From 51d783ca6e2d8341531b12224c7e2f51fe70fdfe Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 13 Jan 2015 18:36:16 +0100 Subject: [PATCH] JS cleanup --- apps/user_ldap/js/experiencedAdmin.js | 5 ++-- apps/user_ldap/js/ldapFilter.js | 19 +++++--------- apps/user_ldap/js/settings.js | 36 +++++++++++++-------------- 3 files changed, 26 insertions(+), 34 deletions(-) diff --git a/apps/user_ldap/js/experiencedAdmin.js b/apps/user_ldap/js/experiencedAdmin.js index 8d138eecc4..f9820c56c9 100644 --- a/apps/user_ldap/js/experiencedAdmin.js +++ b/apps/user_ldap/js/experiencedAdmin.js @@ -25,12 +25,11 @@ function ExperiencedAdmin(wizard, initialState) { /** * toggles whether the admin is an experienced one or not * - * @param {boolean} whether the admin is experienced or not + * @param {boolean} isExperienced whether the admin is experienced or not */ ExperiencedAdmin.prototype.setExperienced = function(isExperienced) { this._isExperienced = isExperienced; - if(this._isExperienced) { - this.enableRawMode(); + if(this._isExperienced) { this.enableRawMode(); this.hideEntryCounters(); } else { this.showEntryCounters(); diff --git a/apps/user_ldap/js/ldapFilter.js b/apps/user_ldap/js/ldapFilter.js index 0f7d240ada..c77995e0de 100644 --- a/apps/user_ldap/js/ldapFilter.js +++ b/apps/user_ldap/js/ldapFilter.js @@ -69,14 +69,6 @@ LdapFilter.prototype.compose = function(updateCount) { ); }; -/** - * this function is triggered after attribute detectors have completed in - * LdapWizard - */ -LdapFilter.prototype.afterDetectorsRan = function() { - this.updateCount(); -}; - /** * this function is triggered after LDAP filters have been composed successfully * @param {object} result returned by the ajax call @@ -99,11 +91,13 @@ LdapFilter.prototype.determineMode = function() { function(result) { var property = 'ldap' + filter.target + 'FilterMode'; filter.mode = parseInt(result.changes[property], 10); - if(filter.mode === LdapWizard.filterModeRaw && - $('#raw'+filter.target+'FilterContainer').hasClass('invisible')) { + var rawContainerIsInvisible = + $('#raw'+filter.target+'FilterContainer').hasClass('invisible'); + if(filter.mode === LdapWizard.filterModeRaw + && rawContainerIsInvisible) { LdapWizard['toggleRaw'+filter.target+'Filter'](); - } else if(filter.mode === LdapWizard.filterModeAssisted && - !$('#raw'+filter.target+'FilterContainer').hasClass('invisible')) { + } else if(filter.mode === LdapWizard.filterModeAssisted + && !rawContainerIsInvisible) { LdapWizard['toggleRaw'+filter.target+'Filter'](); } else { console.log('LDAP Wizard determineMode: returned mode was ยป' + @@ -167,7 +161,6 @@ LdapFilter.prototype.findFeatures = function() { /** * this function is triggered before user and group counts are executed * resolving the passed status variable will fire up counting - * @param {object} status an instance of $.Deferred */ LdapFilter.prototype.beforeUpdateCount = function() { var status = $.Deferred(); diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js index 6db210fe43..3372613b94 100644 --- a/apps/user_ldap/js/settings.js +++ b/apps/user_ldap/js/settings.js @@ -207,7 +207,7 @@ var LdapWizard = { }, basicStatusCheck: function() { - //criterias to continue from the first tab + //criteria to continue from the first tab // - host, port, user filter, agent dn, password, base dn var host = $('#ldap_host').val(); var port = $('#ldap_port').val(); @@ -224,7 +224,7 @@ var LdapWizard = { blacklistAdd: function(id) { - obj = $('#'+id); + var obj = $('#' + id); if(!(obj[0].hasOwnProperty('multiple') && obj[0]['multiple'] === true)) { //no need to blacklist multiselect LdapWizard.saveBlacklist[id] = true; @@ -242,14 +242,14 @@ var LdapWizard = { }, checkBaseDN: function() { - host = $('#ldap_host').val(); - port = $('#ldap_port').val(); - user = $('#ldap_dn').val(); - pass = $('#ldap_agent_password').val(); + var host = $('#ldap_host').val(); + var port = $('#ldap_port').val(); + var user = $('#ldap_dn').val(); + var pass = $('#ldap_agent_password').val(); //FIXME: determine base dn with anonymous access if(host && port && user && pass) { - param = 'action=guessBaseDN'+ + var param = 'action=guessBaseDN'+ '&ldap_serverconfig_chooser='+ encodeURIComponent($('#ldap_serverconfig_chooser').val()); @@ -276,11 +276,11 @@ var LdapWizard = { }, checkPort: function() { - host = $('#ldap_host').val(); - port = $('#ldap_port').val(); + var host = $('#ldap_host').val(); + var port = $('#ldap_port').val(); if(host && !port) { - param = 'action=guessPortAndTLS'+ + var param = 'action=guessPortAndTLS'+ '&ldap_serverconfig_chooser='+ encodeURIComponent($('#ldap_serverconfig_chooser').val()); @@ -307,7 +307,7 @@ var LdapWizard = { }, controlBack: function() { - curTabIndex = $('#ldapSettings').tabs('option', 'active'); + var curTabIndex = $('#ldapSettings').tabs('option', 'active'); if(curTabIndex == 0) { return; } @@ -316,7 +316,7 @@ var LdapWizard = { }, controlContinue: function() { - curTabIndex = $('#ldapSettings').tabs('option', 'active'); + var curTabIndex = $('#ldapSettings').tabs('option', 'active'); if(curTabIndex == 3) { return; } @@ -529,7 +529,7 @@ var LdapWizard = { if(type !== 'User' && type !== 'Group') { return false; } - param = 'action=determine'+encodeURIComponent(type)+'ObjectClasses'+ + var param = 'action=determine'+encodeURIComponent(type)+'ObjectClasses'+ '&ldap_serverconfig_chooser='+ encodeURIComponent($('#ldap_serverconfig_chooser').val()); @@ -571,11 +571,11 @@ var LdapWizard = { functionalityCheck: function() { //criteria to enable the connection: // - host, port, basedn, user filter, login filter - host = $('#ldap_host').val(); - port = $('#ldap_port').val(); - base = $('#ldap_base').val(); - userfilter = $('#ldap_userlist_filter').val(); - loginfilter = $('#ldap_login_filter').val(); + var host = $('#ldap_host').val(); + var port = $('#ldap_port').val(); + var base = $('#ldap_base').val(); + var userfilter = $('#ldap_userlist_filter').val(); + var loginfilter = $('#ldap_login_filter').val(); //FIXME: activates a manually deactivated configuration. if(host && port && base && userfilter && loginfilter) {