BUG 10957 "Feature request - Limit input document..." SOLVED

- Feature request - Limit input document maximum size
- Problema resuelto, al crear un nuevo Input Document se ha adicionado un nuevo campo "Maximum file size" y un dropdown
  que determina la unidad de medida en "KB y MB", esto permite definir el limite del tamañel archivo a anexar.
  Cuando se ejectua el caso al hacer click en "Attach", se muestra el tamañaximo que se puede adjuntar el archivo si es
  mayor	al limite se mostrara un mensaje; asi tambien si se tiene un file asocioado a un input document al igual que lo
  anterior se mostrara un mensaje.
This commit is contained in:
Luis Fernando Saisa Lopez
2014-09-15 12:09:31 -04:00
parent 12692ca8aa
commit 42f06bce9f
21 changed files with 414 additions and 71 deletions

View File

@@ -1,4 +1,4 @@
<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());'>
<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;">
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="content" style="">
@@ -8,8 +8,12 @@
<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 style="display: none;">
<td colspan="2">{$form.PRO_UID}</td>
<tbody>
<tr style="display: none;">
<td colspan="2">
{$form.PRO_UID}
{$form.INP_DOC_UPLOAD_MAX_FILESIZE}
</td>
</tr>
<tr style="display: none;">
<td colspan="2">{$form.INP_DOC_UID}</td>
@@ -20,43 +24,49 @@
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$INP_DOC_TITLE}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.INP_DOC_TITLE} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_TITLE}</td>
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_TITLE}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$INP_DOC_FORM_NEEDED}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.INP_DOC_FORM_NEEDED} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_FORM_NEEDED}</td>
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_FORM_NEEDED}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$INP_DOC_ORIGINAL}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.INP_DOC_ORIGINAL} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_ORIGINAL}</td>
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_ORIGINAL}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$INP_DOC_DESCRIPTION}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.INP_DOC_DESCRIPTION} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_DESCRIPTION}</td>
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_DESCRIPTION}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$INP_DOC_VERSIONING}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.INP_DOC_VERSIONING} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_VERSIONING}</td>
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_VERSIONING}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$INP_DOC_DESTINATION_PATH}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.INP_DOC_DESTINATION_PATH} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_DESTINATION_PATH}</td>
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_DESTINATION_PATH}</td>
</tr>
<tr>
<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>
<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='FormLabel' width="{$form_labelWidth}">{$INP_DOC_MAX_FILESIZE}</td>
<td class='FormFieldContent' >{$form.INP_DOC_MAX_FILESIZE} {$form.INP_DOC_MAX_FILESIZE_UNIT} {$INP_DOC_UPLOAD_MAX_FILESIZE_LABEL} {$form.INP_DOC_UPLOAD_MAX_FILESIZE_LABEL}</td>
</tr>
<tr>
<td class="FormButton" colspan="2" align="center"> <br/> {$form.ACCEPT} &nbsp; {$form.BTN_CANCEL} </td>
</tr>
@@ -70,4 +80,4 @@
<script type="text/javascript">
{$form.JS}
</script>
</form>
</form>

View File

@@ -2,6 +2,7 @@
<dynaForm name="intputdocs/inputdocs_Edit" type="xmlform" width="100%" enableTemplate="1">
<PRO_UID type="hidden" showInTable="0"/>
<INP_DOC_UID type="hidden" showInTable="0"/>
<INP_DOC_UPLOAD_MAX_FILESIZE type="hidden" showInTable="0" />
<TITLE type="title" group="1">
<en><![CDATA[Input Document Information]]></en>
</TITLE>
@@ -29,6 +30,22 @@
<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>
<INP_DOC_MAX_FILESIZE type="text" maxlength="10" size="8" mode="edit">
<en>Maximum file size</en>
</INP_DOC_MAX_FILESIZE>
<INP_DOC_MAX_FILESIZE_UNIT type="dropdown" colWidth="80" titleAlign="left" align="left">
<en>
<option name="KB">KB</option>
<option name="MB">MB</option>
</en>
</INP_DOC_MAX_FILESIZE_UNIT>
<INP_DOC_UPLOAD_MAX_FILESIZE_LABEL type="text" maxlength="30" validate="Any" size="10" mode="view">
<en>Max upload file size</en>
</INP_DOC_UPLOAD_MAX_FILESIZE_LABEL>
<BTN_CANCEL type="button" onclick="cancel();">
<en><![CDATA[Cancel]]></en>
</BTN_CANCEL>

View File

@@ -44,6 +44,32 @@ var currentPagedTable = @#PAGED_TABLE_ID;
return false;
}
}
if (getField("INP_DOC_MAX_FILESIZE").value.trim() != "") {
var maxFilesize = parseInt(getField("INP_DOC_MAX_FILESIZE").value.trim());
var maxFilesizeUnit = getField("INP_DOC_MAX_FILESIZE_UNIT").value;
var uploadMaxFilesize = parseInt(getField("INP_DOC_UPLOAD_MAX_FILESIZE").value);
maxFilesize = maxFilesize * ((maxFilesizeUnit == "MB")? 1024 * 1024 : 1024);
if(maxFilesize > 0) {
if(maxFilesize > uploadMaxFilesize) {
new leimnud.module.app.alert().make({label: _("ID_SIZE_VERY_LARGE_PERMITTED")});
getField("INP_DOC_MAX_FILESIZE").focus();
return false;
}
} else {
new leimnud.module.app.alert().make({label: _("ID_MAXIMUM_SIZE_FILE_GREATER_THAN_ZERO")});
getField("INP_DOC_MAX_FILESIZE").focus();
return false;
}
} else {
new leimnud.module.app.alert().make({label: _("ID_MAXIMUM_SIZE_FILE_REQUIRED")});
getField("INP_DOC_MAX_FILESIZE").focus();
return false;
}
return true;
}
function inputdocsSave( form ) {