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
/**
* 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

@@ -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,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;
?>