From fe2ab6e9b60c2e68caac9d46948de33abbdffa1a Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 8 Jun 2010 21:32:31 +0000 Subject: [PATCH] Monotone-Parent: f7911e1f3d0c926e6815a5dff6b0912b4fad036d Monotone-Revision: 49976b1102a1a35107c285adb4e08d81c27bd01d Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-06-08T21:32:31 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++ UI/WebServerResources/UIxAttendeesEditor.js | 41 +++++++++++++-------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 01f8e0089..e9f5861ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-06-08 Wolfgang Sourdeau + * UI/WebServerResources/UIxAttendeesEditor.js + (initializeAttendeeRole): new function that initialize an input's + row appearance based in the associated uid. + * UI/WebServerResources/SchedulerUI.js: (onCalendarsMenuPrepareVisibility): the "export" menu option is now disabled for non-owner users, since the function itself will diff --git a/UI/WebServerResources/UIxAttendeesEditor.js b/UI/WebServerResources/UIxAttendeesEditor.js index 012076ea3..ed7640c3e 100644 --- a/UI/WebServerResources/UIxAttendeesEditor.js +++ b/UI/WebServerResources/UIxAttendeesEditor.js @@ -272,25 +272,11 @@ function performSearchCallback(http) { else { if (document.currentPopupMenu) hideMenu(document.currentPopupMenu); - + if (data.contacts.length == 1) { // Single result var contact = data.contacts[0]; input.uid = contact["c_uid"]; - var row = $(input.parentNode.parentNode); - if (input.uid == OwnerLogin) { - row.removeAttribute("role"); - row.setAttribute("partstat", "accepted"); - row.addClassName("organizer-row"); - row.removeClassName("attendee-row"); - row.isOrganizer = true; - } else { - row.removeAttribute("partstat"); - row.setAttribute("role", "req-participant"); - row.addClassName("attendee-row"); - row.removeClassName("organizer-row"); - row.isOrganizer = false; - } var isList = (contact["c_component"] && contact["c_component"] == "vlist"); if (isList) { @@ -326,6 +312,7 @@ function performSearchCallback(http) { checkAttendee(input); } } + initializeAttendeeRole(input); } } else @@ -334,6 +321,25 @@ function performSearchCallback(http) { } } +function initializeAttendeeRole(input) { + var row = $(input.parentNode.parentNode); + if (input.uid && input.uid == OwnerLogin) { + row.removeAttribute("role"); + row.removeClassName("attendee-row"); + row.setAttribute("partstat", "accepted"); + row.addClassName("organizer-row"); + row.isOrganizer = true; + } else { + row.removeAttribute("partstat"); + row.removeClassName("organizer-row"); + if (input.value.length > 0) { + row.setAttribute("role", "req-participant"); + row.addClassName("attendee-row"); + } + row.isOrganizer = false; + } +} + function onAttendeeResultClick(event) { var input = this.parentNode.input; input.uid = this.uid; @@ -341,7 +347,9 @@ function onAttendeeResultClick(event) { input.container = this.container; input.isList = this.isList; input.confirmedValue = input.value = this.address; + initializeAttendeeRole(input); checkAttendee(input); + this.parentNode.input = null; } @@ -497,7 +505,7 @@ function checkAttendee(input) { var dataRow = dataTable.rows[row.sectionRowIndex]; tbody.removeChild(row); dataTable.removeChild(dataRow); - } + } else if (input.modified) { if (!row.hasClassName("needs-action")) { row.addClassName("needs-action"); @@ -532,6 +540,7 @@ function onInputBlur(event) { if (this.isList) { resolveListAttendees(this, false); } else { + initializeAttendeeRole(this); checkAttendee(this); } }