Monotone-Parent: a641a4defe2d11d4baa914640535e45ef48f0425

Monotone-Revision: 0de048fc2845b8e712e21700f4604fa0cd9eeea4

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-05-28T16:52:17
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-05-28 16:52:17 +00:00
parent df904d06ab
commit eb8125f468
3 changed files with 59 additions and 17 deletions

View File

@@ -135,6 +135,42 @@ function initializePrivacyMenu() {
}
}
function findAttendeeWithFieldValue(field, fieldValue) {
var foundAttendee = null;
var attendeesKeys = attendees.keys();
for (var i = 0; !foundAttendee && i < attendeesKeys.length; i++) {
var attendee = attendees.get(attendeesKeys[i]);
if (attendee[field] == fieldValue) {
foundAttendee = attendee;
}
}
return foundAttendee;
}
function findDelegateAddress() {
var delegateAddress = null;
var ownerAttendee = findAttendeeWithFieldValue("uid", ownerLogin);
if (ownerAttendee && ownerAttendee["delegated-to"]) {
var delegateAttendee
= findAttendeeWithFieldValue("email",
ownerAttendee["delegated-to"]);
if (delegateAttendee) {
if (delegateAttendee["name"]) {
delegateAddress = (delegateAttendee["name"]
+ " <" + delegateAttendee["email"] + ">");
}
else {
delegateAddress = delegateAttendee["email"];
}
}
}
return delegateAddress;
}
function onComponentEditorLoad(event) {
initializeDocumentHref();
initializePrivacyMenu();
@@ -152,16 +188,26 @@ function onComponentEditorLoad(event) {
onMenuSetClassification.bindAsEventListener(menuItems[i]),
false);
}
tmp = $("replyList");
if (tmp) {
tmp.observe("change", onReplyChange);
var isDelegated = (tmp.value == 4);
tmp = $("delegatedTo");
tmp.addInterface(SOGoAutoCompletionInterface);
tmp.uidField = "c_mail";
tmp.excludeGroups = true;
tmp.animationParent=$("delegateEditor");
}
var delegateEditor = $("delegateEditor");
tmp.animationParent = delegateEditor;
if (isDelegated) {
var delegateAddress = findDelegateAddress();
if (delegateAddress) {
tmp.value = delegateAddress;
}
delegateEditor.show();
}
}
tmp = $("repeatHref");
if (tmp)
tmp.observe("click", onPopupRecurrenceWindow);