!import
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
1 var gIdentity = null;
2 var gPrefInt = null;
3
onLoad
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
4 function onLoad()
5 {
6 createDirectoriesList();
7 parent.onPanelLoaded('am-addressing.xul');
8 }
9
onInit
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
10 function onInit(aPageId, aServerId)
11 {
12 onInitCompositionAndAddressing();
13 }
14
onInitCompositionAndAddressing
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
15 function onInitCompositionAndAddressing()
16 {
17 setupDirectoriesList();
18 enabling();
19 quoteEnabling();
20 }
21
onPreInit
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
22 function onPreInit(account, accountValues)
23 {
24 gIdentity = account.defaultIdentity;
25 }
26
enabling
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
27 function enabling()
28 {
29 var autocomplete = document.getElementById("ldapAutocomplete");
30 var directoriesList = document.getElementById("directoriesList");
31 var directoriesListPopup = document.getElementById("directoriesListPopup");
32 var editButton = document.getElementById("editButton");
33
34 // this is the hidden text element that assigned a value from the prefs
35 var overrideGlobalPref = document.getElementById("identity.overrideGlobalPref");
36
37 switch(autocomplete.value)
38 {
39 case "0":
40 directoriesList.setAttribute("disabled", true);
41 directoriesListPopup.setAttribute("disabled", true);
42 editButton.setAttribute("disabled", true);
43 break;
44 case "1":
45 directoriesList.removeAttribute("disabled");
46 directoriesListPopup.removeAttribute("disabled");
47 editButton.removeAttribute("disabled");
48 break;
49 }
50
51 if (!gPrefInt) {
52 gPrefInt = Components.classes["@mozilla.org/preferences-service;1"]
53 .getService(Components.interfaces.nsIPrefBranch);
54 }
55
56 // If the default per-identity directory preferences are locked
57 // disable the corresponding elements.
58 if (gIdentity && gPrefInt.prefIsLocked("mail.identity." + gIdentity.key + ".overrideGlobal_Pref")) {
59 document.getElementById("useGlobalPref").setAttribute("disabled", "true");
60 document.getElementById("directories").setAttribute("disabled", "true");
61 }
62 else
63 {
64 document.getElementById("useGlobalPref").removeAttribute("disabled");
65 document.getElementById("directories").removeAttribute("disabled");
66 }
67 if (gIdentity && gPrefInt.prefIsLocked("mail.identity." + gIdentity.key + ".directoryServer")) {
68 document.getElementById("directoriesList").setAttribute("disabled", "true");
69 document.getElementById("directoriesListPopup").setAttribute("disabled", "true");
70 }
71
72 LoadDirectories(directoriesListPopup);
73 }
74
onSave
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
75 function onSave()
76 {
77 onSaveCompositionAndAddressing();
78 }
79
onSaveCompositionAndAddressing
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
80 function onSaveCompositionAndAddressing()
81 {
82 var override = document.getElementById("identity.overrideGlobalPref");
83 var autocomplete = document.getElementById("ldapAutocomplete");
84 var directoryServer = document.getElementById("identity.directoryServer");
85 var directoriesList =
86 document.getElementById("directoriesList").getAttribute('value');
87
88 // When switching between panes,
89 // if we save the value of an element as null
90 // we will be forced to get the value from preferences when we get back.
91 // We are saving the value as "" for the radio button and also for
92 // the directory server if the selected directory is "None"
93 // So, we need the two elements overrideGlobalPref and directoryServer
94 // to save the state when the directory is
95 // set to none and the first radio button is selected.
96 switch(autocomplete.value)
97 {
98 case "0":
99 override.setAttribute('value', "");
100 document.getElementById("overrideGlobalPref").setAttribute("value", "0");
101 document.getElementById("directoryServer").setAttribute("value", "");
102 break;
103 case "1":
104 override.setAttribute('value', true);
105 directoryServer.setAttribute("value", directoriesList);
106 document.getElementById("overrideGlobalPref").setAttribute("value", "");
107 if(directoriesList == "")
108 document.getElementById("directoryServer").setAttribute("value", "none");
109 else
110 document.getElementById("directoryServer").setAttribute("value", "");
111 break;
112 }
113 }
114
quoteEnabling
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
115 function quoteEnabling()
116 {
117 var quotebox = document.getElementById("thenBox");
118 var placebox = document.getElementById("placeBox");
119 var quotecheck = document.getElementById("identity.autoQuote");
120
121 if (quotecheck.checked && !quotecheck.disabled &&
122 document.getElementById("identity.attachSignature").checked &&
123 (document.getElementById("identity.replyOnTop").value == 1)) {
124 placebox.firstChild.removeAttribute("disabled");
125 placebox.lastChild.removeAttribute("disabled");
126 }
127 else {
128 placebox.firstChild.setAttribute("disabled", "true");
129 placebox.lastChild.setAttribute("disabled", "true");
130 }
131 if (quotecheck.checked && !quotecheck.disabled) {
132 quotebox.firstChild.removeAttribute("disabled");
133 quotebox.lastChild.removeAttribute("disabled");
134 }
135 else {
136 quotebox.firstChild.setAttribute("disabled", "true");
137 quotebox.lastChild.setAttribute("disabled", "true");
138 }
139 }