Monotone-Parent: f1b87d4db17a8caa13d51a72ad2dfbc796ac7d8f
Monotone-Revision: f584f3f14a5068b2832a02797f1f2468d9232033 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-12-05T21:05:04 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
f431b1f55f
commit
2c665af66c
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2007-12-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/MainUI/SOGoUserHomePage.m ([SOGoUserHomePage
|
||||
-foldersSearchAction]): make use of the new search methods in
|
||||
SOGoUserFolder (see below).
|
||||
|
||||
* UI/Contacts/UIxContactFoldersView.m ([-foldersSearchAction]):
|
||||
moved method into ../MainUI/SOGoUserHomePage.m.
|
||||
|
||||
* SoObjects/SOGo/SOGoUserFolder.m ([SOGoUserFolder
|
||||
-foldersOfType:folderTypeforUID:uid]): only return folders owned
|
||||
by the specified user.
|
||||
|
||||
2007-12-05 Francis Lachapelle <flachapelle@inverse.ca>
|
||||
|
||||
* SoObjects/Mailer/SOGoDraftObject.m: The condition for replyToAll
|
||||
|
|
|
@ -131,18 +131,16 @@
|
|||
return filter;
|
||||
}
|
||||
|
||||
#warning UIxContactsFoldersView should use these methods\
|
||||
instead from now on...
|
||||
|
||||
- (NSArray *) _subFoldersFromFolder: (SOGoParentFolder *) parentFolder
|
||||
{
|
||||
NSMutableArray *folders;
|
||||
NSEnumerator *subfolders;
|
||||
SOGoFolder *currentFolder;
|
||||
NSString *folderName;
|
||||
NSString *folderName, *folderOwner;
|
||||
NSMutableDictionary *currentDictionary;
|
||||
SoSecurityManager *securityManager;
|
||||
|
||||
folderOwner = [parentFolder ownerInContext: context];
|
||||
securityManager = [SoSecurityManager sharedSecurityManager];
|
||||
|
||||
folders = [NSMutableArray array];
|
||||
|
@ -151,7 +149,9 @@
|
|||
while ((currentFolder = [subfolders nextObject]))
|
||||
{
|
||||
if (![securityManager validatePermission: SOGoPerm_AccessObject
|
||||
onObject: currentFolder inContext: context])
|
||||
onObject: currentFolder inContext: context]
|
||||
&& [[currentFolder ownerInContext: context]
|
||||
isEqualToString: folderOwner])
|
||||
{
|
||||
folderName = [NSString stringWithFormat: @"/%@/%@",
|
||||
[parentFolder nameInContainer],
|
||||
|
|
|
@ -221,121 +221,6 @@
|
|||
return folders;
|
||||
}
|
||||
|
||||
- (NSArray *) _foldersForUID: (NSString *) uid
|
||||
ofType: (NSString *) folderType
|
||||
{
|
||||
NSObject *topFolder, *userFolder;
|
||||
SOGoParentFolder *parentFolder;
|
||||
NSMutableArray *folders;
|
||||
|
||||
folders = [NSMutableArray new];
|
||||
[folders autorelease];
|
||||
|
||||
topFolder = [[[self clientObject] container] container];
|
||||
userFolder = [topFolder lookupName: uid inContext: context acquire: NO];
|
||||
|
||||
/* FIXME: should be moved in the SOGo* classes. Maybe by having a SOGoFolderManager. */
|
||||
if ([folderType length] == 0 || [folderType isEqualToString: @"calendar"])
|
||||
{
|
||||
parentFolder = [userFolder lookupName: @"Calendar"
|
||||
inContext: context acquire: NO];
|
||||
[folders
|
||||
addObjectsFromArray: [self _subFoldersFromFolder: parentFolder]];
|
||||
}
|
||||
if ([folderType length] == 0 || [folderType isEqualToString: @"contact"])
|
||||
{
|
||||
parentFolder = [userFolder lookupName: @"Contacts"
|
||||
inContext: context acquire: NO];
|
||||
[folders
|
||||
addObjectsFromArray: [self _subFoldersFromFolder: parentFolder]];
|
||||
}
|
||||
|
||||
return folders;
|
||||
}
|
||||
|
||||
- (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: (NSArray *) results
|
||||
withType: (NSString *) folderType
|
||||
{
|
||||
WOResponse *response;
|
||||
NSString *uid, *foldersString;
|
||||
NSMutableString *responseString;
|
||||
NSDictionary *contact;
|
||||
NSEnumerator *contacts;
|
||||
NSArray *folders;
|
||||
|
||||
response = [context response];
|
||||
|
||||
if ([results count])
|
||||
{
|
||||
[response setStatus: 200];
|
||||
[response setHeader: @"text/plain; charset=utf-8"
|
||||
forKey: @"Content-Type"];
|
||||
|
||||
responseString = [NSMutableString new];
|
||||
contacts = [results objectEnumerator];
|
||||
while ((contact = [contacts nextObject]))
|
||||
{
|
||||
uid = [contact objectForKey: @"c_uid"];
|
||||
folders = [self _foldersForUID: uid ofType: folderType];
|
||||
foldersString
|
||||
= [self _foldersStringForFolders: [folders objectEnumerator]];
|
||||
[responseString appendFormat: @"%@:%@:%@%@\n", uid,
|
||||
[contact objectForKey: @"cn"],
|
||||
[contact objectForKey: @"c_email"],
|
||||
foldersString];
|
||||
}
|
||||
[response appendContentString: responseString];
|
||||
[responseString release];
|
||||
}
|
||||
else
|
||||
[response setStatus: 404];
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) foldersSearchAction
|
||||
{
|
||||
NSString *contact, *folderType;
|
||||
id <WOActionResults> result;
|
||||
LDAPUserManager *um;
|
||||
|
||||
um = [LDAPUserManager sharedUserManager];
|
||||
contact = [self queryParameterForKey: @"search"];
|
||||
if ([contact length] > 0)
|
||||
{
|
||||
folderType = [self queryParameterForKey: @"type"];
|
||||
result
|
||||
= [self _foldersResponseForResults: [um fetchContactsMatching: contact]
|
||||
withType: folderType];
|
||||
}
|
||||
else
|
||||
result = [NSException exceptionWithHTTPStatus: 400
|
||||
reason: @"missing 'search' parameter"];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// - (SOGoContactGCSFolder *) contactFolderForUID: (NSString *) uid
|
||||
// {
|
||||
// SOGoFolder *upperContainer;
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
pageName = "UIxContactFoldersView";
|
||||
actionName = "contactSearch";
|
||||
};
|
||||
foldersSearch = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxContactFoldersView";
|
||||
actionName = "foldersSearch";
|
||||
};
|
||||
updateAdditionalAddressBooks = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxContactFoldersView";
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
function onSearchFormSubmit() {
|
||||
var searchValue = $("searchValue");
|
||||
|
||||
var url = (ApplicationBaseURL
|
||||
+ "/foldersSearch?ldap-only=YES&search=" + escape(searchValue.value)
|
||||
var url = (UserFolderURL
|
||||
+ "foldersSearch?search=" + escape(searchValue.value)
|
||||
+ "&type=" + window.opener.userFolderType);
|
||||
if (document.userFoldersRequest) {
|
||||
document.userFoldersRequest.aborted = true;
|
||||
|
@ -97,6 +97,7 @@ function userFoldersCallback(http) {
|
|||
if (http.status == 200) {
|
||||
var response = http.responseText;
|
||||
div.innerHTML = buildTree(http.responseText);
|
||||
div.clean = false;
|
||||
var nodes = document.getElementsByClassName("node", $("d"));
|
||||
for (i = 0; i < nodes.length; i++)
|
||||
Event.observe(nodes[i], "click", onFolderTreeItemClick.bindAsEventListener(nodes[i]));
|
||||
|
@ -136,9 +137,17 @@ function onConfirmFolderSelection(event) {
|
|||
}
|
||||
}
|
||||
|
||||
function onFolderSearchKeyDown(event) {
|
||||
var div = $("folders");
|
||||
if (!div.clean) {
|
||||
div.innerHTML = "";
|
||||
div.clean = true;
|
||||
}
|
||||
}
|
||||
|
||||
function initUserFoldersWindow() {
|
||||
configureSearchField();
|
||||
Event.observe($("addButton"), "click", onConfirmFolderSelection);
|
||||
$("searchValue").observe("keydown", onFolderSearchKeyDown);
|
||||
$("addButton").observe("click", onConfirmFolderSelection);
|
||||
}
|
||||
|
||||
FastInit.addOnLoad(initUserFoldersWindow);
|
||||
|
|
|
@ -918,7 +918,12 @@ function onSearchKeyDown(event) {
|
|||
if (this.timer)
|
||||
clearTimeout(this.timer);
|
||||
|
||||
this.timer = setTimeout("onSearchFormSubmit()", 1000);
|
||||
if (event.keyCode == 13) {
|
||||
onSearchFormSubmit();
|
||||
event.preventDefault();
|
||||
}
|
||||
else
|
||||
this.timer = setTimeout("onSearchFormSubmit()", 1000);
|
||||
}
|
||||
|
||||
function onSearchFormSubmit(event) {
|
||||
|
|
Loading…
Reference in New Issue