- 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.
92 lines
2.6 KiB
XML
Executable File
92 lines
2.6 KiB
XML
Executable File
<?xml version="1.0" encoding="UTF-8"?>
|
|
<dynaForm name="cases_AttachInputDocument1" type="xmlform" width="500px" labelWidth="120px" enableTemplate="1">
|
|
<TYPE_LABEL type="private"/>
|
|
<APP_DOC_TYPE type="hidden" defaultValue="INPUT"/>
|
|
<DOC_UID type="hidden"/>
|
|
<APP_DOC_UID type="hidden"/>
|
|
<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>
|
|
<APP_DOC_COMMENT type="textarea" rows="5" cols="32" colWidth="200" titleAlign="left" align="left">
|
|
<en><![CDATA[Comments]]></en>
|
|
</APP_DOC_COMMENT>
|
|
<MORE type="hidden">
|
|
<en>Upload Multiple Input Documents</en>
|
|
</MORE>
|
|
<BTN_CANCEL type="button" onclick="cancel();">
|
|
<en><![CDATA[Cancel]]></en>
|
|
</BTN_CANCEL>
|
|
<SAVE type="button" onclick="verifyInfo(this.form);">
|
|
<en><![CDATA[Save]]></en>
|
|
</SAVE>
|
|
<MESSAGE1 type="phpvariable"/>
|
|
<MESSAGE2 type="phpvariable"/>
|
|
<JS type="javascript"><![CDATA[
|
|
leimnud.event.add(window, 'load', function() {
|
|
if (getField('INP_DOC_FORM_NEEDED').value == 'VIRTUAL') {
|
|
hideRow('INP_DOC_ORIGINAL');
|
|
}
|
|
});
|
|
|
|
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');
|
|
if (oAux.value == '')
|
|
{
|
|
alert('@G::LoadTranslation(ID_PLEASE_SELECT_FILE)');
|
|
oAux.focus();
|
|
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];
|
|
|
|
allowedTypes = getField('fileTypes').value.split(", ");
|
|
|
|
for(i=0; i<allowedTypes.length; i++){
|
|
allowed = allowedTypes[i].replace('*','').replace('.','');
|
|
if((allowed != '*') && (docType != allowed)){
|
|
flag = 1;
|
|
} else {
|
|
flag = 0;
|
|
i = allowedTypes.length;
|
|
}
|
|
}
|
|
if( flag == 1){
|
|
alert('@G::LoadTranslation(ID_UPLOAD_ERR_NOT_ALLOWED_EXTENSION)');
|
|
oAux.focus();
|
|
return;
|
|
}
|
|
|
|
getField('SAVE').disabled = true;
|
|
getField('BTN_CANCEL').disabled = true;
|
|
oForm.submit();
|
|
};
|
|
|
|
function cancel(){
|
|
oPanel.remove();
|
|
}
|
|
|
|
]]></JS>
|
|
</dynaForm>
|