- Modification de LSformElement_password_generate :

Modification du bouton view en hide (et vise versa)
This commit is contained in:
Benjamin Renard 2008-05-15 13:27:47 +00:00
parent a1b75aab6b
commit ab87eded0e
3 changed files with 12 additions and 2 deletions

View file

@ -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();
},

View file

@ -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 {

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B