From 27ac82a803377dc5c6b33ef6f3293d08e0de78fd Mon Sep 17 00:00:00 2001 From: jennylee Date: Wed, 17 Oct 2012 12:03:40 -0400 Subject: [PATCH 1/3] CODE STYLE workflow/engine/methods/processes/process_Delete.php workflow/engine/methods/processes/processes_DeleteObjectPermission.php workflow/engine/methods/processes/processes_doUpload.php workflow/engine/methods/processes/processes_DownloadFile.php workflow/engine/methods/processes/processes_DownloadFileXpdl.php workflow/engine/methods/processes/processes_checkProperties.php workflow/engine/methods/processes/processes_Export.php workflow/engine/methods/processes/processes_GetFile.php workflow/engine/methods/processes/processes_Import.php workflow/engine/methods/processes/processes_Import_Ajax.php --- .../methods/processes/processes_Delete.php | 70 ++- .../processes_DeleteObjectPermission.php | 123 ++--- .../processes/processes_DownloadFile.php | 41 +- .../processes/processes_DownloadFileXpdl.php | 73 ++- .../methods/processes/processes_Export.php | 158 +++--- .../methods/processes/processes_GetFile.php | 32 +- .../methods/processes/processes_Import.php | 87 ++- .../processes/processes_Import_Ajax.php | 522 +++++++++--------- .../processes/processes_checkProperties.php | 120 ++-- .../methods/processes/processes_doUpload.php | 56 +- 10 files changed, 624 insertions(+), 658 deletions(-) diff --git a/workflow/engine/methods/processes/processes_Delete.php b/workflow/engine/methods/processes/processes_Delete.php index 6929aa5a8..3361bb0c4 100755 --- a/workflow/engine/methods/processes/processes_Delete.php +++ b/workflow/engine/methods/processes/processes_Delete.php @@ -12,51 +12,49 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ global $RBAC; -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access){ - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} -G::LoadClass('processMap'); +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} +G::LoadClass( 'processMap' ); $oProcessMap = new ProcessMap(); -$UIDS = explode(',', $_POST['PRO_UIDS']); +$UIDS = explode( ',', $_POST['PRO_UIDS'] ); -try{ - - foreach($UIDS as $UID){ - $oProcessMap->deleteProcess($UID); - } - $resp->status = 0; - $resp->msg = 'All process was deleted successfully'; - echo G::json_encode($resp); -} catch(Exception $e){ - $resp->status = 1; - $resp->msg = $e->getMessage(); - echo G::json_encode($resp); -} +try { - - \ No newline at end of file + foreach ($UIDS as $UID) { + $oProcessMap->deleteProcess( $UID ); + } + $resp->status = 0; + $resp->msg = 'All process was deleted successfully'; + echo G::json_encode( $resp ); +} catch (Exception $e) { + $resp->status = 1; + $resp->msg = $e->getMessage(); + echo G::json_encode( $resp ); +} + + diff --git a/workflow/engine/methods/processes/processes_DeleteObjectPermission.php b/workflow/engine/methods/processes/processes_DeleteObjectPermission.php index e1bae6119..fd9f97a8e 100755 --- a/workflow/engine/methods/processes/processes_DeleteObjectPermission.php +++ b/workflow/engine/methods/processes/processes_DeleteObjectPermission.php @@ -1,63 +1,60 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} -try{ -require_once 'classes/model/ObjectPermission.php'; -$oOP = new ObjectPermission(); -$oOP = ObjectPermissionPeer::retrieveByPK($_GET['OP_UID']); -$sProcessUID = $oOP->getProUid(); -$oOP->delete(); -$result->success = true; -$result->msg = G::LoadTranslation('ID_REPORTTABLE_REMOVED'); -G::LoadClass('processMap'); -$oProcessMap = new ProcessMap(); -$oProcessMap->getObjectsPermissionsCriteria($sProcessUID); -} -catch (Exception $e) { - $result->success = false; - $result->msg = $e->getMessage(); - } -print G::json_encode($result); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} +try { + require_once 'classes/model/ObjectPermission.php'; + $oOP = new ObjectPermission(); + $oOP = ObjectPermissionPeer::retrieveByPK( $_GET['OP_UID'] ); + $sProcessUID = $oOP->getProUid(); + $oOP->delete(); + $result->success = true; + $result->msg = G::LoadTranslation( 'ID_REPORTTABLE_REMOVED' ); + G::LoadClass( 'processMap' ); + $oProcessMap = new ProcessMap(); + $oProcessMap->getObjectsPermissionsCriteria( $sProcessUID ); +} catch (Exception $e) { + $result->success = false; + $result->msg = $e->getMessage(); +} +print G::json_encode( $result ); diff --git a/workflow/engine/methods/processes/processes_DownloadFile.php b/workflow/engine/methods/processes/processes_DownloadFile.php index 3520a1e26..c1847e52a 100755 --- a/workflow/engine/methods/processes/processes_DownloadFile.php +++ b/workflow/engine/methods/processes/processes_DownloadFile.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - //add more security, and catch any error or exception - - $sFileName = $_GET['p'] . '.pm'; - $file=PATH_DOCUMENT . 'output'. PATH_SEP. $sFileName.'tpm'; - $filex=PATH_DOCUMENT . 'output'. PATH_SEP. $sFileName; - - if(file_exists($file)) - { - rename($file, $filex); - } - - $realPath = PATH_DOCUMENT . 'output'. PATH_SEP. $sFileName; - G::streamFile ( $realPath, true ); +//add more security, and catch any error or exception + + +$sFileName = $_GET['p'] . '.pm'; +$file = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName . 'tpm'; +$filex = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName; + +if (file_exists( $file )) { + rename( $file, $filex ); +} + +$realPath = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName; +G::streamFile( $realPath, true ); diff --git a/workflow/engine/methods/processes/processes_DownloadFileXpdl.php b/workflow/engine/methods/processes/processes_DownloadFileXpdl.php index 1432dc8be..8c0fbfaf3 100755 --- a/workflow/engine/methods/processes/processes_DownloadFileXpdl.php +++ b/workflow/engine/methods/processes/processes_DownloadFileXpdl.php @@ -1,37 +1,36 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - //add more security, and catch any error or exception - - $sFileName = $_GET['p'] . '.xpdl'; - $file=PATH_DOCUMENT . 'output'. PATH_SEP. $sFileName.'tpm'; - $filex=PATH_DOCUMENT . 'output'. PATH_SEP. $sFileName; - - if(file_exists($file)) - { - rename($file, $filex); - } - - $realPath = PATH_DOCUMENT . 'output'. PATH_SEP. $sFileName; - G::streamFile ( $realPath, true ); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +//add more security, and catch any error or exception + + +$sFileName = $_GET['p'] . '.xpdl'; +$file = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName . 'tpm'; +$filex = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName; + +if (file_exists( $file )) { + rename( $file, $filex ); +} + +$realPath = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName; +G::streamFile( $realPath, true ); diff --git a/workflow/engine/methods/processes/processes_Export.php b/workflow/engine/methods/processes/processes_Export.php index 3a13f2b0d..7014dcfd9 100755 --- a/workflow/engine/methods/processes/processes_Export.php +++ b/workflow/engine/methods/processes/processes_Export.php @@ -12,100 +12,94 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - -G::LoadThirdParty('pear/json','class.json'); +G::LoadThirdParty( 'pear/json', 'class.json' ); try { - function myTruncate($chain, $limit, $break='.', $pad='...') { - if (strlen($chain) <= $limit) { - return $chain; - } - $breakpoint = strpos($chain, $break, $limit); - if (false !== $breakpoint) { - $len =strlen($chain) - 1; - if ($breakpoint < $len) { - $chain = substr($chain, 0, $breakpoint) . $pad; - } - } - return $chain; - } - function addTitlle($Category, $Id, $Lang) { - require_once 'classes/model/Content.php'; - $content = new Content(); - $value = $content->load($Category,'', $Id, $Lang); - return $value; - } - - $oJSON = new Services_JSON(); - $stdObj = $oJSON->decode( $_POST['data'] ); - if ( isset ($stdObj->pro_uid ) ) - $sProUid = $stdObj->pro_uid; - else - throw ( new Exception ( 'the process uid is not defined!.' ) ); - - /* Includes */ - G::LoadClass('processes'); - $oProcess = new Processes(); - $proFields = $oProcess->serializeProcess( $sProUid ); - $Fields = $oProcess->saveSerializedProcess ( $proFields ); - $pathLength = strlen(PATH_DATA ."sites".PATH_SEP.SYS_SYS.PATH_SEP."files".PATH_SEP."output".PATH_SEP); - $length = strlen($Fields['PRO_TITLE']) + $pathLength; - foreach($Fields as $key => $value) - { - if ($key == 'PRO_TITLE') { - $Fields[$key] = myTruncate($value, 65, ' ', '...'); + function myTruncate ($chain, $limit, $break = '.', $pad = '...') + { + if (strlen( $chain ) <= $limit) { + return $chain; + } + $breakpoint = strpos( $chain, $break, $limit ); + if (false !== $breakpoint) { + $len = strlen( $chain ) - 1; + if ($breakpoint < $len) { + $chain = substr( $chain, 0, $breakpoint ) . $pad; + } + } + return $chain; } - if ($key == 'FILENAME') { - $Fields[$key] = myTruncate($value, 60, '_', '...pm'); - } - if (($length) >= 250) { - if ($key == 'FILENAME_LINK') { - list($file,$rest) = explode ('p=',$value); - list($filenameLink,$rest) = explode ('&',$rest); - $Fields[$key] = myTruncate($filenameLink, 250 - $pathLength, '_', ''); - $Fields[$key] = $file."p=".$Fields[$key].'&'.$rest; - } - } - } - /* Render page */ - if (isset($_REQUEST["processMap"]) && $_REQUEST["processMap"] == 1) { + function addTitlle ($Category, $Id, $Lang) + { + require_once 'classes/model/Content.php'; + $content = new Content(); + $value = $content->load( $Category, '', $Id, $Lang ); + return $value; + } + + $oJSON = new Services_JSON(); + $stdObj = $oJSON->decode( $_POST['data'] ); + if (isset( $stdObj->pro_uid )) + $sProUid = $stdObj->pro_uid; + else + throw (new Exception( 'the process uid is not defined!.' )); + + /* Includes */ + G::LoadClass( 'processes' ); + $oProcess = new Processes(); + $proFields = $oProcess->serializeProcess( $sProUid ); + $Fields = $oProcess->saveSerializedProcess( $proFields ); + $pathLength = strlen( PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP ); + $length = strlen( $Fields['PRO_TITLE'] ) + $pathLength; + + foreach ($Fields as $key => $value) { + if ($key == 'PRO_TITLE') { + $Fields[$key] = myTruncate( $value, 65, ' ', '...' ); + } + if ($key == 'FILENAME') { + $Fields[$key] = myTruncate( $value, 60, '_', '...pm' ); + } + if (($length) >= 250) { + if ($key == 'FILENAME_LINK') { + list ($file, $rest) = explode( 'p=', $value ); + list ($filenameLink, $rest) = explode( '&', $rest ); + $Fields[$key] = myTruncate( $filenameLink, 250 - $pathLength, '_', '' ); + $Fields[$key] = $file . "p=" . $Fields[$key] . '&' . $rest; + } + } + } + + /* Render page */ + if (isset( $_REQUEST["processMap"] ) && $_REQUEST["processMap"] == 1) { + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( "xmlform", "xmlform", "processes/processes_Export", "", $Fields ); + + G::RenderPage( "publish", "raw" ); + } else { + $xmlFrm = new XmlForm(); + $xmlFrm->home = PATH_XMLFORM . "processes" . PATH_SEP; + $xmlFrm->parseFile( "processes_Export.xml", SYS_LANG, true ); + + $Fields["xmlFrmFieldLabel"] = array ("title" => $xmlFrm->fields["TITLE"]->label,"proTitle" => $xmlFrm->fields["PRO_TITLE"]->label,"proDescription" => $xmlFrm->fields["PRO_DESCRIPTION"]->label,"size" => $xmlFrm->fields["SIZE"]->label,"fileName" => $xmlFrm->fields["FILENAME_LABEL"]->label + ); + + echo G::json_encode( $Fields ); + } +} catch (Exception $e) { $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent("xmlform", "xmlform", "processes/processes_Export", "", $Fields); - - G::RenderPage("publish", "raw"); - } - else { - $xmlFrm = new XmlForm(); - $xmlFrm->home = PATH_XMLFORM . "processes" . PATH_SEP; - $xmlFrm->parseFile("processes_Export.xml" , SYS_LANG, true); - - $Fields["xmlFrmFieldLabel"] = array( - "title" => $xmlFrm->fields["TITLE"]->label, - "proTitle" => $xmlFrm->fields["PRO_TITLE"]->label, - "proDescription" => $xmlFrm->fields["PRO_DESCRIPTION"]->label, - "size" => $xmlFrm->fields["SIZE"]->label, - "fileName" => $xmlFrm->fields["FILENAME_LABEL"]->label - ); - - echo G::json_encode($Fields); - } -} -catch ( Exception $e ){ - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage('publish', 'raw' ); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', 'raw' ); } diff --git a/workflow/engine/methods/processes/processes_GetFile.php b/workflow/engine/methods/processes/processes_GetFile.php index 5d686f79f..477f2d6d9 100755 --- a/workflow/engine/methods/processes/processes_GetFile.php +++ b/workflow/engine/methods/processes/processes_GetFile.php @@ -1,18 +1,18 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} try { - -/* Includes */ -G::LoadClass('processes'); - /* Render page */ - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_Import', '', NULL, 'processes_ImportFile' ); - G::RenderPage( "publish", "blank"); + /* Includes */ + G::LoadClass( 'processes' ); -} -catch ( Exception $e ){ - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage('publish', "blank"); -} + /* Render page */ + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'PROCESSES'; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_Import', '', NULL, 'processes_ImportFile' ); + G::RenderPage( "publish", "blank" ); + +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', "blank" ); +} diff --git a/workflow/engine/methods/processes/processes_Import_Ajax.php b/workflow/engine/methods/processes/processes_Import_Ajax.php index a0679c371..3e3fc4892 100644 --- a/workflow/engine/methods/processes/processes_Import_Ajax.php +++ b/workflow/engine/methods/processes/processes_Import_Ajax.php @@ -12,327 +12,311 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - ini_set('max_execution_time', '0'); +ini_set( 'max_execution_time', '0' ); - - - - -function reservedWordsSqlValidate($data) +function reservedWordsSqlValidate ($data) { - $arrayAux = array(); + $arrayAux = array (); $reservedWordsSql = G::reservedWordsSql(); foreach ($data->reportTables as $rptIndex => $rptValue) { - if (in_array(strtoupper($rptValue["REP_TAB_NAME"]), $reservedWordsSql)) { + if (in_array( strtoupper( $rptValue["REP_TAB_NAME"] ), $reservedWordsSql )) { $arrayAux[] = $rptValue["REP_TAB_NAME"]; } } - if (count($arrayAux) > 0) { - throw (new Exception(G::LoadTranslation("ID_PMTABLE_INVALID_NAME", array(implode(", ", $arrayAux))))); + if (count( $arrayAux ) > 0) { + throw (new Exception( G::LoadTranslation( "ID_PMTABLE_INVALID_NAME", array (implode( ", ", $arrayAux ) + ) ) )); } - $arrayAux = array(); + $arrayAux = array (); foreach ($data->reportTablesVars as $rptIndex => $rptValue) { - if (in_array(strtoupper($rptValue["REP_VAR_NAME"]), $reservedWordsSql)) { + if (in_array( strtoupper( $rptValue["REP_VAR_NAME"] ), $reservedWordsSql )) { $arrayAux[] = $rptValue["REP_VAR_NAME"]; } } - if (count($arrayAux) > 0) { - throw (new Exception(G::LoadTranslation("ID_PMTABLE_INVALID_FIELD_NAME", array(implode(", ", $arrayAux))))); + if (count( $arrayAux ) > 0) { + throw (new Exception( G::LoadTranslation( "ID_PMTABLE_INVALID_FIELD_NAME", array (implode( ", ", $arrayAux ) + ) ) )); } } +$action = isset( $_REQUEST['ajaxAction'] ) ? $_REQUEST['ajaxAction'] : null; +$result = new stdClass(); +$result->success = true; +$result->catchMessage = ""; - - - $action = isset($_REQUEST['ajaxAction']) ? $_REQUEST['ajaxAction'] : null; - - $result = new stdClass(); - $result->success = true; - $result->catchMessage = ""; - - if ( $action == "uploadFileNewProcess") { +if ($action == "uploadFileNewProcess") { try { - //type of file, bpmn, xpdl, or pm - $processFileType = $_REQUEST["processFileType"]; - $oProcess = new stdClass(); - $oData = new stdClass(); + //type of file, bpmn, xpdl, or pm + $processFileType = $_REQUEST["processFileType"]; + $oProcess = new stdClass(); + $oData = new stdClass(); - $isCorrectTypeFile = 1; + $isCorrectTypeFile = 1; - if ( isset($_FILES['form']['type']['PROCESS_FILENAME']) ) { - $allowedExtensions = array($processFileType); - $allowedExtensions = array( 'xpdl', 'bpmn', 'pm'); - if (!in_array(end(explode(".", $_FILES['form']['name']['PROCESS_FILENAME'])), $allowedExtensions)) { - throw new Exception(G::LoadTranslation("ID_FILE_UPLOAD_INCORRECT_EXTENSION")); + if (isset( $_FILES['form']['type']['PROCESS_FILENAME'] )) { + $allowedExtensions = array ($processFileType + ); + $allowedExtensions = array ('xpdl','bpmn','pm' + ); + if (! in_array( end( explode( ".", $_FILES['form']['name']['PROCESS_FILENAME'] ) ), $allowedExtensions )) { + throw new Exception( G::LoadTranslation( "ID_FILE_UPLOAD_INCORRECT_EXTENSION" ) ); + } } - } - if ($processFileType != "pm" && $processFileType != "xpdl" && $processFileType != "bpmn" ) { - throw new Exception(G::LoadTranslation("ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR")); - } - - if ($processFileType == "pm") { - G::LoadClass('processes'); - $oProcess = new Processes(); - } - - if ($processFileType == "xpdl") { - G::LoadClass('xpdl'); - $oProcess = new Xpdl(); - } - - $result->success = true; - $result->ExistProcessInDatabase = ""; //"" -Default - //0 -Dont exist process - //1 -exist process - $result->ExistGroupsInDatabase = ""; //"" -Default - //0 -Dont exist process - //1 -exist process - $optionGroupExistInDatabase = isset($_REQUEST["optionGroupExistInDatabase"]) ? $_REQUEST["optionGroupExistInDatabase"] : null; - - //!Upload file - if ( ! is_null($optionGroupExistInDatabase)) { - $filename = $_REQUEST["PRO_FILENAME"]; - $path = PATH_DOCUMENT . 'input' . PATH_SEP ; - } - else { - if ($_FILES['form']['error']['PROCESS_FILENAME'] == 0){ - $filename = $_FILES['form']['name']['PROCESS_FILENAME']; - $path = PATH_DOCUMENT . 'input' . PATH_SEP ; - $tempName = $_FILES['form']['tmp_name']['PROCESS_FILENAME']; - //$action = "none"; - G::uploadFile($tempName, $path, $filename ); + if ($processFileType != "pm" && $processFileType != "xpdl" && $processFileType != "bpmn") { + throw new Exception( G::LoadTranslation( "ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR" ) ); } - } - //importing a bpmn diagram, using external class to do it. - if ($processFileType == "bpmn") { - G::LoadClass('bpmnExport'); - $bpmn = new bpmnExport(); - $bpmn->importBpmn( $path . $filename); - die; - } - - //if file is a .pm or .xpdl file continues normally the importing - if ($processFileType == "pm") { - $oData = $oProcess->getProcessData ( $path . $filename ); - } - else { - $oData = $oProcess->getProcessDataXpdl ( $path . $filename ); - } - - reservedWordsSqlValidate($oData); - - //!Upload file - $Fields['PRO_FILENAME'] = $filename; - $Fields['IMPORT_OPTION'] = 2; - - $sProUid = $oData->process['PRO_UID']; - - $oData->process['PRO_UID_OLD'] = $sProUid; - - if ( $oProcess->processExists ( $sProUid ) ) { - $result->ExistProcessInDatabase = 1; - } - else { - $result->ExistProcessInDatabase = 0; - } - - //!respect of the groups - $result->ExistGroupsInDatabase = 1; - $result->groupBeforeAccion = $action; - if (!is_null($optionGroupExistInDatabase)) { - if ($optionGroupExistInDatabase == 1) { - $oData->groupwfs = $oProcess->renameExistingGroups($oData->groupwfs); - } - else if ($optionGroupExistInDatabase == 2) { - $oBaseGroup = $oData->groupwfs; - $oNewGroup = $oProcess->mergeExistingGroups($oData->groupwfs); - $oData->groupwfs = $oNewGroup; - $oData->taskusers = $oProcess->mergeExistingUsers($oBaseGroup, $oNewGroup, $oData->taskusers); - } - $result->ExistGroupsInDatabase = 0; - } - else { - if ( !($oProcess->checkExistingGroups($oData->groupwfs) > 0) ) { - $result->ExistGroupsInDatabase = 0; - } - } - //!respect of the groups - - if ($result->ExistProcessInDatabase == 0 && $result->ExistGroupsInDatabase == 0){ if ($processFileType == "pm") { - $oProcess->createProcessFromData ($oData, $path . $filename ); + G::LoadClass( 'processes' ); + $oProcess = new Processes(); } - else { - if ( !isset( $oData->tasks) ) $oData->tasks = array(); - $tasks = $oData->tasks; - $oProcess->createProcessFromDataXpdl ($oData,$tasks); + + if ($processFileType == "xpdl") { + G::LoadClass( 'xpdl' ); + $oProcess = new Xpdl(); } - } - //!data ouput - $result->sNewProUid = $sProUid; - $result->proFileName = $Fields['PRO_FILENAME']; - } - catch (Exception $e ) { - $result->response = $e->getMessage(); - $result->catchMessage = $e->getMessage(); - $result->success = true; - } - } + $result->success = true; + $result->ExistProcessInDatabase = ""; //"" -Default + //0 -Dont exist process + //1 -exist process + $result->ExistGroupsInDatabase = ""; //"" -Default + //0 -Dont exist process + //1 -exist process + $optionGroupExistInDatabase = isset( $_REQUEST["optionGroupExistInDatabase"] ) ? $_REQUEST["optionGroupExistInDatabase"] : null; - if ($action == "uploadFileNewProcessExist") { + //!Upload file + if (! is_null( $optionGroupExistInDatabase )) { + $filename = $_REQUEST["PRO_FILENAME"]; + $path = PATH_DOCUMENT . 'input' . PATH_SEP; + } else { + if ($_FILES['form']['error']['PROCESS_FILENAME'] == 0) { + $filename = $_FILES['form']['name']['PROCESS_FILENAME']; + $path = PATH_DOCUMENT . 'input' . PATH_SEP; + $tempName = $_FILES['form']['tmp_name']['PROCESS_FILENAME']; + //$action = "none"; + G::uploadFile( $tempName, $path, $filename ); + } + } + + //importing a bpmn diagram, using external class to do it. + if ($processFileType == "bpmn") { + G::LoadClass( 'bpmnExport' ); + $bpmn = new bpmnExport(); + $bpmn->importBpmn( $path . $filename ); + die(); + } + + //if file is a .pm or .xpdl file continues normally the importing + if ($processFileType == "pm") { + $oData = $oProcess->getProcessData( $path . $filename ); + } else { + $oData = $oProcess->getProcessDataXpdl( $path . $filename ); + } + + reservedWordsSqlValidate( $oData ); + + //!Upload file + $Fields['PRO_FILENAME'] = $filename; + $Fields['IMPORT_OPTION'] = 2; + + $sProUid = $oData->process['PRO_UID']; + + $oData->process['PRO_UID_OLD'] = $sProUid; + + if ($oProcess->processExists( $sProUid )) { + $result->ExistProcessInDatabase = 1; + } else { + $result->ExistProcessInDatabase = 0; + } + + //!respect of the groups + $result->ExistGroupsInDatabase = 1; + $result->groupBeforeAccion = $action; + if (! is_null( $optionGroupExistInDatabase )) { + if ($optionGroupExistInDatabase == 1) { + $oData->groupwfs = $oProcess->renameExistingGroups( $oData->groupwfs ); + } else if ($optionGroupExistInDatabase == 2) { + $oBaseGroup = $oData->groupwfs; + $oNewGroup = $oProcess->mergeExistingGroups( $oData->groupwfs ); + $oData->groupwfs = $oNewGroup; + $oData->taskusers = $oProcess->mergeExistingUsers( $oBaseGroup, $oNewGroup, $oData->taskusers ); + } + $result->ExistGroupsInDatabase = 0; + } else { + if (! ($oProcess->checkExistingGroups( $oData->groupwfs ) > 0)) { + $result->ExistGroupsInDatabase = 0; + } + } + //!respect of the groups + + + if ($result->ExistProcessInDatabase == 0 && $result->ExistGroupsInDatabase == 0) { + if ($processFileType == "pm") { + $oProcess->createProcessFromData( $oData, $path . $filename ); + } else { + if (! isset( $oData->tasks )) + $oData->tasks = array (); + $tasks = $oData->tasks; + $oProcess->createProcessFromDataXpdl( $oData, $tasks ); + } + } + + //!data ouput + $result->sNewProUid = $sProUid; + $result->proFileName = $Fields['PRO_FILENAME']; + } catch (Exception $e) { + $result->response = $e->getMessage(); + $result->catchMessage = $e->getMessage(); + $result->success = true; + } +} + +if ($action == "uploadFileNewProcessExist") { try { - $option = $_REQUEST["IMPORT_OPTION"]; - $filename = $_REQUEST["PRO_FILENAME"]; - $processFileType = $_REQUEST["processFileType"]; + $option = $_REQUEST["IMPORT_OPTION"]; + $filename = $_REQUEST["PRO_FILENAME"]; + $processFileType = $_REQUEST["processFileType"]; - $result->ExistGroupsInDatabase = ""; //"" -Default - //0 -Dont exist process - //1 -exist process + $result->ExistGroupsInDatabase = ""; //"" -Default + //0 -Dont exist process + //1 -exist process - $optionGroupExistInDatabase = isset($_REQUEST["optionGroupExistInDatabase"]) ? $_REQUEST["optionGroupExistInDatabase"] : null; - $sNewProUid = ""; - $oProcess = new stdClass(); - if ($processFileType != "pm" && $processFileType != "xpdl") { - throw new Exception(G::LoadTranslation("ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR")); - } + $optionGroupExistInDatabase = isset( $_REQUEST["optionGroupExistInDatabase"] ) ? $_REQUEST["optionGroupExistInDatabase"] : null; + $sNewProUid = ""; - //load the variables - if ($processFileType == "pm") { - G::LoadClass('processes'); - $oProcess = new Processes(); - } - else { - G::LoadClass('xpdl'); - $oProcess = new Xpdl(); - } - - $path = PATH_DOCUMENT . 'input' . PATH_SEP ; - - if ($processFileType == "pm"){ - $oData = $oProcess->getProcessData ( $path . $filename ); - } - else { - $oData = $oProcess->getProcessDataXpdl ( $path . $filename ); - } - - reservedWordsSqlValidate($oData); - - $Fields['PRO_FILENAME'] = $filename; - $sProUid = $oData->process['PRO_UID']; - - $oData->process['PRO_UID_OLD'] = $sProUid; - - $result->ExistGroupsInDatabase = 1; - if ( !is_null($optionGroupExistInDatabase)) { - if ($optionGroupExistInDatabase == 1){ - $oData->groupwfs = $oProcess->renameExistingGroups($oData->groupwfs); + $oProcess = new stdClass(); + if ($processFileType != "pm" && $processFileType != "xpdl") { + throw new Exception( G::LoadTranslation( "ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR" ) ); } - else if ($optionGroupExistInDatabase == 2) { - $oBaseGroup = $oData->groupwfs; - $oNewGroup = $oProcess->mergeExistingGroups($oData->groupwfs); - $oData->groupwfs = $oNewGroup; - $oData->taskusers = $oProcess->mergeExistingUsers($oBaseGroup, $oNewGroup, $oData->taskusers); - } - $result->ExistGroupsInDatabase = 0; - } - else { - if ( !($oProcess->checkExistingGroups($oData->groupwfs) > 0) ) { - $result->ExistGroupsInDatabase = 0; - } - } - if ($result->ExistGroupsInDatabase == 0) { - //Update the current Process, overwriting all tasks and steps - if ( $option == 1 ) { - $oProcess->updateProcessFromData ($oData, $path . $filename ); - if (file_exists(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid)) { - $oDirectory = dir(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid); - while ($sObjectName = $oDirectory->read()) { - if (($sObjectName != '.') && ($sObjectName != '..')) { - unlink(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid . PATH_SEP . $sObjectName); - } + //load the variables + if ($processFileType == "pm") { + G::LoadClass( 'processes' ); + $oProcess = new Processes(); + } else { + G::LoadClass( 'xpdl' ); + $oProcess = new Xpdl(); + } + + $path = PATH_DOCUMENT . 'input' . PATH_SEP; + + if ($processFileType == "pm") { + $oData = $oProcess->getProcessData( $path . $filename ); + } else { + $oData = $oProcess->getProcessDataXpdl( $path . $filename ); + } + + reservedWordsSqlValidate( $oData ); + + $Fields['PRO_FILENAME'] = $filename; + $sProUid = $oData->process['PRO_UID']; + + $oData->process['PRO_UID_OLD'] = $sProUid; + + $result->ExistGroupsInDatabase = 1; + if (! is_null( $optionGroupExistInDatabase )) { + if ($optionGroupExistInDatabase == 1) { + $oData->groupwfs = $oProcess->renameExistingGroups( $oData->groupwfs ); + } else if ($optionGroupExistInDatabase == 2) { + $oBaseGroup = $oData->groupwfs; + $oNewGroup = $oProcess->mergeExistingGroups( $oData->groupwfs ); + $oData->groupwfs = $oNewGroup; + $oData->taskusers = $oProcess->mergeExistingUsers( $oBaseGroup, $oNewGroup, $oData->taskusers ); } - $oDirectory->close(); - } - $sNewProUid = $sProUid; - } - - //Disable current Process and create a new version of the Process - if ( $option == 2 ) { - $oProcess->disablePreviousProcesses( $sProUid ); - $sNewProUid = $oProcess->getUnusedProcessGUID() ; - $oProcess->setProcessGuid ( $oData, $sNewProUid ); - $oProcess->setProcessParent( $oData, $sProUid ); - $oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date ( 'M d, H:i' ); - $oProcess->renewAll ( $oData ); - - if ($processFileType == "pm") { - $oProcess->createProcessFromData ($oData, $path . $filename ); - } - else { - if ( !isset( $oData->tasks) ) { - $oData->tasks = array(); + $result->ExistGroupsInDatabase = 0; + } else { + if (! ($oProcess->checkExistingGroups( $oData->groupwfs ) > 0)) { + $result->ExistGroupsInDatabase = 0; } - $tasks = $oData->tasks; - $oProcess->createProcessFromDataXpdl ($oData,$tasks); - } } - //Create a completely new Process without change the current Process - if ( $option == 3 ) { - //krumo ($oData); die; - $sNewProUid = $oProcess->getUnusedProcessGUID() ; - $oProcess->setProcessGuid ( $oData, $sNewProUid ); - $oData->process['PRO_TITLE'] = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date ( 'M d, H:i' ); - $oProcess->renewAll ( $oData ); - - if ($processFileType == "pm"){ - $oProcess->createProcessFromData ($oData, $path . $filename ); - } - else { - if ( !isset( $oData->tasks) ) { - $oData->tasks = array(); + if ($result->ExistGroupsInDatabase == 0) { + //Update the current Process, overwriting all tasks and steps + if ($option == 1) { + $oProcess->updateProcessFromData( $oData, $path . $filename ); + if (file_exists( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid )) { + $oDirectory = dir( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid ); + while ($sObjectName = $oDirectory->read()) { + if (($sObjectName != '.') && ($sObjectName != '..')) { + unlink( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid . PATH_SEP . $sObjectName ); + } + } + $oDirectory->close(); + } + $sNewProUid = $sProUid; } - $tasks = $oData->tasks; - $oProcess->createProcessFromDataXpdl ($oData,$tasks); - } - } - } - //!data ouput - $result->fileName = $filename; - $result->importOption = $option; - $result->sNewProUid = $sNewProUid; - $result->success = true; - $result->ExistGroupsInDatabase = $result->ExistGroupsInDatabase; - $result->groupBeforeAccion = $action; - //!data ouput + //Disable current Process and create a new version of the Process + if ($option == 2) { + $oProcess->disablePreviousProcesses( $sProUid ); + $sNewProUid = $oProcess->getUnusedProcessGUID(); + $oProcess->setProcessGuid( $oData, $sNewProUid ); + $oProcess->setProcessParent( $oData, $sProUid ); + $oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' ); + $oProcess->renewAll( $oData ); + + if ($processFileType == "pm") { + $oProcess->createProcessFromData( $oData, $path . $filename ); + } else { + if (! isset( $oData->tasks )) { + $oData->tasks = array (); + } + $tasks = $oData->tasks; + $oProcess->createProcessFromDataXpdl( $oData, $tasks ); + } + } + + //Create a completely new Process without change the current Process + if ($option == 3) { + //krumo ($oData); die; + $sNewProUid = $oProcess->getUnusedProcessGUID(); + $oProcess->setProcessGuid( $oData, $sNewProUid ); + $oData->process['PRO_TITLE'] = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' ); + $oProcess->renewAll( $oData ); + + if ($processFileType == "pm") { + $oProcess->createProcessFromData( $oData, $path . $filename ); + } else { + if (! isset( $oData->tasks )) { + $oData->tasks = array (); + } + $tasks = $oData->tasks; + $oProcess->createProcessFromDataXpdl( $oData, $tasks ); + } + } + } + + //!data ouput + $result->fileName = $filename; + $result->importOption = $option; + $result->sNewProUid = $sNewProUid; + $result->success = true; + $result->ExistGroupsInDatabase = $result->ExistGroupsInDatabase; + $result->groupBeforeAccion = $action; + //!data ouput + } catch (Exception $e) { + $result->response = $e->getMessage(); + $result->success = true; } - catch (Exception $e ) { - $result->response = $e->getMessage(); - $result->success = true; - } - } - - echo G::json_encode($result); - exit(); +} +echo G::json_encode( $result ); +exit(); + diff --git a/workflow/engine/methods/processes/processes_checkProperties.php b/workflow/engine/methods/processes/processes_checkProperties.php index 233e20214..d00bcf538 100755 --- a/workflow/engine/methods/processes/processes_checkProperties.php +++ b/workflow/engine/methods/processes/processes_checkProperties.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - + global $RBAC; -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} -$form = $_POST ['form']; +$form = $_POST['form']; -//$tasUid = $form['TASKS']; +//$tasUid = $form['TASKS']; $tasUid = $form['TAS_PARENT']; $spSynchronous = $form['SP_SYNCHRONOUS']; require_once 'classes/model/Route.php'; require_once 'classes/model/Task.php'; -$oRoute= new Route(); -$oCriteria = new Criteria('workflow'); -$oCriteria->addSelectColumn(RoutePeer::ROU_NEXT_TASK); -$oCriteria->add(RoutePeer::TAS_UID, $tasUid); -$oDataset = RoutePeer::doSelectRS($oCriteria); -$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); +$oRoute = new Route(); +$oCriteria = new Criteria( 'workflow' ); +$oCriteria->addSelectColumn( RoutePeer::ROU_NEXT_TASK ); +$oCriteria->add( RoutePeer::TAS_UID, $tasUid ); +$oDataset = RoutePeer::doSelectRS( $oCriteria ); +$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); -$sw=1; -// if there are more step we're looking them and we're checking TAS_ASSIGN_TYPE field -while ($oDataset->next() && $sw){ - $aRow = $oDataset->getRow(); - - $oCriteria1 = new Criteria('workflow'); - $oCriteria1->addSelectColumn(TaskPeer::TAS_ASSIGN_TYPE); - $oCriteria1->add(TaskPeer::PRO_UID, $form['PRO_PARENT']); - $oCriteria1->add(TaskPeer::TAS_UID, $aRow['ROU_NEXT_TASK']); - $oDataset1 = TaskPeer::doSelectRS($oCriteria1); - $oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset1->next(); - $aRow1 = $oDataset1->getRow(); - - if($spSynchronous && $aRow1['TAS_ASSIGN_TYPE']=='MANUAL') - $sw=0; +$sw = 1; +// if there are more step we're looking them and we're checking TAS_ASSIGN_TYPE field +while ($oDataset->next() && $sw) { + $aRow = $oDataset->getRow(); + + $oCriteria1 = new Criteria( 'workflow' ); + $oCriteria1->addSelectColumn( TaskPeer::TAS_ASSIGN_TYPE ); + $oCriteria1->add( TaskPeer::PRO_UID, $form['PRO_PARENT'] ); + $oCriteria1->add( TaskPeer::TAS_UID, $aRow['ROU_NEXT_TASK'] ); + $oDataset1 = TaskPeer::doSelectRS( $oCriteria1 ); + $oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset1->next(); + $aRow1 = $oDataset1->getRow(); + + if ($spSynchronous && $aRow1['TAS_ASSIGN_TYPE'] == 'MANUAL') + $sw = 0; } -///If there are at least one TAS_ASSIGN_TYPE field with MANUAL it returns 1 -if(!$sw) - return print $spSynchronous; -else - return print '0'; - - +///If there are at least one TAS_ASSIGN_TYPE field with MANUAL it returns 1 +if (! $sw) + return print $spSynchronous; +else + return print '0'; + + diff --git a/workflow/engine/methods/processes/processes_doUpload.php b/workflow/engine/methods/processes/processes_doUpload.php index 079579517..152832ad9 100755 --- a/workflow/engine/methods/processes/processes_doUpload.php +++ b/workflow/engine/methods/processes/processes_doUpload.php @@ -1,29 +1,29 @@ - Date: Wed, 17 Oct 2012 12:12:52 -0400 Subject: [PATCH 2/3] CODE STYLE FILES: workflow/engine/methods/processes/processes_ImportExisting.php workflow/engine/methods/processes/processes_ImportExistingXpdl.php workflow/engine/methods/processes/processes_ImportFile.php workflow/engine/methods/processes/processes_ImportFileXpdl.php workflow/engine/methods/processes/processes_ImportXpdl.php workflow/engine/methods/processes/processes_Library.php workflow/engine/methods/processes/processes_List.php workflow/engine/methods/processes/processes_Map.php workflow/engine/methods/processes/processes_New.php workflow/engine/methods/processes/processes_Save.php --- .../processes/processes_ImportExisting.php | 209 +++++++------ .../processes_ImportExistingXpdl.php | 264 ++++++++--------- .../processes/processes_ImportFile.php | 165 ++++++----- .../processes/processes_ImportFileXpdl.php | 211 +++++++------- .../processes/processes_ImportXpdl.php | 127 ++++---- .../methods/processes/processes_Library.php | 274 +++++++++--------- .../methods/processes/processes_List.php | 142 +++++---- .../methods/processes/processes_Map.php | 190 ++++++------ .../methods/processes/processes_New.php | 122 ++++---- .../methods/processes/processes_Save.php | 188 ++++++------ 10 files changed, 936 insertions(+), 956 deletions(-) diff --git a/workflow/engine/methods/processes/processes_ImportExisting.php b/workflow/engine/methods/processes/processes_ImportExisting.php index 3c069cd80..6671ac550 100755 --- a/workflow/engine/methods/processes/processes_ImportExisting.php +++ b/workflow/engine/methods/processes/processes_ImportExisting.php @@ -12,121 +12,120 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - try { - //load the variables - G::LoadClass('processes'); - $oProcess = new Processes(); +try { + //load the variables + G::LoadClass( 'processes' ); + $oProcess = new Processes(); - if ( !isset ($_POST['form']['IMPORT_OPTION'] ) ) { - throw ( new Exception ('Please select an option before to continue')) ; - } - - if ( !isset ($_POST['form']['GROUP_IMPORT_OPTION']) ) { - $action = "none" ; - } else { - $action = $_POST['form']['GROUP_IMPORT_OPTION']; - } - - $option = $_POST['form']['IMPORT_OPTION']; - $filename = $_POST['form']['PRO_FILENAME']; - $ObjUid = $_POST['form']['OBJ_UID']; - - $path = PATH_DOCUMENT . 'input' . PATH_SEP ; - $oData = $oProcess->getProcessData ( $path . $filename ); - - $Fields['PRO_FILENAME'] = $filename; - $sProUid = $oData->process['PRO_UID']; - - $oData->process['PRO_UID_OLD']=$sProUid; - - // code added by gustavo cruz gustavo-at-colosa-dot-com - // evaluate actions or import options - switch($action){ - case "none": - $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); - break; - case "rename": - $oData->groupwfs = $oProcess->renameExistingGroups($oData->groupwfs); - $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); - break; - case "merge": - $oBaseGroup = $oData->groupwfs; - $oNewGroup = $oProcess->mergeExistingGroups($oData->groupwfs); - $oData->groupwfs = $oNewGroup; - $oData->taskusers = $oProcess->mergeExistingUsers($oBaseGroup, $oNewGroup, $oData->taskusers); - - break; - default: - $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); - break; - } - - // if there are duplicated groups render the group importing options - if((isset($groupsDuplicated))&&($groupsDuplicated>0)){ - $Fields['PRO_FILENAME'] = $filename; - $Fields['PRO_PATH'] = $path; - $Fields['IMPORT_OPTION'] = $option; - $Fields['OBJ_UID'] = $ObjUid; - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ValidatingGroups', '', $Fields, 'processes_ImportExisting' ); - G::RenderPage('publish', 'blank'); - die; - } - //end added code - - //Update the current Process, overwriting all tasks and steps - if ( $option == 1 ) { - $oProcess->updateProcessFromData ($oData, $path . $filename ); - if (file_exists(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid)) { - $oDirectory = dir(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid); - while($sObjectName = $oDirectory->read()) { - if (($sObjectName != '.') && ($sObjectName != '..')) { - unlink(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid . PATH_SEP . $sObjectName); - } - } - $oDirectory->close(); + if (! isset( $_POST['form']['IMPORT_OPTION'] )) { + throw (new Exception( 'Please select an option before to continue' )); } - $sNewProUid = $sProUid; - } - //Disable current Process and create a new version of the Process - if ( $option == 2 ) { - $oProcess->disablePreviousProcesses( $sProUid ); - $sNewProUid = $oProcess->getUnusedProcessGUID() ; - $oProcess->setProcessGuid ( $oData, $sNewProUid ); - $oProcess->setProcessParent( $oData, $sProUid ); - $oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date ( 'M d, H:i' ); - $oProcess->renewAll ( $oData ); - $oProcess->createProcessFromData ($oData, $path . $filename ); - } + if (! isset( $_POST['form']['GROUP_IMPORT_OPTION'] )) { + $action = "none"; + } else { + $action = $_POST['form']['GROUP_IMPORT_OPTION']; + } - //Create a completely new Process without change the current Process - if ( $option == 3 ) { - //krumo ($oData); die; - $sNewProUid = $oProcess->getUnusedProcessGUID() ; - $oProcess->setProcessGuid ( $oData, $sNewProUid ); - $oData->process['PRO_TITLE'] = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date ( 'M d, H:i' ); - $oProcess->renewAll ( $oData ); - $oProcess->createProcessFromData ($oData, $path . $filename ); - } - G::header('Location: processes_Map?PRO_UID=' . $sNewProUid); -} -catch ( Exception $e ){ - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage('publish', 'blank'); + $option = $_POST['form']['IMPORT_OPTION']; + $filename = $_POST['form']['PRO_FILENAME']; + $ObjUid = $_POST['form']['OBJ_UID']; + + $path = PATH_DOCUMENT . 'input' . PATH_SEP; + $oData = $oProcess->getProcessData( $path . $filename ); + + $Fields['PRO_FILENAME'] = $filename; + $sProUid = $oData->process['PRO_UID']; + + $oData->process['PRO_UID_OLD'] = $sProUid; + + // code added by gustavo cruz gustavo-at-colosa-dot-com + // evaluate actions or import options + switch ($action) { + case "none": + $groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs ); + break; + case "rename": + $oData->groupwfs = $oProcess->renameExistingGroups( $oData->groupwfs ); + $groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs ); + break; + case "merge": + $oBaseGroup = $oData->groupwfs; + $oNewGroup = $oProcess->mergeExistingGroups( $oData->groupwfs ); + $oData->groupwfs = $oNewGroup; + $oData->taskusers = $oProcess->mergeExistingUsers( $oBaseGroup, $oNewGroup, $oData->taskusers ); + + break; + default: + $groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs ); + break; + } + + // if there are duplicated groups render the group importing options + if ((isset( $groupsDuplicated )) && ($groupsDuplicated > 0)) { + $Fields['PRO_FILENAME'] = $filename; + $Fields['PRO_PATH'] = $path; + $Fields['IMPORT_OPTION'] = $option; + $Fields['OBJ_UID'] = $ObjUid; + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'PROCESSES'; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ValidatingGroups', '', $Fields, 'processes_ImportExisting' ); + G::RenderPage( 'publish', 'blank' ); + die(); + } + //end added code + + + //Update the current Process, overwriting all tasks and steps + if ($option == 1) { + $oProcess->updateProcessFromData( $oData, $path . $filename ); + if (file_exists( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid )) { + $oDirectory = dir( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid ); + while ($sObjectName = $oDirectory->read()) { + if (($sObjectName != '.') && ($sObjectName != '..')) { + unlink( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid . PATH_SEP . $sObjectName ); + } + } + $oDirectory->close(); + } + $sNewProUid = $sProUid; + } + + //Disable current Process and create a new version of the Process + if ($option == 2) { + $oProcess->disablePreviousProcesses( $sProUid ); + $sNewProUid = $oProcess->getUnusedProcessGUID(); + $oProcess->setProcessGuid( $oData, $sNewProUid ); + $oProcess->setProcessParent( $oData, $sProUid ); + $oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' ); + $oProcess->renewAll( $oData ); + $oProcess->createProcessFromData( $oData, $path . $filename ); + } + + //Create a completely new Process without change the current Process + if ($option == 3) { + //krumo ($oData); die; + $sNewProUid = $oProcess->getUnusedProcessGUID(); + $oProcess->setProcessGuid( $oData, $sNewProUid ); + $oData->process['PRO_TITLE'] = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' ); + $oProcess->renewAll( $oData ); + $oProcess->createProcessFromData( $oData, $path . $filename ); + } + G::header( 'Location: processes_Map?PRO_UID=' . $sNewProUid ); +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', 'blank' ); } diff --git a/workflow/engine/methods/processes/processes_ImportExistingXpdl.php b/workflow/engine/methods/processes/processes_ImportExistingXpdl.php index 8c74bd521..3ea21ee39 100755 --- a/workflow/engine/methods/processes/processes_ImportExistingXpdl.php +++ b/workflow/engine/methods/processes/processes_ImportExistingXpdl.php @@ -1,132 +1,132 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - - try { - //load the variables - G::LoadClass('xpdl'); - $oProcess = new Xpdl(); - - if ( !isset ($_POST['form']['IMPORT_OPTION'] ) ) { - throw ( new Exception ('Please select an option before to continue')) ; - } - - if ( !isset ($_POST['form']['GROUP_IMPORT_OPTION']) ) { - $action = "none" ; - } else { - $action = $_POST['form']['GROUP_IMPORT_OPTION']; - } - - $option = $_POST['form']['IMPORT_OPTION']; - $filename = $_POST['form']['PRO_FILENAME']; - $ObjUid = $_POST['form']['OBJ_UID']; - - $path = PATH_DOCUMENT . 'input' . PATH_SEP ; - $oData = $oProcess->getProcessDataXpdl ( $path . $filename ); - $Fields['PRO_FILENAME'] = $filename; - $sProUid = $oData->process['PRO_UID']; - - $oData->process['PRO_UID_OLD']=$sProUid; - if ( !isset( $oData->tasks) ) $oData->tasks = array(); - $tasks = $oData->tasks; - // code added by gustavo cruz gustavo-at-colosa-dot-com - // evaluate actions or import options - switch($action){ - case "none": - $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); - break; - case "rename": - $oData->groupwfs = $oProcess->renameExistingGroups($oData->groupwfs); - $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); - break; - case "merge": - $oBaseGroup = $oData->groupwfs; - $oNewGroup = $oProcess->mergeExistingGroups($oData->groupwfs); - $oData->groupwfs = $oNewGroup; - $oData->taskusers = $oProcess->mergeExistingUsers($oBaseGroup, $oNewGroup, $oData->taskusers); - - break; - default: - $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); - break; - } - - // if there are duplicated groups render the group importing options - if($groupsDuplicated>0){ - $Fields['PRO_FILENAME'] = $filename; - $Fields['PRO_PATH'] = $path; - $Fields['IMPORT_OPTION'] = $option; - $Fields['OBJ_UID'] = $ObjUid; - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ValidatingGroups', '', $Fields, 'processes_ImportExisting' ); - G::RenderPage('publish', "blank"); - die; - } - //end added code - - //Update the current Process, overwriting all tasks and steps - if ( $option == 1 ) { - $oProcess->updateProcessFromData ($oData, $path . $filename ); - if (file_exists(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid)) { - $oDirectory = dir(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid); - while($sObjectName = $oDirectory->read()) { - if (($sObjectName != '.') && ($sObjectName != '..')) { - unlink(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid . PATH_SEP . $sObjectName); - } - } - $oDirectory->close(); - } - $sNewProUid = $sProUid; - } - - //Disable current Process and create a new version of the Process - if ( $option == 2 ) { - $oProcess->disablePreviousProcesses( $sProUid ); - $sNewProUid = $oProcess->getUnusedProcessGUID() ; - $oProcess->setProcessGuid ( $oData, $sNewProUid ); - $oProcess->setProcessParent( $oData, $sProUid ); - $oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date ( 'M d, H:i' ); - $oProcess->renewAll ( $oData ); - $oProcess->createProcessFromDataXpdl ($oData,$tasks); - } - - //Create a completely new Process without change the current Process - if ( $option == 3 ) { - //krumo ($oData); die; - $sNewProUid = $oProcess->getUnusedProcessGUID() ; - $oProcess->setProcessGuid ( $oData, $sNewProUid ); - $oData->process['PRO_TITLE'] = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date ( 'M d, H:i' ); - $oProcess->renewAll ( $oData ); - $oProcess->createProcessFromDataXpdl ($oData,$tasks); - } - G::header('Location: processes_Map?PRO_UID=' . $sNewProUid); -} -catch ( Exception $e ){ - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage('publish', "blank"); -} +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +try { + //load the variables + G::LoadClass( 'xpdl' ); + $oProcess = new Xpdl(); + + if (! isset( $_POST['form']['IMPORT_OPTION'] )) { + throw (new Exception( 'Please select an option before to continue' )); + } + + if (! isset( $_POST['form']['GROUP_IMPORT_OPTION'] )) { + $action = "none"; + } else { + $action = $_POST['form']['GROUP_IMPORT_OPTION']; + } + + $option = $_POST['form']['IMPORT_OPTION']; + $filename = $_POST['form']['PRO_FILENAME']; + $ObjUid = $_POST['form']['OBJ_UID']; + + $path = PATH_DOCUMENT . 'input' . PATH_SEP; + $oData = $oProcess->getProcessDataXpdl( $path . $filename ); + $Fields['PRO_FILENAME'] = $filename; + $sProUid = $oData->process['PRO_UID']; + + $oData->process['PRO_UID_OLD'] = $sProUid; + if (! isset( $oData->tasks )) + $oData->tasks = array (); + $tasks = $oData->tasks; + // code added by gustavo cruz gustavo-at-colosa-dot-com + // evaluate actions or import options + switch ($action) { + case "none": + $groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs ); + break; + case "rename": + $oData->groupwfs = $oProcess->renameExistingGroups( $oData->groupwfs ); + $groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs ); + break; + case "merge": + $oBaseGroup = $oData->groupwfs; + $oNewGroup = $oProcess->mergeExistingGroups( $oData->groupwfs ); + $oData->groupwfs = $oNewGroup; + $oData->taskusers = $oProcess->mergeExistingUsers( $oBaseGroup, $oNewGroup, $oData->taskusers ); + + break; + default: + $groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs ); + break; + } + + // if there are duplicated groups render the group importing options + if ($groupsDuplicated > 0) { + $Fields['PRO_FILENAME'] = $filename; + $Fields['PRO_PATH'] = $path; + $Fields['IMPORT_OPTION'] = $option; + $Fields['OBJ_UID'] = $ObjUid; + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'PROCESSES'; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ValidatingGroups', '', $Fields, 'processes_ImportExisting' ); + G::RenderPage( 'publish', "blank" ); + die(); + } + //end added code + + + //Update the current Process, overwriting all tasks and steps + if ($option == 1) { + $oProcess->updateProcessFromData( $oData, $path . $filename ); + if (file_exists( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid )) { + $oDirectory = dir( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid ); + while ($sObjectName = $oDirectory->read()) { + if (($sObjectName != '.') && ($sObjectName != '..')) { + unlink( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid . PATH_SEP . $sObjectName ); + } + } + $oDirectory->close(); + } + $sNewProUid = $sProUid; + } + + //Disable current Process and create a new version of the Process + if ($option == 2) { + $oProcess->disablePreviousProcesses( $sProUid ); + $sNewProUid = $oProcess->getUnusedProcessGUID(); + $oProcess->setProcessGuid( $oData, $sNewProUid ); + $oProcess->setProcessParent( $oData, $sProUid ); + $oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' ); + $oProcess->renewAll( $oData ); + $oProcess->createProcessFromDataXpdl( $oData, $tasks ); + } + + //Create a completely new Process without change the current Process + if ($option == 3) { + //krumo ($oData); die; + $sNewProUid = $oProcess->getUnusedProcessGUID(); + $oProcess->setProcessGuid( $oData, $sNewProUid ); + $oData->process['PRO_TITLE'] = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' ); + $oProcess->renewAll( $oData ); + $oProcess->createProcessFromDataXpdl( $oData, $tasks ); + } + G::header( 'Location: processes_Map?PRO_UID=' . $sNewProUid ); +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', "blank" ); +} diff --git a/workflow/engine/methods/processes/processes_ImportFile.php b/workflow/engine/methods/processes/processes_ImportFile.php index d6c1aeaac..061187ca7 100755 --- a/workflow/engine/methods/processes/processes_ImportFile.php +++ b/workflow/engine/methods/processes/processes_ImportFile.php @@ -12,106 +12,105 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - try { - //load the variables - G::LoadClass('processes'); - $oProcess = new Processes(); +try { + //load the variables + G::LoadClass( 'processes' ); + $oProcess = new Processes(); -// if ( isset ($_POST) ) { -// krumo ( $_POST ); -// } + // if ( isset ($_POST) ) { + // krumo ( $_POST ); + // } - if (isset($_POST['form']['PRO_FILENAME'])){ - $path = $_POST['form']['PRO_PATH']; - $filename = $_POST['form']['PRO_FILENAME']; - $action = $_POST['form']['GROUP_IMPORT_OPTION']; - } else { - //save the file, if it's not saved + + if (isset( $_POST['form']['PRO_FILENAME'] )) { + $path = $_POST['form']['PRO_PATH']; + $filename = $_POST['form']['PRO_FILENAME']; + $action = $_POST['form']['GROUP_IMPORT_OPTION']; + } else { + //save the file, if it's not saved if ($_FILES['form']['error']['PROCESS_FILENAME'] == 0) { $filename = $_FILES['form']['name']['PROCESS_FILENAME']; - $path = PATH_DOCUMENT . 'input' . PATH_SEP ; + $path = PATH_DOCUMENT . 'input' . PATH_SEP; $tempName = $_FILES['form']['tmp_name']['PROCESS_FILENAME']; $action = "none"; - G::uploadFile($tempName, $path, $filename ); + G::uploadFile( $tempName, $path, $filename ); } - } - //we check if the file is a pm file - $aExtPmfile= explode('.', $filename); - if($aExtPmfile[sizeof($aExtPmfile)-1]!='pm') { - throw ( new Exception ( G::LoadTranslation( 'ID_NOT_PM_FILE' )) ); - } - - $oData = $oProcess->getProcessData ( $path . $filename ); + } + //we check if the file is a pm file + $aExtPmfile = explode( '.', $filename ); + if ($aExtPmfile[sizeof( $aExtPmfile ) - 1] != 'pm') { + throw (new Exception( G::LoadTranslation( 'ID_NOT_PM_FILE' ) )); + } - $Fields['PRO_FILENAME'] = $filename; - $Fields['IMPORT_OPTION'] = 2; + $oData = $oProcess->getProcessData( $path . $filename ); - $sProUid = $oData->process['PRO_UID']; - - $oData->process['PRO_UID_OLD']=$sProUid; - - if ( $oProcess->processExists ( $sProUid ) ) { - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ImportExisting', '', $Fields, 'processes_ImportExisting' ); - G::RenderPage('publish', 'blank'); - die; - } - // code added by gustavo cruz gustavo-at-colosa-dot-com - // evaluate actions or import options - switch($action){ - case "none": - $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); - break; - case "rename": - $oData->groupwfs = $oProcess->renameExistingGroups($oData->groupwfs); - $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); - break; - case "merge": - - $oBaseGroup = $oData->groupwfs; - $oNewGroup = $oProcess->mergeExistingGroups($oData->groupwfs); - $oData->groupwfs = $oNewGroup; - $oData->taskusers = $oProcess->mergeExistingUsers($oBaseGroup, $oNewGroup, $oData->taskusers); - - break; - default: - $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); - break; - } - - // if there are duplicated groups render the group importing options - if($groupsDuplicated>0){ - $Fields['PRO_FILENAME'] = $filename; - $Fields['PRO_PATH'] = $path; + $Fields['PRO_FILENAME'] = $filename; $Fields['IMPORT_OPTION'] = 2; - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ValidatingGroups', '', $Fields, 'processes_ImportFile' ); - G::RenderPage('publish', 'blank'); - die; - } - // end added code - $oProcess->createProcessFromData ($oData, $path . $filename ); - G::header('Location: processes_Map?PRO_UID=' . $sProUid); -} -catch ( Exception $e ){ - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage('publish', 'blank'); + $sProUid = $oData->process['PRO_UID']; + + $oData->process['PRO_UID_OLD'] = $sProUid; + + if ($oProcess->processExists( $sProUid )) { + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'PROCESSES'; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ImportExisting', '', $Fields, 'processes_ImportExisting' ); + G::RenderPage( 'publish', 'blank' ); + die(); + } + // code added by gustavo cruz gustavo-at-colosa-dot-com + // evaluate actions or import options + switch ($action) { + case "none": + $groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs ); + break; + case "rename": + $oData->groupwfs = $oProcess->renameExistingGroups( $oData->groupwfs ); + $groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs ); + break; + case "merge": + + $oBaseGroup = $oData->groupwfs; + $oNewGroup = $oProcess->mergeExistingGroups( $oData->groupwfs ); + $oData->groupwfs = $oNewGroup; + $oData->taskusers = $oProcess->mergeExistingUsers( $oBaseGroup, $oNewGroup, $oData->taskusers ); + + break; + default: + $groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs ); + break; + } + + // if there are duplicated groups render the group importing options + if ($groupsDuplicated > 0) { + $Fields['PRO_FILENAME'] = $filename; + $Fields['PRO_PATH'] = $path; + $Fields['IMPORT_OPTION'] = 2; + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'PROCESSES'; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ValidatingGroups', '', $Fields, 'processes_ImportFile' ); + G::RenderPage( 'publish', 'blank' ); + die(); + } + // end added code + $oProcess->createProcessFromData( $oData, $path . $filename ); + G::header( 'Location: processes_Map?PRO_UID=' . $sProUid ); + +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', 'blank' ); } diff --git a/workflow/engine/methods/processes/processes_ImportFileXpdl.php b/workflow/engine/methods/processes/processes_ImportFileXpdl.php index d03099ce5..5e9fa8049 100755 --- a/workflow/engine/methods/processes/processes_ImportFileXpdl.php +++ b/workflow/engine/methods/processes/processes_ImportFileXpdl.php @@ -1,106 +1,105 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - - try { - //load the variables - G::LoadClass('xpdl'); - $oProcess = new Xpdl(); - if (isset($_POST['form']['PRO_FILENAME'])){ - $path = $_POST['form']['PRO_PATH']; - $filename = $_POST['form']['PRO_FILENAME']; - $action = $_POST['form']['GROUP_IMPORT_OPTION']; - } else { - //save the file, if it's not saved - if ($_FILES['form']['error']['PROCESS_FILENAME'] == 0) { - $filename = $_FILES['form']['name']['PROCESS_FILENAME']; - $path = PATH_DOCUMENT . 'input' . PATH_SEP ; - $tempName = $_FILES['form']['tmp_name']['PROCESS_FILENAME']; - $action = "none"; - G::uploadFile($tempName, $path, $filename ); - } - } - $oData = $oProcess->getProcessDataXpdl ( $path . $filename ); - $Fields['PRO_FILENAME'] = $filename; - $Fields['IMPORT_OPTION'] = 2; - $sProUid = $oData->process['PRO_UID']; - - $oData->process['PRO_UID_OLD']=$sProUid; - - if ( $oProcess->processExists ( $sProUid ) ) { - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ImportExistingXpdl', '', $Fields, 'processes_ImportExistingXpdl' ); - G::RenderPage('publish', "blank"); - die; - } - // code added by gustavo cruz gustavo-at-colosa-dot-com - // evaluate actions or import options - switch($action){ - case "none": - $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); - break; - case "rename": - $oData->groupwfs = $oProcess->renameExistingGroups($oData->groupwfs); - $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); - break; - case "merge": - - $oBaseGroup = $oData->groupwfs; - $oNewGroup = $oProcess->mergeExistingGroups($oData->groupwfs); - $oData->groupwfs = $oNewGroup; - $oData->taskusers = $oProcess->mergeExistingUsers($oBaseGroup, $oNewGroup, $oData->taskusers); - - break; - default: - $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); - break; - } - - // if there are duplicated groups render the group importing options - if($groupsDuplicated>0){ - $Fields['PRO_FILENAME'] = $filename; - $Fields['PRO_PATH'] = $path; - $Fields['IMPORT_OPTION'] = 2; - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ValidatingGroups', '', $Fields, 'processes_ImportFile' ); - G::RenderPage('publish', "blank"); - die; - } - // end added code - if ( !isset( $oData->tasks) ) $oData->tasks = array(); - $tasks = $oData->tasks; - $oProcess->createProcessFromDataXpdl ($oData,$tasks); - G::header('Location: processes_Map?PRO_UID=' . $sProUid); - -} -catch ( Exception $e ){ - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage('publish', "blank"); -} +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +try { + //load the variables + G::LoadClass( 'xpdl' ); + $oProcess = new Xpdl(); + if (isset( $_POST['form']['PRO_FILENAME'] )) { + $path = $_POST['form']['PRO_PATH']; + $filename = $_POST['form']['PRO_FILENAME']; + $action = $_POST['form']['GROUP_IMPORT_OPTION']; + } else { + //save the file, if it's not saved + if ($_FILES['form']['error']['PROCESS_FILENAME'] == 0) { + $filename = $_FILES['form']['name']['PROCESS_FILENAME']; + $path = PATH_DOCUMENT . 'input' . PATH_SEP; + $tempName = $_FILES['form']['tmp_name']['PROCESS_FILENAME']; + $action = "none"; + G::uploadFile( $tempName, $path, $filename ); + } + } + $oData = $oProcess->getProcessDataXpdl( $path . $filename ); + $Fields['PRO_FILENAME'] = $filename; + $Fields['IMPORT_OPTION'] = 2; + $sProUid = $oData->process['PRO_UID']; + + $oData->process['PRO_UID_OLD'] = $sProUid; + + if ($oProcess->processExists( $sProUid )) { + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'PROCESSES'; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ImportExistingXpdl', '', $Fields, 'processes_ImportExistingXpdl' ); + G::RenderPage( 'publish', "blank" ); + die(); + } + // code added by gustavo cruz gustavo-at-colosa-dot-com + // evaluate actions or import options + switch ($action) { + case "none": + $groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs ); + break; + case "rename": + $oData->groupwfs = $oProcess->renameExistingGroups( $oData->groupwfs ); + $groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs ); + break; + case "merge": + + $oBaseGroup = $oData->groupwfs; + $oNewGroup = $oProcess->mergeExistingGroups( $oData->groupwfs ); + $oData->groupwfs = $oNewGroup; + $oData->taskusers = $oProcess->mergeExistingUsers( $oBaseGroup, $oNewGroup, $oData->taskusers ); + + break; + default: + $groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs ); + break; + } + + // if there are duplicated groups render the group importing options + if ($groupsDuplicated > 0) { + $Fields['PRO_FILENAME'] = $filename; + $Fields['PRO_PATH'] = $path; + $Fields['IMPORT_OPTION'] = 2; + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'PROCESSES'; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ValidatingGroups', '', $Fields, 'processes_ImportFile' ); + G::RenderPage( 'publish', "blank" ); + die(); + } + // end added code + if (! isset( $oData->tasks )) + $oData->tasks = array (); + $tasks = $oData->tasks; + $oProcess->createProcessFromDataXpdl( $oData, $tasks ); + G::header( 'Location: processes_Map?PRO_UID=' . $sProUid ); + +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', "blank" ); +} diff --git a/workflow/engine/methods/processes/processes_ImportXpdl.php b/workflow/engine/methods/processes/processes_ImportXpdl.php index a0eb2b9d4..7b18fb3d5 100755 --- a/workflow/engine/methods/processes/processes_ImportXpdl.php +++ b/workflow/engine/methods/processes/processes_ImportXpdl.php @@ -1,65 +1,62 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} - -try { - -/* Includes */ -G::LoadClass('processes'); - - /* Render page */ - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ImportXpdl', '', NULL, 'processes_ImportFileXpdl' ); - G::RenderPage('publish', "blank"); - -} -catch ( Exception $e ){ - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage('publish', "blank"); -} +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} + +try { + + /* Includes */ + G::LoadClass( 'processes' ); + + /* Render page */ + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'PROCESSES'; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ImportXpdl', '', NULL, 'processes_ImportFileXpdl' ); + G::RenderPage( 'publish', "blank" ); + +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', "blank" ); +} diff --git a/workflow/engine/methods/processes/processes_Library.php b/workflow/engine/methods/processes/processes_Library.php index 1b1592939..6e7acf1d4 100755 --- a/workflow/engine/methods/processes/processes_Library.php +++ b/workflow/engine/methods/processes/processes_Library.php @@ -1,138 +1,136 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} - -/**************************/ - - function parseItemArray( $array ) { - if (!isset ($array->item) && !is_array($array) ) { - return null; - } - - $result = array(); - if ( isset ( $array->item ) ) { - foreach ($array->item as $key => $value) { - $result[$value->key] = $value->value; - } - } - else { - foreach ($array as $key => $value) { - $result[$value->key] = $value->value; - } - } - return $result; - } - - -try { - G::LoadClass('processes'); - $oProcess = new Processes(); - $oProcess->ws_open_public (); - - $result = $oProcess->ws_ProcessList ( ); - $processes[] = array ( 'uid' => 'char', 'name' => 'char', 'age' => 'integer', 'balance' => 'float' ); - - if ( $result->status_code == 0 && isset($result->processes) ) { - foreach ( $result->processes as $key => $val ) { - $process = parseItemArray($val); - $processes[] = $process; - } - } - $_DBArray['processes'] = $processes; - $_SESSION['_DBArray'] = $_DBArray; - - G::LoadClass( 'ArrayPeer'); - $c = new Criteria ('dbarray'); - $c->setDBArrayTable('processes'); - - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - - - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('propeltable', 'paged-table', 'processes/processes_ListPublic', $c); - $oHeadPublisher =& headPublisher::getSingleton(); - //$oHeadPublisher->addScriptCode('leimnud.Package.Load("newAccount",{Type:"file",Absolute:true,Path:"/jscore/newAccount.js"});'); - $oHeadPublisher->addScriptCode(" - var oPanel; - var oPanel2; - var showDetails = function(sUID) { - oPanel = new leimnud.module.panel(); - oPanel.options = { - size:{w:650,h:550}, - position:{x:0,y:0,center:true}, - title:'', - theme:'firefox', - statusBar:true, - control :{resize:false,roll:false,drag:true}, - fx :{modal:true,opacity:true,blinkToFront:false,fadeIn:false} - }; - oPanel.events = { - remove: function() { delete(oPanel); }.extend(this) - }; - oPanel.make(); - oPanel.loader.show(); - var oRPC = new leimnud.module.rpc.xmlhttp({ - url : 'processes_Ajax', - args: 'action=showDetailsPMDWL&data=' + {pro_uid:sUID}.toJSONString() - }); - oRPC.callback = function(rpc){ - oPanel.loader.hide(); - var scs = rpc.xmlhttp.responseText.extractScript(); - oPanel.addContent(rpc.xmlhttp.responseText); - scs.evalScript(); - }.extend(this); - oRPC.make(); - }; - "); - G::RenderPage('publish', 'blank'); - } - catch ( Exception $e ) { - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage( 'publish', 'blank' ); - } \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} + +/** + * *********************** + */ + +function parseItemArray ($array) +{ + if (! isset( $array->item ) && ! is_array( $array )) { + return null; + } + + $result = array (); + if (isset( $array->item )) { + foreach ($array->item as $key => $value) { + $result[$value->key] = $value->value; + } + } else { + foreach ($array as $key => $value) { + $result[$value->key] = $value->value; + } + } + return $result; +} + +try { + G::LoadClass( 'processes' ); + $oProcess = new Processes(); + $oProcess->ws_open_public(); + + $result = $oProcess->ws_ProcessList(); + $processes[] = array ('uid' => 'char','name' => 'char','age' => 'integer','balance' => 'float' + ); + + if ($result->status_code == 0 && isset( $result->processes )) { + foreach ($result->processes as $key => $val) { + $process = parseItemArray( $val ); + $processes[] = $process; + } + } + $_DBArray['processes'] = $processes; + $_SESSION['_DBArray'] = $_DBArray; + + G::LoadClass( 'ArrayPeer' ); + $c = new Criteria( 'dbarray' ); + $c->setDBArrayTable( 'processes' ); + + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'PROCESSES'; + + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'processes/processes_ListPublic', $c ); + $oHeadPublisher = & headPublisher::getSingleton(); + //$oHeadPublisher->addScriptCode('leimnud.Package.Load("newAccount",{Type:"file",Absolute:true,Path:"/jscore/newAccount.js"});'); + $oHeadPublisher->addScriptCode( " + var oPanel; + var oPanel2; + var showDetails = function(sUID) { + oPanel = new leimnud.module.panel(); + oPanel.options = { + size:{w:650,h:550}, + position:{x:0,y:0,center:true}, + title:'', + theme:'firefox', + statusBar:true, + control :{resize:false,roll:false,drag:true}, + fx :{modal:true,opacity:true,blinkToFront:false,fadeIn:false} + }; + oPanel.events = { + remove: function() { delete(oPanel); }.extend(this) + }; + oPanel.make(); + oPanel.loader.show(); + var oRPC = new leimnud.module.rpc.xmlhttp({ + url : 'processes_Ajax', + args: 'action=showDetailsPMDWL&data=' + {pro_uid:sUID}.toJSONString() + }); + oRPC.callback = function(rpc){ + oPanel.loader.hide(); + var scs = rpc.xmlhttp.responseText.extractScript(); + oPanel.addContent(rpc.xmlhttp.responseText); + scs.evalScript(); + }.extend(this); + oRPC.make(); + }; + " ); + G::RenderPage( 'publish', 'blank' ); +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', 'blank' ); +} \ No newline at end of file diff --git a/workflow/engine/methods/processes/processes_List.php b/workflow/engine/methods/processes/processes_List.php index d0862c37e..f90e7207f 100755 --- a/workflow/engine/methods/processes/processes_List.php +++ b/workflow/engine/methods/processes/processes_List.php @@ -1,73 +1,69 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} - - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'process'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_ID_SUB_MENU_SELECTED = '-'; - - - $aLabels['LANG'] = SYS_LANG; - $aLabels['PRO_EDIT'] = G::LoadTranslation('ID_EDIT'); - $aLabels['PRO_DELETE']= G::LoadTranslation('ID_DELETE'); - $aLabels['ACTIVE'] = G::LoadTranslation('ID_ACTIVE'); - $aLabels['INACTIVE'] = G::LoadTranslation('ID_INACTIVE'); - $aLabels['CONFIRM'] = G::LoadTranslation('ID_MSG_CONFIRM_DELETE_PROCESS'); - - - G::LoadClass ( 'processMap'); - $oProcess = new processMap(); - $c = $oProcess->getConditionProcessList(); - -function activeFalse($value) -{ - return $value=="ACTIVE"?"ID_ACTIVE":"ID_INACTIVE"; -} - -$G_PUBLISH = new Publisher; -$G_PUBLISH->AddContent('propeltable', 'paged-table', 'processes/processes_List', $c, $aLabels, '' ); -G::RenderPage('publish'); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} + +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'process'; +$G_ID_MENU_SELECTED = 'PROCESSES'; +$G_ID_SUB_MENU_SELECTED = '-'; + +$aLabels['LANG'] = SYS_LANG; +$aLabels['PRO_EDIT'] = G::LoadTranslation( 'ID_EDIT' ); +$aLabels['PRO_DELETE'] = G::LoadTranslation( 'ID_DELETE' ); +$aLabels['ACTIVE'] = G::LoadTranslation( 'ID_ACTIVE' ); +$aLabels['INACTIVE'] = G::LoadTranslation( 'ID_INACTIVE' ); +$aLabels['CONFIRM'] = G::LoadTranslation( 'ID_MSG_CONFIRM_DELETE_PROCESS' ); + +G::LoadClass( 'processMap' ); +$oProcess = new processMap(); +$c = $oProcess->getConditionProcessList(); + +function activeFalse ($value) +{ + return $value == "ACTIVE" ? "ID_ACTIVE" : "ID_INACTIVE"; +} + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'processes/processes_List', $c, $aLabels, '' ); +G::RenderPage( 'publish' ); diff --git a/workflow/engine/methods/processes/processes_Map.php b/workflow/engine/methods/processes/processes_Map.php index f4775603c..7c6312c24 100755 --- a/workflow/engine/methods/processes/processes_Map.php +++ b/workflow/engine/methods/processes/processes_Map.php @@ -1,96 +1,94 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} -$processUID = $_GET['PRO_UID']; - -$_SESSION['PROCESS'] = $processUID; -$_SESSION['PROCESSMAP'] = 'LEIMNUD'; - -G::LoadClass('processMap'); - -$oTemplatePower = new TemplatePower(PATH_TPL . 'processes/processes_Map.html'); -$oTemplatePower->prepare(); - -$G_MAIN_MENU = 'processmaker'; -$G_ID_MENU_SELECTED = 'PROCESSES'; -$G_SUB_MENU = 'processes'; -$G_ID_SUB_MENU_SELECTED = '_'; - -$G_PUBLISH = new Publisher; -$G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower); - -$oHeadPublisher =& headPublisher::getSingleton(); -$oHeadPublisher->addScriptFile('/jscore/dbConnections/main.js'); -$oHeadPublisher->addScriptCode(' - var maximunX = ' . processMap::getMaximunTaskX($processUID) . '; - var leimnud = new maborak(); - leimnud.make(); - leimnud.Package.Load("rpc,drag,drop,panel,app,validator,fx,dom,abbr",{Instance:leimnud,Type:"module"}); - leimnud.Package.Load("json",{Type:"file"}); - leimnud.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"}); - leimnud.Package.Load("processes_Map",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processes_Map.js"}); - leimnud.Package.Load("stagesmap",{Type:"file",Absolute:true,Path:"/jscore/stagesmap/core/stagesmap.js"}); - leimnud.exec(leimnud.fix.memoryLeak); - leimnud.event.add(window,"load",function(){ - var pb=leimnud.dom.capture("tag.body 0"); - Pm=new processmap(); - Pm.options={ - target :"pm_target", - dataServer :"processes_Ajax.php", - uid :"' . $processUID . '", - lang :"' . SYS_LANG . '", - theme :"processmaker", - size :{w:pb.offsetWidth-10,h:pb.offsetHeight}, - images_dir :"/jscore/processmap/core/images/" - } - Pm.make(); - }); - var changesSavedLabel = "' . addslashes(G::LoadTranslation('ID_SAVED_SUCCESSFULLY')) . '";'); - -if( ! isset($_GET['raw']) ) - G::RenderPage('publish', 'green-submenu'); -else - G::RenderPage('publish', 'raw'); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} +$processUID = $_GET['PRO_UID']; + +$_SESSION['PROCESS'] = $processUID; +$_SESSION['PROCESSMAP'] = 'LEIMNUD'; + +G::LoadClass( 'processMap' ); + +$oTemplatePower = new TemplatePower( PATH_TPL . 'processes/processes_Map.html' ); +$oTemplatePower->prepare(); + +$G_MAIN_MENU = 'processmaker'; +$G_ID_MENU_SELECTED = 'PROCESSES'; +$G_SUB_MENU = 'processes'; +$G_ID_SUB_MENU_SELECTED = '_'; + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower ); + +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->addScriptFile( '/jscore/dbConnections/main.js' ); +$oHeadPublisher->addScriptCode( ' + var maximunX = ' . processMap::getMaximunTaskX( $processUID ) . '; + var leimnud = new maborak(); + leimnud.make(); + leimnud.Package.Load("rpc,drag,drop,panel,app,validator,fx,dom,abbr",{Instance:leimnud,Type:"module"}); + leimnud.Package.Load("json",{Type:"file"}); + leimnud.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"}); + leimnud.Package.Load("processes_Map",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processes_Map.js"}); + leimnud.Package.Load("stagesmap",{Type:"file",Absolute:true,Path:"/jscore/stagesmap/core/stagesmap.js"}); + leimnud.exec(leimnud.fix.memoryLeak); + leimnud.event.add(window,"load",function(){ + var pb=leimnud.dom.capture("tag.body 0"); + Pm=new processmap(); + Pm.options={ + target :"pm_target", + dataServer :"processes_Ajax.php", + uid :"' . $processUID . '", + lang :"' . SYS_LANG . '", + theme :"processmaker", + size :{w:pb.offsetWidth-10,h:pb.offsetHeight}, + images_dir :"/jscore/processmap/core/images/" + } + Pm.make(); + }); + var changesSavedLabel = "' . addslashes( G::LoadTranslation( 'ID_SAVED_SUCCESSFULLY' ) ) . '";' ); + +if (! isset( $_GET['raw'] )) + G::RenderPage( 'publish', 'green-submenu' ); +else + G::RenderPage( 'publish', 'raw' ); diff --git a/workflow/engine/methods/processes/processes_New.php b/workflow/engine/methods/processes/processes_New.php index 1e60686c1..ad37b27a9 100755 --- a/workflow/engine/methods/processes/processes_New.php +++ b/workflow/engine/methods/processes/processes_New.php @@ -1,63 +1,59 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} - - //call plugins - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - $oPluginRegistry->executeTriggers ( PM_NEW_PROCESS_LIST , NULL ); - - - $aFields['MESSAGE1'] = G::LoadTranslation('ID_MSG_ERROR_PRO_TITLE'); - - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_PUBLISH = new Publisher; - if ( isset ( $_DBArray['ProcessesNew']) ) { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_New', '', $aFields, 'processes_Save'); - } - else { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_NewSimple', '', $aFields, 'processes_Save'); - } - G::RenderPage( 'publish', 'blank'); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} + +//call plugins +$oPluginRegistry = & PMPluginRegistry::getSingleton(); +$oPluginRegistry->executeTriggers( PM_NEW_PROCESS_LIST, NULL ); + +$aFields['MESSAGE1'] = G::LoadTranslation( 'ID_MSG_ERROR_PRO_TITLE' ); + +$G_MAIN_MENU = 'processmaker'; +$G_ID_MENU_SELECTED = 'PROCESSES'; +$G_PUBLISH = new Publisher(); +if (isset( $_DBArray['ProcessesNew'] )) { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_New', '', $aFields, 'processes_Save' ); +} else { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_NewSimple', '', $aFields, 'processes_Save' ); +} +G::RenderPage( 'publish', 'blank' ); diff --git a/workflow/engine/methods/processes/processes_Save.php b/workflow/engine/methods/processes/processes_Save.php index 61b52eb62..8887e677c 100755 --- a/workflow/engine/methods/processes/processes_Save.php +++ b/workflow/engine/methods/processes/processes_Save.php @@ -1,96 +1,94 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -/* - * This is a ajax response file - * - */ - -G::LoadThirdParty('pear/json','class.json'); - -$function = isset($_POST['function']) ? $_POST['function']: ''; - -switch($function){ - case 'lookForNameProcess': - require_once 'classes/model/Content.php'; - $snameProcess=urldecode($_POST['NAMEPROCESS']); - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn('COUNT(*) AS PROCESS'); - $oCriteria->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE'); - $oCriteria->add(ContentPeer::CON_LANG, SYS_LANG); - $oCriteria->add(ContentPeer::CON_VALUE, $snameProcess); - $oDataset = ContentPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - $aRow = $oDataset->getRow(); - print($aRow['PROCESS'] ? true : false); - break; - - default: - if ( isset($_GET['PRO_UID'])) { - $_POST['form']['PRO_UID'] = $_GET['PRO_UID']; - } - - $_POST['form']['PRO_TITLE'] = trim($_POST['form']['PRO_TITLE']); - - G::LoadClass('processMap'); - $oProcessMap = new ProcessMap(); - if (!isset($_POST['form']['PRO_UID'])) { - $_POST['form']['USR_UID'] = $_SESSION['USER_LOGGED']; - $oJSON = new Services_JSON(); - require_once 'classes/model/Task.php'; - - $sProUid = $oProcessMap->createProcess($_POST['form']); - - //call plugins - $oData['PRO_UID'] = $sProUid; - $oData['PRO_TEMPLATE'] = (isset($_POST['form']['PRO_TEMPLATE']) && $_POST['form']['PRO_TEMPLATE'] != '') ? $_POST['form']['PRO_TEMPLATE'] : ''; - $oData['PROCESSMAP'] = $oProcessMap; - - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - $oPluginRegistry->executeTriggers(PM_NEW_PROCESS_SAVE, $oData); - - G::header('location: processes_Map?PRO_UID=' . $sProUid); - die; - } - else { - $_POST['form']['PRO_DYNAFORMS'] = array(); - $_POST['form']['PRO_DYNAFORMS']['PROCESS'] = isset($_POST['form']['PRO_SUMMARY_DYNAFORM']) ? $_POST['form']['PRO_SUMMARY_DYNAFORM'] : ''; - unset($_POST['form']['PRO_SUMMARY_DYNAFORM']); - $oProcessMap->updateProcess($_POST['form']); - $sProUid = $_POST['form']['PRO_UID']; - } - - //Save Calendar ID for this process - G::LoadClass("calendar"); - $calendarObj=new Calendar(); - $calendarObj->assignCalendarTo($sProUid, $_POST['form']['PRO_CALENDAR'], 'PROCESS'); - - if ($_POST['form']['THETYPE'] == '') { - G::header('location: main'); - } - break; - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/* + * This is a ajax response file + * + */ + +G::LoadThirdParty( 'pear/json', 'class.json' ); + +$function = isset( $_POST['function'] ) ? $_POST['function'] : ''; + +switch ($function) { + case 'lookForNameProcess': + require_once 'classes/model/Content.php'; + $snameProcess = urldecode( $_POST['NAMEPROCESS'] ); + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( 'COUNT(*) AS PROCESS' ); + $oCriteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $oCriteria->add( ContentPeer::CON_LANG, SYS_LANG ); + $oCriteria->add( ContentPeer::CON_VALUE, $snameProcess ); + $oDataset = ContentPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + $aRow = $oDataset->getRow(); + print ($aRow['PROCESS'] ? true : false) ; + break; + + default: + if (isset( $_GET['PRO_UID'] )) { + $_POST['form']['PRO_UID'] = $_GET['PRO_UID']; + } + + $_POST['form']['PRO_TITLE'] = trim( $_POST['form']['PRO_TITLE'] ); + + G::LoadClass( 'processMap' ); + $oProcessMap = new ProcessMap(); + if (! isset( $_POST['form']['PRO_UID'] )) { + $_POST['form']['USR_UID'] = $_SESSION['USER_LOGGED']; + $oJSON = new Services_JSON(); + require_once 'classes/model/Task.php'; + + $sProUid = $oProcessMap->createProcess( $_POST['form'] ); + + //call plugins + $oData['PRO_UID'] = $sProUid; + $oData['PRO_TEMPLATE'] = (isset( $_POST['form']['PRO_TEMPLATE'] ) && $_POST['form']['PRO_TEMPLATE'] != '') ? $_POST['form']['PRO_TEMPLATE'] : ''; + $oData['PROCESSMAP'] = $oProcessMap; + + $oPluginRegistry = & PMPluginRegistry::getSingleton(); + $oPluginRegistry->executeTriggers( PM_NEW_PROCESS_SAVE, $oData ); + + G::header( 'location: processes_Map?PRO_UID=' . $sProUid ); + die(); + } else { + $_POST['form']['PRO_DYNAFORMS'] = array (); + $_POST['form']['PRO_DYNAFORMS']['PROCESS'] = isset( $_POST['form']['PRO_SUMMARY_DYNAFORM'] ) ? $_POST['form']['PRO_SUMMARY_DYNAFORM'] : ''; + unset( $_POST['form']['PRO_SUMMARY_DYNAFORM'] ); + $oProcessMap->updateProcess( $_POST['form'] ); + $sProUid = $_POST['form']['PRO_UID']; + } + + //Save Calendar ID for this process + G::LoadClass( "calendar" ); + $calendarObj = new Calendar(); + $calendarObj->assignCalendarTo( $sProUid, $_POST['form']['PRO_CALENDAR'], 'PROCESS' ); + + if ($_POST['form']['THETYPE'] == '') { + G::header( 'location: main' ); + } + break; + } \ No newline at end of file From 57c78b834278f035403fdc73ed5ef889b0caecbf Mon Sep 17 00:00:00 2001 From: jennylee Date: Wed, 17 Oct 2012 12:20:58 -0400 Subject: [PATCH 3/3] CODE STYLE FILES: workflow/engine/methods/processes/processesList.php workflow/engine/methods/processes/processes_SaveEditObjectPermission.php workflow/engine/methods/processes/processes_SaveObjectPermission.php workflow/engine/methods/processes/processes_UploadFiles.php workflow/engine/methods/processes/processes_UploadFilesForm.php workflow/engine/methods/processes/processes_User.php workflow/engine/methods/processes/processes_subProcessSave.php workflow/engine/methods/processes/processes_webEntryGenerate.php workflow/engine/methods/processes/processes_webEntryValidate.php workflow/engine/methods/processes/webEntry_Val_Assig.php --- .../methods/processes/processesList.php | 138 ++++--- .../processes_SaveEditObjectPermission.php | 167 ++++----- .../processes_SaveObjectPermission.php | 166 ++++----- .../processes/processes_UploadFiles.php | 38 +- .../processes/processes_UploadFilesForm.php | 34 +- .../methods/processes/processes_User.php | 72 ++-- .../processes/processes_subProcessSave.php | 192 +++++----- .../processes/processes_webEntryGenerate.php | 341 +++++++++--------- .../processes/processes_webEntryValidate.php | 98 ++--- .../methods/processes/webEntry_Val_Assig.php | 64 ++-- 10 files changed, 636 insertions(+), 674 deletions(-) diff --git a/workflow/engine/methods/processes/processesList.php b/workflow/engine/methods/processes/processesList.php index 608f9e091..7ca688d77 100755 --- a/workflow/engine/methods/processes/processesList.php +++ b/workflow/engine/methods/processes/processesList.php @@ -1,74 +1,70 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -require_once 'classes/model/Process.php'; - -$start = isset($_POST['start'])? $_POST['start']: 0; -$limit = isset($_POST['limit'])? $_POST['limit']: ''; - -$oProcess = new Process(); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ - - $memcache = & PMmemcached::getSingleton(SYS_SYS); +require_once 'classes/model/Process.php'; - $memkey = 'no memcache'; - $memcacheUsed = 'not used'; - $totalCount = 0; - - if( isset($_POST['category']) && $_POST['category'] !== '' ) { - if( isset($_POST['processName']) ) - $proData = $oProcess->getAllProcesses($start, $limit, $_POST['category'], $_POST['processName']); - else - $proData = $oProcess->getAllProcesses($start, $limit, $_POST['category']); - } - else { - if( isset($_POST['processName']) ) { - $memkey = 'processList-' . $start . '-' . $limit . '-' . $_POST['processName']; - $memcacheUsed = 'yes'; - if ( ($proData = $memcache->get( $memkey )) === false ) { - $proData = $oProcess->getAllProcesses($start, $limit, null, $_POST['processName']); - $memcache->set( $memkey , $proData, PMmemcached::ONE_HOUR ); - $memcacheUsed = 'no'; - } - } - else { - $memkey = 'processList-allProcesses-' . $start . '-' . $limit; - $memkeyTotal = $memkey . '-total'; - $memcacheUsed = 'yes'; - if ( ($proData = $memcache->get( $memkey )) === false || ($totalCount=$memcache->get( $memkeyTotal)) === false ) { - $proData = $oProcess->getAllProcesses($start, $limit); - $totalCount = $oProcess->getAllProcessesCount(); - $memcache->set( $memkey , $proData, PMmemcached::ONE_HOUR ); - $memcache->set( $memkeyTotal , $totalCount, PMmemcached::ONE_HOUR ); - $memcacheUsed = 'no'; - } +$start = isset( $_POST['start'] ) ? $_POST['start'] : 0; +$limit = isset( $_POST['limit'] ) ? $_POST['limit'] : ''; + +$oProcess = new Process(); + +$memcache = & PMmemcached::getSingleton( SYS_SYS ); + +$memkey = 'no memcache'; +$memcacheUsed = 'not used'; +$totalCount = 0; + +if (isset( $_POST['category'] ) && $_POST['category'] !== '') { + if (isset( $_POST['processName'] )) + $proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'], $_POST['processName'] ); + else + $proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'] ); +} else { + if (isset( $_POST['processName'] )) { + $memkey = 'processList-' . $start . '-' . $limit . '-' . $_POST['processName']; + $memcacheUsed = 'yes'; + if (($proData = $memcache->get( $memkey )) === false) { + $proData = $oProcess->getAllProcesses( $start, $limit, null, $_POST['processName'] ); + $memcache->set( $memkey, $proData, PMmemcached::ONE_HOUR ); + $memcacheUsed = 'no'; + } + } else { + $memkey = 'processList-allProcesses-' . $start . '-' . $limit; + $memkeyTotal = $memkey . '-total'; + $memcacheUsed = 'yes'; + if (($proData = $memcache->get( $memkey )) === false || ($totalCount = $memcache->get( $memkeyTotal )) === false) { + $proData = $oProcess->getAllProcesses( $start, $limit ); + $totalCount = $oProcess->getAllProcessesCount(); + $memcache->set( $memkey, $proData, PMmemcached::ONE_HOUR ); + $memcache->set( $memkeyTotal, $totalCount, PMmemcached::ONE_HOUR ); + $memcacheUsed = 'no'; + } } - } - $r->memkey = $memkey; - $r->memcache = $memcacheUsed; - $r->data = $proData; - $r->totalCount = $totalCount; - - echo G::json_encode($r); +} +$r->memkey = $memkey; +$r->memcache = $memcacheUsed; +$r->data = $proData; +$r->totalCount = $totalCount; + +echo G::json_encode( $r ); diff --git a/workflow/engine/methods/processes/processes_SaveEditObjectPermission.php b/workflow/engine/methods/processes/processes_SaveEditObjectPermission.php index 44943ad26..21dbad53a 100755 --- a/workflow/engine/methods/processes/processes_SaveEditObjectPermission.php +++ b/workflow/engine/methods/processes/processes_SaveEditObjectPermission.php @@ -1,89 +1,78 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} - -if(isset($_POST['form'])) - $sValue = $_POST['form']; //For old processmap -else - $sValue = $_POST; //For new processmap EXtjs - -list($iRelation, $sUserGroup) = explode('|', $sValue['GROUP_USER']); -$sObjectUID = ''; -switch ($sValue['OP_OBJ_TYPE']) { - case 'ANY': - $sObjectUID = ''; - break; - case 'DYNAFORM': - $sObjectUID = $sValue['DYNAFORMS']; - break; - case 'INPUT': - $sObjectUID = $sValue['INPUTS']; - break; - case 'OUTPUT': - $sObjectUID = $sValue['OUTPUTS']; - break; -} -require_once 'classes/model/ObjectPermission.php'; -$oOP = new ObjectPermission(); -$aData = array('OP_UID' => $sValue['OP_UID'], - 'PRO_UID' => $sValue['PRO_UID'], - 'TAS_UID' => $sValue['TAS_UID']!='' ? $sValue['TAS_UID'] : '0' , - 'USR_UID' => (string)$sUserGroup, - 'OP_USER_RELATION' => $iRelation, - 'OP_TASK_SOURCE' => $sValue['OP_TASK_SOURCE']!='' ? $sValue['OP_TASK_SOURCE'] : '0', - 'OP_PARTICIPATE' => $sValue['OP_PARTICIPATE']!='' ? $sValue['OP_PARTICIPATE'] : 0, - 'OP_OBJ_TYPE' => $sValue['OP_OBJ_TYPE']!='' ? $sValue['OP_OBJ_TYPE'] : '0', - 'OP_OBJ_UID' => $sObjectUID!='' ? $sObjectUID : '0', - 'OP_ACTION' => $sValue['OP_ACTION']!='' ? $sValue['OP_ACTION'] : '0', - 'OP_CASE_STATUS' => $sValue['OP_CASE_STATUS']!='' ? $sValue['OP_CASE_STATUS'] : '0' - ); - -$oObj = new ObjectPermission(); -$oObj->update($aData); - -G::LoadClass('processMap'); -$oProcessMap = new ProcessMap(); -$oProcessMap->getObjectsPermissionsCriteria($sValue['PRO_UID']); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} + +if (isset( $_POST['form'] )) + $sValue = $_POST['form']; //For old processmap +else + $sValue = $_POST; //For new processmap EXtjs + + +list ($iRelation, $sUserGroup) = explode( '|', $sValue['GROUP_USER'] ); +$sObjectUID = ''; +switch ($sValue['OP_OBJ_TYPE']) { + case 'ANY': + $sObjectUID = ''; + break; + case 'DYNAFORM': + $sObjectUID = $sValue['DYNAFORMS']; + break; + case 'INPUT': + $sObjectUID = $sValue['INPUTS']; + break; + case 'OUTPUT': + $sObjectUID = $sValue['OUTPUTS']; + break; +} +require_once 'classes/model/ObjectPermission.php'; +$oOP = new ObjectPermission(); +$aData = array ('OP_UID' => $sValue['OP_UID'],'PRO_UID' => $sValue['PRO_UID'],'TAS_UID' => $sValue['TAS_UID'] != '' ? $sValue['TAS_UID'] : '0','USR_UID' => (string) $sUserGroup,'OP_USER_RELATION' => $iRelation,'OP_TASK_SOURCE' => $sValue['OP_TASK_SOURCE'] != '' ? $sValue['OP_TASK_SOURCE'] : '0','OP_PARTICIPATE' => $sValue['OP_PARTICIPATE'] != '' ? $sValue['OP_PARTICIPATE'] : 0,'OP_OBJ_TYPE' => $sValue['OP_OBJ_TYPE'] != '' ? $sValue['OP_OBJ_TYPE'] : '0','OP_OBJ_UID' => $sObjectUID != '' ? $sObjectUID : '0','OP_ACTION' => $sValue['OP_ACTION'] != '' ? $sValue['OP_ACTION'] : '0','OP_CASE_STATUS' => $sValue['OP_CASE_STATUS'] != '' ? $sValue['OP_CASE_STATUS'] : '0' +); + +$oObj = new ObjectPermission(); +$oObj->update( $aData ); + +G::LoadClass( 'processMap' ); +$oProcessMap = new ProcessMap(); +$oProcessMap->getObjectsPermissionsCriteria( $sValue['PRO_UID'] ); diff --git a/workflow/engine/methods/processes/processes_SaveObjectPermission.php b/workflow/engine/methods/processes/processes_SaveObjectPermission.php index 521e8e1da..a9caf9e2f 100755 --- a/workflow/engine/methods/processes/processes_SaveObjectPermission.php +++ b/workflow/engine/methods/processes/processes_SaveObjectPermission.php @@ -1,88 +1,78 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} -if(isset($_POST['form'])) - $sValue = $_POST['form']; //For old processmap -else - $sValue = $_POST; //For new processmap EXtjs - -list($iRelation, $sUserGroup) = explode('|', $sValue['GROUP_USER']); -$sObjectUID = ''; -switch ($sValue['OP_OBJ_TYPE']) { - case 'ANY': - /*case 'ANY_DYNAFORM': - case 'ANY_INPUT': - case 'ANY_OUTPUT':*/ - $sObjectUID = ''; - break; - case 'DYNAFORM': - $sObjectUID = $sValue['DYNAFORMS']; - break; - case 'INPUT': - $sObjectUID = $sValue['INPUTS']; - break; - case 'OUTPUT': - $sObjectUID = $sValue['OUTPUTS']; - break; -} -require_once 'classes/model/ObjectPermission.php'; -$oOP = new ObjectPermission(); -$aData = array('OP_UID' => G::generateUniqueID(), - 'PRO_UID' =>$sValue['PRO_UID'], - 'TAS_UID' => $sValue['TAS_UID'], - 'USR_UID' => (string)$sUserGroup, - 'OP_USER_RELATION' => $iRelation, - 'OP_TASK_SOURCE' => $sValue['OP_TASK_SOURCE'], - 'OP_PARTICIPATE' => $sValue['OP_PARTICIPATE'], - 'OP_OBJ_TYPE' => $sValue['OP_OBJ_TYPE'], - 'OP_OBJ_UID' => $sObjectUID, - 'OP_ACTION' => $sValue['OP_ACTION'], - 'OP_CASE_STATUS' => $sValue['OP_CASE_STATUS']); -$oOP->fromArray($aData,BasePeer::TYPE_FIELDNAME); -$oOP->save(); -G::LoadClass('processMap'); -$oProcessMap = new ProcessMap(); -$oProcessMap->getObjectsPermissionsCriteria($sValue['PRO_UID']); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} +if (isset( $_POST['form'] )) + $sValue = $_POST['form']; //For old processmap +else + $sValue = $_POST; //For new processmap EXtjs + + +list ($iRelation, $sUserGroup) = explode( '|', $sValue['GROUP_USER'] ); +$sObjectUID = ''; +switch ($sValue['OP_OBJ_TYPE']) { + case 'ANY': + /*case 'ANY_DYNAFORM': + case 'ANY_INPUT': + case 'ANY_OUTPUT':*/ + $sObjectUID = ''; + break; + case 'DYNAFORM': + $sObjectUID = $sValue['DYNAFORMS']; + break; + case 'INPUT': + $sObjectUID = $sValue['INPUTS']; + break; + case 'OUTPUT': + $sObjectUID = $sValue['OUTPUTS']; + break; +} +require_once 'classes/model/ObjectPermission.php'; +$oOP = new ObjectPermission(); +$aData = array ('OP_UID' => G::generateUniqueID(),'PRO_UID' => $sValue['PRO_UID'],'TAS_UID' => $sValue['TAS_UID'],'USR_UID' => (string) $sUserGroup,'OP_USER_RELATION' => $iRelation,'OP_TASK_SOURCE' => $sValue['OP_TASK_SOURCE'],'OP_PARTICIPATE' => $sValue['OP_PARTICIPATE'],'OP_OBJ_TYPE' => $sValue['OP_OBJ_TYPE'],'OP_OBJ_UID' => $sObjectUID,'OP_ACTION' => $sValue['OP_ACTION'],'OP_CASE_STATUS' => $sValue['OP_CASE_STATUS'] +); +$oOP->fromArray( $aData, BasePeer::TYPE_FIELDNAME ); +$oOP->save(); +G::LoadClass( 'processMap' ); +$oProcessMap = new ProcessMap(); +$oProcessMap->getObjectsPermissionsCriteria( $sValue['PRO_UID'] ); diff --git a/workflow/engine/methods/processes/processes_UploadFiles.php b/workflow/engine/methods/processes/processes_UploadFiles.php index d4d6c064f..4d6cca241 100755 --- a/workflow/engine/methods/processes/processes_UploadFiles.php +++ b/workflow/engine/methods/processes/processes_UploadFiles.php @@ -1,19 +1,19 @@ -parent.goToDirectoryforie(\'' . $_POST['form']['PRO_UID'] . '\', \'' . $_POST['form']['MAIN_DIRECTORY'] . '\', \'' . $_POST['form']['CURRENT_DIRECTORY'] . '\');'); +parent.goToDirectoryforie(\'' . $_POST['form']['PRO_UID'] . '\', \'' . $_POST['form']['MAIN_DIRECTORY'] . '\', \'' . $_POST['form']['CURRENT_DIRECTORY'] . '\');' ); diff --git a/workflow/engine/methods/processes/processes_UploadFilesForm.php b/workflow/engine/methods/processes/processes_UploadFilesForm.php index 5871cb5c5..2606fc0a2 100755 --- a/workflow/engine/methods/processes/processes_UploadFilesForm.php +++ b/workflow/engine/methods/processes/processes_UploadFilesForm.php @@ -12,37 +12,33 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - if($_GET['NAVIGATOR']=='ie'){ - $oForm = new Form('processes/processes_UploadFilesForm', '', SYS_LANG); +if ($_GET['NAVIGATOR'] == 'ie') { + $oForm = new Form( 'processes/processes_UploadFilesForm', '', SYS_LANG ); $oForm->action = 'processes_UploadFiles'; - $oForm->values = array('PRO_UID' => $_GET['PRO_UID'], - 'MAIN_DIRECTORY' => $_GET['MAIN_DIRECTORY'], - 'CURRENT_DIRECTORY' => $_GET['CURRENT_DIRECTORY']); - echo '' . - $oForm->render(PATH_CORE . 'templates/xmlform.html', $scriptCode = ''); + $oForm->values = array ('PRO_UID' => $_GET['PRO_UID'],'MAIN_DIRECTORY' => $_GET['MAIN_DIRECTORY'],'CURRENT_DIRECTORY' => $_GET['CURRENT_DIRECTORY'] + ); + echo '' . $oForm->render( PATH_CORE . 'templates/xmlform.html', $scriptCode = '' ); + +} else { + $params = Array ('PRO_UID' => $_GET['PRO_UID'],'MAIN_DIRECTORY' => $_GET['MAIN_DIRECTORY'],'CURRENT_DIRECTORY' => $_GET['CURRENT_DIRECTORY'] + ); - } else { - $params = Array('PRO_UID' => $_GET['PRO_UID'], - 'MAIN_DIRECTORY' => $_GET['MAIN_DIRECTORY'], - 'CURRENT_DIRECTORY' => $_GET['CURRENT_DIRECTORY']); - $_SESSION['processes_upload'] = $params; $G_PUBLISH = new Publisher(); - $oHeadPublisher =& headPublisher::getSingleton(); - $G_PUBLISH->AddContent('view', 'processes/processes_Upload'); - G::RenderPage( "publish" , "raw" ); - } + $oHeadPublisher = & headPublisher::getSingleton(); + $G_PUBLISH->AddContent( 'view', 'processes/processes_Upload' ); + G::RenderPage( "publish", "raw" ); +} diff --git a/workflow/engine/methods/processes/processes_User.php b/workflow/engine/methods/processes/processes_User.php index 26aa26b96..76b57954d 100755 --- a/workflow/engine/methods/processes/processes_User.php +++ b/workflow/engine/methods/processes/processes_User.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - /** - * @Description This is a callback for the View of all groups from a determinated user - * @author Everth S. Berrios Morales - * @Date 16/05/2008 - * @LastModification none - */ -G::LoadThirdParty('pear/json','class.json'); +/** + * ription This is a callback for the View of all groups from a determinated user + * + * @author Everth S. Berrios Morales + * @Date 16/05/2008 + * @LastModification none + */ +G::LoadThirdParty( 'pear/json', 'class.json' ); try { - $oJSON = new Services_JSON(); - $stdObj = $oJSON->decode(stripslashes($_POST['data'])); - if ( isset ($stdObj->pro_uid ) ) - $sProUid = $stdObj->pro_uid; - else - throw ( new Exception ( 'the process uid is not defined!.' ) ); + $oJSON = new Services_JSON(); + $stdObj = $oJSON->decode( stripslashes( $_POST['data'] ) ); + if (isset( $stdObj->pro_uid )) + $sProUid = $stdObj->pro_uid; + else + throw (new Exception( 'the process uid is not defined!.' )); - G::LoadClass('processMap'); - $oProcessMap = new ProcessMap(); - $c = $oProcessMap->listProcessesUser($sProUid); + G::LoadClass( 'processMap' ); + $oProcessMap = new ProcessMap(); + $c = $oProcessMap->listProcessesUser( $sProUid ); - $oHeadPublisher =& headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile('/jscore/processmap/core/processUser.js'); - - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('propeltable', 'paged-table', 'processes/processes_User', $c, array('PRO_UID' => $sProUid)); - G::RenderPage( 'publish', 'raw' ); + $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher->addScriptFile( '/jscore/processmap/core/processUser.js' ); -} -catch ( Exception $e ){ - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); - G::RenderPage('publish', 'raw' ); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'processes/processes_User', $c, array ('PRO_UID' => $sProUid + ) ); + G::RenderPage( 'publish', 'raw' ); + +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', 'raw' ); } ?> \ No newline at end of file diff --git a/workflow/engine/methods/processes/processes_subProcessSave.php b/workflow/engine/methods/processes/processes_subProcessSave.php index 19f0fb9b1..603f19d9d 100755 --- a/workflow/engine/methods/processes/processes_subProcessSave.php +++ b/workflow/engine/methods/processes/processes_subProcessSave.php @@ -1,102 +1,90 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -global $RBAC; -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} - -//print_r($_POST); die; - -$out = array(); -for($i=1; $i<=count($_POST['form']['grid1']); $i++) -{ - $out[$_POST['form']['grid1'][$i]['VAR_OUT1']]= $_POST['form']['grid1'][$i]['VAR_OUT2']; -} - -$in = array(); -for($j=1; $j<=count($_POST['form']['grid2']); $j++) -{ - $in[$_POST['form']['grid2'][$j]['VAR_IN1']] = $_POST['form']['grid2'][$j]['VAR_IN2']; -} - -require_once 'classes/model/Task.php'; -$oTask= new Task(); -//$aTask=$oTask->load($_POST['form']['TASKS']); -//$aTask=$oTask->load($_POST['form']['PRO_UID']); -$aTask=($_POST['form']['TASKS']!=0)?$oTask->load($_POST['form']['TASKS']):0; -//$aTask['PRO_UID']=0; - -if ( isset ( $_POST['form']['SP_SYNCHRONOUS']) && $_POST['form']['SP_SYNCHRONOUS'] == '' ) { - $_POST['form']['SP_SYNCHRONOUS'] = '0'; -} - -if ( !isset ( $_POST['form']['SP_SYNCHRONOUS']) ) { - $_POST['form']['SP_SYNCHRONOUS'] = '0'; -} - -require_once 'classes/model/SubProcess.php'; -$oOP = new SubProcess(); -$aData = array('SP_UID' => $_POST['form']['SP_UID'],//G::generateUniqueID(), - 'PRO_UID' => (isset($aTask['PRO_UID']))?$aTask['PRO_UID']:'', - 'TAS_UID' => $_POST['form']['TASKS'], - 'PRO_PARENT' => $_POST['form']['PRO_PARENT'], - 'TAS_PARENT' => $_POST['form']['TAS_PARENT'], - 'SP_TYPE' => 'SIMPLE', - 'SP_SYNCHRONOUS' => $_POST['form']['SP_SYNCHRONOUS'], - 'SP_SYNCHRONOUS_TYPE' => 'ALL', - 'SP_SYNCHRONOUS_WAIT' => 0, - 'SP_VARIABLES_OUT' => serialize($out), - 'SP_VARIABLES_IN' => serialize($in), - 'SP_GRID_IN' => ''); - - -$oOP->update($aData); - -require_once 'classes/model/Content.php'; -$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; -//$cont = Content::addContent( 'SP_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] ); -$cont = Content::addContent( 'TAS_TITLE', '', $_POST['form']['TAS_PARENT'], $lang, $_POST['form']['SPROCESS_NAME'] ); -//$cont = Content::addContent( 'TAS_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] ); -//G::header('location: processes_Map?PRO_UID='. $_POST['form']['PRO_UID']); -die; +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +global $RBAC; +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} + +//print_r($_POST); die; + + +$out = array (); +for ($i = 1; $i <= count( $_POST['form']['grid1'] ); $i ++) { + $out[$_POST['form']['grid1'][$i]['VAR_OUT1']] = $_POST['form']['grid1'][$i]['VAR_OUT2']; +} + +$in = array (); +for ($j = 1; $j <= count( $_POST['form']['grid2'] ); $j ++) { + $in[$_POST['form']['grid2'][$j]['VAR_IN1']] = $_POST['form']['grid2'][$j]['VAR_IN2']; +} + +require_once 'classes/model/Task.php'; +$oTask = new Task(); +//$aTask=$oTask->load($_POST['form']['TASKS']); +//$aTask=$oTask->load($_POST['form']['PRO_UID']); +$aTask = ($_POST['form']['TASKS'] != 0) ? $oTask->load( $_POST['form']['TASKS'] ) : 0; +//$aTask['PRO_UID']=0; + + +if (isset( $_POST['form']['SP_SYNCHRONOUS'] ) && $_POST['form']['SP_SYNCHRONOUS'] == '') { + $_POST['form']['SP_SYNCHRONOUS'] = '0'; +} + +if (! isset( $_POST['form']['SP_SYNCHRONOUS'] )) { + $_POST['form']['SP_SYNCHRONOUS'] = '0'; +} + +require_once 'classes/model/SubProcess.php'; +$oOP = new SubProcess(); +$aData = array ('SP_UID' => $_POST['form']['SP_UID'],//G::generateUniqueID(), +'PRO_UID' => (isset( $aTask['PRO_UID'] )) ? $aTask['PRO_UID'] : '','TAS_UID' => $_POST['form']['TASKS'],'PRO_PARENT' => $_POST['form']['PRO_PARENT'],'TAS_PARENT' => $_POST['form']['TAS_PARENT'],'SP_TYPE' => 'SIMPLE','SP_SYNCHRONOUS' => $_POST['form']['SP_SYNCHRONOUS'],'SP_SYNCHRONOUS_TYPE' => 'ALL','SP_SYNCHRONOUS_WAIT' => 0,'SP_VARIABLES_OUT' => serialize( $out ),'SP_VARIABLES_IN' => serialize( $in ),'SP_GRID_IN' => '' +); + +$oOP->update( $aData ); + +require_once 'classes/model/Content.php'; +$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; +//$cont = Content::addContent( 'SP_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] ); +$cont = Content::addContent( 'TAS_TITLE', '', $_POST['form']['TAS_PARENT'], $lang, $_POST['form']['SPROCESS_NAME'] ); +//$cont = Content::addContent( 'TAS_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] ); +//G::header('location: processes_Map?PRO_UID='. $_POST['form']['PRO_UID']); +die(); diff --git a/workflow/engine/methods/processes/processes_webEntryGenerate.php b/workflow/engine/methods/processes/processes_webEntryGenerate.php index a67f8caba..983aae414 100755 --- a/workflow/engine/methods/processes/processes_webEntryGenerate.php +++ b/workflow/engine/methods/processes/processes_webEntryGenerate.php @@ -1,171 +1,170 @@ -PRO_UID; -$sTASKS = $oData->TASKS; -$sDYNAFORM = $oData->DYNAFORM; -$sWE_TYPE = $oData->WE_TYPE; -$sWS_USER = $oData->WS_USER; -$sWS_PASS = $oData->WS_PASS; -$sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN; -$sWE_USR = $oData->WE_USR; - -$withWS = $sWE_TYPE == 'WS'; - -G::LoadClass("system"); - -try { - $pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP; - G::mk_dir ( $pathProcess, 0777 ); - - $oTask = new Task ( ); - $TaskFields = $oTask->load ( $sTASKS ); - $WE_EVN_UID = $oTask->getStartingEvent($sTASKS); - if ($TaskFields['TAS_ASSIGN_TYPE'] != 'BALANCED') { - throw (new Exception ( "The task '" . $TaskFields['TAS_TITLE'] . "' doesn't have a valid assignment type. The task needs to have a 'Cyclical Assignment'." )); - } - - G::LoadClass ( 'tasks' ); - $oTask = new Tasks ( ); - $user = $oTask->assignUsertoTask ( $sTASKS ); - - if ($user == 0) { - throw (new Exception ( "The task '" . $TaskFields['TAS_TITLE'] . "' doesn't have users." )); - } - - if (G::is_https ()) - $http = 'https://'; - else - $http = 'http://'; - - $sContent = ''; - - if ($withWS) { - //creating sys.info; - $SITE_PUBLIC_PATH = ''; - if (file_exists ( $SITE_PUBLIC_PATH . '' )) {} - - //creating the first file - require_once 'classes/model/Dynaform.php'; - $oDynaform = new Dynaform ( ); - $aDynaform = $oDynaform->load ( $sDYNAFORM ); - $dynTitle = str_replace ( ' ', '_', str_replace ( '/', '_', $aDynaform['DYN_TITLE'] ) ); - $sContent = "AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n"; - $sContent .= "G::RenderPage('publish', 'blank');"; - file_put_contents ( $pathProcess . $dynTitle . '.php', $sContent ); - //creating the second file, the post file who receive the post form. - $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; - $template = new TemplatePower ( $pluginTpl ); - $template->prepare (); - $template->assign ( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); - $template->assign ( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); - $template->assign ( 'processUid', $sPRO_UID ); - $template->assign ( 'dynaformUid', $sDYNAFORM ); - $template->assign ( 'taskUid', $sTASKS ); - $template->assign ( 'wsUser', $sWS_USER ); - $template->assign ( 'wsPass', 'md5:' . md5 ( $sWS_PASS ) ); - $template->assign ( 'wsRoundRobin', $sWS_ROUNDROBIN ); - - if($sWE_USR == "2"){ - $template->assign ( 'USR_VAR', "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;" ); - } else { - $template->assign ( 'USR_VAR', '$USR_UID = -1;' ); - } - - - $template->assign ( 'dynaform', $dynTitle ); - $template->assign ( 'timestamp', date ( 'l jS \of F Y h:i:s A' ) ); - $template->assign ( 'ws', SYS_SYS ); - $template->assign ( 'version', System::getVersion() ); - - $fileName = $pathProcess . $dynTitle . 'Post.php'; - file_put_contents ( $fileName, $template->getOutputContent () ); - //creating the third file, only if this wsClient.php file doesn't exist. - $fileName = $pathProcess . 'wsClient.php'; - $pluginTpl = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php'; - - if ( file_exists ($fileName) ) { - if( filesize($fileName) != filesize($pluginTpl) ){ - @copy($fileName, $pathProcess . 'wsClient.php.bck'); - @unlink($fileName); - - $template = new TemplatePower ( $pluginTpl ); - $template->prepare (); - file_put_contents ( $fileName, $template->getOutputContent () ); - } - } else { - $template = new TemplatePower ( $pluginTpl ); - $template->prepare (); - file_put_contents ( $fileName, $template->getOutputContent () ); - } - - require_once 'classes/model/Event.php'; - $oEvent = new Event ( ); - $aDataEvent = array(); - - $aDataEvent['EVN_UID'] = $WE_EVN_UID; //$oData->WE_EVN_UID; - $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE'; - $aDataEvent['EVN_ACTION'] = $sDYNAFORM; - $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; - $output = $oEvent->update($aDataEvent); - //Show link - $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; - print $link; - //print "\n $link "; - - - } else { - $G_FORM = new Form ( $sPRO_UID . '/' . $sDYNAFORM, PATH_DYNAFORM, SYS_LANG, false ); - $G_FORM->action = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/cases_StartExternal.php'; - - $scriptCode = ''; - $scriptCode = $G_FORM->render ( PATH_CORE . 'templates/' . 'xmlform' . '.html', $scriptCode ); - $scriptCode = str_replace ( '/controls/', $http . $_SERVER['HTTP_HOST'] . '/controls/', $scriptCode ); - $scriptCode = str_replace ( '/js/maborak/core/images/', $http . $_SERVER['HTTP_HOST'] . '/js/maborak/core/images/', $scriptCode ); - - //render the template - $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentry.tpl'; - $template = new TemplatePower ( $pluginTpl ); - $template->prepare (); - require_once 'classes/model/Step.php'; - $oStep = new Step(); - $sUidGrids = $oStep->lookingforUidGrids($sPRO_UID,$sDYNAFORM); - - - $template->assign ( 'siteUrl', $http . $_SERVER['HTTP_HOST'] ); - $template->assign ( 'sysSys', SYS_SYS ); - $template->assign ( 'sysLang', SYS_LANG ); - $template->assign ( 'sysSkin', SYS_SKIN ); - $template->assign ( 'processUid', $sPRO_UID ); - $template->assign ( 'dynaformUid', $sDYNAFORM ); - $template->assign ( 'taskUid', $sTASKS ); - $template->assign ( 'dynFileName', $sPRO_UID . '/' . $sDYNAFORM ); - $template->assign ( 'formId', $G_FORM->id ); - $template->assign ( 'scriptCode', $scriptCode ); - - if(sizeof($sUidGrids)>0){ - foreach($sUidGrids as $k => $v){ - $template->newBlock( 'grid_uids' ); - $template->assign ( 'siteUrl', $http . $_SERVER['HTTP_HOST'] ); - $template->assign ( 'gridFileName', $sPRO_UID . '/' . $v ); - } - } - - print_r ( '' ); - } - -} catch ( Exception $e ) { - $G_PUBLISH = new Publisher ( ); - $aMessage['MESSAGE'] = $e->getMessage (); - $G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage ( 'publish', 'raw' ); -} - - +PRO_UID; +$sTASKS = $oData->TASKS; +$sDYNAFORM = $oData->DYNAFORM; +$sWE_TYPE = $oData->WE_TYPE; +$sWS_USER = $oData->WS_USER; +$sWS_PASS = $oData->WS_PASS; +$sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN; +$sWE_USR = $oData->WE_USR; + +$withWS = $sWE_TYPE == 'WS'; + +G::LoadClass( "system" ); + +try { + $pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP; + G::mk_dir( $pathProcess, 0777 ); + + $oTask = new Task(); + $TaskFields = $oTask->load( $sTASKS ); + $WE_EVN_UID = $oTask->getStartingEvent( $sTASKS ); + if ($TaskFields['TAS_ASSIGN_TYPE'] != 'BALANCED') { + throw (new Exception( "The task '" . $TaskFields['TAS_TITLE'] . "' doesn't have a valid assignment type. The task needs to have a 'Cyclical Assignment'." )); + } + + G::LoadClass( 'tasks' ); + $oTask = new Tasks(); + $user = $oTask->assignUsertoTask( $sTASKS ); + + if ($user == 0) { + throw (new Exception( "The task '" . $TaskFields['TAS_TITLE'] . "' doesn't have users." )); + } + + if (G::is_https()) + $http = 'https://'; + else + $http = 'http://'; + + $sContent = ''; + + if ($withWS) { + //creating sys.info; + $SITE_PUBLIC_PATH = ''; + if (file_exists( $SITE_PUBLIC_PATH . '' )) { + } + + //creating the first file + require_once 'classes/model/Dynaform.php'; + $oDynaform = new Dynaform(); + $aDynaform = $oDynaform->load( $sDYNAFORM ); + $dynTitle = str_replace( ' ', '_', str_replace( '/', '_', $aDynaform['DYN_TITLE'] ) ); + $sContent = "AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n"; + $sContent .= "G::RenderPage('publish', 'blank');"; + file_put_contents( $pathProcess . $dynTitle . '.php', $sContent ); + //creating the second file, the post file who receive the post form. + $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; + $template = new TemplatePower( $pluginTpl ); + $template->prepare(); + $template->assign( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); + $template->assign( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); + $template->assign( 'processUid', $sPRO_UID ); + $template->assign( 'dynaformUid', $sDYNAFORM ); + $template->assign( 'taskUid', $sTASKS ); + $template->assign( 'wsUser', $sWS_USER ); + $template->assign( 'wsPass', 'md5:' . md5( $sWS_PASS ) ); + $template->assign( 'wsRoundRobin', $sWS_ROUNDROBIN ); + + if ($sWE_USR == "2") { + $template->assign( 'USR_VAR', "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;" ); + } else { + $template->assign( 'USR_VAR', '$USR_UID = -1;' ); + } + + $template->assign( 'dynaform', $dynTitle ); + $template->assign( 'timestamp', date( 'l jS \of F Y h:i:s A' ) ); + $template->assign( 'ws', SYS_SYS ); + $template->assign( 'version', System::getVersion() ); + + $fileName = $pathProcess . $dynTitle . 'Post.php'; + file_put_contents( $fileName, $template->getOutputContent() ); + //creating the third file, only if this wsClient.php file doesn't exist. + $fileName = $pathProcess . 'wsClient.php'; + $pluginTpl = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php'; + + if (file_exists( $fileName )) { + if (filesize( $fileName ) != filesize( $pluginTpl )) { + @copy( $fileName, $pathProcess . 'wsClient.php.bck' ); + @unlink( $fileName ); + + $template = new TemplatePower( $pluginTpl ); + $template->prepare(); + file_put_contents( $fileName, $template->getOutputContent() ); + } + } else { + $template = new TemplatePower( $pluginTpl ); + $template->prepare(); + file_put_contents( $fileName, $template->getOutputContent() ); + } + + require_once 'classes/model/Event.php'; + $oEvent = new Event(); + $aDataEvent = array (); + + $aDataEvent['EVN_UID'] = $WE_EVN_UID; //$oData->WE_EVN_UID; + $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE'; + $aDataEvent['EVN_ACTION'] = $sDYNAFORM; + $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; + $output = $oEvent->update( $aDataEvent ); + //Show link + $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; + print $link; + //print "\n $link "; + + + } else { + $G_FORM = new Form( $sPRO_UID . '/' . $sDYNAFORM, PATH_DYNAFORM, SYS_LANG, false ); + $G_FORM->action = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/cases_StartExternal.php'; + + $scriptCode = ''; + $scriptCode = $G_FORM->render( PATH_CORE . 'templates/' . 'xmlform' . '.html', $scriptCode ); + $scriptCode = str_replace( '/controls/', $http . $_SERVER['HTTP_HOST'] . '/controls/', $scriptCode ); + $scriptCode = str_replace( '/js/maborak/core/images/', $http . $_SERVER['HTTP_HOST'] . '/js/maborak/core/images/', $scriptCode ); + + //render the template + $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentry.tpl'; + $template = new TemplatePower( $pluginTpl ); + $template->prepare(); + require_once 'classes/model/Step.php'; + $oStep = new Step(); + $sUidGrids = $oStep->lookingforUidGrids( $sPRO_UID, $sDYNAFORM ); + + $template->assign( 'siteUrl', $http . $_SERVER['HTTP_HOST'] ); + $template->assign( 'sysSys', SYS_SYS ); + $template->assign( 'sysLang', SYS_LANG ); + $template->assign( 'sysSkin', SYS_SKIN ); + $template->assign( 'processUid', $sPRO_UID ); + $template->assign( 'dynaformUid', $sDYNAFORM ); + $template->assign( 'taskUid', $sTASKS ); + $template->assign( 'dynFileName', $sPRO_UID . '/' . $sDYNAFORM ); + $template->assign( 'formId', $G_FORM->id ); + $template->assign( 'scriptCode', $scriptCode ); + + if (sizeof( $sUidGrids ) > 0) { + foreach ($sUidGrids as $k => $v) { + $template->newBlock( 'grid_uids' ); + $template->assign( 'siteUrl', $http . $_SERVER['HTTP_HOST'] ); + $template->assign( 'gridFileName', $sPRO_UID . '/' . $v ); + } + } + + print_r( '' ); + } + +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', 'raw' ); +} + + diff --git a/workflow/engine/methods/processes/processes_webEntryValidate.php b/workflow/engine/methods/processes/processes_webEntryValidate.php index 46ffd6059..03f78520a 100755 --- a/workflow/engine/methods/processes/processes_webEntryValidate.php +++ b/workflow/engine/methods/processes/processes_webEntryValidate.php @@ -11,8 +11,8 @@ $sTASKS_SEL = $oData->TASKS_NAME; //echo $sTASKS."
"; $sDYNAFORM = $oData->DYNAFORM; $sWE_TYPE = $oData->WE_TYPE; -$sWS_USER = trim($oData->WS_USER); -$sWS_PASS = trim($oData->WS_PASS); +$sWS_USER = trim( $oData->WS_USER ); +$sWS_PASS = trim( $oData->WS_PASS ); $sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN; $sWE_USR = $oData->WE_USR; @@ -20,37 +20,41 @@ $sWE_USR = $oData->WE_USR; //echo ($sTASKS."
"); //echo ($sDYNAFORM."
"); -if (G::is_https ()) + +if (G::is_https()) $http = 'https://'; - else +else $http = 'http://'; $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; -@$client = new SoapClient ( $endpoint ); +@$client = new SoapClient( $endpoint ); $user = $sWS_USER; $pass = $sWS_PASS; -$params = array ('userid' => $user, 'password' => $pass ); -$result = $client->__SoapCall ( 'login', array ($params ) ); +$params = array ('userid' => $user,'password' => $pass +); +$result = $client->__SoapCall( 'login', array ($params +) ); //$_SESSION ['WS_SESSION_ID'] = ''; + //if ($result->status_code == 0) { // $_SESSION ['WS_SESSION_ID'] = $result->message; //} -$fields ['status_code'] = $result->status_code; -$fields ['message'] = 'ProcessMaker WebService version: ' . $result->version . "\n" . $result->message; -$fields ['version'] = $result->version; -$fields ['time_stamp'] = $result->timestamp; + +$fields['status_code'] = $result->status_code; +$fields['message'] = 'ProcessMaker WebService version: ' . $result->version . "\n" . $result->message; +$fields['version'] = $result->version; +$fields['time_stamp'] = $result->timestamp; $messageCode = 1; - -G::LoadClass ( 'Task' ); -G::LoadClass ( 'User' ); -G::LoadClass ( 'TaskUser' ); -G::LoadClass ( 'Groupwf' ); +G::LoadClass( 'Task' ); +G::LoadClass( 'User' ); +G::LoadClass( 'TaskUser' ); +G::LoadClass( 'Groupwf' ); /** * note added by gustavo cruz gustavo-at-colosa-dot-com * This is a little check to see if the GroupUser class has been declared or not. @@ -58,39 +62,39 @@ G::LoadClass ( 'Groupwf' ); * It's seems that could be replicated in a Linux server easily. * I recomend that in some way check already if a imported class is declared * somewhere else or maybe delegate the task to the G Class LoadClass method. - **/ -if(!class_exists('GroupUser')) { - G::LoadClass ( 'GroupUser' ); + */ +if (! class_exists( 'GroupUser' )) { + G::LoadClass( 'GroupUser' ); } - // if the user has been authenticated, then check if has the rights or - // permissions to create the webentry - if ($result->status_code == 0) { - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(UsersPeer::USR_UID); - $oCriteria->addSelectColumn(TaskUserPeer::USR_UID); - $oCriteria->addSelectColumn(TaskUserPeer::TAS_UID); - $oCriteria->addJoin(TaskUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); - $oCriteria->add(TaskUserPeer::TAS_UID, $sTASKS); - $oCriteria->add(UsersPeer::USR_USERNAME, $sWS_USER); - //$oCriteria->add(TaskUserPeer::TU_RELATION,1); - $userIsAssigned = TaskUserPeer::doCount($oCriteria); - // if the user is not assigned directly, maybe a have the task a group with the user - if($userIsAssigned<1) { - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(UsersPeer::USR_UID); - $oCriteria->addJoin(UsersPeer::USR_UID, GroupUserPeer::USR_UID, Criteria::LEFT_JOIN); - $oCriteria->addJoin(GroupUserPeer::GRP_UID, TaskUserPeer::USR_UID, Criteria::LEFT_JOIN); - $oCriteria->add(TaskUserPeer::TAS_UID, $sTASKS); - $oCriteria->add(UsersPeer::USR_USERNAME, $sWS_USER); - $userIsAssigned = GroupUserPeer::doCount($oCriteria); - if (!($userIsAssigned>=1)) { - $messageCode = "The User \"".$sWS_USER."\" doesn't have the task \"".$sTASKS_SEL."\" assigned"; - } - } - - } else { - $messageCode = $result->message; +// if the user has been authenticated, then check if has the rights or +// permissions to create the webentry +if ($result->status_code == 0) { + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( UsersPeer::USR_UID ); + $oCriteria->addSelectColumn( TaskUserPeer::USR_UID ); + $oCriteria->addSelectColumn( TaskUserPeer::TAS_UID ); + $oCriteria->addJoin( TaskUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN ); + $oCriteria->add( TaskUserPeer::TAS_UID, $sTASKS ); + $oCriteria->add( UsersPeer::USR_USERNAME, $sWS_USER ); + //$oCriteria->add(TaskUserPeer::TU_RELATION,1); + $userIsAssigned = TaskUserPeer::doCount( $oCriteria ); + // if the user is not assigned directly, maybe a have the task a group with the user + if ($userIsAssigned < 1) { + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( UsersPeer::USR_UID ); + $oCriteria->addJoin( UsersPeer::USR_UID, GroupUserPeer::USR_UID, Criteria::LEFT_JOIN ); + $oCriteria->addJoin( GroupUserPeer::GRP_UID, TaskUserPeer::USR_UID, Criteria::LEFT_JOIN ); + $oCriteria->add( TaskUserPeer::TAS_UID, $sTASKS ); + $oCriteria->add( UsersPeer::USR_USERNAME, $sWS_USER ); + $userIsAssigned = GroupUserPeer::doCount( $oCriteria ); + if (! ($userIsAssigned >= 1)) { + $messageCode = "The User \"" . $sWS_USER . "\" doesn't have the task \"" . $sTASKS_SEL . "\" assigned"; } + } + +} else { + $messageCode = $result->message; +} echo ($messageCode); ?> diff --git a/workflow/engine/methods/processes/webEntry_Val_Assig.php b/workflow/engine/methods/processes/webEntry_Val_Assig.php index e7f1fcfc0..5c2cc7028 100755 --- a/workflow/engine/methods/processes/webEntry_Val_Assig.php +++ b/workflow/engine/methods/processes/webEntry_Val_Assig.php @@ -1,32 +1,32 @@ -PRO_UID; -$sTASKS = $oData->TASKS; -$sDYNAFORM = $oData->DYNAFORM; - - -if (G::is_https ()) - $http = 'https://'; - else - $http = 'http://'; - -$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; -@$client = new SoapClient ( $endpoint ); - - -G::LoadClass ( 'Task' ); -G::LoadClass ( 'User' ); -G::LoadClass ( 'TaskUser' ); - -$oTask = new Task ( ); - $TaskFields = $oTask->kgetassigType ( $sPRO_UID, $sTASKS ); - -if ($TaskFields['TAS_ASSIGN_TYPE'] == 'BALANCED')echo 1; -else echo 0; - -?> +PRO_UID; +$sTASKS = $oData->TASKS; +$sDYNAFORM = $oData->DYNAFORM; + +if (G::is_https()) + $http = 'https://'; +else + $http = 'http://'; + +$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; +@$client = new SoapClient( $endpoint ); + +G::LoadClass( 'Task' ); +G::LoadClass( 'User' ); +G::LoadClass( 'TaskUser' ); + +$oTask = new Task(); +$TaskFields = $oTask->kgetassigType( $sPRO_UID, $sTASKS ); + +if ($TaskFields['TAS_ASSIGN_TYPE'] == 'BALANCED') + echo 1; +else + echo 0; + +?>