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
*
* @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();

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
* @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();

View File

@ -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) {