From 7e7c84b58147c56bb4ebc37039de0267b6966c72 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Thu, 24 Feb 2011 00:02:24 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: 1b715d5ad2013f8b321552d51b97acc350812ee7 Monotone-Revision: 98c561a2f104032c09afa2ddd35d5f510fdcc200 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2011-02-24T00:02:24 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++++ UI/WebServerResources/UIxPreferences.js | 26 +++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b98d3569..f381a14aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,10 @@ the SQL-based authentication sources (required database columns) and also the "id" uniqueness of authentication sources in general + * UI/WebServerResources/UIxPreferences.js + Added many checks in case the Mail module is disabled for + proper behavior of the Preferences panel. + 2011-02-23 Francis Lachapelle * SoObjects/Mailer/SOGoMailObject.m (-lookupInfoForBodyPart:): we diff --git a/UI/WebServerResources/UIxPreferences.js b/UI/WebServerResources/UIxPreferences.js index 9538f5c01..e929f799e 100644 --- a/UI/WebServerResources/UIxPreferences.js +++ b/UI/WebServerResources/UIxPreferences.js @@ -94,12 +94,17 @@ function _setupEvents() { } } + + // We check for non-null elements as replyPlacementList and composeMessagesType + // might not be present if ModulesConstraints disable those elements + if ($("replyPlacementList")) + $("replyPlacementList").observe ("change", onReplyPlacementListChange); + + if ($("composeMessagesType")) + $("composeMessagesType").observe ("change", onComposeMessagesTypeChange); + // Note: we also monitor changes to the calendar categories. // See functions endEditable and onColorPickerChoice. - - $("replyPlacementList").observe ("change", onReplyPlacementListChange); - $("composeMessagesType").observe ("change", onComposeMessagesTypeChange); - var valueInputs = [ "calendarCategoriesValue", "calendarCategoriesValue" ]; for (var i = 0; i < valueInputs.length; i++) { var valueInput = $(valueInputs[i]); @@ -749,14 +754,23 @@ function saveMailAccounts() { /* This removal enables us to avoid a few warning from SOPE for the inputs that were created dynamically. */ var editor = $("mailAccountEditor"); - editor.parentNode.removeChild(editor); + + // Could be null if ModuleConstraints disables email access + if (editor) + editor.parentNode.removeChild(editor); compactMailAccounts(); var mailAccountsJSON = $("mailAccountsJSON"); - mailAccountsJSON.value = Object.toJSON(mailAccounts); + + if (mailAccountsJSON) + mailAccountsJSON.value = Object.toJSON(mailAccounts); } function compactMailAccounts() { + + if (!mailAccounts) + return; + for (var i = 1; i < mailAccounts.length; i++) { var account = mailAccounts[i]; var encryption = account["encryption"];