BUG-14990 - NEW FEATURE, permitir especificar extensiones para los inputdocs.

Nuevo campo en Input Documents, dicho campo acepta las extensiones de los inputdocs permitidos.
Se agregaron validaciones para que funcione correctamente
This commit is contained in:
jennylee
2014-08-29 15:17:43 -04:00
parent db57d8c81c
commit a585a9a4b1
15 changed files with 331 additions and 19 deletions

View File

@@ -51,6 +51,11 @@
<td class="FormLabel" width="{$form_labelWidth}">{$INP_DOC_TAGS}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.INP_DOC_TAGS} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_TAGS}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$INP_DOC_TYPE_FILE}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.INP_DOC_TYPE_FILE} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_TYPE_FILE}</td>
</tr>
<tr>
<td class="FormButton" colspan="2" align="center"> <br/> {$form.ACCEPT} &nbsp; {$form.BTN_CANCEL} </td>

View File

@@ -26,6 +26,9 @@
<INP_DOC_TAGS type="textpm" size="30" maxlength="200" showVars="1" process="@#PRO_UID" symbol="@#" validate="Tag">
<en><![CDATA[Tags]]></en>
</INP_DOC_TAGS>
<INP_DOC_TYPE_FILE type="text" maxlength="200" size="37" colWidth="200" titleAlign="left" align="left" hint="To verify that the content of the file is the correct according to its extension, it is necessary to enable the FILEINFO extension, if this is not enabled only the extension will be verified." dataCompareField="T.CON_VALUE" dataCompareType="contains">
<en><![CDATA[Allowed file extensions (use *.* to allow any extension)]]></en>
</INP_DOC_TYPE_FILE>
<BTN_CANCEL type="button" onclick="cancel();">
<en><![CDATA[Cancel]]></en>
</BTN_CANCEL>

View File

@@ -17,9 +17,34 @@ var currentPagedTable = @#PAGED_TABLE_ID;
popupWindow('@G::LoadTranslation(ID_EDIT_INPUTDOCS)', '@G::encryptlink(@#inputdocsEdit)?INP_DOC_UID='+ uid , 500, 410);
}
function validate_form(){
var sw = true;
sw = sw && (getField('INP_DOC_TITLE').value!='');
return sw;
if(getField('INP_DOC_TITLE').value == ''){
alert('@G::LoadTranslation(ID_INPUT_DOC_TITLE_REQUIRED)');
getField('INP_DOC_TITLE').focus();
return false;
}
oTypeFile = getField('INP_DOC_TYPE_FILE');
if (oTypeFile.value == '' ){
alert('@G::LoadTranslation(ID_INPUT_DOC_TYPE_FILE_REQUIRED)');
oTypeFile.focus();
return false;
}
allowedTypes = getField('INP_DOC_TYPE_FILE').value.split(", ");
expreg = /^\*\.?[a-z]{2,8}$/;
for(i=0; i<allowedTypes.length; i++){
atype = allowedTypes[i];
if((atype=='*.*') || (expreg.test(atype)) ){
//
} else {
alert('@G::LoadTranslation(ID_UPLOAD_ERR_WRONG_ALLOWED_EXTENSION_FORMAT)');
oTypeFile.focus();
return false;
}
}
return true;
}
function inputdocsSave( form ) {
var nameInput = getField('INP_DOC_TITLE').value;
@@ -34,16 +59,12 @@ var currentPagedTable = @#PAGED_TABLE_ID;
}else{
alert(G_STRINGS.ID_EXIST_INPUTDOCUMENT);return false;
}
}else{
alert('@G::LoadTranslation(ID_INPUT_DOC_TITLE_REQUIRED)'); return false;
}
}else{
if (validate_form()){
ajax_post( form.action, form, 'POST' );
currentPopupWindow.remove();
@#PAGED_TABLE_ID.refresh();
}else{
alert('@G::LoadTranslation(ID_INPUT_DOC_TITLE_REQUIRED)'); return false;
}
}
}