Merge pull request #775 from Jennydmz/57c78b834278f035403fdc73ed5ef889b0caecbf

CODE STYLE.
This commit is contained in:
ferOnti
2012-10-17 09:43:51 -07:00
30 changed files with 2196 additions and 2288 deletions

View File

@@ -1,74 +1,70 @@
<?php
/**
* processes_List.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.
*
* 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.
*
*/
require_once 'classes/model/Process.php';
$start = isset($_POST['start'])? $_POST['start']: 0;
$limit = isset($_POST['limit'])? $_POST['limit']: '';
$oProcess = new Process();
<?php
/**
* processes_List.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.
*
* 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.
*/
$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'] !== '<reset>' ) {
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'] !== '<reset>') {
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 );

View File

@@ -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 <http://www.gnu.org/licenses/>.
* 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.
*
*/
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 {
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 );
}

View File

@@ -1,63 +1,60 @@
<?php
/**
* processes_Save.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.
*
*/
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);
<?php
/**
* processes_Save.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.
*/
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 );

View File

@@ -1,10 +1,10 @@
<?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
@@ -12,26 +12,25 @@
*
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* 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'] . '.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 );

View File

@@ -1,37 +1,36 @@
<?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 );
<?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 );

View File

@@ -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 <http://www.gnu.org/licenses/>.
* 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.
*
*/
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' );
}

View File

@@ -1,18 +1,18 @@
<?php
<?php
switch ($_GET['MAIN_DIRECTORY']) {
case 'mailTemplates':
$sDirectory = PATH_DATA_MAILTEMPLATES . $_GET['PRO_UID'] . PATH_SEP . ($_GET['CURRENT_DIRECTORY'] != '' ? $_GET['CURRENT_DIRECTORY'] . PATH_SEP : '');
break;
case 'public':
$sDirectory = PATH_DATA_PUBLIC . $_GET['PRO_UID'] . PATH_SEP . ($_GET['CURRENT_DIRECTORY'] != '' ? $_GET['CURRENT_DIRECTORY'] . PATH_SEP : '');
break;
default:
die;
break;
}
//fixed: added a file extension when is a javascript file by krlos
$_GET['FILE'] .= ($_GET['sFilextension']!='' && $_GET['sFilextension']=='javascript')?'.js':'';
if (file_exists($sDirectory . $_GET['FILE'])) {
G::streamFile($sDirectory . $_GET['FILE'], true);
case 'mailTemplates':
$sDirectory = PATH_DATA_MAILTEMPLATES . $_GET['PRO_UID'] . PATH_SEP . ($_GET['CURRENT_DIRECTORY'] != '' ? $_GET['CURRENT_DIRECTORY'] . PATH_SEP : '');
break;
case 'public':
$sDirectory = PATH_DATA_PUBLIC . $_GET['PRO_UID'] . PATH_SEP . ($_GET['CURRENT_DIRECTORY'] != '' ? $_GET['CURRENT_DIRECTORY'] . PATH_SEP : '');
break;
default:
die();
break;
}
//fixed: added a file extension when is a javascript file by krlos
$_GET['FILE'] .= ($_GET['sFilextension'] != '' && $_GET['sFilextension'] == 'javascript') ? '.js' : '';
if (file_exists( $sDirectory . $_GET['FILE'] )) {
G::streamFile( $sDirectory . $_GET['FILE'], true );
}

View File

@@ -1,10 +1,10 @@
<?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
@@ -12,54 +12,51 @@
*
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* 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;
}
}
$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" );
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
* 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('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' );
}

View File

@@ -1,132 +1,132 @@
<?php
/**
* 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;
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");
}
<?php
/**
* 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;
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" );
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
* 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('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' );
}

View File

@@ -1,106 +1,105 @@
<?php
/**
* 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', "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");
}
<?php
/**
* 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', "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" );
}

View File

@@ -1,65 +1,62 @@
<?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', "blank");
}
catch ( Exception $e ){
$G_PUBLISH = new Publisher;
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage('publish', "blank");
}
<?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', "blank" );
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', "blank" );
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
* 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.
*
*/
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();

View File

@@ -1,138 +1,136 @@
<?php
/**
* processes_List.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.
*
*/
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' );
}
<?php
/**
* processes_List.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.
*/
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' );
}

View File

@@ -1,73 +1,69 @@
<?php
/**
* processes_List.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.
*
*/
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');
<?php
/**
* processes_List.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.
*/
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' );

View File

@@ -1,96 +1,94 @@
<?php
/**
* processes_Map.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.
*
*/
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');
<?php
/**
* processes_Map.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.
*/
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' );

View File

@@ -1,63 +1,59 @@
<?php
/**
* processes_New.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;
}
}
//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');
<?php
/**
* processes_New.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;
}
}
//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' );

View File

@@ -1,96 +1,94 @@
<?php
/**
* processes_Save.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.
*
*/
/*
* 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;
<?php
/**
* processes_Save.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.
*/
/*
* 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;
}

View File

@@ -1,89 +1,78 @@
<?php
/**
* processes_SaveEditObjectPermission.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.
*
*/
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']);
<?php
/**
* processes_SaveEditObjectPermission.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.
*/
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'] );

View File

@@ -1,88 +1,78 @@
<?php
/**
* processes_Save.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.
*
*/
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']);
<?php
/**
* processes_Save.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.
*/
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'] );

View File

@@ -1,19 +1,19 @@
<?php
switch ($_POST['form']['MAIN_DIRECTORY']) {
case 'mailTemplates':
$sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['form']['PRO_UID'] . PATH_SEP . ($_POST['form']['CURRENT_DIRECTORY'] != '' ? $_POST['form']['CURRENT_DIRECTORY'] . PATH_SEP : '');
break;
case 'public':
$sDirectory = PATH_DATA_PUBLIC . $_POST['form']['PRO_UID'] . PATH_SEP . ($_POST['form']['CURRENT_DIRECTORY'] != '' ? $_POST['form']['CURRENT_DIRECTORY'] . PATH_SEP : '');
break;
default:
die;
break;
}
for ($i = 1; $i <= 5; $i++) {
if ($_FILES['form']['tmp_name']['FILENAME' . (string)$i] != '') {
G::uploadFile($_FILES['form']['tmp_name']['FILENAME' . (string)$i], $sDirectory, $_FILES['form']['name']['FILENAME' . (string)$i]);
}
}
die('<script type="text/javascript">parent.goToDirectoryforie(\'' . $_POST['form']['PRO_UID'] . '\', \'' . $_POST['form']['MAIN_DIRECTORY'] . '\', \'' . $_POST['form']['CURRENT_DIRECTORY'] . '\');</script>');
<?php
switch ($_POST['form']['MAIN_DIRECTORY']) {
case 'mailTemplates':
$sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['form']['PRO_UID'] . PATH_SEP . ($_POST['form']['CURRENT_DIRECTORY'] != '' ? $_POST['form']['CURRENT_DIRECTORY'] . PATH_SEP : '');
break;
case 'public':
$sDirectory = PATH_DATA_PUBLIC . $_POST['form']['PRO_UID'] . PATH_SEP . ($_POST['form']['CURRENT_DIRECTORY'] != '' ? $_POST['form']['CURRENT_DIRECTORY'] . PATH_SEP : '');
break;
default:
die();
break;
}
for ($i = 1; $i <= 5; $i ++) {
if ($_FILES['form']['tmp_name']['FILENAME' . (string) $i] != '') {
G::uploadFile( $_FILES['form']['tmp_name']['FILENAME' . (string) $i], $sDirectory, $_FILES['form']['name']['FILENAME' . (string) $i] );
}
}
die( '<script type="text/javascript">parent.goToDirectoryforie(\'' . $_POST['form']['PRO_UID'] . '\', \'' . $_POST['form']['MAIN_DIRECTORY'] . '\', \'' . $_POST['form']['CURRENT_DIRECTORY'] . '\');</script>' );

View File

@@ -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 <http://www.gnu.org/licenses/>.
* 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.
*
*/
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 '<link rel="stylesheet" type="text/css" href="/skins/' . SYS_SKIN . '/style.css"/>' .
$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 '<link rel="stylesheet" type="text/css" href="/skins/' . SYS_SKIN . '/style.css"/>' . $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" );
}

View File

@@ -1,10 +1,10 @@
<?php
/**
* processes_User.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
@@ -12,48 +12,48 @@
*
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* 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.
*
*/
/**
* @Description This is a callback for the View of all groups from a determinated user
* @author Everth S. Berrios Morales <everth@colosa.com>
* @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 <everth@colosa.com>
* @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' );
}
?>

View File

@@ -1,10 +1,10 @@
<?php
/**
* processes_checkProperties.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
@@ -12,79 +12,77 @@
*
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* 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.
*
*/
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';

View File

@@ -1,29 +1,29 @@
<?php
sleep(1);
if(isset($_SESSION['processes_upload'])){
$form = $_SESSION['processes_upload'];
switch ($form['MAIN_DIRECTORY']) {
case 'mailTemplates':
$sDirectory = PATH_DATA_MAILTEMPLATES . $form['PRO_UID'] . PATH_SEP . ($form['CURRENT_DIRECTORY'] != '' ? $form['CURRENT_DIRECTORY'] . PATH_SEP : '');
break;
case 'public':
$sDirectory = PATH_DATA_PUBLIC . $form['PRO_UID'] . PATH_SEP . ($form['CURRENT_DIRECTORY'] != '' ? $form['CURRENT_DIRECTORY'] . PATH_SEP : '');
break;
default:
die;
break;
}
}
if ($_FILES['form']['error'] == "0") {
G::uploadFile($_FILES['form']['tmp_name'], $sDirectory, $_FILES['form']['name']);
$msg = "Uploaded (" . (round((filesize($sDirectory.$_FILES['form']['name'])/1024) * 10) /10) . " kb)";
$result = 1;
//echo $sDirectory.$_FILES['form']['name'];
} else {
$msg = "Failed";
$result = 0;
}
<?php
sleep( 1 );
if (isset( $_SESSION['processes_upload'] )) {
$form = $_SESSION['processes_upload'];
switch ($form['MAIN_DIRECTORY']) {
case 'mailTemplates':
$sDirectory = PATH_DATA_MAILTEMPLATES . $form['PRO_UID'] . PATH_SEP . ($form['CURRENT_DIRECTORY'] != '' ? $form['CURRENT_DIRECTORY'] . PATH_SEP : '');
break;
case 'public':
$sDirectory = PATH_DATA_PUBLIC . $form['PRO_UID'] . PATH_SEP . ($form['CURRENT_DIRECTORY'] != '' ? $form['CURRENT_DIRECTORY'] . PATH_SEP : '');
break;
default:
die();
break;
}
}
if ($_FILES['form']['error'] == "0") {
G::uploadFile( $_FILES['form']['tmp_name'], $sDirectory, $_FILES['form']['name'] );
$msg = "Uploaded (" . (round( (filesize( $sDirectory . $_FILES['form']['name'] ) / 1024) * 10 ) / 10) . " kb)";
$result = 1;
//echo $sDirectory.$_FILES['form']['name'];
} else {
$msg = "Failed";
$result = 0;
}
echo "{'result': $result, 'msg':'$msg'}";

View File

@@ -1,102 +1,90 @@
<?php
/**
* processes_subProcessSave.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.
*
*/
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;
<?php
/**
* processes_subProcessSave.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.
*/
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();

View File

@@ -1,171 +1,170 @@
<?php
global $G_FORM;
$sPRO_UID = $oData->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 = "<?php\n";
$sContent .= "global \$_DBArray;\n";
$sContent .= "if (!isset(\$_DBArray)) {\n";
$sContent .= " \$_DBArray = array();\n";
$sContent .= "}\n";
$sContent .= "\$_SESSION['PROCESS'] = '" . $sPRO_UID . "';\n";
$sContent .= "\$_SESSION['CURRENT_DYN_UID'] = '" . $sDYNAFORM . "';\n";
$sContent .= "\$G_PUBLISH = new Publisher;\n";
$sContent .= "\$G_PUBLISH->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<a href='$link' target='_new' > $link </a>";
} 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 ( '<textarea cols="70" rows="20">' . htmlentities ( str_replace ( '</body>', '</form></body>', str_replace ( '</form>', '', $template->getOutputContent () ) ) ) . '</textarea>' );
}
} catch ( Exception $e ) {
$G_PUBLISH = new Publisher ( );
$aMessage['MESSAGE'] = $e->getMessage ();
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage ( 'publish', 'raw' );
}
<?php
global $G_FORM;
$sPRO_UID = $oData->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 = "<?php\n";
$sContent .= "global \$_DBArray;\n";
$sContent .= "if (!isset(\$_DBArray)) {\n";
$sContent .= " \$_DBArray = array();\n";
$sContent .= "}\n";
$sContent .= "\$_SESSION['PROCESS'] = '" . $sPRO_UID . "';\n";
$sContent .= "\$_SESSION['CURRENT_DYN_UID'] = '" . $sDYNAFORM . "';\n";
$sContent .= "\$G_PUBLISH = new Publisher;\n";
$sContent .= "\$G_PUBLISH->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<a href='$link' target='_new' > $link </a>";
} 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( '<textarea cols="70" rows="20">' . htmlentities( str_replace( '</body>', '</form></body>', str_replace( '</form>', '', $template->getOutputContent() ) ) ) . '</textarea>' );
}
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'raw' );
}

View File

@@ -11,8 +11,8 @@ $sTASKS_SEL = $oData->TASKS_NAME;
//echo $sTASKS."<br>";
$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."<br>");
//echo ($sDYNAFORM."<br>");
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);
?>

View File

@@ -1,32 +1,32 @@
<?php
/**
* webEntryValidate_Val_assig
* it gets the assign type for the task
* with pro_uid and tas_uid
*/
$sPRO_UID = $oData->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;
?>
<?php
/**
* webEntryValidate_Val_assig
* it gets the assign type for the task
* with pro_uid and tas_uid
*/
$sPRO_UID = $oData->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;
?>