]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix triggering of group update counts. improves the basic code which is also responsi...
authorArthur Schiwon <blizzz@owncloud.com>
Thu, 9 Oct 2014 15:17:50 +0000 (17:17 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Thu, 9 Oct 2014 15:17:50 +0000 (17:17 +0200)
apps/user_ldap/js/ldapFilter.js
apps/user_ldap/js/settings.js

index 5b93d81f371cb461ebd81ccfdece1b84e541a020..6b62604efb7fa849050b407fb1657fc5a1af7532 100644 (file)
@@ -14,7 +14,7 @@ function LdapFilter(target, determineModeCallback) {
                target === 'Group') {
                this.target = target;
        }
-};
+}
 
 LdapFilter.prototype.activate = function() {
        if(this.activated) {
@@ -33,6 +33,11 @@ LdapFilter.prototype.compose = function(callback) {
                return false;
        }
 
+       if(this.mode === LdapWizard.filterModeRaw) {
+               //Raw filter editing, i.e. user defined filter, don't compose
+               return;
+       }
+
        if(this.target === 'User') {
                action = 'getUserListFilter';
        } else if(this.target === 'Login') {
@@ -41,11 +46,6 @@ LdapFilter.prototype.compose = function(callback) {
                action = 'getGroupFilter';
        }
 
-       if(!$('#raw'+this.target+'FilterContainer').hasClass('invisible')) {
-               //Raw filter editing, i.e. user defined filter, don't compose
-               return;
-       }
-
        var param = 'action='+action+
                '&ldap_serverconfig_chooser='+
                encodeURIComponent($('#ldap_serverconfig_chooser').val());
@@ -55,10 +55,9 @@ LdapFilter.prototype.compose = function(callback) {
        LdapWizard.ajax(param,
                function(result) {
                        LdapWizard.applyChanges(result);
-                       if(filter.target === 'User') {
-                               LdapWizard.countUsers();
-                       } else if(filter.target === 'Group') {
-                               LdapWizard.countGroups();
+                       console.log(filter.mode);
+                       filter.updateCount();
+                       if(filter.target === 'Group') {
                                LdapWizard.detectGroupMemberAssoc();
                        }
                        if(typeof callback !== 'undefined') {
index f5b8081497f51dfa7f890b0fe700467e6d307895..be643c81b4bd32b5b4c8b079555c71ab00726f6c 100644 (file)
@@ -542,7 +542,6 @@ var LdapWizard = {
 
        initGroupFilter: function() {
                LdapWizard.groupFilter.activate();
-               LdapWizard.countGroups();
        },
 
        /** init login filter tab section **/
@@ -576,6 +575,9 @@ var LdapWizard = {
        instantiateFilters: function() {
                delete LdapWizard.userFilter;
                LdapWizard.userFilter = new LdapFilter('User', function(mode) {
+                       if(mode === LdapWizard.filterModeAssisted) {
+                               LdapWizard.groupFilter.updateCount();
+                       }
                        LdapWizard.userFilter.findFeatures();
                });
                $('#rawUserFilterContainer .ldapGetEntryCount').click(function(event) {
@@ -593,6 +595,9 @@ var LdapWizard = {
 
                delete LdapWizard.groupFilter;
                LdapWizard.groupFilter = new LdapFilter('Group', function(mode) {
+                       if(mode === LdapWizard.filterModeAssisted) {
+                               LdapWizard.groupFilter.updateCount();
+                       }
                        LdapWizard.groupFilter.findFeatures();
                });
                $('#rawGroupFilterContainer .ldapGetEntryCount').click(function(event) {
@@ -617,7 +622,6 @@ var LdapWizard = {
                if(LdapWizard.userFilterObjectClassesHasRun &&
                        LdapWizard.userFilterAvailableGroupsHasRun) {
                        LdapWizard.userFilter.compose(LdapWizard.detectEmailAttribute);
-                       LdapWizard.countUsers();
                }
        },
 
@@ -657,10 +661,8 @@ var LdapWizard = {
                }
 
                if(triggerObj.id == 'ldap_userlist_filter' && !LdapWizard.admin.isExperienced()) {
-                       LdapWizard.countUsers();
                        LdapWizard.detectEmailAttribute();
                } else if(triggerObj.id == 'ldap_group_filter' && !LdapWizard.admin.isExperienced()) {
-                       LdapWizard.countGroups();
                        LdapWizard.detectGroupMemberAssoc();
                }