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

@@ -5,13 +5,19 @@
$aFields = $oOutputDocument->load( $uid );
$type = $aFields['OUT_DOC_TYPE'];
if ( $type == 'JRXML') $extension = 'jrxml';
if ( $type == 'ACROFORM') $extension = 'pdf';
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 );

View File

@@ -21,12 +21,7 @@ switch($action){
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",
$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 );

View File

@@ -20,7 +20,6 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
global $RBAC;
@@ -28,40 +27,34 @@ try {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
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) {
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
//die($oException->getMessage());
}
print G::json_encode( $result );
?>

View File

@@ -20,7 +20,6 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
global $RBAC;
@@ -28,12 +27,12 @@ try {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
break;
}
@@ -41,8 +40,7 @@ try {
$ooutputDocument = new OutputDocument();
if (isset( $_GET['OUT_DOC_UID'] )) {
$aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] );
}
else {
} else {
$aFields = array ();
$aFields['PRO_UID'] = $_GET['PRO_UID'];
}
@@ -51,8 +49,7 @@ try {
$ooutputDocument = new OutputDocument();
if (isset( $_GET['OUT_DOC_UID'] )) {
$aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] );
}
else {
} else {
$aFields = array ();
$aFields['PRO_UID'] = $_GET['PRO_UID'];
}
@@ -67,30 +64,32 @@ try {
//$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'
));
$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;
die();
break;
case 'JRXML':
break;
case 'ACROFORM':
$type = $aFields['OUT_DOC_TYPE'];
if ( $type == 'JRXML') $extension = 'jrxml';
if ( $type == 'ACROFORM') $extension = 'pdf';
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) )
if (file_exists( $filename )) {
$aFields['FILENAME'] = $downFileName;
else
} else {
$aFields['FILENAME'] = '';
}
$aFields['FILELINK'] = '../outputdocs/downloadFile?' . $aFields['OUT_DOC_UID'];
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocsUploadFile', '', $aFields, '../outputdocs/uploadFile' );
@@ -98,8 +97,7 @@ try {
break;
}
G::RenderPage( 'publish', 'raw' );
}
catch (Exception $oException) {
} catch (Exception $oException) {
die( $oException->getMessage() );
}

View File

@@ -20,12 +20,11 @@
*
* 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;
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';
@@ -34,12 +33,10 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
$G_PUBLISH = new Publisher;
$Fields=array( 'SYS_LANG' => SYS_LANG,
);
$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" );
?>

View File

@@ -20,7 +20,6 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
global $RBAC;
@@ -28,58 +27,51 @@ try {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
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 {
} 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 ('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 {
} else {
$xmlform = 'outputdocs/outputdocs_New';
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, '../outputdocs/outputdocs_Save' );
}
G::RenderPage( 'publish', 'raw' );
}
catch (Exception $oException) {
} catch (Exception $oException) {
die( $oException->getMessage() );
}

View File

@@ -21,7 +21,6 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
global $RBAC;
@@ -29,15 +28,14 @@ try {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
break;
}
require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
if (isset( $_GET['OUT_DOC_UID'] )) {
@@ -46,22 +44,17 @@ try {
$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) {
@@ -89,3 +82,4 @@ try {
} catch (Exception $oException) {
die( $oException->getMessage() );
}

View File

@@ -21,7 +21,6 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
global $RBAC;
@@ -29,23 +28,23 @@ try {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
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

View File

@@ -2,9 +2,9 @@
try {
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.' ));
}
$uid = $_POST['form']['OUT_DOC_UID'];
$oOutputDocument = new OutputDocument();
$aFields = $oOutputDocument->load( $uid );
@@ -12,12 +12,13 @@ try {
$aExtension = explode( '.', strtolower( basename( $_FILES['form']['name']['OUT_DOC_FILE'] ) ) );
$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." ));
}
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." ));
}
$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) {
@@ -26,7 +27,7 @@ try {
}
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>";
}