From f09f9d37f46fa36ee42d19b4e0c4f1ca5487db7d Mon Sep 17 00:00:00 2001 From: norahmollo Date: Wed, 17 Oct 2012 15:23:02 +0000 Subject: [PATCH] ODE STYLE Formating workflow/engine/methods/outpudocs/ Change format files in workflow/engine/methods/outpudocs/ --- .../methods/outputdocs/downloadFile.php | 40 ++-- .../methods/outputdocs/outputdocs_Ajax.php | 157 +++++++------ .../methods/outputdocs/outputdocs_Delete.php | 127 +++++------ .../methods/outputdocs/outputdocs_Edit.php | 206 +++++++++--------- .../methods/outputdocs/outputdocs_List.php | 87 ++++---- .../methods/outputdocs/outputdocs_New.php | 162 +++++++------- .../outputdocs/outputdocs_Properties.php | 174 +++++++-------- .../methods/outputdocs/outputdocs_Save.php | 179 ++++++++------- .../engine/methods/outputdocs/uploadFile.php | 51 ++--- 9 files changed, 579 insertions(+), 604 deletions(-) diff --git a/workflow/engine/methods/outputdocs/downloadFile.php b/workflow/engine/methods/outputdocs/downloadFile.php index f2424ff23..db76dbe8b 100755 --- a/workflow/engine/methods/outputdocs/downloadFile.php +++ b/workflow/engine/methods/outputdocs/downloadFile.php @@ -1,17 +1,23 @@ -load($uid); - $type = $aFields['OUT_DOC_TYPE']; - - if ( $type == 'JRXML') $extension = 'jrxml'; - if ( $type == 'ACROFORM') $extension = 'pdf'; - - $fileJrxml = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension ; - - $bDownload = true; - // The ereg_replace function has been DEPRECATED as of PHP 5.3.0. - // $downFileName = ereg_replace('[^A-Za-z0-9_]', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension; - $downFileName = preg_replace('/[^A-Za-z0-9_]/i', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension; - G::streamFile ( $fileJrxml, $bDownload, $downFileName ); +load( $uid ); +$type = $aFields['OUT_DOC_TYPE']; + +if ($type == 'JRXML') { + $extension = 'jrxml'; +} +if ($type == 'ACROFORM') { + $extension = 'pdf'; +} + +$fileJrxml = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension; + +$bDownload = true; +// The ereg_replace function has been DEPRECATED as of PHP 5.3.0. +// $downFileName = ereg_replace('[^A-Za-z0-9_]', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension; + +$downFileName = preg_replace( '/[^A-Za-z0-9_]/i', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension; +G::streamFile( $fileJrxml, $bDownload, $downFileName ); + diff --git a/workflow/engine/methods/outputdocs/outputdocs_Ajax.php b/workflow/engine/methods/outputdocs/outputdocs_Ajax.php index f243fbfdc..946876f28 100755 --- a/workflow/engine/methods/outputdocs/outputdocs_Ajax.php +++ b/workflow/engine/methods/outputdocs/outputdocs_Ajax.php @@ -1,83 +1,78 @@ -success = true; - $result->msg = 'success - saved '. $_SESSION['outpudocs_tmpFile']; - echo G::json_encode($result); - break; - - case 'getTemplateFile': - $aExtensions = array ( "exe", "com", "dll", "ocx", "fon", "ttf", "doc", "xls", "mdb", "rtf", "bin", - "jpeg", "jpg", "jif", "jfif", "gif", "tif", "tiff", "png", "bmp", "pdf", - "aac", "mp3", "mp3pro", "vorbis", "realaudio", "vqf", "wma", - "aiff", "flac", "wav", "midi", "mka", "ogg", "jpeg", "ilbm", - "tar", "zip", "rar", "arj", "gzip", "bzip2", "afio", "kgb", "gz", - "asf", "avi", "mov", "iff", "ogg", "ogm", "mkv", "3gp", - ); - $sFileName = strtolower($_SESSION['outpudocs_tmpFile']); - $strRev = strrev($sFileName); - $searchPos = strpos($strRev, '.'); - $pos = (strlen($sFileName) - 1) - $searchPos; - $sExtension = substr($sFileName, $pos+1, strlen($sFileName)); - if(! in_array($sExtension, $aExtensions)) - echo $content = file_get_contents($_SESSION['outpudocs_tmpFile']); - break; - - case 'loadTemplateContent': - require_once 'classes/model/OutputDocument.php'; - $ooutputDocument = new OutputDocument(); - if (isset($_POST['OUT_DOC_UID'])) { - $aFields = $ooutputDocument->load($_POST['OUT_DOC_UID']); - - echo $aFields['OUT_DOC_TEMPLATE']; - } - break; - - case 'lookForNameOutput': - require_once('classes/model/Content.php'); - require_once ( "classes/model/OutputDocument.php" ); - - $snameInput = urldecode($_POST['NAMEOUTPUT']); - $sPRO_UID = urldecode($_POST['proUid']); - - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_UID); - $oCriteria->add(OutputDocumentPeer::PRO_UID, $sPRO_UID); - $oDataset = OutputDocumentPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $flag = true; - while ($oDataset->next() && $flag) { - $aRow = $oDataset->getRow(); - - $oCriteria1 = new Criteria('workflow'); - $oCriteria1->addSelectColumn('COUNT(*) AS OUTPUTS'); - $oCriteria1->add(ContentPeer::CON_CATEGORY, 'OUT_DOC_TITLE'); - $oCriteria1->add(ContentPeer::CON_ID, $aRow['OUT_DOC_UID']); - $oCriteria1->add(ContentPeer::CON_VALUE, $snameInput); - $oCriteria1->add(ContentPeer::CON_LANG, SYS_LANG); - $oDataset1 = ContentPeer::doSelectRS($oCriteria1); - $oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset1->next(); - $aRow1 = $oDataset1->getRow(); - - if ($aRow1['OUTPUTS']) - $flag = false; - } - echo $flag; - // G::json_encode($flag); - break; +if ($action == '') { + $action = isset( $_POST['function'] ) ? $_POST['function'] : ''; +} + +switch ($action) { + case 'setTemplateFile': + //print_r($_FILES); + $_SESSION['outpudocs_tmpFile'] = PATH_DATA . $_FILES['templateFile']['name']; + // file_put_contents($_FILES['templateFile']['name'], file_get_contents($_FILES['templateFile']['tmp_name'])); + copy( $_FILES['templateFile']['tmp_name'], $_SESSION['outpudocs_tmpFile'] ); + $result = new stdClass(); + + $result->success = true; + $result->msg = 'success - saved ' . $_SESSION['outpudocs_tmpFile']; + echo G::json_encode( $result ); + break; + + case 'getTemplateFile': + $aExtensions = array ("exe","com","dll","ocx","fon","ttf","doc","xls","mdb","rtf","bin","jpeg","jpg","jif","jfif","gif","tif","tiff","png","bmp","pdf","aac","mp3","mp3pro","vorbis","realaudio","vqf","wma","aiff","flac","wav","midi","mka","ogg","jpeg","ilbm","tar","zip","rar","arj","gzip","bzip2","afio","kgb","gz","asf","avi","mov","iff","ogg","ogm","mkv","3gp" + ); + $sFileName = strtolower( $_SESSION['outpudocs_tmpFile'] ); + $strRev = strrev( $sFileName ); + $searchPos = strpos( $strRev, '.' ); + $pos = (strlen( $sFileName ) - 1) - $searchPos; + $sExtension = substr( $sFileName, $pos + 1, strlen( $sFileName ) ); + if (! in_array( $sExtension, $aExtensions )) + echo $content = file_get_contents( $_SESSION['outpudocs_tmpFile'] ); + break; + + case 'loadTemplateContent': + require_once 'classes/model/OutputDocument.php'; + $ooutputDocument = new OutputDocument(); + if (isset( $_POST['OUT_DOC_UID'] )) { + $aFields = $ooutputDocument->load( $_POST['OUT_DOC_UID'] ); + + echo $aFields['OUT_DOC_TEMPLATE']; + } + break; + + case 'lookForNameOutput': + require_once ('classes/model/Content.php'); + require_once ("classes/model/OutputDocument.php"); + + $snameInput = urldecode( $_POST['NAMEOUTPUT'] ); + $sPRO_UID = urldecode( $_POST['proUid'] ); + + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( OutputDocumentPeer::OUT_DOC_UID ); + $oCriteria->add( OutputDocumentPeer::PRO_UID, $sPRO_UID ); + $oDataset = OutputDocumentPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $flag = true; + while ($oDataset->next() && $flag) { + $aRow = $oDataset->getRow(); + + $oCriteria1 = new Criteria( 'workflow' ); + $oCriteria1->addSelectColumn( 'COUNT(*) AS OUTPUTS' ); + $oCriteria1->add( ContentPeer::CON_CATEGORY, 'OUT_DOC_TITLE' ); + $oCriteria1->add( ContentPeer::CON_ID, $aRow['OUT_DOC_UID'] ); + $oCriteria1->add( ContentPeer::CON_VALUE, $snameInput ); + $oCriteria1->add( ContentPeer::CON_LANG, SYS_LANG ); + $oDataset1 = ContentPeer::doSelectRS( $oCriteria1 ); + $oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset1->next(); + $aRow1 = $oDataset1->getRow(); + + if ($aRow1['OUTPUTS']) + $flag = false; + } + echo $flag; + // G::json_encode($flag); + break; } diff --git a/workflow/engine/methods/outputdocs/outputdocs_Delete.php b/workflow/engine/methods/outputdocs/outputdocs_Delete.php index d443262dc..b1b12f2b0 100755 --- a/workflow/engine/methods/outputdocs/outputdocs_Delete.php +++ b/workflow/engine/methods/outputdocs/outputdocs_Delete.php @@ -1,67 +1,60 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - global $RBAC; - switch ($RBAC->userCanAccess('PM_FACTORY')) { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - require_once 'classes/model/OutputDocument.php'; - require_once 'classes/model/ObjectPermission.php'; - require_once 'classes/model/Step.php'; - G::LoadClass( 'processMap' ); - - $oOutputDocument = new OutputDocument(); - $fields = $oOutputDocument->load($_POST['OUT_DOC_UID']); - $oOutputDocument->remove($_POST['OUT_DOC_UID']); - - $oStep = new Step(); - $oStep->removeStep('OUTPUT_DOCUMENT', $_POST['OUT_DOC_UID']); - - $oOP = new ObjectPermission(); - $oOP->removeByObject('OUTPUT', $_POST['OUT_DOC_UID']); - - //refresh dbarray with the last change in outputDocument - $oMap = new processMap(); - $oCriteria = $oMap->getOutputDocumentsCriteria($fields['PRO_UID'] ); - - $result->success = true; - $result->msg = G::LoadTranslation('ID_OUTPUTDOCUMENT_REMOVED'); -} -catch (Exception $e) { - $result->success = false; - $result->msg = $e->getMessage(); - //die($oException->getMessage()); -} -print G::json_encode($result); -?> \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + global $RBAC; + switch ($RBAC->userCanAccess( 'PM_FACTORY' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } + require_once 'classes/model/OutputDocument.php'; + require_once 'classes/model/ObjectPermission.php'; + require_once 'classes/model/Step.php'; + G::LoadClass( 'processMap' ); + $oOutputDocument = new OutputDocument(); + $fields = $oOutputDocument->load( $_POST['OUT_DOC_UID'] ); + $oOutputDocument->remove( $_POST['OUT_DOC_UID'] ); + $oStep = new Step(); + $oStep->removeStep( 'OUTPUT_DOCUMENT', $_POST['OUT_DOC_UID'] ); + $oOP = new ObjectPermission(); + $oOP->removeByObject( 'OUTPUT', $_POST['OUT_DOC_UID'] ); + //refresh dbarray with the last change in outputDocument + $oMap = new processMap(); + $oCriteria = $oMap->getOutputDocumentsCriteria( $fields['PRO_UID'] ); + $result->success = true; + $result->msg = G::LoadTranslation( 'ID_OUTPUTDOCUMENT_REMOVED' ); +} catch (Exception $e) { + $result->success = false; + $result->msg = $e->getMessage(); + //die($oException->getMessage()); +} +print G::json_encode( $result ); + diff --git a/workflow/engine/methods/outputdocs/outputdocs_Edit.php b/workflow/engine/methods/outputdocs/outputdocs_Edit.php index b64261e11..d4d405373 100755 --- a/workflow/engine/methods/outputdocs/outputdocs_Edit.php +++ b/workflow/engine/methods/outputdocs/outputdocs_Edit.php @@ -1,105 +1,103 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - global $RBAC; - switch ($RBAC->userCanAccess('PM_FACTORY')) { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - - require_once 'classes/model/OutputDocument.php'; - $ooutputDocument = new OutputDocument(); - if (isset($_GET['OUT_DOC_UID'])) { - $aFields = $ooutputDocument->load($_GET['OUT_DOC_UID']); - } - else { - $aFields = array(); - $aFields['PRO_UID'] = $_GET['PRO_UID']; - } - - require_once 'classes/model/OutputDocument.php'; - $ooutputDocument = new OutputDocument(); - if (isset($_GET['OUT_DOC_UID'])) { - $aFields = $ooutputDocument->load($_GET['OUT_DOC_UID']); - } - else { - $aFields = array(); - $aFields['PRO_UID'] = $_GET['PRO_UID']; - } - - $type = isset ( $aFields['OUT_DOC_TYPE']) ? $aFields['OUT_DOC_TYPE'] : 'HTML'; - - G::LoadClass('xmlfield_InputPM'); - $G_PUBLISH = new Publisher(); - - switch ( $type ) { - case 'HTML' : - //$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Edit', '', $aFields , '../outputdocs/outputdocs_Save'); - $oHeadPublisher =& headPublisher::getSingleton(); - $oHeadPublisher->assign('OUT_DOC_UID', $_GET['OUT_DOC_UID']); - $translations = G::getTranslations(Array( - 'ID_FILE', 'ID_OUT_PUT_DOC_UPLOAD_TITLE', 'ID_UPLOADING_FILE', 'ID_UPLOAD', 'ID_CANCEL', - 'ID_SAVE', 'ID_LOAD_FROM_FILE', 'ID_SELECT_TEMPLATE_FILE', 'ID_ALERT_MESSAGE', 'ID_INVALID_FILE' - )); -// $oHeadPublisher->assign('TRANSLATIONS', $translations); - $oHeadPublisher->addExtJsScript('outputdocs/htmlEditor', false ); //adding a javascript file .js - G::RenderPage('publish', 'extJs'); - die; - break; - - case 'JRXML' : - case 'ACROFORM' : - $type = $aFields['OUT_DOC_TYPE']; - if ( $type == 'JRXML') $extension = 'jrxml'; - if ( $type == 'ACROFORM') $extension = 'pdf'; - - // The ereg_replace function has been DEPRECATED as of PHP 5.3.0. - // $downFileName = ereg_replace('[^A-Za-z0-9_]', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension; - $downFileName = preg_replace('/[^A-Za-z0-9_]/i', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension; - $filename = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension ; - if ( file_exists ( $filename) ) - $aFields['FILENAME'] = $downFileName; - else - $aFields['FILENAME'] = ''; - - $aFields['FILELINK'] = '../outputdocs/downloadFile?' . $aFields['OUT_DOC_UID']; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsUploadFile', '', $aFields , '../outputdocs/uploadFile'); - $G_PUBLISH->AddContent('view', 'outputdocs/editJrxml' ); - break; - } - G::RenderPage('publish', 'raw'); - -} -catch (Exception $oException) { - die($oException->getMessage()); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + global $RBAC; + switch ($RBAC->userCanAccess( 'PM_FACTORY' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } + + require_once 'classes/model/OutputDocument.php'; + $ooutputDocument = new OutputDocument(); + if (isset( $_GET['OUT_DOC_UID'] )) { + $aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] ); + } else { + $aFields = array (); + $aFields['PRO_UID'] = $_GET['PRO_UID']; + } + + require_once 'classes/model/OutputDocument.php'; + $ooutputDocument = new OutputDocument(); + if (isset( $_GET['OUT_DOC_UID'] )) { + $aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] ); + } else { + $aFields = array (); + $aFields['PRO_UID'] = $_GET['PRO_UID']; + } + + $type = isset( $aFields['OUT_DOC_TYPE'] ) ? $aFields['OUT_DOC_TYPE'] : 'HTML'; + + G::LoadClass( 'xmlfield_InputPM' ); + $G_PUBLISH = new Publisher(); + + switch ($type) { + case 'HTML': + //$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Edit', '', $aFields , '../outputdocs/outputdocs_Save'); + $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher->assign( 'OUT_DOC_UID', $_GET['OUT_DOC_UID'] ); + $translations = G::getTranslations( Array ('ID_FILE','ID_OUT_PUT_DOC_UPLOAD_TITLE','ID_UPLOADING_FILE','ID_UPLOAD','ID_CANCEL','ID_SAVE','ID_LOAD_FROM_FILE','ID_SELECT_TEMPLATE_FILE','ID_ALERT_MESSAGE','ID_INVALID_FILE') ); + // $oHeadPublisher->assign('TRANSLATIONS', $translations); + $oHeadPublisher->addExtJsScript( 'outputdocs/htmlEditor', false ); //adding a javascript file .js + G::RenderPage( 'publish', 'extJs' ); + die(); + break; + case 'JRXML': + break; + case 'ACROFORM': + $type = $aFields['OUT_DOC_TYPE']; + if ($type == 'JRXML') { + $extension = 'jrxml'; + } + if ($type == 'ACROFORM') { + $extension = 'pdf'; + } + + // The ereg_replace function has been DEPRECATED as of PHP 5.3.0. + // $downFileName = ereg_replace('[^A-Za-z0-9_]', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension; + $downFileName = preg_replace( '/[^A-Za-z0-9_]/i', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension; + $filename = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension; + if (file_exists( $filename )) { + $aFields['FILENAME'] = $downFileName; + } else { + $aFields['FILENAME'] = ''; + } + + $aFields['FILELINK'] = '../outputdocs/downloadFile?' . $aFields['OUT_DOC_UID']; + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocsUploadFile', '', $aFields, '../outputdocs/uploadFile' ); + $G_PUBLISH->AddContent( 'view', 'outputdocs/editJrxml' ); + break; + } + G::RenderPage( 'publish', 'raw' ); +} catch (Exception $oException) { + die( $oException->getMessage() ); } + diff --git a/workflow/engine/methods/outputdocs/outputdocs_List.php b/workflow/engine/methods/outputdocs/outputdocs_List.php index d5265a3c3..06eb567bd 100755 --- a/workflow/engine/methods/outputdocs/outputdocs_List.php +++ b/workflow/engine/methods/outputdocs/outputdocs_List.php @@ -1,45 +1,42 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; - - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'processes'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_ID_SUB_MENU_SELECTED = 'OUTPUTDOCS'; - - $dbc = new DBConnection(); - $ses = new DBSession($dbc); - - $G_PUBLISH = new Publisher; - $Fields=array( 'SYS_LANG' => SYS_LANG, - ); - - $G_PUBLISH->AddContent('pagedtable', 'paged-table', 'outputdocs/outputdocs_List', '', $Fields , 'outputdocs_Save'); - - G::RenderPage( "publish" ); - -?> \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} +//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'processes'; +$G_ID_MENU_SELECTED = 'PROCESSES'; +$G_ID_SUB_MENU_SELECTED = 'OUTPUTDOCS'; + +$dbc = new DBConnection(); +$ses = new DBSession( $dbc ); + +$G_PUBLISH = new Publisher(); +$Fields = array ('SYS_LANG' => SYS_LANG); + +$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'outputdocs/outputdocs_List', '', $Fields, 'outputdocs_Save' ); + +G::RenderPage( "publish" ); + diff --git a/workflow/engine/methods/outputdocs/outputdocs_New.php b/workflow/engine/methods/outputdocs/outputdocs_New.php index a7a357fb0..bd41b19ba 100755 --- a/workflow/engine/methods/outputdocs/outputdocs_New.php +++ b/workflow/engine/methods/outputdocs/outputdocs_New.php @@ -1,85 +1,77 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - global $RBAC; - switch ($RBAC->userCanAccess('PM_FACTORY')) { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - require_once 'classes/model/OutputDocument.php'; - $ooutputDocument = new OutputDocument(); - if (isset($_GET['OUT_DOC_UID'])) { - $aFields = $ooutputDocument->load($_GET['OUT_DOC_UID']); - } - else { - $aFields = array(); - $aFields['PRO_UID'] = $_GET['PRO_UID']; - } - $aFields['OUT_DOC_TYPE'] = 'HTML'; - - - $enabledJavaBridge = false; - - /** - * Temporally Disabled, because we are not using JRXML output doc type by now - G::LoadClass ('javaBridgePM'); - if ( class_exists ( 'javaBridgePM' ) ) { - $JBPM = new JavaBridgePM(); - try { - $JBPM->checkJavaExtension(); - $util = new Java("com.processmaker.util.pmutils"); - $enabledJavaBridge = true; - } catch ( Exception $e ) { - - } - //$util->setInputPath( JAVATEST_PATH ); - //$util->setOutputPath( JAVATEST_PATH ); - } - */ - - - G::LoadClass('xmlfield_InputPM'); - $G_PUBLISH = new Publisher(); - if ( ! $enabledJavaBridge ) { - $xmlform = 'outputdocs/outputdocs_Properties'; - $G_PUBLISH->AddContent('xmlform', 'xmlform', $xmlform, '', $aFields , '../outputdocs/outputdocs_Save'); - } - else { - $xmlform = 'outputdocs/outputdocs_New'; - $G_PUBLISH->AddContent('xmlform', 'xmlform', $xmlform, '', $aFields , '../outputdocs/outputdocs_Save'); - } - G::RenderPage('publish', 'raw'); -} -catch (Exception $oException) { - die($oException->getMessage()); -} +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + global $RBAC; + switch ($RBAC->userCanAccess( 'PM_FACTORY' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } + require_once 'classes/model/OutputDocument.php'; + $ooutputDocument = new OutputDocument(); + if (isset( $_GET['OUT_DOC_UID'] )) { + $aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] ); + } else { + $aFields = array (); + $aFields['PRO_UID'] = $_GET['PRO_UID']; + } + $aFields['OUT_DOC_TYPE'] = 'HTML'; + $enabledJavaBridge = false; + /** + * Temporally Disabled, because we are not using JRXML output doc type by now + * G::LoadClass ('javaBridgePM'); + * if ( class_exists ( 'javaBridgePM' ) ) { + * $JBPM = new JavaBridgePM(); + * try { + * $JBPM->checkJavaExtension(); + * $util = new Java("com.processmaker.util.pmutils"); + * $enabledJavaBridge = true; + * } catch ( Exception $e ) { + * + * } + * //$util->setInputPath( JAVATEST_PATH ); + * //$util->setOutputPath( JAVATEST_PATH ); + * } + */ + G::LoadClass( 'xmlfield_InputPM' ); + $G_PUBLISH = new Publisher(); + if (! $enabledJavaBridge) { + $xmlform = 'outputdocs/outputdocs_Properties'; + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, '../outputdocs/outputdocs_Save' ); + } else { + $xmlform = 'outputdocs/outputdocs_New'; + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, '../outputdocs/outputdocs_Save' ); + } + G::RenderPage( 'publish', 'raw' ); +} catch (Exception $oException) { + die( $oException->getMessage() ); +} + diff --git a/workflow/engine/methods/outputdocs/outputdocs_Properties.php b/workflow/engine/methods/outputdocs/outputdocs_Properties.php index 30b0c833f..fdedfffab 100755 --- a/workflow/engine/methods/outputdocs/outputdocs_Properties.php +++ b/workflow/engine/methods/outputdocs/outputdocs_Properties.php @@ -1,91 +1,85 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - global $RBAC; - switch ($RBAC->userCanAccess('PM_FACTORY')) { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - - require_once 'classes/model/OutputDocument.php'; - $ooutputDocument = new OutputDocument(); - if (isset($_GET['OUT_DOC_UID'])) { - $aFields = $ooutputDocument->load($_GET['OUT_DOC_UID']); - } else { - $aFields = array(); - $aFields['PRO_UID'] = $_GET['PRO_UID']; - } - - $type = isset($aFields['OUT_DOC_TYPE']) ? $aFields['OUT_DOC_TYPE'] : 'HTML'; - - $aFields['OUT_DOC_TAGS'] = isset($aFields['OUT_DOC_TAGS']) ? $aFields['OUT_DOC_TAGS'] : 'OUTPUT'; - $aFields['OUT_DOC_VERSIONING'] = strval($aFields['OUT_DOC_VERSIONING']); - $aFields['OUT_DOC_LANDSCAPE'] = strval($aFields['OUT_DOC_LANDSCAPE']); - if(isset($aFields['OUT_DOC_PDF_SECURITY_ENABLED'])){ - $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] = strval($aFields['OUT_DOC_PDF_SECURITY_ENABLED']); - } - - - if (isset($aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']) && $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") { - $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = G::decrypt($aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'], $_GET['OUT_DOC_UID']); - $aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::decrypt($aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], $_GET['OUT_DOC_UID']); - } - - G::LoadClass('xmlfield_InputPM'); - $G_PUBLISH = new Publisher(); - switch ($type) { - case 'HTML' : - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save'); - break; - case 'JRXML' : - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save'); - /* - // $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsDynaformList', '', $aFields , '../outputdocs/outputdocs_Save'); - require_once 'classes/model/Process.php'; - G::LoadClass( 'processMap'); - $sProcessUID = $aFields['PRO_UID']; - $oProcess = new Process(); - $oProcessMap = new ProcessMap(); - $aFields = $oProcess->load($sProcessUID); - $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ShortList', $oProcessMap->getDynaformsCriteria($sProcessUID), $aFields); - */ - break; - case 'ACROFORM' : - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save'); - break; - } - G::RenderPage('publish', 'raw'); -} catch (Exception $oException) { - die($oException->getMessage()); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + global $RBAC; + switch ($RBAC->userCanAccess( 'PM_FACTORY' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } + require_once 'classes/model/OutputDocument.php'; + $ooutputDocument = new OutputDocument(); + if (isset( $_GET['OUT_DOC_UID'] )) { + $aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] ); + } else { + $aFields = array (); + $aFields['PRO_UID'] = $_GET['PRO_UID']; + } + $type = isset( $aFields['OUT_DOC_TYPE'] ) ? $aFields['OUT_DOC_TYPE'] : 'HTML'; + $aFields['OUT_DOC_TAGS'] = isset( $aFields['OUT_DOC_TAGS'] ) ? $aFields['OUT_DOC_TAGS'] : 'OUTPUT'; + $aFields['OUT_DOC_VERSIONING'] = strval( $aFields['OUT_DOC_VERSIONING'] ); + $aFields['OUT_DOC_LANDSCAPE'] = strval( $aFields['OUT_DOC_LANDSCAPE'] ); + if (isset( $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] )) { + $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] = strval( $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] ); + } + if (isset( $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] ) && $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") { + $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = G::decrypt( $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'], $_GET['OUT_DOC_UID'] ); + $aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::decrypt( $aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], $_GET['OUT_DOC_UID'] ); + } + G::LoadClass( 'xmlfield_InputPM' ); + $G_PUBLISH = new Publisher(); + switch ($type) { + case 'HTML': + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' ); + break; + case 'JRXML': + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' ); + /* + // $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsDynaformList', '', $aFields , '../outputdocs/outputdocs_Save'); + require_once 'classes/model/Process.php'; + G::LoadClass( 'processMap'); + $sProcessUID = $aFields['PRO_UID']; + $oProcess = new Process(); + $oProcessMap = new ProcessMap(); + $aFields = $oProcess->load($sProcessUID); + $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ShortList', $oProcessMap->getDynaformsCriteria($sProcessUID), $aFields); + */ + break; + case 'ACROFORM': + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' ); + break; + } + G::RenderPage( 'publish', 'raw' ); +} catch (Exception $oException) { + die( $oException->getMessage() ); } + diff --git a/workflow/engine/methods/outputdocs/outputdocs_Save.php b/workflow/engine/methods/outputdocs/outputdocs_Save.php index af6c15a11..984f4e228 100755 --- a/workflow/engine/methods/outputdocs/outputdocs_Save.php +++ b/workflow/engine/methods/outputdocs/outputdocs_Save.php @@ -1,91 +1,90 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - global $RBAC; - switch ($RBAC->userCanAccess('PM_FACTORY')) { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - - //default: - - require_once 'classes/model/OutputDocument.php'; - G::LoadClass('processMap'); - - $oOutputDocument = new OutputDocument(); - - - if (isset($_POST['form'])) - $aData = $_POST['form']; //For old process map form - else - $aData = $_POST; //For Extjs (Since we are not using form in ExtJS) - - - if(isset($aData['OUT_DOC_TITLE']) && $aData['OUT_DOC_TITLE']!=''){ - $oForm = new Form('outputdocs/outputdocs_Properties', PATH_XMLFORM); - $aData = $oForm->validatePost(); - if(isset($aData['OUT_DOC_PDF_SECURITY_ENABLED'])&&$aData['OUT_DOC_PDF_SECURITY_ENABLED']=="0"){ - $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] =""; - $aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] =""; - $aData['OUT_DOC_PDF_SECURITY_PERMISSIONS'] =""; - } - if(isset($aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'])&&$aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']!=""){ - $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = G::encrypt($aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'],$aData['OUT_DOC_UID']); - $aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::encrypt($aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'],$aData['OUT_DOC_UID']); - } - } - if ($aData['OUT_DOC_UID'] == '') { - - if ((isset($aData['OUT_DOC_TYPE'])) && ( $aData['OUT_DOC_TYPE'] == 'JRXML' )) { - $dynaformUid = $aData['DYN_UID']; - $outDocUid = $oOutputDocument->create($aData); - G::LoadClass('javaBridgePM'); - $jbpm = new JavaBridgePM (); - print $jbpm->generateJrxmlFromDynaform($outDocUid, $dynaformUid, 'classic'); - } else { - $outDocUid = $oOutputDocument->create($aData); - } - } else { - $oOutputDocument->update($aData); - } - - if (isset($aData['PRO_UID'])) { - //refresh dbarray with the last change in outputDocument - $oMap = new processMap(); - $oCriteria = $oMap->getOutputDocumentsCriteria($aData['PRO_UID']); - } - -} catch (Exception $oException) { - die($oException->getMessage()); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + global $RBAC; + switch ($RBAC->userCanAccess( 'PM_FACTORY' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } + + //default: + + + require_once 'classes/model/OutputDocument.php'; + G::LoadClass( 'processMap' ); + + $oOutputDocument = new OutputDocument(); + + if (isset( $_POST['form'] )) + $aData = $_POST['form']; //For old process map form + else + $aData = $_POST; //For Extjs (Since we are not using form in ExtJS) + + + if (isset( $aData['OUT_DOC_TITLE'] ) && $aData['OUT_DOC_TITLE'] != '') { + $oForm = new Form( 'outputdocs/outputdocs_Properties', PATH_XMLFORM ); + $aData = $oForm->validatePost(); + if (isset( $aData['OUT_DOC_PDF_SECURITY_ENABLED'] ) && $aData['OUT_DOC_PDF_SECURITY_ENABLED'] == "0") { + $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = ""; + $aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = ""; + $aData['OUT_DOC_PDF_SECURITY_PERMISSIONS'] = ""; + } + if (isset( $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] ) && $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") { + $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = G::encrypt( $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'], $aData['OUT_DOC_UID'] ); + $aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::encrypt( $aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], $aData['OUT_DOC_UID'] ); + } + } + if ($aData['OUT_DOC_UID'] == '') { + + if ((isset( $aData['OUT_DOC_TYPE'] )) && ($aData['OUT_DOC_TYPE'] == 'JRXML')) { + $dynaformUid = $aData['DYN_UID']; + $outDocUid = $oOutputDocument->create( $aData ); + G::LoadClass( 'javaBridgePM' ); + $jbpm = new JavaBridgePM(); + print $jbpm->generateJrxmlFromDynaform( $outDocUid, $dynaformUid, 'classic' ); + } else { + $outDocUid = $oOutputDocument->create( $aData ); + } + } else { + $oOutputDocument->update( $aData ); + } + + if (isset( $aData['PRO_UID'] )) { + //refresh dbarray with the last change in outputDocument + $oMap = new processMap(); + $oCriteria = $oMap->getOutputDocumentsCriteria( $aData['PRO_UID'] ); + } + +} catch (Exception $oException) { + die( $oException->getMessage() ); } diff --git a/workflow/engine/methods/outputdocs/uploadFile.php b/workflow/engine/methods/outputdocs/uploadFile.php index 0a43144a2..3f81a84c6 100755 --- a/workflow/engine/methods/outputdocs/uploadFile.php +++ b/workflow/engine/methods/outputdocs/uploadFile.php @@ -1,32 +1,33 @@ load( $uid ); + $type = $aFields['OUT_DOC_TYPE']; - $uid = $_POST['form']['OUT_DOC_UID']; - $oOutputDocument = new OutputDocument(); - $aFields = $oOutputDocument->load($uid); - $type = $aFields['OUT_DOC_TYPE']; - - $aExtension = explode ('.', strtolower(basename( $_FILES['form']['name']['OUT_DOC_FILE'] ))); - $extension = $aExtension[ count($aExtension) -1 ]; - if ( $extension != 'jrxml' && $type == 'JRXML') - throw ( new Exception ( "'$extension' is not a valid extension, you must upload a .jrxml file." ) ); + $aExtension = explode( '.', strtolower( basename( $_FILES['form']['name']['OUT_DOC_FILE'] ) ) ); + $extension = $aExtension[count( $aExtension ) - 1]; + if ($extension != 'jrxml' && $type == 'JRXML') { + throw (new Exception( "'$extension' is not a valid extension, you must upload a .jrxml file." )); + } - if ( $extension != 'pdf' && $type == 'ACROFORM') - throw ( new Exception ( "'$extension' is not a valid extension, you must upload a .pdf file." ) ); + if ($extension != 'pdf' && $type == 'ACROFORM') { + throw (new Exception( "'$extension' is not a valid extension, you must upload a .pdf file." )); + } + $fileJrxml = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension; + if (! empty( $_FILES['form'] )) { + if ($_FILES['form']['error']['OUT_DOC_FILE'] == 0) { + G::uploadFile( $_FILES['form']['tmp_name']['OUT_DOC_FILE'], dirname( $fileJrxml ), basename( $fileJrxml ) ); + } + } + print "File uploaded."; - $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 "File uploaded."; +} catch (Exception $e) { + print "Error: " . $e->getMessage() . ""; +} -} -catch ( Exception $e ) { - print "Error: " . $e->getMessage() . ""; -} \ No newline at end of file