ODE STYLE Formating workflow/engine/methods/outpudocs/

Change format files in workflow/engine/methods/outpudocs/
This commit is contained in:
norahmollo
2012-10-17 15:23:02 +00:00
parent 767f67e713
commit f09f9d37f4
9 changed files with 579 additions and 604 deletions

View File

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

View File

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

View File

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

View File

@@ -1,85 +1,77 @@
<?php <?php
/** /**
* outputdocs_Edit.php * outputdocs_Edit.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/ try {
try { global $RBAC;
global $RBAC; switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
switch ($RBAC->userCanAccess('PM_FACTORY')) { case - 2:
case -2: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; case - 1:
case -1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; }
} require_once 'classes/model/OutputDocument.php';
require_once 'classes/model/OutputDocument.php'; $ooutputDocument = new OutputDocument();
$ooutputDocument = new OutputDocument(); if (isset( $_GET['OUT_DOC_UID'] )) {
if (isset($_GET['OUT_DOC_UID'])) { $aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] );
$aFields = $ooutputDocument->load($_GET['OUT_DOC_UID']); } else {
} $aFields = array ();
else { $aFields['PRO_UID'] = $_GET['PRO_UID'];
$aFields = array(); }
$aFields['PRO_UID'] = $_GET['PRO_UID']; $aFields['OUT_DOC_TYPE'] = 'HTML';
} $enabledJavaBridge = false;
$aFields['OUT_DOC_TYPE'] = 'HTML'; /**
* Temporally Disabled, because we are not using JRXML output doc type by now
* G::LoadClass ('javaBridgePM');
$enabledJavaBridge = false; * if ( class_exists ( 'javaBridgePM' ) ) {
* $JBPM = new JavaBridgePM();
/** * try {
* Temporally Disabled, because we are not using JRXML output doc type by now * $JBPM->checkJavaExtension();
G::LoadClass ('javaBridgePM'); * $util = new Java("com.processmaker.util.pmutils");
if ( class_exists ( 'javaBridgePM' ) ) { * $enabledJavaBridge = true;
$JBPM = new JavaBridgePM(); * } catch ( Exception $e ) {
try { *
$JBPM->checkJavaExtension(); * }
$util = new Java("com.processmaker.util.pmutils"); * //$util->setInputPath( JAVATEST_PATH );
$enabledJavaBridge = true; * //$util->setOutputPath( JAVATEST_PATH );
} catch ( Exception $e ) { * }
*/
} G::LoadClass( 'xmlfield_InputPM' );
//$util->setInputPath( JAVATEST_PATH ); $G_PUBLISH = new Publisher();
//$util->setOutputPath( JAVATEST_PATH ); if (! $enabledJavaBridge) {
} $xmlform = 'outputdocs/outputdocs_Properties';
*/ $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, '../outputdocs/outputdocs_Save' );
} else {
$xmlform = 'outputdocs/outputdocs_New';
G::LoadClass('xmlfield_InputPM'); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, '../outputdocs/outputdocs_Save' );
$G_PUBLISH = new Publisher(); }
if ( ! $enabledJavaBridge ) { G::RenderPage( 'publish', 'raw' );
$xmlform = 'outputdocs/outputdocs_Properties'; } catch (Exception $oException) {
$G_PUBLISH->AddContent('xmlform', 'xmlform', $xmlform, '', $aFields , '../outputdocs/outputdocs_Save'); die( $oException->getMessage() );
} }
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 <?php
/** /**
* outputdocs_Edit.php * outputdocs_Edit.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/ try {
try { global $RBAC;
global $RBAC; switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
switch ($RBAC->userCanAccess('PM_FACTORY')) { case - 2:
case -2: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; case - 1:
case -1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; }
} require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
require_once 'classes/model/OutputDocument.php'; if (isset( $_GET['OUT_DOC_UID'] )) {
$ooutputDocument = new OutputDocument(); $aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] );
if (isset($_GET['OUT_DOC_UID'])) { } else {
$aFields = $ooutputDocument->load($_GET['OUT_DOC_UID']); $aFields = array ();
} else { $aFields['PRO_UID'] = $_GET['PRO_UID'];
$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'] );
$type = isset($aFields['OUT_DOC_TYPE']) ? $aFields['OUT_DOC_TYPE'] : 'HTML'; $aFields['OUT_DOC_LANDSCAPE'] = strval( $aFields['OUT_DOC_LANDSCAPE'] );
if (isset( $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] )) {
$aFields['OUT_DOC_TAGS'] = isset($aFields['OUT_DOC_TAGS']) ? $aFields['OUT_DOC_TAGS'] : 'OUTPUT'; $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] = strval( $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] );
$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_OPEN_PASSWORD'] ) && $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") {
if(isset($aFields['OUT_DOC_PDF_SECURITY_ENABLED'])){ $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_ENABLED'] = strval($aFields['OUT_DOC_PDF_SECURITY_ENABLED']); $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();
if (isset($aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']) && $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") { switch ($type) {
$aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = G::decrypt($aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'], $_GET['OUT_DOC_UID']); case 'HTML':
$aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::decrypt($aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], $_GET['OUT_DOC_UID']); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' );
} break;
case 'JRXML':
G::LoadClass('xmlfield_InputPM'); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' );
$G_PUBLISH = new Publisher(); /*
switch ($type) { // $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsDynaformList', '', $aFields , '../outputdocs/outputdocs_Save');
case 'HTML' : require_once 'classes/model/Process.php';
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save'); G::LoadClass( 'processMap');
break; $sProcessUID = $aFields['PRO_UID'];
case 'JRXML' : $oProcess = new Process();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save'); $oProcessMap = new ProcessMap();
/* $aFields = $oProcess->load($sProcessUID);
// $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsDynaformList', '', $aFields , '../outputdocs/outputdocs_Save'); $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ShortList', $oProcessMap->getDynaformsCriteria($sProcessUID), $aFields);
require_once 'classes/model/Process.php'; */
G::LoadClass( 'processMap'); break;
$sProcessUID = $aFields['PRO_UID']; case 'ACROFORM':
$oProcess = new Process(); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' );
$oProcessMap = new ProcessMap(); break;
$aFields = $oProcess->load($sProcessUID); }
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ShortList', $oProcessMap->getDynaformsCriteria($sProcessUID), $aFields); G::RenderPage( 'publish', 'raw' );
*/ } catch (Exception $oException) {
break; die( $oException->getMessage() );
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,90 @@
<?php <?php
/** /**
* outputdocs_Save.php * outputdocs_Save.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/ try {
try { global $RBAC;
global $RBAC; switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
switch ($RBAC->userCanAccess('PM_FACTORY')) { case - 2:
case -2: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; case - 1:
case -1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; }
}
//default:
//default:
require_once 'classes/model/OutputDocument.php'; require_once 'classes/model/OutputDocument.php';
G::LoadClass('processMap'); G::LoadClass( 'processMap' );
$oOutputDocument = new OutputDocument(); $oOutputDocument = new OutputDocument();
if (isset( $_POST['form'] ))
if (isset($_POST['form'])) $aData = $_POST['form']; //For old process map form
$aData = $_POST['form']; //For old process map form else
else $aData = $_POST; //For Extjs (Since we are not using form in ExtJS)
$aData = $_POST; //For Extjs (Since we are not using form in ExtJS)
if (isset( $aData['OUT_DOC_TITLE'] ) && $aData['OUT_DOC_TITLE'] != '') {
if(isset($aData['OUT_DOC_TITLE']) && $aData['OUT_DOC_TITLE']!=''){ $oForm = new Form( 'outputdocs/outputdocs_Properties', PATH_XMLFORM );
$oForm = new Form('outputdocs/outputdocs_Properties', PATH_XMLFORM); $aData = $oForm->validatePost();
$aData = $oForm->validatePost(); if (isset( $aData['OUT_DOC_PDF_SECURITY_ENABLED'] ) && $aData['OUT_DOC_PDF_SECURITY_ENABLED'] == "0") {
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_OPEN_PASSWORD'] =""; $aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = "";
$aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] =""; $aData['OUT_DOC_PDF_SECURITY_PERMISSIONS'] = "";
$aData['OUT_DOC_PDF_SECURITY_PERMISSIONS'] =""; }
} if (isset( $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] ) && $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") {
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_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'] );
$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 ($aData['OUT_DOC_UID'] == '') {
if ((isset( $aData['OUT_DOC_TYPE'] )) && ($aData['OUT_DOC_TYPE'] == 'JRXML')) {
if ((isset($aData['OUT_DOC_TYPE'])) && ( $aData['OUT_DOC_TYPE'] == 'JRXML' )) { $dynaformUid = $aData['DYN_UID'];
$dynaformUid = $aData['DYN_UID']; $outDocUid = $oOutputDocument->create( $aData );
$outDocUid = $oOutputDocument->create($aData); G::LoadClass( 'javaBridgePM' );
G::LoadClass('javaBridgePM'); $jbpm = new JavaBridgePM();
$jbpm = new JavaBridgePM (); print $jbpm->generateJrxmlFromDynaform( $outDocUid, $dynaformUid, 'classic' );
print $jbpm->generateJrxmlFromDynaform($outDocUid, $dynaformUid, 'classic'); } else {
} else { $outDocUid = $oOutputDocument->create( $aData );
$outDocUid = $oOutputDocument->create($aData); }
} } else {
} else { $oOutputDocument->update( $aData );
$oOutputDocument->update($aData); }
}
if (isset( $aData['PRO_UID'] )) {
if (isset($aData['PRO_UID'])) { //refresh dbarray with the last change in outputDocument
//refresh dbarray with the last change in outputDocument $oMap = new processMap();
$oMap = new processMap(); $oCriteria = $oMap->getOutputDocumentsCriteria( $aData['PRO_UID'] );
$oCriteria = $oMap->getOutputDocumentsCriteria($aData['PRO_UID']); }
}
} catch (Exception $oException) {
} catch (Exception $oException) { die( $oException->getMessage() );
die($oException->getMessage());
} }

View File

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