First commit on ProcessMaker CORE Engine and Jeaqueline's changes
This commit is contained in:
@@ -142,7 +142,12 @@ try {
|
||||
case 'addSubProcess':
|
||||
$sOutput = $oProcessMap->addSubProcess($oData->uid, $oData->position->x, $oData->position->y);
|
||||
break;
|
||||
|
||||
case 'taskColor':
|
||||
$oTask->taskColor($oData->pro_uid, $oData->tas_uid);
|
||||
break;
|
||||
case 'addTaskHidden':
|
||||
$sOutput = $oProcessMap->addTaskHidden($oData->uid, $oData->position->x, $oData->position->y);
|
||||
break;
|
||||
case 'editTaskProperties':
|
||||
$oProcessMap->editTaskProperties($oData->uid, (isset($oData->iForm) ? $oData->iForm : 1), $oData->index);
|
||||
break;
|
||||
@@ -228,6 +233,9 @@ try {
|
||||
case 5:
|
||||
$oData->type = 'SEC-JOIN';
|
||||
break;
|
||||
case 8:
|
||||
$oData->type = 'DISCRIMINATOR';
|
||||
break;
|
||||
}
|
||||
$oProcessMap->newPattern($oData->pro_uid, $oData->tas_uid, $oData->next_task, $oData->type);
|
||||
}
|
||||
@@ -253,14 +261,17 @@ try {
|
||||
case 5:
|
||||
$sType = 'SEC-JOIN';
|
||||
break;
|
||||
case 8:
|
||||
$sType = 'DISCRIMINATOR';
|
||||
break;
|
||||
}
|
||||
if (($oData->type != 0) && ($oData->type != 5)) {
|
||||
if (($oData->type != 0) && ($oData->type != 5) && ($oData->type != 8)) {
|
||||
if ($oProcessMap->getNumberOfRoutes($oData->pro_uid, $oData->tas_uid, $oData->next_task, $sType) > 0) {
|
||||
die;
|
||||
}
|
||||
unset($aRow);
|
||||
}
|
||||
if (($oData->delete) || ($oData->type == 0) || ($oData->type == 5)) {
|
||||
if (($oData->delete) || ($oData->type == 0) || ($oData->type == 5) || ($oData->type == 8)) {
|
||||
G::LoadClass('tasks');
|
||||
$oTasks = new Tasks();
|
||||
$oTasks->deleteAllRoutesOfTask($oData->pro_uid, $oData->tas_uid);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* processes_DownloadFile.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 );
|
||||
@@ -0,0 +1,131 @@
|
||||
<?
|
||||
/**
|
||||
* processes_ImportFileExisting.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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;
|
||||
$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');
|
||||
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');
|
||||
}
|
||||
105
workflow/engine/methods/processes/processes_ImportFileXpdl.php
Normal file
105
workflow/engine/methods/processes/processes_ImportFileXpdl.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?
|
||||
/**
|
||||
* processes_ImportFile.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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');
|
||||
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');
|
||||
die;
|
||||
}
|
||||
// end added code
|
||||
$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');
|
||||
}
|
||||
65
workflow/engine/methods/processes/processes_ImportXpdl.php
Normal file
65
workflow/engine/methods/processes/processes_ImportXpdl.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* processes_Import.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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" );
|
||||
|
||||
}
|
||||
catch ( Exception $e ){
|
||||
$G_PUBLISH = new Publisher;
|
||||
$aMessage['MESSAGE'] = $e->getMessage();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
|
||||
G::RenderPage('publish');
|
||||
}
|
||||
Reference in New Issue
Block a user