JS cleanup

This commit is contained in:
Arthur Schiwon 2015-01-13 18:36:16 +01:00
parent 55672280e0
commit 51d783ca6e
3 changed files with 26 additions and 34 deletions

View File

@ -25,12 +25,11 @@ function ExperiencedAdmin(wizard, initialState) {
/** /**
* toggles whether the admin is an experienced one or not * 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) { ExperiencedAdmin.prototype.setExperienced = function(isExperienced) {
this._isExperienced = isExperienced; this._isExperienced = isExperienced;
if(this._isExperienced) { if(this._isExperienced) { this.enableRawMode();
this.enableRawMode();
this.hideEntryCounters(); this.hideEntryCounters();
} else { } else {
this.showEntryCounters(); this.showEntryCounters();

View File

@ -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 * this function is triggered after LDAP filters have been composed successfully
* @param {object} result returned by the ajax call * @param {object} result returned by the ajax call
@ -99,11 +91,13 @@ LdapFilter.prototype.determineMode = function() {
function(result) { function(result) {
var property = 'ldap' + filter.target + 'FilterMode'; var property = 'ldap' + filter.target + 'FilterMode';
filter.mode = parseInt(result.changes[property], 10); filter.mode = parseInt(result.changes[property], 10);
if(filter.mode === LdapWizard.filterModeRaw && var rawContainerIsInvisible =
$('#raw'+filter.target+'FilterContainer').hasClass('invisible')) { $('#raw'+filter.target+'FilterContainer').hasClass('invisible');
if(filter.mode === LdapWizard.filterModeRaw
&& rawContainerIsInvisible) {
LdapWizard['toggleRaw'+filter.target+'Filter'](); LdapWizard['toggleRaw'+filter.target+'Filter']();
} else if(filter.mode === LdapWizard.filterModeAssisted && } else if(filter.mode === LdapWizard.filterModeAssisted
!$('#raw'+filter.target+'FilterContainer').hasClass('invisible')) { && !rawContainerIsInvisible) {
LdapWizard['toggleRaw'+filter.target+'Filter'](); LdapWizard['toggleRaw'+filter.target+'Filter']();
} else { } else {
console.log('LDAP Wizard determineMode: returned mode was »' + 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 * this function is triggered before user and group counts are executed
* resolving the passed status variable will fire up counting * resolving the passed status variable will fire up counting
* @param {object} status an instance of $.Deferred
*/ */
LdapFilter.prototype.beforeUpdateCount = function() { LdapFilter.prototype.beforeUpdateCount = function() {
var status = $.Deferred(); var status = $.Deferred();

View File

@ -207,7 +207,7 @@ var LdapWizard = {
}, },
basicStatusCheck: function() { 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 // - host, port, user filter, agent dn, password, base dn
var host = $('#ldap_host').val(); var host = $('#ldap_host').val();
var port = $('#ldap_port').val(); var port = $('#ldap_port').val();
@ -224,7 +224,7 @@ var LdapWizard = {
blacklistAdd: function(id) { blacklistAdd: function(id) {
obj = $('#'+id); var obj = $('#' + id);
if(!(obj[0].hasOwnProperty('multiple') && obj[0]['multiple'] === true)) { if(!(obj[0].hasOwnProperty('multiple') && obj[0]['multiple'] === true)) {
//no need to blacklist multiselect //no need to blacklist multiselect
LdapWizard.saveBlacklist[id] = true; LdapWizard.saveBlacklist[id] = true;
@ -242,14 +242,14 @@ var LdapWizard = {
}, },
checkBaseDN: function() { checkBaseDN: function() {
host = $('#ldap_host').val(); var host = $('#ldap_host').val();
port = $('#ldap_port').val(); var port = $('#ldap_port').val();
user = $('#ldap_dn').val(); var user = $('#ldap_dn').val();
pass = $('#ldap_agent_password').val(); var pass = $('#ldap_agent_password').val();
//FIXME: determine base dn with anonymous access //FIXME: determine base dn with anonymous access
if(host && port && user && pass) { if(host && port && user && pass) {
param = 'action=guessBaseDN'+ var param = 'action=guessBaseDN'+
'&ldap_serverconfig_chooser='+ '&ldap_serverconfig_chooser='+
encodeURIComponent($('#ldap_serverconfig_chooser').val()); encodeURIComponent($('#ldap_serverconfig_chooser').val());
@ -276,11 +276,11 @@ var LdapWizard = {
}, },
checkPort: function() { checkPort: function() {
host = $('#ldap_host').val(); var host = $('#ldap_host').val();
port = $('#ldap_port').val(); var port = $('#ldap_port').val();
if(host && !port) { if(host && !port) {
param = 'action=guessPortAndTLS'+ var param = 'action=guessPortAndTLS'+
'&ldap_serverconfig_chooser='+ '&ldap_serverconfig_chooser='+
encodeURIComponent($('#ldap_serverconfig_chooser').val()); encodeURIComponent($('#ldap_serverconfig_chooser').val());
@ -307,7 +307,7 @@ var LdapWizard = {
}, },
controlBack: function() { controlBack: function() {
curTabIndex = $('#ldapSettings').tabs('option', 'active'); var curTabIndex = $('#ldapSettings').tabs('option', 'active');
if(curTabIndex == 0) { if(curTabIndex == 0) {
return; return;
} }
@ -316,7 +316,7 @@ var LdapWizard = {
}, },
controlContinue: function() { controlContinue: function() {
curTabIndex = $('#ldapSettings').tabs('option', 'active'); var curTabIndex = $('#ldapSettings').tabs('option', 'active');
if(curTabIndex == 3) { if(curTabIndex == 3) {
return; return;
} }
@ -529,7 +529,7 @@ var LdapWizard = {
if(type !== 'User' && type !== 'Group') { if(type !== 'User' && type !== 'Group') {
return false; return false;
} }
param = 'action=determine'+encodeURIComponent(type)+'ObjectClasses'+ var param = 'action=determine'+encodeURIComponent(type)+'ObjectClasses'+
'&ldap_serverconfig_chooser='+ '&ldap_serverconfig_chooser='+
encodeURIComponent($('#ldap_serverconfig_chooser').val()); encodeURIComponent($('#ldap_serverconfig_chooser').val());
@ -571,11 +571,11 @@ var LdapWizard = {
functionalityCheck: function() { functionalityCheck: function() {
//criteria to enable the connection: //criteria to enable the connection:
// - host, port, basedn, user filter, login filter // - host, port, basedn, user filter, login filter
host = $('#ldap_host').val(); var host = $('#ldap_host').val();
port = $('#ldap_port').val(); var port = $('#ldap_port').val();
base = $('#ldap_base').val(); var base = $('#ldap_base').val();
userfilter = $('#ldap_userlist_filter').val(); var userfilter = $('#ldap_userlist_filter').val();
loginfilter = $('#ldap_login_filter').val(); var loginfilter = $('#ldap_login_filter').val();
//FIXME: activates a manually deactivated configuration. //FIXME: activates a manually deactivated configuration.
if(host && port && base && userfilter && loginfilter) { if(host && port && base && userfilter && loginfilter) {