From 9046b96b4c327b3b1a1499dcc67a61b0ba5d25e8 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 10 Nov 2008 02:12:36 +0000 Subject: [PATCH] - LSformElement_password : Ajout de LStips sur les boutons --- .../class/class.LSformElement_password.php | 15 ++++++++++++++ .../js/LSformElement_password_field.js | 20 ++++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/trunk/includes/class/class.LSformElement_password.php b/trunk/includes/class/class.LSformElement_password.php index 3f3fcc80..0dc2118d 100644 --- a/trunk/includes/class/class.LSformElement_password.php +++ b/trunk/includes/class/class.LSformElement_password.php @@ -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(); } diff --git a/trunk/includes/js/LSformElement_password_field.js b/trunk/includes/js/LSformElement_password_field.js index 7b8e1e25..b2fdc2b0 100644 --- a/trunk/includes/js/LSformElement_password_field.js +++ b/trunk/includes/js/LSformElement_password_field.js @@ -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'));