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';
}
if ($type == 'ACROFORM') {
$extension = 'pdf';
}
$fileJrxml = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension ; $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 );
$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,76 +1,71 @@
<?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",
"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']); $sFileName = strtolower( $_SESSION['outpudocs_tmpFile'] );
$strRev = strrev($sFileName); $strRev = strrev( $sFileName );
$searchPos = strpos($strRev, '.'); $searchPos = strpos( $strRev, '.' );
$pos = (strlen($sFileName) - 1) - $searchPos; $pos = (strlen( $sFileName ) - 1) - $searchPos;
$sExtension = substr($sFileName, $pos+1, strlen($sFileName)); $sExtension = substr( $sFileName, $pos + 1, strlen( $sFileName ) );
if(! in_array($sExtension, $aExtensions)) if (! in_array( $sExtension, $aExtensions ))
echo $content = file_get_contents($_SESSION['outpudocs_tmpFile']); echo $content = file_get_contents( $_SESSION['outpudocs_tmpFile'] );
break; break;
case 'loadTemplateContent': case 'loadTemplateContent':
require_once 'classes/model/OutputDocument.php'; require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument(); $ooutputDocument = new OutputDocument();
if (isset($_POST['OUT_DOC_UID'])) { if (isset( $_POST['OUT_DOC_UID'] )) {
$aFields = $ooutputDocument->load($_POST['OUT_DOC_UID']); $aFields = $ooutputDocument->load( $_POST['OUT_DOC_UID'] );
echo $aFields['OUT_DOC_TEMPLATE']; echo $aFields['OUT_DOC_TEMPLATE'];
} }
break; break;
case 'lookForNameOutput': case 'lookForNameOutput':
require_once('classes/model/Content.php'); require_once ('classes/model/Content.php');
require_once ( "classes/model/OutputDocument.php" ); require_once ("classes/model/OutputDocument.php");
$snameInput = urldecode($_POST['NAMEOUTPUT']); $snameInput = urldecode( $_POST['NAMEOUTPUT'] );
$sPRO_UID = urldecode($_POST['proUid']); $sPRO_UID = urldecode( $_POST['proUid'] );
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_UID); $oCriteria->addSelectColumn( OutputDocumentPeer::OUT_DOC_UID );
$oCriteria->add(OutputDocumentPeer::PRO_UID, $sPRO_UID); $oCriteria->add( OutputDocumentPeer::PRO_UID, $sPRO_UID );
$oDataset = OutputDocumentPeer::doSelectRS($oCriteria); $oDataset = OutputDocumentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$flag = true; $flag = true;
while ($oDataset->next() && $flag) { while ($oDataset->next() && $flag) {
$aRow = $oDataset->getRow(); $aRow = $oDataset->getRow();
$oCriteria1 = new Criteria('workflow'); $oCriteria1 = new Criteria( 'workflow' );
$oCriteria1->addSelectColumn('COUNT(*) AS OUTPUTS'); $oCriteria1->addSelectColumn( 'COUNT(*) AS OUTPUTS' );
$oCriteria1->add(ContentPeer::CON_CATEGORY, 'OUT_DOC_TITLE'); $oCriteria1->add( ContentPeer::CON_CATEGORY, 'OUT_DOC_TITLE' );
$oCriteria1->add(ContentPeer::CON_ID, $aRow['OUT_DOC_UID']); $oCriteria1->add( ContentPeer::CON_ID, $aRow['OUT_DOC_UID'] );
$oCriteria1->add(ContentPeer::CON_VALUE, $snameInput); $oCriteria1->add( ContentPeer::CON_VALUE, $snameInput );
$oCriteria1->add(ContentPeer::CON_LANG, SYS_LANG); $oCriteria1->add( ContentPeer::CON_LANG, SYS_LANG );
$oDataset1 = ContentPeer::doSelectRS($oCriteria1); $oDataset1 = ContentPeer::doSelectRS( $oCriteria1 );
$oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset1->next(); $oDataset1->next();
$aRow1 = $oDataset1->getRow(); $aRow1 = $oDataset1->getRow();

View File

@@ -20,48 +20,41 @@
* *
* 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(); $oOutputDocument = new OutputDocument();
$fields = $oOutputDocument->load($_POST['OUT_DOC_UID']); $fields = $oOutputDocument->load( $_POST['OUT_DOC_UID'] );
$oOutputDocument->remove($_POST['OUT_DOC_UID']); $oOutputDocument->remove( $_POST['OUT_DOC_UID'] );
$oStep = new Step(); $oStep = new Step();
$oStep->removeStep('OUTPUT_DOCUMENT', $_POST['OUT_DOC_UID']); $oStep->removeStep( 'OUTPUT_DOCUMENT', $_POST['OUT_DOC_UID'] );
$oOP = new ObjectPermission(); $oOP = new ObjectPermission();
$oOP->removeByObject('OUTPUT', $_POST['OUT_DOC_UID']); $oOP->removeByObject( 'OUTPUT', $_POST['OUT_DOC_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($fields['PRO_UID'] ); $oCriteria = $oMap->getOutputDocumentsCriteria( $fields['PRO_UID'] );
$result->success = true; $result->success = true;
$result->msg = G::LoadTranslation('ID_OUTPUTDOCUMENT_REMOVED'); $result->msg = G::LoadTranslation( 'ID_OUTPUTDOCUMENT_REMOVED' );
} } catch (Exception $e) {
catch (Exception $e) {
$result->success = false; $result->success = false;
$result->msg = $e->getMessage(); $result->msg = $e->getMessage();
//die($oException->getMessage()); //die($oException->getMessage());
} }
print G::json_encode($result); print G::json_encode( $result );
?>

View File

@@ -20,86 +20,84 @@
* *
* 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 {
else { $aFields = array ();
$aFields = array();
$aFields['PRO_UID'] = $_GET['PRO_UID']; $aFields['PRO_UID'] = $_GET['PRO_UID'];
} }
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 {
else { $aFields = array ();
$aFields = array();
$aFields['PRO_UID'] = $_GET['PRO_UID']; $aFields['PRO_UID'] = $_GET['PRO_UID'];
} }
$type = isset ( $aFields['OUT_DOC_TYPE']) ? $aFields['OUT_DOC_TYPE'] : 'HTML'; $type = isset( $aFields['OUT_DOC_TYPE'] ) ? $aFields['OUT_DOC_TYPE'] : 'HTML';
G::LoadClass('xmlfield_InputPM'); G::LoadClass( 'xmlfield_InputPM' );
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
switch ( $type ) { switch ($type) {
case 'HTML' : case 'HTML':
//$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Edit', '', $aFields , '../outputdocs/outputdocs_Save'); //$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Edit', '', $aFields , '../outputdocs/outputdocs_Save');
$oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->assign('OUT_DOC_UID', $_GET['OUT_DOC_UID']); $oHeadPublisher->assign( 'OUT_DOC_UID', $_GET['OUT_DOC_UID'] );
$translations = G::getTranslations(Array( $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') );
'ID_FILE', 'ID_OUT_PUT_DOC_UPLOAD_TITLE', 'ID_UPLOADING_FILE', 'ID_UPLOAD', 'ID_CANCEL', // $oHeadPublisher->assign('TRANSLATIONS', $translations);
'ID_SAVE', 'ID_LOAD_FROM_FILE', 'ID_SELECT_TEMPLATE_FILE', 'ID_ALERT_MESSAGE', 'ID_INVALID_FILE' $oHeadPublisher->addExtJsScript( 'outputdocs/htmlEditor', false ); //adding a javascript file .js
)); G::RenderPage( 'publish', 'extJs' );
// $oHeadPublisher->assign('TRANSLATIONS', $translations); die();
$oHeadPublisher->addExtJsScript('outputdocs/htmlEditor', false ); //adding a javascript file .js
G::RenderPage('publish', 'extJs');
die;
break; break;
case 'JRXML':
case 'JRXML' : break;
case 'ACROFORM' : case 'ACROFORM':
$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';
}
if ($type == 'ACROFORM') {
$extension = 'pdf';
}
// The ereg_replace function has been DEPRECATED as of PHP 5.3.0. // 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 = ereg_replace('[^A-Za-z0-9_]', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension;
$downFileName = preg_replace('/[^A-Za-z0-9_]/i', '_', $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 ; $filename = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension;
if ( file_exists ( $filename) ) if (file_exists( $filename )) {
$aFields['FILENAME'] = $downFileName; $aFields['FILENAME'] = $downFileName;
else } else {
$aFields['FILENAME'] = ''; $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

@@ -20,26 +20,23 @@
* *
* 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) return $RBAC_Response; 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';
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); $dbc = new DBConnection();
$ses = new DBSession( $dbc );
$G_MAIN_MENU = 'processmaker'; $G_PUBLISH = new Publisher();
$G_SUB_MENU = 'processes'; $Fields = array ('SYS_LANG' => SYS_LANG);
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'OUTPUTDOCS';
$dbc = new DBConnection(); $G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'outputdocs/outputdocs_List', '', $Fields, 'outputdocs_Save' );
$ses = new DBSession($dbc);
$G_PUBLISH = new Publisher; G::RenderPage( "publish" );
$Fields=array( 'SYS_LANG' => SYS_LANG,
);
$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'outputdocs/outputdocs_List', '', $Fields , 'outputdocs_Save');
G::RenderPage( "publish" );
?>

View File

@@ -20,66 +20,58 @@
* *
* 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 {
else { $aFields = array ();
$aFields = array();
$aFields['PRO_UID'] = $_GET['PRO_UID']; $aFields['PRO_UID'] = $_GET['PRO_UID'];
} }
$aFields['OUT_DOC_TYPE'] = 'HTML'; $aFields['OUT_DOC_TYPE'] = 'HTML';
$enabledJavaBridge = false; $enabledJavaBridge = false;
/** /**
* Temporally Disabled, because we are not using JRXML output doc type by now * Temporally Disabled, because we are not using JRXML output doc type by now
G::LoadClass ('javaBridgePM'); * G::LoadClass ('javaBridgePM');
if ( class_exists ( 'javaBridgePM' ) ) { * if ( class_exists ( 'javaBridgePM' ) ) {
$JBPM = new JavaBridgePM(); * $JBPM = new JavaBridgePM();
try { * try {
$JBPM->checkJavaExtension(); * $JBPM->checkJavaExtension();
$util = new Java("com.processmaker.util.pmutils"); * $util = new Java("com.processmaker.util.pmutils");
$enabledJavaBridge = true; * $enabledJavaBridge = true;
} catch ( Exception $e ) { * } catch ( Exception $e ) {
*
} * }
//$util->setInputPath( JAVATEST_PATH ); * //$util->setInputPath( JAVATEST_PATH );
//$util->setOutputPath( JAVATEST_PATH ); * //$util->setOutputPath( JAVATEST_PATH );
} * }
*/ */
G::LoadClass( 'xmlfield_InputPM' );
G::LoadClass('xmlfield_InputPM');
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
if ( ! $enabledJavaBridge ) { if (! $enabledJavaBridge) {
$xmlform = 'outputdocs/outputdocs_Properties'; $xmlform = 'outputdocs/outputdocs_Properties';
$G_PUBLISH->AddContent('xmlform', 'xmlform', $xmlform, '', $aFields , '../outputdocs/outputdocs_Save'); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, '../outputdocs/outputdocs_Save' );
} } else {
else {
$xmlform = 'outputdocs/outputdocs_New'; $xmlform = 'outputdocs/outputdocs_New';
$G_PUBLISH->AddContent('xmlform', 'xmlform', $xmlform, '', $aFields , '../outputdocs/outputdocs_Save'); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, '../outputdocs/outputdocs_Save' );
} }
G::RenderPage('publish', 'raw'); G::RenderPage( 'publish', 'raw' );
} } catch (Exception $oException) {
catch (Exception $oException) { die( $oException->getMessage() );
die($oException->getMessage());
} }

View File

@@ -21,55 +21,48 @@
* *
* 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 { } else {
$aFields = array(); $aFields = array ();
$aFields['PRO_UID'] = $_GET['PRO_UID']; $aFields['PRO_UID'] = $_GET['PRO_UID'];
} }
$type = isset( $aFields['OUT_DOC_TYPE'] ) ? $aFields['OUT_DOC_TYPE'] : 'HTML';
$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_TAGS'] = isset($aFields['OUT_DOC_TAGS']) ? $aFields['OUT_DOC_TAGS'] : 'OUTPUT'; $aFields['OUT_DOC_LANDSCAPE'] = strval( $aFields['OUT_DOC_LANDSCAPE'] );
$aFields['OUT_DOC_VERSIONING'] = strval($aFields['OUT_DOC_VERSIONING']); if (isset( $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] )) {
$aFields['OUT_DOC_LANDSCAPE'] = strval($aFields['OUT_DOC_LANDSCAPE']); $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] = strval( $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] );
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'] );
if (isset($aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']) && $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") { $aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::decrypt( $aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], $_GET['OUT_DOC_UID'] );
$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::LoadClass('xmlfield_InputPM');
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
switch ($type) { switch ($type) {
case 'HTML' : case 'HTML':
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save'); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' );
break; break;
case 'JRXML' : case 'JRXML':
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save'); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' );
/* /*
// $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsDynaformList', '', $aFields , '../outputdocs/outputdocs_Save'); // $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsDynaformList', '', $aFields , '../outputdocs/outputdocs_Save');
require_once 'classes/model/Process.php'; require_once 'classes/model/Process.php';
@@ -81,11 +74,12 @@ try {
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ShortList', $oProcessMap->getDynaformsCriteria($sProcessUID), $aFields); $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ShortList', $oProcessMap->getDynaformsCriteria($sProcessUID), $aFields);
*/ */
break; break;
case 'ACROFORM' : case 'ACROFORM':
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save'); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' );
break; break;
} }
G::RenderPage('publish', 'raw'); G::RenderPage( 'publish', 'raw' );
} catch (Exception $oException) { } catch (Exception $oException) {
die($oException->getMessage()); die( $oException->getMessage() );
} }

View File

@@ -21,71 +21,70 @@
* *
* 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

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