margin: 5px;
}
+.ldap_count {
+ line-height: 45px;
+}
+
.ldapSettingControls {
margin-top: 3px;
}
*/
function ExperiencedAdmin(wizard, initialState) {
this.wizard = wizard;
- this.isExperienced = false;
+ this.isExperienced = initialState;
+ if(this.isExperienced) {
+ this.hideEntryCounters();
+ }
}
*
* @param {boolean} whether the admin is experienced or not
*/
-ExperiencedAdmin.prototype.toggle = function(isExperienced) {
+ExperiencedAdmin.prototype.setExperienced = function(isExperienced) {
this.isExperienced = isExperienced;
if(this.isExperienced) {
this.enableRawMode();
+ this.hideEntryCounters();
+ } else {
+ this.showEntryCounters();
}
};
/**
* switches all LDAP filters from Assisted to Raw mode.
*/
-ExperiencedAdmin.prototype.enableRawMode = function () {
+ExperiencedAdmin.prototype.enableRawMode = function() {
containers = {
'toggleRawGroupFilter': '#rawGroupFilterContainer',
'toggleRawLoginFilter': '#rawLoginFilterContainer',
this.wizard[method]();
}
};
+};
+
+ExperiencedAdmin.prototype.updateUserTab = function(mode) {
+ this._updateTab(mode, $('#ldap_user_count'));
+}
+ExperiencedAdmin.prototype.updateGroupTab = function(mode) {
+ this._updateTab(mode, $('#ldap_group_count'));
+}
+ExperiencedAdmin.prototype._updateTab = function(mode, $countEl) {
+ if(mode === LdapWizard.filterModeAssisted) {
+ $countEl.removeClass('hidden');
+ } else if(!this.isExperienced) {
+ $countEl.removeClass('hidden');
+ } else {
+ $countEl.addClass('hidden');
+ }
+}
+
+/**
+ * hide user and group counters, they will be displayed on demand only
+ */
+ExperiencedAdmin.prototype.hideEntryCounters = function() {
+ $('#ldap_user_count').addClass('hidden');
+ $('#ldap_group_count').addClass('hidden');
+ $('.ldapGetEntryCount').removeClass('hidden');
+};
+
+/**
+* shows user and group counters, they will be displayed on demand only
+*/
+ExperiencedAdmin.prototype.showEntryCounters = function() {
+ $('#ldap_user_count').removeClass('hidden');
+ $('#ldap_group_count').removeClass('hidden');
+ $('.ldapGetEntryCount').addClass('hidden');
};
}
}
+LdapFilter.prototype.getMode = function() {
+ return this.mode;
+}
+
LdapFilter.prototype.unlock = function() {
this.locked = false;
if(this.lazyRunCompose) {
};
LdapFilter.prototype.findFeatures = function() {
+ //TODO: reset this.foundFeatures when any base DN changes
if(!this.foundFeatures && !this.locked && this.mode === LdapWizard.filterModeAssisted) {
this.foundFeatures = true;
if(this.target === 'User') {
LdapWizard.findObjectClasses(objcEl, this.target);
LdapWizard.findAvailableGroups(avgrEl, this.target + "s");
}
-}
+};
+
+LdapFilter.prototype.updateCount = function() {
+ if(this.target === 'User') {
+ LdapWizard.countUsers();
+ } else if (this.target === 'Group') {
+ LdapWizard.countGroups();
+ }
+};
}
},
- _countThings: function(method) {
+ _countThings: function(method, spinnerID) {
param = 'action='+method+
'&ldap_serverconfig_chooser='+
encodeURIComponent($('#ldap_serverconfig_chooser').val());
+ LdapWizard.showSpinner(spinnerID);
LdapWizard.ajax(param,
function(result) {
LdapWizard.applyChanges(result);
+ LdapWizard.hideSpinner(spinnerID);
},
function (result) {
- // error handling
+ OC.Notification.show('Counting the entries failed with, ' + result.message);
+ LdapWizard.hideSpinner(spinnerID);
}
);
},
countGroups: function() {
- LdapWizard._countThings('countGroups');
+ LdapWizard._countThings('countGroups', '#ldap_group_count');
},
countUsers: function() {
- LdapWizard._countThings('countUsers');
+ LdapWizard._countThings('countUsers', '#ldap_user_count');
},
detectEmailAttribute: function() {
init: function() {
LdapWizard.instantiateFilters();
+ LdapWizard.admin.setExperienced($('#ldap_experienced_admin').is(':checked'));
LdapWizard.basicStatusCheck();
LdapWizard.functionalityCheck();
LdapWizard.isConfigurationActiveControlLocked = false;
LdapWizard.userFilter = new LdapFilter('User', function(mode) {
LdapWizard.userFilter.findFeatures();
});
+ $('#rawUserFilterContainer .ldapGetEntryCount').click(function(event) {
+ event.preventDefault();
+ $('#ldap_user_count').text('');
+ LdapWizard.userFilter.updateCount();
+ LdapWizard.detectEmailAttribute();
+ $('#ldap_user_count').removeClass('hidden');
+ });
delete LdapWizard.loginFilter;
LdapWizard.loginFilter = new LdapFilter('Login', function(mode) {
LdapWizard.groupFilter = new LdapFilter('Group', function(mode) {
LdapWizard.groupFilter.findFeatures();
});
+ $('#rawGroupFilterContainer .ldapGetEntryCount').click(function(event) {
+ event.preventDefault();
+ $('#ldap_group_count').text('');
+ LdapWizard.groupFilter.updateCount();
+ LdapWizard.detectGroupMemberAssoc();
+ $('#ldap_group_count').removeClass('hidden');
+ });
},
userFilterObjectClassesHasRun: false,
}
}
- if(triggerObj.id == 'ldap_userlist_filter') {
+ if(triggerObj.id == 'ldap_userlist_filter' && !LdapWizard.admin.isExperienced()) {
LdapWizard.countUsers();
LdapWizard.detectEmailAttribute();
- } else if(triggerObj.id == 'ldap_group_filter') {
+ } else if(triggerObj.id == 'ldap_group_filter' && !LdapWizard.admin.isExperienced()) {
LdapWizard.countGroups();
LdapWizard.detectGroupMemberAssoc();
}
'groupFilterGroupSelectState',
'ldapGroupFilterMode'
);
+ LdapWizard.admin.updateGroupTab(LdapWizard.groupFilter.getMode());
},
toggleRawLoginFilter: function() {
'userFilterGroupSelectState',
'ldapUserFilterMode'
);
+ LdapWizard.admin.updateUserTab(LdapWizard.userFilter.getMode());
},
updateStatusIndicator: function(isComplete) {
expAdminCB = $('#ldap_experienced_admin');
LdapWizard.admin = new ExperiencedAdmin(LdapWizard, expAdminCB.is(':checked'));
expAdminCB.change(function() {
- LdapWizard.admin.toggle($(this).is(':checked'));
+ LdapWizard.admin.setExperienced($(this).is(':checked'));
});
});
placeholder="<?php p($l->t('Raw LDAP filter'));?>"
title="<?php p($l->t('The filter specifies which LDAP groups shall have access to the %s instance.', $theme->getName()));?>"
/>
+ <button class="ldapGetEntryCount hidden" name="ldapGetEntryCount" type="button">
+ <?php p($l->t('Test Filter'));?>
+ </button>
</p>
<p>
<div class="ldapWizardInfo invisible"> </div>
</p>
- <p>
+ <p class="ldap_count">
<span id="ldap_group_count">0 <?php p($l->t('groups found'));?></span>
</p>
<?php print_unescaped($_['wizardControls']); ?>
</div>
-</fieldset>
\ No newline at end of file
+</fieldset>
placeholder="<?php p($l->t('Raw LDAP filter'));?>"
title="<?php p($l->t('The filter specifies which LDAP users shall have access to the %s instance.', $theme->getName()));?>"
/>
+ <button class="ldapGetEntryCount hidden" name="ldapGetEntryCount" type="button">
+ <?php p($l->t('Test Filter'));?>
+ </button>
</p>
<p>
<div class="ldapWizardInfo invisible"> </div>
</p>
- <p>
+ <p class="ldap_count">
<span id="ldap_user_count">0 <?php p($l->t('users found'));?></span>
</p>
<?php print_unescaped($_['wizardControls']); ?>
</div>
-</fieldset>
\ No newline at end of file
+</fieldset>