summaryrefslogtreecommitdiffstats
path: root/mailnews/base/prefs/content/aw-accname.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-03 00:17:46 -0400
committerMatt A. Tobin <email@mattatobin.com>2019-11-03 00:17:46 -0400
commit302bf1b523012e11b60425d6eee1221ebc2724eb (patch)
treeb191a895f8716efcbe42f454f37597a545a6f421 /mailnews/base/prefs/content/aw-accname.js
parent21b3f6247403c06f85e1f45d219f87549862198f (diff)
downloadUXP-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/base/prefs/content/aw-accname.js')
-rw-r--r--mailnews/base/prefs/content/aw-accname.js73
1 files changed, 73 insertions, 0 deletions
diff --git a/mailnews/base/prefs/content/aw-accname.js b/mailnews/base/prefs/content/aw-accname.js
new file mode 100644
index 000000000..6fce2e878
--- /dev/null
+++ b/mailnews/base/prefs/content/aw-accname.js
@@ -0,0 +1,73 @@
+/* -*- 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 gPrefsBundle;
+
+function acctNamePageValidate()
+{
+ var accountname = document.getElementById("prettyName").value;
+ var canAdvance = accountname ? true : false;
+
+ // Check if this accountname already exists. If so, return false so that
+ // user can enter a different unique account name.
+ if (canAdvance && accountNameExists(accountname))
+ canAdvance = false;
+
+ document.documentElement.canAdvance = canAdvance;
+}
+
+function acctNamePageUnload() {
+ var pageData = parent.GetPageData();
+
+ // fix for bug #255473
+ // allow for multiple RSS accounts.
+ // if our isp.rdf file defines "wizardAutoGenerateUniqueHostname"
+ // we generate a unique hostname until we have one that doesn't exist
+ // for RSS accounts, in rss.rdf, userName, hostName and serverType
+ // default to the same thing, so we need to do this to allow for
+ // multiple RSS accounts. Note, they can all have the same pretty name.
+ if (gCurrentAccountData &&
+ gCurrentAccountData.wizardAutoGenerateUniqueHostname)
+ {
+ var serverType = parent.getCurrentServerType(pageData);
+ var userName = parent.getCurrentUserName(pageData);
+ var hostName = parent.getCurrentHostname(pageData);
+ var hostNamePref = hostName;
+ var i = 2;
+ while (parent.AccountExists(userName, hostName, serverType))
+ {
+ // If "Feeds" exists, try "Feeds-2", then "Feeds-3", etc.
+ hostName = hostNamePref + "-" + i;
+ i++;
+ }
+ setPageData(pageData, "server", "hostname", hostName);
+ }
+
+ var accountname = document.getElementById("prettyName").value;
+ setPageData(pageData, "accname", "prettyName", accountname);
+ // Set this to true so we know the user has set the name.
+ setPageData(pageData, "accname", "userset", true);
+ return true;
+}
+
+function acctNamePageInit()
+{
+ gPrefsBundle = document.getElementById("bundle_prefs");
+ var accountNameInput = document.getElementById("prettyName");
+ if (accountNameInput.value=="") {
+ var pageData = parent.GetPageData();
+ var type = parent.getCurrentServerType(pageData);
+ var accountName;
+
+ if (gCurrentAccountData && gCurrentAccountData.wizardAccountName)
+ accountName = gCurrentAccountData.wizardAccountName;
+ else if (type == "nntp")
+ accountName = pageData.newsserver.hostname.value;
+ else
+ accountName = pageData.identity.email.value;
+ accountNameInput.value = accountName;
+ }
+ acctNamePageValidate();
+}