BUG 000 PM tables ver2 ready - propel & phing integration
This commit is contained in:
@@ -1,290 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesAjax.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
if(isset($_POST['action'])) {
|
||||
switch ($_POST['action']) {
|
||||
case 'tableExists':
|
||||
G::LoadSystem('database_' . strtolower(DB_ADAPTER));
|
||||
$oDataBase = new database(DB_ADAPTER, DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||
$oDataBase->iFetchType = MYSQL_NUM;
|
||||
$oDataset = $oDataBase->executeQuery($oDataBase->generateShowTablesLikeSQL($_POST['sTableName']));
|
||||
echo $oDataBase->countResults($oDataset);
|
||||
break;
|
||||
case 'classExists':
|
||||
$sClassName = strtolower(trim($_POST['sClassName']));
|
||||
$aDirectories = array();
|
||||
$aClasses = array();
|
||||
$aDirectories[] = PATH_GULLIVER;
|
||||
$aDirectories[] = PATH_THIRDPARTY;
|
||||
$aDirectories[] = PATH_RBAC;
|
||||
$aDirectories[] = PATH_CORE . 'classes' . PATH_SEP;
|
||||
foreach ($aDirectories as $sDirectory) {
|
||||
includeClasses($sDirectory, $aClasses, true);
|
||||
}
|
||||
echo (int)class_exists($sClassName);
|
||||
break;
|
||||
|
||||
case 'exportexporView':
|
||||
global $G_PUBLISH;
|
||||
require_once ( 'classes/class.xmlfield_InputPM.php' );
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
|
||||
$oCriteria->add(AdditionalTablesPeer::ADD_TAB_UID, '', Criteria::NOT_EQUAL);
|
||||
|
||||
$G_PUBLISH->AddContent('propeltable', 'additionalTables/paged-table', 'additionalTables/additionalTablesExportList', $oCriteria);
|
||||
G::RenderPage('publish', 'raw');
|
||||
break;
|
||||
case 'updatePageSize':
|
||||
G::LoadClass('configuration');
|
||||
$c = new Configurations();
|
||||
$arr['pageSize'] = $_REQUEST['size'];
|
||||
$arr['dateSave'] = date('Y-m-d H:i:s');
|
||||
$config = Array();
|
||||
$config[] = $arr;
|
||||
$c->aConfig = $config;
|
||||
$c->saveConfig('additionalTablesList', 'pageSize','',$_SESSION['USER_LOGGED']);
|
||||
echo '{success: true}';
|
||||
break;
|
||||
case 'updatePageSizeData':
|
||||
G::LoadClass('configuration');
|
||||
$c = new Configurations();
|
||||
$arr['pageSize'] = $_REQUEST['size'];
|
||||
$arr['dateSave'] = date('Y-m-d H:i:s');
|
||||
$config = Array();
|
||||
$config[] = $arr;
|
||||
$c->aConfig = $config;
|
||||
$c->saveConfig('additionalTablesData', 'pageSize','',$_SESSION['USER_LOGGED']);
|
||||
echo '{success: true}';
|
||||
break;
|
||||
|
||||
case 'doExport':
|
||||
# @Author: Erik Amaru Ortiz <aortiz.erik@gmail.com>
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
|
||||
$tables = explode(',', $_POST['tables']);
|
||||
$schema = explode(',', $_POST['schema']);
|
||||
$data = explode(',', $_POST['data']);
|
||||
|
||||
G::LoadCLass('net');
|
||||
$net = new NET(G::getIpAddress());
|
||||
|
||||
G::LoadClass("system");
|
||||
|
||||
$META = " \n-----== ProcessMaker Open Source Private Tables ==-----\n".
|
||||
" @Ver: 1.0 Oct-2009\n".
|
||||
" @Processmaker version: ".System::getVersion()."\n".
|
||||
" -------------------------------------------------------\n".
|
||||
" @Export Date: ".date("l jS \of F Y h:i:s A")."\n".
|
||||
" @Server address: ".getenv('SERVER_NAME')." (".getenv('SERVER_ADDR').")\n".
|
||||
" @Client address: ".$net->hostname."\n".
|
||||
" @Workspace: ".SYS_SYS."\n".
|
||||
" @Export trace back:\n\n";
|
||||
|
||||
|
||||
$EXPORT_TRACEBACK = Array();
|
||||
$c = 0;
|
||||
foreach ($tables as $uid) {
|
||||
|
||||
$aTable = new additionalTables();
|
||||
$tRecord = $aTable->load($uid);
|
||||
$oAdditionalTables = new additionalTables();
|
||||
$table = $oAdditionalTables->getAllData($uid);
|
||||
|
||||
$rows = $table['rows'];
|
||||
$count = $table['count'];
|
||||
|
||||
array_push($EXPORT_TRACEBACK, Array(
|
||||
'uid' => $uid,
|
||||
'name' => $tRecord['ADD_TAB_NAME'],
|
||||
'num_regs' => sizeof($rows),
|
||||
'schema' => in_array($uid, $schema)? 'yes': 'no',
|
||||
'data' => in_array($uid, $data)? 'yes': 'no'
|
||||
// 'schema' => ($schema[$c]=='Export')? 'yes': 'no',
|
||||
// 'data' => ($data[$c]=='Export')? 'yes': 'no'
|
||||
));
|
||||
}
|
||||
|
||||
$sTrace = "TABLE UID\t\t\t\tTABLE NAME\tREGS\tSCHEMA\tDATA\n";
|
||||
foreach($EXPORT_TRACEBACK as $row){
|
||||
$sTrace .= "{$row['uid']}\t{$row['name']}\t\t{$row['num_regs']}\t{$row['schema']}\t{$row['data']}\n";
|
||||
}
|
||||
|
||||
$META .= $sTrace;
|
||||
|
||||
///////////////EXPORT PROCESS
|
||||
$PUBLIC_ROOT_PATH = PATH_DATA.'sites'.PATH_SEP.SYS_SYS.PATH_SEP.'public'.PATH_SEP;
|
||||
$filenameOnly = 'SYS-'.strtoupper(SYS_SYS)."_".date("Y-m-d").'_'.date("Hi").".pmt";
|
||||
$filename = $PUBLIC_ROOT_PATH . $filenameOnly;
|
||||
$fp = fopen( $filename, "wb");
|
||||
$bytesSaved = 0;
|
||||
|
||||
$bufferType = '@META';
|
||||
$fsData = sprintf("%09d", strlen($META));
|
||||
$fsbufferType = sprintf("%09d", strlen($bufferType));
|
||||
$bytesSaved += fwrite($fp, $fsbufferType); //writing the size of $oData
|
||||
$bytesSaved += fwrite($fp, $bufferType); //writing the $oData
|
||||
$bytesSaved += fwrite($fp, $fsData); //writing the size of $oData
|
||||
$bytesSaved += fwrite($fp, $META); //writing the $oData
|
||||
|
||||
foreach($EXPORT_TRACEBACK as $record){
|
||||
|
||||
if($record['schema'] == 'yes'){
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$aData = $oAdditionalTables->load($record['uid'], true);
|
||||
|
||||
$bufferType = '@SCHEMA';
|
||||
$SDATA = serialize($aData);
|
||||
$fsUid = sprintf("%09d", strlen($record['uid']));
|
||||
$fsData = sprintf("%09d", strlen ($SDATA));
|
||||
$fsbufferType = sprintf("%09d", strlen($bufferType));
|
||||
|
||||
$bytesSaved += fwrite($fp, $fsbufferType); //writing the size of $oData
|
||||
$bytesSaved += fwrite($fp, $bufferType); //writing the $oData
|
||||
$bytesSaved += fwrite($fp, $fsUid ); //writing the size of xml file
|
||||
$bytesSaved += fwrite($fp, $record['uid'] ); //writing the xmlfile
|
||||
$bytesSaved += fwrite($fp, $fsData); //writing the size of xml file
|
||||
$bytesSaved += fwrite($fp, $SDATA); //writing the xmlfile
|
||||
}
|
||||
|
||||
if($record['data'] == 'yes'){
|
||||
//export data
|
||||
$oAdditionalTables = new additionalTables();
|
||||
$table = $oAdditionalTables->getAllData($uid);
|
||||
|
||||
$rows = $table['rows'];
|
||||
$count = $table['count'];
|
||||
|
||||
$bufferType = '@DATA';
|
||||
$SDATA = serialize($rows);
|
||||
$fsUid = sprintf("%09d", strlen($record['name']));
|
||||
$fsData = sprintf("%09d", strlen ($SDATA));
|
||||
$fsbufferType = sprintf("%09d", strlen($bufferType));
|
||||
|
||||
$bytesSaved += fwrite($fp, $fsbufferType); //writing the size of $oData
|
||||
$bytesSaved += fwrite($fp, $bufferType); //writing the $oData
|
||||
$bytesSaved += fwrite($fp, $fsUid ); //writing the size of xml file
|
||||
$bytesSaved += fwrite($fp, $record['name'] ); //writing the xmlfile
|
||||
$bytesSaved += fwrite($fp, $fsData); //writing the size of xml file
|
||||
$bytesSaved += fwrite($fp, $SDATA); //writing the xmlfile
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fclose ($fp);
|
||||
|
||||
$filenameLink = "../additionalTables/doExport?f={$filenameOnly}";
|
||||
$aFields['SIZE'] = round(($bytesSaved/1024), 2)." Kb";
|
||||
$aFields['META'] = "<pre>".$META."</pre>";
|
||||
$aFields['FILENAME'] = $filenameOnly;
|
||||
$aFields['FILENAME_LINK'] = $filenameLink;
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'additionalTables/doExport', '', $aFields, '');
|
||||
G::RenderPage('publish', 'raw');
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['function'])) {
|
||||
$sfunction = $_POST['function'];
|
||||
switch($sfunction) {
|
||||
case 'existClass' :
|
||||
$result = '';
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$tables = explode(',', $_POST['tables']);
|
||||
$schema = explode(',', $_POST['schema']);
|
||||
$data = explode(',', $_POST['data']);
|
||||
|
||||
G::LoadCLass('net');
|
||||
$net = new NET(G::getIpAddress());
|
||||
G::LoadClass("system");
|
||||
$EXPORT_TRACEBACK = Array();
|
||||
foreach ($tables as $uid) {
|
||||
$aTable = new additionalTables();
|
||||
$tRecord = $aTable->load($uid);
|
||||
$oAdditionalTables = new additionalTables();
|
||||
$ocaux = $oAdditionalTables->checkClassNotExist($uid);
|
||||
if($ocaux == null ){
|
||||
$result = $result . ' <br> ' . $tRecord['ADD_TAB_NAME'];
|
||||
}
|
||||
}
|
||||
return print $result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function includeClasses($sDirectory, &$aClasses, $bRecursive = false) {
|
||||
$aClassesFilter = array('class.filterForm.php',
|
||||
'class.dvEditor.php',
|
||||
'class.htmlArea.php',
|
||||
'class.database_base.php',
|
||||
'class.error.php',
|
||||
'class.xmlMenu.php',
|
||||
'class.form.php',
|
||||
'class.xmlform.php',
|
||||
'class.xmlformExtension.php',
|
||||
'pakeFileTask.class.php',
|
||||
'class.groupUser.php',
|
||||
'class.xmlfield_InputPM.php',
|
||||
'class.dynaFormField.php',
|
||||
'class.toolBar.php');
|
||||
$oDirectory = dir($sDirectory);
|
||||
while ($sObject = $oDirectory->read()) {
|
||||
if (!in_array($sObject, array('.', '..'))) {
|
||||
if (is_dir($sDirectory . PATH_SEP . $sObject)) {
|
||||
if ($bRecursive && ($sObject != 'html2ps_pdf') && ($sObject == 'propel-generator')) {
|
||||
includeClasses($sDirectory . PATH_SEP . $sObject, $aClasses, true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$aAux = pathinfo($sDirectory . PATH_SEP . $sObject);
|
||||
if (!isset($aAux['extension'])) {
|
||||
$aAux['extension'] = '';
|
||||
}
|
||||
if (strtolower($aAux['extension']) == 'php') {
|
||||
try {
|
||||
if (!in_array($aAux['basename'], $aClassesFilter)) {
|
||||
@include $sDirectory . PATH_SEP . $sObject;
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
//Nothing
|
||||
}
|
||||
$aClasses[] = $sObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesData.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
global $RBAC;
|
||||
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
|
||||
$G_PUBLISH = new Publisher;
|
||||
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$oAdditionalTables->createXmlList($_GET['sUID']);
|
||||
$arrTable = $oAdditionalTables->load($_GET['sUID'],true);
|
||||
$fields = $arrTable['FIELDS'];
|
||||
|
||||
G::LoadClass('configuration');
|
||||
$c = new Configurations();
|
||||
$configPage = $c->getConfiguration('additionalTablesData', 'pageSize','',$_SESSION['USER_LOGGED']);
|
||||
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
|
||||
|
||||
$arrNames = Array();
|
||||
$arrDescrip = Array();
|
||||
$arrPKF = Array();
|
||||
$c = 0;
|
||||
$xPKF = "";
|
||||
foreach ($fields as $field){
|
||||
$c++;
|
||||
$arrNames[] = $field['FLD_NAME'];
|
||||
$arrDescrip[] = $field['FLD_DESCRIPTION'];
|
||||
if ($field['FLD_KEY']=='1'){
|
||||
$arrPKF[] = $field['FLD_NAME'];
|
||||
}
|
||||
}
|
||||
$xPKF = implode(',', $arrPKF);
|
||||
|
||||
|
||||
//$oHeadPublisher->usingExtJs('ux/Ext.ux.fileUploadField');
|
||||
$oHeadPublisher->addExtJsScript('additionalTables/additionalTablesData', false); //adding a javascript file .js
|
||||
$oHeadPublisher->addContent('additionalTables/additionalTablesData'); //adding a html file .html.
|
||||
|
||||
$table_uid = Array();
|
||||
$table_uid['UID'] = $_GET['sUID'];
|
||||
$table_uid['COUNTER'] = $c;
|
||||
$table_uid['TABLE_NAME'] = $arrTable['ADD_TAB_NAME'];
|
||||
$table_uid['PKF'] = $xPKF;
|
||||
|
||||
|
||||
$oHeadPublisher->assign('TABLES', $table_uid);
|
||||
$oHeadPublisher->assign('NAMES', $arrNames);
|
||||
$oHeadPublisher->assign('VALUES', $arrDescrip);
|
||||
$oHeadPublisher->assign('CONFIG', $Config);
|
||||
|
||||
G::RenderPage('publish', 'extJs');
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesDataDelete.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
|
||||
$sUID = $_GET['sUID'];
|
||||
unset($_GET['sUID']);
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
//$oAdditionalTables->deleteDataInTable($_POST['sUID'], $_POST['sPMUID']);
|
||||
$oAdditionalTables->deleteDataInTable($sUID, $_GET);
|
||||
|
||||
G::header('Location: additionalTablesData?sUID=' . $sUID);
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesDataEdit.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
|
||||
$sUID = $_GET['sUID'];
|
||||
unset($_GET['sUID']);
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$oAdditionalTables->createXmlEdit($sUID, false);
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_SUB_MENU = 'setup';
|
||||
$G_ID_MENU_SELECTED = 'SETUP';
|
||||
$G_ID_SUB_MENU_SELECTED = 'ADDITIONAL_TABLES';
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'xmlLists/' . $sUID . 'Edit', '', $oAdditionalTables->getDataTable($sUID, $_GET), 'additionalTablesUpdateData?sUID=' . $sUID, '', '', PATH_DYNAFORM);
|
||||
G::RenderPage('publishBlank', 'blank');
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesDataImport.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
if (preg_match('/[\x00-\x08\x0b-\x0c\x0e\x1f]/', file_get_contents($_FILES['form']['tmp_name']['CSV_FILE'])) === 0) {
|
||||
if ($oFile = fopen($_FILES['form']['tmp_name']['CSV_FILE'], 'r')) {
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$aAdditionalTables = $oAdditionalTables->load($_POST['form']['ADD_TAB_UID'], true);
|
||||
$sErrorMessages = '';
|
||||
$i = 1;
|
||||
while (($aAux = fgetcsv($oFile, 4096, $_POST['form']['CSV_DELIMITER'])) !== false) {
|
||||
if ($i > 1) {
|
||||
$aData = array();
|
||||
$j = 0;
|
||||
foreach ($aAdditionalTables['FIELDS'] as $aField) {
|
||||
$aData[$aField['FLD_NAME']] = (isset($aAux[$j]) ? $aAux[$j] : '');
|
||||
$j++;
|
||||
}
|
||||
try {
|
||||
if (!$oAdditionalTables->saveDataInTable($_POST['form']['ADD_TAB_UID'], $aData)) {
|
||||
$sErrorMessages .= G::LoadTranslation('ID_DUPLICATE_ENTRY_PRIMARY_KEY') . ', ' . G::LoadTranslation('ID_LINE') . ' ' . $i . '<br />';
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
$sErrorMessages .= G::LoadTranslation('ID_ERROR_INSERT_LINE') . ': ' . G::LoadTranslation('ID_LINE') . ' ' . $i . '<br />';
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
fclose($oFile);
|
||||
}
|
||||
if ($sErrorMessages != '') {
|
||||
G::SendMessageText($sErrorMessages, 'warning');
|
||||
}
|
||||
G::header('Location: additionalTablesData?sUID=' . $_POST['form']['ADD_TAB_UID']);
|
||||
die;
|
||||
}
|
||||
else {
|
||||
G::SendTemporalMessage('ID_UPLOAD_VALID_CSV_FILE', 'error', 'labels');
|
||||
G::header('Location: additionalTablesData?sUID=' . $_POST['form']['ADD_TAB_UID']);
|
||||
die;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesDataImportForm.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
//$G_SUB_MENU = 'setup';
|
||||
$G_ID_MENU_SELECTED = 'SETUP';
|
||||
//$G_ID_SUB_MENU_SELECTED = 'ADDITIONAL_TABLES';
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'additionalTables/additionalTablesTitle', '', $oAdditionalTables->load($_GET['sUID']));
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'additionalTables/additionalTablesDataImportForm', '', array('ADD_TAB_UID' => $_GET['sUID']), '../additionalTables/additionalTablesDataImport');
|
||||
G::RenderPage('publishBlank', 'blank');
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesDataNew.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$oAdditionalTables->createXmlEdit($_GET['sUID'], true);
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
//$G_SUB_MENU = 'setup';
|
||||
$G_ID_MENU_SELECTED = 'SETUP';
|
||||
//$G_ID_SUB_MENU_SELECTED = 'ADDITIONAL_TABLES';
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'xmlLists/' . $_GET['sUID'] . 'Edit', '', '', 'additionalTablesSaveData?sUID=' . $_GET['sUID'], '', '', PATH_DYNAFORM);
|
||||
G::RenderPage('publishBlank', 'blank');
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesDelete.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
|
||||
if (!isset($_GET['sUID'])) {
|
||||
die;
|
||||
}
|
||||
|
||||
if ($_GET['sUID'] == '') {
|
||||
die;
|
||||
}
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$oAdditionalTables->deleteMultiple($_GET['sUID']);
|
||||
|
||||
G::Header('Location: additionalTablesList');
|
||||
@@ -1,203 +0,0 @@
|
||||
<?
|
||||
/**
|
||||
* processes_ImportFile.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* @Author: Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*/
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
|
||||
try {
|
||||
|
||||
echo '<pre>';
|
||||
//print_R($_POST['form']['OVERWRITE']);
|
||||
|
||||
$overWrite = isset($_POST['form']['OVERWRITE'])? true: false;
|
||||
|
||||
//save the file
|
||||
if ($_FILES['form']['error']['FILENAME'] == 0) {
|
||||
$PUBLIC_ROOT_PATH = PATH_DATA.'sites'.PATH_SEP.SYS_SYS.PATH_SEP.'public'.PATH_SEP;
|
||||
|
||||
$filename = $_FILES['form']['name']['FILENAME'];
|
||||
$tempName = $_FILES['form']['tmp_name']['FILENAME'];
|
||||
G::uploadFile($tempName, $PUBLIC_ROOT_PATH, $filename );
|
||||
|
||||
$fileContent = file_get_contents($PUBLIC_ROOT_PATH.$filename);
|
||||
|
||||
if(strpos($fileContent, '-----== ProcessMaker Open Source Private Tables ==-----') !== false){
|
||||
$oMap = new aTablesMap();
|
||||
|
||||
$fp = fopen($PUBLIC_ROOT_PATH.$filename, "rb");
|
||||
$fsData = intval(fread($fp, 9)); //reading the metadata
|
||||
$sType = fread($fp, $fsData); //reading string $oData
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
require_once 'classes/model/Fields.php';
|
||||
$oFields = new Fields();
|
||||
|
||||
while ( !feof($fp) ) {
|
||||
switch($sType){
|
||||
case '@META':
|
||||
$fsData = intval(fread($fp, 9));
|
||||
$METADATA = fread($fp, $fsData);
|
||||
//print_r($METADATA);
|
||||
break;
|
||||
case '@SCHEMA':
|
||||
|
||||
$fsUid = intval(fread($fp, 9));
|
||||
$uid = fread($fp, $fsUid);
|
||||
|
||||
$fsData = intval(fread($fp, 9));
|
||||
$schema = fread($fp, $fsData);
|
||||
$contentSchema = unserialize($schema);
|
||||
//print_r($contentSchema);
|
||||
|
||||
if($overWrite){
|
||||
$aTable = new additionalTables();
|
||||
try{
|
||||
$tRecord = $aTable->load($uid);
|
||||
$aTable->deleteAll($uid);
|
||||
} catch(Exception $e){
|
||||
$tRecord = $aTable->loadByName($contentSchema['ADD_TAB_NAME']);
|
||||
if($tRecord[0]){
|
||||
$aTable->deleteAll($tRecord[0]['ADD_TAB_UID']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#verify if exists some table with the same name
|
||||
$aTable = new additionalTables();
|
||||
$tRecord = $aTable->loadByName("{$contentSchema['ADD_TAB_NAME']}%");
|
||||
|
||||
if($tRecord){
|
||||
$tNameOld = $contentSchema['ADD_TAB_NAME'];
|
||||
$contentSchema['ADD_TAB_NAME'] = "{$contentSchema['ADD_TAB_NAME']}".sizeof($tRecord);
|
||||
$contentSchema['ADD_TAB_CLASS_NAME'] = "{$contentSchema['ADD_TAB_CLASS_NAME']}".sizeof($tRecord);
|
||||
$oMap->addRoute($tNameOld, $contentSchema['ADD_TAB_NAME']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$sAddTabUid = $oAdditionalTables->create(
|
||||
array(
|
||||
'ADD_TAB_NAME' => $contentSchema['ADD_TAB_NAME'],
|
||||
'ADD_TAB_CLASS_NAME' => $contentSchema['ADD_TAB_CLASS_NAME'],
|
||||
'ADD_TAB_DESCRIPTION' => $contentSchema['ADD_TAB_DESCRIPTION'],
|
||||
'ADD_TAB_SDW_LOG_INSERT' => $contentSchema['ADD_TAB_SDW_LOG_INSERT'],
|
||||
'ADD_TAB_SDW_LOG_UPDATE' => $contentSchema['ADD_TAB_SDW_LOG_UPDATE'],
|
||||
'ADD_TAB_SDW_LOG_DELETE' => $contentSchema['ADD_TAB_SDW_LOG_DELETE'],
|
||||
'ADD_TAB_SDW_LOG_SELECT' => $contentSchema['ADD_TAB_SDW_LOG_SELECT'],
|
||||
'ADD_TAB_SDW_MAX_LENGTH' => $contentSchema['ADD_TAB_SDW_MAX_LENGTH'],
|
||||
'ADD_TAB_SDW_AUTO_DELETE' => $contentSchema['ADD_TAB_SDW_AUTO_DELETE'],
|
||||
'ADD_TAB_PLG_UID' => $contentSchema['ADD_TAB_PLG_UID']
|
||||
),
|
||||
$contentSchema['FIELDS']
|
||||
);
|
||||
|
||||
|
||||
$aFields = array();
|
||||
foreach( $contentSchema['FIELDS'] as $iRow => $aRow ){
|
||||
unset($aRow['FLD_UID']);
|
||||
$aRow['ADD_TAB_UID'] = $sAddTabUid;
|
||||
$oFields->create($aRow);
|
||||
// print_R($aRow); die;
|
||||
$aFields[] = array(
|
||||
'sType' => $contentSchema['FIELDS'][$iRow]['FLD_TYPE'],
|
||||
'iSize' => $contentSchema['FIELDS'][$iRow]['FLD_SIZE'],
|
||||
'sFieldName' => $contentSchema['FIELDS'][$iRow]['FLD_NAME'],
|
||||
'bNull' => $contentSchema['FIELDS'][$iRow]['FLD_NULL'],
|
||||
'bAI' => $contentSchema['FIELDS'][$iRow]['FLD_AUTO_INCREMENT'],
|
||||
'bPrimaryKey' => $contentSchema['FIELDS'][$iRow]['FLD_KEY']
|
||||
);
|
||||
}
|
||||
$oAdditionalTables->createTable($contentSchema['ADD_TAB_NAME'], 'wf', $aFields);
|
||||
|
||||
for($i=1; $i <= count($contentSchema['FIELDS']); $i++){
|
||||
$contentSchema['FIELDS'][$i]['FLD_NULL'] = $contentSchema['FIELDS'][$i]['FLD_NULL'] == '1' ? 'on' : '';
|
||||
$contentSchema['FIELDS'][$i]['FLD_AUTO_INCREMENT'] = $contentSchema['FIELDS'][$i]['FLD_AUTO_INCREMENT'] == '1' ? 'on' : '';
|
||||
$contentSchema['FIELDS'][$i]['FLD_KEY'] = $contentSchema['FIELDS'][$i]['FLD_KEY'] == '1' ? 'on' : '';
|
||||
$contentSchema['FIELDS'][$i]['FLD_FOREIGN_KEY'] = $contentSchema['FIELDS'][$i]['FLD_FOREIGN_KEY'] == '1' ? 'on' : '';
|
||||
}
|
||||
|
||||
$oAdditionalTables->createPropelClasses($contentSchema['ADD_TAB_NAME'], $contentSchema['ADD_TAB_CLASS_NAME'], $contentSchema['FIELDS'], $sAddTabUid);
|
||||
|
||||
break;
|
||||
case '@DATA':
|
||||
$fstName = intval(fread($fp, 9));
|
||||
$tName = fread($fp, $fstName);
|
||||
$fsData = intval(fread($fp, 9));
|
||||
$contentData = unserialize(fread($fp, $fsData));
|
||||
|
||||
$tName = $oMap->route($tName);
|
||||
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$tRecord = $oAdditionalTables->loadByName($tName);
|
||||
|
||||
if($tRecord){
|
||||
foreach($contentData as $data){
|
||||
unset($data['DUMMY']);
|
||||
$oAdditionalTables->saveDataInTable($tRecord[0]['ADD_TAB_UID'], $data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
$fsData = intval(fread($fp, 9));
|
||||
if($fsData > 0){
|
||||
$sType = fread($fp, $fsData);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
G::header("location: additionalTablesList");
|
||||
|
||||
} else {
|
||||
G::SendTemporalMessage ('INVALID_FILE', "Error");
|
||||
G::header("location: additionalTablesToImport");
|
||||
}
|
||||
|
||||
}
|
||||
} catch(Exception $e){
|
||||
echo $e;
|
||||
}
|
||||
|
||||
|
||||
class aTablesMap{
|
||||
var $aMap;
|
||||
|
||||
function route($uid){
|
||||
if( isset($this->aMap[$uid]) ){
|
||||
return $this->aMap[$uid];
|
||||
} else {
|
||||
return $uid;
|
||||
}
|
||||
}
|
||||
|
||||
function addRoute($item, $equal){
|
||||
$this->aMap[$item] = $equal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesEdit.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
|
||||
if (!isset($_GET['sUID'])) {
|
||||
G::header('Location: additionalTablesList');
|
||||
die;
|
||||
}
|
||||
|
||||
if ($_GET['sUID'] == '') {
|
||||
G::header('Location: additionalTablesList');
|
||||
die;
|
||||
}
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
//$G_SUB_MENU = 'setup';
|
||||
$G_ID_MENU_SELECTED = 'SETUP';
|
||||
//$G_ID_SUB_MENU_SELECTED = 'ADDITIONAL_TABLES';
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$aData = $oAdditionalTables->load($_GET['sUID'], true);
|
||||
if ($aData['ADD_TAB_SDW_LOG_INSERT'] == 1) {
|
||||
$aData['ADD_TAB_SDW_LOG_INSERT'] = 'on';
|
||||
}
|
||||
else {
|
||||
$aData['ADD_TAB_SDW_LOG_INSERT'] = '';
|
||||
}
|
||||
if ($aData['ADD_TAB_SDW_LOG_UPDATE'] == 1) {
|
||||
$aData['ADD_TAB_SDW_LOG_UPDATE'] = 'on';
|
||||
}
|
||||
else {
|
||||
$aData['ADD_TAB_SDW_LOG_UPDATE'] = '';
|
||||
}
|
||||
if ($aData['ADD_TAB_SDW_LOG_DELETE'] == 1) {
|
||||
$aData['ADD_TAB_SDW_LOG_DELETE'] = 'on';
|
||||
}
|
||||
else {
|
||||
$aData['ADD_TAB_SDW_LOG_DELETE'] = '';
|
||||
}
|
||||
if ($aData['ADD_TAB_SDW_LOG_SELECT'] == 1) {
|
||||
$aData['ADD_TAB_SDW_LOG_SELECT'] = 'on';
|
||||
}
|
||||
else {
|
||||
$aData['ADD_TAB_SDW_LOG_SELECT'] = '';
|
||||
}
|
||||
if ($aData['ADD_TAB_SDW_AUTO_DELETE'] == 1) {
|
||||
$aData['ADD_TAB_SDW_AUTO_DELETE'] = 'on';
|
||||
}
|
||||
else {
|
||||
$aData['ADD_TAB_SDW_AUTO_DELETE'] = '';
|
||||
}
|
||||
foreach ($aData['FIELDS'] as $iRow => $aRow) {
|
||||
if ($aRow['FLD_NULL'] == 1) {
|
||||
$aData['FIELDS'][$iRow]['FLD_NULL'] = 'on';
|
||||
}
|
||||
else {
|
||||
$aData['FIELDS'][$iRow]['FLD_NULL'] = '';
|
||||
}
|
||||
if ($aRow['FLD_AUTO_INCREMENT'] == 1) {
|
||||
$aData['FIELDS'][$iRow]['FLD_AUTO_INCREMENT'] = 'on';
|
||||
}
|
||||
else {
|
||||
$aData['FIELDS'][$iRow]['FLD_AUTO_INCREMENT'] = '';
|
||||
}
|
||||
if ($aRow['FLD_KEY'] == 1) {
|
||||
$aData['FIELDS'][$iRow]['FLD_KEY'] = 'on';
|
||||
}
|
||||
else {
|
||||
$aData['FIELDS'][$iRow]['FLD_KEY'] = '';
|
||||
}
|
||||
if ($aRow['FLD_FOREIGN_KEY'] == 1) {
|
||||
$aData['FIELDS'][$iRow]['FLD_FOREIGN_KEY'] = 'on';
|
||||
}
|
||||
else {
|
||||
$aData['FIELDS'][$iRow]['FLD_FOREIGN_KEY'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'additionalTables/additionalTablesEdit', '', $aData, '../additionalTables/additionalTablesSave');
|
||||
G::RenderPage('publishBlank', 'blank');
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesList.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
global $RBAC;
|
||||
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
|
||||
$G_PUBLISH = new Publisher;
|
||||
|
||||
G::LoadClass('configuration');
|
||||
$c = new Configurations();
|
||||
$configPage = $c->getConfiguration('additionalTablesList', 'pageSize','',$_SESSION['USER_LOGGED']);
|
||||
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
|
||||
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
|
||||
//$oHeadPublisher->usingExtJs('ux/Ext.ux.fileUploadField');
|
||||
$oHeadPublisher->addExtJsScript('additionalTables/additionalTablesList', false); //adding a javascript file .js
|
||||
$oHeadPublisher->addContent('additionalTables/additionalTablesList'); //adding a html file .html.
|
||||
$oHeadPublisher->assign('FORMATS',$c->getFormats());
|
||||
$oHeadPublisher->assign('CONFIG', $Config);
|
||||
G::RenderPage('publish', 'extJs');
|
||||
|
||||
/*global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
|
||||
$oCriteria->add(AdditionalTablesPeer::ADD_TAB_UID, '', Criteria::NOT_EQUAL);
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
//$G_SUB_MENU = 'admin';
|
||||
$G_ID_MENU_SELECTED = 'SETUP';
|
||||
//$G_ID_SUB_MENU_SELECTED = 'ADMIN';
|
||||
|
||||
$G_PUBLISH = new Publisher;
|
||||
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'additionalTables/additionalTablesList', $oCriteria, '', '');
|
||||
G::RenderPage('publishBlank', 'blank');*/
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesNew.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
//$G_SUB_MENU = 'setup';
|
||||
$G_ID_MENU_SELECTED = 'SETUP';
|
||||
//$G_ID_SUB_MENU_SELECTED = 'ADDITIONAL_TABLES';
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'additionalTables/additionalTablesNew', '', '', '../additionalTables/additionalTablesSave');
|
||||
G::RenderPage('publishBlank', 'blank');
|
||||
@@ -1,220 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesSave.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
unset($_POST['form']['ADD_TAB_NAME_OLD']);
|
||||
unset($_POST['form']['ADD_TAB_CLASS_NAME_OLD']);
|
||||
if (!isset($_POST['form']['ADD_TAB_SDW_LOG_INSERT'])) {
|
||||
$_POST['form']['ADD_TAB_SDW_LOG_INSERT'] = '';
|
||||
}
|
||||
if (!isset($_POST['form']['ADD_TAB_SDW_LOG_UPDATE'])) {
|
||||
$_POST['form']['ADD_TAB_SDW_LOG_UPDATE'] = '';
|
||||
}
|
||||
if (!isset($_POST['form']['ADD_TAB_SDW_LOG_DELETE'])) {
|
||||
$_POST['form']['ADD_TAB_SDW_LOG_DELETE'] = '';
|
||||
}
|
||||
if (!isset($_POST['form']['ADD_TAB_SDW_LOG_SELECT'])) {
|
||||
$_POST['form']['ADD_TAB_SDW_LOG_SELECT'] = '';
|
||||
}
|
||||
if (!isset($_POST['form']['ADD_TAB_SDW_MAX_LENGTH'])) {
|
||||
$_POST['form']['ADD_TAB_SDW_MAX_LENGTH'] = 0;
|
||||
}
|
||||
if (!isset($_POST['form']['ADD_TAB_SDW_AUTO_DELETE'])) {
|
||||
$_POST['form']['ADD_TAB_SDW_AUTO_DELETE'] = '';
|
||||
}
|
||||
foreach ($_POST['form']['FIELDS'] as $iRow => $aRow) {
|
||||
if (!isset($_POST['form']['FIELDS'][$iRow]['FLD_NULL'])) {
|
||||
$_POST['form']['FIELDS'][$iRow]['FLD_NULL'] = '';
|
||||
}
|
||||
if (!isset($_POST['form']['FIELDS'][$iRow]['FLD_AUTO_INCREMENT'])) {
|
||||
$_POST['form']['FIELDS'][$iRow]['FLD_AUTO_INCREMENT'] = '';
|
||||
}
|
||||
if (!isset($_POST['form']['FIELDS'][$iRow]['FLD_KEY'])) {
|
||||
$_POST['form']['FIELDS'][$iRow]['FLD_KEY'] = '';
|
||||
}
|
||||
if (!isset($_POST['form']['FIELDS'][$iRow]['FLD_FOREIGN_KEY'])) {
|
||||
$_POST['form']['FIELDS'][$iRow]['FLD_FOREIGN_KEY'] = '';
|
||||
}
|
||||
if (!isset($_POST['form']['FIELDS'][$iRow]['FLD_FOREIGN_KEY_TABLE'])) {
|
||||
$_POST['form']['FIELDS'][$iRow]['FLD_FOREIGN_KEY_TABLE'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_POST['form']['FIELDS'][$iRow]['FLD_NULL_HDN'])) {
|
||||
$_POST['form']['FIELDS'][$iRow]['FLD_NULL_HDN'] = '';
|
||||
}
|
||||
if (!isset($_POST['form']['FIELDS'][$iRow]['FLD_KEY_HDN'])) {
|
||||
$_POST['form']['FIELDS'][$iRow]['FLD_KEY_HDN'] = '';
|
||||
}
|
||||
// replace values check
|
||||
if (isset($_POST['form']['FIELDS'][$iRow]['FLD_KEY']) && $_POST['form']['FIELDS'][$iRow]['FLD_KEY_HDN'] == 'on') {
|
||||
$_POST['form']['FIELDS'][$iRow]['FLD_KEY'] = $_POST['form']['FIELDS'][$iRow]['FLD_KEY_HDN'];
|
||||
}
|
||||
if (isset($_POST['form']['FIELDS'][$iRow]['FLD_NULL']) && $_POST['form']['FIELDS'][$iRow]['FLD_NULL_HDN'] == 'on') {
|
||||
$_POST['form']['FIELDS'][$iRow]['FLD_NULL'] = $_POST['form']['FIELDS'][$iRow]['FLD_NULL_HDN'];
|
||||
}
|
||||
}
|
||||
|
||||
$aKeys = array();
|
||||
$aDynavars = array();
|
||||
$aNoKeys = array();
|
||||
foreach ($_POST['form']['FIELDS'] as $aRow) {
|
||||
if ($aRow['FLD_KEY'] == 'on') {
|
||||
$aKeys[] = $aRow;
|
||||
if(isset($aRow['CASE_VARIABLE']))
|
||||
$aDynavars[] = array('FLD_UID'=>$aRow['FLD_UID'],'CASE_VARIABLE'=>$aRow['CASE_VARIABLE']);
|
||||
else
|
||||
$aDynavars[] = array('FLD_UID'=>$aRow['FLD_UID'],'CASE_VARIABLE'=>'');
|
||||
}
|
||||
else {
|
||||
$aNoKeys[] = $aRow;
|
||||
}
|
||||
}
|
||||
//print_r($_POST);
|
||||
$aDynavars = serialize($aDynavars);
|
||||
//var_dump($aKeys);
|
||||
//print_r($aDynavars);
|
||||
//die;
|
||||
$_POST['form']['FIELDS'] = array();
|
||||
$i = 1;
|
||||
foreach ($aKeys as $aRow) {
|
||||
$_POST['form']['FIELDS'][$i] = $aRow;
|
||||
$i++;
|
||||
}
|
||||
foreach ($aNoKeys as $aRow) {
|
||||
$_POST['form']['FIELDS'][$i] = $aRow;
|
||||
$i++;
|
||||
}
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
require_once 'classes/model/Fields.php';
|
||||
$oFields = new Fields();
|
||||
|
||||
if ($_POST['form']['ADD_TAB_UID'] == '') {
|
||||
|
||||
// We verified that the table does not exist.
|
||||
$aNameTable = $oAdditionalTables->loadByName($_POST['form']['ADD_TAB_NAME']);
|
||||
if(is_array($aNameTable)) {
|
||||
G::SendMessageText('There is already a table named "' . $_POST['form']['ADD_TAB_NAME'] . '" in the database. Table creation canceled.', 'warning');
|
||||
G::header('Location: additionalTablesList');
|
||||
die;
|
||||
}
|
||||
// Reserved Words
|
||||
$aReservedWords = array ('ALTER', 'CLOSE', 'COMMIT', 'CREATE', 'DECLARE',
|
||||
'DELETE', 'DROP', 'FETCH', 'FUNCTION', 'GRANT',
|
||||
'INDEX', 'INSERT', 'OPEN', 'REVOKE', 'ROLLBACK',
|
||||
'SELECT', 'SYNONYM', 'TABLE', 'UPDATE', 'VIEW' );
|
||||
if (in_array(strtoupper($_POST['form']['ADD_TAB_NAME']), $aReservedWords) ) {
|
||||
G::SendMessageText('Could not create the table with the name "' . $_POST['form']['ADD_TAB_NAME'] . '" because it is a reserved word.', 'warning');
|
||||
G::header('Location: additionalTablesList');
|
||||
die;
|
||||
}
|
||||
|
||||
$arrFields = $_POST['form']['FIELDS'];
|
||||
$newaFields = array();
|
||||
foreach ($arrFields as $arrField){
|
||||
$arrField['FLD_NAME'] = strtoupper($arrField['FLD_NAME']);
|
||||
$newaFields[] = $arrField;
|
||||
}
|
||||
|
||||
$sAddTabUid = $oAdditionalTables->create(array('ADD_TAB_NAME' => $_POST['form']['ADD_TAB_NAME'],
|
||||
'ADD_TAB_CLASS_NAME' => $_POST['form']['ADD_TAB_CLASS_NAME'],
|
||||
'ADD_TAB_DESCRIPTION' => $_POST['form']['ADD_TAB_DESCRIPTION'],
|
||||
'ADD_TAB_SDW_LOG_INSERT' => ($_POST['form']['ADD_TAB_SDW_LOG_INSERT'] == 'on' ? 1 : 0),
|
||||
'ADD_TAB_SDW_LOG_UPDATE' => ($_POST['form']['ADD_TAB_SDW_LOG_UPDATE'] == 'on' ? 1 : 0),
|
||||
'ADD_TAB_SDW_LOG_DELETE' => ($_POST['form']['ADD_TAB_SDW_LOG_DELETE'] == 'on' ? 1 : 0),
|
||||
'ADD_TAB_SDW_LOG_SELECT' => ($_POST['form']['ADD_TAB_SDW_LOG_SELECT'] == 'on' ? 1 : 0),
|
||||
'ADD_TAB_SDW_MAX_LENGTH' => $_POST['form']['ADD_TAB_SDW_MAX_LENGTH'],
|
||||
'ADD_TAB_SDW_AUTO_DELETE' => ($_POST['form']['ADD_TAB_SDW_AUTO_DELETE'] == 'on' ? 1 : 0),
|
||||
'ADD_TAB_DYNAVARS' => $aDynavars,
|
||||
'ADD_TAB_PLG_UID' => ''), $newaFields);
|
||||
$aFields = array();
|
||||
/*$aFields[] = array('sType' => 'INT',
|
||||
'iSize' => '11',
|
||||
'sFieldName' => 'PM_UNIQUE_ID',
|
||||
'bNull' => 0,
|
||||
'bAI' => 1,
|
||||
'bPrimaryKey' => 1);*/
|
||||
foreach ($_POST['form']['FIELDS'] as $iRow => $aRow) {
|
||||
$oFields->create(array('FLD_INDEX' => $iRow,
|
||||
'ADD_TAB_UID' => $sAddTabUid,
|
||||
'FLD_NAME' => strtoupper($_POST['form']['FIELDS'][$iRow]['FLD_NAME']),
|
||||
'FLD_DESCRIPTION' => $_POST['form']['FIELDS'][$iRow]['FLD_DESCRIPTION'],
|
||||
'FLD_TYPE' => $_POST['form']['FIELDS'][$iRow]['FLD_TYPE'],
|
||||
'FLD_SIZE' => $_POST['form']['FIELDS'][$iRow]['FLD_SIZE'],
|
||||
'FLD_NULL' => ($_POST['form']['FIELDS'][$iRow]['FLD_NULL'] == 'on' ? 1 : 0),
|
||||
'FLD_AUTO_INCREMENT' => ($_POST['form']['FIELDS'][$iRow]['FLD_AUTO_INCREMENT'] == 'on' ? 1 : 0),
|
||||
'FLD_KEY' => ($_POST['form']['FIELDS'][$iRow]['FLD_KEY'] == 'on' ? 1 : 0),
|
||||
'FLD_FOREIGN_KEY' => ($_POST['form']['FIELDS'][$iRow]['FLD_FOREIGN_KEY'] == 'on' ? 1 : 0),
|
||||
'FLD_FOREIGN_KEY_TABLE' => $_POST['form']['FIELDS'][$iRow]['FLD_FOREIGN_KEY_TABLE']));
|
||||
$aFields[] = array('sType' => $_POST['form']['FIELDS'][$iRow]['FLD_TYPE'],
|
||||
'iSize' => $_POST['form']['FIELDS'][$iRow]['FLD_SIZE'],
|
||||
'sFieldName' => strtoupper($_POST['form']['FIELDS'][$iRow]['FLD_NAME']),
|
||||
'bNull' => ($_POST['form']['FIELDS'][$iRow]['FLD_NULL'] == 'on' ? 1 : 0),
|
||||
'bAI' => ($_POST['form']['FIELDS'][$iRow]['FLD_AUTO_INCREMENT'] == 'on' ? 1 : 0),
|
||||
'bPrimaryKey' => ($_POST['form']['FIELDS'][$iRow]['FLD_KEY'] == 'on' ? 1 : 0));
|
||||
}
|
||||
$oAdditionalTables->createTable($_POST['form']['ADD_TAB_NAME'], 'wf', $aFields);
|
||||
$oAdditionalTables->createPropelClasses($_POST['form']['ADD_TAB_NAME'], $_POST['form']['ADD_TAB_CLASS_NAME'], $newaFields, $sAddTabUid);
|
||||
}
|
||||
else {
|
||||
$aData = $oAdditionalTables->load($_POST['form']['ADD_TAB_UID'], true);
|
||||
$oAdditionalTables->update(array('ADD_TAB_UID' => $_POST['form']['ADD_TAB_UID'],
|
||||
'ADD_TAB_NAME' => $_POST['form']['ADD_TAB_NAME'],
|
||||
'ADD_TAB_CLASS_NAME' => $_POST['form']['ADD_TAB_CLASS_NAME'],
|
||||
'ADD_TAB_DESCRIPTION' => $_POST['form']['ADD_TAB_DESCRIPTION'],
|
||||
'ADD_TAB_SDW_LOG_INSERT' => ($_POST['form']['ADD_TAB_SDW_LOG_INSERT'] == 'on' ? 1 : 0),
|
||||
'ADD_TAB_SDW_LOG_UPDATE' => ($_POST['form']['ADD_TAB_SDW_LOG_UPDATE'] == 'on' ? 1 : 0),
|
||||
'ADD_TAB_SDW_LOG_DELETE' => ($_POST['form']['ADD_TAB_SDW_LOG_DELETE'] == 'on' ? 1 : 0),
|
||||
'ADD_TAB_SDW_LOG_SELECT' => ($_POST['form']['ADD_TAB_SDW_LOG_SELECT'] == 'on' ? 1 : 0),
|
||||
'ADD_TAB_SDW_MAX_LENGTH' => $_POST['form']['ADD_TAB_SDW_MAX_LENGTH'],
|
||||
'ADD_TAB_SDW_AUTO_DELETE' => ($_POST['form']['ADD_TAB_SDW_AUTO_DELETE'] == 'on' ? 1 : 0),
|
||||
'ADD_TAB_DYNAVARS' => $aDynavars,
|
||||
'ADD_TAB_PLG_UID' => ''), $_POST['form']['FIELDS']);
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(FieldsPeer::ADD_TAB_UID, $_POST['form']['ADD_TAB_UID']);
|
||||
FieldsPeer::doDelete($oCriteria);
|
||||
$aNewFields = array();
|
||||
foreach ($_POST['form']['FIELDS'] as $iRow => $aField) {
|
||||
$sUID = $oFields->create(array('FLD_UID' => $_POST['form']['FIELDS'][$iRow]['FLD_UID'],
|
||||
'ADD_TAB_UID' => $_POST['form']['ADD_TAB_UID'],
|
||||
'FLD_INDEX' => $iRow,
|
||||
'FLD_NAME' => strtoupper($_POST['form']['FIELDS'][$iRow]['FLD_NAME']),
|
||||
'FLD_DESCRIPTION' => $_POST['form']['FIELDS'][$iRow]['FLD_DESCRIPTION'],
|
||||
'FLD_TYPE' => $_POST['form']['FIELDS'][$iRow]['FLD_TYPE'],
|
||||
'FLD_SIZE' => $_POST['form']['FIELDS'][$iRow]['FLD_SIZE'],
|
||||
'FLD_NULL' => ($_POST['form']['FIELDS'][$iRow]['FLD_NULL'] == 'on' ? 1 : 0),
|
||||
'FLD_AUTO_INCREMENT' => ($_POST['form']['FIELDS'][$iRow]['FLD_AUTO_INCREMENT'] == 'on' ? 1 : 0),
|
||||
'FLD_KEY' => ($_POST['form']['FIELDS'][$iRow]['FLD_KEY'] == 'on' ? 1 : 0),
|
||||
'FLD_FOREIGN_KEY' => ($_POST['form']['FIELDS'][$iRow]['FLD_FOREIGN_KEY'] == 'on' ? 1 : 0),
|
||||
'FLD_FOREIGN_KEY_TABLE' => $_POST['form']['FIELDS'][$iRow]['FLD_FOREIGN_KEY_TABLE']));
|
||||
$aNewFields[$sUID] = $aField;
|
||||
}
|
||||
$aOldFields = array();
|
||||
foreach ($aData['FIELDS'] as $aField) {
|
||||
$aOldFields[$aField['FLD_UID']] = $aField;
|
||||
}
|
||||
$oAdditionalTables->updateTable($_POST['form']['ADD_TAB_NAME'], 'wf', $aNewFields, $aOldFields);
|
||||
$oAdditionalTables->createPropelClasses($_POST['form']['ADD_TAB_NAME'], $_POST['form']['ADD_TAB_CLASS_NAME'], $_POST['form']['FIELDS'], $aData['ADD_TAB_UID']);
|
||||
}
|
||||
G::header('Location: additionalTablesList');
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesSaveData.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
unset($_POST['form']['btnSave']);
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
if (!$oAdditionalTables->saveDataInTable($_GET['sUID'], $_POST['form'])) {
|
||||
G::SendTemporalMessage('ID_DUPLICATE_ENTRY_PRIMARY_KEY', 'warning');
|
||||
}
|
||||
|
||||
G::header('Location: additionalTablesData?sUID=' . $_GET['sUID']);
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesToExport.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
global $RBAC;
|
||||
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
|
||||
$G_PUBLISH = new Publisher;
|
||||
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
|
||||
|
||||
$oHeadPublisher->addExtJsScript('additionalTables/additionalTablesExport', false); //adding a javascript file .js
|
||||
$oHeadPublisher->addContent('additionalTables/additionalTablesExport'); //adding a html file .html.
|
||||
|
||||
$toSend = Array();
|
||||
$toSend['UID_LIST'] = $_GET["sUID"];
|
||||
|
||||
|
||||
$oHeadPublisher->assign('EXPORT_TABLES', $toSend);
|
||||
G::RenderPage('publish', 'extJs');
|
||||
?>
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* processes_DownloadFile.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
//add more security, and catch any error or exception
|
||||
|
||||
/*
|
||||
* Author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*
|
||||
*/
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
//$G_SUB_MENU = 'setup';
|
||||
$G_ID_MENU_SELECTED = 'SETUP';
|
||||
//$G_ID_SUB_MENU_SELECTED = 'ADDITIONAL_TABLES';
|
||||
|
||||
$POST_MAX_SIZE = ini_get('post_max_size');
|
||||
$mul = substr($POST_MAX_SIZE, -1);
|
||||
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
||||
$postMaxSize = (int)$POST_MAX_SIZE * $mul;
|
||||
|
||||
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize');
|
||||
$mul = substr($UPLOAD_MAX_SIZE, -1);
|
||||
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
||||
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul;
|
||||
|
||||
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize;
|
||||
$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'additionalTables/additionalTablesToImport.xml', '', $Fields, 'additionalTablesDoImport');
|
||||
G::RenderPage('publishBlank', 'blank');
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* additionalTablesUpdateData.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
unset($_POST['form']['btnSave']);
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$oAdditionalTables->updateDataInTable($_GET['sUID'], $_POST['form']);
|
||||
|
||||
G::header('Location: additionalTablesData?sUID=' . $_GET['sUID']. '&r='.rand());
|
||||
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* data_additionalTablesList.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
|
||||
G::LoadClass('configuration');
|
||||
$co = new Configurations();
|
||||
$config = $co->getConfiguration('additionalTablesData', 'pageSize','',$_SESSION['USER_LOGGED']);
|
||||
$limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20;
|
||||
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
|
||||
$limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size;
|
||||
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$oAdditionalTables->createXmlList($_GET['sUID']);
|
||||
|
||||
$ocaux = $oAdditionalTables->getDataCriteria($_GET['sUID']);
|
||||
$rsc = AdditionalTablesPeer::doSelectRS($ocaux);
|
||||
$rsc->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$total_rows = 0;
|
||||
while ($rsc->next()){
|
||||
$total_rows++;
|
||||
}
|
||||
|
||||
$ocaux1 = $oAdditionalTables->getDataCriteria($_GET['sUID']);
|
||||
$ocaux1->setLimit($limit);
|
||||
$ocaux1->setOffset($start);
|
||||
|
||||
$rs = AdditionalTablesPeer::DoSelectRs ($ocaux1);
|
||||
$rs->setFetchmode (ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$rows = Array();
|
||||
while($rs->next()){
|
||||
$rows[] = $rs->getRow();
|
||||
}
|
||||
echo '{rows: '.G::json_encode($rows).', total_rows: '.$total_rows.'}';
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* data_additionalTablesList.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
|
||||
$oCriteria->addSelectColumn("'".G::LoadTranslation('ID_ACTION_EXPORT')."' as 'CH_SCHEMA'");
|
||||
$oCriteria->addSelectColumn("'".G::LoadTranslation('ID_ACTION_EXPORT')."' as 'CH_DATA'");
|
||||
|
||||
$uids = explode(',',$_GET['aUID']);
|
||||
|
||||
foreach ($uids as $UID){
|
||||
if (!isset($CC)){
|
||||
$CC = $oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_UID, $UID ,Criteria::EQUAL);
|
||||
}else{
|
||||
$CC->addOr($oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_UID, $UID ,Criteria::EQUAL));
|
||||
}
|
||||
}
|
||||
$oCriteria->add($CC);
|
||||
$oCriteria->addAnd($oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_UID, '', Criteria::NOT_EQUAL));
|
||||
|
||||
$oDataset = AdditionalTablesPeer::doSelectRS ( $oCriteria );
|
||||
$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
$addTables = Array();
|
||||
while( $oDataset->next() ) {
|
||||
$addTables[] = $oDataset->getRow();
|
||||
}
|
||||
echo G::json_encode($addTables);
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* data_additionalTablesList.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
G::LoadClass('configuration');
|
||||
$co = new Configurations();
|
||||
$config = $co->getConfiguration('additionalTablesList', 'pageSize','',$_SESSION['USER_LOGGED']);
|
||||
$env = $co->getConfiguration('ENVIRONMENT_SETTINGS', '');
|
||||
$limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20;
|
||||
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
|
||||
$limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size;
|
||||
$filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : '';
|
||||
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
|
||||
$oCriteria->add(AdditionalTablesPeer::PRO_UID, '', Criteria::EQUAL);
|
||||
if ($filter!=''){
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_NAME, '%'.$filter.'%',Criteria::LIKE)->addOr(
|
||||
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_DESCRIPTION, '%'.$filter.'%',Criteria::LIKE)));
|
||||
}
|
||||
$total_tables = AdditionalTablesPeer::doCount($oCriteria);
|
||||
//$oDataset = AdditionalTablesPeer::doSelectRS ( $oCriteria );
|
||||
//$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
//$oDataset->next();
|
||||
//$row = $oDataset->getRow();
|
||||
//$total_tables = $row['CNT'];
|
||||
|
||||
$oCriteria->clear();
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
|
||||
$oCriteria->add(AdditionalTablesPeer::ADD_TAB_UID, '', Criteria::NOT_EQUAL);
|
||||
$oCriteria->add(AdditionalTablesPeer::PRO_UID, '', Criteria::EQUAL);
|
||||
if ($filter!=''){
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_NAME, '%'.$filter.'%',Criteria::LIKE)->addOr(
|
||||
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_DESCRIPTION, '%'.$filter.'%',Criteria::LIKE)));
|
||||
}
|
||||
|
||||
$oCriteria->setLimit($limit);
|
||||
$oCriteria->setOffset($start);
|
||||
|
||||
$oDataset = AdditionalTablesPeer::doSelectRS ( $oCriteria );
|
||||
$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
$addTables = Array();
|
||||
while( $oDataset->next() ) {
|
||||
$addTables[] = $oDataset->getRow();
|
||||
}
|
||||
echo '{tables: '.G::json_encode($addTables).', total_tables: '.$total_tables.'}';
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* processes_DownloadFile.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
//add more security, and catch any error or exception
|
||||
|
||||
/*
|
||||
* Author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*
|
||||
*/
|
||||
|
||||
$PUBLIC_ROOT_PATH = PATH_DATA.'sites'.PATH_SEP.SYS_SYS.PATH_SEP.'public'.PATH_SEP;
|
||||
$sFileName = $_GET['f'];
|
||||
|
||||
$realPath = $PUBLIC_ROOT_PATH . $sFileName;
|
||||
G::streamFile ( $realPath, true );
|
||||
unlink($realPath);
|
||||
Reference in New Issue
Block a user