Merge pull request #769 from Jennydmz/master

CODE STYLE.
This commit is contained in:
ferOnti
2012-10-17 08:52:43 -07:00
7 changed files with 619 additions and 616 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,72 +1,72 @@
<?php
$ipaddress = $_SERVER['REMOTE_ADDR'];
try {
$aux = explode ( '|', $_GET['id'] );
$ipaddress = $_SERVER['REMOTE_ADDR'];
try {
$aux = explode( '|', $_GET['id'] );
$index=0;
$ObjUid = str_replace ( '"', '', $aux[$index++] );
if ( isset ($_GET['v'] ))
$versionReq = $_GET['v'];
$index = 0;
$ObjUid = str_replace( '"', '', $aux[$index ++] );
if (isset( $_GET['v'] ))
$versionReq = $_GET['v'];
//downloading the file
$localPath = PATH_DOCUMENT . 'input' . PATH_SEP ;
G::mk_dir($localPath);
//downloading the file
$localPath = PATH_DOCUMENT . 'input' . PATH_SEP;
G::mk_dir( $localPath );
$newfilename = G::GenerateUniqueId() . '.pm';
$downloadUrl = PML_DOWNLOAD_URL . '?id=' . $ObjUid . (isset($_GET['s']) ? '&s=' . $_GET['s'] : '');
$downloadUrl = PML_DOWNLOAD_URL . '?id=' . $ObjUid . (isset( $_GET['s'] ) ? '&s=' . $_GET['s'] : '');
//print "<hr>$downloadUrl<hr>";die;
G::LoadClass('processes');
G::LoadClass( 'processes' );
$oProcess = new Processes();
$oProcess->downloadFile( $downloadUrl, $localPath, $newfilename);
$oProcess->downloadFile( $downloadUrl, $localPath, $newfilename );
//getting the ProUid from the file recently downloaded
$oData = $oProcess->getProcessData ( $localPath . $newfilename );
if (is_null($oData)) {
throw new Exception('Error');
$oData = $oProcess->getProcessData( $localPath . $newfilename );
if (is_null( $oData )) {
throw new Exception( 'Error' );
}
$Fields['IMPORT_OPTION'] = 2;
$Fields['PRO_FILENAME'] = $newfilename;
$Fields['OBJ_UID'] = $ObjUid ;
$Fields['PRO_FILENAME'] = $newfilename;
$Fields['OBJ_UID'] = $ObjUid;
$sProUid = $oData->process['PRO_UID'];
$oData->process['PRO_UID_OLD']=$sProUid;
//print $sProUid;die;
$oData->process['PRO_UID_OLD'] = $sProUid;
//print $sProUid;die;
//if the process exists, we need to ask what kind of re-import the user wants,
if ( $oProcess->processExists ( $sProUid ) ) {
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ImportExisting', '', $Fields, 'downloadPML_ImportExisting' );
G::RenderPage('publish', 'blank');
die;
if ($oProcess->processExists( $sProUid )) {
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ImportExisting', '', $Fields, 'downloadPML_ImportExisting' );
G::RenderPage( 'publish', 'blank' );
die();
}
//creating the process
$oProcess->createProcessFromData ($oData, $localPath . $newfilename );
$oProcess->createProcessFromData( $oData, $localPath . $newfilename );
//show the info after the imported process
G::LoadClass('processes');
G::LoadClass( 'processes' );
$oProcess = new Processes();
$oProcess->ws_open_public ();
$processData = $oProcess->ws_processGetData ( $ObjUid );
$Fields['pro_title'] = $processData->title;
$Fields['installSteps'] = nl2br($processData->installSteps);
$Fields['category'] = (isset($processData->category) ? $processData->category : '');
$Fields['version'] = $processData->version;
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_PUBLISH = new Publisher;
$Fields['PRO_UID'] = $sProUid;
$processmapLink = "processes_Map?PRO_UID=$sProUid";
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ImportSucessful', '', $Fields, $processmapLink );
G::RenderPage('publish', 'blank');
die;
}
catch ( Exception $e ) {
$G_PUBLISH = new Publisher;
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
$oProcess->ws_open_public();
$processData = $oProcess->ws_processGetData( $ObjUid );
$Fields['pro_title'] = $processData->title;
$Fields['installSteps'] = nl2br( $processData->installSteps );
$Fields['category'] = (isset( $processData->category ) ? $processData->category : '');
$Fields['version'] = $processData->version;
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_PUBLISH = new Publisher();
$Fields['PRO_UID'] = $sProUid;
$processmapLink = "processes_Map?PRO_UID=$sProUid";
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ImportSucessful', '', $Fields, $processmapLink );
G::RenderPage( 'publish', 'blank' );
}
die();
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' );
}

View File

@@ -12,89 +12,87 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
//load the variables
G::LoadClass('processes');
$oProcess = new Processes();
try {
//load the variables
G::LoadClass( 'processes' );
$oProcess = new Processes();
if ( !isset ($_POST['form']['IMPORT_OPTION'] ) ) {
throw ( new Exception ('Please select an option before to continue')) ;
}
$option = $_POST['form']['IMPORT_OPTION'];
$filename = $_POST['form']['PRO_FILENAME'];
$ObjUid = $_POST['form']['OBJ_UID'];
$path = PATH_DOCUMENT . 'input' . PATH_SEP ;
$oData = $oProcess->getProcessData ( $path . $filename );
$Fields['PRO_FILENAME'] = $filename;
$sProUid = $oData->process['PRO_UID'];
$oData->process['PRO_UID_OLD']=$sProUid;
//Update the current Process, overwriting all tasks and steps
if ( $option == 1 ) {
$oProcess->updateProcessFromData ($oData, $path . $filename );
if (file_exists(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid)) {
$oDirectory = dir(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid);
while($sObjectName = $oDirectory->read()) {
if (($sObjectName != '.') && ($sObjectName != '..')) {
unlink(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid . PATH_SEP . $sObjectName);
}
}
$oDirectory->close();
if (! isset( $_POST['form']['IMPORT_OPTION'] )) {
throw (new Exception( 'Please select an option before to continue' ));
}
$sNewProUid = $sProUid;
}
//Disable current Process and create a new version of the Process
if ( $option == 2 ) {
$oProcess->disablePreviousProcesses( $sProUid );
$sNewProUid = $oProcess->getUnusedProcessGUID() ;
$oProcess->setProcessGuid ( $oData, $sNewProUid );
$oProcess->setProcessParent( $oData, $sProUid );
$oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date ( 'M d, H:i' );
$oProcess->renewAllTaskGuid ( $oData );
$oProcess->renewAllDynaformGuid ( $oData );
$oProcess->renewAllInputGuid ( $oData );
$oProcess->renewAllOutputGuid ( $oData );
$oProcess->renewAllStepGuid ( $oData );
$oProcess->renewAllTriggerGuid ( $oData );
$oProcess->renewAllSubProcessGuid ( $oData );
$oProcess->createProcessFromData ($oData, $path . $filename );
}
$option = $_POST['form']['IMPORT_OPTION'];
$filename = $_POST['form']['PRO_FILENAME'];
$ObjUid = $_POST['form']['OBJ_UID'];
//Create a completely new Process without change the current Process
if ( $option == 3 ) {
//krumo ($oData);
$sNewProUid = $oProcess->getUnusedProcessGUID() ;
$oProcess->setProcessGuid ( $oData, $sNewProUid );
$oData->process['PRO_TITLE'] = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date ( 'M d, H:i' );
$oProcess->renewAllTaskGuid ( $oData );
$oProcess->renewAllDynaformGuid ( $oData );
$oProcess->renewAllInputGuid ( $oData );
$oProcess->renewAllOutputGuid ( $oData );
$oProcess->renewAllStepGuid ( $oData );
$oProcess->renewAllTriggerGuid ( $oData );
$oProcess->renewAllSubProcessGuid ( $oData );
$oProcess->createProcessFromData ($oData, $path . $filename );
}
G::header('Location: processes_Map?PRO_UID=' . $sNewProUid);
}
catch ( Exception $e ){
$G_PUBLISH = new Publisher;
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage('publish', 'blank');
$path = PATH_DOCUMENT . 'input' . PATH_SEP;
$oData = $oProcess->getProcessData( $path . $filename );
$Fields['PRO_FILENAME'] = $filename;
$sProUid = $oData->process['PRO_UID'];
$oData->process['PRO_UID_OLD'] = $sProUid;
//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->renewAllTaskGuid( $oData );
$oProcess->renewAllDynaformGuid( $oData );
$oProcess->renewAllInputGuid( $oData );
$oProcess->renewAllOutputGuid( $oData );
$oProcess->renewAllStepGuid( $oData );
$oProcess->renewAllTriggerGuid( $oData );
$oProcess->renewAllSubProcessGuid( $oData );
$oProcess->createProcessFromData( $oData, $path . $filename );
}
//Create a completely new Process without change the current Process
if ($option == 3) {
//krumo ($oData);
$sNewProUid = $oProcess->getUnusedProcessGUID();
$oProcess->setProcessGuid( $oData, $sNewProUid );
$oData->process['PRO_TITLE'] = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' );
$oProcess->renewAllTaskGuid( $oData );
$oProcess->renewAllDynaformGuid( $oData );
$oProcess->renewAllInputGuid( $oData );
$oProcess->renewAllOutputGuid( $oData );
$oProcess->renewAllStepGuid( $oData );
$oProcess->renewAllTriggerGuid( $oData );
$oProcess->renewAllSubProcessGuid( $oData );
$oProcess->createProcessFromData( $oData, $path . $filename );
}
G::header( 'Location: processes_Map?PRO_UID=' . $sNewProUid );
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' );
}

View File

@@ -1,10 +1,10 @@
<?php
/**
* index.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,17 +12,15 @@
*
* 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.
*
*/
$newFile = str_replace ( 'index.php', 'processes_List.php' , __FILE__ ) ;
return $newFile;
$newFile = str_replace( 'index.php', 'processes_List.php', __FILE__ );
return $newFile;

View File

@@ -12,15 +12,14 @@
*
* 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.
*
*/
/*$access = $RBAC->userCanAccess('PM_FACTORY');
@@ -38,23 +37,23 @@ if( $access != 1 ) {
}
exit();
}*/
//next two variables store the current process uid and the last processmap used
//next two variables store the current process uid and the last processmap used
//print_r ($_SESSION['PROCESS'] );
//print_r ($_SESSION['PROCESSMAP'] );
$RBAC->requirePermissions('PM_FACTORY');
$RBAC->requirePermissions( 'PM_FACTORY' );
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'process';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'process';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = '-';
$G_PUBLISH = new Publisher;
$oHeadPublisher =& headPublisher::getSingleton();
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
//$oHeadPublisher->addScriptFile('/jscore/processes/main.js');
$G_PUBLISH->AddContent('view', 'processes/mainLoad');
$G_PUBLISH->AddContent( 'view', 'processes/mainLoad' );
if (isset( $_GET['type'] ))
G::RenderPage( "publishBlank", "blank" );
else
G::RenderPage( "publish" );
if( isset($_GET['type']) )
G::RenderPage( "publishBlank", "blank");
else
G::RenderPage( "publish" );

View File

@@ -1,37 +1,36 @@
<?php
/**
* main.php Cases List main processor
*
* 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.
*
*/
$oHeadPublisher =& headPublisher::getSingleton();
G::loadClass('configuration');
$conf = new Configurations;
$oHeadPublisher->addExtJsScript('processes/main', true ); //adding a javascript file .js
$oHeadPublisher->addContent('processes/main'); //adding a html file .html.
$oHeadPublisher->assign('pageSize', $conf->getEnvSetting('casesListRowNumber'));
G::RenderPage('publish', 'extJs');
<?php
/**
* main.php Cases List main processor
*
* 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.
*/
$oHeadPublisher = & headPublisher::getSingleton();
G::loadClass( 'configuration' );
$conf = new Configurations();
$oHeadPublisher->addExtJsScript( 'processes/main', true ); //adding a javascript file .js
$oHeadPublisher->addContent( 'processes/main' ); //adding a html file .html.
$oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) );
G::RenderPage( 'publish', 'extJs' );

View File

@@ -12,15 +12,14 @@
*
* 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.
*
*/
/*
@@ -39,30 +38,30 @@ switch ($RBAC->userCanAccess('PM_FACTORY'))
break;
}
*/
$PRO_UID = $_GET['PRO_UID'];
require_once 'classes/model/Process.php';
G::LoadClass('case');
$oProcessMap = new Cases();
$process = new Process();
$processData = $process->load($PRO_UID);
$c = $oProcessMap->getCriteriaProcessCases('TO_DO', $PRO_UID);
$processData["TO_DO"] = ApplicationPeer::doCount($c);
$PRO_UID = $_GET['PRO_UID'];
require_once 'classes/model/Process.php';
G::LoadClass( 'case' );
$oProcessMap = new Cases();
$c = $oProcessMap->getCriteriaProcessCases('COMPLETED', $PRO_UID);
$processData["COMPLETED"] = ApplicationPeer::doCount($c);
$process = new Process();
$processData = $process->load( $PRO_UID );
$c = $oProcessMap->getCriteriaProcessCases('DRAFT', $PRO_UID);
$processData["DRAFT"] = ApplicationPeer::doCount($c);
$c = $oProcessMap->getCriteriaProcessCases( 'TO_DO', $PRO_UID );
$processData["TO_DO"] = ApplicationPeer::doCount( $c );
$c = $oProcessMap->getCriteriaProcessCases('CANCELLED', $PRO_UID);
$processData["CANCELLED"] = ApplicationPeer::doCount($c);
$c = $oProcessMap->getCriteriaProcessCases( 'COMPLETED', $PRO_UID );
$processData["COMPLETED"] = ApplicationPeer::doCount( $c );
$processData["PRO_UID"] = $PRO_UID;
$c = $oProcessMap->getCriteriaProcessCases( 'DRAFT', $PRO_UID );
$processData["DRAFT"] = ApplicationPeer::doCount( $c );
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_DeleteCases', '', $processData, 'processes_Delete.php');
G::RenderPage('publish', 'raw');
$c = $oProcessMap->getCriteriaProcessCases( 'CANCELLED', $PRO_UID );
$processData["CANCELLED"] = ApplicationPeer::doCount( $c );
$processData["PRO_UID"] = $PRO_UID;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_DeleteCases', '', $processData, 'processes_Delete.php' );
G::RenderPage( 'publish', 'raw' );
?>