summaryrefslogtreecommitdiffstats
path: root/content/manager/editAccountOverlay.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 07:58:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 07:58:57 +0000
commit592d2180f5d3984853bf55f91be87ac5d1dc0c1a (patch)
tree74ebbedcb80b9eca5e9773fb1b558e75f69cad8d /content/manager/editAccountOverlay.js
parentInitial commit. (diff)
downloaddav4tbsync-8be688b93f923136d2b34407128e7f561b798a58.tar.xz
dav4tbsync-8be688b93f923136d2b34407128e7f561b798a58.zip
Adding upstream version 4.7.upstream/4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'content/manager/editAccountOverlay.js')
-rw-r--r--content/manager/editAccountOverlay.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/content/manager/editAccountOverlay.js b/content/manager/editAccountOverlay.js
new file mode 100644
index 0000000..8f32af8
--- /dev/null
+++ b/content/manager/editAccountOverlay.js
@@ -0,0 +1,46 @@
+/*
+ * This file is part of DAV-4-TbSync.
+ *
+ * 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/.
+ */
+
+"use strict";
+
+const dav = TbSync.providers.dav;
+
+var tbSyncEditAccountOverlay = {
+
+ onload: function (window, accountData) {
+ this.accountData = accountData;
+
+ let serviceprovider = this.accountData.getAccountProperty("serviceprovider");
+ let isServiceProvider = dav.sync.serviceproviders.hasOwnProperty(serviceprovider);
+
+ // special treatment for configuration label, which is a permanent setting and will not change by switching modes
+ let configlabel = window.document.getElementById("tbsync.accountsettings.label.config");
+ if (configlabel) {
+ let extra = "";
+ if (isServiceProvider) {
+ extra = " [" + TbSync.getString("add.serverprofile." + serviceprovider, "dav") + "]";
+ }
+ configlabel.setAttribute("value", TbSync.getString("config.custom", "dav") + extra);
+ }
+
+ //set certain elements as "alwaysDisable", if locked by service provider
+ if (isServiceProvider) {
+ let items = window.document.getElementsByClassName("lockIfServiceProvider");
+ for (let i=0; i < items.length; i++) {
+ items[i].setAttribute("alwaysDisabled", "true");
+ }
+ }
+ },
+
+ stripHost: function (document, field) {
+ let host = document.getElementById('tbsync.accountsettings.pref.' + field).value;
+ while (host.endsWith("/")) { host = host.slice(0,-1); }
+ document.getElementById('tbsync.accountsettings.pref.' + field).value = host
+ this.accountData.setAccountProperty(field, host);
+ }
+};