From ab87eded0e47ee4a730ffbe990edf70a3ee86a2e Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 15 May 2008 13:27:47 +0000 Subject: [PATCH] - Modification de LSformElement_password_generate : Modification du bouton view en hide (et vise versa) --- trunk/includes/js/LSform.js | 9 +++++++++ trunk/index_ajax.php | 5 +++-- trunk/templates/images/hide.png | Bin 0 -> 572 bytes 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 trunk/templates/images/hide.png diff --git a/trunk/includes/js/LSform.js b/trunk/includes/js/LSform.js index 290c038b..cb0ce1d0 100644 --- a/trunk/includes/js/LSform.js +++ b/trunk/includes/js/LSform.js @@ -219,6 +219,7 @@ var LSform = new Class({ var getAttrNameAndIdValues = getAttrNameAndId.exec(img.id); var attrName = getAttrNameAndIdValues[1]; var fieldId = 'LSformElement_password_' + attrName + '_' + getAttrNameAndIdValues[2]; + var viewBtnId = 'LSformElement_password_view_btn_userPassword_' + getAttrNameAndIdValues[2]; var data = { template: 'LSform', @@ -226,6 +227,7 @@ var LSform = new Class({ attribute: attrName, objecttype: $('LSform_objecttype').value, idform: $('LSform_idform').value, + viewBtnId: viewBtnId, fieldId: fieldId }; data.imgload=varLSdefault.loadingImgDisplay(img); @@ -244,6 +246,7 @@ var LSform = new Class({ varLSdefault.loadingImgHide(data.imgload); this.changeInputType($(data.fieldId),'text'); $(data.fieldId).value=data.generatePassword; + $(data.viewBtnId).setProperty('src','templates/images/hide.png'); this.LSformElement_password_generate_inputHistory[data.fieldId]=data.generatePassword; } } @@ -260,6 +263,10 @@ var LSform = new Class({ onLSformElement_password_generate_inputModify: function(input) { input.value=''; input = this.changeInputType(input,'password'); + var getAttrNameAndId = /LSformElement_password_(.*)_([0-9]*)/ + var attrNameAndId = getAttrNameAndId.exec(input.id); + var viewBtnId = 'LSformElement_password_view_btn_' + attrNameAndId[1] + '_' + attrNameAndId[2]; + $(viewBtnId).setProperty('src','templates/images/view.png'); this.LSformElement_password_generate_inputHistory[input.id]=''; input.focus(); }, @@ -274,9 +281,11 @@ var LSform = new Class({ if (input.type=='password') { input = this.changeInputType(input,'text'); + img.setProperty('src','templates/images/hide.png'); } else { input = this.changeInputType(input,'password'); + img.setProperty('src','templates/images/view.png'); } input.focus(); }, diff --git a/trunk/index_ajax.php b/trunk/index_ajax.php index 0ff700cf..65b64e11 100644 --- a/trunk/index_ajax.php +++ b/trunk/index_ajax.php @@ -79,7 +79,7 @@ if (!isset($_ERRORS)) { } break; case 'generatePassword': - if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['fieldId'])) && (isset($_REQUEST['idform'])) ) { + if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['viewBtnId'])) && (isset($_REQUEST['fieldId'])) && (isset($_REQUEST['idform'])) ) { $object = new $_REQUEST['objecttype'](); $form = $object -> getForm($_REQUEST['idform']); $field=$form -> getElement($_REQUEST['attribute']); @@ -87,7 +87,8 @@ if (!isset($_ERRORS)) { if ( $val ) { $data = array( 'generatePassword' => $val, - 'fieldId' => $_REQUEST['fieldId'] + 'fieldId' => $_REQUEST['fieldId'], + 'viewBtnId' => $_REQUEST['viewBtnId'] ); } else { diff --git a/trunk/templates/images/hide.png b/trunk/templates/images/hide.png new file mode 100644 index 0000000000000000000000000000000000000000..0cb777a46620ab1194d23751f09b188882b84659 GIT binary patch literal 572 zcmV-C0>k}@P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iOG< z4F)G!vMPE200F#7L_t(I%axK}OH*MS$3M^c;}QoGWnQ^KONceL3Iq|~fG;5HqPqsW zFjFG%9YiJ58!5x^QV`S|L82A(24Z?4EQh8w+Q3dH*M>{k+0%ub!{#{)`@(bae4pp@ zdw%?$uULGuux$gL8^LgS! zqa>1JZD9cAVh4fl0K54-*9X1fIgahNm95;O}og(c|}VRMSPXuShA8vf&u_7nfXc`QtV|U8TRL6DfpjDF8I;^*R7X zJmG>%nJm>m7Cud(^z%2pSFA?MH=akd10z1*f;V5iBWzYtb&Z3fLG8@K+}Y5ol}f?s zKvmThuaGRKl0zI=oygT|Boenm6O-egu_tNgy7`|cCdXd{gMHJ@ zzQ4;)>_&_qhH;*k!vlAL=8$-4b}lXLB2Iz-lrlS)wg74;C;SCxp4bzULg!=v0000< KMNUMnLSTY{4*W6z literal 0 HcmV?d00001