CODE STYLE

workflow/engine/methods/processes/process_Delete.php
workflow/engine/methods/processes/processes_DeleteObjectPermission.php
workflow/engine/methods/processes/processes_doUpload.php
workflow/engine/methods/processes/processes_DownloadFile.php
workflow/engine/methods/processes/processes_DownloadFileXpdl.php
workflow/engine/methods/processes/processes_checkProperties.php
workflow/engine/methods/processes/processes_Export.php
workflow/engine/methods/processes/processes_GetFile.php
workflow/engine/methods/processes/processes_Import.php
workflow/engine/methods/processes/processes_Import_Ajax.php
This commit is contained in:
jennylee
2012-10-17 12:03:40 -04:00
parent 7deb103424
commit 27ac82a803
10 changed files with 624 additions and 658 deletions

View File

@@ -12,51 +12,49 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
$access = $RBAC->userCanAccess('PM_FACTORY');
if( $access != 1 ){
switch ($access){
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -2:
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
}
G::LoadClass('processMap');
$access = $RBAC->userCanAccess( 'PM_FACTORY' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
G::LoadClass( 'processMap' );
$oProcessMap = new ProcessMap();
$UIDS = explode(',', $_POST['PRO_UIDS']);
$UIDS = explode( ',', $_POST['PRO_UIDS'] );
try{
foreach($UIDS as $UID){
$oProcessMap->deleteProcess($UID);
}
$resp->status = 0;
$resp->msg = 'All process was deleted successfully';
echo G::json_encode($resp);
} catch(Exception $e){
$resp->status = 1;
$resp->msg = $e->getMessage();
echo G::json_encode($resp);
}
try {
foreach ($UIDS as $UID) {
$oProcessMap->deleteProcess( $UID );
}
$resp->status = 0;
$resp->msg = 'All process was deleted successfully';
echo G::json_encode( $resp );
} catch (Exception $e) {
$resp->status = 1;
$resp->msg = $e->getMessage();
echo G::json_encode( $resp );
}

View File

@@ -1,63 +1,60 @@
<?php
/**
* processes_Save.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
$access = $RBAC->userCanAccess('PM_FACTORY');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
}
try{
require_once 'classes/model/ObjectPermission.php';
$oOP = new ObjectPermission();
$oOP = ObjectPermissionPeer::retrieveByPK($_GET['OP_UID']);
$sProcessUID = $oOP->getProUid();
$oOP->delete();
$result->success = true;
$result->msg = G::LoadTranslation('ID_REPORTTABLE_REMOVED');
G::LoadClass('processMap');
$oProcessMap = new ProcessMap();
$oProcessMap->getObjectsPermissionsCriteria($sProcessUID);
}
catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode($result);
<?php
/**
* processes_Save.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
$access = $RBAC->userCanAccess( 'PM_FACTORY' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
try {
require_once 'classes/model/ObjectPermission.php';
$oOP = new ObjectPermission();
$oOP = ObjectPermissionPeer::retrieveByPK( $_GET['OP_UID'] );
$sProcessUID = $oOP->getProUid();
$oOP->delete();
$result->success = true;
$result->msg = G::LoadTranslation( 'ID_REPORTTABLE_REMOVED' );
G::LoadClass( 'processMap' );
$oProcessMap = new ProcessMap();
$oProcessMap->getObjectsPermissionsCriteria( $sProcessUID );
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode( $result );

View File

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

View File

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

View File

@@ -12,100 +12,94 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
G::LoadThirdParty('pear/json','class.json');
G::LoadThirdParty( 'pear/json', 'class.json' );
try {
function myTruncate($chain, $limit, $break='.', $pad='...') {
if (strlen($chain) <= $limit) {
return $chain;
}
$breakpoint = strpos($chain, $break, $limit);
if (false !== $breakpoint) {
$len =strlen($chain) - 1;
if ($breakpoint < $len) {
$chain = substr($chain, 0, $breakpoint) . $pad;
}
}
return $chain;
}
function addTitlle($Category, $Id, $Lang) {
require_once 'classes/model/Content.php';
$content = new Content();
$value = $content->load($Category,'', $Id, $Lang);
return $value;
}
$oJSON = new Services_JSON();
$stdObj = $oJSON->decode( $_POST['data'] );
if ( isset ($stdObj->pro_uid ) )
$sProUid = $stdObj->pro_uid;
else
throw ( new Exception ( 'the process uid is not defined!.' ) );
/* Includes */
G::LoadClass('processes');
$oProcess = new Processes();
$proFields = $oProcess->serializeProcess( $sProUid );
$Fields = $oProcess->saveSerializedProcess ( $proFields );
$pathLength = strlen(PATH_DATA ."sites".PATH_SEP.SYS_SYS.PATH_SEP."files".PATH_SEP."output".PATH_SEP);
$length = strlen($Fields['PRO_TITLE']) + $pathLength;
foreach($Fields as $key => $value)
{
if ($key == 'PRO_TITLE') {
$Fields[$key] = myTruncate($value, 65, ' ', '...');
function myTruncate ($chain, $limit, $break = '.', $pad = '...')
{
if (strlen( $chain ) <= $limit) {
return $chain;
}
$breakpoint = strpos( $chain, $break, $limit );
if (false !== $breakpoint) {
$len = strlen( $chain ) - 1;
if ($breakpoint < $len) {
$chain = substr( $chain, 0, $breakpoint ) . $pad;
}
}
return $chain;
}
if ($key == 'FILENAME') {
$Fields[$key] = myTruncate($value, 60, '_', '...pm');
}
if (($length) >= 250) {
if ($key == 'FILENAME_LINK') {
list($file,$rest) = explode ('p=',$value);
list($filenameLink,$rest) = explode ('&',$rest);
$Fields[$key] = myTruncate($filenameLink, 250 - $pathLength, '_', '');
$Fields[$key] = $file."p=".$Fields[$key].'&'.$rest;
}
}
}
/* Render page */
if (isset($_REQUEST["processMap"]) && $_REQUEST["processMap"] == 1) {
function addTitlle ($Category, $Id, $Lang)
{
require_once 'classes/model/Content.php';
$content = new Content();
$value = $content->load( $Category, '', $Id, $Lang );
return $value;
}
$oJSON = new Services_JSON();
$stdObj = $oJSON->decode( $_POST['data'] );
if (isset( $stdObj->pro_uid ))
$sProUid = $stdObj->pro_uid;
else
throw (new Exception( 'the process uid is not defined!.' ));
/* Includes */
G::LoadClass( 'processes' );
$oProcess = new Processes();
$proFields = $oProcess->serializeProcess( $sProUid );
$Fields = $oProcess->saveSerializedProcess( $proFields );
$pathLength = strlen( PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP );
$length = strlen( $Fields['PRO_TITLE'] ) + $pathLength;
foreach ($Fields as $key => $value) {
if ($key == 'PRO_TITLE') {
$Fields[$key] = myTruncate( $value, 65, ' ', '...' );
}
if ($key == 'FILENAME') {
$Fields[$key] = myTruncate( $value, 60, '_', '...pm' );
}
if (($length) >= 250) {
if ($key == 'FILENAME_LINK') {
list ($file, $rest) = explode( 'p=', $value );
list ($filenameLink, $rest) = explode( '&', $rest );
$Fields[$key] = myTruncate( $filenameLink, 250 - $pathLength, '_', '' );
$Fields[$key] = $file . "p=" . $Fields[$key] . '&' . $rest;
}
}
}
/* Render page */
if (isset( $_REQUEST["processMap"] ) && $_REQUEST["processMap"] == 1) {
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( "xmlform", "xmlform", "processes/processes_Export", "", $Fields );
G::RenderPage( "publish", "raw" );
} else {
$xmlFrm = new XmlForm();
$xmlFrm->home = PATH_XMLFORM . "processes" . PATH_SEP;
$xmlFrm->parseFile( "processes_Export.xml", SYS_LANG, true );
$Fields["xmlFrmFieldLabel"] = array ("title" => $xmlFrm->fields["TITLE"]->label,"proTitle" => $xmlFrm->fields["PRO_TITLE"]->label,"proDescription" => $xmlFrm->fields["PRO_DESCRIPTION"]->label,"size" => $xmlFrm->fields["SIZE"]->label,"fileName" => $xmlFrm->fields["FILENAME_LABEL"]->label
);
echo G::json_encode( $Fields );
}
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent("xmlform", "xmlform", "processes/processes_Export", "", $Fields);
G::RenderPage("publish", "raw");
}
else {
$xmlFrm = new XmlForm();
$xmlFrm->home = PATH_XMLFORM . "processes" . PATH_SEP;
$xmlFrm->parseFile("processes_Export.xml" , SYS_LANG, true);
$Fields["xmlFrmFieldLabel"] = array(
"title" => $xmlFrm->fields["TITLE"]->label,
"proTitle" => $xmlFrm->fields["PRO_TITLE"]->label,
"proDescription" => $xmlFrm->fields["PRO_DESCRIPTION"]->label,
"size" => $xmlFrm->fields["SIZE"]->label,
"fileName" => $xmlFrm->fields["FILENAME_LABEL"]->label
);
echo G::json_encode($Fields);
}
}
catch ( Exception $e ){
$G_PUBLISH = new Publisher;
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage('publish', 'raw' );
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'raw' );
}

View File

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

View File

@@ -1,10 +1,10 @@
<?php
/**
* processes_Import.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,54 +12,51 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$access = $RBAC->userCanAccess('PM_FACTORY');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
}
$access = $RBAC->userCanAccess( 'PM_FACTORY' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
try {
/* Includes */
G::LoadClass('processes');
/* Render page */
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_Import', '', NULL, 'processes_ImportFile' );
G::RenderPage( "publish", "blank");
/* Includes */
G::LoadClass( 'processes' );
}
catch ( Exception $e ){
$G_PUBLISH = new Publisher;
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage('publish', "blank");
}
/* Render page */
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_Import', '', NULL, 'processes_ImportFile' );
G::RenderPage( "publish", "blank" );
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', "blank" );
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,10 @@
<?php
/**
* processes_checkProperties.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,79 +12,77 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
$access = $RBAC->userCanAccess('PM_FACTORY');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
}
$access = $RBAC->userCanAccess( 'PM_FACTORY' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
$form = $_POST ['form'];
$form = $_POST['form'];
//$tasUid = $form['TASKS'];
//$tasUid = $form['TASKS'];
$tasUid = $form['TAS_PARENT'];
$spSynchronous = $form['SP_SYNCHRONOUS'];
require_once 'classes/model/Route.php';
require_once 'classes/model/Task.php';
$oRoute= new Route();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(RoutePeer::ROU_NEXT_TASK);
$oCriteria->add(RoutePeer::TAS_UID, $tasUid);
$oDataset = RoutePeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oRoute = new Route();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( RoutePeer::ROU_NEXT_TASK );
$oCriteria->add( RoutePeer::TAS_UID, $tasUid );
$oDataset = RoutePeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$sw=1;
// if there are more step we're looking them and we're checking TAS_ASSIGN_TYPE field
while ($oDataset->next() && $sw){
$aRow = $oDataset->getRow();
$oCriteria1 = new Criteria('workflow');
$oCriteria1->addSelectColumn(TaskPeer::TAS_ASSIGN_TYPE);
$oCriteria1->add(TaskPeer::PRO_UID, $form['PRO_PARENT']);
$oCriteria1->add(TaskPeer::TAS_UID, $aRow['ROU_NEXT_TASK']);
$oDataset1 = TaskPeer::doSelectRS($oCriteria1);
$oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset1->next();
$aRow1 = $oDataset1->getRow();
if($spSynchronous && $aRow1['TAS_ASSIGN_TYPE']=='MANUAL')
$sw=0;
$sw = 1;
// if there are more step we're looking them and we're checking TAS_ASSIGN_TYPE field
while ($oDataset->next() && $sw) {
$aRow = $oDataset->getRow();
$oCriteria1 = new Criteria( 'workflow' );
$oCriteria1->addSelectColumn( TaskPeer::TAS_ASSIGN_TYPE );
$oCriteria1->add( TaskPeer::PRO_UID, $form['PRO_PARENT'] );
$oCriteria1->add( TaskPeer::TAS_UID, $aRow['ROU_NEXT_TASK'] );
$oDataset1 = TaskPeer::doSelectRS( $oCriteria1 );
$oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset1->next();
$aRow1 = $oDataset1->getRow();
if ($spSynchronous && $aRow1['TAS_ASSIGN_TYPE'] == 'MANUAL')
$sw = 0;
}
///If there are at least one TAS_ASSIGN_TYPE field with MANUAL it returns 1
if(!$sw)
return print $spSynchronous;
else
return print '0';
///If there are at least one TAS_ASSIGN_TYPE field with MANUAL it returns 1
if (! $sw)
return print $spSynchronous;
else
return print '0';

View File

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