Monotone-Parent: ef9dde1efccc6f2049760614ab6add61bb302de5
Monotone-Revision: eb3a293c7b6e644d0c97e3f1954550bb78ebb5ef Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-10-26T00:15:12 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
a1a7bcf4f1
commit
21799d8e1f
|
@ -1,5 +1,10 @@
|
|||
2006-10-25 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/Contacts/UIxContactFoldersView.m ([UIxContactFoldersView
|
||||
-contactSearchAction]): new action that returns the uid and the
|
||||
username + email of the user whose name contain the value of the
|
||||
"search" url parameter.
|
||||
|
||||
* SoObjects/Appointments/SOGoAppointmentFolder.m
|
||||
([SOGoAppointmentFolder
|
||||
-fetchFreebusyInfosFrom:_startDateto:_endDate]): added fields
|
||||
|
|
|
@ -21,9 +21,13 @@
|
|||
*/
|
||||
|
||||
#import <Foundation/NSString.h>
|
||||
#import <SoObjects/Contacts/SOGoContactFolders.h>
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGObjWeb/SoObject.h>
|
||||
#import <NGObjWeb/WOResponse.h>
|
||||
|
||||
#import <SOGo/NSString+URL.h>
|
||||
#import <SoObjects/SOGo/NSString+URL.h>
|
||||
#import <SoObjects/Contacts/SOGoContactFolders.h>
|
||||
#import <SoObjects/Contacts/SOGoContactFolder.h>
|
||||
|
||||
#import "common.h"
|
||||
|
||||
|
@ -76,4 +80,92 @@
|
|||
return [self _selectActionForApplication: @"calendars-contacts"];
|
||||
}
|
||||
|
||||
|
||||
- (NSArray *) _searchResults: (NSString *) contact
|
||||
{
|
||||
NSMutableArray *results;
|
||||
SOGoContactFolders *topFolder;
|
||||
NSEnumerator *sogoContactFolders;
|
||||
id <SOGoContactFolder> currentFolder;
|
||||
|
||||
results = [NSMutableArray new];
|
||||
[results autorelease];
|
||||
|
||||
topFolder = [self clientObject];
|
||||
sogoContactFolders = [[topFolder contactFolders] objectEnumerator];
|
||||
currentFolder = [sogoContactFolders nextObject];
|
||||
while (currentFolder)
|
||||
{
|
||||
[results addObjectsFromArray: [currentFolder
|
||||
lookupContactsWithFilter: contact
|
||||
sortBy: @"cn"
|
||||
ordering: NSOrderedAscending]];
|
||||
currentFolder = [sogoContactFolders nextObject];
|
||||
}
|
||||
[topFolder release];
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
- (NSString *) _emailForResult: (NSDictionary *) result
|
||||
{
|
||||
NSMutableString *email;
|
||||
NSString *name, *mail;
|
||||
|
||||
email = [NSMutableString string];
|
||||
name = [result objectForKey: @"displayName"];
|
||||
if (![name length])
|
||||
name = [result objectForKey: @"cn"];
|
||||
mail = [result objectForKey: @"mail"];
|
||||
if ([name length])
|
||||
[email appendFormat: @"%@ <%@>", name, mail];
|
||||
else
|
||||
[email appendString: mail];
|
||||
|
||||
NSLog(@"email: '%@'", email);
|
||||
|
||||
return email;
|
||||
}
|
||||
|
||||
- (WOResponse *) _responseForResults: (NSArray *) results
|
||||
{
|
||||
WOResponse *response;
|
||||
NSString *email, *responseString;
|
||||
NSDictionary *result;
|
||||
|
||||
response = [context response];
|
||||
|
||||
if ([results count])
|
||||
{
|
||||
result = [results objectAtIndex: 0];
|
||||
email = [self _emailForResult: result];
|
||||
responseString = [NSString stringWithFormat: @"%@:%@",
|
||||
[result objectForKey: @"c_uid"],
|
||||
email];
|
||||
[response setStatus: 200];
|
||||
[response setHeader: @"text/plain; charset=iso-8859-1"
|
||||
forKey: @"Content-Type"];
|
||||
[response appendContentString: responseString];
|
||||
}
|
||||
else
|
||||
[response setStatus: 404];
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) contactSearchAction
|
||||
{
|
||||
NSString *contact;
|
||||
id <WOActionResults> result;
|
||||
|
||||
contact = [self queryParameterForKey: @"search"];
|
||||
if ([contact length])
|
||||
result = [self _responseForResults: [self _searchResults: contact]];
|
||||
else
|
||||
result = [NSException exceptionWithHTTPStatus: 400
|
||||
reason: @"missing 'search' parameter"];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -12,28 +12,33 @@
|
|||
methods = {
|
||||
view = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxContactFoldersView";
|
||||
pageName = "UIxContactFoldersView";
|
||||
};
|
||||
new = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxContactFoldersView";
|
||||
pageName = "UIxContactFoldersView";
|
||||
actionName = "new";
|
||||
};
|
||||
scheduler-contacts = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxContactFoldersView";
|
||||
pageName = "UIxContactFoldersView";
|
||||
actionName = "selectForScheduler";
|
||||
};
|
||||
mailer-contacts = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxContactFoldersView";
|
||||
pageName = "UIxContactFoldersView";
|
||||
actionName = "selectForMailer";
|
||||
};
|
||||
calendars-contacts = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxContactFoldersView";
|
||||
pageName = "UIxContactFoldersView";
|
||||
actionName = "selectForCalendars";
|
||||
};
|
||||
contactSearch = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxContactFoldersView";
|
||||
actionName = "contactSearch";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -47,11 +52,11 @@
|
|||
methods = {
|
||||
view = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxContactsListView";
|
||||
pageName = "UIxContactsListView";
|
||||
};
|
||||
new = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxContactEditor";
|
||||
pageName = "UIxContactEditor";
|
||||
actionName = "new";
|
||||
};
|
||||
mailer-contacts = {
|
||||
|
|
Loading…
Reference in New Issue