Merge remote branch 'upstream/master'

Conflicts:
	workflow/engine/methods/services/xpdl.php
This commit is contained in:
jennylee
2012-10-17 14:36:11 -04:00
151 changed files with 9866 additions and 41562 deletions

View File

@@ -133,7 +133,7 @@ function expandNode()
global $RBAC;
$user = ($RBAC->userCanAccess('PM_ALLCASES') == 1)? '' : $_SESSION['USER_LOGGED'];
$folderContentObj = $oPMFolder->getFolderContent ($_POST ['node'] != 'root' ?
$_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder, array(), null, null, $limit, $start, $user);
$_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder, array(), null, null, $limit, $start, $user, true);
$folderContent=$folderContentObj['documents'];
$totalDocuments=$folderContentObj['totalDocumentsCount'];
$totalItems+=count($folderContent);

View File

@@ -1,301 +0,0 @@
<?php
/**
* cases_Scheduler_Save.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2010 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
/*
global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY'))
{
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
*/
require_once 'classes/model/CaseScheduler.php';
$oCaseScheduler = new CaseScheduler();
if (empty($_POST)) {
die('The information sended is empty!');
}
if(empty($_POST['SCH_UID']))
$aData['SCH_UID'] = G::generateUniqueID();
else
$aData['SCH_UID'] = $_POST['SCH_UID'];
$aData['SCH_NAME'] = $_POST['SCH_NAME'];
$aData['SCH_DEL_USER_NAME'] = $_POST['SCH_DEL_USER_NAME'];
$aData['SCH_DEL_USER_PASS'] = md5($_POST['SCH_USER_PASSWORD']);
$aData['SCH_DEL_USER_UID'] = $_POST['SCH_DEL_USER_UID'];
$aData['PRO_UID'] = $_POST['PRO_UID'];
$aData['TAS_UID'] = $_POST['TAS_UID'];
$aData['SCH_STATE'] = 'ACTIVE';
$aData['SCH_LAST_STATE'] = 'CREATED'; // 'ACTIVE';
$aData['USR_UID'] = $_SESSION['USER_LOGGED'];
$sOption = $_POST['SCH_OPTION'];
if($sOption == 'Daily')
{
$aData['SCH_OPTION'] = '1';
$sOption = '1';
}
else if($sOption == 'Weekly')
{
$aData['SCH_OPTION'] = '2';
$sOption = '2';
}
else if($sOption == 'Monthly')
{
$aData['SCH_OPTION'] = '3';
$sOption = '3';
}
else if($sOption == 'One time only')
{
$aData['SCH_OPTION'] = '4';
$sOption = '4';
}
if ($_POST['SCH_START_DATE']!=''){
$sDateTmp = $_POST['SCH_START_DATE'];
} else {
$sDateTmp = date('Y-m-d');
}
$sTimeTmp = $_POST['SCH_START_TIME'];
$aData['SCH_START_TIME'] = date('Y-m-d', strtotime($sDateTmp)) . ' ' . date('H:i:s', strtotime($sTimeTmp));
$aData['SCH_START_DATE'] = date('Y-m-d', strtotime($sDateTmp)) . ' ' . date('H:i:s', strtotime($sTimeTmp));
$nActualTime = $_POST['SCH_START_TIME']; // time();
// $nActualDate = date("Y-m-d H:i:s", $nActualTime);
$sValue = '';
$sDaysPerformTask = '';
$sWeeks = '';
$sMonths = '';
$sMonths = '';
$sStartDay = '';
$nSW = 0;
switch($sOption){
case '1' : // Option 1
$sValue = $_POST['SCH_DAYS_PERFORM_TASK'];
switch($sValue){
case '1' : $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['SCH_DAYS_PERFORM_TASK'] . '|1';
break;
case '2' :
$aData['SCH_OPTION'] = '2';
$aData['SCH_EVERY_DAYS'] = '1';
$aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|';
break;
case '3' : // Every [n] Days
$sDaysPerformTask = $_POST['SCH_DAYS_PERFORM_TASK_OPT_3'];
$aData['SCH_DAYS_PERFORM_TASK'] = $_POST['SCH_DAYS_PERFORM_TASK'] . '|' . $_POST['SCH_DAYS_PERFORM_TASK_OPT_3'];
break;
}
break;
case '2' : // If the option is zero, set by default 1
if(empty($_POST['SCH_EVERY_DAYS']))
$nEveryDays = 1;
else
$nEveryDays = $_POST['SCH_EVERY_DAYS'];
$aData['SCH_EVERY_DAYS'] = $nEveryDays;
$sWeeks = '';
if(!empty($_POST['SCH_WEEK_DAYS'])){
$aWeekDays = explode(',',$_POST['SCH_WEEK_DAYS']);
foreach($aWeekDays as $value) {
$sWeeks = $sWeeks . $value . '|';
}
}
/*if(!empty($_POST['SCH_WEEK_DAYS_2'])){
$aWeekDays2 = $_POST['SCH_WEEK_DAYS_2'];
foreach($aWeekDays2 as $value) {
$sWeeks = $sWeeks . $value . '|';
}
}*/
$sStartTime = $_POST['SCH_START_TIME'];
$aData['SCH_WEEK_DAYS'] = $sWeeks;
break;
case '3' :
$nStartDay = $_POST['SCH_START_DAY'];
if($nStartDay == 'Day of Month')
$nStartDay = 1;
else if($nStartDay == 'The Day')
$nStartDay = 2;
$sStartDayOpt2Week = $_POST['SCH_START_DAY_OPT_2_WEEKS'];
switch($sStartDayOpt2Week){
case 'First':
$sStartDayOpt2Week = 1;
break;
case 'Second':
$sStartDayOpt2Week = 2;
break;
case 'Third':
$sStartDayOpt2Week = 3;
break;
case 'Fourth':
$sStartDayOpt2Week = 4;
break;
case 'Last':
$sStartDayOpt2Week = 5;
break;
}
$sStartDayOpt2DayWeek = $_POST['SCH_START_DAY_OPT_2_DAYS_WEEK'];
switch($sStartDayOpt2DayWeek){
case 'Monday':
$sStartDayOpt2DayWeek = 1;
break;
case 'Tuesday':
$sStartDayOpt2DayWeek = 2;
break;
case 'Wednesday':
$sStartDayOpt2DayWeek = 3;
break;
case 'Thursday':
$sStartDayOpt2DayWeek = 4;
break;
case 'Friday':
$sStartDayOpt2DayWeek = 5;
break;
case 'Saturday':
$sStartDayOpt2DayWeek = 6;
break;
case 'Sunday':
$sStartDayOpt2DayWeek = 7;
break;
}
if($nStartDay == 1){
$aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['SCH_START_DAY_OPT_1'];
} else {
$aData['SCH_START_DAY'] = $nStartDay . '|' . $sStartDayOpt2Week . '|' . $sStartDayOpt2DayWeek;
}
$sMonths = '';
if(!empty($_POST['SCH_MONTHS'])){
//$aMonths = $_POST['SCH_MONTHS'];
$aMonths = explode(',',$_POST['SCH_MONTHS']);
foreach($aMonths as $value) {
$sMonths = $sMonths . $value . '|' ;
}
}
/*if(!empty($_POST['SCH_MONTHS_2'])){
$aMonths2 = $_POST['SCH_MONTHS_2'];
foreach($aMonths2 as $value) {
$sMonths = $sMonths . $value . '|' ;
}
}
if(!empty($_POST['SCH_MONTHS_3'])){
$aMonths3 = $_POST['SCH_MONTHS_3'];
foreach($aMonths3 as $value) {
$sMonths = $sMonths . $value . '|' ;
}
} */
$aData['SCH_MONTHS'] = $sMonths;
$sStartDay = $aData['SCH_START_DAY'];
$sValue = $nStartDay;
break;
}
if(($sOption!='1') && ($sOption!='4')) {
if ($sStartDay==''){
$sStartDay = date('Y-m-d');
}
// echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."<br>";
$dCurrentDay = date("d");
$dCurrentMonth = date("m");
$aStartDay = explode( "|" , $aData['SCH_START_DAY'] );
if($sOption=='3'&&$aStartDay[0]=='1'){
$monthsArray = explode("|",$sMonths);
foreach ($monthsArray as $row){
if ( $dCurrentMonth == $row && $dCurrentDay<$aStartDay[1] ){
$startTime = $_POST['SCH_START_TIME'].":00";
$aData['SCH_TIME_NEXT_RUN'] = date('Y') . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime;
break;
} else {
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun($sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp);
}
}
} else {
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun($sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp);
}
// print_r ($aData['SCH_TIME_NEXT_RUN']);
// die;
} else {
if ($sOption=='4'){
$aData['SCH_END_DATE'] = $aData['SCH_START_TIME'];
}
$aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME'];
}
if(trim($_POST['SCH_END_DATE'])!=''){
$aData['SCH_END_DATE'] = $_POST['SCH_END_DATE'];
}
if(!empty($_POST['SCH_REPEAT_TASK_CHK'])){
$nOptEvery = $_POST['SCH_REPEAT_EVERY_OPT'];
if($nOptEvery ==2)
$aData['SCH_REPEAT_EVERY'] = $_POST['SCH_REPEAT_EVERY'] * 60;
else
$aData['SCH_REPEAT_EVERY'] = $_POST['SCH_REPEAT_EVERY'];
}
//$aData['SCH_END_DATE'] = "2020-12-30";
if(empty($_POST['SCH_UID']))
$oCaseScheduler->create($aData);
else
$oCaseScheduler->update($aData);
//Save Scheduler_uid in the Event Table for Start Timer.
$oData['EVN_UID']= $_POST['EVN_UID'];
$oData['EVN_ACTION']= $aData['SCH_UID'];
require_once "classes/model/Event.php";
$oEvent = new Event();
$oEvent->update($oData);
echo "{success: true}";
//G::header('location: cases_Scheduler_List');
}
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -1,249 +0,0 @@
<?php
/**
* events_EditAction.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;
global $_DBArray;
if ($RBAC->userCanAccess('PM_SETUP') != 1) {
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
}
if ( isset ($_SESSION['EVN_UID']) ) {
$evnUid = $_SESSION['EVN_UID'];
unset ( $_SESSION['EVN_UID'] );
}
else
$evnUid = $_GET['EVN_UID'];
require_once 'classes/model/Event.php';
require_once 'classes/model/Triggers.php';
$oEvent = new Event();
$oTrigger = new Triggers();
$aFields = $oEvent->load( $evnUid );
$parameters = unserialize ( $oEvent->getEvnActionParameters() );
//g::pr($parameters); die;
$aTrigger = $oTrigger->load($aFields['TRI_UID']);
$hash = md5 ( $oTrigger->getTriWebbot() );
//var_dump($hash,$parameters->hash);die;
//if the hash is different, the script was edited , so we will show the trigger editor.
if ( ( isset($parameters->hash) && $hash <> $parameters->hash ) || $aFields['EVN_ACTION'] == 'EXECUTE_TRIGGER' || $aFields['EVN_ACTION'] == 'EXECUTE_CONDITIONAL_TRIGGER' ) {
$oTriggerParams = unserialize($aTrigger['TRI_PARAM']);
// check again a hash, this time to check the trigger itself integrity
if ($oTriggerParams['hash']!=$hash){
// if has changed edit manually
G::LoadClass('xmlfield_InputPM');
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'triggers/triggersNarrowEdit', '', $aTrigger, '../events/triggersSave');
G::RenderPage('publish', 'raw');
die;
} else {
// if not launch the wizard view.
$triUid = $aFields['TRI_UID'];
$_GET = $oTriggerParams['params'];
$_GET['TRI_UID'] = $triUid;
require_once(PATH_METHODS.'triggers/triggers_EditWizard.php');
die;
}
}
$aFields['EVN_MESSAGE_SUBJECT'] = (isset($parameters->SUBJECT) ? $parameters->SUBJECT : '');
if(isset($parameters->TO)){
$paramTO[] = Array('id'=>'char', 'name'=>'char');
//echo '<pre>';print_r($parameters->TO);
foreach($parameters->TO as $item){
$row = explode('|', $item);
switch($row[0]){
case 'usr':
require_once('classes/model/Users.php');
$user = new Users();
if($row[1] == '-1'){
$value = '(Current Task User)';
} else {
$rec = $user->load($row[1]);
$value = $rec['USR_FIRSTNAME'].' '.$rec['USR_LASTNAME'];
}
break;
case 'grp':
G::LoadClass('groups');
$group = new Groups();
$rec = $group->load($row[1]);
$value = strip_tags($rec->getGrpTitle());
break;
case 'ext':
$value = htmlentities($row[1]);
break;
case 'dyn':
$value = htmlentities('@#'.$row[1]);
break;
default:
echo '->'.$row[0];
}
$paramTO[] = Array('id'=>replaceQuotes($item), 'name'=>$value);
}
} else {
$paramTO[] = Array('id'=>'char', 'name'=>'char');
$paramTO[] = Array('id'=>'usr|-1', 'name'=>'(Current Task User)');
}
$_DBArray['eventomsgto'] = $paramTO;
if(isset($parameters->CC)){
$paramCC[] = Array('id'=>'char', 'name'=>'char');
foreach($parameters->CC as $item){
$row = explode('|', $item);
switch($row[0]){
case 'usr':
require_once('classes/model/Users.php');
$user = new Users();
if($row[1] == '-1'){
$value = '(Current Task User)';
} else {
$rec = $user->load($row[1]);
$value = $rec['USR_FIRSTNAME'].' '.$rec['USR_LASTNAME'];
}
break;
case 'grp':
G::LoadClass('groups');
$group = new Groups();
$rec = $group->load($row[1]);
$value = strip_tags($rec->getGrpTitle());
break;
case 'ext':
$value = htmlentities($row[1]);
break;
case 'dyn':
$value = htmlentities('@#'.$row[1]);
break;
}
$paramCC[] = Array('id'=>replaceQuotes($item), 'name'=>$value);
}
$_DBArray['eventomsgcc'] = $paramCC;
} else {
$_DBArray['eventomsgcc'] = Array();
}
if(isset($parameters->BCC)){
$paramBCC[] = Array('id'=>'char', 'name'=>'char');
foreach($parameters->BCC as $item){
$row = explode('|', $item);
switch($row[0]){
case 'usr':
require_once('classes/model/Users.php');
$user = new Users();
if($row[1] == '-1'){
$value = '(Current Task User)';
} else {
$rec = $user->load($row[1]);
$value = $rec['USR_FIRSTNAME'].' '.$rec['USR_LASTNAME'];
}
break;
case 'grp':
G::LoadClass('groups');
$group = new Groups();
$rec = $group->load($row[1]);
$value = strip_tags($rec->getGrpTitle());
break;
case 'ext':
$value = htmlentities($row[1]);
break;
case 'dyn':
$value = htmlentities('@#'.$row[1]);
break;
}
$paramBCC[] = Array('id'=>replaceQuotes($item), 'name'=>$value);
}
$_DBArray['eventomsgbcc'] = $paramBCC;
} else {
$_DBArray['eventomsgbcc'] = Array();
}
$aFields['EVN_MESSAGE_TO_TO'] = $paramTO;
$aFields['EVN_MESSAGE_TO_CC'] = (isset($parameters->CC) ? $paramCC : '');
$aFields['EVN_MESSAGE_TO_BCC'] = (isset($parameters->BCC) ? $paramBCC : '');
$aFields['EVN_MESSAGE_TEMPLATE'] = (isset($parameters->TEMPLATE) ? $parameters->TEMPLATE : '');
$aTemplates = array();
$aTemplates[] = array('TEMPLATE1' => 'char',
'TEMPLATE2' => 'char');
$sDirectory = PATH_DATA_MAILTEMPLATES . $aFields['PRO_UID'] . PATH_SEP;
G::verifyPath($sDirectory, true);
if (!file_exists($sDirectory . 'alert_message.html')) {
@copy(PATH_TPL . 'mails' . PATH_SEP . 'alert_message.html', $sDirectory . 'alert_message.html');
}
$oDirectory = dir($sDirectory);
while ($sObject = $oDirectory->read()) {
if (($sObject !== '.') && ($sObject !== '..') && ($sObject !== 'alert_message.html')) {
$aTemplates[] = array('TEMPLATE1' => $sObject,
'TEMPLATE2' => $sObject);
}
}
$_DBArray['templates'] = $aTemplates;
$aTriggers[] = array('TRI_UID' => 'char',
'TRI_TITLE' => 'char');
G::LoadClass('processMap');
$oProcessMap = new ProcessMap();
$oDataset = TriggersPeer::doSelectRS($oProcessMap->getTriggersCriteria($aFields['PRO_UID']));
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aTriggers[] = array('TRI_UID' => $aRow['TRI_UID'],
'TRI_TITLE' => $aRow['TRI_TITLE']);
$oDataset->next();
}
$_DBArray['triggers'] = $aTriggers;
$_SESSION['_DBArray'] = $_DBArray;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'events/eventsEditAction', '', $aFields, '../events/eventsSave');
//$G_PUBLISH->AddContent('xmlform', 'xmlform', 'events/eventsEditAction', '', $aFields, '../events/eventsSave');
G::RenderPage('publish', 'raw');
function replaceQuotes($aData){
return str_replace('"', '&quote;', $aData);
}

View File

@@ -1,56 +0,0 @@
<?php
/**
* cases_Events_Save.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2010 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
$oJSON = new Services_JSON();
if ( isset ($_POST['sData']) ) {
$oData = $oJSON->decode($_POST['sData']);
}
//Convert Object into Array
foreach($oData as $key=>$value)
{
$aData[$key] = $value;
}
require_once 'classes/model/Event.php';
$oEvent = new Event();
if (!isset($aData['EVN_UID']) && $aData['EVN_UID'] == '' ) {
$sEventUid = $oEvent->create($aData);
}
else
$sEventUid = $oEvent->update($aData);
$_SESSION['EVN_UID'] = $sEventUid;
echo "{success: true,data:'.$sEventUid.'}";
//G::header('location: cases_Scheduler_List');
}
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -1,170 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
if ( isset($_GET['tid'] ) )
{
$rows = $oProcessMap->getExtStepsCriteria($_GET['tid']); //Getting all assigned steps on a task
array_shift($rows);
}
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}
$steps = array();
//@@stepsChildren is an array that stores before and after triggers tree data for a step
$stepsChildren = array();
$assignChildren = array();
//@@assignTaskChildren is an array that stores Before Assignment,Before Derivation and After Derivation triggers tree data for assigned task
$assignTaskChildren = array();
//Creating steps array for populating tree depending on count of assigned steps to a task
for($i=0;$i<count($rows);$i++)
{
//Getting beforeTriggersCount for a step
$beforeTriggers = $oProcessMap->getStepTriggersCriteria($rows[$i]['STEP_UID'], $_GET['tid'], 'BEFORE');
$beforeTriggersCount = StepTriggerPeer::doCount($beforeTriggers);
//Getting afterTriggersCount for a step
$afterTriggers = $oProcessMap->getStepTriggersCriteria($rows[$i]['STEP_UID'], $_GET['tid'], 'AFTER');
$afterTriggersCount = StepTriggerPeer::doCount($afterTriggers);
$iTotal = $beforeTriggersCount + $afterTriggersCount;
//Tree level 3 nodes i.e. final nodes (Leaf Nodes)
$beforeTriggerChildren[0] = array(
'text' => 'Assign / Show Before Triggers',
'id' => $rows[$i]['STEP_UID'].'|BEFORE',
'leaf' => true,
);
$afterTriggerChildren[0] = array(
'text' => 'Assign / Show After Triggers',
'id' => $rows[$i]['STEP_UID'].'|AFTER',
'leaf' => true,
);
//Tree level 2 nodes i.e. Before and After Triggers for level 1 nodes
$stepsChildren[0] = array(
'text' => 'Before - Triggers ('.$beforeTriggersCount.')',
//'id' => $rows[$i]['STEP_UID'].'-BEFORE',
'children' => $beforeTriggerChildren
);
$stepsChildren[1] = array(
'text' => 'After - Triggers ('.$afterTriggersCount.')',
//'id' => $rows[$i]['STEP_UID'].'-AFTER',
'children' => $afterTriggerChildren
);
//Tree level 1 nodes (Main steps)
$steps[] = array(
'text' => $rows[$i]['STEP_TITLE'].' - Triggers ('.$iTotal.')',
//'id' => 'ssaas',
'children' => $stepsChildren
);
}
//Creating tree for Assign Task Step
$beforeAssignmentChildren[] = array(
'text' => 'Assign / Show Triggers',
'id' => '-1|BEFORE',
'leaf' => true,
);
$beforeDerivationChildren[] = array(
'text' => 'Assign / Show Triggers',
'id' => '-2|BEFORE',
'leaf' => true,
);
$afterDerivationChildren[] = array(
'text' => 'Assign / Show Triggers',
'id' => '-2|AFTER',
'leaf' => true,
);
//Getting counts for Before Assignment,Before Derivation and After Derivation triggers for a step
$beforeAssignmentTriggers = $oProcessMap->getStepTriggersCriteria('-1', $_GET['tid'], 'BEFORE');
$beforeAssignmentTriggersCount = StepTriggerPeer::doCount($beforeAssignmentTriggers);
$beforeDerivationTriggers = $oProcessMap->getStepTriggersCriteria('-2', $_GET['tid'], 'BEFORE');
$beforeDerivationTriggersCount = StepTriggerPeer::doCount($beforeDerivationTriggers);
$afterDerivationTriggers = $oProcessMap->getStepTriggersCriteria('-2', $_GET['tid'], 'AFTER');
$afterDerivationTriggersCount = StepTriggerPeer::doCount($afterDerivationTriggers);
$iTotal = $beforeAssignmentTriggersCount + $beforeDerivationTriggersCount + $afterDerivationTriggersCount;
$assignTaskChildren[] = array(
'text' => 'Before Assignment - Triggers ('.$beforeAssignmentTriggersCount.')',
'children' => $beforeAssignmentChildren
);
$assignTaskChildren[] = array(
'text' => 'Before Derivation - Triggers ('.$beforeDerivationTriggersCount.')',
'children' => $beforeDerivationChildren
);
$assignTaskChildren[] = array(
'text' => 'After Derivation - Triggers ('.$afterDerivationTriggersCount.')',
'children' => $afterDerivationChildren
);
//Adding last value in an array for "Assign Task"
$steps[] = array(
'text' => '[ Assign Task ] - Triggers ('.$iTotal.')',
//'id' => $rows[$i]['STEP_UID'],
'children' => $assignTaskChildren
);
/* $nodes = "[{
text: 'Step 1 - Triggers (0)',
cls: 'blank',
iconCls: 'blank',
children: [{
text: 'Before - Triggers (0)',
cls: 'blank',
iconCls: 'blank',
children: [{
text: 'Assign Before Trigger',
leaf: true,
}]
},{
text: 'After - Triggers (0)',
leaf: true,
cls: 'blank',
iconCls: 'blank',
}]
},{
text: 'Step 2 - Triggers (0)',
children: [{
text: 'Before - Triggers (0)',
leaf: true,
},{
text: 'After - Triggers (0)',
leaf: true,
}]
},{
text: 'Assign Task - Triggers(0)',
children: [{
text: 'Before Assigment - Triggers(0)',
leaf: true,
},{
text: 'Before Derivation - Triggers(0)',
leaf: true,
},{
text: 'After Derivation - Triggers(0)',
leaf: true,
}]
}]";*/
//echo $nodes;
echo G::json_encode($steps);

View File

@@ -1,124 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
$start = isset($_POST['start'])? $_POST['start']: 0;
$limit = isset($_POST['limit'])? $_POST['limit']: '';
if ( isset($_GET['tid'] ) )
{
$rows = $oProcessMap->getExtStepsCriteria($start, $limit, $_GET['tid']); //Getting all assigned steps on a task
array_shift($rows);
}
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}
$steps = array();
//@@stepsChildren is an array that stores before and after triggers tree data for a step
$stepsChildren = array();
$assignChildren = array();
//@@assignTaskChildren is an array that stores Before Assignment,Before Derivation and After Derivation triggers tree data for assigned task
$assignTaskChildren = array();
//Creating steps array for populating tree depending on count of assigned steps to a task
for($i=0;$i<count($rows);$i++)
{
//Getting beforeTriggersCount for a step
$beforeTriggers = $oProcessMap->getStepTriggersCriteria($rows[$i]['STEP_UID'], $_GET['tid'], 'BEFORE');
$beforeTriggersCount = StepTriggerPeer::doCount($beforeTriggers);
//Getting afterTriggersCount for a step
$afterTriggers = $oProcessMap->getStepTriggersCriteria($rows[$i]['STEP_UID'], $_GET['tid'], 'AFTER');
$afterTriggersCount = StepTriggerPeer::doCount($afterTriggers);
$iTotal = $beforeTriggersCount + $afterTriggersCount;
//Tree level 3 nodes i.e. final nodes (Leaf Nodes)
$beforeTriggerChildren[0] = array(
'text' => 'Assign / Show Before Triggers',
'id' => $rows[$i]['STEP_UID'].'|BEFORE',
'leaf' => true,
);
$afterTriggerChildren[0] = array(
'text' => 'Assign / Show After Triggers',
'id' => $rows[$i]['STEP_UID'].'|AFTER',
'leaf' => true,
);
//Tree level 2 nodes i.e. Before and After Triggers for level 1 nodes
$stepsChildren[0] = array(
'text' => 'Before - Triggers ('.$beforeTriggersCount.')',
//'id' => $rows[$i]['STEP_UID'].'-BEFORE',
'children' => $beforeTriggerChildren
);
$stepsChildren[1] = array(
'text' => 'After - Triggers ('.$afterTriggersCount.')',
//'id' => $rows[$i]['STEP_UID'].'-AFTER',
'children' => $afterTriggerChildren
);
//Tree level 1 nodes (Main steps)
$steps[] = array(
'text' => $rows[$i]['STEP_TITLE'].' - Triggers ('.$iTotal.')',
//'id' => 'ssaas',
'children' => $stepsChildren
);
}
//Creating tree for Assign Task Step
$beforeAssignmentChildren[] = array(
'text' => 'Assign / Show Triggers',
'id' => '-1|BEFORE',
'leaf' => true,
);
$beforeDerivationChildren[] = array(
'text' => 'Assign / Show Triggers',
'id' => '-2|BEFORE',
'leaf' => true,
);
$afterDerivationChildren[] = array(
'text' => 'Assign / Show Triggers',
'id' => '-2|AFTER',
'leaf' => true,
);
//Getting counts for Before Assignment,Before Derivation and After Derivation triggers for a step
$beforeAssignmentTriggers = $oProcessMap->getStepTriggersCriteria('-1', $_GET['tid'], 'BEFORE');
$beforeAssignmentTriggersCount = StepTriggerPeer::doCount($beforeAssignmentTriggers);
$beforeDerivationTriggers = $oProcessMap->getStepTriggersCriteria('-2', $_GET['tid'], 'BEFORE');
$beforeDerivationTriggersCount = StepTriggerPeer::doCount($beforeDerivationTriggers);
$afterDerivationTriggers = $oProcessMap->getStepTriggersCriteria('-2', $_GET['tid'], 'AFTER');
$afterDerivationTriggersCount = StepTriggerPeer::doCount($afterDerivationTriggers);
$iTotal = $beforeAssignmentTriggersCount + $beforeDerivationTriggersCount + $afterDerivationTriggersCount;
$assignTaskChildren[] = array(
'text' => 'Before Assignment - Triggers ('.$beforeAssignmentTriggersCount.')',
'children' => $beforeAssignmentChildren
);
$assignTaskChildren[] = array(
'text' => 'Before Derivation - Triggers ('.$beforeDerivationTriggersCount.')',
'children' => $beforeDerivationChildren
);
$assignTaskChildren[] = array(
'text' => 'After Derivation - Triggers ('.$afterDerivationTriggersCount.')',
'children' => $afterDerivationChildren
);
//Adding last value in an array for "Assign Task"
$steps[] = array(
'text' => '[ Assign Task ] - Triggers ('.$iTotal.')',
//'id' => $rows[$i]['STEP_UID'],
'children' => $assignTaskChildren
);
echo G::json_encode($steps);

View File

@@ -1,272 +0,0 @@
<?php
/**
* openProcess.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.
*
*/
G::LoadClass('xpdl');
$processUID = $_REQUEST['PRO_UID'];
$oProcess = new Xpdl();
$fields = $oProcess->serializeProcess($processUID);
$oData = unserialize($fields);
$arrayTasks = array();
$countTasks = 0;
$countSubProcess= 0;
$arrayEvents = array();
$arraySubProcess= array();
$count = 0;
$countRoutes = 0;
$arrayRoutes = array();
$process = array();
$process = $oProcess->createProcessPM($oData->process);
foreach($oData->tasks as $id => $value)
{
if($value['TAS_TYPE'] == 'SUBPROCESS'){
$arraySubProcess[$countSubProcess]['0'] = $value['TAS_UID'];
$arraySubProcess[$countSubProcess]['1'] = $value['TAS_TITLE'];
$arraySubProcess[$countSubProcess]['2'] = $value['TAS_POSX'];
$arraySubProcess[$countSubProcess]['3'] = $value['TAS_POSY'];
$countSubProcess = $countSubProcess + 1;
}
else
{
$arrayTasks[$countTasks]['0'] = $value['TAS_UID'];
$arrayTasks[$countTasks]['1'] = $value['TAS_TITLE'];
$arrayTasks[$countTasks]['2'] = $value['TAS_POSX'];
$arrayTasks[$countTasks]['3'] = $value['TAS_POSY'];
$arrayTasks[$countTasks]['4'] = $value['TAS_WIDTH'];
$arrayTasks[$countTasks]['5'] = $value['TAS_HEIGHT'];
$arrayTasks[$countTasks]['6'] = $value['TAS_BOUNDARY'];
if($value['TAS_START'] == 'TRUE'){
$arrayEvents[$count]['0'] = G::generateUniqueID();
if($value['TAS_EVN_UID'] == '')
{
$arrayEvents[$count]['1'] = 'bpmnEventEmptyStart';
}
else
{
foreach($oData->event as $eventid => $val){
if($val['EVN_UID'] == $value['TAS_EVN_UID'])
{
$arrayEvents[$count]['0'] = $val['EVN_UID'];
$arrayEvents[$count]['1'] = $val['EVN_TYPE'];
break;
}
}
}
$arrayEvents[$count]['2'] = $value['TAS_POSX']+68;
$arrayEvents[$count]['3'] = $value['TAS_POSY']-50;
$arrayEvents[$count]['4'] = $value['TAS_UID'];
$arrayRoutes[$countRoutes]['0']= G::generateUniqueID();
$arrayRoutes[$countRoutes]['1']= $arrayEvents[$count]['0'];
$arrayRoutes[$countRoutes]['2']= $value['TAS_UID'];
$arrayRoutes[$countRoutes]['3']= '1';
$arrayRoutes[$countRoutes]['4']= '2';
$count = $count+ 1;
$countRoutes = $countRoutes+ 1;
}
$countTasks = $countTasks + 1;
}
}
$lanes = $oProcess->createLanesNewPM($oData->lanes);
$fields = $oProcess->createTransitionsPM($oData->tasks,$oData->routes,$arrayEvents,$count,$arrayRoutes,$countRoutes);
//Get Standalone Events and routes
$countEvent = count($fields['EVENTS']);
$countRoutes = count($fields['TRANSITION']);
foreach($oData->event as $id => $value)
{
if($value['TAS_UID'] == '' && $value['EVN_TAS_UID_FROM'] != '' && $value['EVN_TAS_UID_TO'] != ''){ //Check for Intermediate Events
$evn_uid = $value['EVN_UID'];
$idTaskFrom = $value['EVN_TAS_UID_FROM'];
$idTaskTo = $value['EVN_TAS_UID_TO'];
$fields['EVENTS'][$countEvent]['0'] = $value['EVN_UID'];
$fields['EVENTS'][$countEvent]['1'] = $value['EVN_TYPE'];
$fields['EVENTS'][$countEvent]['2'] = $value['EVN_POSX'];
$fields['EVENTS'][$countEvent]['3'] = $value['EVN_POSY'];
$fields['EVENTS'][$countEvent]['4'] = $value['TAS_UID'];
$countEvent = $countEvent + 1;
$fields['TRANSITION'][$countRoutes]['0']= G::generateUniqueID();
$fields['TRANSITION'][$countRoutes]['1']= $idTaskFrom;
$fields['TRANSITION'][$countRoutes]['2']= $evn_uid;
$fields['TRANSITION'][$countRoutes]['3']= '1';
$fields['TRANSITION'][$countRoutes]['4']= '2';
$countRoutes = $countRoutes + 1;
$fields['TRANSITION'][$countRoutes]['0']= G::generateUniqueID();
$fields['TRANSITION'][$countRoutes]['1']= $evn_uid;
$fields['TRANSITION'][$countRoutes]['2']= $idTaskTo;
$fields['TRANSITION'][$countRoutes]['3']= '2';
$fields['TRANSITION'][$countRoutes]['4']= '1';
$countRoutes = $countRoutes + 1;
}
else if($value['TAS_UID'] == '' && $value['EVN_TAS_UID_TO'] != '' && ! preg_match("/Start/", $value['EVN_TYPE'])){
$evn_uid = $value['EVN_UID'];
$idTask = $value['EVN_TAS_UID_TO'];
$fields['EVENTS'][$countEvent]['0'] = $value['EVN_UID'];
$fields['EVENTS'][$countEvent]['1'] = $value['EVN_TYPE'];
$fields['EVENTS'][$countEvent]['2'] = $value['EVN_POSX'];
$fields['EVENTS'][$countEvent]['3'] = $value['EVN_POSY'];
$fields['EVENTS'][$countEvent]['4'] = $value['TAS_UID'];
$countEvent = $countEvent + 1;
$fields['TRANSITION'][$countRoutes]['0']= G::generateUniqueID();
$fields['TRANSITION'][$countRoutes]['1']= $evn_uid;
$fields['TRANSITION'][$countRoutes]['2']= $idTask;
$fields['TRANSITION'][$countRoutes]['3']= '2';
$fields['TRANSITION'][$countRoutes]['4']= '1';
$countRoutes = $countRoutes + 1;
}
else if($value['TAS_UID'] == '' && $value['EVN_TAS_UID_FROM'] != '' && ! preg_match("/End/", $value['EVN_TYPE'])){ //Check for Intermediate Events
$evn_uid = $value['EVN_UID'];
$idTask = $value['EVN_TAS_UID_FROM'];
$fields['EVENTS'][$countEvent]['0'] = $value['EVN_UID'];
$fields['EVENTS'][$countEvent]['1'] = $value['EVN_TYPE'];
$fields['EVENTS'][$countEvent]['2'] = $value['EVN_POSX'];
$fields['EVENTS'][$countEvent]['3'] = $value['EVN_POSY'];
$fields['EVENTS'][$countEvent]['4'] = $value['TAS_UID'];
$countEvent = $countEvent + 1;
$fields['TRANSITION'][$countRoutes]['0']= G::generateUniqueID();
$fields['TRANSITION'][$countRoutes]['1']= $idTask;
$fields['TRANSITION'][$countRoutes]['2']= $evn_uid;
$fields['TRANSITION'][$countRoutes]['3']= '1';
$fields['TRANSITION'][$countRoutes]['4']= '2';
$countRoutes = $countRoutes + 1;
}
else if($value['TAS_UID'] == '' && $value['EVN_TAS_UID_FROM'] == '' && $value['EVN_TAS_UID_TO'] == ''){
$fields['EVENTS'][$countEvent]['0'] = $value['EVN_UID'];
$fields['EVENTS'][$countEvent]['1'] = $value['EVN_TYPE'];
$fields['EVENTS'][$countEvent]['2'] = $value['EVN_POSX'];
$fields['EVENTS'][$countEvent]['3'] = $value['EVN_POSY'];
$fields['EVENTS'][$countEvent]['4'] = $value['TAS_UID'];
$countEvent = $countEvent + 1;
}
}
//Get all the standalone Gateway
$countGateway = count($fields['GATEWAYS']);
$countTransitions = count($fields['TRANSITION']);
foreach($oData->gateways as $id => $value)
{
if($value['GAT_NEXT_TASK'] != '' && $value['TAS_UID'] != '' && $value['GAT_TYPE'] != ''){
$fields['GATEWAYS'][$countGateway]['0'] = $value['GAT_UID'];
$fields['GATEWAYS'][$countGateway]['1'] = $value['GAT_TYPE'];
$fields['GATEWAYS'][$countGateway]['2'] = $value['GAT_X'];
$fields['GATEWAYS'][$countGateway]['3'] = $value['GAT_Y'];
$fields['GATEWAYS'][$countGateway]['4'] = $value['TAS_UID'];
$fields['GATEWAYS'][$countGateway]['5'] = $value['TAS_UID'];
$countGateway+=1;
$fields['TRANSITION'][$countTransitions]['0'] = G::generateUniqueID();
$fields['TRANSITION'][$countTransitions]['1'] = $value['TAS_UID'];
$fields['TRANSITION'][$countTransitions]['2'] = $value['GAT_UID'];
$fields['TRANSITION'][$countTransitions]['3'] = '1';
$fields['TRANSITION'][$countTransitions]['4'] = '2';
$countTransitions += 1;
$fields['TRANSITION'][$countTransitions]['0'] = G::generateUniqueID();
$fields['TRANSITION'][$countTransitions]['1'] = $value['GAT_UID'];
$fields['TRANSITION'][$countTransitions]['2'] = $value['GAT_NEXT_TASK'];
$fields['TRANSITION'][$countTransitions]['3'] = '2';
$fields['TRANSITION'][$countTransitions]['4'] = '1';
$countTransitions += 1;
}
//creating gateway and route from gateway to task i.e if target task is not NULL
else if($value['GAT_NEXT_TASK'] != '' && $value['TAS_UID'] == ''){
$fields['GATEWAYS'][$countGateway]['0'] = $value['GAT_UID'];
$fields['GATEWAYS'][$countGateway]['1'] = $value['GAT_TYPE'];
$fields['GATEWAYS'][$countGateway]['2'] = $value['GAT_X'];
$fields['GATEWAYS'][$countGateway]['3'] = $value['GAT_Y'];
$fields['GATEWAYS'][$countGateway]['4'] = $value['TAS_UID'];
$fields['GATEWAYS'][$countGateway]['5'] = $value['GAT_NEXT_TASK'];
$fields['TRANSITION'][$countTransitions]['0'] = G::generateUniqueID();
$fields['TRANSITION'][$countTransitions]['1'] = $value['GAT_UID'];
$fields['TRANSITION'][$countTransitions]['2'] = $value['GAT_NEXT_TASK'];
$fields['TRANSITION'][$countTransitions]['3'] = '2';
$fields['TRANSITION'][$countTransitions]['4'] = '1';
$countGateway+=1;
$countTransitions += 1;
}
//creating gateway and route from task to gateway i.e if source task is not NULL
else if($value['GAT_NEXT_TASK'] == '' && $value['TAS_UID'] != ''){
$fields['GATEWAYS'][$countGateway]['0'] = $value['GAT_UID'];
$fields['GATEWAYS'][$countGateway]['1'] = $value['GAT_TYPE'];
$fields['GATEWAYS'][$countGateway]['2'] = $value['GAT_X'];
$fields['GATEWAYS'][$countGateway]['3'] = $value['GAT_Y'];
$fields['GATEWAYS'][$countGateway]['4'] = $value['TAS_UID'];
$fields['GATEWAYS'][$countGateway]['5'] = $value['GAT_NEXT_TASK'];
$fields['TRANSITION'][$countTransitions]['0'] = G::generateUniqueID();
$fields['TRANSITION'][$countTransitions]['1'] = $value['TAS_UID'];
$fields['TRANSITION'][$countTransitions]['2'] = $value['GAT_UID'];
$fields['TRANSITION'][$countTransitions]['3'] = '1';
$fields['TRANSITION'][$countTransitions]['4'] = '2';
$countGateway+=1;
$countTransitions += 1;
}
else if($value['GAT_NEXT_TASK'] == '' && $value['TAS_UID'] == ''){
$fields['GATEWAYS'][$countGateway]['0'] = $value['GAT_UID'];
$fields['GATEWAYS'][$countGateway]['1'] = $value['GAT_TYPE'];
$fields['GATEWAYS'][$countGateway]['2'] = $value['GAT_X'];
$fields['GATEWAYS'][$countGateway]['3'] = $value['GAT_Y'];
$countGateway += 1;
}
}
//Create Annotation route
foreach($oData->lanes as $id => $value)
{
if($value['SWI_NEXT_UID'] != '') {
$fields['TRANSITION'][$countTransitions]['0'] = G::generateUniqueID();
$fields['TRANSITION'][$countTransitions]['1'] = $value['SWI_NEXT_UID'];
$fields['TRANSITION'][$countTransitions]['2'] = $value['SWI_UID'];
$fields['TRANSITION'][$countTransitions]['3'] = '1';
$fields['TRANSITION'][$countTransitions]['4'] = '2';
$countTransitions += 1;
}
}
//$subProcess = $oProcess->createSubProcessesPM($oData->subProcess);
$arrayEvents = $fields['EVENTS'];
$arrayGateways = $fields['GATEWAYS'];
$arrayRoutes = $fields['TRANSITION'];
$result['TASKS'] = $arrayTasks;
$result['ROUTES'] = $arrayRoutes;
$result['EVENTS'] = $arrayEvents;
$result['GATEWAYS'] = $arrayGateways;
$aTasks = G::json_encode($arrayTasks);
$aSubProcess = G::json_encode($arraySubProcess);
$aRoutes = G::json_encode($arrayRoutes);
$aEvents = G::json_encode($arrayEvents);
$aGateways = G::json_encode($arrayGateways);
$aProcess = G::json_encode($process);
$aLanes = G::json_encode($lanes);
echo "tasks:$aTasks|gateways:$aGateways|events:$aEvents|annotations:$aLanes|process:$aProcess|subprocess:$aSubProcess|routes:$aRoutes";
?>

View File

@@ -1,190 +0,0 @@
<?php
/**
* patterns_Ajax.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.
*
*/
G::LoadInclude('ajax');
G::LoadClass('processMap');
$oJSON = new Services_JSON();
if(isset($_POST['mode']) && $_POST['mode'] != '')
{
$aData = $_POST;
$aData['TASK'] = $oJSON->decode($_POST['TASK']);
$aData['ROU_NEXT_TASK'] = $oJSON->decode($_POST['ROU_NEXT_TASK']);
}
//Saving Gateway details into Gateway table
if($aData['ROU_TYPE'] != 'SEQUENTIAL')
{
$oProcessMap = new processMap();
//$sGatewayUID = $oProcessMap->saveNewGateway($aData['PROCESS'], $aData['TASK'][0], $aData['ROU_NEXT_TASK'][0]);
require_once 'classes/model/Gateway.php';
$oGateway = new Gateway ( );
$aGatewayFields = array();
$aGatewayFields['GAT_UID'] = $aData['GAT_UID'];
$aGatewayFields['TAS_UID'] = $aData['TASK'][0];
$aGatewayFields['GAT_NEXT_TASK'] = $aData['ROU_NEXT_TASK'][0];
$aGatewayFields['GAT_TYPE'] = '';
$oGateway->update($aGatewayFields);
//$sGatewayUID = $oProcessMap->saveNewGateway($aData['PROCESS'], $aData['TASK'][0], $aData['ROU_NEXT_TASK'][0]);
//echo $sGatewayUID.'|';
}
//else
// echo $aData['ROU_EVN_UID'].'|'; //sending route_event_uid in response
G::LoadClass('tasks');
$oTasks = new Tasks();
$rou_id = 0;
$aFields['GAT_UID'] = $aData['GAT_UID'];
switch ($aData['action']) {
case 'savePattern':
foreach ($aData['TASK'] as $iKey => $aRow)
{
$oTasks->deleteAllRoutesOfTask($aData['PROCESS'], $aRow);
}
require_once 'classes/model/Route.php';
require_once 'classes/model/Event.php';
$oEvent = new Event ( );
$oRoute = new Route();
switch ($aData['ROU_TYPE']) {
case 'SEQUENTIAL':
case 'SEC-JOIN':
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'][0];
$aFields['ROU_NEXT_TASK'] = $aData['ROU_NEXT_TASK'][0];
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
if(isset($aData['ROU_EVN_UID']) && $aData['ROU_EVN_UID'] != ''){
$aFields['ROU_EVN_UID'] = $aData['ROU_EVN_UID'];
$aDataEvent = array();
$aDataEvent['EVN_UID'] = $aData['ROU_EVN_UID'];
$aDataEvent['EVN_TAS_UID_FROM'] = $aData['TASK'][0];
$aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE';
$oEvent->update($aDataEvent);
}
if(isset($aData['PORT_NUMBER_IP']))
$aFields['ROU_TO_PORT'] = $aData['PORT_NUMBER_IP'];
if(isset($aData['PORT_NUMBER_OP']))
$aFields['ROU_FROM_PORT'] = $aData['PORT_NUMBER_OP'];
$rou_id = $oRoute->create($aFields);
break;
case 'SELECT':
foreach ($aData['GRID_SELECT_TYPE'] as $iKey => $aRow)
{
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'];
$aFields['ROU_NEXT_TASK'] = $aRow;
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
if(isset($aData['PORT_NUMBER_IP']))
$aFields['ROU_TO_PORT'] = $aData['PORT_NUMBER_IP'];
if(isset($aData['PORT_NUMBER_OP']))
$aFields['ROU_FROM_PORT'] = $aData['PORT_NUMBER_OP'];
$rou_id = $oRoute->create($aFields);
unset($aFields);
}
break;
case 'EVALUATE':
foreach ($aData['ROU_NEXT_TASK'] as $iKey => $aRow)
{
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'][0];
$aFields['ROU_NEXT_TASK'] = $aRow;
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
$aFields['GAT_UID'] = $aData['GAT_UID'];
if(isset($aData['PORT_NUMBER_IP']))
$aFields['ROU_TO_PORT'] = $aData['PORT_NUMBER_IP'];
if(isset($aData['PORT_NUMBER_OP']))
$aFields['ROU_FROM_PORT'] = $aData['PORT_NUMBER_OP'];
//$aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER'];
$rou_id = $oRoute->create($aFields);
unset($aFields);
}
break;
case 'PARALLEL':
foreach ($aData['ROU_NEXT_TASK'] as $iKey => $aRow)
{
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'][0];
$aFields['ROU_NEXT_TASK'] = $aRow;
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$aFields['GAT_UID'] = $aData['GAT_UID'];;
if(isset($aData['PORT_NUMBER_IP']))
$aFields['ROU_TO_PORT'] = $aData['PORT_NUMBER_IP'];
if(isset($aData['PORT_NUMBER_OP']))
$aFields['ROU_FROM_PORT']= $aData['PORT_NUMBER_OP'];
$rou_id = $oRoute->create($aFields);
unset($aFields);
}
break;
case 'PARALLEL-BY-EVALUATION':
foreach ($aData['ROU_NEXT_TASK'] as $iKey => $aRow)
{
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'][0];
$aFields['ROU_NEXT_TASK'] = $aRow;
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$aFields['GAT_UID'] = $aData['GAT_UID'];;
if(isset($aData['PORT_NUMBER_IP']))
$aFields['ROU_TO_PORT'] = $aData['PORT_NUMBER_IP'];
if(isset($aData['PORT_NUMBER_OP']))
$aFields['ROU_FROM_PORT']= $aData['PORT_NUMBER_OP'];
$rou_id = $oRoute->create($aFields);
unset($aFields);
}
break;
case 'DISCRIMINATOR': //Girish ->Added to save changes, while editing the route
foreach ($aData['TASK'] as $iKey => $aRow)
{
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aRow;
$aFields['ROU_NEXT_TASK'] = $aData['ROU_NEXT_TASK'][0];
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$aFields['GAT_UID'] = $aData['GAT_UID'];;
if(isset($aData['PORT_NUMBER_IP']))
$aFields['ROU_TO_PORT'] = $aData['PORT_NUMBER_IP'];
if(isset($aData['PORT_NUMBER_OP']))
$aFields['ROU_FROM_PORT'] = $aData['PORT_NUMBER_OP'];
$routeData = $oTasks->getRouteByType($aData['PROCESS'], $aData['ROU_NEXT_TASK'][0], $aData['ROU_TYPE']);
foreach($routeData as $route)
{
$sFields['ROU_UID'] = $route['ROU_UID'];
$rou_id = $oRoute->update($sFields);
}
$rou_id =$oRoute->create($aFields);
unset($aFields);
}
break;
}
echo $rou_id;
}
?>

View File

@@ -1,398 +0,0 @@
<?php
/**
* processes_Ajax.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.
*
*/
G::LoadInclude('ajax');
$oJSON = new Services_JSON();
if ( isset ($_REQUEST['data']) ) {
$oData = $oJSON->decode(stripslashes($_REQUEST['data']));
$sOutput = '';
}
else {
if (!isset($_POST['form'])) {
$aData = urldecode_values($_POST);
}
else {
$aData = urldecode_values($_POST['form']);
}
}
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
require_once 'classes/model/Task.php';
require_once 'classes/model/Event.php';
$oEvent = new Event();
$oTask = new Task();
if ( isset ($_REQUEST['action']) ) {
switch($_REQUEST['action'])
{
case 'load':
$sOutput = $oProcessMap->load($oData->uid);
echo $sOutput;
break;
case 'addTask':
$sOutput = $oProcessMap->addTask($oData->uid, $oData->position->x, $oData->position->y,$oData->cordinate->x,$oData->cordinate->y);
echo $sOutput;
break;
case 'saveTaskPosition':
$sOutput = $oProcessMap->saveTaskPosition($oData->uid, $oData->position->x, $oData->position->y);
echo $sOutput;
break;
case 'saveEventPosition':
$sOutput = $oProcessMap->saveEventPosition($oData->uid, $oData->position->x, $oData->position->y);
echo $sOutput;
break;
case 'saveGatewayPosition':
$sOutput = $oProcessMap->saveGatewayPosition($oData->uid, $oData->position->x, $oData->position->y);
//echo $sOutput;
break;
case 'saveTaskCordinates':
$sOutput = $oProcessMap->saveTaskCordinates($oData->uid, $oData->position->x, $oData->position->y);
echo $sOutput;
break;
case 'saveAnnotationCordinates':
$sOutput = $oProcessMap->saveAnnotationCordinates($oData->uid, $oData->position->x, $oData->position->y);
echo $sOutput;
break;
case 'deleteTask':
$sOutput = $oProcessMap->deleteTask($oData->tas_uid);
echo $sOutput;
break;
case 'addGateway':
$sOutput = $oProcessMap->addGateway($oData);
echo $sOutput;
break;
case 'deleteGateway':
$sOutput = $oProcessMap->deleteGateway($oData->pro_uid, $oData->gat_uid);
echo $sOutput;
break;
case 'updateTaskName':
$aTask['TAS_UID'] = $oData->uid;
$aTask['TAS_TITLE'] = $oData->label;
$oTask->update($aTask);
break;
case 'updateTask':
$aTask['TAS_UID'] = $oData->uid;
$aTask['TAS_BOUNDARY'] = $oData->boundary;
$oTask->update($aTask);
$sOutput = $oJSON->encode($oData);
echo $sOutput;
break;
case 'addSubProcess':
$sOutput = $oProcessMap->addSubProcess($oData->uid, $oData->position->x, $oData->position->y);
echo $sOutput;
break;
case 'deleteSubProcess':
$sOutput = $oProcessMap->deleteSubProcess($oData->pro_uid, $oData->tas_uid);
break;
case 'addText':
$sOutput = $oProcessMap->addText($oData->uid, $oData->label, $oData->position->x, $oData->position->y,$oData->task_uid);
echo $sOutput;
break;
case 'updateText':
$sOutput = $oProcessMap->updateText($oData->uid, $oData->label, $oData->next_uid);
echo $sOutput;
break;
case 'saveTextPosition':
$sOutput = $oProcessMap->saveTextPosition($oData->uid, $oData->position->x, $oData->position->y);
break;
case 'deleteText':
$sOutput = $oProcessMap->deleteText($oData->uid);
echo $sOutput;
break;
case 'getProcesses':
$sOutput = $oProcessMap->getAllProcesses();
echo $sOutput;
break;
case 'dynaforms':
$sOutput = $oProcessMap->getDynaformList($oData->uid);
$sOutput = $oJSON->encode($sOutput);
echo $sOutput;
break;
case 'webEntry_validate':
include(PATH_METHODS . 'processes/processes_webEntryValidate.php');
break;
case 'webEntry_generate':
include(PATH_METHODS . 'processes/processes_webEntryGenerate.php');
break;
case 'webEntry':
$sOutput = $oProcessMap->listNewWebEntry($oData->uid,$oData->evn_uid);
echo $sOutput;
break;
case 'loadTask':
$oOutput = $oTask->load($oData->uid);
$sOutput = $oJSON->encode($oOutput);
echo $sOutput;
break;
case 'assignProcessUser':
$oProcessMap->assignProcessUser($oData->PRO_UID, $oData->USR_UID);
break;
case 'removeProcessUser':
$oProcessMap->removeProcessUser($oData->PU_UID);
break;
case 'saveInterMessageEvent':
$aData['TAS_UID'] = $oData->uid;
$aData['TAS_SEND_LAST_EMAIL'] = strtoupper($oData->tas_send);
$aData['TAS_DEF_MESSAGE'] = $oData->data;
if(isset($aData['TAS_SEND_LAST_EMAIL']) && $aData['TAS_SEND_LAST_EMAIL'] == 'FALSE'){
$aData['TAS_DEF_MESSAGE'] = '';
}else{
$aData['TAS_DEF_MESSAGE'] = str_replace('@amp@', '&', $aData['TAS_DEF_MESSAGE']);
}
$sOutput = $oTask->update($aData);
echo $sOutput;
break;
case 'editObjectPermission':
// we also need the process uid variable for the function.
$oProcessMap->editObjectPermission($oData->op_uid,$oData->pro_uid);
break;
case 'triggersList':
$sOutput = $oProcessMap->getTriggers($oData->pro_uid);
$sOutput = $oJSON->encode($sOutput);
echo $sOutput;
break;
case 'loadCategory':
$sOutput = $oProcessMap->loadProcessCategory();
$sOutput = $oJSON->encode($sOutput);
echo $sOutput;
break;
case 'saveProcess':
$aData['PRO_UID'] = $oData->PRO_UID;
$aData['PRO_CALENDAR'] = $oData->PRO_CALENDAR;
$aData['PRO_CATEGORY'] = $oData->PRO_CATEGORY;
$aData['PRO_DEBUG'] = $oData->PRO_DEBUG;
$aData['PRO_DESCRIPTION'] = $oData->PRO_DESCRIPTION;
$aData['PRO_TITLE'] = $oData->PRO_TITLE;
$sOutput = $oProcessMap->updateProcess($aData);
echo $sOutput;
break;
case 'saveStartEvent':
$aData['TAS_UID'] = $oData->tas_uid;
$aData['TAS_START'] = $oData->tas_start;
$aData['TAS_EVN_UID'] = '';
$oTask->update($aData);
break;
case 'deleteStartEvent':
$aData['TAS_UID'] = $oData->tas_uid;
$aData['TAS_START'] = $oData->tas_start;
$aData['TAS_EVN_UID'] = '';
$oTask->update($aData);
if(isset($oData->evn_uid))
$oEvent->remove($oData->evn_uid);
break;
case 'updateEvent':
$aData['EVN_UID'] = $oData->evn_uid;
$aData['EVN_TYPE'] = $oData->evn_type;
$oEvent = EventPeer::retrieveByPK($aData['EVN_UID']);
if (!is_null($oEvent))
$oEvent->update($aData);
break;
case 'saveEvents':
$sOutput = $oProcessMap->saveExtEvents($oData);
echo $sOutput;
break;
case 'addEvent':
$sOutput = $oProcessMap->saveExtddEvents($oData);
echo $sOutput;
/*
$aData['PRO_UID'] = $oData->uid;
$aData['EVN_TYPE'] = $oData->tas_type;
$aData['EVN_STATUS'] = 'ACTIVE';
$aData['EVN_WHEN'] = '1';
$aData['EVN_ACTION'] = '';
if(preg_match("/Inter/", $oData->tas_type)){
$aData['EVN_RELATED_TO'] = 'MULTIPLE';
$aData['EVN_TAS_UID_FROM'] = $oData->tas_from;
$aData['EVN_TAS_UID_TO'] = $oData->tas_to;
$sOutput = $oEvent->create($aData);
echo $sOutput;
}
//Code for Start Events only
if(preg_match("/Start/", $oData->tas_type)){
$oEvn_uid='';
$aData['EVN_RELATED_TO'] = 'SINGLE';
$aData['TAS_UID'] = $oData->tas_uid;
$oTaskData = $oTask->load($aData['TAS_UID']);
if($oTaskData['TAS_EVN_UID'] == ''){
$oEvn_uid = $oEvent->create($aData);
}else{
$aData['EVN_UID'] = $oTaskData['TAS_EVN_UID'];
$oEvn_uid = $aData['EVN_UID'];
$oEvent->update($aData);
}
$aTask['TAS_UID'] = $oData->tas_uid;
$aTask['TAS_EVN_UID'] = $oEvn_uid;
$aTask['TAS_START'] = 'TRUE';
$oTask->update($aTask);
}*/
break;
case 'deleteRoute':
require_once 'classes/model/Route.php';
$oRoute = new Route();
$sOutput = $oRoute->remove($oData->uid);
echo $sOutput;
break;
case 'deleteEvent':
$sOutput = $oEvent->remove($oData->uid);
echo $sOutput;
break;
case 'assign':
G::LoadClass('tasks');
$oTasks = new Tasks();
switch ($oData->TU_RELATION) {
case 1:
echo $oTasks->assignUser($oData->TAS_UID, $oData->USR_UID, $oData->TU_TYPE);
break;
case 2:
echo $oTasks->assignGroup($oData->TAS_UID, $oData->USR_UID, $oData->TU_TYPE);
break;
}
break;
case 'ofToAssign':
G::LoadClass('tasks');
$oTasks = new Tasks();
switch ($oData->TU_RELATION) {
case 1:
echo $oTasks->ofToAssignUser($oData->TAS_UID, $oData->USR_UID, $oData->TU_TYPE);
break;
case 2:
echo $oTasks->ofToAssignGroup($oData->TAS_UID, $oData->USR_UID, $oData->TU_TYPE);
break;
}
break;
case 'saveSubprocessDetails':
//$aTask=$oTask->load($_POST['form']['TASKS']);
//$aTask=$oTask->load($_POST['form']['PRO_UID']);
$out = array();
$in = array();
if(isset($_POST['VAR_OUT']) && $_POST['VAR_OUT'] != ''){
$varOut = explode('|',$_POST['VAR_OUT']);
$aVarOut1 = G::json_decode($varOut[0]);
$aVarOut2 = G::json_decode($varOut[1]);
for($i=1; $i<=count($aVarOut1); $i++){
$out[$aVarOut1[$i-1]]= $aVarOut2[$i-1];
}
}
if(isset($_POST['VAR_IN']) && $_POST['VAR_IN'] != ''){
$varIn = explode('|',$_POST['VAR_IN']);
$aVarIn1 = G::json_decode($varIn[0]);
$aVarIn2 = G::json_decode($varIn[1]);
for($i=1; $i<=count($aVarIn1); $i++){
$in[$aVarIn1[$i-1]]= $aVarIn2[$i-1];
}
}
if($_POST['VAR_IN'] == '')
$in[$_POST['VAR_IN']] = '';
//Getting first Tasks of selected process
$aNewCase = $oProcessMap->subProcess_TaskIni($_POST['PRO_UID']);
$i = 0;
foreach ($aNewCase as $aRow) {
if ($i > 0 && $aRow['pro_uid'] == $_POST['sProcessUID']) {
$sTASKS = $aRow['uid'];
}
$i++;
}
//$aTask=($_POST['TASKS']!=0)?$oTask->load($_POST['TASKS']):0;
$aTask=($sTASKS!=0)?$oTask->load($sTASKS):0;
//$aTask['PRO_UID']=0;
if ( isset ( $_POST['SP_SYNCHRONOUS']) && $_POST['SP_SYNCHRONOUS'] == '' ) {
$_POST['SP_SYNCHRONOUS'] = '0';
}
if ( !isset ( $_POST['SP_SYNCHRONOUS']) ) {
$_POST['SP_SYNCHRONOUS'] = '0';
}
require_once 'classes/model/SubProcess.php';
$oOP = new SubProcess();
$aData = array('SP_UID' => $_POST['SP_UID'],//G::generateUniqueID(),
'PRO_UID' => $aTask['PRO_UID'],
'TAS_UID' => $sTASKS,
'PRO_PARENT' => $_POST['PRO_PARENT'],
'TAS_PARENT' => $_POST['TAS_PARENT'],
'SP_TYPE' => 'SIMPLE',
'SP_SYNCHRONOUS' => $_POST['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['TAS_PARENT'], $lang, $_POST['SPROCESS_NAME'] );
break;
case 'subprocessProperties':
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['TAS_PARENT'], $lang, $_POST['SPROCESS_NAME'] );
break;
case 'deleteTriggers':
try{
require_once('classes/model/Triggers.php');
require_once('classes/model/StepTrigger.php');
$TRI_UIDS = explode(',', $_POST['TRI_UID']);
foreach($TRI_UIDS as $i=>$TRI_UID) {
$oTrigger = new Triggers();
$triggerObj=$oTrigger->load($TRI_UID);
$oTrigger->remove($TRI_UID);
$oStepTrigger = new StepTrigger();
$oStepTrigger->removeTrigger($TRI_UID);
}
$result->success = true;
$result->message = G::LoadTranslation('ID_TRIGGERS_REMOVED');
}
catch (Exception $e) {
$result->success = false;
$result->message = $e->getMessage();
}
print G::json_encode($result);
break;
case 'getOutputDocsTemplates':
require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
if (isset($_GET['OUT_DOC_UID'])) {
$rows = $ooutputDocument->load($_GET['OUT_DOC_UID']);
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
break;
}
}
}
?>

View File

@@ -1,179 +0,0 @@
<?php
/*
Copyright (c) 2010, Andrew Rymarczyk
All rights reserved.
Redistribution and use in source and minified, compiled or otherwise obfuscated
form, with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in minified, compiled or otherwise obfuscated form must
reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials
provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//$save_path = PATH_DATA_MAILTEMPLATES . '4601910684c597eab4810e6037370402' . PATH_SEP ;
$save_path = $_SERVER['DOCUMENT_ROOT'].'/uploads/';
$valid_chars_regex = '.A-Z0-9_ !@#$%^&()+={}\[\]\',~`-'; // Characters allowed in the file name (in a Regular Expression format)
//$extension_whitelist = array('csv', 'gif', 'png','tif'); // Allowed file extensions
$MAX_FILENAME_LENGTH = 260;
$max_file_size_in_bytes = 2147483647; // 2GB in bytes
$upload_name = 'Filedata';
/*
This is an upload script for SWFUpload that attempts to properly handle uploaded files
in a secure way.
Notes:
SWFUpload doesn't send a MIME-TYPE. In my opinion this is ok since MIME-TYPE is no better than
file extension and is probably worse because it can vary from OS to OS and browser to browser (for the same file).
The best thing to do is content sniff the file but this can be resource intensive, is difficult, and can still be fooled or inaccurate.
Accepting uploads can never be 100% secure.
You can't guarantee that SWFUpload is really the source of the upload. A malicious user
will probably be uploading from a tool that sends invalid or false metadata about the file.
The script should properly handle this.
The script should not over-write existing files.
The script should strip away invalid characters from the file name or reject the file.
The script should not allow files to be saved that could then be executed on the webserver (such as .php files).
To keep things simple we will use an extension whitelist for allowed file extensions. Which files should be allowed
depends on your server configuration. The extension white-list is _not_ tied your SWFUpload file_types setting
For better security uploaded files should be stored outside the webserver's document root. Downloaded files
should be accessed via a download script that proxies from the file system to the webserver. This prevents
users from executing malicious uploaded files. It also gives the developer control over the outgoing mime-type,
access restrictions, etc. This, however, is outside the scope of this script.
SWFUpload sends each file as a separate POST rather than several files in a single post. This is a better
method in my opinions since it better handles file size limits, e.g., if post_max_size is 100 MB and I post two 60 MB files then
the post would fail (2x60MB = 120MB). In SWFupload each 60 MB is posted as separate post and we stay within the limits. This
also simplifies the upload script since we only have to handle a single file.
The script should properly handle situations where the post was too large or the posted file is larger than
our defined max. These values are not tied to your SWFUpload file_size_limit setting.
*/
// Check post_max_size (http://us3.php.net/manual/en/features.file-upload.php#73762)
$POST_MAX_SIZE = ini_get('post_max_size');
$unit = strtoupper(substr($POST_MAX_SIZE, -1));
$multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1)));
if ((int)$_SERVER['CONTENT_LENGTH'] > $multiplier*(int)$POST_MAX_SIZE && $POST_MAX_SIZE) {
//header("HTTP/1.1 500 Internal Server Error"); // This will trigger an uploadError event in SWFUpload
//echo "POST exceeded maximum allowed size.";
HandleError('POST exceeded maximum allowed size.');
}
// Other variables
$file_name = '';
$file_extension = '';
$uploadErrors = array(
0=>'There is no error, the file uploaded with success',
1=>'The uploaded file exceeds the upload_max_filesize directive in php.ini',
2=>'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
3=>'The uploaded file was only partially uploaded',
4=>'No file was uploaded',
6=>'Missing a temporary folder'
);
// Validate the upload
if (!isset($_FILES[$upload_name])) {
HandleError('No upload found in \$_FILES for ' . $upload_name);
} else if (isset($_FILES[$upload_name]["error"]) && $_FILES[$upload_name]["error"] != 0) {
HandleError($uploadErrors[$_FILES[$upload_name]["error"]]);
} else if (!isset($_FILES[$upload_name]["tmp_name"]) || !@is_uploaded_file($_FILES[$upload_name]["tmp_name"])) {
HandleError('Upload failed is_uploaded_file test.');
} else if (!isset($_FILES[$upload_name]['name'])) {
HandleError('File has no name.');
}
// Validate the file size (Warning: the largest files supported by this code is 2GB)
$file_size = @filesize($_FILES[$upload_name]["tmp_name"]);
if (!$file_size || $file_size > $max_file_size_in_bytes) {
HandleError('File exceeds the maximum allowed size');
}
if ($file_size <= 0) {
HandleError('File size outside allowed lower bound');
}
// Validate file name (for our purposes we'll just remove invalid characters)
$file_name = preg_replace('/[^'.$valid_chars_regex.']|\.+$/i', "", basename($_FILES[$upload_name]['name']));
if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
HandleError('Invalid file name');
}
// Validate that we won't over-write an existing file
if (file_exists($save_path . $file_name)) {
HandleError('A file with this name already exists');
}
/*
// Validate file extension
$path_info = pathinfo($_FILES[$upload_name]['name']);
$file_extension = $path_info["extension"];
$is_valid_extension = false;
foreach ($extension_whitelist as $extension) {
if (strcasecmp($file_extension, $extension) == 0) {
$is_valid_extension = true;
break;
}
}
if (!$is_valid_extension) {
HandleError("Invalid file extension");
exit(0);
}
*/
// Validate file contents (extension and mime-type can't be trusted)
/*
Validating the file contents is OS and web server configuration dependant. Also, it may not be reliable.
See the comments on this page: http://us2.php.net/fileinfo
Also see http://72.14.253.104/search?q=cache:3YGZfcnKDrYJ:www.scanit.be/uploads/php-file-upload.pdf+php+file+command&hl=en&ct=clnk&cd=8&gl=us&client=firefox-a
which describes how a PHP script can be embedded within a GIF image file.
Therefore, no sample code will be provided here. Research the issue, decide how much security is
needed, and implement a solution that meets the needs.
*/
// Process the file
/*
At this point we are ready to process the valid file. This sample code shows how to save the file. Other tasks
could be done such as creating an entry in a database or generating a thumbnail.
Depending on your server OS and needs you may need to set the Security Permissions on the file after it has
been saved.
*/
if (!@move_uploaded_file($_FILES[$upload_name]["tmp_name"], $save_path.$file_name)) {
HandleError("File could not be saved.");
}
die('{"success":true}');
/* Handles the error output. This error message will be sent to the uploadSuccess event handler. The event handler
will have to check for any error messages and react as needed. */
function HandleError($message) {
die('{success:false,error:'.G::json_encode($message).'}');
}
?>

View File

@@ -1,67 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
if ( isset($_GET['eid'] ) )
{
//Getting available Steps Criteria that have been not selected for a particular task
require_once "classes/model/Event.php";
$oEvent = new Event();
$oData = $oEvent->load($_GET['eid']);
$sch_uid = $oData['EVN_ACTION'];
if($sch_uid != '')
{
$rows = $oProcessMap->caseNewSchedulerList($sch_uid);
if($rows['SCH_OPTION'] == '3')
{
$sch_start_day = explode('|',$rows['SCH_START_DAY']);
$count = count($sch_start_day);
switch($count){
case 1:
$rows['SCH_START_DAY'] = $sch_start_day[0];
break;
case 2:
$rows['SCH_START_DAY'] = $sch_start_day[0];
$rows['SCH_START_DAY_OPT_2_WEEKS'] = $sch_start_day[1];
break;
case 3:
$rows['SCH_START_DAY'] = $sch_start_day[0];
$rows['SCH_START_DAY_OPT_2_WEEKS'] = $sch_start_day[1];
$rows['SCH_START_DAY_OPT_2_DAYS_WEEK'] = $sch_start_day[2];
break;
}
}
if($rows['SCH_START_DATE'] != '')
{
$sch_str_dt = explode(' ',$rows['SCH_START_DATE']);
$rows['SCH_START_DATE'] = $sch_str_dt[0];
}
if($rows['SCH_END_DATE'] != '')
{
$sch_str_dt = explode(' ',$rows['SCH_END_DATE']);
$rows['SCH_END_DATE'] = $sch_str_dt[0];
}
$result = G::json_encode( $rows ) ;
$result = str_replace("\\/","/",'{success:true,data:'.$result.'}'); // unescape the slashes
}
else
{
$result = '{failure:true}'; // unescape the slashes
}
echo $result;
}
//print G::json_encode( $result ) ;
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}
?>

View File

@@ -1,18 +0,0 @@
<?php
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
if (isset($_GET['pid'] ))
{
$rows = $oProcessMap->getExtCaseTrackerObjectsCriteria($_GET['pid']);
}
if (isset($_GET['tid'] ))
{
$rows = $oProcessMap->getAvailableExtCaseTrackerObjects($_GET['tid']);
}
array_shift($rows);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode($result);
?>

View File

@@ -1,27 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
if ( isset($_GET['pid']) )
{
$rows = $oProcessMap->getExtCriteriaDBSList($_GET['pid']);
}
if(isset($_GET['tid']))
{
require_once 'classes/model/DbSource.php';
$o = new DbSource();
$rows = $o->load($_GET['tid']);
}
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}
?>

View File

@@ -1,37 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
if ( isset($_GET['pid'] ) )
{
//Getting Dynaform List
$rows = $oProcessMap->getExtDynaformsList($_GET['pid']);
array_shift($rows);
}
else if(isset($_GET['tabId'])){
$oAdditionalTables = new AdditionalTables();
$aData = $oAdditionalTables->load($_GET['tabId'], true);
$addTabName = $aData['ADD_TAB_NAME'];
foreach ($aData['FIELDS'] as $iRow => $aRow) {
if ($aRow['FLD_KEY'] == 1) {
$rows[] = $aRow;
}
}
}
//Getting Additional PM tables list created by user for combobox
else
{
//Getting Dynaform List
$rows = $oProcessMap->getExtAdditionalTablesList();
}
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}

View File

@@ -1,27 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
if ( isset($_GET['startInterId'] ) )
{
//Getting available Steps Criteria that have been not selected for a particular task
require_once "classes/model/Event.php";
$oEvent = new Event();
$aRows = $oEvent->load($_GET['startInterId']);
//$sch_uid = $oData['EVN_ACTION'];
$result = G::json_encode( $aRows );
$result = str_replace("\\/","/",'{success:true,data:'.$result.'}'); // unescape the slashes
/*else
{
$result = '{failure:true}'; // unescape the slashes
}*/
echo $result;
}
//print G::json_encode( $result ) ;
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}
?>

View File

@@ -1,454 +0,0 @@
<?php
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
//$_GET['sid'] gets STEP_UID and sTYPE(i.e BEFORE and AFTER) in format STEP_UID-sTYPE
if(isset($_GET['stepid'])){
$aStepTypeId = explode('|',$_GET['stepid']);
$_SESSION['stepUID'] = $_GET['stepid'];
//$aStepTypeId = explode('-','2517180104cd42c25cc39e4071099227-BEFORE');
$sStep = $aStepTypeId[0];
$sType = $aStepTypeId[1];
}
//$_GET['sid'] gets STEP_UID and sTYPE(i.e BEFORE and AFTER) in format STEP_UID-sTYPE
if(isset($_GET['stepid'])){
$aStepTypeId = explode('|',$_GET['stepid']);
$_SESSION['stepUID'] = $_GET['stepid'];
//$aStepTypeId = explode('-','2517180104cd42c25cc39e4071099227-BEFORE');
$sStep = $aStepTypeId[0];
$sType = $aStepTypeId[1];
}
$start = isset($_POST['start'])? $_POST['start']: 0;
$limit = isset($_POST['limit'])? $_POST['limit']: '';
switch( $_GET['action'] ) {
case 'getDynaformList' :
$result = $oProcessMap->getExtDynaformsList($start, $limit, $_GET['pid']);
print G::json_encode( $result ) ;
break;
case 'getPMTableDynaform':
$oAdditionalTables = new AdditionalTables();
$aData = $oAdditionalTables->load($_GET['tabId'], true);
$addTabName = $aData['ADD_TAB_NAME'];
foreach ($aData['FIELDS'] as $iRow => $aRow)
{
if ($aRow['FLD_KEY'] == 1)
{
$rows[] = $aRow;
}
}
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'getAdditionalTables':
$rows = $oProcessMap->getExtAdditionalTablesList();
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'getInputDocumentList':
$rows = $oProcessMap->getExtInputDocumentsCriteria($start, $limit,$_GET['pid']);
$result['totalCount'] = $oProcessMap->getAllInputDocumentCount();
array_shift($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'editInputDocument':
require_once 'classes/model/InputDocument.php';
$oInputDocument = new InputDocument();
$rows = $oInputDocument->load($_GET['INP_DOC_UID']);
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
break;
case 'getOutputDocument':
$rows = $oProcessMap->getExtOutputDocumentsCriteria($start, $limit,$_GET['pid']);
$result['totalCount'] = $oProcessMap->getAllOutputDocumentCount();
array_shift($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'editObjectPermission':
$rows = $oProcessMap->editExtObjectPermission($_GET['pid'],$_GET['op_uid']);
//array_shift($rows);
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
break;
case 'editOutputDocument':
require_once 'classes/model/OutputDocument.php';
$oOutputDocument = new OutputDocument();
$rows = $oOutputDocument->load($_GET['tid']);
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
break;
case 'getReportTables':
$rows = $oProcessMap->getExtReportTables($start, $limit,$_GET['pid']);
$result['totalCount'] = $oProcessMap->getAllReportTableCount();
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'editReportTables':
require_once 'classes/model/ReportTable.php';
$oReportTable = new ReportTable();
$rows = $oReportTable->load($_GET['REP_TAB_UID'],$_GET['pid']);
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
break;
case 'getReportTableType':
if(isset($_GET['pid']) && $_GET['type'] == 'NORMAL')
{
$aTheFields = array();
$aTheFields = getDynaformsVars($_GET['pid'], false);
foreach ($aTheFields as $aField)
{
$rows[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sType'],
'FIELD_NAME' => $aField['sName']);
}
}
else if (isset($_GET['pid']) && $_GET['type'] == 'GRID')
{
$aTheFields = array();
$aTheFields = getGridsVars($_GET['pid']);
foreach ($aTheFields as $aField)
{
$rows[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sXmlForm'],
'FIELD_NAME' => $aField['sName']);
}
}
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'getDatabaseConnectionList':
$rows = $oProcessMap->getExtCriteriaDBSList($start, $limit,$_GET['pid']);
$result['totalCount'] = $oProcessMap->getAllDbSourceCount();
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'editDatabaseConnection':
require_once 'classes/model/DbSource.php';
$o = new DbSource();
$rows = $o->load($_GET['dbs_uid'],$_GET['pid']);
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
break;
case 'process_Supervisors':
$rows = $oProcessMap->listExtProcessesSupervisors($start, $limit, $_GET['pid']);
$result['totalCount'] = $oProcessMap->getAllProcessSupervisorsCount();
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'availableProcessesSupervisors':
$rows = $oProcessMap->listExtNoProcessesUser($_GET['pid']);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'supervisorDynaforms':
$rows = $oProcessMap->getExtSupervisorDynaformsList($start, $limit,$_GET['pid']);
$result['totalCount'] = $oProcessMap->getAllSupervisorDynaformsCount();
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'availableSupervisorDynaforms':
$rows = $oProcessMap->getExtAvailableSupervisorDynaformsList($_GET['pid']);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'supervisorInputDoc':
$rows = $oProcessMap->getExtSupervisorInputsList($start, $limit,$_GET['pid']);
$result['totalCount'] = $oProcessMap->getAllSupervisorInputsCount();
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'availableSupervisorInputDoc':
$rows = $oProcessMap->getExtAvailableSupervisorInputsList($_GET['pid']);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'getAssignedCaseTrackerObjects':
$rows = $oProcessMap->getExtCaseTrackerObjectsCriteria($start, $limit, $_GET['pid']);
$result['totalCount'] = $oProcessMap->getAllCaseTrackerObjectCount();
array_shift($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'getAvailableCaseTrackerObjects':
$rows = $oProcessMap->getAvailableExtCaseTrackerObjects($_GET['pid']);
array_shift($rows);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'getAvailableSteps':
$rows = $oProcessMap->getExtAvailableBBCriteria($_GET['pid'], $_GET['tid']);
array_shift($rows);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'getAssignedSteps':
$rows = $oProcessMap->getExtStepsCriteria($start, $limit,$_GET['tid']);
$result['totalCount'] = $oProcessMap->getAllStepCount();
array_shift($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'getAssignedUsersList':
$rows = $oProcessMap->usersExtList($start, $limit, $_GET['pid'], $_GET['tid']);
$result['totalCount'] = $oProcessMap->getAllTaskUserCount();
array_shift($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'getAvailableUsersList':
$rows = $oProcessMap->getAvailableExtUsersCriteria($_GET['tid']);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'getAvailableStepTriggers':
$aStepTypeId = explode('|',$_SESSION['stepUID']);
$sStep = $aStepTypeId[0];
$sType = $aStepTypeId[1];
//Getting available Steps Criteria that have been not selected for a particular task
$rows = $oProcessMap->getExtAvailableStepTriggersCriteria($_GET['pid'], $sStep, $_GET['tid'], $sType);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'getAssignedStepTriggers':
$rows = $oProcessMap->getExtStepTriggersCriteria($start, $limit, $sStep, $_GET['tid'], $sType);
$result['totalCount'] = $oProcessMap->getAllStepTriggerCount();
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'availableUsers':
$rows = $oProcessMap->getExtAvailableUsersList($_GET['tid']);
array_shift($rows);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'assignedUsers':
$rows = $oProcessMap->getExtusersadhoc($start, $limit,$_GET['pid'], $_GET['tid']);
$result['totalCount'] = $oProcessMap->getAllTaskUserCount();
array_shift($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'getTaskPropertiesList':
require_once 'classes/model/Task.php';
$oTask = new Task();
$rows = $oTask->load($_GET['tid']);
while (list($key, $value) = each($rows)) {
if ($value == 'TRUE')
$rows[$key] = true;
else if($value == 'FALSE')
$rows[$key] = false;
if($key == 'TAS_TYPE_DAY' && $value == '1')
$rows[$key] = 'Work Days';
else if($key == 'TAS_TYPE_DAY' && $value == '2')
$rows[$key] = 'Calendar Days';
if($key == 'TAS_TYPE' && $value == 'NORMAL')
$rows[$key] = false;
else if($key == 'TAS_TYPE' && $value == 'ADHOC')
$rows[$key] = true;
}
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
break;
case 'getSubProcessProperties':
if($_GET['type'] == 2) //Loading sub process details
{
$rows = $oProcessMap->subProcessExtProperties($_GET['pid'], $_GET['tid'],'','0');
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
print $result;
}
else
{
$rows = $oProcessMap->subProcessExtProperties($_GET['pid'], $_GET['tid'],'',$_GET['type']);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
}
break;
case 'getObjectPermission':
$rows = $oProcessMap->getExtObjectsPermissions($start, $limit,$_GET['pid']);
$result['totalCount'] = $oProcessMap->getAllObjectPermissionCount();
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'getObjectPermissionType':
$rows = $oProcessMap->newExtObjectPermission($_GET['pid'],$_GET['objectType']);
array_shift($rows);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'process_Edit':
$rows = $oProcessMap->editProcessNew($_GET['pid']);
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
break;
case 'getTriggersList':
$rows = $oProcessMap->getExtTriggersList($start, $limit, $_GET['pid']);
$result['totalCount'] = $oProcessMap->getAllTriggersCount();
array_shift($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
break;
case 'editTriggers':
require_once('classes/model/Triggers.php');
if (isset($_GET['TRI_UID']))
{
$oTrigger = new Triggers();
$rows = $oTrigger->load($_GET['TRI_UID']);
}
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
break;
case 'getCaseTracker':
//$rows = $oProcessMap->caseTracker($_GET['pid']);
$oCaseTracker = new CaseTracker ( );
$rows = $oCaseTracker->load($_GET['pid']);
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
break;
case 'getVariables':
$aFields = getDynaformsVars($_GET['pid']);
if(isset ($_GET['type']))
$aType = $_GET['type'];
else $aType='';
$rows[0] = Array (
'fieldname' => 'char',
'variable' => 'char',
'type' => 'type',
'label' => 'char'
);
foreach ( $aFields as $aField ) {
switch ($aType){
case "system":
if($aField['sType']=="system"){
$rows[] = Array (
'fieldname' => $_GET['sFieldName'],
'variable' => $_GET['sSymbol'] . $aField['sName'],
'variable_label' => '<div class="pm__dynavars"> <a id="dynalink" href=# onclick="insertFormVar(\''.$_GET['sFieldName'].'\',\''.$_GET['sSymbol'] . $aField['sName'].'\');">'.$_GET['sSymbol'] . $aField['sName'].'</a></div>',
'type' => $aField['sType'],
'label' => $aField['sLabel']
);
}
break;
case "process":
if($aField['sType']!="system"){
$rows[] = Array (
'fieldname' => $_GET['sFieldName'],
'variable' => $_GET['sSymbol'] . $aField['sName'],
'variable_label' => '<div class="pm__dynavars"> <a id="dynalink" href=# onclick="insertFormVar(\''.$_GET['sFieldName'].'\',\''.$_GET['sSymbol'] . $aField['sName'].'\');">'.$_GET['sSymbol'] . $aField['sName'].'</a></div>',
'type' => $aField['sType'],
'label' => $aField['sLabel']
);
}
break;
default:
$rows[] = Array (
'fieldname' => $_GET['sFieldName'],
'variable' => $_GET['sSymbol'] . $aField['sName'],
'variable_label' => '<div class="pm__dynavars"> <a id="dynalink" href=# onclick="insertFormVar(\''.$_GET['sFieldName'].'\',\''.$_GET['sSymbol'] . $aField['sName'].'\');">'.$_GET['sSymbol'] . $aField['sName'].'</a></div>',
'type' => $aField['sType'],
'label' => $aField['sLabel']
);
break;
}
}
array_shift($rows);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode($result);
break;
}
//$result['data'] = $rows;
//print G::json_encode( $result ) ;
/*$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;*/

View File

@@ -1,30 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
if ( isset($_GET['pid'] ) )
{
$rows = $oProcessMap->getExtInputDocumentsCriteria($_GET['pid']);
array_shift($rows);
}
if (isset($_GET['INP_DOC_UID'])) {
require_once 'classes/model/InputDocument.php';
$oInputDocument = new InputDocument();
$rows = $oInputDocument->load($_GET['INP_DOC_UID']);
}
// $result['totalCount'] = count($rows);
// $result['data'] = $rows;
// print G::json_encode( $result) ;
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}

View File

@@ -1,18 +0,0 @@
<?php
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
if ( isset($_GET['pid'] ) && !isset($_GET ['action']))
{
$rows = $oProcessMap->getExtObjectsPermissions($_GET['pid']);
}
if ( isset($_GET['pid'] )&& isset($_GET['action']) )
{
$rows = $oProcessMap->newExtObjectPermission($_GET['pid'],$_GET['action']);
array_shift($rows);
}
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode($result);
?>

View File

@@ -1,36 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
if ( isset($_GET['pid'] ) )
{
$rows = $oProcessMap->getExtOutputDocumentsCriteria($_GET['pid']);
array_shift($rows);
}
// else
// {
// $rows = $oProcessMap->getExtInputDocumentsCriteria($_GET['pid']);
// }
if (isset($_GET['tid']))
{
require_once 'classes/model/OutputDocument.php';
$oOutputDocument = new OutputDocument();
$rows = $oOutputDocument->load($_GET['tid']);
}
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
/* $result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result) ;*/
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}

View File

@@ -1,40 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
$processUID = $_GET['pid'];
$action = $_GET['action'];
switch($action)
{
case 'process_User':
$rows = $oProcessMap->listExtProcessesUser($processUID);
break;
case 'availableProcessesUser':
$rows = $oProcessMap->listExtNoProcessesUser($processUID);
break;
case 'supervisorDynaforms':
$rows = $oProcessMap->getExtSupervisorDynaformsList($processUID);
break;
case 'availableSupervisorDynaforms':
$rows = $oProcessMap->getExtAvailableSupervisorDynaformsList($processUID);
break;
case 'supervisorInputDoc':
$rows = $oProcessMap->getExtSupervisorInputsList($processUID);
break;
case 'availableSupervisorInputDoc':
$rows = $oProcessMap->getExtAvailableSupervisorInputsList($processUID);
break;
}
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}
?>

View File

@@ -1,58 +0,0 @@
<?php
/**
* processes_Export.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.
*
*/
G::LoadThirdParty('pear/json','class.json');
try {
if ( isset($_GET['pro_uid']))
$sProUid = $_GET['pro_uid'];
else
throw ( new Exception ( 'the process uid is not defined!.' ) );
/* Includes */
G::LoadClass('processes');
$oProcess = new Processes();
$proFields = $oProcess->serializeProcess( $sProUid );
$Fields = $oProcess->saveSerializedProcess ( $proFields );
if (G::is_https ())
$http = 'https://';
else
$http = 'http://';
$Fields['FILENAME_LINK'] = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/processes/' . $Fields['FILENAME_LINK'];
$result = G::json_encode( $Fields );
$result = str_replace("\\/","/",'{success:true,data:'.$result.'}'); // unescape the slashes
echo $result;
}
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,45 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
if(isset($_GET['pid']) && !isset($_GET['type'])){
$rows = $oProcessMap->getExtReportTables($_GET['pid']);
}
else if(isset($_GET['pid']) && $_GET['type'] == 'NORMAL')
{
$aTheFields = array();
$aTheFields = getDynaformsVars($_GET['pid'], false);
foreach ($aTheFields as $aField) {
$rows[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sType'],
'FIELD_NAME' => $aField['sName']);
}
}
else if(isset($_GET['pid']) && $_GET['type'] == 'GRID'){
$aTheFields = array();
$aTheFields = getGridsVars($_GET['pid']);
foreach ($aTheFields as $aField) {
$rows[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sXmlForm'],
'FIELD_NAME' => $aField['sName']);
}
}
if(isset($_GET['tid']))
{
require_once 'classes/model/ReportTable.php';
$o = new ReportTable();
$rows = $o->load($_GET['tid']);
}
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}
?>

View File

@@ -1,40 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
//$_GET['sid'] gets STEP_UID and sTYPE(i.e BEFORE and AFTER) in format STEP_UID-sTYPE
if(isset($_GET['stepid']))
{
$aStepTypeId = explode('|',$_GET['stepid']);
$_SESSION['stepUID'] = $_GET['stepid'];
//$aStepTypeId = explode('-','2517180104cd42c25cc39e4071099227-BEFORE');
$sStep = $aStepTypeId[0];
$sType = $aStepTypeId[1];
}
if (isset($_GET['pid'] ) && isset($_SESSION['stepUID']))
{
$aStepTypeId = explode('|',$_SESSION['stepUID']);
$sStep = $aStepTypeId[0];
$sType = $aStepTypeId[1];
//Getting available Steps Criteria that have been not selected for a particular task
$rows = $oProcessMap->getExtAvailableStepTriggersCriteria($_GET['pid'], $sStep, $_GET['tid'], $sType);
}
else
{
//Getting all Steps Criteria that have been selected for a particular task
$rows = $oProcessMap->getExtStepTriggersCriteria($sStep, $_GET['tid'], $sType);
}
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}
?>

View File

@@ -1,31 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
//array_shift($rows);
if($_GET['type'] == 2) //Loading sub process details
{
$rows = $oProcessMap->subProcessExtProperties($_GET['pid'], $_GET['tid'],'','0');
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
print $result;
}
else
{
$rows = $oProcessMap->subProcessExtProperties($_GET['pid'], $_GET['tid'],'',$_GET['type']);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
}
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}
?>

View File

@@ -1,64 +0,0 @@
<?php
try
{
require_once 'classes/model/Task.php';
$oTask = new Task();
$rows = $oTask->load($_GET['tid']);
while (list($key, $value) = each($rows)) {
if ($value == 'TRUE')
$rows[$key] = true;
else if($value == 'FALSE')
$rows[$key] = false;
if($key == 'TAS_TYPE_DAY' && $value == '1')
$rows[$key] = 'Work Days';
else if($key == 'TAS_TYPE_DAY' && $value == '2')
$rows[$key] = 'Calendar Days';
if($key == 'TAS_ASSIGN_TYPE')
{
switch($value)
{
case 'SELF_SERVICE':
$rows[$value] = 'true';
break;
case 'REPORT_TO':
$rows[$value] = 'true';
break;
case 'BALANCED':
$rows[$value] = 'true';
break;
case 'MANUAL':
$rows[$value] = 'true';
break;
case 'EVALUATE':
$rows[$value] = 'true';
$rows['hideEvaluateField'] = 'false';
break;
case 'STATIC_MI':
$rows[$value] = 'true';
$rows['hidePartialJoinField'] = 'false';
break;
case 'CANCEL_MI':
$rows[$value] = 'true';
$rows['hidePartialJoinField'] = 'false';
break;
}
}
}
$tmpData = G::json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}
?>

View File

@@ -1,28 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
if ( isset($_GET['pid'] ) )
{
//Getting available Steps Criteria that have been not selected for a particular task
$rows = $oProcessMap->getExtAvailableBBCriteria($_GET['pid'], $_GET['tid']);
array_shift($rows);
}
else
{
//Getting all Steps Criteria that have been selected for a particular task
$rows = $oProcessMap->getExtStepsCriteria($_GET['tid']);
array_shift($rows);
}
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}
?>

View File

@@ -1,24 +0,0 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
if ( isset($_GET['pid'] ) )
{
$rows = $oProcessMap->usersExtList($_GET['pid'], $_GET['tid']);
array_shift($rows);
}
else
{
$rows = $oProcessMap->getAvailableExtUsersCriteria($_GET['tid']);
}
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print G::json_encode( $result ) ;
}
catch ( Exception $e ) {
print G::json_encode ( $e->getMessage() );
}
?>

View File

@@ -1,60 +0,0 @@
<?php
G::LoadClass('processMap');
G::LoadClass('XmlForm_Field');
//$oXMLfield = new XmlForm_Field_TextPM(new DBConnection);
$aFields = getDynaformsVars($_GET['pid']);
if(isset ($_GET['type']))
$aType = $_GET['type'];
else $aType='';
$aRows[0] = Array (
'fieldname' => 'char',
'variable' => 'char',
'type' => 'type',
'label' => 'char'
);
foreach ( $aFields as $aField ) {
switch ($aType){
case "system":
if($aField['sType']=="system"){
$aRows[] = Array (
'fieldname' => $_GET['sFieldName'],
'variable' => $_GET['sSymbol'] . $aField['sName'],
'variable_label' => '<div class="pm__dynavars"> <a id="dynalink" href=# onclick="insertFormVar(\''.$_GET['sFieldName'].'\',\''.$_GET['sSymbol'] . $aField['sName'].'\');">'.$_GET['sSymbol'] . $aField['sName'].'</a></div>',
'type' => $aField['sType'],
'label' => $aField['sLabel']
);
}
break;
case "process":
if($aField['sType']!="system"){
$aRows[] = Array (
'fieldname' => $_GET['sFieldName'],
'variable' => $_GET['sSymbol'] . $aField['sName'],
'variable_label' => '<div class="pm__dynavars"> <a id="dynalink" href=# onclick="insertFormVar(\''.$_GET['sFieldName'].'\',\''.$_GET['sSymbol'] . $aField['sName'].'\');">'.$_GET['sSymbol'] . $aField['sName'].'</a></div>',
'type' => $aField['sType'],
'label' => $aField['sLabel']
);
}
break;
default:
$aRows[] = Array (
'fieldname' => $_GET['sFieldName'],
'variable' => $_GET['sSymbol'] . $aField['sName'],
'variable_label' => '<div class="pm__dynavars"> <a id="dynalink" href=# onclick="insertFormVar(\''.$_GET['sFieldName'].'\',\''.$_GET['sSymbol'] . $aField['sName'].'\');">'.$_GET['sSymbol'] . $aField['sName'].'</a></div>',
'type' => $aField['sType'],
'label' => $aField['sLabel']
);
break;
}
}
array_shift($aRows);
$result['totalCount'] = count($aRows);
$result['data'] = $aRows;
print G::json_encode($result);
?>

View File

@@ -1,136 +0,0 @@
<?php
/**
* saveProcess.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try{
G::LoadClass('xpdl');
G::LoadClass('processMap');
G::LoadClass('tasks');
$oProcessMap = new processMap(new DBConnection);
$oProcess = new Xpdl();
$oTask = new Task();
if(isset($_POST['PRO_UID'])){
$idProcess = $_POST['PRO_UID'];
if($oProcess->processExists ($idProcess)){
$process['ID'] = $idProcess;
}
else{
$result = array();
$result['status_code'] = $idProcess;
$result['message'] = "the process does not exist";
$result['timestamp'] = date('Y-m-d H:i:s');
echo G::json_encode($result);
die;
}
}
else{
$result = array();
$result['status_code'] = 1;
$result['message'] = "you don't send the process uid";
$result['timestamp'] = date('Y-m-d H:i:s');
echo G::json_encode($result);
die;
}
$aTasks = G::json_decode ( $_POST['tasks'] );
$aRoutes = G::json_decode ( $_POST['routes'] );
$aEvents = G::json_decode ( $_POST['events'] );
$aGateways = G::json_decode ( $_POST['gateways'] );
$aAnnotations = G::json_decode ( $_POST['annotations'] );
$aSubprocess = G::json_decode ( $_POST['subprocess'] );
$fields = $oProcess->serializeProcess($idProcess);
$oData = unserialize($fields);
$aRoutes = $oProcess->super_unique($aRoutes);
$sOutput = '';
$subProcesses = array();
foreach($aTasks as $endBase => $valueEnd){
$tasks['ID_TASK'] = $valueEnd['0'];
$tasks['START'] = '';
foreach($aEvents as $id => $value){
if($value['1'] == 'bpmnEventEmptyStart' or $value['1'] == 'bpmnEventMessageStart' or $value['1'] == 'bpmnEventTimerStart' ){
foreach($aRoutes as $endR => $valueR){
if($tasks['ID_TASK'] == $valueR['2'] and $valueR['1'] == $value['0'] ){
$tasks['START'] = 'TRUE';
unset($aEvents[$id]);
unset($aRoutes[$endR]);
}
}
}
}
if( $tasks['START'] == ''){
$tasks['START'] = 'FALSE';
}
$tasks['TAS_TITLE'] = $valueEnd['1'];
$tasks['X'] = $valueEnd['2'];
$tasks['Y'] = $valueEnd['3'];
$tasks['TAS_TYPE'] = $valueEnd['6'];
$tasks['ID_PROCESS'] = $idProcess;
//$tasks['TASK_TYPE'] = 'NORMAL';
$tasks['DESCRIPTION']= '';
$oData->tasks[]= $oProcess->createDataTask($tasks);
}
$endArray = array();
$endArray = $oProcess->convertArrayEnd($aEvents,$idProcess);
$oData->lanes = $oProcess->createLanesPM($aAnnotations,$idProcess);
$transitions = $oProcess->createArrayRoutes($oData->tasks,$aRoutes,$aEvents,$aGateways,$aEvents,$idProcess);
$oData->routes = $transitions['ROUTES'];
$routeTransitions = $transitions['TRANSITIONS'];
$numberRoutes = $transitions['NUMBER'];
$oData->tasks = $transitions['TASKS'];
$taskHidden = $transitions['HIDDEN'];
foreach($aSubprocess as $key => $value){
//print_R($value['0']);
//$sOutput = $oTask->remove($value['0']);
$sOutput = $oProcessMap->addSubProcess($idProcess,$value['2'],$value['3']);
/*$subProcess[$key]['ID_PROCESS'] = $idProcess;
$subProcess[$key]['TAS_TITLE'] = $idProcess;
$subProcess[$key]['ID_TASK'] = $value['0'];
$subProcess[$key]['TAS_UID'] = $value['0'];
$subProcess[$key]['TASK_PARENT'] = '';
$subProcess[$key]['PROCESS_PARENT'] = '';
$subProcess[$key]['TASK_TYPE'] = 'SUBPROCESS';
$subProcess[$key]['DESCRIPTION'] = '';
$subProcess[$key]['X'] = $value['2'];
$subProcess[$key]['Y'] = $value['3'];
print_R($subProcess[$key]);
$subProcesses[] = $oProcess->createSubProcess($subProcess);
$oData->tasks[] = $oProcess->createTask($subProcess[$key]);*/
}
$numberTransitions = sizeof($routeTransitions);
if($numberTransitions > 0){
$routesArray = $oProcess->createGateways($routeTransitions,$endArray,$oData->routes,$numberRoutes,$idProcess,$taskHidden);
$oData->routes = $routesArray;
}
$oProcess->updateProcessFromDataXpdl($oData,$oData->tasks);
$result->success = true;
$result->msg = G::LoadTranslation('ID_PROCESS_SAVE_SUCCESS');
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode($result);

View File

@@ -76,6 +76,16 @@ if (isset($_GET["id"]) && isset($_GET["id"])) {
}
}
$oServerConf =& serverConf::getSingleton();
if ($oServerConf->isRtl(SYS_LANG)) {
$regionTreePanel = 'east';
$regionDebug = 'west';
} else {
$regionTreePanel = 'west';
$regionDebug = 'east';
}
$oHeadPublisher->assign('regionTreePanel', $regionTreePanel);
$oHeadPublisher->assign('regionDebug', $regionDebug);
$oHeadPublisher->assign("defaultOption", $defaultOption); //User menu permissions
$oHeadPublisher->assign("_nodeId", isset($confDefaultOption)? $confDefaultOption : "PM_USERS"); //User menu permissions
$oHeadPublisher->assign("FORMATS", $conf->getFormats());

View File

@@ -154,9 +154,9 @@ try {
}
if (PHP_VERSION < 5.2) {
setcookie(session_name(), session_id(), null, '/', '; HttpOnly');
setcookie(session_name(), session_id(), null, '/', '; HttpOnly');
} else {
setcookie(session_name(), session_id(), null, '/', null, null, true);
setcookie(session_name(), session_id(), null, '/', null, null, true);
}
$aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']);
@@ -214,11 +214,11 @@ try {
//************** background processes, here we are putting some back office routines **********
$heartBeatNWIDate = $oServerConf->getHeartbeatProperty('HB_NEXT_GWI_DATE','HEART_BEAT_CONF');
if (is_null($heartBeatNWIDate)) {
$heartBeatNWIDate = time();
$heartBeatNWIDate = time();
}
if (time() >= $heartBeatNWIDate) {
$oServerConf->setWsInfo(SYS_SYS, $oServerConf->getWorkspaceInfo(SYS_SYS));
$oServerConf->setHeartbeatProperty('HB_NEXT_GWI_DATE', strtotime('+1 day'), 'HEART_BEAT_CONF');
$oServerConf->setWsInfo(SYS_SYS, $oServerConf->getWorkspaceInfo(SYS_SYS));
$oServerConf->setHeartbeatProperty('HB_NEXT_GWI_DATE', strtotime('+1 day'), 'HEART_BEAT_CONF');
}
//**** defining and saving server info, this file has the values of the global array $_SERVER ****

View File

@@ -24,63 +24,62 @@ require_once 'classes/model/UsersProperties.php';
$oUserProperty = new UsersProperties();
$aUserProperty = $oUserProperty->load($_SESSION['USER_LOGGED']);
$aHistory = unserialize($aUserProperty['USR_PASSWORD_HISTORY']);
if (!is_array($aHistory)) {
$aHistory = array();
$aHistory = array();
}
if (!defined('PPP_PASSWORD_HISTORY')) {
define('PPP_PASSWORD_HISTORY', 0);
define('PPP_PASSWORD_HISTORY', 0);
}
if (PPP_PASSWORD_HISTORY > 0) {
if (count($aHistory) >= PPP_PASSWORD_HISTORY) {
array_shift($aHistory);
}
$aHistory[] = $_POST['form']['USR_PASSWORD'];
if (count($aHistory) >= PPP_PASSWORD_HISTORY) {
array_shift($aHistory);
}
$aHistory[] = $_POST['form']['USR_PASSWORD'];
}
$aUserProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s');
$aUserProperty['USR_LOGGED_NEXT_TIME'] = 0;
$aUserProperty['USR_PASSWORD_HISTORY'] = serialize($aHistory);
$oUserProperty->update($aUserProperty);
if ( class_exists('redirectDetail')) {
//falta validar...
if(isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE']))
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
$oPluginRegistry = &PMPluginRegistry::getSingleton();
//$oPluginRegistry->showArrays();
$aRedirectLogin = $oPluginRegistry->getRedirectLogins();
if(isset($aRedirectLogin))
{ if(is_array($aRedirectLogin))
{
foreach ( $aRedirectLogin as $key=>$detail ) {
if(isset($detail->sPathMethod))
{
if ( $detail->sRoleCode == $userRole ) {
G::header('location: /sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $detail->sPathMethod );
die;
}
if (class_exists('redirectDetail')) {
//falta validar...
if (isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'])) {
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
//$oPluginRegistry->showArrays();
$aRedirectLogin = $oPluginRegistry->getRedirectLogins();
if (isset($aRedirectLogin)) {
if (is_array($aRedirectLogin)) {
foreach ($aRedirectLogin as $key => $detail) {
if (isset($detail->sPathMethod)) {
if ($detail->sRoleCode == $userRole) {
G::header('location: /sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $detail->sPathMethod );
die;
}
}
}
}
}
}
}
}
//end plugin
if (isset($frm['USER_LANG'])) {
if (isset($frm['USER_LANG'])) {
if ($frm['USER_LANG'] != '') {
$lang = $frm['USER_LANG'];
$lang = $frm['USER_LANG'];
}
}
else {
} else {
if (defined('SYS_LANG')) {
$lang = SYS_LANG;
$lang = SYS_LANG;
} else {
$lang = 'en';
}
else {
$lang = 'en';
}
}
$sLocation = $oUserProperty->redirectTo($_SESSION['USER_LOGGED'], $lang);
G::header('Location: ' . $sLocation);
die;
}
$sLocation = $oUserProperty->redirectTo($_SESSION['USER_LOGGED'], $lang);
G::header('Location: ' . $sLocation);
die;
?>

View File

@@ -24,82 +24,78 @@
*
*/
function lookup( $target ) {
global $ntarget;
$msg = $target . ' => ';
//if (eregi ( '[a-zA-Z]', $target ))
if (preg_match( '[a-zA-Z]', $target )) //Made compatible to PHP 5.3
$ntarget = gethostbyname ( $target );
else
$ntarget = gethostbyaddr ( $target );
$msg .= $ntarget;
return ($msg);
function lookup ($target)
{
global $ntarget;
$msg = $target . ' => ';
//if (eregi ( '[a-zA-Z]', $target ))
if (preg_match( '[a-zA-Z]', $target )) {
//Made compatible to PHP 5.3
$ntarget = gethostbyname ( $target );
} else {
$ntarget = gethostbyaddr ( $target );
}
$msg .= $ntarget;
return ($msg);
}
G::LoadClass("system");
if (getenv ( 'HTTP_CLIENT_IP' )) {
$ip = getenv ( 'HTTP_CLIENT_IP' );
}
else {
if (getenv ( 'HTTP_X_FORWARDED_FOR' )) {
$ip = getenv ( 'HTTP_X_FORWARDED_FOR' );
}
else {
$ip = getenv ( 'REMOTE_ADDR' );
}
$ip = getenv ( 'HTTP_CLIENT_IP' );
} else {
if (getenv ( 'HTTP_X_FORWARDED_FOR' )) {
$ip = getenv ( 'HTTP_X_FORWARDED_FOR' );
} else {
$ip = getenv ( 'REMOTE_ADDR' );
}
}
$redhat = '';
if (file_exists ( '/etc/redhat-release' )) {
$fnewsize = filesize ( '/etc/redhat-release' );
$fp = fopen ( '/etc/redhat-release', 'r' );
$redhat = trim ( fread ( $fp, $fnewsize ) );
fclose ( $fp );
$fnewsize = filesize ( '/etc/redhat-release' );
$fp = fopen ( '/etc/redhat-release', 'r' );
$redhat = trim ( fread ( $fp, $fnewsize ) );
fclose ( $fp );
}
$redhat .= " (" . PHP_OS . ")";
if (defined ( "DB_HOST" )) {
G::LoadClass ( 'net' );
G::LoadClass ( 'dbConnections' );
$dbNetView = new NET ( DB_HOST );
$dbNetView->loginDbServer ( DB_USER, DB_PASS );
$dbConns = new dbConnections ( '' );
$availdb = '';
foreach ( $dbConns->getDbServicesAvailables () as $key => $val ) {
if ($availdb != '')
$availdb .= ', ';
$availdb .= $val ['name'];
}
try {
$sMySQLVersion = $dbNetView->getDbServerVersion ( DB_ADAPTER );
}
catch ( Exception $oException ) {
$sMySQLVersion = '?????';
}
G::LoadClass ( 'net' );
G::LoadClass ( 'dbConnections' );
$dbNetView = new NET ( DB_HOST );
$dbNetView->loginDbServer ( DB_USER, DB_PASS );
$dbConns = new dbConnections ( '' );
$availdb = '';
foreach ($dbConns->getDbServicesAvailables () as $key => $val) {
if ($availdb != '') {
$availdb .= ', ';
}
$availdb .= $val ['name'];
}
try {
$sMySQLVersion = $dbNetView->getDbServerVersion ( DB_ADAPTER );
} catch (Exception $oException) {
$sMySQLVersion = '?????';
}
}
$Fields ['SYSTEM'] = $redhat;
if (defined ( "DB_HOST" )) {
$Fields ['DATABASE'] = $dbNetView->dbName ( DB_ADAPTER ) . ' (Version ' . $sMySQLVersion . ')';
$Fields ['DATABASE_SERVER'] = DB_HOST;
$Fields ['DATABASE_NAME'] = DB_NAME;
$Fields ['AVAILABLE_DB'] = $availdb;
}
else {
$Fields ['DATABASE'] = "Not defined";
$Fields ['DATABASE_SERVER'] = "Not defined";
$Fields ['DATABASE_NAME'] = "Not defined";
$Fields ['AVAILABLE_DB'] = "Not defined";
$Fields ['DATABASE'] = $dbNetView->dbName ( DB_ADAPTER ) . ' (Version ' . $sMySQLVersion . ')';
$Fields ['DATABASE_SERVER'] = DB_HOST;
$Fields ['DATABASE_NAME'] = DB_NAME;
$Fields ['AVAILABLE_DB'] = $availdb;
} else {
$Fields ['DATABASE'] = "Not defined";
$Fields ['DATABASE_SERVER'] = "Not defined";
$Fields ['DATABASE_NAME'] = "Not defined";
$Fields ['AVAILABLE_DB'] = "Not defined";
}
$eeT="";
if(class_exists('pmLicenseManager')){
if (class_exists('pmLicenseManager')) {
$eeT=" - Enterprise Edition";
}
}
$Fields ['PHP'] = phpversion ();
$Fields ['FLUID'] = System::getVersion() . $eeT;
$Fields ['IP'] = lookup ( $ip );
@@ -113,8 +109,9 @@ $Fields ['SERVER_ADDR'] = getenv ( 'SERVER_ADDR' );
$Fields ['HTTP_USER_AGENT'] = getenv ( 'HTTP_USER_AGENT' );
$Fields ['TIME_ZONE'] = (defined('TIME_ZONE')) ? TIME_ZONE : "Unknown";
if (! defined ( 'SKIP_RENDER_SYSTEM_INFORMATION' )) {
$G_PUBLISH = new Publisher ( );
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/dbInfo', '', $Fields, 'appNew2' );
G::RenderPage ( 'publish', 'raw' );
if (!defined( 'SKIP_RENDER_SYSTEM_INFORMATION')) {
$G_PUBLISH = new Publisher ( );
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/dbInfo', '', $Fields, 'appNew2' );
G::RenderPage ( 'publish', 'raw' );
}

View File

@@ -22,7 +22,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$G_PUBLISH = new Publisher ();
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/forgotPassword', '', array(), 'retrivePassword.php');
G::RenderPage ( "publish" );
$G_PUBLISH = new Publisher ();
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/forgotPassword', '', array(), 'retrivePassword.php');
G::RenderPage ( "publish" );

View File

@@ -22,7 +22,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$newFile = str_replace ( 'index.php', 'login.php' , __FILE__ ) ;
$newFile = str_replace ( 'index.php', 'login.php' , __FILE__ );
return $newFile;

View File

@@ -23,28 +23,25 @@
*
*/
try {
G::LoadInclude ( 'ajax' );
if (isset ( $_POST ['form'] )) {
$_POST = $_POST ['form'];
}
$_POST ['function'] = get_ajax_value ( 'function' );
switch ($_POST ['function']) {
case 'getStarted_save' :
require_once 'classes/model/Configuration.php';
$aData ['CFG_UID'] = 'getStarted';
$aData ['OBJ_UID'] = '';
$aData ['CFG_VALUE'] = '1';
$aData ['PRO_UID'] = '';
$aData ['USR_UID'] = '';
$aData ['APP_UID'] = '';
$oConfig = new Configuration ( );
$oConfig->create ( $aData );
break;
}
}
catch ( Exception $oException ) {
die ( $oException->getMessage () );
G::LoadInclude ( 'ajax' );
if (isset ( $_POST ['form'] )) {
$_POST = $_POST ['form'];
}
$_POST ['function'] = get_ajax_value ( 'function' );
switch ($_POST ['function']) {
case 'getStarted_save':
require_once 'classes/model/Configuration.php';
$aData ['CFG_UID'] = 'getStarted';
$aData ['OBJ_UID'] = '';
$aData ['CFG_VALUE'] = '1';
$aData ['PRO_UID'] = '';
$aData ['USR_UID'] = '';
$aData ['APP_UID'] = '';
$oConfig = new Configuration ( );
$oConfig->create ( $aData );
break;
}
} catch ( Exception $oException ) {
die ( $oException->getMessage () );
}

View File

@@ -30,7 +30,7 @@ $G_SUB_MENU = "empty";
$referer = $_SERVER ['HTTP_REFERER'];
$dbc = new DBConnection ( );
$G_PUBLISH = new Publisher ( );
$G_PUBLISH->AddContent ( "xmlform", "xmlform", "login/noViewPage", "", NULL );
$G_PUBLISH->AddContent ( "xmlform", "xmlform", "login/noViewPage", "", null );
G::RenderPage ( "publish" );
?>

View File

@@ -11,40 +11,40 @@ $user = new Users();
$userData = $rbacUser->getByUsername($data['USR_USERNAME']);
if($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL']) {
$aSetup = getEmailConfiguration();
if (count($aSetup) == 0 || !isset($aSetup['MESS_ENGINE'])) {
G::SendTemporalMessage ('ID_EMAIL_ENGINE_IS_NOT_ENABLED', "warning");
G::header('location: forgotPassword');
die;
}
if ($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL']) {
$aSetup = getEmailConfiguration();
if (count($aSetup) == 0 || !isset($aSetup['MESS_ENGINE'])) {
G::SendTemporalMessage ('ID_EMAIL_ENGINE_IS_NOT_ENABLED', "warning");
G::header('location: forgotPassword');
die;
}
$newPass = G::generate_password();
$newPass = G::generate_password();
$aData['USR_UID'] = $userData['USR_UID'];
$aData['USR_PASSWORD'] = md5($newPass);
/* **Save after sending the mail
$rbacUser->update($aData);
$user->update($aData);
*/
$sFrom = ($aSetup['MESS_ACCOUNT'] != '' ? $aSetup['MESS_ACCOUNT'] . ' ' : '') . '<' . $aSetup['MESS_ACCOUNT'] . '>';
$sSubject = G::LoadTranslation('ID_RESET_PASSWORD').' - ProcessMaker' ;
$msg = '<h3>ProcessMaker Forgot password Service</h3>';
$msg .='<p>'.G::LoadTranslation('ID_YOUR_USERMANE_IS').' : <strong>'.$userData['USR_USERNAME'].'</strong></p>';
$msg .='<p>'.G::LoadTranslation('ID_YOUR_PASSWORD_IS').' : <strong>'.$newPass.'</strong></p>';
switch ($aSetup['MESS_ENGINE']) {
case 'MAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1');
break;
case 'PHPMAILER':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_2');
break;
case 'OPENMAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_3');
break;
}
$aData['USR_UID'] = $userData['USR_UID'];
$aData['USR_PASSWORD'] = md5($newPass);
/* **Save after sending the mail
$rbacUser->update($aData);
$user->update($aData);
*/
$sFrom = ($aSetup['MESS_ACCOUNT'] != '' ? $aSetup['MESS_ACCOUNT'] . ' ' : '') . '<' . $aSetup['MESS_ACCOUNT'] . '>';
$sSubject = G::LoadTranslation('ID_RESET_PASSWORD').' - ProcessMaker' ;
$msg = '<h3>ProcessMaker Forgot password Service</h3>';
$msg .='<p>'.G::LoadTranslation('ID_YOUR_USERMANE_IS').' : <strong>'.$userData['USR_USERNAME'].'</strong></p>';
$msg .='<p>'.G::LoadTranslation('ID_YOUR_PASSWORD_IS').' : <strong>'.$newPass.'</strong></p>';
switch ($aSetup['MESS_ENGINE']) {
case 'MAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1');
break;
case 'PHPMAILER':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_2');
break;
case 'OPENMAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_3');
break;
}
$sBody = "
$sBody = "
<table style=\"background-color: white; font-family: Arial,Helvetica,sans-serif; color: black; font-size: 11px; text-align: left;\" cellpadding='10' cellspacing='0' width='100%'>
<tbody><tr><td><img id='logo' src='http://".$_SERVER['SERVER_NAME']."/images/processmaker.logo.jpg' /></td></tr>
<tr><td style='font-size: 14px;'>$msg</td></tr>
@@ -53,99 +53,66 @@ if($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL']
<a href='http://www.processmaker.com' style='color:#c40000;'>www.processmaker.com</a><br /></td>
</tr></tbody></table>";
G::LoadClass('spool');
$oSpool = new spoolRun();
G::LoadClass('spool');
$oSpool = new spoolRun();
$oSpool->setConfig( array(
'MESS_ENGINE' => $aSetup['MESS_ENGINE'],
'MESS_SERVER' => $aSetup['MESS_SERVER'],
'MESS_PORT' => $aSetup['MESS_PORT'],
'MESS_ACCOUNT' => $aSetup['MESS_ACCOUNT'],
'MESS_PASSWORD' => $aSetup['MESS_PASSWORD'],
'SMTPAuth' => $aSetup['MESS_RAUTH'],
'SMTPSecure' => $aSetup['SMTPSecure']
));
$oSpool->setConfig( array(
'MESS_ENGINE' => $aSetup['MESS_ENGINE'],
'MESS_SERVER' => $aSetup['MESS_SERVER'],
'MESS_PORT' => $aSetup['MESS_PORT'],
'MESS_ACCOUNT' => $aSetup['MESS_ACCOUNT'],
'MESS_PASSWORD' => $aSetup['MESS_PASSWORD'],
'SMTPAuth' => $aSetup['MESS_RAUTH'],
'SMTPSecure' => $aSetup['SMTPSecure']
));
$passwd = $oSpool->config['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
$passwd = $oSpool->config['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
}
}
}
$oSpool->config['MESS_PASSWORD'] = $passwd;
$oSpool->create(array(
'msg_uid' => '',
'app_uid' => '',
'del_index' => 0,
'app_msg_type' => 'TEST',
'app_msg_subject' => $sSubject,
'app_msg_from' => $sFrom,
'app_msg_to' => $data['USR_EMAIL'],
'app_msg_body' => $sBody,
'app_msg_cc' => '',
'app_msg_bcc' => '',
'app_msg_attach' => '',
'app_msg_template' => '',
'app_msg_status' => 'pending',
'app_msg_attach'=>''
));
$oSpool->config['MESS_PASSWORD'] = $passwd;
try {
$oSpool->sendMail();
$rbacUser->update($aData);
$user->update($aData);
G::header ("location: login.html");
G::SendTemporalMessage ('ID_NEW_PASSWORD_SENT', "info");
}
catch (phpmailerException $e) {
G::header ("location: login.html");
G::SendTemporalMessage (G::LoadTranslation('MISSING_OR_NOT_CONFIGURED_SMTP'), "warning", 'string');
}
catch (Exception $e) {
G::header ("location: login.html");
G::SendTemporalMessage ($e->getMessage(), "warning", 'string');
}
$oSpool->create(array(
'msg_uid' => '',
'app_uid' => '',
'del_index' => 0,
'app_msg_type' => 'TEST',
'app_msg_subject' => $sSubject,
'app_msg_from' => $sFrom,
'app_msg_to' => $data['USR_EMAIL'],
'app_msg_body' => $sBody,
'app_msg_cc' => '',
'app_msg_bcc' => '',
'app_msg_attach' => '',
'app_msg_template' => '',
'app_msg_status' => 'pending',
'app_msg_attach'=>''
));
try {
$oSpool->sendMail();
$rbacUser->update($aData);
$user->update($aData);
G::header ("location: login.html");
G::SendTemporalMessage ('ID_NEW_PASSWORD_SENT', "info");
} catch (phpmailerException $e) {
G::header ("location: login.html");
G::SendTemporalMessage (G::LoadTranslation('MISSING_OR_NOT_CONFIGURED_SMTP'), "warning", 'string');
} catch (Exception $e) {
G::header ("location: login.html");
G::SendTemporalMessage ($e->getMessage(), "warning", 'string');
}
} else {
$msg = G::LoadTranslation('ID_USER') . ' ' . $data['USR_USERNAME'] . ' '. G::LoadTranslation('ID_IS_NOT_REGISTERED');
G::SendTemporalMessage ($msg, "warning", 'string');
G::header('location: forgotPassword');
$msg = G::LoadTranslation('ID_USER') . ' ' . $data['USR_USERNAME'] . ' '. G::LoadTranslation('ID_IS_NOT_REGISTERED');
G::SendTemporalMessage ($msg, "warning", 'string');
G::header('location: forgotPassword');
}

View File

@@ -23,9 +23,11 @@
*
*/
if (! isset ( $_POST ))
G::header ( 'location: /sys/' . $lang . '/' . SYS_SKIN . '/' . 'login/login' );
if (! isset ( $_POST )) {
G::header ( 'location: /sys/' . $lang . '/' . SYS_SKIN . '/' . 'login/login' );
}
if (isset ( $_SESSION ['sysLogin'] )) {
$_POST ['form'] = $_SESSION ['sysLogin'];
}
require_once ('authentication.php');
if (isset ( $_SESSION ['sysLogin'] ))
$_POST ['form'] = $_SESSION ['sysLogin'];
require_once ('authentication.php');

View File

@@ -1,40 +1,39 @@
<?php
/**
* messages_Delete.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.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadClass('message');
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$messages = new Message( $dbc );
if (!isset($_POST['MESS_UID'])) return;
$messages->Delete( $_POST['MESS_UID'] );
?>
<?php
/**
* messages_Delete.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.
*/
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadClass( 'message' );
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
$messages = new Message( $dbc );
if (! isset( $_POST['MESS_UID'] )) {
return;
}
$messages->Delete( $_POST['MESS_UID'] );

View File

@@ -1,43 +1,43 @@
<?php
/**
* messages_Edit.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.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadClass('message');
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$messages = new Message( $dbc );
$messages->Fields['MESS_UID']=(isset($_GET['MESS_UID'])) ? urldecode($_GET['MESS_UID']):'0';
$messages->Load( $messages->Fields['MESS_UID'] );
$messages->Fields['PRO_UID'] = isset($messages->Fields['PRO_UID'])?$messages->Fields['PRO_UID']:$_GET['PRO_UID'];
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'messages/messages_Edit', '', $messages->Fields , SYS_URI . 'messages/messages_Save');
G::RenderPage( "publish" , "raw" );
?>
<?php
/**
* messages_Edit.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.
*/
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadClass( 'message' );
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
$messages = new Message( $dbc );
$messages->Fields['MESS_UID'] = (isset( $_GET['MESS_UID'] )) ? urldecode( $_GET['MESS_UID'] ) : '0';
$messages->Load( $messages->Fields['MESS_UID'] );
$messages->Fields['PRO_UID'] = isset( $messages->Fields['PRO_UID'] ) ? $messages->Fields['PRO_UID'] : $_GET['PRO_UID'];
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'messages/messages_Edit', '', $messages->Fields, SYS_URI . 'messages/messages_Save' );
G::RenderPage( "publish", "raw" );

View File

@@ -1,47 +1,45 @@
<?php
/**
* messages_List.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'MESSAGES';
$dbc = new DBConnection();
$ses = new DBSession($dbc);
//Hardcode: UID of the library by default
$PRO_UID='746B734DC23311';
$G_PUBLISH = new Publisher;
$Fields=array( 'SYS_LANG' => SYS_LANG,
'PRO_UID' => $PRO_UID );
$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'messages/messages_List', '', $Fields , 'messages_Save');
G::RenderPage( "publish" );
?>
<?php
/**
* messages_List.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'MESSAGES';
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
//Hardcode: UID of the library by default
$PRO_UID = '746B734DC23311';
$G_PUBLISH = new Publisher();
$Fields = array ('SYS_LANG' => SYS_LANG,'PRO_UID' => $PRO_UID);
$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'messages/messages_List', '', $Fields, 'messages_Save' );
G::RenderPage( "publish" );

View File

@@ -1,39 +1,40 @@
<?php
/**
* messages_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.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadClass('message');
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$messages = new Message( $dbc );
if ($_POST['form']['MESS_UID']==='') unset($_POST['form']['MESS_UID']);
$messages->Save( $_POST['form'] );
?>
<?php
/**
* messages_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.
*/
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadClass( 'message' );
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
$messages = new Message( $dbc );
if ($_POST['form']['MESS_UID'] === '') {
unset( $_POST['form']['MESS_UID'] );
}
$messages->Save( $_POST['form'] );

View File

@@ -1,17 +1,23 @@
<?php
require_once 'classes/model/OutputDocument.php';
$uid = $_SERVER['QUERY_STRING'];
$oOutputDocument = new OutputDocument();
$aFields = $oOutputDocument->load($uid);
$type = $aFields['OUT_DOC_TYPE'];
if ( $type == 'JRXML') $extension = 'jrxml';
if ( $type == 'ACROFORM') $extension = 'pdf';
$fileJrxml = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension ;
$bDownload = true;
// The ereg_replace function has been DEPRECATED as of PHP 5.3.0.
// $downFileName = ereg_replace('[^A-Za-z0-9_]', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension;
$downFileName = preg_replace('/[^A-Za-z0-9_]/i', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension;
G::streamFile ( $fileJrxml, $bDownload, $downFileName );
<?php
require_once 'classes/model/OutputDocument.php';
$uid = $_SERVER['QUERY_STRING'];
$oOutputDocument = new OutputDocument();
$aFields = $oOutputDocument->load( $uid );
$type = $aFields['OUT_DOC_TYPE'];
if ($type == 'JRXML') {
$extension = 'jrxml';
}
if ($type == 'ACROFORM') {
$extension = 'pdf';
}
$fileJrxml = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension;
$bDownload = true;
// The ereg_replace function has been DEPRECATED as of PHP 5.3.0.
// $downFileName = ereg_replace('[^A-Za-z0-9_]', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension;
$downFileName = preg_replace( '/[^A-Za-z0-9_]/i', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension;
G::streamFile( $fileJrxml, $bDownload, $downFileName );

View File

@@ -1,83 +1,78 @@
<?php
$action = isset($POST['action'])? $POST['action']: isset($_GET['action'])? $_GET['action']: '';
<?php
$action = isset( $POST['action'] ) ? $POST['action'] : isset( $_GET['action'] ) ? $_GET['action'] : '';
// Function call from ajax_function for calling to lookForNameOutput.
if($action=='') {
$action = isset($_POST['function'])?$_POST['function']:'';
}
switch($action){
case 'setTemplateFile':
//print_r($_FILES);
$_SESSION['outpudocs_tmpFile'] = PATH_DATA . $_FILES['templateFile']['name'];
// file_put_contents($_FILES['templateFile']['name'], file_get_contents($_FILES['templateFile']['tmp_name']));
copy($_FILES['templateFile']['tmp_name'], $_SESSION['outpudocs_tmpFile']);
$result = new stdClass();
$result->success = true;
$result->msg = 'success - saved '. $_SESSION['outpudocs_tmpFile'];
echo G::json_encode($result);
break;
case 'getTemplateFile':
$aExtensions = array ( "exe", "com", "dll", "ocx", "fon", "ttf", "doc", "xls", "mdb", "rtf", "bin",
"jpeg", "jpg", "jif", "jfif", "gif", "tif", "tiff", "png", "bmp", "pdf",
"aac", "mp3", "mp3pro", "vorbis", "realaudio", "vqf", "wma",
"aiff", "flac", "wav", "midi", "mka", "ogg", "jpeg", "ilbm",
"tar", "zip", "rar", "arj", "gzip", "bzip2", "afio", "kgb", "gz",
"asf", "avi", "mov", "iff", "ogg", "ogm", "mkv", "3gp",
);
$sFileName = strtolower($_SESSION['outpudocs_tmpFile']);
$strRev = strrev($sFileName);
$searchPos = strpos($strRev, '.');
$pos = (strlen($sFileName) - 1) - $searchPos;
$sExtension = substr($sFileName, $pos+1, strlen($sFileName));
if(! in_array($sExtension, $aExtensions))
echo $content = file_get_contents($_SESSION['outpudocs_tmpFile']);
break;
case 'loadTemplateContent':
require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
if (isset($_POST['OUT_DOC_UID'])) {
$aFields = $ooutputDocument->load($_POST['OUT_DOC_UID']);
echo $aFields['OUT_DOC_TEMPLATE'];
}
break;
case 'lookForNameOutput':
require_once('classes/model/Content.php');
require_once ( "classes/model/OutputDocument.php" );
$snameInput = urldecode($_POST['NAMEOUTPUT']);
$sPRO_UID = urldecode($_POST['proUid']);
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_UID);
$oCriteria->add(OutputDocumentPeer::PRO_UID, $sPRO_UID);
$oDataset = OutputDocumentPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$flag = true;
while ($oDataset->next() && $flag) {
$aRow = $oDataset->getRow();
$oCriteria1 = new Criteria('workflow');
$oCriteria1->addSelectColumn('COUNT(*) AS OUTPUTS');
$oCriteria1->add(ContentPeer::CON_CATEGORY, 'OUT_DOC_TITLE');
$oCriteria1->add(ContentPeer::CON_ID, $aRow['OUT_DOC_UID']);
$oCriteria1->add(ContentPeer::CON_VALUE, $snameInput);
$oCriteria1->add(ContentPeer::CON_LANG, SYS_LANG);
$oDataset1 = ContentPeer::doSelectRS($oCriteria1);
$oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset1->next();
$aRow1 = $oDataset1->getRow();
if ($aRow1['OUTPUTS'])
$flag = false;
}
echo $flag;
// G::json_encode($flag);
break;
if ($action == '') {
$action = isset( $_POST['function'] ) ? $_POST['function'] : '';
}
switch ($action) {
case 'setTemplateFile':
//print_r($_FILES);
$_SESSION['outpudocs_tmpFile'] = PATH_DATA . $_FILES['templateFile']['name'];
// file_put_contents($_FILES['templateFile']['name'], file_get_contents($_FILES['templateFile']['tmp_name']));
copy( $_FILES['templateFile']['tmp_name'], $_SESSION['outpudocs_tmpFile'] );
$result = new stdClass();
$result->success = true;
$result->msg = 'success - saved ' . $_SESSION['outpudocs_tmpFile'];
echo G::json_encode( $result );
break;
case 'getTemplateFile':
$aExtensions = array ("exe","com","dll","ocx","fon","ttf","doc","xls","mdb","rtf","bin","jpeg","jpg","jif","jfif","gif","tif","tiff","png","bmp","pdf","aac","mp3","mp3pro","vorbis","realaudio","vqf","wma","aiff","flac","wav","midi","mka","ogg","jpeg","ilbm","tar","zip","rar","arj","gzip","bzip2","afio","kgb","gz","asf","avi","mov","iff","ogg","ogm","mkv","3gp"
);
$sFileName = strtolower( $_SESSION['outpudocs_tmpFile'] );
$strRev = strrev( $sFileName );
$searchPos = strpos( $strRev, '.' );
$pos = (strlen( $sFileName ) - 1) - $searchPos;
$sExtension = substr( $sFileName, $pos + 1, strlen( $sFileName ) );
if (! in_array( $sExtension, $aExtensions ))
echo $content = file_get_contents( $_SESSION['outpudocs_tmpFile'] );
break;
case 'loadTemplateContent':
require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
if (isset( $_POST['OUT_DOC_UID'] )) {
$aFields = $ooutputDocument->load( $_POST['OUT_DOC_UID'] );
echo $aFields['OUT_DOC_TEMPLATE'];
}
break;
case 'lookForNameOutput':
require_once ('classes/model/Content.php');
require_once ("classes/model/OutputDocument.php");
$snameInput = urldecode( $_POST['NAMEOUTPUT'] );
$sPRO_UID = urldecode( $_POST['proUid'] );
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( OutputDocumentPeer::OUT_DOC_UID );
$oCriteria->add( OutputDocumentPeer::PRO_UID, $sPRO_UID );
$oDataset = OutputDocumentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$flag = true;
while ($oDataset->next() && $flag) {
$aRow = $oDataset->getRow();
$oCriteria1 = new Criteria( 'workflow' );
$oCriteria1->addSelectColumn( 'COUNT(*) AS OUTPUTS' );
$oCriteria1->add( ContentPeer::CON_CATEGORY, 'OUT_DOC_TITLE' );
$oCriteria1->add( ContentPeer::CON_ID, $aRow['OUT_DOC_UID'] );
$oCriteria1->add( ContentPeer::CON_VALUE, $snameInput );
$oCriteria1->add( ContentPeer::CON_LANG, SYS_LANG );
$oDataset1 = ContentPeer::doSelectRS( $oCriteria1 );
$oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset1->next();
$aRow1 = $oDataset1->getRow();
if ($aRow1['OUTPUTS'])
$flag = false;
}
echo $flag;
// G::json_encode($flag);
break;
}

View File

@@ -1,67 +1,60 @@
<?php
/**
* outputdocs_Delete.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) {
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
require_once 'classes/model/OutputDocument.php';
require_once 'classes/model/ObjectPermission.php';
require_once 'classes/model/Step.php';
G::LoadClass( 'processMap' );
$oOutputDocument = new OutputDocument();
$fields = $oOutputDocument->load($_POST['OUT_DOC_UID']);
$oOutputDocument->remove($_POST['OUT_DOC_UID']);
$oStep = new Step();
$oStep->removeStep('OUTPUT_DOCUMENT', $_POST['OUT_DOC_UID']);
$oOP = new ObjectPermission();
$oOP->removeByObject('OUTPUT', $_POST['OUT_DOC_UID']);
//refresh dbarray with the last change in outputDocument
$oMap = new processMap();
$oCriteria = $oMap->getOutputDocumentsCriteria($fields['PRO_UID'] );
$result->success = true;
$result->msg = G::LoadTranslation('ID_OUTPUTDOCUMENT_REMOVED');
}
catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
//die($oException->getMessage());
}
print G::json_encode($result);
?>
<?php
/**
* outputdocs_Delete.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
try {
global $RBAC;
switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
require_once 'classes/model/OutputDocument.php';
require_once 'classes/model/ObjectPermission.php';
require_once 'classes/model/Step.php';
G::LoadClass( 'processMap' );
$oOutputDocument = new OutputDocument();
$fields = $oOutputDocument->load( $_POST['OUT_DOC_UID'] );
$oOutputDocument->remove( $_POST['OUT_DOC_UID'] );
$oStep = new Step();
$oStep->removeStep( 'OUTPUT_DOCUMENT', $_POST['OUT_DOC_UID'] );
$oOP = new ObjectPermission();
$oOP->removeByObject( 'OUTPUT', $_POST['OUT_DOC_UID'] );
//refresh dbarray with the last change in outputDocument
$oMap = new processMap();
$oCriteria = $oMap->getOutputDocumentsCriteria( $fields['PRO_UID'] );
$result->success = true;
$result->msg = G::LoadTranslation( 'ID_OUTPUTDOCUMENT_REMOVED' );
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
//die($oException->getMessage());
}
print G::json_encode( $result );

View File

@@ -1,105 +1,103 @@
<?php
/**
* outputdocs_Edit.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) {
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
if (isset($_GET['OUT_DOC_UID'])) {
$aFields = $ooutputDocument->load($_GET['OUT_DOC_UID']);
}
else {
$aFields = array();
$aFields['PRO_UID'] = $_GET['PRO_UID'];
}
require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
if (isset($_GET['OUT_DOC_UID'])) {
$aFields = $ooutputDocument->load($_GET['OUT_DOC_UID']);
}
else {
$aFields = array();
$aFields['PRO_UID'] = $_GET['PRO_UID'];
}
$type = isset ( $aFields['OUT_DOC_TYPE']) ? $aFields['OUT_DOC_TYPE'] : 'HTML';
G::LoadClass('xmlfield_InputPM');
$G_PUBLISH = new Publisher();
switch ( $type ) {
case 'HTML' :
//$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Edit', '', $aFields , '../outputdocs/outputdocs_Save');
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->assign('OUT_DOC_UID', $_GET['OUT_DOC_UID']);
$translations = G::getTranslations(Array(
'ID_FILE', 'ID_OUT_PUT_DOC_UPLOAD_TITLE', 'ID_UPLOADING_FILE', 'ID_UPLOAD', 'ID_CANCEL',
'ID_SAVE', 'ID_LOAD_FROM_FILE', 'ID_SELECT_TEMPLATE_FILE', 'ID_ALERT_MESSAGE', 'ID_INVALID_FILE'
));
// $oHeadPublisher->assign('TRANSLATIONS', $translations);
$oHeadPublisher->addExtJsScript('outputdocs/htmlEditor', false ); //adding a javascript file .js
G::RenderPage('publish', 'extJs');
die;
break;
case 'JRXML' :
case 'ACROFORM' :
$type = $aFields['OUT_DOC_TYPE'];
if ( $type == 'JRXML') $extension = 'jrxml';
if ( $type == 'ACROFORM') $extension = 'pdf';
// The ereg_replace function has been DEPRECATED as of PHP 5.3.0.
// $downFileName = ereg_replace('[^A-Za-z0-9_]', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension;
$downFileName = preg_replace('/[^A-Za-z0-9_]/i', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension;
$filename = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension ;
if ( file_exists ( $filename) )
$aFields['FILENAME'] = $downFileName;
else
$aFields['FILENAME'] = '';
$aFields['FILELINK'] = '../outputdocs/downloadFile?' . $aFields['OUT_DOC_UID'];
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsUploadFile', '', $aFields , '../outputdocs/uploadFile');
$G_PUBLISH->AddContent('view', 'outputdocs/editJrxml' );
break;
}
G::RenderPage('publish', 'raw');
}
catch (Exception $oException) {
die($oException->getMessage());
<?php
/**
* outputdocs_Edit.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
try {
global $RBAC;
switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
if (isset( $_GET['OUT_DOC_UID'] )) {
$aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] );
} else {
$aFields = array ();
$aFields['PRO_UID'] = $_GET['PRO_UID'];
}
require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
if (isset( $_GET['OUT_DOC_UID'] )) {
$aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] );
} else {
$aFields = array ();
$aFields['PRO_UID'] = $_GET['PRO_UID'];
}
$type = isset( $aFields['OUT_DOC_TYPE'] ) ? $aFields['OUT_DOC_TYPE'] : 'HTML';
G::LoadClass( 'xmlfield_InputPM' );
$G_PUBLISH = new Publisher();
switch ($type) {
case 'HTML':
//$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Edit', '', $aFields , '../outputdocs/outputdocs_Save');
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->assign( 'OUT_DOC_UID', $_GET['OUT_DOC_UID'] );
$translations = G::getTranslations( Array ('ID_FILE','ID_OUT_PUT_DOC_UPLOAD_TITLE','ID_UPLOADING_FILE','ID_UPLOAD','ID_CANCEL','ID_SAVE','ID_LOAD_FROM_FILE','ID_SELECT_TEMPLATE_FILE','ID_ALERT_MESSAGE','ID_INVALID_FILE') );
// $oHeadPublisher->assign('TRANSLATIONS', $translations);
$oHeadPublisher->addExtJsScript( 'outputdocs/htmlEditor', false ); //adding a javascript file .js
G::RenderPage( 'publish', 'extJs' );
die();
break;
case 'JRXML':
break;
case 'ACROFORM':
$type = $aFields['OUT_DOC_TYPE'];
if ($type == 'JRXML') {
$extension = 'jrxml';
}
if ($type == 'ACROFORM') {
$extension = 'pdf';
}
// The ereg_replace function has been DEPRECATED as of PHP 5.3.0.
// $downFileName = ereg_replace('[^A-Za-z0-9_]', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension;
$downFileName = preg_replace( '/[^A-Za-z0-9_]/i', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension;
$filename = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension;
if (file_exists( $filename )) {
$aFields['FILENAME'] = $downFileName;
} else {
$aFields['FILENAME'] = '';
}
$aFields['FILELINK'] = '../outputdocs/downloadFile?' . $aFields['OUT_DOC_UID'];
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocsUploadFile', '', $aFields, '../outputdocs/uploadFile' );
$G_PUBLISH->AddContent( 'view', 'outputdocs/editJrxml' );
break;
}
G::RenderPage( 'publish', 'raw' );
} catch (Exception $oException) {
die( $oException->getMessage() );
}

View File

@@ -1,45 +1,42 @@
<?php
/**
* outputdocs_List.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'OUTPUTDOCS';
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$G_PUBLISH = new Publisher;
$Fields=array( 'SYS_LANG' => SYS_LANG,
);
$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'outputdocs/outputdocs_List', '', $Fields , 'outputdocs_Save');
G::RenderPage( "publish" );
?>
<?php
/**
* outputdocs_List.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'OUTPUTDOCS';
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
$G_PUBLISH = new Publisher();
$Fields = array ('SYS_LANG' => SYS_LANG);
$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'outputdocs/outputdocs_List', '', $Fields, 'outputdocs_Save' );
G::RenderPage( "publish" );

View File

@@ -1,85 +1,77 @@
<?php
/**
* outputdocs_Edit.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) {
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
if (isset($_GET['OUT_DOC_UID'])) {
$aFields = $ooutputDocument->load($_GET['OUT_DOC_UID']);
}
else {
$aFields = array();
$aFields['PRO_UID'] = $_GET['PRO_UID'];
}
$aFields['OUT_DOC_TYPE'] = 'HTML';
$enabledJavaBridge = false;
/**
* Temporally Disabled, because we are not using JRXML output doc type by now
G::LoadClass ('javaBridgePM');
if ( class_exists ( 'javaBridgePM' ) ) {
$JBPM = new JavaBridgePM();
try {
$JBPM->checkJavaExtension();
$util = new Java("com.processmaker.util.pmutils");
$enabledJavaBridge = true;
} catch ( Exception $e ) {
}
//$util->setInputPath( JAVATEST_PATH );
//$util->setOutputPath( JAVATEST_PATH );
}
*/
G::LoadClass('xmlfield_InputPM');
$G_PUBLISH = new Publisher();
if ( ! $enabledJavaBridge ) {
$xmlform = 'outputdocs/outputdocs_Properties';
$G_PUBLISH->AddContent('xmlform', 'xmlform', $xmlform, '', $aFields , '../outputdocs/outputdocs_Save');
}
else {
$xmlform = 'outputdocs/outputdocs_New';
$G_PUBLISH->AddContent('xmlform', 'xmlform', $xmlform, '', $aFields , '../outputdocs/outputdocs_Save');
}
G::RenderPage('publish', 'raw');
}
catch (Exception $oException) {
die($oException->getMessage());
}
<?php
/**
* outputdocs_Edit.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
try {
global $RBAC;
switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
if (isset( $_GET['OUT_DOC_UID'] )) {
$aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] );
} else {
$aFields = array ();
$aFields['PRO_UID'] = $_GET['PRO_UID'];
}
$aFields['OUT_DOC_TYPE'] = 'HTML';
$enabledJavaBridge = false;
/**
* Temporally Disabled, because we are not using JRXML output doc type by now
* G::LoadClass ('javaBridgePM');
* if ( class_exists ( 'javaBridgePM' ) ) {
* $JBPM = new JavaBridgePM();
* try {
* $JBPM->checkJavaExtension();
* $util = new Java("com.processmaker.util.pmutils");
* $enabledJavaBridge = true;
* } catch ( Exception $e ) {
*
* }
* //$util->setInputPath( JAVATEST_PATH );
* //$util->setOutputPath( JAVATEST_PATH );
* }
*/
G::LoadClass( 'xmlfield_InputPM' );
$G_PUBLISH = new Publisher();
if (! $enabledJavaBridge) {
$xmlform = 'outputdocs/outputdocs_Properties';
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, '../outputdocs/outputdocs_Save' );
} else {
$xmlform = 'outputdocs/outputdocs_New';
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, '../outputdocs/outputdocs_Save' );
}
G::RenderPage( 'publish', 'raw' );
} catch (Exception $oException) {
die( $oException->getMessage() );
}

View File

@@ -1,91 +1,85 @@
<?php
/**
* outputdocs_Edit.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) {
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
if (isset($_GET['OUT_DOC_UID'])) {
$aFields = $ooutputDocument->load($_GET['OUT_DOC_UID']);
} else {
$aFields = array();
$aFields['PRO_UID'] = $_GET['PRO_UID'];
}
$type = isset($aFields['OUT_DOC_TYPE']) ? $aFields['OUT_DOC_TYPE'] : 'HTML';
$aFields['OUT_DOC_TAGS'] = isset($aFields['OUT_DOC_TAGS']) ? $aFields['OUT_DOC_TAGS'] : 'OUTPUT';
$aFields['OUT_DOC_VERSIONING'] = strval($aFields['OUT_DOC_VERSIONING']);
$aFields['OUT_DOC_LANDSCAPE'] = strval($aFields['OUT_DOC_LANDSCAPE']);
if(isset($aFields['OUT_DOC_PDF_SECURITY_ENABLED'])){
$aFields['OUT_DOC_PDF_SECURITY_ENABLED'] = strval($aFields['OUT_DOC_PDF_SECURITY_ENABLED']);
}
if (isset($aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']) && $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") {
$aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = G::decrypt($aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'], $_GET['OUT_DOC_UID']);
$aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::decrypt($aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], $_GET['OUT_DOC_UID']);
}
G::LoadClass('xmlfield_InputPM');
$G_PUBLISH = new Publisher();
switch ($type) {
case 'HTML' :
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save');
break;
case 'JRXML' :
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save');
/*
// $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsDynaformList', '', $aFields , '../outputdocs/outputdocs_Save');
require_once 'classes/model/Process.php';
G::LoadClass( 'processMap');
$sProcessUID = $aFields['PRO_UID'];
$oProcess = new Process();
$oProcessMap = new ProcessMap();
$aFields = $oProcess->load($sProcessUID);
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ShortList', $oProcessMap->getDynaformsCriteria($sProcessUID), $aFields);
*/
break;
case 'ACROFORM' :
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save');
break;
}
G::RenderPage('publish', 'raw');
} catch (Exception $oException) {
die($oException->getMessage());
<?php
/**
* outputdocs_Edit.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
try {
global $RBAC;
switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
if (isset( $_GET['OUT_DOC_UID'] )) {
$aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] );
} else {
$aFields = array ();
$aFields['PRO_UID'] = $_GET['PRO_UID'];
}
$type = isset( $aFields['OUT_DOC_TYPE'] ) ? $aFields['OUT_DOC_TYPE'] : 'HTML';
$aFields['OUT_DOC_TAGS'] = isset( $aFields['OUT_DOC_TAGS'] ) ? $aFields['OUT_DOC_TAGS'] : 'OUTPUT';
$aFields['OUT_DOC_VERSIONING'] = strval( $aFields['OUT_DOC_VERSIONING'] );
$aFields['OUT_DOC_LANDSCAPE'] = strval( $aFields['OUT_DOC_LANDSCAPE'] );
if (isset( $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] )) {
$aFields['OUT_DOC_PDF_SECURITY_ENABLED'] = strval( $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] );
}
if (isset( $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] ) && $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") {
$aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = G::decrypt( $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'], $_GET['OUT_DOC_UID'] );
$aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::decrypt( $aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], $_GET['OUT_DOC_UID'] );
}
G::LoadClass( 'xmlfield_InputPM' );
$G_PUBLISH = new Publisher();
switch ($type) {
case 'HTML':
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' );
break;
case 'JRXML':
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' );
/*
// $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsDynaformList', '', $aFields , '../outputdocs/outputdocs_Save');
require_once 'classes/model/Process.php';
G::LoadClass( 'processMap');
$sProcessUID = $aFields['PRO_UID'];
$oProcess = new Process();
$oProcessMap = new ProcessMap();
$aFields = $oProcess->load($sProcessUID);
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ShortList', $oProcessMap->getDynaformsCriteria($sProcessUID), $aFields);
*/
break;
case 'ACROFORM':
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' );
break;
}
G::RenderPage( 'publish', 'raw' );
} catch (Exception $oException) {
die( $oException->getMessage() );
}

View File

@@ -1,91 +1,91 @@
<?php
/**
* outputdocs_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.
*
*/
try {
global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) {
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
//default:
require_once 'classes/model/OutputDocument.php';
G::LoadClass('processMap');
$oOutputDocument = new OutputDocument();
if (isset($_POST['form']))
$aData = $_POST['form']; //For old process map form
else
$aData = $_POST; //For Extjs (Since we are not using form in ExtJS)
if(isset($aData['OUT_DOC_TITLE']) && $aData['OUT_DOC_TITLE']!=''){
$oForm = new Form('outputdocs/outputdocs_Properties', PATH_XMLFORM);
$aData = $oForm->validatePost();
if(isset($aData['OUT_DOC_PDF_SECURITY_ENABLED'])&&$aData['OUT_DOC_PDF_SECURITY_ENABLED']=="0"){
$aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] ="";
$aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] ="";
$aData['OUT_DOC_PDF_SECURITY_PERMISSIONS'] ="";
}
if(isset($aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'])&&$aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']!=""){
$aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = G::encrypt($aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'],$aData['OUT_DOC_UID']);
$aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::encrypt($aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'],$aData['OUT_DOC_UID']);
}
}
if ($aData['OUT_DOC_UID'] == '') {
if ((isset($aData['OUT_DOC_TYPE'])) && ( $aData['OUT_DOC_TYPE'] == 'JRXML' )) {
$dynaformUid = $aData['DYN_UID'];
$outDocUid = $oOutputDocument->create($aData);
G::LoadClass('javaBridgePM');
$jbpm = new JavaBridgePM ();
print $jbpm->generateJrxmlFromDynaform($outDocUid, $dynaformUid, 'classic');
} else {
$outDocUid = $oOutputDocument->create($aData);
}
} else {
$oOutputDocument->update($aData);
}
if (isset($aData['PRO_UID'])) {
//refresh dbarray with the last change in outputDocument
$oMap = new processMap();
$oCriteria = $oMap->getOutputDocumentsCriteria($aData['PRO_UID']);
}
} catch (Exception $oException) {
die($oException->getMessage());
<?php
/**
* outputdocs_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.
*/
try {
global $RBAC;
switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
//default:
require_once 'classes/model/OutputDocument.php';
G::LoadClass( 'processMap' );
$oOutputDocument = new OutputDocument();
if (isset( $_POST['form'] ))
$aData = $_POST['form']; //For old process map form
else
$aData = $_POST; //For Extjs (Since we are not using form in ExtJS)
if (isset( $aData['OUT_DOC_TITLE'] ) && $aData['OUT_DOC_TITLE'] != '') {
$oForm = new Form( 'outputdocs/outputdocs_Properties', PATH_XMLFORM );
$aData = $oForm->validatePost();
if (isset( $aData['OUT_DOC_PDF_SECURITY_ENABLED'] ) && $aData['OUT_DOC_PDF_SECURITY_ENABLED'] == "0") {
$aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = "";
$aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = "";
$aData['OUT_DOC_PDF_SECURITY_PERMISSIONS'] = "";
}
if (isset( $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] ) && $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") {
$aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = G::encrypt( $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'], $aData['OUT_DOC_UID'] );
$aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::encrypt( $aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], $aData['OUT_DOC_UID'] );
}
}
if ($aData['OUT_DOC_UID'] == '') {
if ((isset( $aData['OUT_DOC_TYPE'] )) && ($aData['OUT_DOC_TYPE'] == 'JRXML')) {
$dynaformUid = $aData['DYN_UID'];
$outDocUid = $oOutputDocument->create( $aData );
G::LoadClass( 'javaBridgePM' );
$jbpm = new JavaBridgePM();
print $jbpm->generateJrxmlFromDynaform( $outDocUid, $dynaformUid, 'classic' );
} else {
$outDocUid = $oOutputDocument->create( $aData );
}
} else {
$oOutputDocument->update( $aData );
}
if (isset( $aData['PRO_UID'] )) {
//refresh dbarray with the last change in outputDocument
$oMap = new processMap();
$oCriteria = $oMap->getOutputDocumentsCriteria( $aData['PRO_UID'] );
}
} catch (Exception $oException) {
die( $oException->getMessage() );
}

View File

@@ -1,32 +1,33 @@
<?php
try {
require_once 'classes/model/OutputDocument.php';
require_once 'classes/model/OutputDocument.php';
if (empty($_FILES['form']) || $_FILES['form']['name']['OUT_DOC_FILE'] == '')
throw ( new Exception ( 'you must upload a file.' ) );
if (empty( $_FILES['form'] ) || $_FILES['form']['name']['OUT_DOC_FILE'] == '') {
throw (new Exception( 'you must upload a file.' ));
}
$uid = $_POST['form']['OUT_DOC_UID'];
$oOutputDocument = new OutputDocument();
$aFields = $oOutputDocument->load( $uid );
$type = $aFields['OUT_DOC_TYPE'];
$uid = $_POST['form']['OUT_DOC_UID'];
$oOutputDocument = new OutputDocument();
$aFields = $oOutputDocument->load($uid);
$type = $aFields['OUT_DOC_TYPE'];
$aExtension = explode ('.', strtolower(basename( $_FILES['form']['name']['OUT_DOC_FILE'] )));
$extension = $aExtension[ count($aExtension) -1 ];
if ( $extension != 'jrxml' && $type == 'JRXML')
throw ( new Exception ( "'$extension' is not a valid extension, you must upload a .jrxml file." ) );
$aExtension = explode( '.', strtolower( basename( $_FILES['form']['name']['OUT_DOC_FILE'] ) ) );
$extension = $aExtension[count( $aExtension ) - 1];
if ($extension != 'jrxml' && $type == 'JRXML') {
throw (new Exception( "'$extension' is not a valid extension, you must upload a .jrxml file." ));
}
if ( $extension != 'pdf' && $type == 'ACROFORM')
throw ( new Exception ( "'$extension' is not a valid extension, you must upload a .pdf file." ) );
if ($extension != 'pdf' && $type == 'ACROFORM') {
throw (new Exception( "'$extension' is not a valid extension, you must upload a .pdf file." ));
}
$fileJrxml = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension;
if (! empty( $_FILES['form'] )) {
if ($_FILES['form']['error']['OUT_DOC_FILE'] == 0) {
G::uploadFile( $_FILES['form']['tmp_name']['OUT_DOC_FILE'], dirname( $fileJrxml ), basename( $fileJrxml ) );
}
}
print "<font face='Arial' size='2' >File uploaded.</font>";
$fileJrxml = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension;
if (!empty($_FILES['form'])) {
if ($_FILES['form']['error']['OUT_DOC_FILE'] == 0) {
G::uploadFile($_FILES['form']['tmp_name']['OUT_DOC_FILE'], dirname($fileJrxml), basename($fileJrxml) );
}
}
print "<font face='Arial' size='2' >File uploaded.</font>";
} catch (Exception $e) {
print "<font face='Arial' size='2' color='red' >Error: " . $e->getMessage() . "</font>";
}
}
catch ( Exception $e ) {
print "<font face='Arial' size='2' color='red' >Error: " . $e->getMessage() . "</font>";
}

View File

@@ -1,155 +1,148 @@
<?php
/**
* patterns_Ajax.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.
*
*/
G::LoadInclude('ajax');
$oJSON = new Services_JSON();
if(isset($_POST['mode']) && $_POST['mode'] != '')
$aData = $_POST;
else
$aData = $_POST['form'];
G::LoadClass('tasks');
$oTasks = new Tasks();
$rou_id = 0;
switch ($aData['action']) {
case 'savePattern':
//if ($aData['ROU_TYPE'] != $aData['ROU_TYPE_OLD'])
//{
$oTasks->deleteAllRoutesOfTask($aData['PROCESS'], $aData['TASK']);
//}
require_once 'classes/model/Route.php';
$oRoute = new Route();
switch ($aData['ROU_TYPE']) {
case 'SEQUENTIAL':
case 'SEC-JOIN':
<?php
/**
* patterns_Ajax.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.
*/
G::LoadInclude( 'ajax' );
$oJSON = new Services_JSON();
if (isset( $_POST['mode'] ) && $_POST['mode'] != '') {
$aData = $_POST;
} else {
$aData = $_POST['form'];
}
G::LoadClass( 'tasks' );
$oTasks = new Tasks();
$rou_id = 0;
switch ($aData['action']) {
case 'savePattern':
//if ($aData['ROU_TYPE'] != $aData['ROU_TYPE_OLD'])
//{
$oTasks->deleteAllRoutesOfTask( $aData['PROCESS'], $aData['TASK'] );
//}
require_once 'classes/model/Route.php';
$oRoute = new Route();
switch ($aData['ROU_TYPE']) {
case 'SEQUENTIAL':
case 'SEC-JOIN':
/*if ($aData['ROU_UID'] != '')
{
$aFields['ROU_UID'] = $aData['ROU_UID'];
}*/
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'];
$aFields['ROU_NEXT_TASK'] = $aData['ROU_NEXT_TASK'];
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
//$aFields['ROU_TO_LAST_USER'] = $aData['ROU_TO_LAST_USER'];
$rou_id = $oRoute->create($aFields);
break;
case 'SELECT':
foreach ($aData['GRID_SELECT_TYPE'] as $iKey => $aRow)
{
/*if ($aRow['ROU_UID'] != '')
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'];
$aFields['ROU_NEXT_TASK'] = $aData['ROU_NEXT_TASK'];
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
//$aFields['ROU_TO_LAST_USER'] = $aData['ROU_TO_LAST_USER'];
$rou_id = $oRoute->create( $aFields );
break;
case 'SELECT':
foreach ($aData['GRID_SELECT_TYPE'] as $iKey => $aRow) {
/*if ($aRow['ROU_UID'] != '')
{
$aFields['ROU_UID'] = $aRow['ROU_UID'];
}*/
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'];
$aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK'];
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
//$aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER'];
$rou_id = $oRoute->create($aFields);
unset($aFields);
}
break;
case 'EVALUATE':
foreach ($aData['GRID_EVALUATE_TYPE'] as $iKey => $aRow)
{
/*if ($aRow['ROU_UID'] != '')
}*/
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'];
$aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK'];
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
//$aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER'];
$rou_id = $oRoute->create( $aFields );
unset( $aFields );
}
break;
case 'EVALUATE':
foreach ($aData['GRID_EVALUATE_TYPE'] as $iKey => $aRow) {
/*if ($aRow['ROU_UID'] != '')
{
$aFields['ROU_UID'] = $aRow['ROU_UID'];
}*/
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'];
$aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK'];
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
//$aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER'];
$rou_id = $oRoute->create($aFields);
unset($aFields);
}
break;
case 'PARALLEL':
foreach ($aData['GRID_PARALLEL_TYPE'] as $iKey => $aRow)
{
/*if ($aRow['ROU_UID'] != '')
}*/
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'];
$aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK'];
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
//$aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER'];
$rou_id = $oRoute->create( $aFields );
unset( $aFields );
}
break;
case 'PARALLEL':
foreach ($aData['GRID_PARALLEL_TYPE'] as $iKey => $aRow) {
/*if ($aRow['ROU_UID'] != '')
{
$aFields['ROU_UID'] = $aRow['ROU_UID'];
}*/
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'];
$aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK'];
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$rou_id = $oRoute->create($aFields);
unset($aFields);
}
break;
case 'PARALLEL-BY-EVALUATION':
foreach ($aData['GRID_PARALLEL_EVALUATION_TYPE'] as $iKey => $aRow)
{
/*if ($aRow['ROU_UID'] != '')
}*/
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'];
$aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK'];
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$rou_id = $oRoute->create( $aFields );
unset( $aFields );
}
break;
case 'PARALLEL-BY-EVALUATION':
foreach ($aData['GRID_PARALLEL_EVALUATION_TYPE'] as $iKey => $aRow) {
/*if ($aRow['ROU_UID'] != '')
{
$aFields['ROU_UID'] = $aRow['ROU_UID'];
}*/
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'];
$aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK'];
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
if(isset($aRow['ROU_OPTIONAL']) && trim($aRow['ROU_OPTIONAL'])!=''
&& ($aRow['ROU_OPTIONAL']==='TRUE' || $aRow['ROU_OPTIONAL']==='FALSE'))
$aFields['ROU_OPTIONAL'] = $aRow['ROU_OPTIONAL'];
$rou_id = $oRoute->create($aFields);
unset($aFields);
}
break;
case 'DISCRIMINATOR': //Girish ->Added to save changes, while editing the route
foreach ($aData['GRID_DISCRIMINATOR_TYPE'] as $iKey => $aRow)
{
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'];
$aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK'];
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
$aFields['ROU_OPTIONAL'] = $aRow['ROU_OPTIONAL'];
$routeData = $oTasks->getRouteByType($aData['PROCESS'], $aRow['ROU_NEXT_TASK'], $aData['ROU_TYPE']);
foreach($routeData as $route)
{
$sFields['ROU_UID'] = $route['ROU_UID'];
$sFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
$sFields['ROU_OPTIONAL'] = $aRow['ROU_OPTIONAL'];
$rou_id = $oRoute->update($sFields);
}
$rou_id =$oRoute->create($aFields);
unset($aFields);
}
break;
}
echo $rou_id;
}
}*/
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'];
$aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK'];
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
if (isset( $aRow['ROU_OPTIONAL'] ) && trim( $aRow['ROU_OPTIONAL'] ) != '' && ($aRow['ROU_OPTIONAL'] === 'TRUE' || $aRow['ROU_OPTIONAL'] === 'FALSE'))
$aFields['ROU_OPTIONAL'] = $aRow['ROU_OPTIONAL'];
$rou_id = $oRoute->create( $aFields );
unset( $aFields );
}
break;
case 'DISCRIMINATOR': //Girish ->Added to save changes, while editing the route
foreach ($aData['GRID_DISCRIMINATOR_TYPE'] as $iKey => $aRow) {
$aFields['PRO_UID'] = $aData['PROCESS'];
$aFields['TAS_UID'] = $aData['TASK'];
$aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK'];
$aFields['ROU_CASE'] = $iKey;
$aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
$aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
$aFields['ROU_OPTIONAL'] = $aRow['ROU_OPTIONAL'];
$routeData = $oTasks->getRouteByType( $aData['PROCESS'], $aRow['ROU_NEXT_TASK'], $aData['ROU_TYPE'] );
foreach ($routeData as $route) {
$sFields['ROU_UID'] = $route['ROU_UID'];
$sFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
$sFields['ROU_OPTIONAL'] = $aRow['ROU_OPTIONAL'];
$rou_id = $oRoute->update( $sFields );
}
$rou_id = $oRoute->create( $aFields );
unset( $aFields );
}
break;
}
echo $rou_id;
}
?>

View File

@@ -12,36 +12,35 @@
*
* 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(isset($_POST['function'])) {
switch($_POST['function']) {
case 'checkCategoryName':
$CategoryName = $_POST['CategoryName'];
require_once ( "classes/model/ProcessCategory.php" );
$processCategory = new ProcessCategory();
$aProcessCategory = $processCategory->loadByCategoryName($CategoryName);
if( is_array($aProcessCategory)) {
return print '1';
} else {
return print '0';
}
break;
default: echo 'default';
}
if (isset( $_POST['function'] )) {
switch ($_POST['function']) {
case 'checkCategoryName':
$CategoryName = $_POST['CategoryName'];
require_once ("classes/model/ProcessCategory.php");
$processCategory = new ProcessCategory();
$aProcessCategory = $processCategory->loadByCategoryName( $CategoryName );
if (is_array( $aProcessCategory )) {
return print '1';
} else {
return print '0';
}
break;
default:
echo 'default';
}
}

View File

@@ -1,41 +1,39 @@
<?php
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1){
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
//G::header('location: ../login/login');
die;
}
//to do: improve the way to pass two or more parameters in the paged-table ( link )
$aux = explode ( '|', $_GET['id'] );
$index=0;
$CategoryUid = str_replace ( '"', '', $aux[$index++] );
require_once ( "classes/model/ProcessCategory.php" );
//if exists the row in the database propel will update it, otherwise will insert.
$tr = ProcessCategoryPeer::retrieveByPK( $CategoryUid );
if ( ( is_object ( $tr ) && get_class ($tr) == 'ProcessCategory' ) ) {
$fields['CATEGORY_UID'] = $tr->getCategoryUid();
$fields['LABEL_CATEGORY_UID'] = $tr->getCategoryUid();
$fields['CATEGORY_PARENT'] = $tr->getCategoryParent();
$fields['LABEL_CATEGORY_PARENT'] = $tr->getCategoryParent();
$fields['CATEGORY_NAME'] = $tr->getCategoryName();
$fields['LABEL_CATEGORY_NAME'] = $tr->getCategoryName();
$fields['CATEGORY_ICON'] = $tr->getCategoryIcon();
$fields['LABEL_CATEGORY_ICON'] = $tr->getCategoryIcon();
}
else
$fields = array();
$G_MAIN_MENU = 'workflow';
$G_SUB_MENU = 'processCategory';
$G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'processCategory/processCategoryDelete', '', $fields, 'processCategoryDeleteExec' );
G::RenderPage('publishBlank', 'blank');
<?php
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
//G::header('location: ../login/login');
die();
}
//to do: improve the way to pass two or more parameters in the paged-table ( link )
$aux = explode( '|', $_GET['id'] );
$index = 0;
$CategoryUid = str_replace( '"', '', $aux[$index ++] );
require_once ("classes/model/ProcessCategory.php");
//if exists the row in the database propel will update it, otherwise will insert.
$tr = ProcessCategoryPeer::retrieveByPK( $CategoryUid );
if ((is_object( $tr ) && get_class( $tr ) == 'ProcessCategory')) {
$fields['CATEGORY_UID'] = $tr->getCategoryUid();
$fields['LABEL_CATEGORY_UID'] = $tr->getCategoryUid();
$fields['CATEGORY_PARENT'] = $tr->getCategoryParent();
$fields['LABEL_CATEGORY_PARENT'] = $tr->getCategoryParent();
$fields['CATEGORY_NAME'] = $tr->getCategoryName();
$fields['LABEL_CATEGORY_NAME'] = $tr->getCategoryName();
$fields['CATEGORY_ICON'] = $tr->getCategoryIcon();
$fields['LABEL_CATEGORY_ICON'] = $tr->getCategoryIcon();
} else
$fields = array ();
$G_MAIN_MENU = 'workflow';
$G_SUB_MENU = 'processCategory';
$G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processCategory/processCategoryDelete', '', $fields, 'processCategoryDeleteExec' );
G::RenderPage( 'publishBlank', 'blank' );
?>

View File

@@ -1,46 +1,44 @@
<?php
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1){
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
//G::header('location: ../login/login');
die;
}
try {
$form = $_POST['form'];
$CategoryUid = $form['CATEGORY_UID'];
require_once ( "classes/model/ProcessCategory.php" );
require_once 'classes/model/Process.php';
//we'are looking for data into process with this CategoryUid
$oCriteria = new Criteria('workflow');
$oCriteria->add(ProcessPeer::PRO_CATEGORY, $CategoryUid);
$oDataset = ProcessPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($oDataset->next()) {
$aDataProcess = $oDataset->getRow();
$oCriteria1 = new Criteria('workflow');
$oCriteria1->add(ProcessPeer::PRO_CATEGORY, '');
$oCriteria2 = new Criteria('workflow');
$oCriteria2->add(ProcessPeer::PRO_UID, $aDataProcess['PRO_UID']);
BasePeer::doUpdate($oCriteria2, $oCriteria1, Propel::getConnection('workflow'));
}
//if exists the row in the database propel will update it, otherwise will insert.
$tr = ProcessCategoryPeer::retrieveByPK( $CategoryUid );
if ( ( is_object ( $tr ) && get_class ($tr) == 'ProcessCategory' ) ) {
$tr->delete();
}
G::Header('location: processCategoryList');
}
catch ( Exception $e ) {
$G_PUBLISH = new Publisher;
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' );
}
<?php
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
//G::header('location: ../login/login');
die();
}
try {
$form = $_POST['form'];
$CategoryUid = $form['CATEGORY_UID'];
require_once ("classes/model/ProcessCategory.php");
require_once 'classes/model/Process.php';
//we'are looking for data into process with this CategoryUid
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ProcessPeer::PRO_CATEGORY, $CategoryUid );
$oDataset = ProcessPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
while ($oDataset->next()) {
$aDataProcess = $oDataset->getRow();
$oCriteria1 = new Criteria( 'workflow' );
$oCriteria1->add( ProcessPeer::PRO_CATEGORY, '' );
$oCriteria2 = new Criteria( 'workflow' );
$oCriteria2->add( ProcessPeer::PRO_UID, $aDataProcess['PRO_UID'] );
BasePeer::doUpdate( $oCriteria2, $oCriteria1, Propel::getConnection( 'workflow' ) );
}
//if exists the row in the database propel will update it, otherwise will insert.
$tr = ProcessCategoryPeer::retrieveByPK( $CategoryUid );
if ((is_object( $tr ) && get_class( $tr ) == 'ProcessCategory')) {
$tr->delete();
}
G::Header( 'location: processCategoryList' );
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' );
}

View File

@@ -1,35 +1,32 @@
<?php
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1){
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
//G::header('location: ../login/login');
die;
}
$aux = explode ( '|', isset($_GET['id']) ? $_GET['id'] : '' );
$CategoryUid = str_replace ( '"', '', $aux[0] );
require_once ( "classes/model/ProcessCategory.php" );
//if exists the row in the database propel will update it, otherwise will insert.
$tr = ProcessCategoryPeer::retrieveByPK( $CategoryUid );
if ( ( is_object ( $tr ) && get_class ($tr) == 'ProcessCategory' ) ) {
$fields['CATEGORY_UID'] = $tr->getCategoryUid();
$fields['CATEGORY_PARENT'] = $tr->getCategoryParent();
$fields['CATEGORY_NAME'] = $tr->getCategoryName();
$fields['CATEGORY_ICON'] = $tr->getCategoryIcon();
}
else
$fields = array();
$G_MAIN_MENU = 'workflow';
$G_SUB_MENU = 'processCategory';
$G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'processCategory/processCategoryEdit', '', $fields, 'processCategorySave' );
G::RenderPage('publishBlank', 'blank');
<?php
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
//G::header('location: ../login/login');
die();
}
$aux = explode( '|', isset( $_GET['id'] ) ? $_GET['id'] : '' );
$CategoryUid = str_replace( '"', '', $aux[0] );
require_once ("classes/model/ProcessCategory.php");
//if exists the row in the database propel will update it, otherwise will insert.
$tr = ProcessCategoryPeer::retrieveByPK( $CategoryUid );
if ((is_object( $tr ) && get_class( $tr ) == 'ProcessCategory')) {
$fields['CATEGORY_UID'] = $tr->getCategoryUid();
$fields['CATEGORY_PARENT'] = $tr->getCategoryParent();
$fields['CATEGORY_NAME'] = $tr->getCategoryName();
$fields['CATEGORY_ICON'] = $tr->getCategoryIcon();
} else
$fields = array ();
$G_MAIN_MENU = 'workflow';
$G_SUB_MENU = 'processCategory';
$G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processCategory/processCategoryEdit', '', $fields, 'processCategorySave' );
G::RenderPage( 'publishBlank', 'blank' );
?>

View File

@@ -1,47 +1,46 @@
<?php
/**
* processCategoryList.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.
*
*/
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1){
G::SendTemporalMessage('krlos', 'error', 'labels');
die;
}
G::LoadClass('configuration');
$c = new Configurations();
$configPage = $c->getConfiguration('processCategoryList', 'pageSize','',$_SESSION['USER_LOGGED']);
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$G_MAIN_MENU = 'workflow';
$G_SUB_MENU = 'processCategory';
$G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('processCategory/processCategoryList', false); //adding a javascript file .js
$oHeadPublisher->addContent('processCategory/processCategoryList'); //adding a html file .html.
$oHeadPublisher->assign('FORMATS',$c->getFormats());
$oHeadPublisher->assign('CONFIG', $Config);
G::RenderPage('publish', 'extJs');
<?php
/**
* processCategoryList.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.
*/
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'krlos', 'error', 'labels' );
die();
}
G::LoadClass( 'configuration' );
$c = new Configurations();
$configPage = $c->getConfiguration( 'processCategoryList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
$G_MAIN_MENU = 'workflow';
$G_SUB_MENU = 'processCategory';
$G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'processCategory/processCategoryList', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'processCategory/processCategoryList' ); //adding a html file .html.
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
$oHeadPublisher->assign( 'CONFIG', $Config );
G::RenderPage( 'publish', 'extJs' );

View File

@@ -1,27 +1,26 @@
<?php
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1){
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
//G::header('location: ../login/login');
die;
}
require_once ( "classes/model/ProcessCategory.php" );
$fields['CATEGORY_UID'] = G::GenerateUniqueID();;
$fields['CATEGORY_PARENT'] = '';
$fields['CATEGORY_NAME'] = '';
$fields['CATEGORY_ICON'] = '';
$G_MAIN_MENU = 'workflow';
$G_SUB_MENU = 'processCategory';
$G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'processCategory/processCategoryNew', '', $fields, 'processCategorySave' );
G::RenderPage('publishBlank', 'blank');
?>
<?php
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
//G::header('location: ../login/login');
die();
}
require_once ("classes/model/ProcessCategory.php");
$fields['CATEGORY_UID'] = G::GenerateUniqueID();
;
$fields['CATEGORY_PARENT'] = '';
$fields['CATEGORY_NAME'] = '';
$fields['CATEGORY_ICON'] = '';
$G_MAIN_MENU = 'workflow';
$G_SUB_MENU = 'processCategory';
$G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processCategory/processCategoryNew', '', $fields, 'processCategorySave' );
G::RenderPage( 'publishBlank', 'blank' );
?>

View File

@@ -1,59 +1,58 @@
<?php
try {
$form = $_POST['form'];
$CategoryUid = $form['CATEGORY_UID'];
$CategoryParent = $form['CATEGORY_PARENT'];
$CategoryName = $form['CATEGORY_NAME'];
$CategoryIcon = $form['CATEGORY_ICON'];
<?php
try {
$form = $_POST['form'];
$CategoryUid = $form['CATEGORY_UID'];
$CategoryParent = $form['CATEGORY_PARENT'];
$CategoryName = $form['CATEGORY_NAME'];
$CategoryIcon = $form['CATEGORY_ICON'];
require_once ("classes/model/ProcessCategory.php");
//if exists the row in the database propel will update it, otherwise will insert.
$tr = ProcessCategoryPeer::retrieveByPK( $CategoryUid );
$processCategory = new ProcessCategory();
$aProcessCategory = $processCategory->loadByCategoryName( $CategoryName );
if (! is_array( $aProcessCategory )) {
if (! (is_object( $tr ) && get_class( $tr ) == 'ProcessCategory')) {
$tr = new ProcessCategory();
}
$tr->setCategoryUid( $CategoryUid );
$tr->setCategoryParent( $CategoryParent );
$tr->setCategoryName( $CategoryName );
$tr->setCategoryIcon( $CategoryIcon );
if ($tr->validate()) {
// we save it, since we get no validation errors, or do whatever else you like.
$res = $tr->save();
} else {
// Something went wrong. We can now get the validationFailures and handle them.
$msg = '';
$validationFailuresArray = $tr->getValidationFailures();
foreach ($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>";
}
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
}
//return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => '');
require_once ( "classes/model/ProcessCategory.php" );
//to do: uniform coderror structures for all classes
//if exists the row in the database propel will update it, otherwise will insert.
$tr = ProcessCategoryPeer::retrieveByPK( $CategoryUid );
$processCategory = new ProcessCategory();
$aProcessCategory = $processCategory->loadByCategoryName($CategoryName);
if(! is_array($aProcessCategory)) {
if ( ! ( is_object ( $tr ) && get_class ($tr) == 'ProcessCategory' ) ) {
$tr = new ProcessCategory();
}
$tr->setCategoryUid( $CategoryUid );
$tr->setCategoryParent( $CategoryParent );
$tr->setCategoryName( $CategoryName );
$tr->setCategoryIcon( $CategoryIcon );
if ($tr->validate() ) {
// we save it, since we get no validation errors, or do whatever else you like.
$res = $tr->save();
}
else {
// Something went wrong. We can now get the validationFailures and handle them.
$msg = '';
$validationFailuresArray = $tr->getValidationFailures();
foreach($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>";
}
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
}
//return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => '');
//to do: uniform coderror structures for all classes
//if ( $res['codError'] < 0 ) {
// G::SendMessageText ( $res['message'] , 'error' );
//}
G::Header('location: processCategoryList');
//if ( $res['codError'] < 0 ) {
// G::SendMessageText ( $res['message'] , 'error' );
//}
G::Header( 'location: processCategoryList' );
} else {
// G::SendTemporalMessage("El registro ya existe", "warning", 'labels');
G::Header('location: processCategoryList');
die;
// G::SendTemporalMessage("El registro ya existe", "warning", 'labels');
G::Header( 'location: processCategoryList' );
die();
}
} catch ( Exception $e ) {
$G_PUBLISH = new Publisher;
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' );
}
}

View File

@@ -12,154 +12,154 @@
*
* 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(isset($_REQUEST['action'])) {
switch($_REQUEST['action']) {
case 'processCategoryList':
require_once 'classes/model/ProcessCategory.php';
require_once 'classes/model/Process.php';
G::LoadClass('configuration');
$co = new Configurations();
$config = $co->getConfiguration('processCategoryList', 'pageSize','',$_SESSION['USER_LOGGED']);
$limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20;
$start = isset($_POST['start']) ? $_POST['start'] : 0;
$limit = isset($_POST['limit']) ? $_POST['limit'] : $limit_size;
$filter = isset($_REQUEST['textFilter'])? $_REQUEST['textFilter'] : '';
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn('COUNT(*) AS CNT');
$oCriteria->add(ProcessCategoryPeer::CATEGORY_UID,'',Criteria::NOT_EQUAL);
if ($filter != ''){
$oCriteria->add(ProcessCategoryPeer::CATEGORY_NAME,'%'.$filter.'%',Criteria::LIKE);
}
$oDat = ProcessCategoryPeer::doSelectRS($oCriteria);
$oDat->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDat->next();
$row = $oDat->getRow();
$total_categories = $row['CNT'];
$oCriteria->clear();
$oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_UID);
$oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
$oCriteria->add(ProcessCategoryPeer::CATEGORY_UID,'',Criteria::NOT_EQUAL);
if ($filter != ''){
$oCriteria->add(ProcessCategoryPeer::CATEGORY_NAME,'%'.$filter.'%',Criteria::LIKE);
}
$oCriteria->setLimit($limit);
$oCriteria->setOffset($start);
$oDataset = ProcessCategoryPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$proc = new Process();
$aProcess = $proc->getAllProcessesByCategory();
$aCat = array();
while ($oDataset->next()){
$aCat[] = $oDataset->getRow();
$index = sizeof($aCat)-1;
$aCat[$index]['TOTAL_PROCESSES'] = isset($aProcess[$aCat[$index]['CATEGORY_UID']]) ? $aProcess[$aCat[$index]['CATEGORY_UID']] : 0;
}
echo '{categories: '.G::json_encode($aCat).', total_categories: '.$total_categories.'}';
break;
case 'updatePageSize':
G::LoadClass('configuration');
$c = new Configurations();
$arr['pageSize'] = $_REQUEST['size'];
$arr['dateSave'] = date('Y-m-d H:i:s');
$config = Array();
$config[] = $arr;
$c->aConfig = $config;
$c->saveConfig('processCategoryList', 'pageSize','',$_SESSION['USER_LOGGED']);
echo '{success: true}';
break;
case 'checkCategoryName':
require_once 'classes/model/ProcessCategory.php';
$catName = $_REQUEST['cat_name'];
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
$oCriteria->add(ProcessCategoryPeer::CATEGORY_NAME, $catName);
$oDataset = ProcessCategoryPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$row = $oDataset->getRow();
$response = isset($row['CATEGORY_NAME'])? 'false' : 'true' ;
echo $response;
break;
case 'saveNewCategory':
try{
require_once 'classes/model/ProcessCategory.php';
$catName = trim($_REQUEST['category']);
$pcat = new ProcessCategory();
$pcat->setNew(true);
$pcat->setCategoryUid(G::GenerateUniqueID());
$pcat->setCategoryName($catName);
$pcat->save();
echo '{success: true}';
}catch(Exception $ex){
echo '{success: false, error: '.$ex->getMessage().'}';
}
break;
case 'checkEditCategoryName':
require_once 'classes/model/ProcessCategory.php';
$catUID = $_REQUEST['cat_uid'];
$catName = $_REQUEST['cat_name'];
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
$oCriteria->add(ProcessCategoryPeer::CATEGORY_NAME, $catName);
$oCriteria->add(ProcessCategoryPeer::CATEGORY_UID,$catUID,Criteria::NOT_EQUAL);
$oDataset = ProcessCategoryPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$row = $oDataset->getRow();
$response = isset($row['CATEGORY_NAME'])? 'false' : 'true' ;
echo $response;
break;
case 'updateCategory':
try{
require_once 'classes/model/ProcessCategory.php';
$catUID = $_REQUEST['cat_uid'];
$catName = trim($_REQUEST['category']);
$pcat = new ProcessCategory();
$pcat->setNew(false);
$pcat->setCategoryUid($catUID);
$pcat->setCategoryName($catName);
$pcat->save();
echo '{success: true}';
}catch(Exception $ex){
echo '{success: false, error: '.$ex->getMessage().'}';
}
break;
case 'canDeleteCategory':
require_once 'classes/model/Process.php';
$proc = new Process();
$aProcess = $proc->getAllProcessesByCategory();
$catUID = $_REQUEST['CAT_UID'];
$response = isset($aProcess[$catUID])? 'false' : 'true';
echo $response;
break;
case 'deleteCategory':
try{
require_once 'classes/model/ProcessCategory.php';
$catUID = $_REQUEST['cat_uid'];
$cat = new ProcessCategory();
$cat->setCategoryUid($catUID);
$cat->delete();
echo '{success: true}';
}catch(Exception $ex){
echo '{success: false, error: '.$ex->getMessage().'}';
}
break;
default: echo 'default';
}
if (isset( $_REQUEST['action'] )) {
switch ($_REQUEST['action']) {
case 'processCategoryList':
require_once 'classes/model/ProcessCategory.php';
require_once 'classes/model/Process.php';
G::LoadClass( 'configuration' );
$co = new Configurations();
$config = $co->getConfiguration( 'processCategoryList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$limit_size = isset( $config['pageSize'] ) ? $config['pageSize'] : 20;
$start = isset( $_POST['start'] ) ? $_POST['start'] : 0;
$limit = isset( $_POST['limit'] ) ? $_POST['limit'] : $limit_size;
$filter = isset( $_REQUEST['textFilter'] ) ? $_REQUEST['textFilter'] : '';
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
$oCriteria->add( ProcessCategoryPeer::CATEGORY_UID, '', Criteria::NOT_EQUAL );
if ($filter != '') {
$oCriteria->add( ProcessCategoryPeer::CATEGORY_NAME, '%' . $filter . '%', Criteria::LIKE );
}
$oDat = ProcessCategoryPeer::doSelectRS( $oCriteria );
$oDat->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDat->next();
$row = $oDat->getRow();
$total_categories = $row['CNT'];
$oCriteria->clear();
$oCriteria->addSelectColumn( ProcessCategoryPeer::CATEGORY_UID );
$oCriteria->addSelectColumn( ProcessCategoryPeer::CATEGORY_NAME );
$oCriteria->add( ProcessCategoryPeer::CATEGORY_UID, '', Criteria::NOT_EQUAL );
if ($filter != '') {
$oCriteria->add( ProcessCategoryPeer::CATEGORY_NAME, '%' . $filter . '%', Criteria::LIKE );
}
$oCriteria->setLimit( $limit );
$oCriteria->setOffset( $start );
$oDataset = ProcessCategoryPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$proc = new Process();
$aProcess = $proc->getAllProcessesByCategory();
$aCat = array ();
while ($oDataset->next()) {
$aCat[] = $oDataset->getRow();
$index = sizeof( $aCat ) - 1;
$aCat[$index]['TOTAL_PROCESSES'] = isset( $aProcess[$aCat[$index]['CATEGORY_UID']] ) ? $aProcess[$aCat[$index]['CATEGORY_UID']] : 0;
}
echo '{categories: ' . G::json_encode( $aCat ) . ', total_categories: ' . $total_categories . '}';
break;
case 'updatePageSize':
G::LoadClass( 'configuration' );
$c = new Configurations();
$arr['pageSize'] = $_REQUEST['size'];
$arr['dateSave'] = date( 'Y-m-d H:i:s' );
$config = Array ();
$config[] = $arr;
$c->aConfig = $config;
$c->saveConfig( 'processCategoryList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
echo '{success: true}';
break;
case 'checkCategoryName':
require_once 'classes/model/ProcessCategory.php';
$catName = $_REQUEST['cat_name'];
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( ProcessCategoryPeer::CATEGORY_NAME );
$oCriteria->add( ProcessCategoryPeer::CATEGORY_NAME, $catName );
$oDataset = ProcessCategoryPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$row = $oDataset->getRow();
$response = isset( $row['CATEGORY_NAME'] ) ? 'false' : 'true';
echo $response;
break;
case 'saveNewCategory':
try {
require_once 'classes/model/ProcessCategory.php';
$catName = trim( $_REQUEST['category'] );
$pcat = new ProcessCategory();
$pcat->setNew( true );
$pcat->setCategoryUid( G::GenerateUniqueID() );
$pcat->setCategoryName( $catName );
$pcat->save();
echo '{success: true}';
} catch (Exception $ex) {
echo '{success: false, error: ' . $ex->getMessage() . '}';
}
break;
case 'checkEditCategoryName':
require_once 'classes/model/ProcessCategory.php';
$catUID = $_REQUEST['cat_uid'];
$catName = $_REQUEST['cat_name'];
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( ProcessCategoryPeer::CATEGORY_NAME );
$oCriteria->add( ProcessCategoryPeer::CATEGORY_NAME, $catName );
$oCriteria->add( ProcessCategoryPeer::CATEGORY_UID, $catUID, Criteria::NOT_EQUAL );
$oDataset = ProcessCategoryPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$row = $oDataset->getRow();
$response = isset( $row['CATEGORY_NAME'] ) ? 'false' : 'true';
echo $response;
break;
case 'updateCategory':
try {
require_once 'classes/model/ProcessCategory.php';
$catUID = $_REQUEST['cat_uid'];
$catName = trim( $_REQUEST['category'] );
$pcat = new ProcessCategory();
$pcat->setNew( false );
$pcat->setCategoryUid( $catUID );
$pcat->setCategoryName( $catName );
$pcat->save();
echo '{success: true}';
} catch (Exception $ex) {
echo '{success: false, error: ' . $ex->getMessage() . '}';
}
break;
case 'canDeleteCategory':
require_once 'classes/model/Process.php';
$proc = new Process();
$aProcess = $proc->getAllProcessesByCategory();
$catUID = $_REQUEST['CAT_UID'];
$response = isset( $aProcess[$catUID] ) ? 'false' : 'true';
echo $response;
break;
case 'deleteCategory':
try {
require_once 'classes/model/ProcessCategory.php';
$catUID = $_REQUEST['cat_uid'];
$cat = new ProcessCategory();
$cat->setCategoryUid( $catUID );
$cat->delete();
echo '{success: true}';
} catch (Exception $ex) {
echo '{success: false, error: ' . $ex->getMessage() . '}';
}
break;
default:
echo 'default';
}
}

View File

@@ -1,36 +0,0 @@
<?php
/**
* processes_DownloadFile.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
//add more security, and catch any error or exception
$sFileName = $_GET['p'] . '.xpdl';
$file = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName . 'tpm';
$filex = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName;
if (file_exists( $file )) {
rename( $file, $filex );
}
$realPath = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName;
G::streamFile( $realPath, true );

View File

@@ -1,132 +0,0 @@
<?php
/**
* processes_ImportFileExisting.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
try {
//load the variables
G::LoadClass( 'xpdl' );
$oProcess = new Xpdl();
if (! isset( $_POST['form']['IMPORT_OPTION'] )) {
throw (new Exception( 'Please select an option before to continue' ));
}
if (! isset( $_POST['form']['GROUP_IMPORT_OPTION'] )) {
$action = "none";
} else {
$action = $_POST['form']['GROUP_IMPORT_OPTION'];
}
$option = $_POST['form']['IMPORT_OPTION'];
$filename = $_POST['form']['PRO_FILENAME'];
$ObjUid = $_POST['form']['OBJ_UID'];
$path = PATH_DOCUMENT . 'input' . PATH_SEP;
$oData = $oProcess->getProcessDataXpdl( $path . $filename );
$Fields['PRO_FILENAME'] = $filename;
$sProUid = $oData->process['PRO_UID'];
$oData->process['PRO_UID_OLD'] = $sProUid;
if (! isset( $oData->tasks ))
$oData->tasks = array ();
$tasks = $oData->tasks;
// code added by gustavo cruz gustavo-at-colosa-dot-com
// evaluate actions or import options
switch ($action) {
case "none":
$groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs );
break;
case "rename":
$oData->groupwfs = $oProcess->renameExistingGroups( $oData->groupwfs );
$groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs );
break;
case "merge":
$oBaseGroup = $oData->groupwfs;
$oNewGroup = $oProcess->mergeExistingGroups( $oData->groupwfs );
$oData->groupwfs = $oNewGroup;
$oData->taskusers = $oProcess->mergeExistingUsers( $oBaseGroup, $oNewGroup, $oData->taskusers );
break;
default:
$groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs );
break;
}
// if there are duplicated groups render the group importing options
if ($groupsDuplicated > 0) {
$Fields['PRO_FILENAME'] = $filename;
$Fields['PRO_PATH'] = $path;
$Fields['IMPORT_OPTION'] = $option;
$Fields['OBJ_UID'] = $ObjUid;
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ValidatingGroups', '', $Fields, 'processes_ImportExisting' );
G::RenderPage( 'publish', "blank" );
die();
}
//end added code
//Update the current Process, overwriting all tasks and steps
if ($option == 1) {
$oProcess->updateProcessFromData( $oData, $path . $filename );
if (file_exists( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid )) {
$oDirectory = dir( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid );
while ($sObjectName = $oDirectory->read()) {
if (($sObjectName != '.') && ($sObjectName != '..')) {
unlink( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid . PATH_SEP . $sObjectName );
}
}
$oDirectory->close();
}
$sNewProUid = $sProUid;
}
//Disable current Process and create a new version of the Process
if ($option == 2) {
$oProcess->disablePreviousProcesses( $sProUid );
$sNewProUid = $oProcess->getUnusedProcessGUID();
$oProcess->setProcessGuid( $oData, $sNewProUid );
$oProcess->setProcessParent( $oData, $sProUid );
$oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' );
$oProcess->renewAll( $oData );
$oProcess->createProcessFromDataXpdl( $oData, $tasks );
}
//Create a completely new Process without change the current Process
if ($option == 3) {
//krumo ($oData); die;
$sNewProUid = $oProcess->getUnusedProcessGUID();
$oProcess->setProcessGuid( $oData, $sNewProUid );
$oData->process['PRO_TITLE'] = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' );
$oProcess->renewAll( $oData );
$oProcess->createProcessFromDataXpdl( $oData, $tasks );
}
G::header( 'Location: processes_Map?PRO_UID=' . $sNewProUid );
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', "blank" );
}

View File

@@ -1,105 +0,0 @@
<?php
/**
* processes_ImportFile.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
try {
//load the variables
G::LoadClass( 'xpdl' );
$oProcess = new Xpdl();
if (isset( $_POST['form']['PRO_FILENAME'] )) {
$path = $_POST['form']['PRO_PATH'];
$filename = $_POST['form']['PRO_FILENAME'];
$action = $_POST['form']['GROUP_IMPORT_OPTION'];
} else {
//save the file, if it's not saved
if ($_FILES['form']['error']['PROCESS_FILENAME'] == 0) {
$filename = $_FILES['form']['name']['PROCESS_FILENAME'];
$path = PATH_DOCUMENT . 'input' . PATH_SEP;
$tempName = $_FILES['form']['tmp_name']['PROCESS_FILENAME'];
$action = "none";
G::uploadFile( $tempName, $path, $filename );
}
}
$oData = $oProcess->getProcessDataXpdl( $path . $filename );
$Fields['PRO_FILENAME'] = $filename;
$Fields['IMPORT_OPTION'] = 2;
$sProUid = $oData->process['PRO_UID'];
$oData->process['PRO_UID_OLD'] = $sProUid;
if ($oProcess->processExists( $sProUid )) {
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ImportExistingXpdl', '', $Fields, 'processes_ImportExistingXpdl' );
G::RenderPage( 'publish', "blank" );
die();
}
// code added by gustavo cruz gustavo-at-colosa-dot-com
// evaluate actions or import options
switch ($action) {
case "none":
$groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs );
break;
case "rename":
$oData->groupwfs = $oProcess->renameExistingGroups( $oData->groupwfs );
$groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs );
break;
case "merge":
$oBaseGroup = $oData->groupwfs;
$oNewGroup = $oProcess->mergeExistingGroups( $oData->groupwfs );
$oData->groupwfs = $oNewGroup;
$oData->taskusers = $oProcess->mergeExistingUsers( $oBaseGroup, $oNewGroup, $oData->taskusers );
break;
default:
$groupsDuplicated = $oProcess->checkExistingGroups( $oData->groupwfs );
break;
}
// if there are duplicated groups render the group importing options
if ($groupsDuplicated > 0) {
$Fields['PRO_FILENAME'] = $filename;
$Fields['PRO_PATH'] = $path;
$Fields['IMPORT_OPTION'] = 2;
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ValidatingGroups', '', $Fields, 'processes_ImportFile' );
G::RenderPage( 'publish', "blank" );
die();
}
// end added code
if (! isset( $oData->tasks ))
$oData->tasks = array ();
$tasks = $oData->tasks;
$oProcess->createProcessFromDataXpdl( $oData, $tasks );
G::header( 'Location: processes_Map?PRO_UID=' . $sProUid );
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', "blank" );
}

View File

@@ -61,7 +61,7 @@ $result->catchMessage = "";
if ($action == "uploadFileNewProcess") {
try {
//type of file, bpmn, xpdl, or pm
//type of file: only pm
$processFileType = $_REQUEST["processFileType"];
$oProcess = new stdClass();
$oData = new stdClass();
@@ -71,13 +71,12 @@ if ($action == "uploadFileNewProcess") {
if (isset( $_FILES['form']['type']['PROCESS_FILENAME'] )) {
$allowedExtensions = array ($processFileType
);
$allowedExtensions = array ('xpdl','bpmn','pm'
);
$allowedExtensions = array ('pm');
if (! in_array( end( explode( ".", $_FILES['form']['name']['PROCESS_FILENAME'] ) ), $allowedExtensions )) {
throw new Exception( G::LoadTranslation( "ID_FILE_UPLOAD_INCORRECT_EXTENSION" ) );
}
}
if ($processFileType != "pm" && $processFileType != "xpdl" && $processFileType != "bpmn") {
if ($processFileType != "pm") {
throw new Exception( G::LoadTranslation( "ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR" ) );
}
@@ -86,21 +85,16 @@ if ($action == "uploadFileNewProcess") {
$oProcess = new Processes();
}
if ($processFileType == "xpdl") {
G::LoadClass( 'xpdl' );
$oProcess = new Xpdl();
}
$result->success = true;
$result->ExistProcessInDatabase = ""; //"" -Default
//0 -Dont exist process
//1 -exist process
$result->ExistGroupsInDatabase = ""; //"" -Default
//0 -Dont exist process
//1 -exist process
$result->ExistProcessInDatabase = ""; //"" -Default
//0 -Dont exist process
//1 -exist process
$result->ExistGroupsInDatabase = ""; //"" -Default
//0 -Dont exist process
//1 -exist process
$optionGroupExistInDatabase = isset( $_REQUEST["optionGroupExistInDatabase"] ) ? $_REQUEST["optionGroupExistInDatabase"] : null;
//!Upload file
//!Upload file
if (! is_null( $optionGroupExistInDatabase )) {
$filename = $_REQUEST["PRO_FILENAME"];
$path = PATH_DOCUMENT . 'input' . PATH_SEP;
@@ -109,12 +103,12 @@ if ($action == "uploadFileNewProcess") {
$filename = $_FILES['form']['name']['PROCESS_FILENAME'];
$path = PATH_DOCUMENT . 'input' . PATH_SEP;
$tempName = $_FILES['form']['tmp_name']['PROCESS_FILENAME'];
//$action = "none";
//$action = "none";
G::uploadFile( $tempName, $path, $filename );
}
}
//importing a bpmn diagram, using external class to do it.
//importing a bpmn diagram, using external class to do it.
if ($processFileType == "bpmn") {
G::LoadClass( 'bpmnExport' );
$bpmn = new bpmnExport();
@@ -122,16 +116,14 @@ if ($action == "uploadFileNewProcess") {
die();
}
//if file is a .pm or .xpdl file continues normally the importing
//if file is a .pm file continues normally the importing
if ($processFileType == "pm") {
$oData = $oProcess->getProcessData( $path . $filename );
} else {
$oData = $oProcess->getProcessDataXpdl( $path . $filename );
}
reservedWordsSqlValidate( $oData );
//!Upload file
//!Upload file
$Fields['PRO_FILENAME'] = $filename;
$Fields['IMPORT_OPTION'] = 2;
@@ -145,7 +137,7 @@ if ($action == "uploadFileNewProcess") {
$result->ExistProcessInDatabase = 0;
}
//!respect of the groups
//!respect of the groups
$result->ExistGroupsInDatabase = 1;
$result->groupBeforeAccion = $action;
if (! is_null( $optionGroupExistInDatabase )) {
@@ -163,21 +155,16 @@ if ($action == "uploadFileNewProcess") {
$result->ExistGroupsInDatabase = 0;
}
}
//!respect of the groups
//!respect of the groups
if ($result->ExistProcessInDatabase == 0 && $result->ExistGroupsInDatabase == 0) {
if ($processFileType == "pm") {
$oProcess->createProcessFromData( $oData, $path . $filename );
} else {
if (! isset( $oData->tasks ))
$oData->tasks = array ();
$tasks = $oData->tasks;
$oProcess->createProcessFromDataXpdl( $oData, $tasks );
}
}
//!data ouput
//!data ouput
$result->sNewProUid = $sProUid;
$result->proFileName = $Fields['PRO_FILENAME'];
} catch (Exception $e) {
@@ -193,34 +180,29 @@ if ($action == "uploadFileNewProcessExist") {
$filename = $_REQUEST["PRO_FILENAME"];
$processFileType = $_REQUEST["processFileType"];
$result->ExistGroupsInDatabase = ""; //"" -Default
//0 -Dont exist process
//1 -exist process
$result->ExistGroupsInDatabase = ""; //"" -Default
//0 -Dont exist process
//1 -exist process
$optionGroupExistInDatabase = isset( $_REQUEST["optionGroupExistInDatabase"] ) ? $_REQUEST["optionGroupExistInDatabase"] : null;
$sNewProUid = "";
$oProcess = new stdClass();
if ($processFileType != "pm" && $processFileType != "xpdl") {
if ($processFileType != "pm") {
throw new Exception( G::LoadTranslation( "ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR" ) );
}
//load the variables
//load the variables
if ($processFileType == "pm") {
G::LoadClass( 'processes' );
$oProcess = new Processes();
} else {
G::LoadClass( 'xpdl' );
$oProcess = new Xpdl();
}
$path = PATH_DOCUMENT . 'input' . PATH_SEP;
if ($processFileType == "pm") {
$oData = $oProcess->getProcessData( $path . $filename );
} else {
$oData = $oProcess->getProcessDataXpdl( $path . $filename );
}
reservedWordsSqlValidate( $oData );
@@ -248,7 +230,7 @@ if ($action == "uploadFileNewProcessExist") {
}
if ($result->ExistGroupsInDatabase == 0) {
//Update the current Process, overwriting all tasks and steps
//Update the current Process, overwriting all tasks and steps
if ($option == 1) {
$oProcess->updateProcessFromData( $oData, $path . $filename );
if (file_exists( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid )) {
@@ -263,7 +245,7 @@ if ($action == "uploadFileNewProcessExist") {
$sNewProUid = $sProUid;
}
//Disable current Process and create a new version of the Process
//Disable current Process and create a new version of the Process
if ($option == 2) {
$oProcess->disablePreviousProcesses( $sProUid );
$sNewProUid = $oProcess->getUnusedProcessGUID();
@@ -274,18 +256,12 @@ if ($action == "uploadFileNewProcessExist") {
if ($processFileType == "pm") {
$oProcess->createProcessFromData( $oData, $path . $filename );
} else {
if (! isset( $oData->tasks )) {
$oData->tasks = array ();
}
$tasks = $oData->tasks;
$oProcess->createProcessFromDataXpdl( $oData, $tasks );
}
}
//Create a completely new Process without change the current Process
//Create a completely new Process without change the current Process
if ($option == 3) {
//krumo ($oData); die;
//krumo ($oData); die;
$sNewProUid = $oProcess->getUnusedProcessGUID();
$oProcess->setProcessGuid( $oData, $sNewProUid );
$oData->process['PRO_TITLE'] = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' );
@@ -293,24 +269,18 @@ if ($action == "uploadFileNewProcessExist") {
if ($processFileType == "pm") {
$oProcess->createProcessFromData( $oData, $path . $filename );
} else {
if (! isset( $oData->tasks )) {
$oData->tasks = array ();
}
$tasks = $oData->tasks;
$oProcess->createProcessFromDataXpdl( $oData, $tasks );
}
}
}
//!data ouput
//!data ouput
$result->fileName = $filename;
$result->importOption = $option;
$result->sNewProUid = $sNewProUid;
$result->success = true;
$result->ExistGroupsInDatabase = $result->ExistGroupsInDatabase;
$result->groupBeforeAccion = $action;
//!data ouput
//!data ouput
} catch (Exception $e) {
$result->response = $e->getMessage();
$result->success = true;
@@ -318,5 +288,5 @@ if ($action == "uploadFileNewProcessExist") {
}
echo G::json_encode( $result );
exit();
exit();

View File

@@ -1,201 +0,0 @@
<?php
function addNodox ($obj, $padre, $indice, $contenido = '', $atributos = '')
{
if (is_object( $padre )) {
if ($contenido == '') {
$nodo = $obj->createElement( $indice );
} else {
$nodo = $obj->createElement( $indice, $contenido );
}
$padre->appendChild( $nodo );
} else {
if ($contenido == '') {
$nodo = $obj->createElement( $indice );
} else {
$nodo = $obj->createElement( $indice, $contenido );
}
$obj->appendChild( $nodo );
}
if (is_array( $atributos )) {
foreach ($atributos as $key => $value) {
$atributo = $obj->createAttribute( $key );
$nodo->appendChild( $atributo );
$texto = $obj->createTextNode( $value );
$atributo->appendChild( $texto );
}
}
return $nodo;
}
function derivationRules ($aRoute, $doc, $nodo_derivationrule)
{
$tam = count( $aRoute );
$c = 0;
switch ($aRoute[$c]['ROU_TYPE']) {
case 'SEQUENTIAL':
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'Sequential', '', '' );
$nodo_nexttask = addNodox( $doc, $nodo_routeType, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
}
break;
case 'EVALUATE':
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'Evaluations', '', '' );
while ($c < $tam) {
$nodo_evaluation = addNodox( $doc, $nodo_routeType, 'Evaluation', '', array ('Condition' => $aRoute[$c]['ROU_CONDITION']
) );
$nodo_nexttask = addNodox( $doc, $nodo_evaluation, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
}
$c ++;
}
break;
case 'SELECT':
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'Selections', '', '' );
while ($c < $tam) {
$nodo_selection = addNodox( $doc, $nodo_routeType, 'Selection', '', array ('Description' => $aRoute[$c]['ROU_CONDITION']
) );
$nodo_nexttask = addNodox( $doc, $nodo_selection, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
}
$c ++;
}
break;
case 'PARALLEL':
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'ParallelForks', '', '' );
while ($c < $tam) {
$nodo_parallelfork = addNodox( $doc, $nodo_routeType, 'ParallelFork', '', '' );
$nodo_nexttask = addNodox( $doc, $nodo_parallelfork, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
}
$c ++;
}
break;
case 'PARALLEL-BY-EVALUATION':
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'ParallelForksByEvaluation', '', '' );
while ($c < $tam) {
$nodo_evaluation = addNodox( $doc, $nodo_routeType, 'Evaluation', '', array ('Condition' => $aRoute[$c]['ROU_CONDITION']
) );
$nodo_nexttask = addNodox( $doc, $nodo_evaluation, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
}
$c ++;
}
break;
case 'SEC-JOIN':
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'ParallelJoin', '', '' );
$nodo_nexttask = addNodox( $doc, $nodo_routeType, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
}
break;
}
}
/**
* **-_--__---___----___---__--_-***
*/
G::LoadClass( 'tasks' );
require_once 'classes/model/Process.php';
$doc = new DOMDocument( '1.0', 'UTF-8' );
$nodo_padre = addNodox( $doc, '', 'Processes', '', array ('xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance','xsi:noNamespaceSchemaLocation' => 'ColosaSchema.xsd'
) );
$aProcesses = array ();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( ProcessPeer::PRO_UID );
//$oCriteria->add(ProcessPeer::PRO_STATUS, 'DISABLED', Criteria::NOT_EQUAL);
//$oCriteria->add(ProcessPeer::PRO_UID, '946679494980c3d0ba0814088444708');
$oDataset = ProcessPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$oProcess = new Process();
while ($aRow = $oDataset->getRow()) {
$aProcess = $oProcess->load( $aRow['PRO_UID'] );
$nodo_process = addNodox( $doc, $nodo_padre, 'Process', '', array ('Title' => $aProcess['PRO_TITLE'],'Description' => $aProcess['PRO_DESCRIPTION']
) );
$nodo_tasks = addNodox( $doc, $nodo_process, 'Tasks', '', '' );
$oTask = new Tasks();
$aTasks = $oTask->getAllTasks( $aProcess['PRO_UID'] );
foreach ($aTasks as $key => $value) {
//print_r($value); echo "<br>";
$aRoute = $oTask->getRoute( $aProcess['PRO_UID'], $value['TAS_UID'] );
//print_r($aRoute[0]['ROU_UID']); echo "<hr>";
/*foreach($aRoute as $k => $v)
echo $k."-->".$v."<br>";
*/
if ($value['TAS_TYPE'] == 'NORMAL') {
$ini = ($value['TAS_START'] == 'TRUE') ? 'true' : 'false';
$nodo_task = addNodox( $doc, $nodo_tasks, 'Task', '', array ('Title' => $value['TAS_TITLE'],'Description' => $value['TAS_DESCRIPTION'],'Id' => 'ID' . $value['TAS_UID'],'StartingTask' => $ini
) );
$nodo_coordinates = addNodox( $doc, $nodo_task, 'Coordinates', '', array ('XCoordinate' => $value['TAS_POSX'],'YCoordinate' => $value['TAS_POSY']
) );
$nodo_derivationrule = addNodox( $doc, $nodo_task, 'DerivationRule', '', '' );
derivationRules( $aRoute, $doc, $nodo_derivationrule );
$nodo_assignmentrules = addNodox( $doc, $nodo_task, 'AssignmentRules', '', '' );
$nodo_cyclicalassignment = addNodox( $doc, $nodo_assignmentrules, 'CyclicalAssignment', '', '' );
$nodo_timingcontrol = addNodox( $doc, $nodo_task, 'TimingControl', '', array ('TaskDuration' => $value['TAS_DURATION']
) );
$nodo_permissions = addNodox( $doc, $nodo_task, 'Permissions', '', '' );
$nodo_caselabels = addNodox( $doc, $nodo_task, 'CaseLabels', '', '' );
$nodo_notifications = addNodox( $doc, $nodo_task, 'Notifications', '', '' );
} else {
require_once ("classes/model/SubProcess.php");
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( SubProcessPeer::PRO_PARENT, $value['PRO_UID'] );
$oCriteria->add( SubProcessPeer::TAS_PARENT, $value['TAS_UID'] );
$oDataset = SubProcessPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
$nodo_task = addNodox( $doc, $nodo_tasks, 'SubProcess', '', array ('Title' => $value['TAS_TITLE'],'Description' => $value['TAS_DESCRIPTION'],'Id' => 'ID' . $value['TAS_UID'],'ProcessRef' => $aRow['PRO_UID']
) );
$nodo_coordinates = addNodox( $doc, $nodo_task, 'Coordinates', '', array ('XCoordinate' => $value['TAS_POSX'],'YCoordinate' => $value['TAS_POSY']
) );
$nodo_derivationrule = addNodox( $doc, $nodo_task, 'DerivationRule', '', '' );
derivationRules( $aRoute, $doc, $nodo_derivationrule );
}
}
$oDataset->next();
}
//die;
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$doc->save( PATH_METHODS . 'services/test_xpdl.xml' );
echo "xml for xpdl creado!!!<br>";