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"];