summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2015-01-14 17:31:20 +0100
committerArthur Schiwon <blizzz@owncloud.com>2015-01-14 17:31:20 +0100
commit3d94aa8953a0d79da2c934b59edd60254e24f5ea (patch)
treeeef5198bc9d940fb7c4564564ae8c5c5d37c86f1
parent672bc287154f63cc742812cc76f22869036e20c7 (diff)
downloadnextcloud-server-3d94aa8953a0d79da2c934b59edd60254e24f5ea.tar.gz
nextcloud-server-3d94aa8953a0d79da2c934b59edd60254e24f5ea.zip
update user or group count only, when the multiselect is closed
-rw-r--r--apps/user_ldap/js/settings.js38
1 files changed, 34 insertions, 4 deletions
diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js
index 2a8fedf5dde..b1abb0994ba 100644
--- a/apps/user_ldap/js/settings.js
+++ b/apps/user_ldap/js/settings.js
@@ -819,15 +819,33 @@ var LdapWizard = {
LdapWizard._save(inputObj, val);
},
+ /**
+ * updates user or group count on multiSelect close. Resets the event
+ * function subsequently.
+ *
+ * @param {LdapFilter} filter
+ * @param {Object} $multiSelectObj
+ */
+ onMultiSelectClose: function(filter, $multiSelectObj) {
+ filter.updateCount();
+ $multiSelectObj.multiselect({close: function(){}});
+ },
+
saveMultiSelect: function(originalObj, resultObj) {
- values = '';
- for(i = 0; i < resultObj.length; i++) {
+ var values = '';
+ for(var i = 0; i < resultObj.length; i++) {
values = values + "\n" + resultObj[i].value;
}
LdapWizard._save($('#'+originalObj)[0], $.trim(values));
+ var $multiSelectObj = $('#'+originalObj);
+ var updateCount = !$multiSelectObj.multiselect("isOpen");
+ var applyUpdateOnCloseToFilter;
if(originalObj === 'ldap_userfilter_objectclass'
|| originalObj === 'ldap_userfilter_groups') {
- LdapWizard.userFilter.compose(true);
+ LdapWizard.userFilter.compose(updateCount);
+ if(!updateCount) {
+ applyUpdateOnCloseToFilter = LdapWizard.userFilter;
+ }
//when user filter is changed afterwards, login filter needs to
//be adjusted, too
if(!LdapWizard.loginFilter) {
@@ -838,7 +856,19 @@ var LdapWizard = {
LdapWizard.loginFilter.compose();
} else if(originalObj === 'ldap_groupfilter_objectclass'
|| originalObj === 'ldap_groupfilter_groups') {
- LdapWizard.groupFilter.compose(true);
+ LdapWizard.groupFilter.compose(updateCount);
+ if(!updateCount) {
+ applyUpdateOnCloseToFilter = LdapWizard.groupFilter;
+ }
+ }
+
+ if(applyUpdateOnCloseToFilter instanceof LdapFilter) {
+ $multiSelectObj.multiselect({
+ close: function () {
+ LdapWizard.onMultiSelectClose(
+ applyUpdateOnCloseToFilter, $multiSelectObj);
+ }
+ });
}
},