!import
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
1 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org Code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998-2001
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38 var useCustomPrefs;
39 var requestReceipt;
40 var leaveInInbox;
41 var moveToSent;
42 var receiptSend;
43 var neverReturn;
44 var returnSome;
45 var notInToCcPref;
46 var notInToCcLabel;
47 var outsideDomainPref;
48 var outsideDomainLabel;
49 var otherCasesPref;
50 var otherCasesLabel;
51 var receiptArriveLabel;
52 var receiptRequestLabel;
53 var gIdentity;
54 var gIncomingServer;
55 var gMdnPrefBranch;
56
onInit
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
57 function onInit()
58 {
59 useCustomPrefs = document.getElementById("identity.use_custom_prefs");
60 requestReceipt = document.getElementById("identity.request_return_receipt_on");
61 leaveInInbox = document.getElementById("leave_in_inbox");
62 moveToSent = document.getElementById("move_to_sent");
63 receiptSend = document.getElementById("server.mdn_report_enabled");
64 neverReturn = document.getElementById("never_return");
65 returnSome = document.getElementById("return_some");
66 notInToCcPref = document.getElementById("server.mdn_not_in_to_cc");
67 notInToCcLabel = document.getElementById("notInToCcLabel");
68 outsideDomainPref = document.getElementById("server.mdn_outside_domain");
69 outsideDomainLabel = document.getElementById("outsideDomainLabel");
70 otherCasesPref = document.getElementById("server.mdn_other");
71 otherCasesLabel = document.getElementById("otherCasesLabel");
72 receiptArriveLabel = document.getElementById("receiptArriveLabel");
73 receiptRequestLabel = document.getElementById("receiptRequestLabel");
74
75 EnableDisableCustomSettings();
76
77 return true;
78 }
79
onSave
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
80 function onSave()
81 {
82
83 }
84
EnableDisableCustomSettings
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
85 function EnableDisableCustomSettings() {
86 if (useCustomPrefs && (useCustomPrefs.getAttribute("value") == "false")) {
87 requestReceipt.setAttribute("disabled", "true");
88 leaveInInbox.setAttribute("disabled", "true");
89 moveToSent.setAttribute("disabled", "true");
90 neverReturn.setAttribute("disabled", "true");
91 returnSome.setAttribute("disabled", "true");
92 receiptArriveLabel.setAttribute("disabled", "true");
93 receiptRequestLabel.setAttribute("disabled", "true");
94 }
95 else {
96 requestReceipt.removeAttribute("disabled");
97 leaveInInbox.removeAttribute("disabled");
98 moveToSent.removeAttribute("disabled");
99 neverReturn.removeAttribute("disabled");
100 returnSome.removeAttribute("disabled");
101 receiptArriveLabel.removeAttribute("disabled");
102 receiptRequestLabel.removeAttribute("disabled");
103 }
104 EnableDisableAllowedReceipts();
105 // Lock id based prefs
106 onLockPreference("mail.identity", gIdentity.key);
107 // Lock server based prefs
108 onLockPreference("mail.server", gIncomingServer.key);
109 return true;
110 }
111
EnableDisableAllowedReceipts
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
112 function EnableDisableAllowedReceipts() {
113 if (receiptSend) {
114 if (!neverReturn.getAttribute("disabled") && (receiptSend.getAttribute("value") != "false")) {
115 notInToCcPref.removeAttribute("disabled");
116 notInToCcLabel.removeAttribute("disabled");
117 outsideDomainPref.removeAttribute("disabled");
118 outsideDomainLabel.removeAttribute("disabled");
119 otherCasesPref.removeAttribute("disabled");
120 otherCasesLabel.removeAttribute("disabled");
121 }
122 else {
123 notInToCcPref.setAttribute("disabled", "true");
124 notInToCcLabel.setAttribute("disabled", "true");
125 outsideDomainPref.setAttribute("disabled", "true");
126 outsideDomainLabel.setAttribute("disabled", "true");
127 otherCasesPref.setAttribute("disabled", "true");
128 otherCasesLabel.setAttribute("disabled", "true");
129 }
130 }
131 return true;
132 }
133
onPreInit
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
134 function onPreInit(account, accountValues)
135 {
136 gIdentity = account.defaultIdentity;
137 gIncomingServer = account.incomingServer;
138 }
139
140 // Disables xul elements that have associated preferences locked.
onLockPreference
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
141 function onLockPreference(initPrefString, keyString)
142 {
143 var finalPrefString;
144
145 var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
146
147 var allPrefElements = [
148 { prefstring:"request_return_receipt_on", id:"identity.request_return_receipt_on"},
149 { prefstring:"select_custom_prefs", id:"identity.select_custom_prefs"},
150 { prefstring:"select_global_prefs", id:"identity.select_global_prefs"},
151 { prefstring:"incorporate_return_receipt", id:"server.incorporate_return_receipt"},
152 { prefstring:"never_return", id:"never_return"},
153 { prefstring:"return_some", id:"return_some"},
154 { prefstring:"mdn_not_in_to_cc", id:"server.mdn_not_in_to_cc"},
155 { prefstring:"mdn_outside_domain", id:"server.mdn_outside_domain"},
156 { prefstring:"mdn_other", id:"server.mdn_other"},
157 ];
158
159 finalPrefString = initPrefString + "." + keyString + ".";
160 gMdnPrefBranch = prefService.getBranch(finalPrefString);
161
162 disableIfLocked( allPrefElements );
163 }
164
disableIfLocked
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
165 function disableIfLocked( prefstrArray )
166 {
167 for (var i=0; i<prefstrArray.length; i++) {
168 var id = prefstrArray[i].id;
169 var element = document.getElementById(id);
170 if (gMdnPrefBranch.prefIsLocked(prefstrArray[i].prefstring)) {
171 if (id == "server.incorporate_return_receipt")
172 {
173 document.getElementById("leave_in_inbox").setAttribute("disabled", "true");
174 document.getElementById("move_to_sent").setAttribute("disabled", "true");
175 }
176 else
177 element.setAttribute("disabled", "true");
178 }
179 }
180 }