mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-11 14:57:12 +00:00
Monotone-Parent: 87a9edec020f812d113ea5bde21c2d30b040ab87
Monotone-Revision: c00d2fadae3d5733fb53c91e14b43a56d1e1ca58 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-06-11T19:55:13 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
1 parent
b74da846f2
commit
5643fd2f3f
7 files changed
+60
-42
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user