aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/js/wizard/wizardTabGeneric.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/js/wizard/wizardTabGeneric.js')
-rw-r--r--apps/user_ldap/js/wizard/wizardTabGeneric.js35
1 files changed, 34 insertions, 1 deletions
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