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>
31 #import "UIxContactsListView.h"
33 @implementation UIxContactsListView
37 if ((self = [super init]))
39 selectorComponentClass = nil;
54 - (void) setCurrentContact: (NSDictionary *) _contact
56 currentContact = _contact;
59 - (NSDictionary *) currentContact
61 return currentContact;
64 - (void) setSearchText: (NSString *) _txt
66 ASSIGNCOPY (searchText, _txt);
72 [self setSearchText: [self queryParameterForKey:@"search"]];
77 - (id <WOActionResults>) mailerContactsAction
79 selectorComponentClass = @"UIxContactsMailerSelection";
84 - (id <WOActionResults>) deleteAction
86 id <WOActionResults> result;
87 NSException <WOActionResults> *ex;
90 ex = [[self clientObject] delete];
95 response = [context response];
96 [response setStatus: 200];
103 - (NSString *) defaultSortKey
108 - (NSString *) displayName
110 NSString *displayName;
112 displayName = [currentContact objectForKey: @"displayName"];
113 if (!(displayName && [displayName length] > 0))
114 displayName = [currentContact objectForKey: @"cn"];
119 - (NSString *) sortKey
123 s = [self queryParameterForKey: @"sort"];
125 s = [self defaultSortKey];
130 - (NSComparisonResult) sortOrdering
132 return ([[self queryParameterForKey:@"desc"] boolValue]
133 ? NSOrderedDescending
134 : NSOrderedAscending);
137 - (NSArray *) contactInfos
139 id <SOGoContactFolder> folder;
141 folder = [self clientObject];
143 return [folder lookupContactsWithFilter: [self searchText]
144 sortBy: [self sortKey]
145 ordering: [self sortOrdering]];
154 [searchText release];
157 currentContact = nil;
158 // [allRecords release];
160 // [filteredRecords release];
161 // filteredRecords = nil;
167 - (BOOL) shouldTakeValuesFromRequest: (WORequest *) _rq
168 inContext: (WOContext*) _c
173 - (WOResponse *) canAccessContentAction
175 WOResponse *response;
176 NSString *clientClass;
178 clientClass = NSStringFromClass([[self clientObject] class]);
180 response = [context response];
181 [response setStatus: 200];
182 [response setHeader: @"text/plain; charset=\"ascii\""
183 forKey: @"content-type"];
186 ([clientClass isEqualToString: @"SOGoContactLDAPFolder"])
192 @end /* UIxContactsListView */