See ChangeLog.

Monotone-Parent: f6c6bfab15922450127ccb9597bbc97468d695c0
Monotone-Revision: afd67b085b60bc29f1319198a1796a532db22ebf

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-10-21T20:12:38
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Francis Lachapelle 2011-10-21 20:12:38 +00:00
parent 19169e821d
commit f1da116a55
9 changed files with 75 additions and 25 deletions

View File

@ -1,3 +1,26 @@
2011-10-21 Francis Lachapelle <flachapelle@inverse.ca>
* SoObjects/SOGo/SOGoUserManager.m
(-_compactAndCompleteContacts:): add the key "isGroup" when defined.
* UI/MainUI/SOGoUserHomePage.m (:_usersForResults:inDomain:):
add a boolean value in the returning array that identifies if the
user is actually a group.
* UI/Common/UIxAclEditor.m (-currentUserClass): return the CSS
class that identifies the user as a single contact or list of contacts.
* UI/WebServerResources/UIxContactsUserFolders.js
(addUserLineToTree): extract the new field that is set to 1 when
the user is actually a group.
* UI/WebServerResources/UIxAclEditor.js (addUser): new argument to
to identify the type of user (person or group).
* UI/WebServerResources/UIxMailToSelection.js
(expandContactListCallback): don't expand contacts without an
email address.
2011-10-19 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreDraftsMessage.m (-getPrDisplayTo:inMemCtx:)

View File

@ -804,6 +804,7 @@
NSArray *newContacts;
NSMutableArray *emails;
NSString *uid, *email, *info;
NSNumber *isGroup;
compactContacts = [NSMutableDictionary dictionary];
while ((userEntry = [contacts nextObject]))
@ -844,6 +845,9 @@
&& ![[returnContact objectForKey: @"c_info"] length])
[returnContact setObject: info forKey: @"c_info"];
[self _fillContactMailRecords: returnContact];
isGroup = [userEntry objectForKey: @"isGroup"];
if (isGroup)
[returnContact setObject: isGroup forKey: @"isGroup"];
}
}

View File

@ -96,9 +96,6 @@
aclsEnum = [[self aclsForObject] objectEnumerator];
while ((currentUID = [aclsEnum nextObject]))
{
if ([currentUID hasPrefix: @"@"])
// NOTE: don't remove the prefix if we want to identify the lists visually
currentUID = [currentUID substringFromIndex: 1];
if (!([currentUID isEqualToString: ownerLogin]
|| [currentUID isEqualToString: defaultUserID]
|| [currentUID isEqualToString: @"anonymous"]))
@ -117,20 +114,25 @@
- (NSString *) currentUser
{
return currentUser;
return ([currentUser hasPrefix: @"@"]
? [currentUser substringFromIndex: 1]
: currentUser);
}
- (NSString *) currentUserClass
{
return ([currentUser hasPrefix: @"@"]
? @"normal-group"
: @"normal-user");
}
- (NSString *) currentUserDisplayName
{
SOGoUserManager *um;
NSString *s;
um = [SOGoUserManager sharedUserManager];
s = ([currentUser hasPrefix: @"@"]
? [currentUser substringFromIndex: 1]
: currentUser);
return [um getFullEmailForUID: s];
return [um getFullEmailForUID: [self currentUser]];
}
- (BOOL) canSubscribeUsers

View File

@ -326,7 +326,7 @@
NSMutableArray *jsonResponse, *jsonLine;
NSArray *allUsers;
int count, max;
BOOL activeUserIsInDomain;
BOOL activeUserIsInDomain, isGroup;
login = [[context activeUser] login];
activeUserIsInDomain = ([domain length] == 0 || [[[context activeUser] domain] isEqualToString: domain]);
@ -352,6 +352,7 @@
[jsonLine addObject: uid];
[jsonLine addObject: [contact objectForKey: @"cn"]];
[jsonLine addObject: [contact objectForKey: @"c_email"]];
[jsonLine addObject: [NSNumber numberWithBool: [[contact objectForKey: @"isGroup"] boolValue]]];
contactInfo = [contact objectForKey: @"c_info"];
if (contactInfo)
[jsonLine addObject: contactInfo];

View File

@ -38,7 +38,7 @@
</div>
<ul id="userList">
<var:foreach list="usersForObject" item="currentUser"
><li var:id="currentUser" class="normal-user">
><li var:id="currentUser" var:class="currentUserClass">
<span class="userFullName"
><var:string value="currentUserDisplayName"
/></span>

View File

@ -51,9 +51,13 @@ UL#userList LI
background-repeat: no-repeat;
background-position: 4px center; }
UL#userList LI.normal-user
UL#userList LI.normal-user,
UL#userList LI.normal-person
{ background-image: url("abcard.png"); }
UL#userList LI.normal-group
{ background-image: url("ablist.png"); }
UL#userList LI.any-user
{ background-image: url("abcard-anyone.png");
border-top: 1px dotted #555; }

View File

@ -9,18 +9,18 @@ var AclEditor = {
var usersToSubscribe = [];
function addUser(userName, userID) {
function addUser(userName, userID, type) {
var result = false;
if (!$(userID)) {
var ul = $("userList");
var lis = ul.childNodesWithTag("li");
var newNode = nodeForUser(userName, userID, canSubscribeUsers);
newNode.addClassName("normal-user");
newNode.addClassName("normal-" + type);
var count = lis.length - 1;
var nextLi = null;
while (count > -1 && !nextLi) {
if ($(lis[count]).hasClassName("normal-user")) {
if ($(lis[count]).hasClassName("normal-person")) {
nextLi = lis[count+1];
}
else {
@ -142,7 +142,8 @@ function subscribeToFolder(refreshCallback, refreshCallbackData) {
var result = true;
if (UserLogin != refreshCallbackData["folder"]) {
result = addUser(refreshCallbackData["folderName"],
refreshCallbackData["folder"]);
refreshCallbackData["folder"],
refreshCallbackData["type"]);
}
else
refreshCallbackData["window"].alert(_("You cannot subscribe to a folder that you own!"));
@ -223,9 +224,9 @@ function onAclCloseHandler(event) {
+ "/subscribeUsers?uids=" + usersToSubscribe.join(","));
new Ajax.Request(url, {
asynchronous: false,
method: 'get',
onFailure: function(transport) {
log("Can't expunge current folder: " + transport.status);
method: 'get',
onFailure: function(transport) {
log("Can't subscribe users: " + transport.status);
}
});
}

View File

@ -37,15 +37,26 @@ function usersSearchCallback(http) {
}
function addUserLineToTree(tree, parent, line) {
// line[0] = uid
// line[1] = cn
// line[2] = email
// line[3] = 1 if it's a group
// line[4] = contact info
var icon = ResourcesURL + '/busy.gif';
var email = line[1] + " &lt;" + line[2] + "&gt;";
if (line[3] && !line[3].empty())
email += ", " + line[3].split("\n").join("; "); // extra contact info
tree.add(parent, 0, email, 0, '#', line[0], 'person',
if (line[4] && !line[4].empty())
email += ", " + line[4].split("\n").join("; "); // extra contact info
var icon_card = 'abcard.png';
var datatype = 'person';
if (line[3]) {
icon_card = 'ablist.png';
datatype = 'group';
}
tree.add(parent, 0, email, 0, '#', line[0], datatype,
'', '',
ResourcesURL + '/abcard.png',
ResourcesURL + '/abcard.png');
ResourcesURL + '/' + icon_card,
ResourcesURL + '/' + icon_card);
if (window.opener.userFolderType != "user") {
tree.add(parent + 1, parent, _("Please wait..."), 0, '#', null,
null, '', '', icon, icon);
@ -198,6 +209,7 @@ function onConfirmFolderSelection(event) {
if (topNode && topNode.selectedEntry) {
var node = topNode.selectedEntry.parentNode;
var folder = node.getAttribute("dataname");
var type = node.getAttribute("datatype");
var folderName;
if (window.opener.userFolderType == "user") {
@ -217,7 +229,7 @@ function onConfirmFolderSelection(event) {
folderName = folderName.replace(/>,.*(\))?$/, ">)$1", "g");
}
var data = { folderName: folderName, folder: folder, window: window };
var data = { folderName: folderName, folder: folder, type: type, window: window };
if (parent$(accessToSubscribedFolder(folder)))
window.alert(_("You have already subscribed to that folder!"));
else

View File

@ -107,6 +107,9 @@ function expandContactListCallback (http) {
if (http.status == 200) {
var data = http.responseText.evalJSON(true);
// TODO: Should check for duplicated entries
for (var i = data.length - 1; i >= 0; i--)
// Remove contacts with no email address
if (data[i][2].length == 0) data.splice(i, 1);
if (data.length >= 1) {
var text = data[0][2];
if (data[0][1].length)