diff options
author | Matt A. Tobin <email@mattatobin.com> | 2019-11-03 00:17:46 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2019-11-03 00:17:46 -0400 |
commit | 302bf1b523012e11b60425d6eee1221ebc2724eb (patch) | |
tree | b191a895f8716efcbe42f454f37597a545a6f421 /mailnews/extensions/mdn/content | |
parent | 21b3f6247403c06f85e1f45d219f87549862198f (diff) | |
download | UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.gz UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.lz UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.xz UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.zip |
Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1
Diffstat (limited to 'mailnews/extensions/mdn/content')
-rw-r--r-- | mailnews/extensions/mdn/content/am-mdn.js | 155 | ||||
-rw-r--r-- | mailnews/extensions/mdn/content/am-mdn.xul | 136 | ||||
-rw-r--r-- | mailnews/extensions/mdn/content/mdn.js | 23 |
3 files changed, 314 insertions, 0 deletions
diff --git a/mailnews/extensions/mdn/content/am-mdn.js b/mailnews/extensions/mdn/content/am-mdn.js new file mode 100644 index 000000000..4dd9e8d8d --- /dev/null +++ b/mailnews/extensions/mdn/content/am-mdn.js @@ -0,0 +1,155 @@ +/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +var useCustomPrefs; +var requestReceipt; +var leaveInInbox; +var moveToSent; +var receiptSend; +var neverReturn; +var returnSome; +var notInToCcPref; +var notInToCcLabel; +var outsideDomainPref; +var outsideDomainLabel; +var otherCasesPref; +var otherCasesLabel; +var receiptArriveLabel; +var receiptRequestLabel; +var gIdentity; +var gIncomingServer; +var gMdnPrefBranch; + +function onInit() +{ + useCustomPrefs = document.getElementById("identity.use_custom_prefs"); + requestReceipt = document.getElementById("identity.request_return_receipt_on"); + leaveInInbox = document.getElementById("leave_in_inbox"); + moveToSent = document.getElementById("move_to_sent"); + receiptSend = document.getElementById("server.mdn_report_enabled"); + neverReturn = document.getElementById("never_return"); + returnSome = document.getElementById("return_some"); + notInToCcPref = document.getElementById("server.mdn_not_in_to_cc"); + notInToCcLabel = document.getElementById("notInToCcLabel"); + outsideDomainPref = document.getElementById("server.mdn_outside_domain"); + outsideDomainLabel = document.getElementById("outsideDomainLabel"); + otherCasesPref = document.getElementById("server.mdn_other"); + otherCasesLabel = document.getElementById("otherCasesLabel"); + receiptArriveLabel = document.getElementById("receiptArriveLabel"); + receiptRequestLabel = document.getElementById("receiptRequestLabel"); + + EnableDisableCustomSettings(); + + return true; +} + +function onSave() +{ + +} + +function EnableDisableCustomSettings() { + if (useCustomPrefs && (useCustomPrefs.getAttribute("value") == "false")) { + requestReceipt.setAttribute("disabled", "true"); + leaveInInbox.setAttribute("disabled", "true"); + moveToSent.setAttribute("disabled", "true"); + neverReturn.setAttribute("disabled", "true"); + returnSome.setAttribute("disabled", "true"); + receiptArriveLabel.setAttribute("disabled", "true"); + receiptRequestLabel.setAttribute("disabled", "true"); + } + else { + requestReceipt.removeAttribute("disabled"); + leaveInInbox.removeAttribute("disabled"); + moveToSent.removeAttribute("disabled"); + neverReturn.removeAttribute("disabled"); + returnSome.removeAttribute("disabled"); + receiptArriveLabel.removeAttribute("disabled"); + receiptRequestLabel.removeAttribute("disabled"); + } + EnableDisableAllowedReceipts(); + // Lock id based prefs + onLockPreference("mail.identity", gIdentity.key); + // Lock server based prefs + onLockPreference("mail.server", gIncomingServer.key); + return true; +} + +function EnableDisableAllowedReceipts() { + if (receiptSend) { + if (!neverReturn.getAttribute("disabled") && (receiptSend.getAttribute("value") != "false")) { + notInToCcPref.removeAttribute("disabled"); + notInToCcLabel.removeAttribute("disabled"); + outsideDomainPref.removeAttribute("disabled"); + outsideDomainLabel.removeAttribute("disabled"); + otherCasesPref.removeAttribute("disabled"); + otherCasesLabel.removeAttribute("disabled"); + } + else { + notInToCcPref.setAttribute("disabled", "true"); + notInToCcLabel.setAttribute("disabled", "true"); + outsideDomainPref.setAttribute("disabled", "true"); + outsideDomainLabel.setAttribute("disabled", "true"); + otherCasesPref.setAttribute("disabled", "true"); + otherCasesLabel.setAttribute("disabled", "true"); + } + } + return true; +} + +function onPreInit(account, accountValues) +{ + gIdentity = account.defaultIdentity; + gIncomingServer = account.incomingServer; +} + +// Disables xul elements that have associated preferences locked. +function onLockPreference(initPrefString, keyString) +{ + var finalPrefString; + + var allPrefElements = [ + { prefstring:"request_return_receipt_on", id:"identity.request_return_receipt_on"}, + { prefstring:"select_custom_prefs", id:"identity.select_custom_prefs"}, + { prefstring:"select_global_prefs", id:"identity.select_global_prefs"}, + { prefstring:"incorporate_return_receipt", id:"server.incorporate_return_receipt"}, + { prefstring:"never_return", id:"never_return"}, + { prefstring:"return_some", id:"return_some"}, + { prefstring:"mdn_not_in_to_cc", id:"server.mdn_not_in_to_cc"}, + { prefstring:"mdn_outside_domain", id:"server.mdn_outside_domain"}, + { prefstring:"mdn_other", id:"server.mdn_other"}, + ]; + + finalPrefString = initPrefString + "." + keyString + "."; + gMdnPrefBranch = Services.prefs.getBranch(finalPrefString); + + disableIfLocked( allPrefElements ); +} + +function disableIfLocked( prefstrArray ) +{ + for (var i=0; i<prefstrArray.length; i++) { + var id = prefstrArray[i].id; + var element = document.getElementById(id); + if (gMdnPrefBranch.prefIsLocked(prefstrArray[i].prefstring)) { + if (id == "server.incorporate_return_receipt") + { + document.getElementById("leave_in_inbox").setAttribute("disabled", "true"); + document.getElementById("move_to_sent").setAttribute("disabled", "true"); + } + else + element.setAttribute("disabled", "true"); + } + } +} + +/** + * Opens Preferences (Options) dialog on the pane and tab where + * the global receipts settings can be found. + */ +function showGlobalReceipts() { + openPrefsFromAccountManager("paneAdvanced", "generalTab", + {subdialog: "showReturnReceipts"}, "receipts_pane"); +} diff --git a/mailnews/extensions/mdn/content/am-mdn.xul b/mailnews/extensions/mdn/content/am-mdn.xul new file mode 100644 index 000000000..c290752ab --- /dev/null +++ b/mailnews/extensions/mdn/content/am-mdn.xul @@ -0,0 +1,136 @@ +<?xml version="1.0"?> + +<!-- + + This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + +<?xml-stylesheet href="chrome://messenger/skin/accountManage.css" type="text/css"?> + +<!DOCTYPE page SYSTEM "chrome://messenger/locale/am-mdn.dtd"> + +<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="&pane.title;" + onload="parent.onPanelLoaded('am-mdn.xul');"> + + <vbox flex="1" style="overflow: auto;"> + <stringbundle id="bundle_smime" src="chrome://messenger/locale/am-mdn.properties"/> + <script type="application/javascript" src="chrome://messenger/content/AccountManager.js"/> + <script type="application/javascript" src="chrome://messenger/content/amUtils.js"/> + <script type="application/javascript" src="chrome://messenger/content/am-mdn.js"/> + + <dialogheader title="&pane.title;"/> + + <groupbox> + + <caption label="&pane.title;"/> + + <hbox id="prefChoices" align="center" flex="1"> + <radiogroup id="identity.use_custom_prefs" wsm_persist="true" genericattr="true" + preftype="bool" prefstring="mail.identity.%identitykey%.use_custom_prefs" + oncommand="EnableDisableCustomSettings();" flex="1"> + <radio id="identity.select_global_prefs" + value="false" + label="&useGlobalPrefs.label;" + accesskey="&useGlobalPrefs.accesskey;"/> + <hbox flex="1"> + <spacer flex="1"/> + <button id="globalReceiptsLink" + label="&globalReceipts.label;" + accesskey="&globalReceipts.accesskey;" + oncommand="showGlobalReceipts();"/> + </hbox> + <radio id="identity.select_custom_prefs" + value="true" + label="&useCustomPrefs.label;" + accesskey="&useCustomPrefs.accesskey;"/> + </radiogroup> + </hbox> + + <vbox id="returnReceiptSettings" class="indent" align="start"> + <checkbox id="identity.request_return_receipt_on" label="&requestReceipt.label;" + accesskey="&requestReceipt.accesskey;" + wsm_persist="true" genericattr="true" iscontrolcontainer="true" + preftype="bool" prefstring="mail.identity.%identitykey%.request_return_receipt_on"/> + + <separator/> + + <vbox id="receiptArrive"> + <label id="receiptArriveLabel" control="server.incorporate_return_receipt">&receiptArrive.label;</label> + <radiogroup id="server.incorporate_return_receipt" wsm_persist="true" genericattr="true" + preftype="int" prefstring="mail.server.%serverkey%.incorporate_return_receipt" + class="indent"> + <radio id="leave_in_inbox" value="0" label="&leaveIt.label;" + accesskey="&leaveIt.accesskey;"/> + <radio id="move_to_sent" value="1" label="&moveToSent.label;" + accesskey="&moveToSent.accesskey;"/> + </radiogroup> + </vbox> + + <separator/> + + <vbox id="receiptRequest"> + <label id="receiptRequestLabel" control="server.mdn_report_enabled">&requestMDN.label;</label> + <radiogroup id="server.mdn_report_enabled" wsm_persist="true" genericattr="true" + preftype="bool" prefstring="mail.server.%serverkey%.mdn_report_enabled" + oncommand="EnableDisableAllowedReceipts();" + class="indent"> + <radio id="never_return" value="false" label="&never.label;" + accesskey="&never.accesskey;"/> + <radio id="return_some" value="true" label="&returnSome.label;" + accesskey="&returnSome.accesskey;"/> + + <hbox id="receiptSendIf" class="indent"> + <grid> + <columns><column/><column/></columns> + <rows> + <row align="center"> + <label id="notInToCcLabel" value="¬InToCc.label;" + accesskey="¬InToCc.accesskey;" control="server.mdn_not_in_to_cc"/> + <menulist id="server.mdn_not_in_to_cc" wsm_persist="true" genericattr="true" + preftype="int" prefstring="mail.server.%serverkey%.mdn_not_in_to_cc"> + <menupopup> + <menuitem value="0" label="&neverSend.label;"/> + <menuitem value="1" label="&alwaysSend.label;"/> + <menuitem value="2" label="&askMe.label;"/> + </menupopup> + </menulist> + </row> + <row align="center"> + <label id="outsideDomainLabel" value="&outsideDomain.label;" + accesskey="&outsideDomain.accesskey;" control="server.mdn_outside_domain"/> + <menulist id="server.mdn_outside_domain" wsm_persist="true" genericattr="true" + preftype="int" prefstring="mail.server.%serverkey%.mdn_outside_domain"> + <menupopup> + <menuitem value="0" label="&neverSend.label;"/> + <menuitem value="1" label="&alwaysSend.label;"/> + <menuitem value="2" label="&askMe.label;"/> + </menupopup> + </menulist> + </row> + <row align="center"> + <label id="otherCasesLabel" value="&otherCases.label;" + accesskey="&otherCases.accesskey;" control="server.mdn_other"/> + <menulist id="server.mdn_other" wsm_persist="true" genericattr="true" + preftype="int" prefstring="mail.server.%serverkey%.mdn_other"> + <menupopup> + <menuitem value="0" label="&neverSend.label;"/> + <menuitem value="1" label="&alwaysSend.label;"/> + <menuitem value="2" label="&askMe.label;"/> + </menupopup> + </menulist> + </row> + </rows> + </grid> + </hbox> + </radiogroup> + + </vbox> + + </vbox> + + </groupbox> + </vbox> + +</page> diff --git a/mailnews/extensions/mdn/content/mdn.js b/mailnews/extensions/mdn/content/mdn.js new file mode 100644 index 000000000..9ac481573 --- /dev/null +++ b/mailnews/extensions/mdn/content/mdn.js @@ -0,0 +1,23 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * default prefs for mdn + */ + +pref("mail.identity.default.use_custom_prefs", false); // false: Use global true: Use custom + +pref("mail.identity.default.request_return_receipt_on", false); + +pref("mail.server.default.incorporate_return_receipt", 0); // 0: Inbox/filter 1: Sent folder + +pref("mail.server.default.mdn_report_enabled", true); // false: Never return receipts true: Return some receipts + +pref("mail.server.default.mdn_not_in_to_cc", 2); // 0: Never 1: Always 2: Ask me 3: Denial +pref("mail.server.default.mdn_outside_domain", 2); +pref("mail.server.default.mdn_other", 2); + +pref("mail.identity.default.request_receipt_header_type", 0); // return receipt header type - 0: MDN-DNT 1: RRT 2: Both + +pref("mail.server.default.mdn_report_enabled", true); |