- LSformElement_password : Ajout de LStips sur les boutons

This commit is contained in:
Benjamin Renard 2008-11-10 02:12:36 +00:00
parent 8ed72e7613
commit 9046b96b4c
2 changed files with 30 additions and 5 deletions

View file

@ -108,6 +108,21 @@ class LSformElement_password extends LSformElement {
$return = $this -> getLabelInfos();
$pwd = "";
if (!$this -> isFreeze()) {
// Help Infos
$GLOBALS['LSsession'] -> addHelpInfos(
'LSformElement_password',
array(
'generate' => _('Générer un mot de passe.'),
'verify' => _('Verifier si le mot de passe saisi correspond à celui stocké.'),
'view' => _('Voir le mot de passe.'),
'hide' => _('Cacher le mot de passe.'),
'mail' => _("Le mot de passe sera envoyé par mail en cas de modification. Cliquer pour désactiver l'envoi."),
'nomail' => _("Le mot de passe ne sera pas envoyé par mail en cas de modification. Cliquer pour activer l'envoi."),
'editmail' => _("Editer le mail qui sera envoyé à l'utilisateur")
)
);
if (($this -> params['html_options']['generationTool'])&&($this -> params['html_options']['autoGenerate'])&&(empty($this -> values))) {
$pwd=$this->generatePassword();
}

View file

@ -17,6 +17,7 @@ var LSformElement_password_field = new Class({
this.editMailBtn.addEvent('click',this.onEditMailBtnClick.bind(this));
this.LSmail_open = 0;
this.editMailBtn.injectAfter(this.input);
varLSdefault.addHelpInfo(this.editMailBtn,'LSformElement_password','editmail');
}
if (this.params.mail['ask']) {
this.mailBtn = new Element('img');
@ -29,11 +30,13 @@ var LSformElement_password_field = new Class({
});
if (this.params.mail['send']) {
this.mailInput.value = 1;
this.mailBtn.src = varLSdefault.imagePath('nomail.png');
this.mailBtn.src = varLSdefault.imagePath('mail.png');
varLSdefault.addHelpInfo(this.mailBtn,'LSformElement_password','mail');
}
else {
this.mailInput.value = 0;
this.mailBtn.src = varLSdefault.imagePath('mail.png');
this.mailBtn.src = varLSdefault.imagePath('nomail.png');
varLSdefault.addHelpInfo(this.mailBtn,'LSformElement_password','nomail');
}
this.mailBtn.injectAfter(this.input);
this.mailInput.injectAfter(this.mailBtn);
@ -46,6 +49,7 @@ var LSformElement_password_field = new Class({
this.viewBtn.addClass('btn');
this.viewBtn.addEvent('click',this.changeInputType.bind(this));
this.viewBtn.injectAfter(this.input);
varLSdefault.addHelpInfo(this.viewBtn,'LSformElement_password','view');
// Verify
if (this.params['verify']) {
@ -56,6 +60,7 @@ var LSformElement_password_field = new Class({
this.verifyBtn.addClass('btn');
this.verifyBtn.addEvent('click',this.onVerifyBtnClick.bind(this));
this.verifyBtn.injectAfter(this.input);
varLSdefault.addHelpInfo(this.verifyBtn,'LSformElement_password','verify');
}
if (this.params['generate']) {
@ -64,6 +69,7 @@ var LSformElement_password_field = new Class({
this.generateBtn.addClass('btn');
this.generateBtn.addEvent('click',this.onGenerateBtnClick.bind(this));
this.generateBtn.injectAfter(this.input);
varLSdefault.addHelpInfo(this.generateBtn,'LSformElement_password','generate');
}
this.initialize_input();
@ -77,13 +83,15 @@ var LSformElement_password_field = new Class({
},
onMailBtnClick: function() {
if (this.mailInput.value==1) {
this.mailInput.value = 0;
if (this.mailInput.value==0) {
this.mailInput.value = 1;
this.mailBtn.src = varLSdefault.imagePath('mail.png');
varLSdefault.setHelpInfo(this.mailBtn,'LSformElement_password','mail');
}
else {
this.mailInput.value = 1;
this.mailInput.value = 0;
this.mailBtn.src = varLSdefault.imagePath('nomail.png');
varLSdefault.setHelpInfo(this.mailBtn,'LSformElement_password','nomail');
}
},
@ -154,10 +162,12 @@ var LSformElement_password_field = new Class({
if (this.input.type=='password') {
var newType = 'text';
this.viewBtn.src=varLSdefault.imagePath('hide.png');
varLSdefault.setHelpInfo(this.viewBtn,'LSformElement_password','hide');
}
else {
var newType = 'password';
this.viewBtn.src=varLSdefault.imagePath('view.png');
varLSdefault.setHelpInfo(this.viewBtn,'LSformElement_password','view');
}
var newInput = new Element('input');
newInput.setProperty('name',this.input.getProperty('name'));