mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-21 15:02:40 +00:00
Monotone-Parent: f1b87d4db17a8caa13d51a72ad2dfbc796ac7d8f
Monotone-Revision: f584f3f14a5068b2832a02797f1f2468d9232033 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-12-05T21:05:04 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
1 parent
f431b1f55f
commit
2c665af66c
9 files changed
+127
-131
No files matched your search
@@ -24,6 +24,7 @@
|
||||
#import <NGObjWeb/WOCookie.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <NGObjWeb/WOResponse.h>
|
||||
|
||||
#import <NGExtensions/NGBase64Coding.h>
|
||||
#import <NGExtensions/NSNull+misc.h>
|
||||
#import <NGExtensions/NSString+misc.h>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGObjWeb/WOCookie.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <NGObjWeb/WOResponse.h>
|
||||
@@ -36,6 +37,7 @@
|
||||
#import <Appointments/SOGoFreeBusyObject.h>
|
||||
#import <SoObjects/SOGo/SOGoWebAuthenticator.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
#import <SoObjects/SOGo/SOGoUserFolder.h>
|
||||
#import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
|
||||
#import <SOGoUI/UIxComponent.h>
|
||||
|
||||
@@ -230,4 +232,85 @@ static NSString *defaultModule = nil;
|
||||
return response;
|
||||
}
|
||||
|
||||
- (NSString *) _foldersStringForFolders: (NSEnumerator *) folders
|
||||
{
|
||||
NSMutableString *foldersString;
|
||||
NSDictionary *currentFolder;
|
||||
|
||||
foldersString = [NSMutableString new];
|
||||
[foldersString autorelease];
|
||||
|
||||
currentFolder = [folders nextObject];
|
||||
while (currentFolder)
|
||||
{
|
||||
[foldersString appendFormat: @";%@:%@:%@",
|
||||
[currentFolder objectForKey: @"displayName"],
|
||||
[currentFolder objectForKey: @"name"],
|
||||
[currentFolder objectForKey: @"type"]];
|
||||
currentFolder = [folders nextObject];
|
||||
}
|
||||
|
||||
return foldersString;
|
||||
}
|
||||
|
||||
- (WOResponse *) _foldersResponseForResults: (NSDictionary *) results
|
||||
{
|
||||
WOResponse *response;
|
||||
NSString *uid, *foldersString;
|
||||
NSMutableString *responseString;
|
||||
NSDictionary *contact;
|
||||
NSEnumerator *contacts;
|
||||
NSArray *folders;
|
||||
|
||||
response = [context response];
|
||||
[response setStatus: 200];
|
||||
[response setHeader: @"text/plain; charset=utf-8"
|
||||
forKey: @"Content-Type"];
|
||||
|
||||
responseString = [NSMutableString new];
|
||||
contacts = [[results allKeys] objectEnumerator];
|
||||
while ((contact = [contacts nextObject]))
|
||||
{
|
||||
uid = [contact objectForKey: @"c_uid"];
|
||||
folders = [results objectForKey: contact];
|
||||
foldersString
|
||||
= [self _foldersStringForFolders: [folders objectEnumerator]];
|
||||
[responseString appendFormat: @"%@:%@:%@%@\n", uid,
|
||||
[contact objectForKey: @"cn"],
|
||||
[contact objectForKey: @"c_email"],
|
||||
foldersString];
|
||||
}
|
||||
[response appendContentString: responseString];
|
||||
[responseString release];
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) foldersSearchAction
|
||||
{
|
||||
NSString *contact, *folderType;
|
||||
NSDictionary *folders;
|
||||
id <WOActionResults> result;
|
||||
|
||||
contact = [self queryParameterForKey: @"search"];
|
||||
if ([contact length])
|
||||
{
|
||||
folderType = [self queryParameterForKey: @"type"];
|
||||
if ([folderType length])
|
||||
{
|
||||
folders = [[self clientObject] foldersOfType: folderType
|
||||
matchingUID: contact];
|
||||
result = [self _foldersResponseForResults: folders];
|
||||
}
|
||||
else
|
||||
result = [NSException exceptionWithHTTPStatus: 400
|
||||
reason: @"missing 'type' parameter"];
|
||||
}
|
||||
else
|
||||
result = [NSException exceptionWithHTTPStatus: 400
|
||||
reason: @"missing 'search' parameter"];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -113,6 +113,11 @@
|
||||
pageName = "SOGoUserHomePage";
|
||||
actionName = "logoff";
|
||||
};
|
||||
foldersSearch = {
|
||||
protectedBy = "View";
|
||||
pageName = "SOGoUserHomePage";
|
||||
actionName = "foldersSearch";
|
||||
};
|
||||
};
|
||||
};
|
||||
SOGoGroupsFolder = {
|
||||
|
||||
Reference in new issue
Block a user