BUG 000 PM tables ver2 ready - propel & phing integration

This commit is contained in:
Erik Amaru Ortiz
2011-08-29 11:39:22 -04:00
parent 5b0da08227
commit f7fcd0472d
46 changed files with 826 additions and 5278 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -84,7 +84,7 @@ class DbSource extends BaseDbSource
return $oCriteria;
}
public function load($Uid, $ProUID)
public function load($Uid, $ProUID='')
{
try {
$oRow = DbSourcePeer::retrieveByPK($Uid, $ProUID);

View File

@@ -74,9 +74,9 @@ class FieldsMapBuilder {
$tMap->addColumn('FLD_DESCRIPTION', 'FldDescription', 'string', CreoleTypes::LONGVARCHAR, true, null);
$tMap->addColumn('FLD_TYPE', 'FldType', 'string', CreoleTypes::VARCHAR, true, 10);
$tMap->addColumn('FLD_TYPE', 'FldType', 'string', CreoleTypes::VARCHAR, true, 20);
$tMap->addColumn('FLD_SIZE', 'FldSize', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addColumn('FLD_SIZE', 'FldSize', 'int', CreoleTypes::INTEGER, false, null);
$tMap->addColumn('FLD_NULL', 'FldNull', 'int', CreoleTypes::TINYINT, true, null);

View File

@@ -74,7 +74,7 @@ abstract class BaseFields extends BaseObject implements Persistent {
* The value for the fld_size field.
* @var int
*/
protected $fld_size = 1;
protected $fld_size = 0;
/**
@@ -458,7 +458,7 @@ abstract class BaseFields extends BaseObject implements Persistent {
$v = (int) $v;
}
if ($this->fld_size !== $v || $v === 1) {
if ($this->fld_size !== $v || $v === 0) {
$this->fld_size = $v;
$this->modifiedColumns[] = FieldsPeer::FLD_SIZE;
}

View File

@@ -2080,8 +2080,8 @@
<column name="FLD_INDEX" type="INTEGER" required="true" default="1"/>
<column name="FLD_NAME" type="VARCHAR" size="60" required="true" default=""/>
<column name="FLD_DESCRIPTION" type="LONGVARCHAR" required="true"/>
<column name="FLD_TYPE" type="VARCHAR" size="10" required="true" default=""/>
<column name="FLD_SIZE" type="INTEGER" required="true" default="1"/>
<column name="FLD_TYPE" type="VARCHAR" size="20" required="true" default=""/>
<column name="FLD_SIZE" type="INTEGER" required="false" default="0"/>
<column name="FLD_NULL" type="TINYINT" required="true" default="1"/>
<column name="FLD_AUTO_INCREMENT" type="TINYINT" required="true" default="0"/>
<column name="FLD_KEY" type="TINYINT" required="true" default="0"/>

View File

@@ -57,40 +57,50 @@ class pmTables extends Controller
public function edit($httpData)
{
require_once PATH_CONTROLLERS . 'pmTablesProxy.php';
$addTabUid = isset($httpData->id) ? $httpData->id : false;
$table = false;
$repTabPluginPermissions = false;
$additionalTables = new AdditionalTables();
require_once 'classes/model/AdditionalTables.php';
G::loadClass('pmTable');
if ($addTabUid !== false) { // if is a edit request
require_once 'classes/model/AdditionalTables.php';
$additionalTables = new AdditionalTables();
$table = false;
$addTabUid = isset($httpData->id) ? $httpData->id : false;
$dataNumRows = 0;
$repTabPluginPermissions = false;
$columnsTypes = PmTable::getPropelSupportedColumnTypes();
$jsFile = isset($httpData->tableType) && $httpData->tableType == 'report' ? 'editReport' : 'edit';
$columnsTypesList = array();
foreach ($columnsTypes as $columnTypeName => $columnType) {
$columnsTypesList[] = array($columnTypeName, $columnType);
}
if ($addTabUid) {
$tableData = $additionalTables->getAllData($httpData->id, 0, 2);
$dataNumRows = $tableData['count'];
}
if ($addTabUid !== false) { // if it is a edit request
$tableFields = array();
$fieldsList = array();
$table = $additionalTables->load($addTabUid, true);
//fix for backware compatibility
$table['DBS_UID'] = $table['DBS_UID'] == null || $table['DBS_UID'] == '' ? 'workflow': $table['DBS_UID'];
$_SESSION['ADD_TAB_UID'] = $addTabUid;
//list dynaform fields
switch ($table['ADD_TAB_TYPE']) {
case 'NORMAL':
case 'GRID':
if ($table['ADD_TAB_TYPE'] == 'NORMAL' || $table['ADD_TAB_TYPE'] == 'GRID') {
$repTabPluginPermissions = $this->_getSimpleReportPluginDef();
break;
}
}
$jsFile = isset($httpData->tableType) && $httpData->tableType == 'report' ? 'editReport' : 'edit';
$this->includeExtJS('pmTables/' . $jsFile, $this->debug);
//fix for backware compatibility
if ($table) {
$table['DBS_UID'] = $table['DBS_UID'] == null || $table['DBS_UID'] == '' ? 'workflow': $table['DBS_UID'];
}
$this->includeExtJS('pmTables/' . $jsFile);
$this->setJSVar('ADD_TAB_UID', $addTabUid);
$this->setJSVar('PRO_UID', isset($_GET['PRO_UID'])? $_GET['PRO_UID'] : false);
$this->setJSVar('TABLE', $table);
$this->setJSVar('dbg', isset($httpData->dbg));
$this->setJSVar('columnsTypes', $columnsTypesList);
$this->setJSVar('dataNumRows', $dataNumRows);
$this->setJSVar('_plugin_permissions', $repTabPluginPermissions);
G::RenderPage('publish', 'extJs');
@@ -108,6 +118,7 @@ class pmTables extends Controller
$this->includeExtJS('pmTables/data', $this->debug);
$this->setJSVar('tableDef', $tableDef);
//g::pr($tableDef['FIELDS']);
G::RenderPage('publish', 'extJs');
}

View File

@@ -178,7 +178,7 @@ class pmTablesProxy extends HttpProxyController
* save pm table
*/
public function save()
{
{
require_once 'classes/model/AdditionalTables.php';
require_once 'classes/model/Fields.php';
try {
@@ -186,25 +186,53 @@ class pmTablesProxy extends HttpProxyController
$data['PRO_UID'] = trim($data['PRO_UID']);
$data['columns'] = G::json_decode($_POST['columns']); //decofing data columns
$isReportTable = $data['PRO_UID'] != '' ? true : false;
// Reserved Words
$aReservedWords = array(
'ALTER', 'CLOSE', 'COMMIT', 'CREATE', 'DECLARE',
'DELETE', 'DROP', 'FETCH', 'FUNCTION', 'GRANT',
'INDEX', 'INSERT', 'OPEN', 'REVOKE', 'ROLLBACK',
'SELECT', 'SYNONYM', 'TABLE', 'UPDATE', 'VIEW',
'APP_UID', 'ROW'
);
$oAdditionalTables = new AdditionalTables();
$oFields = new Fields();
$repTabClassName = $oAdditionalTables->getPHPName($data['REP_TAB_NAME']);
$columns = $data['columns'];
// Reserved Words
$reservedWords = array(
'ALTER', 'CLOSE', 'COMMIT', 'CREATE', 'DECLARE', 'DELETE', 'DROP', 'FETCH', 'FUNCTION', 'GRANT',
'INDEX', 'INSERT', 'OPEN', 'REVOKE', 'ROLLBACK', 'SELECT', 'SYNONYM', 'TABLE', 'UPDATE', 'VIEW', 'APP_UID', 'ROW'
);
// verify if exists.
$aNameTable = $oAdditionalTables->loadByName($data['REP_TAB_NAME']);
if ($data['REP_TAB_UID'] == '') { //new report table
if ($isReportTable) { //setting default columns
$defaultColumns = $this->_getReportTableDefaultColumns($data['REP_TAB_TYPE']);
$columns = array_merge($defaultColumns, $columns);
}
/** validations **/
if(is_array($oAdditionalTables->loadByName($data['REP_TAB_NAME']))) {
throw new Exception('The table "' . $data['REP_TAB_NAME'] . '" already exits.');
}
$repTabClassName = $oAdditionalTables->getPHPName($data['REP_TAB_NAME']);
if (in_array(strtoupper($data['REP_TAB_NAME']), $reservedWords) ) {
throw new Exception('Could not create the table with the name "' . $data['REP_TAB_NAME'] . '" because it is a reserved word.');
}
}
//backward compatility
foreach ($columns as $i => $column) {
switch ($column->field_type) {
case 'INT': $columns[$i]->field_type = 'INTEGER'; break;
case 'TEXT': $columns[$i]->field_type = 'LONGVARCHAR'; break;
}
}
$repTabData = array(
G::loadClass('pmTable');
ob_start();
$pmTable = new pmTable($data['REP_TAB_NAME']);
$pmTable->setDataSource($data['REP_TAB_CONNECTION']);
$pmTable->setColumns($columns);
$pmTable->build();
$buildResult = ob_get_contents();
ob_end_clean();
// Updating additional table struture information
$addTabData = array(
'ADD_TAB_UID' => $data['REP_TAB_UID'],
'ADD_TAB_NAME' => $data['REP_TAB_NAME'],
'ADD_TAB_CLASS_NAME' => $repTabClassName,
@@ -215,60 +243,22 @@ class pmTablesProxy extends HttpProxyController
'ADD_TAB_TYPE' => $data['REP_TAB_TYPE'],
'ADD_TAB_GRID' => $data['REP_TAB_GRID']
);
$columns = $data['columns'];
if ($data['REP_TAB_UID'] == '') { //new report table
if ($isReportTable) { //setting default columns
$defaultColumns = $this->_getReportTableDefaultColumns($data['REP_TAB_TYPE']);
$columns = array_merge($defaultColumns, $columns);
}
/** validations **/
if(is_array($aNameTable)) {
throw new Exception('The table "' . $data['REP_TAB_NAME'] . '" already exits.');
}
if (in_array(strtoupper($data['REP_TAB_NAME']), $aReservedWords) ) {
throw new Exception('Could not create the table with the name "' . $data['REP_TAB_NAME'] . '" because it is a reserved word.');
}
//create record
$addTabUid = $oAdditionalTables->create($repTabData);
$addTabUid = $oAdditionalTables->create($addTabData);
} else { //editing report table
$addTabUid = $data['REP_TAB_UID'];
//loading old data before update
$addTabBeforeData = $oAdditionalTables->load($addTabUid, true);
//updating record
$oAdditionalTables->update($repTabData);
$addTabUid = $data['REP_TAB_UID'];
$oAdditionalTables->update($addTabData);
//removing old data fields references
$oCriteria = new Criteria('workflow');
$oCriteria->add(FieldsPeer::ADD_TAB_UID, $data['REP_TAB_UID']);
//$oCriteria->add(FieldsPeer::FLD_NAME, 'APP_UID', Criteria::NOT_EQUAL);
//$oCriteria->add(FieldsPeer::FLD_NAME, 'ROW', Criteria::NOT_EQUAL);
FieldsPeer::doDelete($oCriteria);
//getting old fieldnames
$oldFields = array();
foreach ($addTabBeforeData['FIELDS'] as $field) {
$oldFields[$field['FLD_UID']] = $field;
}
}
$aFields = array();
$fieldsList = array();
$editFieldsList = array();
// Updating pmtable fields
foreach ($columns as $i => $column) {
//new feature, to reorder the columns
// if (isset($oldFields[$column->uid])) { // the the field alreaday exists
// if ($oldFields[$column->uid]['FLD_INDEX'] != $i) { // if its index has changed
// $column->uid = ''; //set as new field,
// }
// }
$field = array(
'FLD_UID' => $column->uid,
'FLD_INDEX' => $i,
@@ -276,50 +266,40 @@ class pmTablesProxy extends HttpProxyController
'FLD_NAME' => $column->field_name,
'FLD_DESCRIPTION' => $column->field_label,
'FLD_TYPE' => $column->field_type,
'FLD_SIZE' => $column->field_size,
'FLD_NULL' => (isset($column->field_null) && $column->field_null ? 1 : 0),
'FLD_AUTO_INCREMENT' => (isset($column->field_bai) && $column->field_bai ? 1 : 0),
'FLD_KEY' => (isset($column->field_key) && $column->field_key ? 1 : 0),
'FLD_SIZE' => $column->field_size=='' ? NULL : $column->field_size,
'FLD_NULL' => $column->field_null ? 1 : 0,
'FLD_AUTO_INCREMENT' => $column->field_autoincrement ? 1 : 0,
'FLD_KEY' => $column->field_key ? 1 : 0,
'FLD_FOREIGN_KEY' => 0,
'FLD_FOREIGN_KEY_TABLE' => '',
'FLD_DYN_NAME' => $column->field_dyn,
'FLD_DYN_UID' => $column->field_uid,
'FLD_FILTER' => (isset($column->field_filter) && $column->field_filter ? 1 : 0)
'FLD_FILTER' => (isset($column->field_filter) && $column->field_filter) ? 1 : 0
);
$fieldUid = $oFields->create($field);
$fieldsList[] = $field;
if($data['REP_TAB_UID'] == '') { //new
$aFields[] = array(
'sType' => $column->field_type,
'iSize' => $column->field_size,
'sFieldName' => $column->field_name,
'bNull' => (isset($column->field_null) ? $column->field_null : 1),
'bAI' => (isset($column->field_bai) ? $column->field_bai : 0),
'bPrimaryKey' => (isset($column->field_key) ? $column->field_key : 0)
);
} else { //editing
$field['FLD_UID'] = $fieldUid;
$aFields[$fieldUid] = $field;
}
}
if ($data['REP_TAB_UID'] == '') { //create a new report table
$oAdditionalTables->createTable($data['REP_TAB_NAME'], $data['REP_TAB_CONNECTION'], $aFields);
} else { //editing
//print_R($aFields);
$oAdditionalTables->updateTable($data['REP_TAB_NAME'], $data['REP_TAB_CONNECTION'], $aFields, $oldFields);
}
$oAdditionalTables->createPropelClasses($data['REP_TAB_NAME'], '', $fieldsList, $addTabUid, $data['REP_TAB_CONNECTION']);
if ($isReportTable) {
$oAdditionalTables->populateReportTable($data['REP_TAB_NAME'], $data['REP_TAB_CONNECTION'], $data['REP_TAB_TYPE'], $fieldsList, $data['PRO_UID'], $data['REP_TAB_GRID']);
$oFields->create($field);
}
// if ($isReportTable) {
// $oAdditionalTables->populateReportTable($data['REP_TAB_NAME'], $data['REP_TAB_CONNECTION'], $data['REP_TAB_TYPE'], $fieldsList, $data['PRO_UID'], $data['REP_TAB_GRID']);
// }
$result->success = true;
$result->msg = $buildResult;
} catch (Exception $e) {
$buildResult = ob_get_contents();
ob_end_clean();
$result->success = false;
$result->msg = $e->getMessage();
// if it is a propel exception message
if (preg_match('/(.*)\s\[(.*):\s(.*)\]\s\[(.*):\s(.*)\]/', $e->getMessage(), $match)) {
$result->msg = $match[3];
$result->type = ucfirst($pmTable->getDbConfig()->adapter);
}
else {
$result->msg = $e->getMessage();
$result->type = G::loadTranslation('ID_EXCEPTION');
}
$result->trace = $e->getTraceAsString();
}
@@ -332,16 +312,16 @@ class pmTablesProxy extends HttpProxyController
*/
public function delete($httpData)
{
G::LoadClass('reportTables');
$rows = G::json_decode(stripslashes($httpData->rows));
$rp = new reportTables();
$at = new AdditionalTables();
try {
foreach ($rows as $row ) {
if($row->type == 'CLASSIC') {
G::LoadClass('reportTables');
$rp = new reportTables();
$rp->deleteReportTable($row->id);
} else {
$at = new AdditionalTables();
$at->deleteAll($row->id);
}
}
@@ -415,7 +395,8 @@ class pmTablesProxy extends HttpProxyController
throw new Exception("ERROR: $className class file doesn't exit!");
}
require_once $sPath . $this->className . '.php';
//require_once $sPath . $this->className . '.php';
require_once 'classes/' . $this->className . '.php';
$toSave = false;
if (is_array($rows)) { //multiple
@@ -1043,6 +1024,7 @@ class pmTablesProxy extends HttpProxyController
$application->field_key = 1;
$application->field_null = 0;
$application->field_filter = false;
$application->field_autoincrement = false;
array_push($defaultColumns, $application);
$application = new stdClass(); //APP_NUMBER
@@ -1051,12 +1033,13 @@ class pmTablesProxy extends HttpProxyController
$application->field_uid = '';
$application->field_name = 'APP_NUMBER';
$application->field_label = 'APP_NUMBER';
$application->field_type = 'INT';
$application->field_type = 'INTEGER';
$application->field_size = 11;
$application->field_dyn = '';
$application->field_key = 0;
$application->field_null = 0;
$application->field_filter = false;
$application->field_autoincrement = false;
array_push($defaultColumns, $application);
//if it is a grid report table
@@ -1067,12 +1050,13 @@ class pmTablesProxy extends HttpProxyController
$gridIndex->field_uid = '';
$gridIndex->field_name = 'ROW';
$gridIndex->field_label = 'ROW';
$gridIndex->field_type = 'INT';
$gridIndex->field_type = 'INTEGER';
$gridIndex->field_size = '11';
$gridIndex->field_dyn = '';
$gridIndex->field_key = 1;
$gridIndex->field_null = 0;
$gridIndex->field_filter = false;
$application->field_autoincrement = false;
array_push($defaultColumns, $gridIndex);
}

View File

@@ -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;
}
}
}
}
}

View File

@@ -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');

View File

@@ -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);

View File

@@ -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');

View File

@@ -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;
}

View File

@@ -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');

View File

@@ -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');

View File

@@ -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');

View File

@@ -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;
}
}

View File

@@ -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');

View File

@@ -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');*/

View File

@@ -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');

View File

@@ -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');

View File

@@ -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']);

View File

@@ -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');
?>

View File

@@ -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');

View File

@@ -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());

View File

@@ -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.'}';

View File

@@ -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);

View File

@@ -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.'}';

View File

@@ -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);

View File

@@ -1,19 +0,0 @@
<?php
require_once '{pathClasses}/' . SYS_SYS . '/classes/om/Base{className}.php';
/**
* Skeleton subclass for representing a row from the '{tableName}' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package classes.model
*/
class {className} extends Base{className} {
} // {className}

Some files were not shown because too many files have changed in this diff Show More