ldapsaisie/trunk/includes/js/LSsession_login.js
Benjamin Renard 748c9d3ec3 - Modifications diverses suite à plusieurs mise en production :
- Correction de bugs
        - Passage à Net_LDAP2
        - Ajout du changement de niveau de l'annuaire durant la navigation
2008-04-25 13:48:12 +00:00

52 lines
1.6 KiB
JavaScript

var LSsession_login = new Class({
initialize: function(){
this.select_ldapserver = $('LSsession_ldapserver');
if ( ! this.select_ldapserver )
return;
this.select_ldapserver.addEvent('change',this.onLdapServerChanged.bind(this));
this.onLdapServerChanged();
},
onLdapServerChanged: function(){
var imgload = varLSdefault.loadingImgDisplay(this.select_ldapserver);
var server = this.select_ldapserver.value;
var data = {
template: 'login',
action: 'onLdapServerChanged',
server: server,
imgload: imgload
};
new Ajax('index_ajax.php', {data: data, onComplete: this.onLdapServerChangedComplete.bind(this)}).request();
},
onLdapServerChangedComplete: function(responseText, responseXML){
varLSdefault.loadingImgHide();
var data = Json.evaluate(responseText);
LSdebug(data);
if ( data ) {
if (data.LSdebug) {
varLSdefault.displayDebug(data.LSdebug);
}
if (data.LSerror) {
varLSdefault.displayError(data.LSerror);
return;
}
if (data.list_topDn) {
$('LSsession_topDn').getParent().setHTML(data.list_topDn);
LSdebug($('LSsession_topDn').innerHTML);
$$('.loginform-level').each(function(el) {
el.setStyle('display','block');
});
}
}
else {
$$('.loginform-level').each(function(el) {
el.setStyle('display','none');
});
$('LSsession_topDn').empty();
}
}
});
window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSsession_login = new LSsession_login();
});