2008-02-05 17:11:21 +01:00
|
|
|
var LSsession_login = new Class({
|
|
|
|
initialize: function(){
|
2008-02-26 18:40:05 +01:00
|
|
|
this.select_ldapserver = $('LSsession_ldapserver');
|
|
|
|
if ( ! this.select_ldapserver )
|
|
|
|
return;
|
2008-05-15 17:21:54 +02:00
|
|
|
this.loading_zone = $('loading_zone');
|
2008-10-14 19:16:52 +02:00
|
|
|
this.recoverPasswordElements = $$('.LSsession_recoverPassword');
|
2008-02-26 18:40:05 +01:00
|
|
|
this.select_ldapserver.addEvent('change',this.onLdapServerChanged.bind(this));
|
2008-05-15 17:21:54 +02:00
|
|
|
this.onLdapServerChanged();
|
|
|
|
},
|
|
|
|
|
|
|
|
disableInput: function() {
|
|
|
|
$$('input').each(function(el) {
|
|
|
|
el.setProperty('disabled','1');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
enableInput: function() {
|
|
|
|
$$('input').each(function(el) {
|
|
|
|
el.setProperty('disabled','');
|
|
|
|
});
|
2008-02-05 17:11:21 +01:00
|
|
|
},
|
|
|
|
|
2008-02-26 18:40:05 +01:00
|
|
|
onLdapServerChanged: function(){
|
2008-05-15 17:21:54 +02:00
|
|
|
this.disableInput();
|
|
|
|
var imgload = varLSdefault.loadingImgDisplay(this.loading_zone,'inside','big');
|
2008-02-26 18:40:05 +01:00
|
|
|
var server = this.select_ldapserver.value;
|
|
|
|
var data = {
|
2009-02-20 15:05:22 +01:00
|
|
|
noLSsession: 1,
|
|
|
|
template: 'LSsession',
|
|
|
|
action: 'onLdapServerChangedLogin',
|
|
|
|
server: server,
|
|
|
|
imgload: imgload
|
2008-02-26 18:40:05 +01:00
|
|
|
};
|
2008-07-05 22:28:49 +02:00
|
|
|
new Request({url: 'index_ajax.php', data: data, onSuccess: this.onLdapServerChangedComplete.bind(this)}).send();
|
2008-02-26 18:40:05 +01:00
|
|
|
},
|
2008-02-05 17:11:21 +01:00
|
|
|
|
2008-02-26 18:40:05 +01:00
|
|
|
onLdapServerChangedComplete: function(responseText, responseXML){
|
|
|
|
varLSdefault.loadingImgHide();
|
2008-07-05 22:28:49 +02:00
|
|
|
var data = JSON.decode(responseText);
|
2008-02-26 18:40:05 +01:00
|
|
|
LSdebug(data);
|
2008-07-05 22:28:49 +02:00
|
|
|
if ( varLSdefault.checkAjaxReturn(data) ) {
|
2008-04-25 15:48:12 +02:00
|
|
|
if (data.list_topDn) {
|
2008-07-05 22:28:49 +02:00
|
|
|
$('LSsession_topDn').getParent().set('html',data.list_topDn);
|
2008-02-26 18:40:05 +01:00
|
|
|
LSdebug($('LSsession_topDn').innerHTML);
|
2009-01-02 17:00:25 +01:00
|
|
|
$('LSsession_topDn_label').set('html',data.subDnLabel);
|
2008-02-26 18:40:05 +01:00
|
|
|
$$('.loginform-level').each(function(el) {
|
|
|
|
el.setStyle('display','block');
|
|
|
|
});
|
|
|
|
}
|
2008-05-15 17:21:54 +02:00
|
|
|
else {
|
2008-06-05 15:21:18 +02:00
|
|
|
this.loginformLevelHide();
|
2008-05-15 17:21:54 +02:00
|
|
|
}
|
2008-10-14 19:02:18 +02:00
|
|
|
if (data.recoverPassword) {
|
2008-10-14 19:16:52 +02:00
|
|
|
this.recoverPasswordElements.each(function(el) {
|
|
|
|
el.removeClass('LSsession_recoverPassword_hidden');
|
|
|
|
},this);
|
2008-10-14 19:02:18 +02:00
|
|
|
}
|
|
|
|
else {
|
2008-10-14 19:16:52 +02:00
|
|
|
this.recoverPasswordElements.each(function(el) {
|
|
|
|
el.addClass('LSsession_recoverPassword_hidden');
|
|
|
|
},this);
|
2008-10-14 19:02:18 +02:00
|
|
|
}
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
else {
|
2008-06-05 15:21:18 +02:00
|
|
|
this.loginformLevelHide();
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
2008-05-15 17:21:54 +02:00
|
|
|
this.enableInput();
|
2008-06-05 15:21:18 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
loginformLevelHide: function(){
|
|
|
|
$$('.loginform-level').each(function(el) {
|
|
|
|
el.setStyle('display','none');
|
|
|
|
});
|
|
|
|
$('LSsession_topDn').empty();
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
2008-02-05 17:11:21 +01:00
|
|
|
});
|
|
|
|
window.addEvent(window.ie ? 'load' : 'domready', function() {
|
2008-02-26 18:40:05 +01:00
|
|
|
varLSsession_login = new LSsession_login();
|
2008-02-05 17:11:21 +01:00
|
|
|
});
|