summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/js/wizard
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-06-30 11:30:43 +0200
committerMorris Jobke <hey@morrisjobke.de>2017-10-27 14:25:19 +0200
commit5c05a9327ce77a488d0c08eb571c23f68a62a0c2 (patch)
treefb952ae9df112b219b682fa7e11c4534f4e7a683 /apps/user_ldap/js/wizard
parent52b1b97c580847da7ed3413c4fd3b867933ade0a (diff)
downloadnextcloud-server-5c05a9327ce77a488d0c08eb571c23f68a62a0c2.tar.gz
nextcloud-server-5c05a9327ce77a488d0c08eb571c23f68a62a0c2.zip
add save button for setting LDAP Agent DN and Password
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/js/wizard')
-rw-r--r--apps/user_ldap/js/wizard/wizardTabElementary.js14
-rw-r--r--apps/user_ldap/js/wizard/wizardTabGeneric.js35
2 files changed, 45 insertions, 4 deletions
diff --git a/apps/user_ldap/js/wizard/wizardTabElementary.js b/apps/user_ldap/js/wizard/wizardTabElementary.js
index c8cb308952b..7ce1009565d 100644
--- a/apps/user_ldap/js/wizard/wizardTabElementary.js
+++ b/apps/user_ldap/js/wizard/wizardTabElementary.js
@@ -43,11 +43,15 @@ OCA = OCA || {};
},
ldap_dn: {
$element: $('#ldap_dn'),
- setMethod: 'setAgentDN'
+ setMethod: 'setAgentDN',
+ preventAutoSave: true,
+ $saveButton: $('.ldapSaveAgentCredentials')
},
ldap_agent_password: {
$element: $('#ldap_agent_password'),
- setMethod: 'setAgentPwd'
+ setMethod: 'setAgentPwd',
+ preventAutoSave: true,
+ $saveButton: $('.ldapSaveAgentCredentials')
},
ldap_base: {
$element: $('#ldap_base'),
@@ -65,7 +69,11 @@ OCA = OCA || {};
}
};
this.setManagedItems(items);
- _.bindAll(this, 'onPortButtonClick', 'onBaseDNButtonClick', 'onBaseDNTestButtonClick');
+ _.bindAll(this,
+ 'onPortButtonClick',
+ 'onBaseDNButtonClick',
+ 'onBaseDNTestButtonClick'
+ );
this.managedItems.ldap_port.$relatedElements.click(this.onPortButtonClick);
this.managedItems.ldap_base.$detectButton.click(this.onBaseDNButtonClick);
this.managedItems.ldap_base.$testButton.click(this.onBaseDNTestButtonClick);
diff --git a/apps/user_ldap/js/wizard/wizardTabGeneric.js b/apps/user_ldap/js/wizard/wizardTabGeneric.js
index 98e26d303b5..57ac375e321 100644
--- a/apps/user_ldap/js/wizard/wizardTabGeneric.js
+++ b/apps/user_ldap/js/wizard/wizardTabGeneric.js
@@ -53,6 +53,7 @@ OCA = OCA || {};
setManagedItems: function(managedItems) {
this.managedItems = managedItems;
this._enableAutoSave();
+ this._enableSaveButton();
},
/**
@@ -319,7 +320,10 @@ OCA = OCA || {};
for(var id in this.managedItems) {
if(_.isUndefined(this.managedItems[id].$element)
- || _.isUndefined(this.managedItems[id].setMethod)) {
+ || _.isUndefined(this.managedItems[id].setMethod)
+ || (!_.isUndefined(this.managedItems[id].preventAutoSave)
+ && this.managedItems[id].preventAutoSave === true)
+ ) {
continue;
}
var $element = this.managedItems[id].$element;
@@ -332,6 +336,35 @@ OCA = OCA || {};
},
/**
+ * set's up save-button behavior (essentially used for agent dn and pwd)
+ *
+ * @private
+ */
+ _enableSaveButton: function() {
+ var view = this;
+
+ // TODO: this is not nice, because it fires one request per change
+ // in the scenario this happens twice, causes detectors to run
+ // duplicated etc. To have this work properly, the wizard endpoint
+ // must accept setting multiple changes. Instead of messing around
+ // with old ajax/wizard.php use this opportunity and create a
+ // Controller
+ for(var id in this.managedItems) {
+ if(_.isUndefined(this.managedItems[id].$element)
+ || _.isUndefined(this.managedItems[id].$saveButton)
+ ) {
+ continue;
+ }
+ (function (item) {
+ item.$saveButton.click(function(event) {
+ event.preventDefault();
+ view._requestSave(item.$element);
+ });
+ })(this.managedItems[id]);
+ }
+ },
+
+ /**
* initializes a multiSelect element
*
* @param {jQuery} $element