diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 60bb98839..ce776b568 100755 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -5328,6 +5328,177 @@ class G } return $from; } + + /** + * Verify the InputDoc extension, cheking the file name extension (.pdf, .ppt) and the file content. + * + * + * + */ + public function verifyInputDocExtension($InpDocAllowedFiles, $filesName, $filesTmpName){ + $allowedTypes = explode(", ", $InpDocAllowedFiles); + $flag = 0; + + if (!extension_loaded('fileinfo')) { + $dtype = explode(".", $filesName); + + foreach ($allowedTypes as $types => $val) { + if((preg_match('/^\*\.?[a-z]{2,8}$/', $val)) || ($val == '*.*')){ + $allowedDocTypes = substr($val, 2); + if(($dtype[count($dtype) -1]) != $allowedDocTypes){ + $flag = 1; + } else { + $flag = 0; + break; + } + } else { + $message = G::LoadTranslation('ID_UPLOAD_ERR_WRONG_ALLOWED_EXTENSION_FORMAT' ); + G::SendMessageText( $message, "ERROR" ); + + $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + die(); + } + } + } else { + $finfo = new finfo(FILEINFO_MIME_TYPE); + $finfo_ = $finfo->file($filesTmpName); + $docType = explode("/", $finfo_); + + foreach ($allowedTypes as $types => $val) { + if((preg_match('/^\*\.?[a-z]{2,8}$/', $val)) || ($val == '*.*')){ + $allowedDocTypes = substr($val, 2); + + switch($allowedDocTypes){ + case '*': + $flag = 0; + break; + case 'xls': + if($docType[1] != 'vnd.ms-excel'){ + $flag = 1; + } else { + $flag = 0; + } + break; + case 'doc': + if($docType[1] != 'msword'){ + $flag = 1; + } else { + $flag = 0; + } + break; + case 'ppt': + if($docType[1] != 'vnd.ms-office'){ + $flag = 1; + } else { + $flag = 0; + } + break; + case 'docx': + case 'pptx': + case 'xlsx': + if($docType[1] != 'zip'){ + $flag = 1; + } else { + $flag = 0; + } + break; + case 'exe': + case 'wmv': + if($docType[1] != 'octet-stream'){ + $flag = 1; + } else { + $flag = 0; + } + break; + case 'jpg': + if ($docType[1] != 'jpeg'){ + $flag = 1; + } else { + $flag = 0; + } + break; + case 'mp3': + if ($docType[1] != 'mpeg'){ + $flag = 1; + } else { + $flag = 0; + } + break; + case 'rar': + if ($docType[1] != 'x-rar'){ + $flag = 1; + } else { + $flag = 0; + } + break; + case 'txt': + case 'pm': + if ($docType[1] != 'plain'){ + $flag = 1; + } else { + $flag = 0; + } + break; + case 'htm': + case 'html': + if ($docType[1] != 'html'){ + $flag = 1; + } else { + $flag = 0; + } + break; + case 'po': + if ($docType[1] != 'x-po'){ + $flag = 1; + } else { + $flag = 0; + } + break; + case 'pdf': + case 'png': + case 'jpeg': + case 'gif': + case 'zip': + case 'mp4': + if ($docType[1] != $allowedDocTypes){ + $flag = 1; + } else { + $flag = 0; + } + break; + default: + $dtype = explode(".", $filesName); + if(($dtype[count($dtype) - 1]) != $allowedDocTypes){ + $flag = 1; + } else { + $flag = 0; + } + } + + if($flag == 0){ + break; + } + } else { + $message = G::LoadTranslation('ID_UPLOAD_ERR_WRONG_ALLOWED_EXTENSION_FORMAT' ); + G::SendMessageText( $message, "ERROR" ); + + $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + die(); + } + } + } + + if( $flag == 1){ + $message = G::LoadTranslation( 'ID_UPLOAD_ERR_NOT_ALLOWED_EXTENSION' ); + G::SendMessageText( $message, "ERROR" ); + + $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + die(); + } + } } /** diff --git a/workflow/engine/classes/model/map/InputDocumentMapBuilder.php b/workflow/engine/classes/model/map/InputDocumentMapBuilder.php index 699315a15..505409dea 100755 --- a/workflow/engine/classes/model/map/InputDocumentMapBuilder.php +++ b/workflow/engine/classes/model/map/InputDocumentMapBuilder.php @@ -81,6 +81,8 @@ class InputDocumentMapBuilder $tMap->addColumn('INP_DOC_TAGS', 'InpDocTags', 'string', CreoleTypes::LONGVARCHAR, false, null); + $tMap->addColumn('INP_DOC_TYPE_FILE', 'InpDocTypeFile', 'string', CreoleTypes::VARCHAR, false, 200); + $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.'); diff --git a/workflow/engine/classes/model/om/BaseInputDocument.php b/workflow/engine/classes/model/om/BaseInputDocument.php index 5daf7b89b..b41fbd720 100755 --- a/workflow/engine/classes/model/om/BaseInputDocument.php +++ b/workflow/engine/classes/model/om/BaseInputDocument.php @@ -75,6 +75,12 @@ abstract class BaseInputDocument extends BaseObject implements Persistent */ protected $inp_doc_tags; + /** + * The value for the inp_doc_type_file field. + * @var string + */ + protected $inp_doc_type_file = '*.*'; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -177,6 +183,17 @@ abstract class BaseInputDocument extends BaseObject implements Persistent return $this->inp_doc_tags; } + /** + * Get the [inp_doc_type_file] column value. + * + * @return string + */ + public function getInpDocTypeFile() + { + + return $this->inp_doc_type_file; + } + /** * Set the value of [inp_doc_uid] column. * @@ -353,6 +370,28 @@ abstract class BaseInputDocument extends BaseObject implements Persistent } // setInpDocTags() + /** + * Set the value of [inp_doc_type_file] column. + * + * @param string $v new value + * @return void + */ + public function setInpDocTypeFile($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_type_file !== $v || $v === '*.*') { + $this->inp_doc_type_file = $v; + $this->modifiedColumns[] = InputDocumentPeer::INP_DOC_TYPE_FILE; + } + + } // setInpDocTypeFile() + /** * Hydrates (populates) the object variables with values from the database resultset. * @@ -386,12 +425,14 @@ abstract class BaseInputDocument extends BaseObject implements Persistent $this->inp_doc_tags = $rs->getString($startcol + 7); + $this->inp_doc_type_file = $rs->getString($startcol + 8); + $this->resetModified(); $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 8; // 8 = InputDocumentPeer::NUM_COLUMNS - InputDocumentPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 9; // 9 = InputDocumentPeer::NUM_COLUMNS - InputDocumentPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating InputDocument object", $e); @@ -619,6 +660,9 @@ abstract class BaseInputDocument extends BaseObject implements Persistent case 7: return $this->getInpDocTags(); break; + case 8: + return $this->getInpDocTypeFile(); + break; default: return null; break; @@ -647,6 +691,7 @@ abstract class BaseInputDocument extends BaseObject implements Persistent $keys[5] => $this->getInpDocVersioning(), $keys[6] => $this->getInpDocDestinationPath(), $keys[7] => $this->getInpDocTags(), + $keys[8] => $this->getInpDocTypeFile(), ); return $result; } @@ -702,6 +747,9 @@ abstract class BaseInputDocument extends BaseObject implements Persistent case 7: $this->setInpDocTags($value); break; + case 8: + $this->setInpDocTypeFile($value); + break; } // switch() } @@ -757,6 +805,10 @@ abstract class BaseInputDocument extends BaseObject implements Persistent $this->setInpDocTags($arr[$keys[7]]); } + if (array_key_exists($keys[8], $arr)) { + $this->setInpDocTypeFile($arr[$keys[8]]); + } + } /** @@ -800,6 +852,10 @@ abstract class BaseInputDocument extends BaseObject implements Persistent $criteria->add(InputDocumentPeer::INP_DOC_TAGS, $this->inp_doc_tags); } + if ($this->isColumnModified(InputDocumentPeer::INP_DOC_TYPE_FILE)) { + $criteria->add(InputDocumentPeer::INP_DOC_TYPE_FILE, $this->inp_doc_type_file); + } + return $criteria; } @@ -868,6 +924,8 @@ abstract class BaseInputDocument extends BaseObject implements Persistent $copyObj->setInpDocTags($this->inp_doc_tags); + $copyObj->setInpDocTypeFile($this->inp_doc_type_file); + $copyObj->setNew(true); diff --git a/workflow/engine/classes/model/om/BaseInputDocumentPeer.php b/workflow/engine/classes/model/om/BaseInputDocumentPeer.php index ed7c0acff..aaf25196e 100755 --- a/workflow/engine/classes/model/om/BaseInputDocumentPeer.php +++ b/workflow/engine/classes/model/om/BaseInputDocumentPeer.php @@ -25,7 +25,7 @@ abstract class BaseInputDocumentPeer const CLASS_DEFAULT = 'classes.model.InputDocument'; /** The total number of columns. */ - const NUM_COLUMNS = 8; + const NUM_COLUMNS = 9; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -55,6 +55,9 @@ abstract class BaseInputDocumentPeer /** the column name for the INP_DOC_TAGS field */ const INP_DOC_TAGS = 'INPUT_DOCUMENT.INP_DOC_TAGS'; + /** the column name for the INP_DOC_TYPE_FILE field */ + const INP_DOC_TYPE_FILE = 'INPUT_DOCUMENT.INP_DOC_TYPE_FILE'; + /** The PHP to DB Name Mapping */ private static $phpNameMap = null; @@ -66,10 +69,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', ), - 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, ), - 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', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) + 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, ) ); /** @@ -79,10 +82,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, ), - 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, ), - 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, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) + 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, ) ); /** @@ -199,6 +202,8 @@ abstract class BaseInputDocumentPeer $criteria->addSelectColumn(InputDocumentPeer::INP_DOC_TAGS); + $criteria->addSelectColumn(InputDocumentPeer::INP_DOC_TYPE_FILE); + } const COUNT = 'COUNT(INPUT_DOCUMENT.INP_DOC_UID)'; diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index e90a26fca..cb86f8cd2 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -580,6 +580,7 @@ + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index d16757512..6111d79e7 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -267,6 +267,7 @@ CREATE TABLE `INPUT_DOCUMENT` `INP_DOC_VERSIONING` TINYINT default 0 NOT NULL, `INP_DOC_DESTINATION_PATH` MEDIUMTEXT, `INP_DOC_TAGS` MEDIUMTEXT, + `INP_DOC_TYPE_FILE` VARCHAR(200) default '*.*', PRIMARY KEY (`INP_DOC_UID`) )ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Documentation required'; #----------------------------------------------------------------------------- diff --git a/workflow/engine/methods/cases/cases_Ajax.php b/workflow/engine/methods/cases/cases_Ajax.php index ddc82f867..775c5828f 100755 --- a/workflow/engine/methods/cases/cases_Ajax.php +++ b/workflow/engine/methods/cases/cases_Ajax.php @@ -908,6 +908,9 @@ 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'] ); + $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; diff --git a/workflow/engine/methods/cases/cases_SaveData.php b/workflow/engine/methods/cases/cases_SaveData.php index 4f71d7caf..ee256b11c 100644 --- a/workflow/engine/methods/cases/cases_SaveData.php +++ b/workflow/engine/methods/cases/cases_SaveData.php @@ -279,6 +279,9 @@ try { //Get the Custom Folder ID (create if necessary) $oFolder = new AppFolder(); + //***Validating the file allowed extensions*** + G::verifyInputDocExtension($aID['INP_DOC_TYPE_FILE'], $_FILES["form"]["name"]["input"], $_FILES["form"]["tmp_name"]["input"]); + $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); diff --git a/workflow/engine/methods/cases/cases_SaveDocument.php b/workflow/engine/methods/cases/cases_SaveDocument.php index 0d5e89e79..6200da0a1 100755 --- a/workflow/engine/methods/cases/cases_SaveDocument.php +++ b/workflow/engine/methods/cases/cases_SaveDocument.php @@ -93,8 +93,10 @@ if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) { $_SESSION["TRIGGER_DEBUG"]["TRIGGERS_VALUES"] = $arrayTrigger; } - - +//***Validating the file allowed extensions*** +$oInputDocument = new InputDocument(); +$InpDocData = $oInputDocument->load( $inputDocumentUid ); +G::verifyInputDocExtension($InpDocData['INP_DOC_TYPE_FILE'], $_FILES["form"]["name"]["APP_DOC_FILENAME"], $_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"]); //Add Input Document if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) { diff --git a/workflow/engine/methods/inputdocs/inputdocs_Save.php b/workflow/engine/methods/inputdocs/inputdocs_Save.php index 4daa9be8d..77025d9b5 100755 --- a/workflow/engine/methods/inputdocs/inputdocs_Save.php +++ b/workflow/engine/methods/inputdocs/inputdocs_Save.php @@ -88,6 +88,18 @@ try { $aData = $_POST; } + //Validating the format of the allowed extentions + //Allowed Types has to have this format -> *.pdf, *.docx or *.* to all. + $allowedTypes = explode(", ", $aData['INP_DOC_TYPE_FILE']); + foreach ($allowedTypes as $types => $val) { + if((preg_match('/^\*\.?[a-z]{2,8}$/', $val)) || ($val == '*.*')){ + }else { + $message = G::LoadTranslation( 'ID_UPLOAD_ERR_WRONG_ALLOWED_EXTENSION_FORMAT' ); + G::SendMessageText( $message, "ERROR" ); + die(); + } + } + if ($aData['INP_DOC_UID'] == '') { unset( $aData['INP_DOC_UID'] ); $oInputDocument->create( $aData ); diff --git a/workflow/engine/xmlform/cases/cases_AttachInputDocumentGeneral.html b/workflow/engine/xmlform/cases/cases_AttachInputDocumentGeneral.html index 89fa31ce7..549832ced 100755 --- a/workflow/engine/xmlform/cases/cases_AttachInputDocumentGeneral.html +++ b/workflow/engine/xmlform/cases/cases_AttachInputDocumentGeneral.html @@ -22,6 +22,9 @@ {$form.docVersion} + + + {$form.fileTypes} {$APP_DOC_FILENAME} diff --git a/workflow/engine/xmlform/cases/cases_AttachInputDocumentGeneral.xml b/workflow/engine/xmlform/cases/cases_AttachInputDocumentGeneral.xml index afea71511..eb293584a 100755 --- a/workflow/engine/xmlform/cases/cases_AttachInputDocumentGeneral.xml +++ b/workflow/engine/xmlform/cases/cases_AttachInputDocumentGeneral.xml @@ -6,6 +6,7 @@ + @@ -39,6 +40,27 @@ var verifyInfo = function(oForm) oAux.focus(); return; } + + docType = oAux.value.split("."); + docType = docType[docType.length - 1]; + + allowedTypes = getField('fileTypes').value.split(", "); + + for(i=0; i{$INP_DOC_TAGS} {$form.INP_DOC_TAGS} + + + {$INP_DOC_TYPE_FILE} + + {$form.INP_DOC_TYPE_FILE}
{$form.ACCEPT}   {$form.BTN_CANCEL} diff --git a/workflow/engine/xmlform/inputdocs/inputdocs_Edit.xml b/workflow/engine/xmlform/inputdocs/inputdocs_Edit.xml index cee02cb5b..1b48505a6 100755 --- a/workflow/engine/xmlform/inputdocs/inputdocs_Edit.xml +++ b/workflow/engine/xmlform/inputdocs/inputdocs_Edit.xml @@ -26,6 +26,9 @@ + + + diff --git a/workflow/engine/xmlform/inputdocs/inputdocs_Options.xml b/workflow/engine/xmlform/inputdocs/inputdocs_Options.xml index 6f68276fc..5ae097fbe 100755 --- a/workflow/engine/xmlform/inputdocs/inputdocs_Options.xml +++ b/workflow/engine/xmlform/inputdocs/inputdocs_Options.xml @@ -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