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:
@@ -2232,4 +2232,13 @@ var stripNonNumeric = function (str) {
|
||||
}
|
||||
}
|
||||
return out;
|
||||
};
|
||||
};
|
||||
|
||||
function inputDocumentVerifySize(inpDocMaxFileSize, file)
|
||||
{
|
||||
try {
|
||||
return (file.files[0].size <= inpDocMaxFileSize)? 1 : 0;
|
||||
} catch (e) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3308,6 +3308,38 @@ var validateForm = function(sRequiredFields) {
|
||||
}
|
||||
}
|
||||
|
||||
var arrayForm = document.getElementsByTagName("form");
|
||||
var i1 = 0;
|
||||
var i2 = 0;
|
||||
|
||||
for (i1 = 0; i1 <= arrayForm.length - 1; i1++) {
|
||||
var frm = arrayForm[i1];
|
||||
|
||||
var arrayInput = frm.getElementsByTagName("input");
|
||||
|
||||
for (i2 = 0; i2 <= arrayInput.length - 1; i2++) {
|
||||
var input = arrayInput[i2];
|
||||
|
||||
if (input.type == "file") {
|
||||
if (input.value != "") {
|
||||
var pmindocmaxfilesize = input.getAttribute("pmindocmaxfilesize");
|
||||
|
||||
if (pmindocmaxfilesize != null && pmindocmaxfilesize != "") {
|
||||
var flagFilesize = inputDocumentVerifySize(parseInt(pmindocmaxfilesize), input);
|
||||
|
||||
if (flagFilesize == 0) {
|
||||
new leimnud.module.app.alert().make({label: _("ID_SIZE_VERY_LARGE_PERMITTED")});
|
||||
|
||||
swSubmitValidateForm = 1;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -803,7 +803,8 @@ function stringReplace(strSearch,strReplace,str)
|
||||
{var expression=eval("/"+strSearch+"/g");return str.replace(expression,strReplace);}
|
||||
var mb_strlen=function(str){str=str||'';var len=0;for(var i=0;i<str.length;i++){len+=str.charCodeAt(i)<0||str.charCodeAt(i)>255?2:1;}
|
||||
return len;};var stripNonNumeric=function(str){str+='';var rgx=/^\d|\.|-$/;var out='';for(var i=0;i<str.length;i++){if(rgx.test(str.charAt(i))){if(!((str.charAt(i)=='.'&&out.indexOf('.')!=-1)||(str.charAt(i)=='-'&&out.length!=0))){out+=str.charAt(i);}}}
|
||||
return out;};
|
||||
return out;};function inputDocumentVerifySize(inpDocMaxFileSize,file)
|
||||
{try{return(file.files[0].size<=inpDocMaxFileSize)?1:0;}catch(e){return 1;}}
|
||||
var TimeToFade=1000.0;function fade(eid,inOut){inOut=(typeof(inOut)!='undefined')?true:false;var element=document.getElementById(eid);if(element==null)
|
||||
return;if(element.FadeState==null)
|
||||
{if(element.style.opacity==null||element.style.opacity==''||element.style.opacity=='1')
|
||||
@@ -1240,6 +1241,7 @@ if(fielEmailInvalid.length>0){systemMessaggeInvalid+="\n \n"+G_STRINGS.ID_VALIDA
|
||||
alert(systemMessaggeInvalid);swSubmitValidateForm=1;return false;}
|
||||
else{var arrayForm=document.getElementsByTagName("form");var inputAux;var id="";var i1=0;var i2=0;for(i1=0;i1<=arrayForm.length-1;i1++){var frm=arrayForm[i1];for(i2=0;i2<=frm.elements.length-1;i2++){var elem=frm.elements[i2];if(elem.type=="checkbox"&&elem.disabled&&elem.checked){id=elem.id+"_";if(!document.getElementById(id)){inputAux=document.createElement("input");inputAux.type="hidden";inputAux.id=id;inputAux.name=elem.name;inputAux.value=elem.value;frm.appendChild(inputAux);}}}
|
||||
var arrayLink=frm.getElementsByTagName("a");for(i2=0;i2<=arrayLink.length-1;i2++){var link=arrayLink[i2];if(typeof link.id!="undefined"&&link.id!=""&&link.id!="form[DYN_BACKWARD]"&&link.id!="form[DYN_FORWARD]"){var strHtml=link.parentNode.innerHTML;strHtml=stringReplace("\\x0A","",strHtml);strHtml=stringReplace("\\x0D","",strHtml);strHtml=stringReplace("\\x09","",strHtml);if(/^.*pm:field.*$/.test(strHtml)){id=link.id+"_";if(!document.getElementById(id)){var strAux=link.id.replace("form[","");strAux=strAux.substring(0,strAux.length-1);inputAux=document.createElement("input");inputAux.type="hidden";inputAux.id=id;inputAux.name=link.id;inputAux.value=link.href;frm.appendChild(inputAux);inputAux=document.createElement("input");inputAux.type="hidden";inputAux.id=id+"label";inputAux.name="form["+strAux+"_label]";inputAux.value=link.innerHTML;frm.appendChild(inputAux);}}}}}
|
||||
var arrayForm=document.getElementsByTagName("form");var i1=0;var i2=0;for(i1=0;i1<=arrayForm.length-1;i1++){var frm=arrayForm[i1];var arrayInput=frm.getElementsByTagName("input");for(i2=0;i2<=arrayInput.length-1;i2++){var input=arrayInput[i2];if(input.type=="file"){if(input.value!=""){var pmindocmaxfilesize=input.getAttribute("pmindocmaxfilesize");if(pmindocmaxfilesize!=null&&pmindocmaxfilesize!=""){var flagFilesize=inputDocumentVerifySize(parseInt(pmindocmaxfilesize),input);if(flagFilesize==0){new leimnud.module.app.alert().make({label:_("ID_SIZE_VERY_LARGE_PERMITTED")});swSubmitValidateForm=1;return false;}}}}}}
|
||||
return true;}}else{return false;}};var getObject=function(sObject){var i;var oAux=null;var iLength=__aObjects__.length;for(i=0;i<iLength;i++){oAux=__aObjects__[i].getElementByName(sObject);if(oAux){return oAux;}}
|
||||
return oAux;};var saveAndRefreshForm=function(oObject){if(oObject){oObject.form.action+='&_REFRESH_=1';oObject.form.submit();}
|
||||
else{var oAux=window.document.getElementsByTagName('form');if(oAux.length>0){oAux[0].action+='&_REFRESH_=1';oAux[0].submit();}}};var sessionPersits=function(){var rpc=new leimnud.module.rpc.xmlhttp({url:'../services/sessionPersists',args:'dynaformRestoreValues='+(typeof(__dynaformSVal__)!='undefined'?__dynaformSVal__:''),async:false});rpc.make();var response=rpc.xmlhttp.responseText.parseJSON();return response.status;};var showPromptLogin=function(lastAction){lastActionPerformed=lastAction;promptPanel=new leimnud.module.panel();promptPanel.options={statusBarButtons:[{value:_('LOGIN')}],position:{center:true},size:{w:300,h:130},control:{close:false,resize:false},fx:{modal:true}};promptPanel.setStyle={content:{padding:10,paddingBottom:2,textAlign:'left',paddingLeft:50,backgroundRepeat:'no-repeat',backgroundPosition:'10 50%',backgroundColor:'transparent',borderWidth:0}};promptPanel.make();promptPanel.addContent(_('ID_DYNAFORM_EDITOR_LOGIN_AGAIN'));promptPanel.addContent('<br />');var thePassword=$dce('input');thePassword.type='password';thePassword.id='thePassword';leimnud.dom.setStyle(thePassword,{font:'normal 8pt Tahoma,MiscFixed',color:'#000',width:'100%',marginTop:3,backgroundColor:'white',border:'1px solid #919B9C'});promptPanel.addContent(thePassword);thePassword.focus();thePassword.onkeyup=function(evt)
|
||||
|
||||
@@ -3007,18 +3007,36 @@ class XmlForm_Field_File extends XmlForm_Field
|
||||
$styleDisplay = "display: none;";
|
||||
}
|
||||
|
||||
$html = $html1 . "<input type=\"file\" ".$pmtype." id=\"form" . $rowId . "[" . $this->name . "]\" name=\"form" . $rowId . "[" . $this->name . "]\" value=\"" . $value . "\" class=\"module_app_input___gray_file\" style=\"" . $styleDisplay . "\"" . $mode . " " . $this->NSRequiredValue() . " />" . $html2;
|
||||
if (isset( $this->input ) && $this->input != null) {
|
||||
require_once ("classes/model/InputDocument.php");
|
||||
$arrayInputDocumentData = array();
|
||||
$inpDocMaxFilesize = "";
|
||||
|
||||
if (isset($this->input) && $this->input != null) {
|
||||
require_once ("classes" . PATH_SEP . "model" . PATH_SEP . "InputDocument.php");
|
||||
|
||||
try {
|
||||
$indoc = new InputDocument();
|
||||
$aDoc = $indoc->load( $this->input );
|
||||
$aDoc["INP_DOC_TITLE"] = (isset( $aDoc["INP_DOC_TITLE"] )) ? $aDoc["INP_DOC_TITLE"] : null;
|
||||
$html = $html . "<label><img src=\"/images/inputdocument.gif\" width=\"22px\" width=\"22px\" alt=\"\" /><font size=\"1\">(" . trim( $aDoc["INP_DOC_TITLE"] ) . ")</font></label>";
|
||||
$inputDocument = new InputDocument();
|
||||
$arrayInputDocumentData = $inputDocument->load($this->input);
|
||||
} catch (Exception $e) {
|
||||
//Then the input document doesn"t exits, id referencial broken
|
||||
$html = $html . " <font color=\"red\"><img src=\"/images/alert_icon.gif\" width=\"16px\" width=\"16px\" alt=\"\" /><font size=\"1\">(" . G::loadTranslation( "ID_INPUT_DOC_DOESNT_EXIST" ) . ")</font></font>";
|
||||
}
|
||||
}
|
||||
|
||||
if (count($arrayInputDocumentData) > 0) {
|
||||
$inpDocMaxFilesize = $arrayInputDocumentData["INP_DOC_MAX_FILESIZE"] * (($arrayInputDocumentData["INP_DOC_MAX_FILESIZE_UNIT"] == "MB")? 1024 *1024 : 1024); //Bytes
|
||||
}
|
||||
|
||||
$pmInputDocument = "pmindocmaxfilesize=\"" . $inpDocMaxFilesize . "\""; //Bytes
|
||||
|
||||
$html = $html1 . "<input type=\"file\" " . $pmtype . " " . $pmInputDocument . " id=\"form" . $rowId . "[" . $this->name . "]\" name=\"form" . $rowId . "[" . $this->name . "]\" value=\"" . $value . "\" class=\"module_app_input___gray_file\" style=\"" . $styleDisplay . "\"" . $mode . " " . $this->NSRequiredValue() . " />" . $html2;
|
||||
|
||||
if (isset($this->input) && $this->input != null) {
|
||||
if (count($arrayInputDocumentData) > 0) {
|
||||
$maxUploadFilesizeLabel = ($arrayInputDocumentData["INP_DOC_MAX_FILESIZE"] . "" != "0" && $arrayInputDocumentData["INP_DOC_MAX_FILESIZE"] != "")? "Max upload file size [" . $arrayInputDocumentData["INP_DOC_MAX_FILESIZE"] . " " . $arrayInputDocumentData["INP_DOC_MAX_FILESIZE_UNIT"] . "]" : "";
|
||||
|
||||
$arrayInputDocumentData["INP_DOC_TITLE"] = (isset($arrayInputDocumentData["INP_DOC_TITLE"]))? $arrayInputDocumentData["INP_DOC_TITLE"] : null;
|
||||
$html = $html . "<br /><label><img src=\"/images/inputdocument.gif\" width=\"22px\" width=\"22px\" alt=\"\" /><font size=\"1\">(" . trim($arrayInputDocumentData["INP_DOC_TITLE"]) . ") " . $maxUploadFilesizeLabel . "</font></label>";
|
||||
} else {
|
||||
$html = $html . " <font color=\"red\"><img src=\"/images/alert_icon.gif\" width=\"16px\" width=\"16px\" alt=\"\" /><font size=\"1\">(" . G::loadTranslation("ID_INPUT_DOC_DOESNT_EXIST") . ")</font></font>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3517,9 +3517,10 @@ class Cases
|
||||
* @param string $file File ($_FILES["form"]["name"]["APP_DOC_FILENAME"] or path to file)
|
||||
* @param int $fileError File error ($_FILES["form"]["error"]["APP_DOC_FILENAME"] or 0)
|
||||
* @param string $fileTmpName File temporal name ($_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"] or null)
|
||||
* @param string $fileSize File size ($_FILES["form"]["size"]["APP_DOC_FILENAME"] or 0)
|
||||
* @return string Return application document ID
|
||||
*/
|
||||
public function addInputDocument($inputDocumentUid, $appDocUid, $docVersion, $appDocType, $appDocComment, $inputDocumentAction, $applicationUid, $delIndex, $taskUid, $userUid, $option, $file, $fileError = 0, $fileTmpName = null)
|
||||
public function addInputDocument($inputDocumentUid, $appDocUid, $docVersion, $appDocType, $appDocComment, $inputDocumentAction, $applicationUid, $delIndex, $taskUid, $userUid, $option, $file, $fileError = 0, $fileTmpName = null, $fileSize = 0)
|
||||
{
|
||||
$appDocFileName = null;
|
||||
$sw = 0;
|
||||
@@ -3549,6 +3550,16 @@ class Cases
|
||||
$inputDocument = new InputDocument();
|
||||
$arrayInputDocumentData = $inputDocument->load($inputDocumentUid);
|
||||
|
||||
//---
|
||||
$inpDocMaxFilesize = $arrayInputDocumentData["INP_DOC_MAX_FILESIZE"];
|
||||
$inpDocMaxFilesizeUnit = $arrayInputDocumentData["INP_DOC_MAX_FILESIZE_UNIT"];
|
||||
|
||||
$inpDocMaxFilesize = $inpDocMaxFilesize * (($inpDocMaxFilesizeUnit == "MB")? 1024 *1024 : 1024); //Bytes
|
||||
|
||||
if ($fileSize > $inpDocMaxFilesize) {
|
||||
throw new Exception(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"));
|
||||
}
|
||||
|
||||
//Get the Custom Folder ID (create if necessary)
|
||||
$appFolder = new AppFolder();
|
||||
$folderId = $appFolder->createFromPath($arrayInputDocumentData["INP_DOC_DESTINATION_PATH"], $applicationUid);
|
||||
|
||||
@@ -83,6 +83,10 @@ class InputDocumentMapBuilder
|
||||
|
||||
$tMap->addColumn('INP_DOC_TYPE_FILE', 'InpDocTypeFile', 'string', CreoleTypes::VARCHAR, false, 200);
|
||||
|
||||
$tMap->addColumn('INP_DOC_MAX_FILESIZE', 'InpDocMaxFilesize', 'int', CreoleTypes::INTEGER, true, null);
|
||||
|
||||
$tMap->addColumn('INP_DOC_MAX_FILESIZE_UNIT', 'InpDocMaxFilesizeUnit', 'string', CreoleTypes::VARCHAR, true, 2);
|
||||
|
||||
$tMap->addValidator('INP_DOC_UID', 'maxLength', 'propel.validator.MaxLengthValidator', '32', 'Input Document UID can be no larger than 32 in size');
|
||||
|
||||
$tMap->addValidator('INP_DOC_UID', 'required', 'propel.validator.RequiredValidator', '', 'Input Document UID is required.');
|
||||
|
||||
@@ -81,6 +81,18 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $inp_doc_type_file = '*.*';
|
||||
|
||||
/**
|
||||
* The value for the inp_doc_max_filesize field.
|
||||
* @var int
|
||||
*/
|
||||
protected $inp_doc_max_filesize = 0;
|
||||
|
||||
/**
|
||||
* The value for the inp_doc_max_filesize_unit field.
|
||||
* @var string
|
||||
*/
|
||||
protected $inp_doc_max_filesize_unit = 'KB';
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
@@ -194,6 +206,28 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
|
||||
return $this->inp_doc_type_file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [inp_doc_max_filesize] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getInpDocMaxFilesize()
|
||||
{
|
||||
|
||||
return $this->inp_doc_max_filesize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [inp_doc_max_filesize_unit] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInpDocMaxFilesizeUnit()
|
||||
{
|
||||
|
||||
return $this->inp_doc_max_filesize_unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [inp_doc_uid] column.
|
||||
*
|
||||
@@ -392,6 +426,50 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
|
||||
|
||||
} // setInpDocTypeFile()
|
||||
|
||||
/**
|
||||
* Set the value of [inp_doc_max_filesize] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setInpDocMaxFilesize($v)
|
||||
{
|
||||
|
||||
// Since the native PHP type for this column is integer,
|
||||
// we will cast the input value to an int (if it is not).
|
||||
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->inp_doc_max_filesize !== $v || $v === 0) {
|
||||
$this->inp_doc_max_filesize = $v;
|
||||
$this->modifiedColumns[] = InputDocumentPeer::INP_DOC_MAX_FILESIZE;
|
||||
}
|
||||
|
||||
} // setInpDocMaxFilesize()
|
||||
|
||||
/**
|
||||
* Set the value of [inp_doc_max_filesize_unit] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setInpDocMaxFilesizeUnit($v)
|
||||
{
|
||||
|
||||
// Since the native PHP type for this column is string,
|
||||
// we will cast the input to a string (if it is not).
|
||||
if ($v !== null && !is_string($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->inp_doc_max_filesize_unit !== $v || $v === 'KB') {
|
||||
$this->inp_doc_max_filesize_unit = $v;
|
||||
$this->modifiedColumns[] = InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT;
|
||||
}
|
||||
|
||||
} // setInpDocMaxFilesizeUnit()
|
||||
|
||||
/**
|
||||
* Hydrates (populates) the object variables with values from the database resultset.
|
||||
*
|
||||
@@ -427,12 +505,16 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
|
||||
|
||||
$this->inp_doc_type_file = $rs->getString($startcol + 8);
|
||||
|
||||
$this->inp_doc_max_filesize = $rs->getInt($startcol + 9);
|
||||
|
||||
$this->inp_doc_max_filesize_unit = $rs->getString($startcol + 10);
|
||||
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
||||
// FIXME - using NUM_COLUMNS may be clearer.
|
||||
return $startcol + 9; // 9 = InputDocumentPeer::NUM_COLUMNS - InputDocumentPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
return $startcol + 11; // 11 = InputDocumentPeer::NUM_COLUMNS - InputDocumentPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating InputDocument object", $e);
|
||||
@@ -663,6 +745,12 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
|
||||
case 8:
|
||||
return $this->getInpDocTypeFile();
|
||||
break;
|
||||
case 9:
|
||||
return $this->getInpDocMaxFilesize();
|
||||
break;
|
||||
case 10:
|
||||
return $this->getInpDocMaxFilesizeUnit();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
@@ -692,6 +780,8 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
|
||||
$keys[6] => $this->getInpDocDestinationPath(),
|
||||
$keys[7] => $this->getInpDocTags(),
|
||||
$keys[8] => $this->getInpDocTypeFile(),
|
||||
$keys[9] => $this->getInpDocMaxFilesize(),
|
||||
$keys[10] => $this->getInpDocMaxFilesizeUnit(),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
@@ -750,6 +840,12 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
|
||||
case 8:
|
||||
$this->setInpDocTypeFile($value);
|
||||
break;
|
||||
case 9:
|
||||
$this->setInpDocMaxFilesize($value);
|
||||
break;
|
||||
case 10:
|
||||
$this->setInpDocMaxFilesizeUnit($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
@@ -809,6 +905,14 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
|
||||
$this->setInpDocTypeFile($arr[$keys[8]]);
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[9], $arr)) {
|
||||
$this->setInpDocMaxFilesize($arr[$keys[9]]);
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[10], $arr)) {
|
||||
$this->setInpDocMaxFilesizeUnit($arr[$keys[10]]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -856,6 +960,14 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_TYPE_FILE, $this->inp_doc_type_file);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(InputDocumentPeer::INP_DOC_MAX_FILESIZE)) {
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_MAX_FILESIZE, $this->inp_doc_max_filesize);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT)) {
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT, $this->inp_doc_max_filesize_unit);
|
||||
}
|
||||
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
@@ -926,6 +1038,10 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
|
||||
|
||||
$copyObj->setInpDocTypeFile($this->inp_doc_type_file);
|
||||
|
||||
$copyObj->setInpDocMaxFilesize($this->inp_doc_max_filesize);
|
||||
|
||||
$copyObj->setInpDocMaxFilesizeUnit($this->inp_doc_max_filesize_unit);
|
||||
|
||||
|
||||
$copyObj->setNew(true);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class BaseInputDocumentPeer
|
||||
const CLASS_DEFAULT = 'classes.model.InputDocument';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 9;
|
||||
const NUM_COLUMNS = 11;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
@@ -58,6 +58,12 @@ abstract class BaseInputDocumentPeer
|
||||
/** the column name for the INP_DOC_TYPE_FILE field */
|
||||
const INP_DOC_TYPE_FILE = 'INPUT_DOCUMENT.INP_DOC_TYPE_FILE';
|
||||
|
||||
/** the column name for the INP_DOC_MAX_FILESIZE field */
|
||||
const INP_DOC_MAX_FILESIZE = 'INPUT_DOCUMENT.INP_DOC_MAX_FILESIZE';
|
||||
|
||||
/** the column name for the INP_DOC_MAX_FILESIZE_UNIT field */
|
||||
const INP_DOC_MAX_FILESIZE_UNIT = 'INPUT_DOCUMENT.INP_DOC_MAX_FILESIZE_UNIT';
|
||||
|
||||
/** The PHP to DB Name Mapping */
|
||||
private static $phpNameMap = null;
|
||||
|
||||
@@ -69,10 +75,10 @@ abstract class BaseInputDocumentPeer
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('InpDocUid', 'ProUid', 'InpDocFormNeeded', 'InpDocOriginal', 'InpDocPublished', 'InpDocVersioning', 'InpDocDestinationPath', 'InpDocTags', 'InpDocTypeFile', ),
|
||||
BasePeer::TYPE_COLNAME => array (InputDocumentPeer::INP_DOC_UID, InputDocumentPeer::PRO_UID, InputDocumentPeer::INP_DOC_FORM_NEEDED, InputDocumentPeer::INP_DOC_ORIGINAL, InputDocumentPeer::INP_DOC_PUBLISHED, InputDocumentPeer::INP_DOC_VERSIONING, InputDocumentPeer::INP_DOC_DESTINATION_PATH, InputDocumentPeer::INP_DOC_TAGS, InputDocumentPeer::INP_DOC_TYPE_FILE, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('INP_DOC_UID', 'PRO_UID', 'INP_DOC_FORM_NEEDED', 'INP_DOC_ORIGINAL', 'INP_DOC_PUBLISHED', 'INP_DOC_VERSIONING', 'INP_DOC_DESTINATION_PATH', 'INP_DOC_TAGS', 'INP_DOC_TYPE_FILE', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
BasePeer::TYPE_PHPNAME => array ('InpDocUid', 'ProUid', 'InpDocFormNeeded', 'InpDocOriginal', 'InpDocPublished', 'InpDocVersioning', 'InpDocDestinationPath', 'InpDocTags', 'InpDocTypeFile', 'InpDocMaxFilesize', 'InpDocMaxFilesizeUnit', ),
|
||||
BasePeer::TYPE_COLNAME => array (InputDocumentPeer::INP_DOC_UID, InputDocumentPeer::PRO_UID, InputDocumentPeer::INP_DOC_FORM_NEEDED, InputDocumentPeer::INP_DOC_ORIGINAL, InputDocumentPeer::INP_DOC_PUBLISHED, InputDocumentPeer::INP_DOC_VERSIONING, InputDocumentPeer::INP_DOC_DESTINATION_PATH, InputDocumentPeer::INP_DOC_TAGS, InputDocumentPeer::INP_DOC_TYPE_FILE, InputDocumentPeer::INP_DOC_MAX_FILESIZE, InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('INP_DOC_UID', 'PRO_UID', 'INP_DOC_FORM_NEEDED', 'INP_DOC_ORIGINAL', 'INP_DOC_PUBLISHED', 'INP_DOC_VERSIONING', 'INP_DOC_DESTINATION_PATH', 'INP_DOC_TAGS', 'INP_DOC_TYPE_FILE', 'INP_DOC_MAX_FILESIZE', 'INP_DOC_MAX_FILESIZE_UNIT', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -82,10 +88,10 @@ abstract class BaseInputDocumentPeer
|
||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('InpDocUid' => 0, 'ProUid' => 1, 'InpDocFormNeeded' => 2, 'InpDocOriginal' => 3, 'InpDocPublished' => 4, 'InpDocVersioning' => 5, 'InpDocDestinationPath' => 6, 'InpDocTags' => 7, 'InpDocTypeFile' => 8, ),
|
||||
BasePeer::TYPE_COLNAME => array (InputDocumentPeer::INP_DOC_UID => 0, InputDocumentPeer::PRO_UID => 1, InputDocumentPeer::INP_DOC_FORM_NEEDED => 2, InputDocumentPeer::INP_DOC_ORIGINAL => 3, InputDocumentPeer::INP_DOC_PUBLISHED => 4, InputDocumentPeer::INP_DOC_VERSIONING => 5, InputDocumentPeer::INP_DOC_DESTINATION_PATH => 6, InputDocumentPeer::INP_DOC_TAGS => 7, InputDocumentPeer::INP_DOC_TYPE_FILE => 8, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('INP_DOC_UID' => 0, 'PRO_UID' => 1, 'INP_DOC_FORM_NEEDED' => 2, 'INP_DOC_ORIGINAL' => 3, 'INP_DOC_PUBLISHED' => 4, 'INP_DOC_VERSIONING' => 5, 'INP_DOC_DESTINATION_PATH' => 6, 'INP_DOC_TAGS' => 7, 'INP_DOC_TYPE_FILE' => 8, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
BasePeer::TYPE_PHPNAME => array ('InpDocUid' => 0, 'ProUid' => 1, 'InpDocFormNeeded' => 2, 'InpDocOriginal' => 3, 'InpDocPublished' => 4, 'InpDocVersioning' => 5, 'InpDocDestinationPath' => 6, 'InpDocTags' => 7, 'InpDocTypeFile' => 8, 'InpDocMaxFilesize' => 9, 'InpDocMaxFilesizeUnit' => 10, ),
|
||||
BasePeer::TYPE_COLNAME => array (InputDocumentPeer::INP_DOC_UID => 0, InputDocumentPeer::PRO_UID => 1, InputDocumentPeer::INP_DOC_FORM_NEEDED => 2, InputDocumentPeer::INP_DOC_ORIGINAL => 3, InputDocumentPeer::INP_DOC_PUBLISHED => 4, InputDocumentPeer::INP_DOC_VERSIONING => 5, InputDocumentPeer::INP_DOC_DESTINATION_PATH => 6, InputDocumentPeer::INP_DOC_TAGS => 7, InputDocumentPeer::INP_DOC_TYPE_FILE => 8, InputDocumentPeer::INP_DOC_MAX_FILESIZE => 9, InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT => 10, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('INP_DOC_UID' => 0, 'PRO_UID' => 1, 'INP_DOC_FORM_NEEDED' => 2, 'INP_DOC_ORIGINAL' => 3, 'INP_DOC_PUBLISHED' => 4, 'INP_DOC_VERSIONING' => 5, 'INP_DOC_DESTINATION_PATH' => 6, 'INP_DOC_TAGS' => 7, 'INP_DOC_TYPE_FILE' => 8, 'INP_DOC_MAX_FILESIZE' => 9, 'INP_DOC_MAX_FILESIZE_UNIT' => 10, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -204,6 +210,10 @@ abstract class BaseInputDocumentPeer
|
||||
|
||||
$criteria->addSelectColumn(InputDocumentPeer::INP_DOC_TYPE_FILE);
|
||||
|
||||
$criteria->addSelectColumn(InputDocumentPeer::INP_DOC_MAX_FILESIZE);
|
||||
|
||||
$criteria->addSelectColumn(InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT);
|
||||
|
||||
}
|
||||
|
||||
const COUNT = 'COUNT(INPUT_DOCUMENT.INP_DOC_UID)';
|
||||
|
||||
@@ -581,6 +581,8 @@
|
||||
<column name="INP_DOC_DESTINATION_PATH" type="LONGVARCHAR" required="false"/>
|
||||
<column name="INP_DOC_TAGS" type="LONGVARCHAR" required="false"/>
|
||||
<column name="INP_DOC_TYPE_FILE" type="VARCHAR" size="200" required="false" default="*.*"/>
|
||||
<column name="INP_DOC_MAX_FILESIZE" type="INTEGER" required="true" default="0"/>
|
||||
<column name="INP_DOC_MAX_FILESIZE_UNIT" type="VARCHAR" size="2" required="true" default="KB"/>
|
||||
<validator column="INP_DOC_UID">
|
||||
<rule name="maxLength" value="32" message="Input Document UID can be no larger than ${value} in size"/>
|
||||
<rule name="required" message="Input Document UID is required."/>
|
||||
@@ -836,7 +838,7 @@
|
||||
<column name="PRO_TRI_CANCELED" type="VARCHAR" size="32" required="true" default=""/>
|
||||
<column name="PRO_TRI_PAUSED" type="VARCHAR" size="32" required="true" default=""/>
|
||||
<column name="PRO_TRI_REASSIGNED" type="VARCHAR" size="32" required="true" default=""/>
|
||||
<column name="PRO_TRI_UNPAUSED" type="VARCHAR" size="32" required="true" default=""/>
|
||||
<column name="PRO_TRI_UNPAUSED" type="VARCHAR" size="32" required="true" default=""/>
|
||||
<column name="PRO_SHOW_DELEGATE" type="TINYINT" required="true" default="1"/>
|
||||
<column name="PRO_SHOW_DYNAFORM" type="TINYINT" required="true" default="0"/>
|
||||
<column name="PRO_CATEGORY" type="VARCHAR" size="48" required="true" default=""/>
|
||||
|
||||
@@ -593,6 +593,8 @@ CREATE TABLE [INPUT_DOCUMENT]
|
||||
[INP_DOC_VERSIONING] TINYINT default 0 NOT NULL,
|
||||
[INP_DOC_DESTINATION_PATH] NVARCHAR(MAX) NULL,
|
||||
[INP_DOC_TAGS] NVARCHAR(MAX) NULL,
|
||||
[INP_DOC_MAX_FILESIZE] INT default 0 NOT NULL,
|
||||
[INP_DOC_MAX_FILESIZE_UNIT] VARCHAR(2) default 'KB' NOT NULL,
|
||||
CONSTRAINT INPUT_DOCUMENT_PK PRIMARY KEY ([INP_DOC_UID])
|
||||
);
|
||||
|
||||
|
||||
@@ -268,6 +268,8 @@ CREATE TABLE `INPUT_DOCUMENT`
|
||||
`INP_DOC_DESTINATION_PATH` MEDIUMTEXT,
|
||||
`INP_DOC_TAGS` MEDIUMTEXT,
|
||||
`INP_DOC_TYPE_FILE` VARCHAR(200) default '*.*',
|
||||
`INP_DOC_MAX_FILESIZE` INTEGER default 0 NOT NULL,
|
||||
`INP_DOC_MAX_FILESIZE_UNIT` VARCHAR(2) default 'KB' NOT NULL,
|
||||
PRIMARY KEY (`INP_DOC_UID`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Documentation required';
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -333,6 +333,8 @@ CREATE TABLE "INPUT_DOCUMENT"
|
||||
"INP_DOC_VERSIONING" NUMBER(3,0) default 0 NOT NULL,
|
||||
"INP_DOC_DESTINATION_PATH" VARCHAR2(2000),
|
||||
"INP_DOC_TAGS" VARCHAR2(2000)
|
||||
"INP_DOC_MAX_FILESIZE" NUMBER default 0 NOT NULL,
|
||||
"INP_DOC_MAX_FILESIZE_UNIT" VARCHAR2(2) default 'KB' NOT NULL,
|
||||
);
|
||||
|
||||
ALTER TABLE "INPUT_DOCUMENT"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
$response = new stdclass();
|
||||
$response->message = G::LoadTranslation('ID_LOGIN_AGAIN');
|
||||
$response->lostSession = true;
|
||||
print G::json_encode( $response );
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
$response = new stdclass();
|
||||
$response->message = G::LoadTranslation('ID_LOGIN_AGAIN');
|
||||
$response->lostSession = true;
|
||||
print G::json_encode( $response );
|
||||
die();
|
||||
}
|
||||
/**
|
||||
@@ -908,9 +908,17 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
|
||||
$Fields['APP_DOC_UID'] = $_POST['appDocId'];
|
||||
$Fields['actionType'] = $_POST['actionType'];
|
||||
$Fields['docVersion'] = $_POST['docVersion'];
|
||||
$oInputDocument = new InputDocument();
|
||||
$InpDocData = $oInputDocument->load( $Fields['DOC_UID'] );
|
||||
$oInputDocument = new InputDocument();
|
||||
$InpDocData = $oInputDocument->load( $Fields['DOC_UID'] );
|
||||
|
||||
$inpDocMaxFilesize = $InpDocData["INP_DOC_MAX_FILESIZE"];
|
||||
$inpDocMaxFilesizeUnit = $InpDocData["INP_DOC_MAX_FILESIZE_UNIT"];
|
||||
$inpDocMaxFilesize = $inpDocMaxFilesize * (($inpDocMaxFilesizeUnit == "MB")? 1024 *1024 : 1024); //Bytes
|
||||
|
||||
$Fields["INP_DOC_MAX_FILESIZE"] = $inpDocMaxFilesize;
|
||||
$Fields["INP_DOC_MAX_FILESIZE_LABEL"] = ($inpDocMaxFilesize > 0)? "[" . $InpDocData["INP_DOC_MAX_FILESIZE"] . " " . $InpDocData["INP_DOC_MAX_FILESIZE_UNIT"] . "]" : "";
|
||||
$Fields['fileTypes'] = $InpDocData['INP_DOC_TYPE_FILE'];
|
||||
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'cases_SaveDocument?UID=' . $_POST['docID'] );
|
||||
G::RenderPage( 'publish', 'raw' );
|
||||
break;
|
||||
|
||||
@@ -40,10 +40,10 @@ try {
|
||||
if ($_GET['APP_UID'] !== $_SESSION['APPLICATION']) {
|
||||
throw new Exception( G::LoadTranslation( 'ID_INVALID_APPLICATION_ID_MSG', array ('<a href=\'' . $_SERVER['HTTP_REFERER'] . '\'>{1}</a>',G::LoadTranslation( 'ID_REOPEN' ) ) ) );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* PMDynaform
|
||||
* DYN_VERSION is 1: classic Dynaform,
|
||||
* DYN_VERSION is 1: classic Dynaform,
|
||||
* DYN_VERSION is 2: responsive form, Pmdynaform.
|
||||
*/
|
||||
$a = new Criteria("workflow");
|
||||
@@ -183,7 +183,7 @@ try {
|
||||
$aData['USER_UID'] = $_SESSION['USER_LOGGED'];
|
||||
//$aData['APP_STATUS'] = $Fields['APP_STATUS'];
|
||||
$aData['PRO_UID'] = $_SESSION['PROCESS'];
|
||||
|
||||
|
||||
if ($swpmdynaform) {
|
||||
$aData['APP_DATA'] = array_merge($aData['APP_DATA'], $pmdynaform);
|
||||
$_POST["DynaformRequiredFields"] = '[]';
|
||||
@@ -255,6 +255,7 @@ try {
|
||||
if ($arrayFileError[$i] == 0) {
|
||||
$indocUid = null;
|
||||
$fieldName = null;
|
||||
$fileSizeByField = 0;
|
||||
|
||||
if (is_array( $arrayField[$i] )) {
|
||||
if (isset( $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]] ) && ! empty( $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]] )) {
|
||||
@@ -262,12 +263,20 @@ try {
|
||||
}
|
||||
|
||||
$fieldName = $arrayField[$i]["grdName"] . "_" . $arrayField[$i]["index"] . "_" . $arrayField[$i]["grdFieldName"];
|
||||
|
||||
if (isset($_FILES["form"]["size"][$arrayField[$i]["grdName"]][$arrayField[$i]["index"]][$arrayField[$i]["grdFieldName"]])) {
|
||||
$fileSizeByField = $_FILES["form"]["size"][$arrayField[$i]["grdName"]][$arrayField[$i]["index"]][$arrayField[$i]["grdFieldName"]];
|
||||
}
|
||||
} else {
|
||||
if (isset( $_POST["INPUTS"][$arrayField[$i]] ) && ! empty( $_POST["INPUTS"][$arrayField[$i]] )) {
|
||||
$indocUid = $_POST["INPUTS"][$arrayField[$i]];
|
||||
}
|
||||
|
||||
$fieldName = $arrayField[$i];
|
||||
|
||||
if (isset($_FILES["form"]["size"][$fieldName])) {
|
||||
$fileSizeByField = $_FILES["form"]["size"][$fieldName];
|
||||
}
|
||||
}
|
||||
|
||||
if ($indocUid != null) {
|
||||
@@ -290,6 +299,21 @@ try {
|
||||
die();
|
||||
}
|
||||
|
||||
//Validate Filesize of $_FILE
|
||||
$inpDocMaxFilesize = $aID["INP_DOC_MAX_FILESIZE"];
|
||||
$inpDocMaxFilesizeUnit = $aID["INP_DOC_MAX_FILESIZE_UNIT"];
|
||||
|
||||
$inpDocMaxFilesize = $inpDocMaxFilesize * (($inpDocMaxFilesizeUnit == "MB")? 1024 *1024 : 1024); //Bytes
|
||||
|
||||
if ($inpDocMaxFilesize > 0 && $fileSizeByField > 0) {
|
||||
if ($fileSizeByField > $inpDocMaxFilesize) {
|
||||
G::SendMessageText(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"), "ERROR");
|
||||
$arrayAux1 = explode("sys" . SYS_SYS, $_SERVER["HTTP_REFERER"]);
|
||||
G::header("location: /sys" . SYS_SYS . $arrayAux1[1]);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
$aFields = array ("APP_UID" => $_SESSION["APPLICATION"],"DEL_INDEX" => $_SESSION["INDEX"],"USR_UID" => $_SESSION["USER_LOGGED"],"DOC_UID" => $indocUid,"APP_DOC_TYPE" => "INPUT","APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => "","APP_DOC_TITLE" => "","APP_DOC_FILENAME" => $arrayFileName[$i],"FOLDER_UID" => $oFolder->createFromPath( $aID["INP_DOC_DESTINATION_PATH"] ),"APP_DOC_TAGS" => $oFolder->parseTags( $aID["INP_DOC_TAGS"] ),"APP_DOC_FIELDNAME" => $fieldName);
|
||||
} else {
|
||||
$aFields = array ("APP_UID" => $_SESSION["APPLICATION"],"DEL_INDEX" => $_SESSION["INDEX"],"USR_UID" => $_SESSION["USER_LOGGED"],"DOC_UID" => - 1,"APP_DOC_TYPE" => "ATTACHED","APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => "","APP_DOC_TITLE" => "","APP_DOC_FILENAME" => $arrayFileName[$i],"APP_DOC_FIELDNAME" => $fieldName);
|
||||
|
||||
@@ -93,36 +93,45 @@ if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) {
|
||||
$_SESSION["TRIGGER_DEBUG"]["TRIGGERS_VALUES"] = $arrayTrigger;
|
||||
}
|
||||
|
||||
//***Validating the file allowed extensions***
|
||||
$oInputDocument = new InputDocument();
|
||||
//***Validating the file allowed extensions***
|
||||
$oInputDocument = new InputDocument();
|
||||
$InpDocData = $oInputDocument->load( $inputDocumentUid );
|
||||
$res = G::verifyInputDocExtension($InpDocData['INP_DOC_TYPE_FILE'], $_FILES["form"]["name"]["APP_DOC_FILENAME"], $_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"]);
|
||||
if($res->status == 0){
|
||||
$message = $res->message;
|
||||
G::SendMessageText( $message, "ERROR" );
|
||||
$backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] );
|
||||
G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] );
|
||||
$message = $res->message;
|
||||
G::SendMessageText( $message, "ERROR" );
|
||||
$backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] );
|
||||
G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] );
|
||||
die();
|
||||
}
|
||||
|
||||
//Add Input Document
|
||||
if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) {
|
||||
$appDocUid = $case->addInputDocument(
|
||||
$inputDocumentUid,
|
||||
$appDocUid,
|
||||
$docVersion,
|
||||
$appDocType,
|
||||
$appDocComment,
|
||||
$actionType,
|
||||
$_SESSION["APPLICATION"],
|
||||
$_SESSION["INDEX"],
|
||||
$_SESSION["TASK"],
|
||||
$_SESSION["USER_LOGGED"],
|
||||
"xmlform",
|
||||
$_FILES["form"]["name"]["APP_DOC_FILENAME"],
|
||||
$_FILES["form"]["error"]["APP_DOC_FILENAME"],
|
||||
$_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"]
|
||||
);
|
||||
try {
|
||||
$appDocUid = $case->addInputDocument(
|
||||
$inputDocumentUid,
|
||||
$appDocUid,
|
||||
$docVersion,
|
||||
$appDocType,
|
||||
$appDocComment,
|
||||
$actionType,
|
||||
$_SESSION["APPLICATION"],
|
||||
$_SESSION["INDEX"],
|
||||
$_SESSION["TASK"],
|
||||
$_SESSION["USER_LOGGED"],
|
||||
"xmlform",
|
||||
$_FILES["form"]["name"]["APP_DOC_FILENAME"],
|
||||
$_FILES["form"]["error"]["APP_DOC_FILENAME"],
|
||||
$_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"],
|
||||
$_FILES["form"]["size"]["APP_DOC_FILENAME"]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
G::SendMessageText($e->getMessage(), "ERROR");
|
||||
|
||||
$arrayAux = explode("sys" . SYS_SYS, $_SERVER["HTTP_REFERER"]);
|
||||
G::header("location: /sys" . SYS_SYS . $arrayAux[1]);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) {
|
||||
|
||||
@@ -45,6 +45,19 @@ try {
|
||||
}
|
||||
$aFields['INP_DOC_TAGS'] = isset( $aFields['INP_DOC_TAGS'] ) ? $aFields['INP_DOC_TAGS'] : 'INPUT';
|
||||
$aFields['INP_DOC_VERSIONING'] = strval( isset( $aFields['INP_DOC_VERSIONING'] ) ? $aFields['INP_DOC_VERSIONING'] : '' );
|
||||
|
||||
$uploadMaxFilesize = 0;
|
||||
$uploadMaxFilesizeUnit = "KB";
|
||||
|
||||
if (preg_match("/^(\d+)(.*)$/", ini_get("upload_max_filesize"), $arrayMatch)) {
|
||||
$uploadMaxFilesize = (int)($arrayMatch[1]);
|
||||
$uploadMaxFilesizeUnit = (strlen(strtoupper($arrayMatch[2])) > 1)? $arrayMatch[2] : $arrayMatch[2] . "B";
|
||||
$uploadMaxFilesize = $uploadMaxFilesize * (($uploadMaxFilesizeUnit == "MB")? 1024 * 1024 : 1024); //Bytes
|
||||
}
|
||||
|
||||
$aFields["INP_DOC_UPLOAD_MAX_FILESIZE"] = $uploadMaxFilesize;
|
||||
$aFields["INP_DOC_UPLOAD_MAX_FILESIZE_LABEL"] = "(" . $arrayMatch[1] . " " . $uploadMaxFilesizeUnit . ")";
|
||||
|
||||
G::LoadClass( 'xmlfield_InputPM' );
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'inputdocs/inputdocs_Edit', '', $aFields, '../inputdocs/inputdocs_Save' );
|
||||
|
||||
@@ -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} {$form.BTN_CANCEL}</td>
|
||||
</tr>
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
@@ -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} {$form.BTN_CANCEL} </td>
|
||||
</tr>
|
||||
@@ -70,4 +80,4 @@
|
||||
<script type="text/javascript">
|
||||
{$form.JS}
|
||||
</script>
|
||||
</form>
|
||||
</form>
|
||||
@@ -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>
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
Reference in New Issue
Block a user