- Correction bug [#1664] Pas d'image de chargement Ajax

de la liste des serveurs sur la page de login
This commit is contained in:
Benjamin Renard 2008-05-15 15:21:54 +00:00
parent ab87eded0e
commit 7d9399bffe
4 changed files with 76 additions and 44 deletions

View file

@ -57,10 +57,16 @@ var LSdefault = new Class({
(function(){new Fx.Style(this.LSerror,'opacity',{duration:500}).start(0.8,0);}).delay(5000, this);
},
loadingImgDisplay: function(el,position) {
loadingImgDisplay: function(el,position,size) {
this.loading_img_id++;
this.loading_img[this.loading_img_id] = new Element('img');
this.loading_img[this.loading_img_id].src='templates/images/ajax-loader.gif';
if (size=='big') {
var src = 'templates/images/loading.gif';
}
else {
var src = 'templates/images/ajax-loader.gif';
}
this.loading_img[this.loading_img_id].src=src;
if (position=='inside') {
this.loading_img[this.loading_img_id].injectInside(el);
}

View file

@ -3,12 +3,26 @@ var LSsession_login = new Class({
this.select_ldapserver = $('LSsession_ldapserver');
if ( ! this.select_ldapserver )
return;
this.loading_zone = $('loading_zone');
this.select_ldapserver.addEvent('change',this.onLdapServerChanged.bind(this));
this.onLdapServerChanged();
this.onLdapServerChanged();
},
disableInput: function() {
$$('input').each(function(el) {
el.setProperty('disabled','1');
});
},
enableInput: function() {
$$('input').each(function(el) {
el.setProperty('disabled','');
});
},
onLdapServerChanged: function(){
var imgload = varLSdefault.loadingImgDisplay(this.select_ldapserver);
this.disableInput();
var imgload = varLSdefault.loadingImgDisplay(this.loading_zone,'inside','big');
var server = this.select_ldapserver.value;
var data = {
template: 'login',
@ -24,7 +38,7 @@ var LSsession_login = new Class({
var data = Json.evaluate(responseText);
LSdebug(data);
if ( data ) {
if (data.LSdebug) {
if (data.LSdebug) {
varLSdefault.displayDebug(data.LSdebug);
}
if (data.LSerror) {
@ -38,6 +52,11 @@ var LSsession_login = new Class({
el.setStyle('display','block');
});
}
else {
$$('.loginform-level').each(function(el) {
el.setStyle('display','none');
});
}
}
else {
$$('.loginform-level').each(function(el) {
@ -45,6 +64,7 @@ var LSsession_login = new Class({
});
$('LSsession_topDn').empty();
}
this.enableInput();
}
});
window.addEvent(window.ie ? 'load' : 'domready', function() {

View file

@ -1,50 +1,55 @@
#loginform-logo {
float: left;
float: left;
}
div.loginform {
margin: auto;
margin-top: 10%;
border: 1px solid #69c;
padding: 1em;
width: 30em;
background: transparent url(../images/login_fd.png) no-repeat scroll 98% 98%;
margin: auto;
margin-top: 10%;
border: 1px solid #69c;
padding: 1em;
width: 30em;
background: transparent url(../images/login_fd.png) no-repeat scroll 98% 98%;
}
dl.loginform {
margin: 0;
padding: 0;
margin: 0;
padding: 0;
}
.loginform dt {
position: relative;
left: 0;
top: 1.1em;
width: 8em;
font-weight: bold;
font-size: 0.9em;
position: relative;
left: 0;
top: 1.1em;
width: 8em;
font-weight: bold;
font-size: 0.9em;
}
.loginform dd {
margin: 0 0 0 9em;
padding: 0 0 0em 0em;
margin: 0 0 0 9em;
padding: 0 0 0em 0em;
}
.loginform-level{
display: none;
display: none;
}
.loginform-id {
visibility: hidden;
visibility: hidden;
}
.loginform input, .loginform select {
border: 1px inset #ccc;
width: 13em;
border: 1px inset #ccc;
width: 13em;
}
.loginform input[type='submit'] {
border: 1px outset #ccc;
width: 11em;
margin: 1em;
border: 1px outset #ccc;
width: 11em;
margin: 1em;
}
#loading_zone {
float: right;
margin-left: 1em;
}

View file

@ -1,35 +1,36 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>LdapSaisie{if $pagetitle != ''} - {$pagetitle}{/if}</title>
<link rel="stylesheet" type="text/css" href="templates/css/login.css" media="screen" title="Normal" />
{$LSsession_css}
{$LSsession_js}
</head>
<head>
<title>LdapSaisie{if $pagetitle != ''} - {$pagetitle}{/if}</title>
<link rel="stylesheet" type="text/css" href="templates/css/login.css" media="screen" title="Normal" />
{$LSsession_css}
{$LSsession_js}
</head>
<body>
<div id='LSerror'>
{$LSerrors}
</div>
<div id='LSdebug'>
<a href='#' id='LSdebug_hidden'>X</a>
<div id='LSdebug_infos'>{if $LSdebug != ''}{$LSdebug}{/if}</div>
<a href='#' id='LSdebug_hidden'>X</a>
<div id='LSdebug_infos'>{if $LSdebug != ''}{$LSdebug}{/if}</div>
</div>
<div class='loginform'>
<img src='templates/images/logo.png' alt='Logo' id='loginform_logo' />
<div id='loading_zone'></div>
<form action='{$loginform_action}' method='post'>
<dl class='loginform'>
<dt {$loginform_ldapserver_style}>{$loginform_label_ldapserver}</dt>
<dd {$loginform_ldapserver_style}>
<select name='LSsession_ldapserver' id='LSsession_ldapserver'>{html_options values=$loginform_ldapservers_index output=$loginform_ldapservers_name selected=$ldapServerId}</select>
</dd>
<select name='LSsession_ldapserver' id='LSsession_ldapserver'>{html_options values=$loginform_ldapservers_index output=$loginform_ldapservers_name selected=$ldapServerId}</select>
</dd>
<dt class='loginform-level' {$loginform_ldapserver_style}>{$loginform_label_level}</dt>
<dd class='loginform-level' {$loginform_ldapserver_style}><select name='LSsession_topDn' id='LSsession_topDn'>{html_options values=$loginform_topdn_index output=$loginform_topdn_name selected=$topDn}</select></dd>
<dt>{$loginform_label_user}</dt>
<dd><input type='text' name='LSsession_user' /></dd>
<dt>{$loginform_label_pwd}</dt>
<dd><input type='password' name='LSsession_pwd' /></dd>
<dd><input type='submit' value='{$loginform_label_submit}' /></dd>
<dt>{$loginform_label_user}</dt>
<dd><input type='text' name='LSsession_user' /></dd>
<dt>{$loginform_label_pwd}</dt>
<dd><input type='password' name='LSsession_pwd' /></dd>
<dd><input type='submit' value='{$loginform_label_submit}' /></dd>
</dl>
</form>
</div>