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,83 +1,78 @@
<?php <?php
$action = isset($POST['action'])? $POST['action']: isset($_GET['action'])? $_GET['action']: ''; $action = isset( $POST['action'] ) ? $POST['action'] : isset( $_GET['action'] ) ? $_GET['action'] : '';
// Function call from ajax_function for calling to lookForNameOutput. // Function call from ajax_function for calling to lookForNameOutput.
if($action=='') { if ($action == '') {
$action = isset($_POST['function'])?$_POST['function']:''; $action = isset( $_POST['function'] ) ? $_POST['function'] : '';
} }
switch($action){ switch ($action) {
case 'setTemplateFile': case 'setTemplateFile':
//print_r($_FILES); //print_r($_FILES);
$_SESSION['outpudocs_tmpFile'] = PATH_DATA . $_FILES['templateFile']['name']; $_SESSION['outpudocs_tmpFile'] = PATH_DATA . $_FILES['templateFile']['name'];
// file_put_contents($_FILES['templateFile']['name'], file_get_contents($_FILES['templateFile']['tmp_name'])); // file_put_contents($_FILES['templateFile']['name'], file_get_contents($_FILES['templateFile']['tmp_name']));
copy($_FILES['templateFile']['tmp_name'], $_SESSION['outpudocs_tmpFile']); copy( $_FILES['templateFile']['tmp_name'], $_SESSION['outpudocs_tmpFile'] );
$result = new stdClass(); $result = new stdClass();
$result->success = true; $result->success = true;
$result->msg = 'success - saved '. $_SESSION['outpudocs_tmpFile']; $result->msg = 'success - saved ' . $_SESSION['outpudocs_tmpFile'];
echo G::json_encode($result); echo G::json_encode( $result );
break; break;
case 'getTemplateFile': case 'getTemplateFile':
$aExtensions = array ( "exe", "com", "dll", "ocx", "fon", "ttf", "doc", "xls", "mdb", "rtf", "bin", $aExtensions = array ("exe","com","dll","ocx","fon","ttf","doc","xls","mdb","rtf","bin","jpeg","jpg","jif","jfif","gif","tif","tiff","png","bmp","pdf","aac","mp3","mp3pro","vorbis","realaudio","vqf","wma","aiff","flac","wav","midi","mka","ogg","jpeg","ilbm","tar","zip","rar","arj","gzip","bzip2","afio","kgb","gz","asf","avi","mov","iff","ogg","ogm","mkv","3gp"
"jpeg", "jpg", "jif", "jfif", "gif", "tif", "tiff", "png", "bmp", "pdf", );
"aac", "mp3", "mp3pro", "vorbis", "realaudio", "vqf", "wma", $sFileName = strtolower( $_SESSION['outpudocs_tmpFile'] );
"aiff", "flac", "wav", "midi", "mka", "ogg", "jpeg", "ilbm", $strRev = strrev( $sFileName );
"tar", "zip", "rar", "arj", "gzip", "bzip2", "afio", "kgb", "gz", $searchPos = strpos( $strRev, '.' );
"asf", "avi", "mov", "iff", "ogg", "ogm", "mkv", "3gp", $pos = (strlen( $sFileName ) - 1) - $searchPos;
); $sExtension = substr( $sFileName, $pos + 1, strlen( $sFileName ) );
$sFileName = strtolower($_SESSION['outpudocs_tmpFile']); if (! in_array( $sExtension, $aExtensions ))
$strRev = strrev($sFileName); echo $content = file_get_contents( $_SESSION['outpudocs_tmpFile'] );
$searchPos = strpos($strRev, '.'); break;
$pos = (strlen($sFileName) - 1) - $searchPos;
$sExtension = substr($sFileName, $pos+1, strlen($sFileName));
if(! in_array($sExtension, $aExtensions))
echo $content = file_get_contents($_SESSION['outpudocs_tmpFile']);
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();
if ($aRow1['OUTPUTS']) if ($aRow1['OUTPUTS'])
$flag = false; $flag = false;
} }
echo $flag; echo $flag;
// G::json_encode($flag); // G::json_encode($flag);
break; break;
} }

View File

@@ -12,56 +12,49 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) { switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case -2: case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
case -1: case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
} }
require_once 'classes/model/OutputDocument.php'; require_once 'classes/model/OutputDocument.php';
require_once 'classes/model/ObjectPermission.php'; require_once 'classes/model/ObjectPermission.php';
require_once 'classes/model/Step.php'; require_once 'classes/model/Step.php';
G::LoadClass( 'processMap' ); G::LoadClass( 'processMap' );
$oOutputDocument = new OutputDocument();
$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->removeStep( 'OUTPUT_DOCUMENT', $_POST['OUT_DOC_UID'] );
$oStep = new Step(); $oOP = new ObjectPermission();
$oStep->removeStep('OUTPUT_DOCUMENT', $_POST['OUT_DOC_UID']); $oOP->removeByObject( 'OUTPUT', $_POST['OUT_DOC_UID'] );
//refresh dbarray with the last change in outputDocument
$oOP = new ObjectPermission(); $oMap = new processMap();
$oOP->removeByObject('OUTPUT', $_POST['OUT_DOC_UID']); $oCriteria = $oMap->getOutputDocumentsCriteria( $fields['PRO_UID'] );
$result->success = true;
//refresh dbarray with the last change in outputDocument $result->msg = G::LoadTranslation( 'ID_OUTPUTDOCUMENT_REMOVED' );
$oMap = new processMap(); } catch (Exception $e) {
$oCriteria = $oMap->getOutputDocumentsCriteria($fields['PRO_UID'] ); $result->success = false;
$result->msg = $e->getMessage();
$result->success = true; //die($oException->getMessage());
$result->msg = G::LoadTranslation('ID_OUTPUTDOCUMENT_REMOVED');
} }
catch (Exception $e) { print G::json_encode( $result );
$result->success = false;
$result->msg = $e->getMessage();
//die($oException->getMessage());
}
print G::json_encode($result);
?>

View File

@@ -12,94 +12,92 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) { switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case -2: case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
case -1: case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
} }
require_once 'classes/model/OutputDocument.php'; require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument(); $ooutputDocument = new OutputDocument();
if (isset($_GET['OUT_DOC_UID'])) { if (isset( $_GET['OUT_DOC_UID'] )) {
$aFields = $ooutputDocument->load($_GET['OUT_DOC_UID']); $aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] );
} } else {
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 break;
G::RenderPage('publish', 'extJs'); case 'JRXML':
die; break;
break; case 'ACROFORM':
$type = $aFields['OUT_DOC_TYPE'];
if ($type == 'JRXML') {
$extension = 'jrxml';
}
if ($type == 'ACROFORM') {
$extension = 'pdf';
}
case 'JRXML' : // The ereg_replace function has been DEPRECATED as of PHP 5.3.0.
case 'ACROFORM' : // $downFileName = ereg_replace('[^A-Za-z0-9_]', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension;
$type = $aFields['OUT_DOC_TYPE']; $downFileName = preg_replace( '/[^A-Za-z0-9_]/i', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension;
if ( $type == 'JRXML') $extension = 'jrxml'; $filename = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension;
if ( $type == 'ACROFORM') $extension = 'pdf'; if (file_exists( $filename )) {
$aFields['FILENAME'] = $downFileName;
// The ereg_replace function has been DEPRECATED as of PHP 5.3.0. } else {
// $downFileName = ereg_replace('[^A-Za-z0-9_]', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension; $aFields['FILENAME'] = '';
$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');
$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, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) 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

@@ -12,74 +12,66 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) { switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case -2: case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
case -1: case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
}
require_once 'classes/model/OutputDocument.php';
$ooutputDocument = new OutputDocument();
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 ); require_once 'classes/model/OutputDocument.php';
//$util->setOutputPath( JAVATEST_PATH ); $ooutputDocument = new OutputDocument();
} if (isset( $_GET['OUT_DOC_UID'] )) {
*/ $aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] );
} else {
$aFields = array ();
G::LoadClass('xmlfield_InputPM'); $aFields['PRO_UID'] = $_GET['PRO_UID'];
$G_PUBLISH = new Publisher(); }
if ( ! $enabledJavaBridge ) { $aFields['OUT_DOC_TYPE'] = 'HTML';
$xmlform = 'outputdocs/outputdocs_Properties'; $enabledJavaBridge = false;
$G_PUBLISH->AddContent('xmlform', 'xmlform', $xmlform, '', $aFields , '../outputdocs/outputdocs_Save'); /**
} * Temporally Disabled, because we are not using JRXML output doc type by now
else { * G::LoadClass ('javaBridgePM');
$xmlform = 'outputdocs/outputdocs_New'; * if ( class_exists ( 'javaBridgePM' ) ) {
$G_PUBLISH->AddContent('xmlform', 'xmlform', $xmlform, '', $aFields , '../outputdocs/outputdocs_Save'); * $JBPM = new JavaBridgePM();
} * try {
G::RenderPage('publish', 'raw'); * $JBPM->checkJavaExtension();
} * $util = new Java("com.processmaker.util.pmutils");
catch (Exception $oException) { * $enabledJavaBridge = true;
die($oException->getMessage()); * } 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, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) { switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case -2: case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
case -1: case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
} }
require_once 'classes/model/OutputDocument.php';
require_once 'classes/model/OutputDocument.php'; $ooutputDocument = new OutputDocument();
$ooutputDocument = new OutputDocument(); if (isset( $_GET['OUT_DOC_UID'] )) {
if (isset($_GET['OUT_DOC_UID'])) { $aFields = $ooutputDocument->load( $_GET['OUT_DOC_UID'] );
$aFields = $ooutputDocument->load($_GET['OUT_DOC_UID']); } else {
} 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';
$aFields['OUT_DOC_TAGS'] = isset( $aFields['OUT_DOC_TAGS'] ) ? $aFields['OUT_DOC_TAGS'] : 'OUTPUT';
$type = isset($aFields['OUT_DOC_TYPE']) ? $aFields['OUT_DOC_TYPE'] : 'HTML'; $aFields['OUT_DOC_VERSIONING'] = strval( $aFields['OUT_DOC_VERSIONING'] );
$aFields['OUT_DOC_LANDSCAPE'] = strval( $aFields['OUT_DOC_LANDSCAPE'] );
$aFields['OUT_DOC_TAGS'] = isset($aFields['OUT_DOC_TAGS']) ? $aFields['OUT_DOC_TAGS'] : 'OUTPUT'; if (isset( $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] )) {
$aFields['OUT_DOC_VERSIONING'] = strval($aFields['OUT_DOC_VERSIONING']); $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] = strval( $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] );
$aFields['OUT_DOC_LANDSCAPE'] = strval($aFields['OUT_DOC_LANDSCAPE']); }
if(isset($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_ENABLED'] = strval($aFields['OUT_DOC_PDF_SECURITY_ENABLED']); $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = G::decrypt( $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'], $_GET['OUT_DOC_UID'] );
} $aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::decrypt( $aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], $_GET['OUT_DOC_UID'] );
}
G::LoadClass( 'xmlfield_InputPM' );
if (isset($aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']) && $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") { $G_PUBLISH = new Publisher();
$aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = G::decrypt($aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'], $_GET['OUT_DOC_UID']); switch ($type) {
$aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::decrypt($aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], $_GET['OUT_DOC_UID']); case 'HTML':
} $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' );
break;
G::LoadClass('xmlfield_InputPM'); case 'JRXML':
$G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' );
switch ($type) { /*
case 'HTML' : // $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsDynaformList', '', $aFields , '../outputdocs/outputdocs_Save');
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save'); require_once 'classes/model/Process.php';
break; G::LoadClass( 'processMap');
case 'JRXML' : $sProcessUID = $aFields['PRO_UID'];
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save'); $oProcess = new Process();
/* $oProcessMap = new ProcessMap();
// $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsDynaformList', '', $aFields , '../outputdocs/outputdocs_Save'); $aFields = $oProcess->load($sProcessUID);
require_once 'classes/model/Process.php'; $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ShortList', $oProcessMap->getDynaformsCriteria($sProcessUID), $aFields);
G::LoadClass( 'processMap'); */
$sProcessUID = $aFields['PRO_UID']; break;
$oProcess = new Process(); case 'ACROFORM':
$oProcessMap = new ProcessMap(); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save' );
$aFields = $oProcess->load($sProcessUID); break;
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ShortList', $oProcessMap->getDynaformsCriteria($sProcessUID), $aFields); }
*/ G::RenderPage( 'publish', 'raw' );
break;
case 'ACROFORM' :
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save');
break;
}
G::RenderPage('publish', 'raw');
} catch (Exception $oException) { } 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, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) { switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case -2: case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
case -1: case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
}
//default:
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' )) { //default:
$dynaformUid = $aData['DYN_UID'];
$outDocUid = $oOutputDocument->create($aData);
G::LoadClass('javaBridgePM'); require_once 'classes/model/OutputDocument.php';
$jbpm = new JavaBridgePM (); G::LoadClass( 'processMap' );
print $jbpm->generateJrxmlFromDynaform($outDocUid, $dynaformUid, 'classic');
$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 { } else {
$outDocUid = $oOutputDocument->create($aData); $oOutputDocument->update( $aData );
} }
} else {
$oOutputDocument->update($aData);
}
if (isset($aData['PRO_UID'])) { if (isset( $aData['PRO_UID'] )) {
//refresh dbarray with the last change in outputDocument //refresh dbarray with the last change in outputDocument
$oMap = new processMap(); $oMap = new processMap();
$oCriteria = $oMap->getOutputDocumentsCriteria($aData['PRO_UID']); $oCriteria = $oMap->getOutputDocumentsCriteria( $aData['PRO_UID'] );
} }
} catch (Exception $oException) { } catch (Exception $oException) {
die($oException->getMessage()); die( $oException->getMessage() );
} }

View File

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