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 <NGObjWeb/WOContext.h>
23 #import <NGObjWeb/WOResponse.h>
25 #import <Contacts/SOGoContactObject.h>
26 #import <Contacts/SOGoContactFolder.h>
27 #import <Contacts/SOGoContactFolders.h>
29 #import "UIxContactsListView.h"
31 @implementation UIxContactsListView
35 if ((self = [super init]))
37 selectorComponentClass = nil;
46 [contactInfos release];
52 - (void) setCurrentContact: (NSDictionary *) _contact
54 currentContact = _contact;
57 - (NSDictionary *) currentContact
59 return currentContact;
62 - (id <WOActionResults>) mailerContactsAction
64 selectorComponentClass = @"UIxContactsMailerSelection";
69 - (NSString *) selectorComponentClass
71 return selectorComponentClass;
74 - (id <WOActionResults>) deleteAction
76 id <WOActionResults> result;
77 NSException <WOActionResults> *ex;
80 ex = [[self clientObject] delete];
85 response = [context response];
86 [response setStatus: 200];
93 - (NSString *) defaultSortKey
95 return @"displayName";
98 - (NSString *) sortKey
102 s = [self queryParameterForKey: @"sort"];
104 s = [self defaultSortKey];
109 - (NSArray *) contactInfos
111 id <SOGoContactFolder> folder;
112 NSString *ascending, *searchText, *valueText;
113 NSComparisonResult ordering;
117 folder = [self clientObject];
119 ascending = [self queryParameterForKey: @"asc"];
120 ordering = ((![ascending length] || [ascending boolValue])
121 ? NSOrderedAscending : NSOrderedDescending);
123 searchText = [self queryParameterForKey: @"search"];
124 if ([searchText length] > 0)
125 valueText = [self queryParameterForKey: @"value"];
129 [contactInfos release];
130 contactInfos = [folder lookupContactsWithFilter: valueText
131 sortBy: [self sortKey]
133 [contactInfos retain];
141 - (BOOL) shouldTakeValuesFromRequest: (WORequest *) _rq
142 inContext: (WOContext*) _c
147 @end /* UIxContactsListView */