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
require_once 'classes/model/OutputDocument.php';
$uid = $_SERVER['QUERY_STRING'];
$oOutputDocument = new OutputDocument();
$aFields = $oOutputDocument->load($uid);
$type = $aFields['OUT_DOC_TYPE'];
require_once 'classes/model/OutputDocument.php';
$uid = $_SERVER['QUERY_STRING'];
$oOutputDocument = new OutputDocument();
$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 ;
$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,83 +1,78 @@
<?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.
if($action=='') {
$action = isset($_POST['function'])?$_POST['function']:'';
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();
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;
$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 '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']);
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;
echo $aFields['OUT_DOC_TEMPLATE'];
}
break;
case 'lookForNameOutput':
require_once('classes/model/Content.php');
require_once ( "classes/model/OutputDocument.php" );
case 'lookForNameOutput':
require_once ('classes/model/Content.php');
require_once ("classes/model/OutputDocument.php");
$snameInput = urldecode($_POST['NAMEOUTPUT']);
$sPRO_UID = urldecode($_POST['proUid']);
$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();
$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();
$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 ($aRow1['OUTPUTS'])
$flag = false;
}
echo $flag;
// G::json_encode($flag);
break;
}

View File

@@ -12,56 +12,49 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
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');
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());
}
catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
//die($oException->getMessage());
}
print G::json_encode($result);
?>
print G::json_encode( $result );

View File

@@ -12,94 +12,92 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
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;
}
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'];
}
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';
$type = isset( $aFields['OUT_DOC_TYPE'] ) ? $aFields['OUT_DOC_TYPE'] : 'HTML';
G::LoadClass('xmlfield_InputPM');
$G_PUBLISH = new Publisher();
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;
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';
}
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');
// 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() );
}
catch (Exception $oException) {
die($oException->getMessage());
}

View File

@@ -12,34 +12,31 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
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_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'OUTPUTDOCS';
$G_PUBLISH = new Publisher();
$Fields = array ('SYS_LANG' => SYS_LANG);
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'outputdocs/outputdocs_List', '', $Fields, 'outputdocs_Save' );
$G_PUBLISH = new Publisher;
$Fields=array( 'SYS_LANG' => SYS_LANG,
);
G::RenderPage( "publish" );
$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'outputdocs/outputdocs_List', '', $Fields , 'outputdocs_Save');
G::RenderPage( "publish" );
?>

View File

@@ -12,74 +12,66 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
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 ) {
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;
}
//$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());
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() );
}

View File

@@ -13,79 +13,73 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
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');
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());
die( $oException->getMessage() );
}

View File

@@ -13,79 +13,78 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
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'] ="";
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;
}
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');
//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 {
$outDocUid = $oOutputDocument->create($aData);
$oOutputDocument->update( $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']);
}
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());
die( $oException->getMessage() );
}

View File

@@ -1,32 +1,33 @@
<?php
try {
require_once 'classes/model/OutputDocument.php';
require_once 'classes/model/OutputDocument.php';
if (empty($_FILES['form']) || $_FILES['form']['name']['OUT_DOC_FILE'] == '')
throw ( new Exception ( 'you must upload a 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 );
$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." ) );
$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>";
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 "<font face='Arial' size='2' >File uploaded.</font>";
} catch (Exception $e) {
print "<font face='Arial' size='2' color='red' >Error: " . $e->getMessage() . "</font>";
}
catch ( Exception $e ) {
print "<font face='Arial' size='2' color='red' >Error: " . $e->getMessage() . "</font>";
}