76803fc033
Monotone-Revision: b008761331f87b28af61153588a5722a842c7ce1 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-08-15T21:09:50 Monotone-Branch: ca.inverse.sogo
94 lines
2.6 KiB
Objective-C
94 lines
2.6 KiB
Objective-C
/*
|
|
Copyright (C) 2004-2005 SKYRIX Software AG
|
|
|
|
This file is part of OpenGroupware.org.
|
|
|
|
OGo is free software; you can redistribute it and/or modify it under
|
|
the terms of the GNU Lesser General Public License as published by the
|
|
Free Software Foundation; either version 2, or (at your option) any
|
|
later version.
|
|
|
|
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with OGo; see the file COPYING. If not, write to the
|
|
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
02111-1307, USA.
|
|
*/
|
|
|
|
#import <Foundation/NSUserDefaults.h>
|
|
#import <NGObjWeb/WORequest.h>
|
|
#import <NGObjWeb/SoComponent.h>
|
|
#import <NGExtensions/NSString+misc.h>
|
|
|
|
#import <SoObjects/Mailer/SOGoMailObject.h>
|
|
#import <SoObjects/Mailer/SOGoMailAccounts.h>
|
|
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
|
#import <SoObjects/SOGo/SOGoUser.h>
|
|
#import <SOGoUI/UIxComponent.h>
|
|
|
|
#import "UIxMailMainFrame.h"
|
|
|
|
@implementation UIxMailMainFrame
|
|
|
|
/* accessors */
|
|
- (NSString *) mailAccounts
|
|
{
|
|
NSArray *accounts, *accountNames;
|
|
|
|
accounts = [[context activeUser] mailAccounts];
|
|
accountNames = [accounts objectsForKey: @"name"];
|
|
|
|
return [accountNames jsonRepresentation];
|
|
}
|
|
|
|
- (NSString *) pageFormURL
|
|
{
|
|
NSString *u;
|
|
NSRange r;
|
|
|
|
u = [[[self context] request] uri];
|
|
if ((r = [u rangeOfString:@"?"]).length > 0) {
|
|
/* has query parameters */
|
|
// TODO: this is ugly, create reusable link facility in SOPE
|
|
// TODO: remove 'search' and 'filterpopup', preserve sorting
|
|
NSMutableString *ms;
|
|
NSArray *qp;
|
|
unsigned i, count;
|
|
|
|
qp = [[u substringFromIndex:(r.location + r.length)]
|
|
componentsSeparatedByString:@"&"];
|
|
count = [qp count];
|
|
ms = [NSMutableString stringWithCapacity:count * 12];
|
|
|
|
for (i = 0; i < count; i++) {
|
|
NSString *s;
|
|
|
|
s = [qp objectAtIndex:i];
|
|
|
|
/* filter out */
|
|
if ([s hasPrefix:@"search="]) continue;
|
|
if ([s hasPrefix:@"filterpopup="]) continue;
|
|
|
|
if ([ms length] > 0) [ms appendString:@"&"];
|
|
[ms appendString:s];
|
|
}
|
|
|
|
if ([ms length] == 0) {
|
|
/* no other query params */
|
|
u = [u substringToIndex:r.location];
|
|
}
|
|
else {
|
|
u = [u substringToIndex:r.location + r.length];
|
|
u = [u stringByAppendingString:ms];
|
|
}
|
|
return u;
|
|
}
|
|
return [u hasSuffix:@"/"] ? @"view" : @"#";
|
|
}
|
|
|
|
@end /* UIxMailMainFrame */
|