From 0797fb9a62cf0980be5e2a50f241391e8f87e348 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 4 Jul 2008 09:43:28 +0000 Subject: [PATCH] Monotone-Parent: 10716bba581bb0dd4ad881e814040b2adb37ba10 Monotone-Revision: 305966069ea6e632bec9f09e6fd85e54295efb03 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2008-07-04T09:43:28 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++ UI/Contacts/UIxContactFoldersView.h | 1 + UI/Contacts/UIxContactFoldersView.m | 46 +++++++++++ UI/Contacts/product.plist | 5 ++ UI/Templates/MailerUI/UIxMailEditor.wox | 2 +- .../SchedulerUI/UIxAttendeesEditor.wox | 2 +- UI/WebServerResources/UIxAttendeesEditor.js | 77 +++++++++++-------- UI/WebServerResources/UIxMailEditor.js | 62 ++++++++------- UI/WebServerResources/generic.css | 25 ++++-- 9 files changed, 159 insertions(+), 67 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79deaa84c..d8ebdc223 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-07-07 Francis Lachapelle + + * UI/Contacts/UIxContactFoldersView.m ([WOActionResults + allContactSearchAction]): new method to search contacts among + all address books. + 2008-07-04 Wolfgang Sourdeau * SoObjects/SOGo/SOGoObject.m ([SOGoObject diff --git a/UI/Contacts/UIxContactFoldersView.h b/UI/Contacts/UIxContactFoldersView.h index 507b522d9..76f92740a 100644 --- a/UI/Contacts/UIxContactFoldersView.h +++ b/UI/Contacts/UIxContactFoldersView.h @@ -24,6 +24,7 @@ #define UIXCONTACTFOLDERSVIEW_H #import +#import @interface UIxContactFoldersView : UIxComponent { diff --git a/UI/Contacts/UIxContactFoldersView.m b/UI/Contacts/UIxContactFoldersView.m index f6a2d1393..0b7c42e99 100644 --- a/UI/Contacts/UIxContactFoldersView.m +++ b/UI/Contacts/UIxContactFoldersView.m @@ -179,6 +179,52 @@ return response; } +- (id ) allContactSearchAction +{ + id result; + id folder; + NSString *searchText; + NSArray *folders, *contacts, *descriptors, *sortedContacts; + NSMutableArray *allContacts; + unsigned int i; + NSSortDescriptor *displayNameDescriptor; + + searchText = [self queryParameterForKey: @"search"]; + if ([searchText length] > 0) + { + folders = [[self clientObject] subFolders]; + allContacts = [NSMutableArray new]; + for (i = 0; i < [folders count]; i++) { + folder = [folders objectAtIndex: i]; + //NSLog(@"Address book: %@ (%@)", [folder displayName], [folder class]); + contacts = [folder lookupContactsWithFilter: searchText + sortBy: @"displayName" + ordering: NSOrderedAscending]; + if ([contacts count] > 0) { + [allContacts addObjectsFromArray: contacts]; + } + } + + result = [context response]; + if ([allContacts count] > 0) { + // Sort the contacts by display name + displayNameDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"displayName" + ascending:YES] autorelease]; + descriptors = [NSArray arrayWithObjects: displayNameDescriptor, nil]; + sortedContacts = [allContacts sortedArrayUsingDescriptors:descriptors]; + + [(WOResponse*)result appendContentString: [sortedContacts jsonRepresentation]]; + } + else + [(WOResponse*)result setStatus: 404]; + } + else + result = [NSException exceptionWithHTTPStatus: 400 + reason: @"missing 'search' parameter"]; + + return result; +} + - (id ) contactSearchAction { NSString *contact; diff --git a/UI/Contacts/product.plist b/UI/Contacts/product.plist index 2d50fd20b..c47f89180 100644 --- a/UI/Contacts/product.plist +++ b/UI/Contacts/product.plist @@ -22,6 +22,11 @@ pageName = "UIxContactFoldersView"; actionName = "contactSearch"; }; + allContactSearch = { + protectedBy = ""; + pageName = "UIxContactFoldersView"; + actionName = "allContactSearch"; + }; updateAdditionalAddressBooks = { protectedBy = "View"; pageName = "UIxContactFoldersView"; diff --git a/UI/Templates/MailerUI/UIxMailEditor.wox b/UI/Templates/MailerUI/UIxMailEditor.wox index bba37d7fa..61caaedff 100644 --- a/UI/Templates/MailerUI/UIxMailEditor.wox +++ b/UI/Templates/MailerUI/UIxMailEditor.wox @@ -14,7 +14,7 @@ -