Ajaxifed the addressbook module. See ChangeLog.

Monotone-Parent: cb0ecd99fcf222060f6e3bc248d2e9a9c47624c1
Monotone-Revision: 1cdaff22cdbdb961e1937dc8f1ac1936bd06dc99

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-04-14T18:01:02
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle
2011-04-14 18:01:02 +00:00
parent a9806e6b6d
commit a7d852fbec
9 changed files with 249 additions and 119 deletions
+5 -5
View File
@@ -9,7 +9,7 @@ ContactsUI_PRINCIPAL_CLASS = ContactsUIProduct
ContactsUI_LANGUAGES = BrazilianPortuguese Catalan Czech Dutch English French German Hungarian Italian Norwegian Polish Russian Spanish Swedish Ukrainian Welsh
ContactsUI_OBJC_FILES = \
UIxContactsUserFolders.m \
UIxContactsUserFolders.m \
UIxContactsMailerSelection.m \
UIxContactsUserRightsEditor.m \
\
@@ -18,10 +18,10 @@ ContactsUI_OBJC_FILES = \
UIxContactActions.m \
UIxContactView.m \
UIxContactEditor.m \
UIxListView.m \
UIxListEditor.m \
UIxContactsListView.m \
UIxContactFoldersView.m \
UIxListView.m \
UIxListEditor.m \
UIxContactsListActions.m \
UIxContactFoldersView.m \
UIxContactFolderActions.m
ContactsUI_RESOURCE_FILES += \
+3
View File
@@ -29,6 +29,7 @@
@interface UIxContactFoldersView : UIxComponent
{
SOGoUserSettings *us;
NSDictionary *currentContact;
NSString *selectorComponentClass;
NSMutableDictionary *moduleSettings;
id currentFolder;
@@ -37,6 +38,8 @@
- (NSArray *) contactFolders;
- (NSArray *) personalContactInfos;
- (NSString *) currentContactFolderId;
- (NSString *) currentContactFolderOwner;
- (NSString *) currentContactFolderName;
+32
View File
@@ -87,6 +87,38 @@
}
}
- (void) setCurrentContact: (NSDictionary *) _contact
{
currentContact = _contact;
}
- (NSDictionary *) currentContact
{
return currentContact;
}
- (NSString *) currentContactClasses
{
return [[currentContact objectForKey: @"c_component"] lowercaseString];
}
- (NSArray *) personalContactInfos
{
SOGoContactFolders *folders;
id <SOGoContactFolder> folder;
NSArray *contactInfos;
folders = [self clientObject];
folder = [folders lookupPersonalFolder: @"personal" ignoringRights: YES];
contactInfos = [folder lookupContactsWithFilter: nil
onCriteria: nil
sortBy: @"c_cn"
ordering: NSOrderedAscending];
return contactInfos;
}
- (id <WOActionResults>) mailerContactsAction
{
selectorComponentClass = @"UIxContactsMailerSelection";
@@ -19,17 +19,17 @@
02111-1307, USA.
*/
#ifndef __UIxContactsListView_H__
#define __UIxContactsListView_H__
#ifndef __UIxContactsListActions_H__
#define __UIxContactsListActions_H__
#import <SOGoUI/UIxComponent.h>
#import <NGObjWeb/WODirectAction.h>
@class NSDictionary;
@class NSString;
@protocol SOGoContactObject;
@interface UIxContactsListView : UIxComponent
@interface UIxContactsListActions : WODirectAction
{
NSDictionary *currentContact;
NSArray *contactInfos;
@@ -37,4 +37,4 @@
@end
#endif /* __UIxContactsListView_H__ */
#endif /* __UIxContactsListActions_H__ */
@@ -1,5 +1,5 @@
/*
Copyright (C) 2006-2010 Inverse inc.
Copyright (C) 2006-2011 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
@@ -32,6 +32,8 @@
#import <NGExtensions/NSString+misc.h>
#import <NGExtensions/NSNull+misc.h>
#import <Common/WODirectAction+SOGo.h>
#import <Contacts/SOGoContactObject.h>
#import <Contacts/SOGoContactFolder.h>
#import <Contacts/SOGoContactFolders.h>
@@ -44,9 +46,9 @@
#import <SoObjects/Contacts/SOGoContactGCSFolder.h>
#import <GDLContentStore/GCSFolder.h>
#import "UIxContactsListView.h"
#import "UIxContactsListActions.h"
@implementation UIxContactsListView
@implementation UIxContactsListActions
- (id) init
{
@@ -64,16 +66,6 @@
/* accessors */
- (void) setCurrentContact: (NSDictionary *) _contact
{
currentContact = _contact;
}
- (NSDictionary *) currentContact
{
return currentContact;
}
- (NSString *) defaultSortKey
{
return @"c_cn";
@@ -82,8 +74,10 @@
- (NSString *) sortKey
{
NSString *s;
WORequest *rq;
s = [self queryParameterForKey: @"sort"];
rq = [context request];
s = [rq formValueForKey: @"sort"];
if (![s length])
s = [self defaultSortKey];
@@ -95,18 +89,20 @@
id <SOGoContactFolder> folder;
NSString *ascending, *searchText, *valueText;
NSComparisonResult ordering;
WORequest *rq;
if (!contactInfos)
{
folder = [self clientObject];
rq = [context request];
ascending = [self queryParameterForKey: @"asc"];
ascending = [rq formValueForKey: @"asc"];
ordering = ((![ascending length] || [ascending boolValue])
? NSOrderedAscending : NSOrderedDescending);
searchText = [self queryParameterForKey: @"search"];
searchText = [rq formValueForKey: @"search"];
if ([searchText length] > 0)
valueText = [self queryParameterForKey: @"value"];
valueText = [rq formValueForKey: @"value"];
else
valueText = nil;
@@ -121,9 +117,21 @@
return contactInfos;
}
- (NSString *) currentContactClasses
/**
* Retrieve the addressbook contacts with respect to the sort and
* search criteria.
* @return a JSON array of dictionaries representing the contacts.
*/
- (id <WOActionResults>) contactsListAction
{
return [[currentContact objectForKey: @"c_component"] lowercaseString];
id <WOActionResults> result;
NSArray *contactsList;
contactsList = [self contactInfos];
result = [self responseWithStatus: 200
andString: [contactsList jsonRepresentation]];
return result;
}
- (id <WOActionResults>) contactSearchAction
@@ -136,11 +144,12 @@
NSMutableDictionary *uniqueContacts;
unsigned int i;
NSSortDescriptor *commonNameDescriptor;
WORequest *rq;
searchText = [self queryParameterForKey: @"search"];
rq = [context request];
searchText = [rq formValueForKey: @"search"];
if ([searchText length] > 0)
{
folder = nil;
NS_DURING
folder = [self clientObject];
NS_HANDLER
@@ -176,9 +185,8 @@
data = [NSDictionary dictionaryWithObjectsAndKeys: searchText, @"searchText",
sortedContacts, @"contacts", nil];
result = [self responseWithStatus: 200];
[(WOResponse*)result appendContentString: [data jsonRepresentation]];
result = [self responseWithStatus: 200
andString: [data jsonRepresentation]];
}
else
result = [NSException exceptionWithHTTPStatus: 400
@@ -187,13 +195,4 @@
return result;
}
/* actions */
- (BOOL) shouldTakeValuesFromRequest: (WORequest *) _rq
inContext: (WOContext*) _c
{
return YES;
}
@end /* UIxContactsListView */
@end /* UIxContactsListActions */
+7 -5
View File
@@ -71,11 +71,12 @@
methods = {
view = {
protectedBy = "View";
pageName = "UIxContactsListView";
actionClass = "UIxContactsListActions";
actionName = "contactsList";
};
contactSearch = {
protectedBy = "<public>";
pageName = "UIxContactsListView";
actionClass = "UIxContactsListActions";
actionName = "contactSearch";
};
newcontact = {
@@ -90,7 +91,7 @@
};
mailer-contacts = {
protectedBy = "View";
pageName = "UIxContactsListView";
pageName = "UIxContactFoldersView";
actionName = "mailerContacts";
};
export = {
@@ -130,7 +131,8 @@
methods = {
view = {
protectedBy = "<public>";
pageName = "UIxContactsListView";
actionClass = "UIxContactsListActions";
actionName = "contactsList";
};
newcontact = {
protectedBy = "<public>";
@@ -139,7 +141,7 @@
};
mailer-contacts = {
protectedBy = "<public>";
pageName = "UIxContactsListView";
pageName = "UIxContactFoldersView";
actionName = "mailerContacts";
};
canAccessContent = {