BUG 7233 added a new "User Editor for users imported by LDAP"

This commit is contained in:
Alvaro Campos
2012-01-27 12:11:58 -04:00
parent 5ed9e3b63f
commit 4dc3a3e079
4 changed files with 426 additions and 12 deletions

View File

@@ -0,0 +1,157 @@
<form id="{$form_id}" name="{$form_name}" action="{$form_action}" class="{$form_className}" method="post" encType="multipart/form-data" style="margin:0px;" onsubmit='return validateForm("{$form_objectRequiredFields}".parseJSON());'>
<div class="borderForm" style="padding-left: 0pt; padding-right: 0pt; width:80%">
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="content" style="">
<table width="99%">
<tbody><tr>
<td valign="top">
<input class="notValidateThisFields" name="__notValidateThisFields__" id="__notValidateThisFields__" value="" type="hidden">
<input name="DynaformRequiredFields" id="DynaformRequiredFields" value="{$form_objectRequiredFields}" type="hidden">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td colspan="2" class="withoutLabel">{$form.menuUser}</td>
</tr>
<tr>
<td class="FormTitle" colspan="2" align="">{$form.TITLE3}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_PHOTO_SHOW}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_PHOTO_SHOW} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_PHOTO_SHOW}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_PHOTO}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_PHOTO} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_PHOTO}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_RESUME}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_RESUME} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_RESUME}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$MAX_FILES_SIZE}</td>
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.MAX_FILES_SIZE}</td>
</tr>
<tr>
<td class="FormTitle" colspan="2" align="">{$form.TITLE1}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font>{$USR_FIRSTNAME}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_FIRSTNAME} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_FIRSTNAME}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font>{$USR_LASTNAME}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_LASTNAME} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_LASTNAME}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font>{$USR_USERNAME}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_USERNAME} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_USERNAME}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font>{$USR_EMAIL}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_EMAIL} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_EMAIL}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_ADDRESS}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_ADDRESS} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_ADDRESS}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_ZIP_CODE}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_ZIP_CODE} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_ZIP_CODE}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_COUNTRY}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_COUNTRY} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_COUNTRY}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_CITY}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_CITY} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_CITY}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_LOCATION}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_LOCATION} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_LOCATION}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_PHONE}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_PHONE} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_PHONE}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_POSITION}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_POSITION} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_POSITION}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_REPORTS_TO}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_REPORTS_TO} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_REPORTS_TO}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_DEPARTMENT}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_DEPARTMENT} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_DEPARTMENT}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_REPLACED_BY}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_REPLACED_BY} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_REPLACED_BY}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font>{$USR_DUE_DATE}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_DUE_DATE} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_DUE_DATE}</td>
</tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font>{$USR_CALENDAR}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_DUE_DATE} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_CALENDAR}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_STATUS}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_STATUS} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_STATUS}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$USR_ROLE}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_ROLE} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_ROLE}</td>
</tr>
<tr>
<td class="FormTitle" colspan="2" align="">{$form.TITLE2}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font>{$USR_NEW_PASS}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_NEW_PASS} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_NEW_PASS}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font>{$USR_CNF_PASS}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_CNF_PASS} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_CNF_PASS}</td>
</tr>
<tr>
<td class="FormButton" colspan="2" align="center">{$form.SUBMIT} &nbsp; {$form.BTN_CANCEL}</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<div class="FormRequiredTextMessage"><font color="red">* </font>{php}echo (G::LoadTranslation('ID_REQUIRED_FIELD'));{/php}</div></div>
<div class="boxBottom"><div class="a"></div><div class="b"></div><div class="c"></div></div>
</div>
<script type="text/javascript">
{$form.JS}
</script>
</form>

View File

@@ -0,0 +1,256 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="myInfo" width="80%" labelWidth="350px" mode="" enableTemplate="1">
<menuUser type="xmlmenu" xmlfile="users/users_EditOptions"/>
<START_DATE type="phpVariable"/>
<END_DATE type="phpVariable"/>
<TITLE3 type="title" group="1">
<en>Profile</en>
</TITLE3>
<RANDOM type="private"/>
<USR_PHOTO_SHOW type="image" group="1" file="users/users_ViewPhoto?@#RANDOM" home="methods" style="height:96">
<en/>
</USR_PHOTO_SHOW>
<USR_PHOTO type="file" group="1">
<en>Photo</en>
</USR_PHOTO>
<USR_RESUME type="file" group="1">
<en>Résumé</en>
</USR_RESUME>
<MAX_FILES_SIZE type="edit" mode="view">
<en>Max upload files size in bytes</en>
</MAX_FILES_SIZE>
<TITLE1 type="title" group="1">
<en>Personal Information</en>
</TITLE1>
<USR_UID type="private"/>
<USR_FIRSTNAME type="text" size="30" maxlength="32" defaultvalue="" required="1" group="1" dependentfields="" linkfield="" strto="" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection="" mode="view">
<en>First Name</en>
</USR_FIRSTNAME>
<USR_LASTNAME type="text" size="30" maxlength="32" defaultvalue="" required="1" group="1" dependentfields="" linkfield="" strto="" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection="" mode="view">
<en>Last Name</en>
</USR_LASTNAME>
<USR_USERNAME type="text" size="15" maxlength="50" validate="Login" defaultvalue="" required="1" group="1" dependentfields="" linkfield="" strto="" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" onchange="" mode="view">
<en>User ID (*)</en>
</USR_USERNAME>
<USR_EMAIL type="text" size="35" maxlength="100" validate="Email" defaultvalue="" required="0" group="1" dependentfields="" linkfield="" strto="" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection="" mode="view">
<en>Email</en>
</USR_EMAIL>
<USR_ADDRESS type="textarea" rows="3" cols="50" defaultvalue="" required="0" group="1" dependentfields="" linkfield="" strto="" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection="">
<en>Address</en>
</USR_ADDRESS>
<USR_ZIP_CODE type="text" size="30" maxlength="30" defaultvalue="" required="0" group="1" dependentfields="" linkfield="" strto="" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection="">
<en>Zip/Postal Code</en>
</USR_ZIP_CODE>
<USR_COUNTRY type="dropdown" style="width:174pt" defaultvalue="" required="0" group="1" dependentfields="USR_CITY" readonly="0" sqlconnection="" noshowingrid="0" readonlyingrid="0">
SELECT IC_UID, IC_NAME FROM ISO_COUNTRY ORDER BY IC_NAME
<en>Country<option name=""/></en>
</USR_COUNTRY>
<USR_CITY type="dropdown" style="width:174pt" defaultvalue="" required="0" group="1" dependentfields="USR_LOCATION" readonly="0" sqlconnection="" noshowingrid="0" readonlyingrid="0"><![CDATA[
SELECT IS_UID, IS_NAME FROM ISO_SUBDIVISION WHERE IC_UID = "@#USR_COUNTRY" ORDER BY IS_NAME ]]><en>State or Region <option name="">N/D</option></en>
</USR_CITY>
<USR_LOCATION type="dropdown" style="width:174pt" defaultvalue="" required="0" group="1" readonly="0" sqlconnection="" noshowingrid="0" readonlyingrid="0"><![CDATA[
SELECT IL_UID, IL_NAME FROM ISO_LOCATION WHERE IC_UID = "@#USR_COUNTRY" AND IS_UID = "@#USR_CITY" AND IS_UID NOT IN ("") ORDER BY IL_NAME ]]><en>Location <option name="">N/D</option></en>
</USR_LOCATION>
<USR_PHONE type="text" size="15" maxlength="16" defaultvalue="" required="0" group="1" dependentfields="" linkfield="" strto="" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection="">
<en>Phone</en>
</USR_PHONE>
<USR_POSITION type="text" size="35" maxlength="35" defaultvalue="" required="0" group="1" dependentfields="" linkfield="" strto="" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection="">
<en>Position</en>
</USR_POSITION>
<USR_REPORTS_TO type="caption" size="35" maxlength="35" defaultvalue="" required="0" group="1" dependentfields="" linkfield="" strto="" readonly="1" noshowingrid="0">
<en>Reports to</en>
</USR_REPORTS_TO>
<USR_DEPARTMENT type="caption" size="35" maxlength="35" defaultvalue="" required="0" group="1" dependentfields="" linkfield="" strto="" readonly="1" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection="">
<en>Department</en>
</USR_DEPARTMENT>
<USR_REPLACED_BY type="dropdown" defaultvalue="" required="0" group="1" dependentfields="" readonly="0" sqlconnection="dbarray" noshowingrid="0" readonlyingrid="0">
SELECT * FROM aUserInfo
<en>Replaced by<option name=""/></en>
</USR_REPLACED_BY>
<USR_DUE_DATE type="date" mask="Y-m-d" startDate="@#START_DATE" endDate="@#END_DATE" defaultvalue="" required="1" group="1" readonly="0" noshowingrid="0" readonlyingrid="0">
<en>Expiration Date</en>
</USR_DUE_DATE>
<USR_CALENDAR type="dropdown" sqlconnection="dbarray">
SELECT CALENDAR_UID, CALENDAR_NAME FROM availableCalendars
<en>Calendar
<option name="">- None -</option>
</en>
</USR_CALENDAR>
<USR_STATUS type="dropdown" group="1" required="0">
<en>Status
<option name="ACTIVE">ACTIVE</option>
<option name="INACTIVE">INACTIVE</option>
<option name="VACATION">ON VACATION</option>
</en>
</USR_STATUS>
<USR_ROLE type="dropdown" defaultvalue="" required="0" group="1" dependentfields="" readonly="0" sqlconnection="rbac" noshowingrid="0" readonlyingrid="0"><![CDATA[
SELECT ROL_CODE AS USR_ROLE, ROL_CODE AS CODE FROM ROLES WHERE ROL_SYSTEM = '00000000000000000000000000000002' AND ROL_STATUS = 1 ORDER BY ROL_CODE ]]><en>Role</en>
</USR_ROLE>
<TITLE2 type="title" group="1">
<en>Change Password</en>
</TITLE2>
<USR_NEW_PASS type="password" size="30" maxlength="20" validate="5" mask="" required="1" mode="view">
<en>New Password </en>
</USR_NEW_PASS>
<USR_CNF_PASS type="password" size="30" maxlength="20" validate="5" mask="" required="1" mode="view">
<en>Confirm Password </en>
</USR_CNF_PASS>
<SUBMIT type="button" onclick="verifyUserInformation(this.form);" group="1">
<en>Save</en>
</SUBMIT>
<BTN_CANCEL type="button" onclick="cancel();">
<en>Cancel</en>
</BTN_CANCEL>
<MESSAGE0 type="phpvariable"/>
<MESSAGE1 type="phpvariable"/>
<MESSAGE2 type="phpvariable"/>
<MESSAGE3 type="phpvariable"/>
<MESSAGE4 type="phpvariable"/>
<MESSAGE5 type="phpvariable"/>
<JS type="javascript" replacetags="1"><![CDATA[
if((getField('USR_REPORTS_TO').value=='')){
hideRowById ('USR_REPORTS_TO');
}else{
showRowById ('USR_REPORTS_TO');
}
if((getField('USR_DEPARTMENT').value=='')){
hideRowById ('USR_DEPARTMENT');
}else{
showRowById ('USR_DEPARTMENT');
}
var sUsername;
var dynaformOnload = function()
{
//alert(getField('USR_DUE_DATE').value);
//sUsername = document.forms[1].elements['form[USR_USERNAME]'].value;
sUsername = getField('USR_USERNAME').value;
leimnud.event.add(getField('USR_USERNAME'), 'change', {method:verifyUsername, instance:document.forms[0].elements['form[USR_USERNAME]'], event:true});
leimnud.event.add(getField('USR_CITY' ), 'change', {method:existsElements, instance:document.forms[0].elements['form[USR_CITY]'], event:true});
leimnud.event.add(getField('USR_LOCATION'), 'change', {method:existsElements, instance:document.forms[0].elements['form[USR_LOCATION]'], event:true});
if (document.forms[0].elements['form[USR_CITY]'].options.length == 0) {
hideRow(document.forms[0].elements['form[USR_CITY]']);
//hideRow(document.forms[1].elements['form[USR_CITY]']);
}
if (document.forms[0].elements['form[USR_LOCATION]'].options.length == 0) {
hideRow(document.forms[0].elements['form[USR_LOCATION]']);
//hideRow(document.forms[1].elements['form[USR_LOCATION]']);
}
};
var verifyUsername = function()
{
document.forms[0].elements['form[USR_USERNAME]'].disabled = true;
document.forms[0].elements['form[SUBMIT]'].disabled = true;
var oRPC = new leimnud.module.rpc.xmlhttp({
url :'users_Ajax',
async : false,
method :'POST',
args :'function=verifyUsername&sOriginalUsername=' + sUsername + '&sUsername=' + encodeURIComponent(this.value)});
oRPC.make();
var sResponse = oRPC.xmlhttp.responseText;
document.forms[0].elements['form[USR_USERNAME]'].disabled = false;
if (sResponse == '1')
{
new leimnud.module.app.alert().make({
label: "@#MESSAGE0"
});
document.forms[0].elements['form[USR_USERNAME]'].focus();
}
else
{
document.forms[0].elements['form[SUBMIT]'].disabled = false;
document.forms[0].elements['form[USR_EMAIL]'].focus();
}
};
var verifyUserInformation = function(oForm)
{
var oAux1, oAux2;
var bContinue = true;
oAux1 = oForm.elements['form[USR_FIRSTNAME]'];
if (oAux1.value == '')
{
new leimnud.module.app.alert().make({
label: "@#MESSAGE4"
});
oAux1.focus();
bContinue = false;
return false;
}
oAux1 = oForm.elements['form[USR_LASTNAME]'];
if (oAux1.value == '')
{
new leimnud.module.app.alert().make({
label: "@#MESSAGE5"
});
oAux1.focus();
bContinue = false;
return false;
}
oAux1 = oForm.elements['form[USR_USERNAME]'];
if (oAux1.value == '')
{
new leimnud.module.app.alert().make({
label: "@#MESSAGE1"
});
oAux1.focus();
bContinue = false;
return false;
}
// note added by gustavo cruz gustavo-at-colosa-dot-com
// need also a further examination of this issue, seems that this problem
// could replicate in other manually tweaked forms
//sDate = document.getElementById('form[USR_DUE_DATE][div]').firstChild.nodeValue;
oAux1 = oForm.elements['form[USR_DUE_DATE]'];
//oAux1.setAttribute('value',sDate.trim());
if (oAux1.value == '')
{
new leimnud.module.app.alert().make({
label: "@#MESSAGE2"
});
oAux1.focus();
bContinue = false;
return false;
}
oAux1 = oForm.elements['form[USR_NEW_PASS]'];
if (oAux1.value != '')
{
oAux2 = oForm.elements['form[USR_CNF_PASS]'];
if (oAux1.value != oAux2.value)
{
new leimnud.module.app.alert().make({
label: "@#MESSAGE3"
});
oAux1.focus();
bContinue = false;
return false;
}
}
if (bContinue)
{
oForm.submit();
}
};
var existsElements = function () {
if (this.options.length > 0) {
showRow(this);
}
else {
hideRow(this);
}
};
function cancel(){
window.location = 'users_List';
}
]]></JS>
</dynaForm>