2 Copyright (C) 2004-2005 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #import <Foundation/NSUserDefaults.h>
23 #import <NGObjWeb/WORequest.h>
24 #import <NGObjWeb/SoComponent.h>
25 #import <NGExtensions/NSString+misc.h>
27 #import <SoObjects/Mailer/SOGoMailObject.h>
28 #import <SoObjects/Mailer/SOGoMailAccounts.h>
29 #import <SoObjects/SOGo/NSArray+Utilities.h>
30 #import <SoObjects/SOGo/SOGoUser.h>
31 #import <SOGoUI/UIxComponent.h>
33 #import "UIxMailMainFrame.h"
35 @implementation UIxMailMainFrame
38 - (NSString *) mailAccounts
40 NSArray *accounts, *accountNames;
42 accounts = [[context activeUser] mailAccounts];
43 accountNames = [accounts objectsForKey: @"name"];
45 return [accountNames jsonRepresentation];
48 - (NSString *) pageFormURL
53 u = [[[self context] request] uri];
54 if ((r = [u rangeOfString:@"?"]).length > 0) {
55 /* has query parameters */
56 // TODO: this is ugly, create reusable link facility in SOPE
57 // TODO: remove 'search' and 'filterpopup', preserve sorting
62 qp = [[u substringFromIndex:(r.location + r.length)]
63 componentsSeparatedByString:@"&"];
65 ms = [NSMutableString stringWithCapacity:count * 12];
67 for (i = 0; i < count; i++) {
70 s = [qp objectAtIndex:i];
73 if ([s hasPrefix:@"search="]) continue;
74 if ([s hasPrefix:@"filterpopup="]) continue;
76 if ([ms length] > 0) [ms appendString:@"&"];
80 if ([ms length] == 0) {
81 /* no other query params */
82 u = [u substringToIndex:r.location];
85 u = [u substringToIndex:r.location + r.length];
86 u = [u stringByAppendingString:ms];
90 return [u hasSuffix:@"/"] ? @"view" : @"#";
93 @end /* UIxMailMainFrame */