CODE STYLE

FILES:
workflow/engine/methods/processes/processesList.php
workflow/engine/methods/processes/processes_SaveEditObjectPermission.php
workflow/engine/methods/processes/processes_SaveObjectPermission.php
workflow/engine/methods/processes/processes_UploadFiles.php
workflow/engine/methods/processes/processes_UploadFilesForm.php
workflow/engine/methods/processes/processes_User.php
workflow/engine/methods/processes/processes_subProcessSave.php
workflow/engine/methods/processes/processes_webEntryGenerate.php
workflow/engine/methods/processes/processes_webEntryValidate.php
workflow/engine/methods/processes/webEntry_Val_Assig.php
This commit is contained in:
jennylee
2012-10-17 12:20:58 -04:00
parent 06683e9a3d
commit 57c78b8342
10 changed files with 636 additions and 674 deletions

View File

@@ -1,74 +1,70 @@
<?php <?php
/** /**
* processes_List.php * processes_List.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc. * Copyright (C) 2004 - 2008 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * 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();
require_once 'classes/model/Process.php';
$memcache = & PMmemcached::getSingleton(SYS_SYS);
$memkey = 'no memcache'; $start = isset( $_POST['start'] ) ? $_POST['start'] : 0;
$memcacheUsed = 'not used'; $limit = isset( $_POST['limit'] ) ? $_POST['limit'] : '';
$totalCount = 0;
$oProcess = new Process();
if( isset($_POST['category']) && $_POST['category'] !== '<reset>' ) {
if( isset($_POST['processName']) ) $memcache = & PMmemcached::getSingleton( SYS_SYS );
$proData = $oProcess->getAllProcesses($start, $limit, $_POST['category'], $_POST['processName']);
else $memkey = 'no memcache';
$proData = $oProcess->getAllProcesses($start, $limit, $_POST['category']); $memcacheUsed = 'not used';
} $totalCount = 0;
else {
if( isset($_POST['processName']) ) { if (isset( $_POST['category'] ) && $_POST['category'] !== '<reset>') {
$memkey = 'processList-' . $start . '-' . $limit . '-' . $_POST['processName']; if (isset( $_POST['processName'] ))
$memcacheUsed = 'yes'; $proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'], $_POST['processName'] );
if ( ($proData = $memcache->get( $memkey )) === false ) { else
$proData = $oProcess->getAllProcesses($start, $limit, null, $_POST['processName']); $proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'] );
$memcache->set( $memkey , $proData, PMmemcached::ONE_HOUR ); } else {
$memcacheUsed = 'no'; if (isset( $_POST['processName'] )) {
} $memkey = 'processList-' . $start . '-' . $limit . '-' . $_POST['processName'];
} $memcacheUsed = 'yes';
else { if (($proData = $memcache->get( $memkey )) === false) {
$memkey = 'processList-allProcesses-' . $start . '-' . $limit; $proData = $oProcess->getAllProcesses( $start, $limit, null, $_POST['processName'] );
$memkeyTotal = $memkey . '-total'; $memcache->set( $memkey, $proData, PMmemcached::ONE_HOUR );
$memcacheUsed = 'yes'; $memcacheUsed = 'no';
if ( ($proData = $memcache->get( $memkey )) === false || ($totalCount=$memcache->get( $memkeyTotal)) === false ) { }
$proData = $oProcess->getAllProcesses($start, $limit); } else {
$totalCount = $oProcess->getAllProcessesCount(); $memkey = 'processList-allProcesses-' . $start . '-' . $limit;
$memcache->set( $memkey , $proData, PMmemcached::ONE_HOUR ); $memkeyTotal = $memkey . '-total';
$memcache->set( $memkeyTotal , $totalCount, PMmemcached::ONE_HOUR ); $memcacheUsed = 'yes';
$memcacheUsed = 'no'; 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->memkey = $memkey;
$r->memcache = $memcacheUsed; $r->memcache = $memcacheUsed;
$r->data = $proData; $r->data = $proData;
$r->totalCount = $totalCount; $r->totalCount = $totalCount;
echo G::json_encode($r); echo G::json_encode( $r );

View File

@@ -1,89 +1,78 @@
<?php <?php
/** /**
* processes_SaveEditObjectPermission.php * processes_SaveEditObjectPermission.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/ global $RBAC;
global $RBAC; $access = $RBAC->userCanAccess( 'PM_FACTORY' );
$access = $RBAC->userCanAccess('PM_FACTORY'); if ($access != 1) {
if( $access != 1 ){ switch ($access) {
switch ($access) case - 1:
{ G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
case -1: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; case - 2:
break; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
case -2: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; default:
break; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
default: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; }
break; }
}
} if (isset( $_POST['form'] ))
$sValue = $_POST['form']; //For old processmap
if(isset($_POST['form'])) else
$sValue = $_POST['form']; //For old processmap $sValue = $_POST; //For new processmap EXtjs
else
$sValue = $_POST; //For new processmap EXtjs
list ($iRelation, $sUserGroup) = explode( '|', $sValue['GROUP_USER'] );
list($iRelation, $sUserGroup) = explode('|', $sValue['GROUP_USER']); $sObjectUID = '';
$sObjectUID = ''; switch ($sValue['OP_OBJ_TYPE']) {
switch ($sValue['OP_OBJ_TYPE']) { case 'ANY':
case 'ANY': $sObjectUID = '';
$sObjectUID = ''; break;
break; case 'DYNAFORM':
case 'DYNAFORM': $sObjectUID = $sValue['DYNAFORMS'];
$sObjectUID = $sValue['DYNAFORMS']; break;
break; case 'INPUT':
case 'INPUT': $sObjectUID = $sValue['INPUTS'];
$sObjectUID = $sValue['INPUTS']; break;
break; case 'OUTPUT':
case 'OUTPUT': $sObjectUID = $sValue['OUTPUTS'];
$sObjectUID = $sValue['OUTPUTS']; break;
break; }
} require_once 'classes/model/ObjectPermission.php';
require_once 'classes/model/ObjectPermission.php'; $oOP = new ObjectPermission();
$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'
$aData = array('OP_UID' => $sValue['OP_UID'], );
'PRO_UID' => $sValue['PRO_UID'],
'TAS_UID' => $sValue['TAS_UID']!='' ? $sValue['TAS_UID'] : '0' , $oObj = new ObjectPermission();
'USR_UID' => (string)$sUserGroup, $oObj->update( $aData );
'OP_USER_RELATION' => $iRelation,
'OP_TASK_SOURCE' => $sValue['OP_TASK_SOURCE']!='' ? $sValue['OP_TASK_SOURCE'] : '0', G::LoadClass( 'processMap' );
'OP_PARTICIPATE' => $sValue['OP_PARTICIPATE']!='' ? $sValue['OP_PARTICIPATE'] : 0, $oProcessMap = new ProcessMap();
'OP_OBJ_TYPE' => $sValue['OP_OBJ_TYPE']!='' ? $sValue['OP_OBJ_TYPE'] : '0', $oProcessMap->getObjectsPermissionsCriteria( $sValue['PRO_UID'] );
'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 <?php
/** /**
* processes_Save.php * processes_Save.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/ global $RBAC;
global $RBAC; $access = $RBAC->userCanAccess( 'PM_FACTORY' );
$access = $RBAC->userCanAccess('PM_FACTORY'); if ($access != 1) {
if( $access != 1 ){ switch ($access) {
switch ($access) case - 1:
{ G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
case -1: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; case - 2:
break; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
case -2: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; default:
break; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
default: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; }
break; }
} if (isset( $_POST['form'] ))
} $sValue = $_POST['form']; //For old processmap
if(isset($_POST['form'])) else
$sValue = $_POST['form']; //For old processmap $sValue = $_POST; //For new processmap EXtjs
else
$sValue = $_POST; //For new processmap EXtjs
list ($iRelation, $sUserGroup) = explode( '|', $sValue['GROUP_USER'] );
list($iRelation, $sUserGroup) = explode('|', $sValue['GROUP_USER']); $sObjectUID = '';
$sObjectUID = ''; switch ($sValue['OP_OBJ_TYPE']) {
switch ($sValue['OP_OBJ_TYPE']) { case 'ANY':
case 'ANY': /*case 'ANY_DYNAFORM':
/*case 'ANY_DYNAFORM': case 'ANY_INPUT':
case 'ANY_INPUT': case 'ANY_OUTPUT':*/
case 'ANY_OUTPUT':*/ $sObjectUID = '';
$sObjectUID = ''; break;
break; case 'DYNAFORM':
case 'DYNAFORM': $sObjectUID = $sValue['DYNAFORMS'];
$sObjectUID = $sValue['DYNAFORMS']; break;
break; case 'INPUT':
case 'INPUT': $sObjectUID = $sValue['INPUTS'];
$sObjectUID = $sValue['INPUTS']; break;
break; case 'OUTPUT':
case 'OUTPUT': $sObjectUID = $sValue['OUTPUTS'];
$sObjectUID = $sValue['OUTPUTS']; break;
break; }
} require_once 'classes/model/ObjectPermission.php';
require_once 'classes/model/ObjectPermission.php'; $oOP = new ObjectPermission();
$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']
$aData = array('OP_UID' => G::generateUniqueID(), );
'PRO_UID' =>$sValue['PRO_UID'], $oOP->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
'TAS_UID' => $sValue['TAS_UID'], $oOP->save();
'USR_UID' => (string)$sUserGroup, G::LoadClass( 'processMap' );
'OP_USER_RELATION' => $iRelation, $oProcessMap = new ProcessMap();
'OP_TASK_SOURCE' => $sValue['OP_TASK_SOURCE'], $oProcessMap->getObjectsPermissionsCriteria( $sValue['PRO_UID'] );
'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 <?php
switch ($_POST['form']['MAIN_DIRECTORY']) { switch ($_POST['form']['MAIN_DIRECTORY']) {
case 'mailTemplates': case 'mailTemplates':
$sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['form']['PRO_UID'] . PATH_SEP . ($_POST['form']['CURRENT_DIRECTORY'] != '' ? $_POST['form']['CURRENT_DIRECTORY'] . PATH_SEP : ''); $sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['form']['PRO_UID'] . PATH_SEP . ($_POST['form']['CURRENT_DIRECTORY'] != '' ? $_POST['form']['CURRENT_DIRECTORY'] . PATH_SEP : '');
break; break;
case 'public': case 'public':
$sDirectory = PATH_DATA_PUBLIC . $_POST['form']['PRO_UID'] . PATH_SEP . ($_POST['form']['CURRENT_DIRECTORY'] != '' ? $_POST['form']['CURRENT_DIRECTORY'] . PATH_SEP : ''); $sDirectory = PATH_DATA_PUBLIC . $_POST['form']['PRO_UID'] . PATH_SEP . ($_POST['form']['CURRENT_DIRECTORY'] != '' ? $_POST['form']['CURRENT_DIRECTORY'] . PATH_SEP : '');
break; break;
default: default:
die; die();
break; break;
} }
for ($i = 1; $i <= 5; $i++) { for ($i = 1; $i <= 5; $i ++) {
if ($_FILES['form']['tmp_name']['FILENAME' . (string)$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]); 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>'); 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, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if($_GET['NAVIGATOR']=='ie'){ if ($_GET['NAVIGATOR'] == 'ie') {
$oForm = new Form('processes/processes_UploadFilesForm', '', SYS_LANG); $oForm = new Form( 'processes/processes_UploadFilesForm', '', SYS_LANG );
$oForm->action = 'processes_UploadFiles'; $oForm->action = 'processes_UploadFiles';
$oForm->values = array('PRO_UID' => $_GET['PRO_UID'], $oForm->values = array ('PRO_UID' => $_GET['PRO_UID'],'MAIN_DIRECTORY' => $_GET['MAIN_DIRECTORY'],'CURRENT_DIRECTORY' => $_GET['CURRENT_DIRECTORY']
'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 = '' );
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; $_SESSION['processes_upload'] = $params;
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher = & headPublisher::getSingleton();
$G_PUBLISH->AddContent('view', 'processes/processes_Upload'); $G_PUBLISH->AddContent( 'view', 'processes/processes_Upload' );
G::RenderPage( "publish" , "raw" ); G::RenderPage( "publish", "raw" );
} }

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* processes_User.php * processes_User.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * 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, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * 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 * 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 * @author Everth S. Berrios Morales <everth@colosa.com>
* @LastModification none * @Date 16/05/2008
*/ * @LastModification none
G::LoadThirdParty('pear/json','class.json'); */
G::LoadThirdParty( 'pear/json', 'class.json' );
try { try {
$oJSON = new Services_JSON(); $oJSON = new Services_JSON();
$stdObj = $oJSON->decode(stripslashes($_POST['data'])); $stdObj = $oJSON->decode( stripslashes( $_POST['data'] ) );
if ( isset ($stdObj->pro_uid ) ) if (isset( $stdObj->pro_uid ))
$sProUid = $stdObj->pro_uid; $sProUid = $stdObj->pro_uid;
else else
throw ( new Exception ( 'the process uid is not defined!.' ) ); throw (new Exception( 'the process uid is not defined!.' ));
G::LoadClass('processMap'); G::LoadClass( 'processMap' );
$oProcessMap = new ProcessMap(); $oProcessMap = new ProcessMap();
$c = $oProcessMap->listProcessesUser($sProUid); $c = $oProcessMap->listProcessesUser( $sProUid );
$oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/processmap/core/processUser.js'); $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' );
} $G_PUBLISH = new Publisher();
catch ( Exception $e ){ $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'processes/processes_User', $c, array ('PRO_UID' => $sProUid
$G_PUBLISH = new Publisher; ) );
$aMessage['MESSAGE'] = $e->getMessage(); G::RenderPage( 'publish', 'raw' );
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
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,102 +1,90 @@
<?php <?php
/** /**
* processes_subProcessSave.php * processes_subProcessSave.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/
global $RBAC;
global $RBAC; $access = $RBAC->userCanAccess( 'PM_FACTORY' );
$access = $RBAC->userCanAccess('PM_FACTORY'); if ($access != 1) {
if( $access != 1 ){ switch ($access) {
switch ($access) case - 1:
{ G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
case -1: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; case - 2:
break; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
case -2: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; default:
break; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
default: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; }
break; }
}
} //print_r($_POST); die;
//print_r($_POST); die;
$out = array ();
$out = array(); for ($i = 1; $i <= count( $_POST['form']['grid1'] ); $i ++) {
for($i=1; $i<=count($_POST['form']['grid1']); $i++) $out[$_POST['form']['grid1'][$i]['VAR_OUT1']] = $_POST['form']['grid1'][$i]['VAR_OUT2'];
{ }
$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 = array(); $in[$_POST['form']['grid2'][$j]['VAR_IN1']] = $_POST['form']['grid2'][$j]['VAR_IN2'];
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']);
require_once 'classes/model/Task.php'; //$aTask=$oTask->load($_POST['form']['PRO_UID']);
$oTask= new Task(); $aTask = ($_POST['form']['TASKS'] != 0) ? $oTask->load( $_POST['form']['TASKS'] ) : 0;
//$aTask=$oTask->load($_POST['form']['TASKS']); //$aTask['PRO_UID']=0;
//$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'] == '' ) { }
$_POST['form']['SP_SYNCHRONOUS'] = '0';
} if (! isset( $_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();
require_once 'classes/model/SubProcess.php'; $aData = array ('SP_UID' => $_POST['form']['SP_UID'],//G::generateUniqueID(),
$oOP = new SubProcess(); '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' => ''
$aData = array('SP_UID' => $_POST['form']['SP_UID'],//G::generateUniqueID(), );
'PRO_UID' => (isset($aTask['PRO_UID']))?$aTask['PRO_UID']:'',
'TAS_UID' => $_POST['form']['TASKS'], $oOP->update( $aData );
'PRO_PARENT' => $_POST['form']['PRO_PARENT'],
'TAS_PARENT' => $_POST['form']['TAS_PARENT'], require_once 'classes/model/Content.php';
'SP_TYPE' => 'SIMPLE', $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
'SP_SYNCHRONOUS' => $_POST['form']['SP_SYNCHRONOUS'], //$cont = Content::addContent( 'SP_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] );
'SP_SYNCHRONOUS_TYPE' => 'ALL', $cont = Content::addContent( 'TAS_TITLE', '', $_POST['form']['TAS_PARENT'], $lang, $_POST['form']['SPROCESS_NAME'] );
'SP_SYNCHRONOUS_WAIT' => 0, //$cont = Content::addContent( 'TAS_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] );
'SP_VARIABLES_OUT' => serialize($out), //G::header('location: processes_Map?PRO_UID='. $_POST['form']['PRO_UID']);
'SP_VARIABLES_IN' => serialize($in), die();
'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 <?php
global $G_FORM; global $G_FORM;
$sPRO_UID = $oData->PRO_UID; $sPRO_UID = $oData->PRO_UID;
$sTASKS = $oData->TASKS; $sTASKS = $oData->TASKS;
$sDYNAFORM = $oData->DYNAFORM; $sDYNAFORM = $oData->DYNAFORM;
$sWE_TYPE = $oData->WE_TYPE; $sWE_TYPE = $oData->WE_TYPE;
$sWS_USER = $oData->WS_USER; $sWS_USER = $oData->WS_USER;
$sWS_PASS = $oData->WS_PASS; $sWS_PASS = $oData->WS_PASS;
$sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN; $sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN;
$sWE_USR = $oData->WE_USR; $sWE_USR = $oData->WE_USR;
$withWS = $sWE_TYPE == 'WS'; $withWS = $sWE_TYPE == 'WS';
G::LoadClass("system"); G::LoadClass( "system" );
try { try {
$pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP; $pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP;
G::mk_dir ( $pathProcess, 0777 ); G::mk_dir( $pathProcess, 0777 );
$oTask = new Task ( ); $oTask = new Task();
$TaskFields = $oTask->load ( $sTASKS ); $TaskFields = $oTask->load( $sTASKS );
$WE_EVN_UID = $oTask->getStartingEvent($sTASKS); $WE_EVN_UID = $oTask->getStartingEvent( $sTASKS );
if ($TaskFields['TAS_ASSIGN_TYPE'] != 'BALANCED') { 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'." )); 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' ); G::LoadClass( 'tasks' );
$oTask = new Tasks ( ); $oTask = new Tasks();
$user = $oTask->assignUsertoTask ( $sTASKS ); $user = $oTask->assignUsertoTask( $sTASKS );
if ($user == 0) { if ($user == 0) {
throw (new Exception ( "The task '" . $TaskFields['TAS_TITLE'] . "' doesn't have users." )); throw (new Exception( "The task '" . $TaskFields['TAS_TITLE'] . "' doesn't have users." ));
} }
if (G::is_https ()) if (G::is_https())
$http = 'https://'; $http = 'https://';
else else
$http = 'http://'; $http = 'http://';
$sContent = ''; $sContent = '';
if ($withWS) { if ($withWS) {
//creating sys.info; //creating sys.info;
$SITE_PUBLIC_PATH = ''; $SITE_PUBLIC_PATH = '';
if (file_exists ( $SITE_PUBLIC_PATH . '' )) {} if (file_exists( $SITE_PUBLIC_PATH . '' )) {
}
//creating the first file
require_once 'classes/model/Dynaform.php'; //creating the first file
$oDynaform = new Dynaform ( ); require_once 'classes/model/Dynaform.php';
$aDynaform = $oDynaform->load ( $sDYNAFORM ); $oDynaform = new Dynaform();
$dynTitle = str_replace ( ' ', '_', str_replace ( '/', '_', $aDynaform['DYN_TITLE'] ) ); $aDynaform = $oDynaform->load( $sDYNAFORM );
$sContent = "<?php\n"; $dynTitle = str_replace( ' ', '_', str_replace( '/', '_', $aDynaform['DYN_TITLE'] ) );
$sContent .= "global \$_DBArray;\n"; $sContent = "<?php\n";
$sContent .= "if (!isset(\$_DBArray)) {\n"; $sContent .= "global \$_DBArray;\n";
$sContent .= " \$_DBArray = array();\n"; $sContent .= "if (!isset(\$_DBArray)) {\n";
$sContent .= "}\n"; $sContent .= " \$_DBArray = array();\n";
$sContent .= "\$_SESSION['PROCESS'] = '" . $sPRO_UID . "';\n"; $sContent .= "}\n";
$sContent .= "\$_SESSION['CURRENT_DYN_UID'] = '" . $sDYNAFORM . "';\n"; $sContent .= "\$_SESSION['PROCESS'] = '" . $sPRO_UID . "';\n";
$sContent .= "\$G_PUBLISH = new Publisher;\n"; $sContent .= "\$_SESSION['CURRENT_DYN_UID'] = '" . $sDYNAFORM . "';\n";
$sContent .= "\$G_PUBLISH->AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n"; $sContent .= "\$G_PUBLISH = new Publisher;\n";
$sContent .= "G::RenderPage('publish', 'blank');"; $sContent .= "\$G_PUBLISH->AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n";
file_put_contents ( $pathProcess . $dynTitle . '.php', $sContent ); $sContent .= "G::RenderPage('publish', 'blank');";
//creating the second file, the post file who receive the post form. file_put_contents( $pathProcess . $dynTitle . '.php', $sContent );
$pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; //creating the second file, the post file who receive the post form.
$template = new TemplatePower ( $pluginTpl ); $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl';
$template->prepare (); $template = new TemplatePower( $pluginTpl );
$template->assign ( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); $template->prepare();
$template->assign ( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); $template->assign( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' );
$template->assign ( 'processUid', $sPRO_UID ); $template->assign( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' );
$template->assign ( 'dynaformUid', $sDYNAFORM ); $template->assign( 'processUid', $sPRO_UID );
$template->assign ( 'taskUid', $sTASKS ); $template->assign( 'dynaformUid', $sDYNAFORM );
$template->assign ( 'wsUser', $sWS_USER ); $template->assign( 'taskUid', $sTASKS );
$template->assign ( 'wsPass', 'md5:' . md5 ( $sWS_PASS ) ); $template->assign( 'wsUser', $sWS_USER );
$template->assign ( 'wsRoundRobin', $sWS_ROUNDROBIN ); $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;" ); if ($sWE_USR == "2") {
} else { $template->assign( 'USR_VAR', "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;" );
$template->assign ( 'USR_VAR', '$USR_UID = -1;' ); } else {
} $template->assign( 'USR_VAR', '$USR_UID = -1;' );
}
$template->assign ( 'dynaform', $dynTitle ); $template->assign( 'dynaform', $dynTitle );
$template->assign ( 'timestamp', date ( 'l jS \of F Y h:i:s A' ) ); $template->assign( 'timestamp', date( 'l jS \of F Y h:i:s A' ) );
$template->assign ( 'ws', SYS_SYS ); $template->assign( 'ws', SYS_SYS );
$template->assign ( 'version', System::getVersion() ); $template->assign( 'version', System::getVersion() );
$fileName = $pathProcess . $dynTitle . 'Post.php'; $fileName = $pathProcess . $dynTitle . 'Post.php';
file_put_contents ( $fileName, $template->getOutputContent () ); file_put_contents( $fileName, $template->getOutputContent() );
//creating the third file, only if this wsClient.php file doesn't exist. //creating the third file, only if this wsClient.php file doesn't exist.
$fileName = $pathProcess . 'wsClient.php'; $fileName = $pathProcess . 'wsClient.php';
$pluginTpl = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php'; $pluginTpl = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php';
if ( file_exists ($fileName) ) { if (file_exists( $fileName )) {
if( filesize($fileName) != filesize($pluginTpl) ){ if (filesize( $fileName ) != filesize( $pluginTpl )) {
@copy($fileName, $pathProcess . 'wsClient.php.bck'); @copy( $fileName, $pathProcess . 'wsClient.php.bck' );
@unlink($fileName); @unlink( $fileName );
$template = new TemplatePower ( $pluginTpl ); $template = new TemplatePower( $pluginTpl );
$template->prepare (); $template->prepare();
file_put_contents ( $fileName, $template->getOutputContent () ); file_put_contents( $fileName, $template->getOutputContent() );
} }
} else { } else {
$template = new TemplatePower ( $pluginTpl ); $template = new TemplatePower( $pluginTpl );
$template->prepare (); $template->prepare();
file_put_contents ( $fileName, $template->getOutputContent () ); file_put_contents( $fileName, $template->getOutputContent() );
} }
require_once 'classes/model/Event.php'; require_once 'classes/model/Event.php';
$oEvent = new Event ( ); $oEvent = new Event();
$aDataEvent = array(); $aDataEvent = array ();
$aDataEvent['EVN_UID'] = $WE_EVN_UID; //$oData->WE_EVN_UID; $aDataEvent['EVN_UID'] = $WE_EVN_UID; //$oData->WE_EVN_UID;
$aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE'; $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE';
$aDataEvent['EVN_ACTION'] = $sDYNAFORM; $aDataEvent['EVN_ACTION'] = $sDYNAFORM;
$aDataEvent['EVN_CONDITIONS'] = $sWS_USER; $aDataEvent['EVN_CONDITIONS'] = $sWS_USER;
$output = $oEvent->update($aDataEvent); $output = $oEvent->update( $aDataEvent );
//Show link //Show link
$link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php';
print $link; print $link;
//print "\n<a href='$link' target='_new' > $link </a>"; //print "\n<a href='$link' target='_new' > $link </a>";
} else { } else {
$G_FORM = new Form ( $sPRO_UID . '/' . $sDYNAFORM, PATH_DYNAFORM, SYS_LANG, false ); $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'; $G_FORM->action = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/cases_StartExternal.php';
$scriptCode = ''; $scriptCode = '';
$scriptCode = $G_FORM->render ( PATH_CORE . 'templates/' . 'xmlform' . '.html', $scriptCode ); $scriptCode = $G_FORM->render( PATH_CORE . 'templates/' . 'xmlform' . '.html', $scriptCode );
$scriptCode = str_replace ( '/controls/', $http . $_SERVER['HTTP_HOST'] . '/controls/', $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 ); $scriptCode = str_replace( '/js/maborak/core/images/', $http . $_SERVER['HTTP_HOST'] . '/js/maborak/core/images/', $scriptCode );
//render the template //render the template
$pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentry.tpl'; $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentry.tpl';
$template = new TemplatePower ( $pluginTpl ); $template = new TemplatePower( $pluginTpl );
$template->prepare (); $template->prepare();
require_once 'classes/model/Step.php'; require_once 'classes/model/Step.php';
$oStep = new Step(); $oStep = new Step();
$sUidGrids = $oStep->lookingforUidGrids($sPRO_UID,$sDYNAFORM); $sUidGrids = $oStep->lookingforUidGrids( $sPRO_UID, $sDYNAFORM );
$template->assign( 'siteUrl', $http . $_SERVER['HTTP_HOST'] );
$template->assign ( 'siteUrl', $http . $_SERVER['HTTP_HOST'] ); $template->assign( 'sysSys', SYS_SYS );
$template->assign ( 'sysSys', SYS_SYS ); $template->assign( 'sysLang', SYS_LANG );
$template->assign ( 'sysLang', SYS_LANG ); $template->assign( 'sysSkin', SYS_SKIN );
$template->assign ( 'sysSkin', SYS_SKIN ); $template->assign( 'processUid', $sPRO_UID );
$template->assign ( 'processUid', $sPRO_UID ); $template->assign( 'dynaformUid', $sDYNAFORM );
$template->assign ( 'dynaformUid', $sDYNAFORM ); $template->assign( 'taskUid', $sTASKS );
$template->assign ( 'taskUid', $sTASKS ); $template->assign( 'dynFileName', $sPRO_UID . '/' . $sDYNAFORM );
$template->assign ( 'dynFileName', $sPRO_UID . '/' . $sDYNAFORM ); $template->assign( 'formId', $G_FORM->id );
$template->assign ( 'formId', $G_FORM->id ); $template->assign( 'scriptCode', $scriptCode );
$template->assign ( 'scriptCode', $scriptCode );
if (sizeof( $sUidGrids ) > 0) {
if(sizeof($sUidGrids)>0){ foreach ($sUidGrids as $k => $v) {
foreach($sUidGrids as $k => $v){ $template->newBlock( 'grid_uids' );
$template->newBlock( 'grid_uids' ); $template->assign( 'siteUrl', $http . $_SERVER['HTTP_HOST'] );
$template->assign ( 'siteUrl', $http . $_SERVER['HTTP_HOST'] ); $template->assign( 'gridFileName', $sPRO_UID . '/' . $v );
$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>' );
print_r ( '<textarea cols="70" rows="20">' . htmlentities ( str_replace ( '</body>', '</form></body>', str_replace ( '</form>', '', $template->getOutputContent () ) ) ) . '</textarea>' ); }
}
} catch (Exception $e) {
} catch ( Exception $e ) { $G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher ( ); $aMessage['MESSAGE'] = $e->getMessage();
$aMessage['MESSAGE'] = $e->getMessage (); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); G::RenderPage( 'publish', 'raw' );
G::RenderPage ( 'publish', 'raw' ); }
}

View File

@@ -11,8 +11,8 @@ $sTASKS_SEL = $oData->TASKS_NAME;
//echo $sTASKS."<br>"; //echo $sTASKS."<br>";
$sDYNAFORM = $oData->DYNAFORM; $sDYNAFORM = $oData->DYNAFORM;
$sWE_TYPE = $oData->WE_TYPE; $sWE_TYPE = $oData->WE_TYPE;
$sWS_USER = trim($oData->WS_USER); $sWS_USER = trim( $oData->WS_USER );
$sWS_PASS = trim($oData->WS_PASS); $sWS_PASS = trim( $oData->WS_PASS );
$sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN; $sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN;
$sWE_USR = $oData->WE_USR; $sWE_USR = $oData->WE_USR;
@@ -20,37 +20,41 @@ $sWE_USR = $oData->WE_USR;
//echo ($sTASKS."<br>"); //echo ($sTASKS."<br>");
//echo ($sDYNAFORM."<br>"); //echo ($sDYNAFORM."<br>");
if (G::is_https ())
if (G::is_https())
$http = 'https://'; $http = 'https://';
else else
$http = 'http://'; $http = 'http://';
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; $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; $user = $sWS_USER;
$pass = $sWS_PASS; $pass = $sWS_PASS;
$params = array ('userid' => $user, 'password' => $pass ); $params = array ('userid' => $user,'password' => $pass
$result = $client->__SoapCall ( 'login', array ($params ) ); );
$result = $client->__SoapCall( 'login', array ($params
) );
//$_SESSION ['WS_SESSION_ID'] = ''; //$_SESSION ['WS_SESSION_ID'] = '';
//if ($result->status_code == 0) { //if ($result->status_code == 0) {
// $_SESSION ['WS_SESSION_ID'] = $result->message; // $_SESSION ['WS_SESSION_ID'] = $result->message;
//} //}
$fields ['status_code'] = $result->status_code;
$fields ['message'] = 'ProcessMaker WebService version: ' . $result->version . "\n" . $result->message; $fields['status_code'] = $result->status_code;
$fields ['version'] = $result->version; $fields['message'] = 'ProcessMaker WebService version: ' . $result->version . "\n" . $result->message;
$fields ['time_stamp'] = $result->timestamp; $fields['version'] = $result->version;
$fields['time_stamp'] = $result->timestamp;
$messageCode = 1; $messageCode = 1;
G::LoadClass( 'Task' );
G::LoadClass ( 'Task' ); G::LoadClass( 'User' );
G::LoadClass ( 'User' ); G::LoadClass( 'TaskUser' );
G::LoadClass ( 'TaskUser' ); G::LoadClass( 'Groupwf' );
G::LoadClass ( 'Groupwf' );
/** /**
* note added by gustavo cruz gustavo-at-colosa-dot-com * 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. * 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. * 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 * 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. * somewhere else or maybe delegate the task to the G Class LoadClass method.
**/ */
if(!class_exists('GroupUser')) { if (! class_exists( 'GroupUser' )) {
G::LoadClass ( 'GroupUser' ); G::LoadClass( 'GroupUser' );
} }
// if the user has been authenticated, then check if has the rights or // if the user has been authenticated, then check if has the rights or
// permissions to create the webentry // permissions to create the webentry
if ($result->status_code == 0) { if ($result->status_code == 0) {
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn(UsersPeer::USR_UID); $oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addSelectColumn(TaskUserPeer::USR_UID); $oCriteria->addSelectColumn( TaskUserPeer::USR_UID );
$oCriteria->addSelectColumn(TaskUserPeer::TAS_UID); $oCriteria->addSelectColumn( TaskUserPeer::TAS_UID );
$oCriteria->addJoin(TaskUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); $oCriteria->addJoin( TaskUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN );
$oCriteria->add(TaskUserPeer::TAS_UID, $sTASKS); $oCriteria->add( TaskUserPeer::TAS_UID, $sTASKS );
$oCriteria->add(UsersPeer::USR_USERNAME, $sWS_USER); $oCriteria->add( UsersPeer::USR_USERNAME, $sWS_USER );
//$oCriteria->add(TaskUserPeer::TU_RELATION,1); //$oCriteria->add(TaskUserPeer::TU_RELATION,1);
$userIsAssigned = TaskUserPeer::doCount($oCriteria); $userIsAssigned = TaskUserPeer::doCount( $oCriteria );
// if the user is not assigned directly, maybe a have the task a group with the user // if the user is not assigned directly, maybe a have the task a group with the user
if($userIsAssigned<1) { if ($userIsAssigned < 1) {
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn(UsersPeer::USR_UID); $oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addJoin(UsersPeer::USR_UID, GroupUserPeer::USR_UID, Criteria::LEFT_JOIN); $oCriteria->addJoin( UsersPeer::USR_UID, GroupUserPeer::USR_UID, Criteria::LEFT_JOIN );
$oCriteria->addJoin(GroupUserPeer::GRP_UID, TaskUserPeer::USR_UID, Criteria::LEFT_JOIN); $oCriteria->addJoin( GroupUserPeer::GRP_UID, TaskUserPeer::USR_UID, Criteria::LEFT_JOIN );
$oCriteria->add(TaskUserPeer::TAS_UID, $sTASKS); $oCriteria->add( TaskUserPeer::TAS_UID, $sTASKS );
$oCriteria->add(UsersPeer::USR_USERNAME, $sWS_USER); $oCriteria->add( UsersPeer::USR_USERNAME, $sWS_USER );
$userIsAssigned = GroupUserPeer::doCount($oCriteria); $userIsAssigned = GroupUserPeer::doCount( $oCriteria );
if (!($userIsAssigned>=1)) { if (! ($userIsAssigned >= 1)) {
$messageCode = "The User \"".$sWS_USER."\" doesn't have the task \"".$sTASKS_SEL."\" assigned"; $messageCode = "The User \"" . $sWS_USER . "\" doesn't have the task \"" . $sTASKS_SEL . "\" assigned";
}
}
} else {
$messageCode = $result->message;
} }
}
} else {
$messageCode = $result->message;
}
echo ($messageCode); echo ($messageCode);
?> ?>

View File

@@ -1,32 +1,32 @@
<?php <?php
/** /**
* webEntryValidate_Val_assig * webEntryValidate_Val_assig
* it gets the assign type for the task * it gets the assign type for the task
* with pro_uid and tas_uid * with pro_uid and tas_uid
*/ */
$sPRO_UID = $oData->PRO_UID; $sPRO_UID = $oData->PRO_UID;
$sTASKS = $oData->TASKS; $sTASKS = $oData->TASKS;
$sDYNAFORM = $oData->DYNAFORM; $sDYNAFORM = $oData->DYNAFORM;
if (G::is_https())
if (G::is_https ()) $http = 'https://';
$http = 'https://'; else
else $http = 'http://';
$http = 'http://';
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; @$client = new SoapClient( $endpoint );
@$client = new SoapClient ( $endpoint );
G::LoadClass( 'Task' );
G::LoadClass( 'User' );
G::LoadClass ( 'Task' ); G::LoadClass( 'TaskUser' );
G::LoadClass ( 'User' );
G::LoadClass ( 'TaskUser' ); $oTask = new Task();
$TaskFields = $oTask->kgetassigType( $sPRO_UID, $sTASKS );
$oTask = new Task ( );
$TaskFields = $oTask->kgetassigType ( $sPRO_UID, $sTASKS ); if ($TaskFields['TAS_ASSIGN_TYPE'] == 'BALANCED')
echo 1;
if ($TaskFields['TAS_ASSIGN_TYPE'] == 'BALANCED')echo 1; else
else echo 0; echo 0;
?> ?>