Monotone-Parent: 87a9edec020f812d113ea5bde21c2d30b040ab87

Monotone-Revision: c00d2fadae3d5733fb53c91e14b43a56d1e1ca58

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2009-06-11T19:55:13
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2009-06-11 19:55:13 +00:00
parent b74da846f2
commit 5643fd2f3f
7 changed files with 60 additions and 42 deletions

View File

@ -1,3 +1,11 @@
2009-06-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MainUI/SOGoUserHomePage.m (-usersSearchAction): do not return
the user information for the current user.
(-foldersSearchAction): the method only search folders for the
owner of the current folder. The "user" parameter has thus been
removed.
2009-06-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/NSString+Utilities.m (-stringByDetectingURLs):

View File

@ -24,7 +24,6 @@
#define SOGOUSERFOLDER_CONTACTS_H
@class NSArray;
@class NSString;
#import <SOGo/SOGoUserFolder.h>

View File

@ -718,7 +718,7 @@ static NSArray *childRecordFields = nil;
currentUser = [localContext activeUser];
if (delegatedUsers && [delegatedUsers count])
if ([delegatedUsers count])
{
if (![currentUser isSuperUser])
{

View File

@ -129,7 +129,8 @@ static NSString *LDAPContactInfoAttribute = nil;
for (count = 0; count < max; count++)
{
node = [children objectAtIndex: count];
componentName = [[(id<DOMElement>)node attribute: @"name"] lowercaseString];
componentName = [[(id<DOMElement>)node attribute: @"name"]
lowercaseString];
[filter setObject: [node textValue] forKey: componentName];
}

View File

@ -289,16 +289,17 @@ static NSString *LDAPContactInfoAttribute = nil;
return response;
}
- (WOResponse *) _usersResponseForResults: (NSEnumerator *) users
- (WOResponse *) _usersResponseForResults: (NSArray *) users
{
WOResponse *response;
NSString *uid;
NSMutableString *responseString;
NSDictionary *contact;
NSString *contactInfo;
NSString *contactInfo, *login;
NSArray *allUsers;
int i;
login = [[context activeUser] login];
response = [context response];
[response setStatus: 200];
[response setHeader: @"text/plain; charset=utf-8"
@ -308,25 +309,28 @@ static NSString *LDAPContactInfoAttribute = nil;
// We sort our array - this is pretty useful for the Web
// interface of SOGo.
allUsers = [[users allObjects]
sortedArrayUsingSelector: @selector(caseInsensitiveDisplayNameCompare:)];
allUsers = [users
sortedArrayUsingSelector: @selector (caseInsensitiveDisplayNameCompare:)];
for (i = 0; i < [allUsers count]; i++)
{
contact = [allUsers objectAtIndex: i];
uid = [contact objectForKey: @"c_uid"];
if ([LDAPContactInfoAttribute length])
{
contactInfo = [contact objectForKey: LDAPContactInfoAttribute];
if (!contactInfo)
contactInfo = @"";
}
else
contactInfo = @"";
[responseString appendFormat: @"%@:%@:%@:%@\n", uid,
[contact objectForKey: @"cn"],
[contact objectForKey: @"c_email"],
contactInfo];
if (![uid isEqualToString: login])
{
if ([LDAPContactInfoAttribute length])
{
contactInfo = [contact objectForKey: LDAPContactInfoAttribute];
if (!contactInfo)
contactInfo = @"";
}
else
contactInfo = @"";
[responseString appendFormat: @"%@:%@:%@:%@\n", uid,
[contact objectForKey: @"cn"],
[contact objectForKey: @"c_email"],
contactInfo];
}
}
[response appendContentString: responseString];
[responseString release];
@ -339,14 +343,13 @@ static NSString *LDAPContactInfoAttribute = nil;
NSString *contact;
id <WOActionResults> result;
LDAPUserManager *um;
NSEnumerator *users;
um = [LDAPUserManager sharedUserManager];
contact = [self queryParameterForKey: @"search"];
if ([contact length])
{
users = [[um fetchUsersMatching: contact] objectEnumerator];
result = [self _usersResponseForResults: users];
result
= [self _usersResponseForResults: [um fetchUsersMatching: contact]];
}
else
result = [NSException exceptionWithHTTPStatus: 400
@ -375,27 +378,23 @@ static NSString *LDAPContactInfoAttribute = nil;
- (id <WOActionResults>) foldersSearchAction
{
NSString *contact, *folderType;
NSString *folderType;
NSArray *folders;
id <WOActionResults> result;
SOGoUserFolder *userFolder;
contact = [self queryParameterForKey: @"user"];
if ([contact length])
folderType = [self queryParameterForKey: @"type"];
if ([folderType length])
{
folderType = [self queryParameterForKey: @"type"];
if ([folderType length])
{
folders = [[self clientObject] foldersOfType: folderType
forUID: contact];
result = [self _foldersResponseForResults: folders];
}
else
result = [NSException exceptionWithHTTPStatus: 400
reason: @"missing 'type' parameter"];
userFolder = [self clientObject];
folders
= [userFolder foldersOfType: folderType
forUID: [userFolder ownerInContext: context]];
result = [self _foldersResponseForResults: folders];
}
else
result = [NSException exceptionWithHTTPStatus: 400
reason: @"missing 'user' parameter"];
reason: @"missing 'type' parameter"];
return result;
}

View File

@ -94,9 +94,9 @@ function onUserNodeToggle(event) {
this.stopObserving("click", onUserNodeToggle);
var person = this.parentNode.getAttribute("dataname");
var url = (UserFolderURL + "foldersSearch"
+ "?user=" + escape(person)
+ "&type=" + window.opener.userFolderType);
var url = (UserFolderURLForUser(person) + "foldersSearch"
+ "?type=" + window.opener.userFolderType);
var nodeId = this.getAttribute("id").substr(3);
triggerAjaxRequest(url, foldersSearchCallback,
{ nodeId: nodeId, user: person });

View File

@ -352,9 +352,7 @@ function getContrastingTextColor(bgColor) {
// Consider all colors with less than 56% brightness as dark colors and
// use white as the foreground color, otherwise use black.
return ((brightness < 144)
? "white"
: "black");
return ((brightness < 144) ? "white" : "black");
}
function triggerAjaxRequest(url, callback, userdata, content, headers) {
@ -1615,6 +1613,19 @@ function configureLinkBanner() {
}
}
/* accessing another user's data */
function UserFolderURLForUser(user) {
var folderArray = UserFolderURL.split("/");
var count;
if (UserFolderURL.endsWith('/'))
count = folderArray.length - 2;
else
count = folderArray.length - 1;
folderArray[count] = escape(user);
return folderArray.join("/");
}
/* folder creation */
function createFolder(name, okCB, notOkCB) {
if (name) {