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="">
@@ -11,8 +11,11 @@
<tbody><tr style="display: none;">
<td colspan="2">{$form.APP_DOC_TYPE}</td>
</tr>
<tr style="display: none;">
<td colspan="2">{$form.DOC_UID}</td>
<tr style="display: none;">
<td colspan="2">
{$form.DOC_UID}
{$form.INP_DOC_MAX_FILESIZE}
</td>
</tr>
<tr style="display: none;">
<td colspan="2">{$form.APP_DOC_UID}</td>
@@ -26,20 +29,26 @@
<tr style="display: none;">
<td colspan="2">{$form.fileTypes}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$INP_DOC_MAX_FILESIZE_LABEL}</td>
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.INP_DOC_MAX_FILESIZE_LABEL}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$APP_DOC_FILENAME}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.APP_DOC_FILENAME} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.APP_DOC_FILENAME}</td>
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.APP_DOC_FILENAME}</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$APP_DOC_COMMENT}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.APP_DOC_COMMENT} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.APP_DOC_COMMENT}</td>
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.APP_DOC_COMMENT}</td>
</tr>
<tr style="display: none;">
<td colspan="2">{$form.MORE}</td>
</tr>
<tr>
<td class="FormButton" colspan="2" align="center"><br/> {$form.SAVE} &nbsp; {$form.BTN_CANCEL}</td>
</tr>

View File

@@ -7,6 +7,12 @@
<actionType type="hidden"/>
<docVersion type="hidden"/>
<fileTypes type="hidden"/>
<INP_DOC_MAX_FILESIZE type="hidden" showInTable="0" />
<INP_DOC_MAX_FILESIZE_LABEL type="text" maxlength="30" validate="Any" size="10" mode="view">
<en>Max size accepted</en>
</INP_DOC_MAX_FILESIZE_LABEL>
<APP_DOC_FILENAME type="file">
<en><![CDATA[File]]></en>
</APP_DOC_FILENAME>
@@ -31,6 +37,10 @@ leimnud.event.add(window, 'load', function() {
}
});
if (getField("INP_DOC_MAX_FILESIZE").value == 0 || getField("INP_DOC_MAX_FILESIZE").value == "") {
hideRow("INP_DOC_MAX_FILESIZE_LABEL");
}
var verifyInfo = function(oForm)
{
oAux = getField('APP_DOC_FILENAME');
@@ -41,6 +51,13 @@ var verifyInfo = function(oForm)
return;
}
var flagFilesize = inputDocumentVerifySize(parseInt(getField("INP_DOC_MAX_FILESIZE").value), getField("APP_DOC_FILENAME"));
if (flagFilesize == 0) {
new leimnud.module.app.alert().make({label: _("ID_SIZE_VERY_LARGE_PERMITTED")});
return;
}
docType = oAux.value.split(".");
docType = docType[docType.length - 1];