BUG 4314 Validation to uploading Photos and Removal Resume element.
This commit is contained in:
@@ -44,6 +44,7 @@ try {
|
||||
$aFields['MESSAGE3'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS'));
|
||||
$aFields['MESSAGE4'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_FIRSTNAME'));
|
||||
$aFields['MESSAGE5'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_LASTNAME'));
|
||||
$aFields['MESSAGE6'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_ERROR_UPLOADING_IMAGE_TYPE'));
|
||||
$aFields['START_DATE'] = date('Y-m-d');
|
||||
$aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5));
|
||||
|
||||
@@ -138,9 +139,9 @@ try {
|
||||
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul;
|
||||
|
||||
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize;
|
||||
$aFields['MAX_FILES_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
|
||||
$aFields['MAX_FILES_SIZE'] = " (" . $UPLOAD_MAX_SIZE . ") ";
|
||||
|
||||
|
||||
//print_r($aUserInfo);
|
||||
global $_DBArray;
|
||||
$_DBArray['aUserInfo'] = $aUserInfo;
|
||||
$_SESSION['_DBArray'] = $_DBArray;
|
||||
|
||||
@@ -32,6 +32,7 @@ try {
|
||||
$aFields['MESSAGE3'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS'));
|
||||
$aFields['MESSAGE4'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_FIRSTNAME'));
|
||||
$aFields['MESSAGE5'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_LASTNAME'));
|
||||
$aFields['MESSAGE6'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_ERROR_UPLOADING_IMAGE_TYPE'));
|
||||
// the default role variable sets the value that will be showed as the default for the role field.
|
||||
$aFields['DEFAULT_ROLE'] = 'PROCESSMAKER_OPERATOR';
|
||||
$aFields['START_DATE'] = date('Y-m-d');
|
||||
@@ -50,7 +51,7 @@ try {
|
||||
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul;
|
||||
|
||||
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize;
|
||||
$aFields['MAX_FILES_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
|
||||
$aFields['MAX_FILES_SIZE'] = " (" . $UPLOAD_MAX_SIZE . ") ";
|
||||
|
||||
//Load Calendar options and falue for this user
|
||||
G::LoadClass ( 'calendar' );
|
||||
|
||||
@@ -104,7 +104,8 @@ try {
|
||||
$aData['USR_PHONE'] = $form['USR_PHONE'];
|
||||
$aData['USR_ZIP_CODE'] = $form['USR_ZIP_CODE'];
|
||||
$aData['USR_POSITION'] = $form['USR_POSITION'];
|
||||
$aData['USR_RESUME'] = $form['USR_RESUME'];
|
||||
// Commented by removal of resume in the addition and modification of user.
|
||||
// $aData['USR_RESUME'] = $form['USR_RESUME'];
|
||||
$aData['USR_ROLE'] = $form['USR_ROLE'];
|
||||
$aData['USR_REPLACED_BY'] = $form['USR_REPLACED_BY'];
|
||||
|
||||
@@ -246,6 +247,19 @@ try {
|
||||
require_once 'classes/model/Users.php';
|
||||
$oUser = new Users();
|
||||
$oUser->update($aData);
|
||||
$aExtensions = array ( "AIS", "BMP", "BW", "CDR", "CDT", "CGM", "CMX", "CPT", "DCX", "DIB",
|
||||
"EMF", "GBR", "GIF", "GIH", "ICO", "IFF", "ILBM", "JFIF", "JIF", "JPE",
|
||||
"JPEG", "JPG", "KDC", "LBM", "MAC", "PAT", "PCD", "PCT", "PCX", "PIC",
|
||||
"PICT", "PNG", "PNTG", "PIX", "PSD", "PSP", "QTI", "QTIF", "RGB", "RGBA",
|
||||
"RIF", "RLE", "SGI", "TGA", "TIF", "TIFF", "WMF", "XCF"
|
||||
);
|
||||
|
||||
$sPhotoFile = $_FILES['form']['name']['USR_PHOTO'];
|
||||
$aPhotoFile = explode('.', $sPhotoFile);
|
||||
$sExtension = strtoupper ($aPhotoFile[sizeof($aPhotoFile)-1]);
|
||||
if ((strlen($sPhotoFile) > 0) && (! in_array($sExtension, $aExtensions)) ) {
|
||||
throw ( new Exception ( G::LoadTranslation( 'ID_ERROR_UPLOADING_IMAGE_TYPE' )) );
|
||||
}
|
||||
if ($_FILES['form']['error']['USR_PHOTO'] != 1) {
|
||||
if ($_FILES['form']['tmp_name']['USR_PHOTO'] != '') {
|
||||
$aAux = explode('.', $_FILES['form']['name']['USR_PHOTO']);
|
||||
|
||||
@@ -11,28 +11,7 @@
|
||||
<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>
|
||||
@@ -138,6 +117,30 @@
|
||||
<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="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_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="FormButton" colspan="2" align="center">{$form.SUBMIT} {$form.BTN_CANCEL}</td>
|
||||
|
||||
@@ -3,22 +3,7 @@
|
||||
<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>
|
||||
@@ -95,6 +80,26 @@
|
||||
<USR_CNF_PASS type="password" size="30" maxlength="20" validate="5" mask="" required="1">
|
||||
<en>Confirm Password </en>
|
||||
</USR_CNF_PASS>
|
||||
|
||||
<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 file size</en>
|
||||
</MAX_FILES_SIZE>
|
||||
|
||||
<SUBMIT type="button" onclick="verifyUserInformation(this.form);" group="1">
|
||||
<en>Save</en>
|
||||
</SUBMIT>
|
||||
@@ -107,6 +112,7 @@
|
||||
<MESSAGE3 type="phpvariable"/>
|
||||
<MESSAGE4 type="phpvariable"/>
|
||||
<MESSAGE5 type="phpvariable"/>
|
||||
<MESSAGE6 type="phpvariable"/>
|
||||
<JS type="javascript" replacetags="1"><![CDATA[
|
||||
|
||||
if((getField('USR_REPORTS_TO').value=='')){
|
||||
@@ -232,6 +238,37 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var permitted = false;
|
||||
aExtensions = new Array ( ".ais", ".bmp", ".bw", ".cdr", ".cdt", ".cgm", ".cmx", ".cpt", ".dcx", ".dib",
|
||||
".emf", ".gbr", ".gif", ".gih", ".ico", ".iff", ".ilbm", ".jfif", ".jif", ".jpe",
|
||||
".jpeg", ".jpg", ".kdc", ".lbm", ".mac", ".pat", ".pcd", ".pct", ".pcx", ".pic",
|
||||
".pict", ".png", ".pntg", ".pix", ".psd", ".psp", ".qti", ".qtif", ".rgb", ".rgba",
|
||||
".rif", ".rle", ".sgi", ".tga", ".tif", ".tiff", ".wmf", ".xcf"
|
||||
);
|
||||
|
||||
oUsrPhoto = oForm.elements['form[USR_PHOTO]'];
|
||||
sUsrPhoto = oUsrPhoto.value;
|
||||
if (sUsrPhoto != "" ) {
|
||||
extension = (sUsrPhoto.substring(sUsrPhoto.lastIndexOf("."))).toLowerCase();
|
||||
for (var i = 0; i < aExtensions.length; i++) {
|
||||
if (aExtensions[i] == extension) {
|
||||
permitted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
permitted = true;
|
||||
}
|
||||
if (!permitted) {
|
||||
new leimnud.module.app.alert().make({
|
||||
label: "@#MESSAGE6"
|
||||
});
|
||||
bContinue = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bContinue)
|
||||
{
|
||||
oForm.submit();
|
||||
|
||||
@@ -11,23 +11,7 @@
|
||||
<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}</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>
|
||||
@@ -128,6 +112,23 @@
|
||||
<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="FormTitle" colspan="2" align="">{$form.TITLE3}</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_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="FormButton" colspan="2" align="center">{$form.SUBMIT} {$form.BTN_CANCEL}</td>
|
||||
|
||||
@@ -6,18 +6,7 @@
|
||||
<START_DATE type="phpVariable"/>
|
||||
<DEFAULT_ROLE type="phpVariable"/>
|
||||
<END_DATE type="phpVariable"/>
|
||||
<TITLE3 type="title" group="1">
|
||||
<en>Profile</en>
|
||||
</TITLE3>
|
||||
<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>
|
||||
@@ -98,6 +87,22 @@ SELECT ROL_CODE AS USR_ROLE, ROL_CODE AS CODE FROM ROLES WHERE ROL_SYSTEM = '000
|
||||
<SUBMIT type="button" onclick="validateLocalFields(this.form);" group="1">
|
||||
<en>Save</en>
|
||||
</SUBMIT>
|
||||
|
||||
<TITLE3 type="title" group="1">
|
||||
<en>Profile</en>
|
||||
</TITLE3>
|
||||
<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 file size</en>
|
||||
</MAX_FILES_SIZE>
|
||||
|
||||
<BTN_CANCEL type="button" onclick="cancel();">
|
||||
<en>Cancel</en>
|
||||
</BTN_CANCEL>
|
||||
@@ -107,6 +112,7 @@ SELECT ROL_CODE AS USR_ROLE, ROL_CODE AS CODE FROM ROLES WHERE ROL_SYSTEM = '000
|
||||
<MESSAGE3 type="phpvariable"/>
|
||||
<MESSAGE4 type="phpvariable"/>
|
||||
<MESSAGE5 type="phpvariable"/>
|
||||
<MESSAGE6 type="phpvariable"/>
|
||||
<JS type="javascript" replacetags="1"><![CDATA[
|
||||
var sUsername;
|
||||
|
||||
@@ -276,7 +282,31 @@ var validateLocalFields = function(oForm)
|
||||
var sPasswordRep = document.getElementById('form[USR_CNF_PASS]');
|
||||
var sAlert = "";
|
||||
var bContinue = true;
|
||||
var permitted = false;
|
||||
bContinue = validateForm("[{\"name\":\"USR_FIRSTNAME\",\"type\":\"text\",\"label\":\"First Name\"},{\"name\":\"USR_LASTNAME\",\"type\":\"text\",\"label\":\"Last Name\"},{\"name\":\"USR_USERNAME\",\"type\":\"text\",\"label\":\"User ID (*)\"},{\"name\":\"USR_DUE_DATE\",\"type\":\"date\",\"label\":\"Expiration Date\"},{\"name\":\"USR_NEW_PASS\",\"type\":\"password\",\"label\":\"New Password\"},{\"name\":\"USR_CNF_PASS\",\"type\":\"password\",\"label\":\"Confirm Password\"}]".parseJSON());
|
||||
|
||||
aExtensions = new Array ( ".ais", ".bmp", ".bw", ".cdr", ".cdt", ".cgm", ".cmx", ".cpt", ".dcx", ".dib",
|
||||
".emf", ".gbr", ".gif", ".gih", ".ico", ".iff", ".ilbm", ".jfif", ".jif", ".jpe",
|
||||
".jpeg", ".jpg", ".kdc", ".lbm", ".mac", ".pat", ".pcd", ".pct", ".pcx", ".pic",
|
||||
".pict", ".png", ".pntg", ".pix", ".psd", ".psp", ".qti", ".qtif", ".rgb", ".rgba",
|
||||
".rif", ".rle", ".sgi", ".tga", ".tif", ".tiff", ".wmf", ".xcf"
|
||||
);
|
||||
|
||||
oUsrPhoto = oForm.elements['form[USR_PHOTO]'];
|
||||
sUsrPhoto = oUsrPhoto.value;
|
||||
if (sUsrPhoto != "" ) {
|
||||
extension = (sUsrPhoto.substring(sUsrPhoto.lastIndexOf("."))).toLowerCase();
|
||||
for (var i = 0; i < aExtensions.length; i++) {
|
||||
if (aExtensions[i] == extension) {
|
||||
permitted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
permitted = true;
|
||||
}
|
||||
|
||||
if (bContinue){
|
||||
if (!validateLocalEmail(sEmail)){
|
||||
sAlert = sAlert+"Please provide a valid email address. <br>";
|
||||
@@ -286,9 +316,14 @@ var validateLocalFields = function(oForm)
|
||||
sAlert = sAlert+"The password fields don't match. <br>";
|
||||
bContinue = false;
|
||||
}
|
||||
if (!permitted) {
|
||||
sAlert = sAlert + "@#MESSAGE6" + " <br>";
|
||||
bContinue = false;
|
||||
}
|
||||
if (!bContinue){
|
||||
msgBox(sAlert, "alert");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
oForm.submit();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user