From 4a9c3c3317a4e583528fad04c502385f1960fe95 Mon Sep 17 00:00:00 2001 From: Neil Rashbrook Date: Sun, 14 Sep 2008 19:50:22 +0100 Subject: [PATCH] Bug 454574 LDAP account preferences don't update r=philor r+a=Standard8 --- .../prefs/resources/content/am-addressing.js | 101 ++---------------- .../content/am-addressingOverlay.xul | 26 ++--- 2 files changed, 19 insertions(+), 108 deletions(-) diff --git a/mailnews/base/prefs/resources/content/am-addressing.js b/mailnews/base/prefs/resources/content/am-addressing.js index d24ab290ec..676be17ac2 100644 --- a/mailnews/base/prefs/resources/content/am-addressing.js +++ b/mailnews/base/prefs/resources/content/am-addressing.js @@ -52,7 +52,6 @@ function onInit(aPageId, aServerId) function onInitCompositionAndAddressing() { - setupDirectoriesList(); enabling(); quoteEnabling(); } @@ -63,32 +62,6 @@ function onEditDirectories() "editDirectories", "chrome,modal=yes,resizable=no", null); } -function setupDirectoriesList() -{ - var override = document.getElementById("identity.overrideGlobalPref").getAttribute("value"); - var autocomplete = document.getElementById("ldapAutocomplete"); - // useGlobalFlag is set when user changes the selectedItem on the radio button and switches - // to a different pane and switches back in Mail/news AccountSettings - var useGlobalFlag = document.getElementById("overrideGlobalPref").getAttribute("value"); - // directoryServerFlag is set when user changes the server to None and switches - // to a different pane and switches back in Mail/news AccountSettings - var directoryServerFlag = document.getElementById("directoryServer").getAttribute("value"); - - if(override == "true" && !useGlobalFlag) - autocomplete.selectedItem = document.getElementById("directories"); - else - autocomplete.selectedItem = document.getElementById("useGlobalPref"); - - var directoriesList = document.getElementById("directoriesList"); - var directoryServer = - document.getElementById("identity.directoryServer").getAttribute('value'); - if (directoryServerFlag) { - document.getElementById("identity.directoryServer").setAttribute("value", ""); - directoryServer = ""; - } - directoriesList.value = directoryServer; -} - function onPreInit(account, accountValues) { gIdentity = account.defaultIdentity; @@ -96,25 +69,19 @@ function onPreInit(account, accountValues) function enabling() { - var autocomplete = document.getElementById("ldapAutocomplete"); - var directoriesList = document.getElementById("directoriesList"); - var directoriesListPopup = document.getElementById("directoriesListPopup"); + var autocomplete = document.getElementById("identity.overrideGlobal_Pref"); + var directoriesList = document.getElementById("identity.directoryServer"); var editButton = document.getElementById("editButton"); - // this is the hidden text element that assigned a value from the prefs - var overrideGlobalPref = document.getElementById("identity.overrideGlobalPref"); - - switch(autocomplete.value) + switch (autocomplete.value) { - case "0": + case "false": directoriesList.setAttribute("disabled", true); - directoriesListPopup.setAttribute("disabled", true); editButton.setAttribute("disabled", true); break; - case "1": - directoriesList.removeAttribute("disabled"); - directoriesListPopup.removeAttribute("disabled"); - editButton.removeAttribute("disabled"); + case "true": + directoriesList.removeAttribute("disabled"); + editButton.removeAttribute("disabled"); break; } @@ -123,63 +90,11 @@ function enabling() .getService(Components.interfaces.nsIPrefBranch); } - // If the default per-identity directory preferences are locked - // disable the corresponding elements. - if (gIdentity && gPrefInt.prefIsLocked("mail.identity." + gIdentity.key + ".overrideGlobal_Pref")) { - document.getElementById("useGlobalPref").setAttribute("disabled", "true"); - document.getElementById("directories").setAttribute("disabled", "true"); - } - else - { - document.getElementById("useGlobalPref").removeAttribute("disabled"); - document.getElementById("directories").removeAttribute("disabled"); - } if (gIdentity && gPrefInt.prefIsLocked("mail.identity." + gIdentity.key + ".directoryServer")) { - document.getElementById("directoriesList").setAttribute("disabled", "true"); - document.getElementById("directoriesListPopup").setAttribute("disabled", "true"); + directoriesList.setAttribute("disabled", "true"); } } -function onSave() -{ - onSaveCompositionAndAddressing(); -} - -function onSaveCompositionAndAddressing() -{ - var override = document.getElementById("identity.overrideGlobalPref"); - var autocomplete = document.getElementById("ldapAutocomplete"); - var directoryServer = document.getElementById("identity.directoryServer"); - var directoriesList = - document.getElementById("directoriesList").getAttribute('value'); - - // When switching between panes, - // if we save the value of an element as null - // we will be forced to get the value from preferences when we get back. - // We are saving the value as "" for the radio button and also for - // the directory server if the selected directory is "None" - // So, we need the two elements overrideGlobalPref and directoryServer - // to save the state when the directory is - // set to none and the first radio button is selected. - switch(autocomplete.value) - { - case "0": - override.setAttribute('value', ""); - document.getElementById("overrideGlobalPref").setAttribute("value", "0"); - document.getElementById("directoryServer").setAttribute("value", ""); - break; - case "1": - override.setAttribute('value', true); - directoryServer.setAttribute("value", directoriesList); - document.getElementById("overrideGlobalPref").setAttribute("value", ""); - if(directoriesList == "") - document.getElementById("directoryServer").setAttribute("value", "none"); - else - document.getElementById("directoryServer").setAttribute("value", ""); - break; - } -} - function quoteEnabling() { var quotebox = document.getElementById("thenBox"); diff --git a/mailnews/base/prefs/resources/content/am-addressingOverlay.xul b/mailnews/base/prefs/resources/content/am-addressingOverlay.xul index ecb6040bef..49efcafe83 100644 --- a/mailnews/base/prefs/resources/content/am-addressingOverlay.xul +++ b/mailnews/base/prefs/resources/content/am-addressingOverlay.xul @@ -48,14 +48,6 @@ -