BUG 0000 Report tables ver2, improvements and unification with PMTables

(first commit)
This commit is contained in:
Erik Amaru Ortiz
2011-07-08 19:06:32 -04:00
parent 5493e6155c
commit 4c6fb8d7ab
20 changed files with 3691 additions and 27 deletions

View File

@@ -21,6 +21,8 @@ class Controller
private $headPublisher;
public $ExtVar = Array();
public $controllerClass = '';
public function __construct()
{
@@ -97,7 +99,15 @@ class Controller
$this->$name($this->__request__);
} catch (Exception $e) {
new PMException($e->getMessage(), 1);
$template = new TemplatePower(PATH_TEMPLATE . 'controller.exception.tpl');
$template->prepare();
$template->assign('controller', get_called_class());
$template->assign('message', $e->getMessage());
$template->assign('file', $e->getFile());
$template->assign('line', $e->getLine());
$template->assign('trace', $e->getTraceAsString());
echo $template->getOutputContent();
}
}

View File

@@ -97,6 +97,7 @@ class HttpProxyController {
$result->exception->class = get_class($e);
$result->exception->code = $e->getCode();
$result->exception->trace = $e->getTraceAsString();
}
print G::json_encode($result);
}

View File

@@ -0,0 +1,58 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Server Error :: </title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<style>
.box {
-moz-border-radius:6px; /* Rounded edges in Firefox */
background-image: url(/images/classic/info.gif);
color :#000;
border-style:solid;
border-width:1px;
border-color:#000;
font :normal 8pt Tahoma,sans-serif,MiscFixed;
text-decoration:none;
padding:0 20px;
vertical-align:middle;
font-weight: bold;
background-color:#DBDBDB;
}
</style>
<body>
<div class='box'>
<br />
<br />
<table width="70%" border="0" align="center" cellpadding="0" cellspacing="0" class="mainCopy">
<tr>
<td width="15%" align="left" scope="col">
<span class="mxbOnlineTextBlue">CONTROLLER EXCEPTION</span><br />
<hr/>
{message}<br /><br />
Controller: {controller}<br />
File: {file}<br />
Line: {line}
<br />
<br />
<table>
<tr><td><small><pre>{trace}</pre></small></td></tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>

View File

@@ -363,7 +363,7 @@ class spoolRun {
/**
* Posible Options for SMTPSecure are: "", "ssl" or "tls"
*/
if (preg_match('/^(ssl|tls)$/', $this->config['SMTPSecure'])) {
if (isset($this->config['SMTPSecure']) && preg_match('/^(ssl|tls)$/', $this->config['SMTPSecure'])) {
$oPHPMailer->SMTPSecure = $this->config['SMTPSecure'];
}

View File

@@ -253,7 +253,7 @@ class AdditionalTables extends BaseAdditionalTables {
}
function createTable($sTableName, $sConnection = '', $aFields = array()) {
$sTableName = $sTableName;
if ($sConnection == '' || $sConnection == 'wf') {
$sConnection = 'workflow';
}
@@ -425,6 +425,8 @@ class AdditionalTables extends BaseAdditionalTables {
}
function updateTable($sTableName, $sConnection = 'wf', $aNewFields = array(), $aOldFields = array()) {
$debug=false;
if ($sConnection == '' || $sConnection == 'wf') {
$sConnection = 'workflow';
}
@@ -455,11 +457,25 @@ class AdditionalTables extends BaseAdditionalTables {
$aFieldsToDelete[] = $aOldField;
}
}
if ($debug) {
echo 'new';
print_r($aNewFields);
echo 'old';
print_r($aOldFields);
echo 'to add';
print_r($aFieldsToAdd);
echo 'keys';
print_r($aKeys);
echo 'to delete';
print_r($aFieldsToDelete);
}
foreach ($aNewFields as $aNewField) {
if (isset($aOldFields[$aNewField['FLD_UID']])) {
$aOldField = $aOldFields[$aNewField['FLD_UID']];
$bEqual = true;
if (trim($aNewField['FLD_NAME']) != trim($aOldField['FLD_NAME'])) {
$bEqual = false;
}
@@ -483,7 +499,12 @@ class AdditionalTables extends BaseAdditionalTables {
$aFieldsToAlter[] = $aNewField;
}
}
}
}
if ($debug) {
echo 'to alter'; print_r($aFieldsToAlter);
}
G::LoadSystem('database_' . strtolower(DB_ADAPTER));
$oDataBase = new database(DB_ADAPTER, DB_HOST, DB_USER, DB_PASS, DB_NAME);
@@ -492,12 +513,28 @@ class AdditionalTables extends BaseAdditionalTables {
//$oDataBase->executeQuery($oDataBase->generateDropPrimaryKeysSQL($sTableName));
$con = Propel::getConnection($sConnection);
$stmt = $con->createStatement();
$sQuery = $oDataBase->generateDropPrimaryKeysSQL($sTableName);
if ($debug) {
echo 'sql drop pk';
var_dump($sQuery);
}
try {
$rs = $stmt->executeQuery($sQuery);
} catch(PDOException $oException ) {
throw $oException;
}
foreach ($aFieldsToDelete as $aFieldToDelete) {
//$oDataBase->executeQuery($oDataBase->generateDropColumnSQL($sTableName, strtoupper($aFieldToDelete['FLD_NAME'])));
$sQuery = $oDataBase->generateDropColumnSQL($sTableName, strtoupper($aFieldToDelete['FLD_NAME']));
if ($debug) {
echo 'sql drop field';
var_dump($sQuery);
}
$rs = $stmt->executeQuery($sQuery);
}
foreach ($aFieldsToAdd as $aFieldToAdd) {
switch ($aFieldToAdd['FLD_TYPE']) {
case 'VARCHAR':
@@ -540,17 +577,19 @@ class AdditionalTables extends BaseAdditionalTables {
//$oDataBase->executeQuery($oDataBase->generateAddColumnSQL($sTableName, strtoupper($aFieldToAdd['FLD_NAME']), $aData));
$sQuery = $oDataBase->generateAddColumnSQL($sTableName, strtoupper($aFieldToAdd['FLD_NAME']), $aData);
$rs = $stmt->executeQuery($sQuery);
}
foreach ($aFieldsToDelete as $aFieldToDelete) {
//$oDataBase->executeQuery($oDataBase->generateDropColumnSQL($sTableName, strtoupper($aFieldToDelete['FLD_NAME'])));
$sQuery = $oDataBase->generateDropColumnSQL($sTableName, strtoupper($aFieldToDelete['FLD_NAME']));
if ($debug) {
echo 'sql add';
var_dump($sQuery);
}
$rs = $stmt->executeQuery($sQuery);
}
//$oDataBase->executeQuery($oDataBase->generateAddPrimaryKeysSQL($sTableName, $aKeys));
$sQuery = $oDataBase->generateAddPrimaryKeysSQL($sTableName, $aKeys);
if ($debug) {
echo 'sql gen pk';
var_dump($sQuery);
}
$rs = $stmt->executeQuery($sQuery);
foreach ($aFieldsToAlter as $aFieldToAlter) {
@@ -595,6 +634,10 @@ class AdditionalTables extends BaseAdditionalTables {
//$oDataBase->executeQuery($oDataBase->generateChangeColumnSQL($sTableName, strtoupper($aFieldToAlter['FLD_NAME']), $aData, strtoupper($aFieldToAlter['FLD_NAME_OLD'])));
$sQuery = $oDataBase->generateChangeColumnSQL($sTableName, strtoupper($aFieldToAlter['FLD_NAME']), $aData, strtoupper($aFieldToAlter['FLD_NAME_OLD']));
if ($debug) {
echo 'sql alter';
var_dump($sQuery);
}
$rs = $stmt->executeQuery($sQuery);
}
}
@@ -603,7 +646,7 @@ class AdditionalTables extends BaseAdditionalTables {
}
}
function createPropelClasses($sTableName, $sClassName, $aFields, $sAddTabUid) {
function createPropelClasses($sTableName, $sClassName, $aFields, $sAddTabUid, $connection='workflow') {
try {
/*$aUID = array('FLD_NAME' => 'PM_UNIQUE_ID',
'FLD_TYPE' => 'INT',
@@ -632,14 +675,19 @@ class AdditionalTables extends BaseAdditionalTables {
$sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
if (!file_exists($sPath)) {
G::mk_dir($sPath);
G::mk_dir($sPath);
}
if (!file_exists($sPath . 'map')) {
G::mk_dir($sPath . 'map');
G::mk_dir($sPath . 'om');
}
if (!file_exists($sPath . 'om')) {
G::mk_dir($sPath . 'om');
}
$aData = array();
$aData['pathClasses'] = substr(PATH_DB, 0, -1);
$aData['tableName'] = $sTableName;
$aData['className'] = $sClassName;
$aData['connection'] = $connection;
$aData['GUID'] = $sAddTabUid;
$aData['firstColumn'] = strtoupper($aFields[1]['FLD_NAME']);
$aData['totalColumns'] = count($aFields);
@@ -770,13 +818,13 @@ class AdditionalTables extends BaseAdditionalTables {
break;
}
$aColumns[] = $aColumn;
if ($aField['FLD_KEY'] == 'on') {
if ($aField['FLD_KEY'] == 1 || $aField['FLD_KEY'] === 'on') {
$aPKs[] = $aColumn;
}
else {
$aNotPKs[] = $aColumn;
}
if ($aField['FLD_AUTO_INCREMENT'] == 'on') {
if ($aField['FLD_AUTO_INCREMENT'] == 1 || $aField['FLD_AUTO_INCREMENT'] === 'on') {
$aData['useIdGenerator'] = 'true';
}
$i++;
@@ -1027,11 +1075,12 @@ class AdditionalTables extends BaseAdditionalTables {
//deleting clases
$sClassName = $this->getPHPName($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $aData['ADD_TAB_NAME']);
$sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
@unlink($sPath . $sClassName . '.php');
@unlink($sPath . $sClassName . 'Peer.php');
@unlink($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName . 'MapBuilder.php');
@unlink($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . '.php');
@unlink($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . 'Peer.php');
@unlink($sPath . 'map' . PATH_SEP . $sClassName . 'MapBuilder.php');
@unlink($sPath . 'om' . PATH_SEP . 'Base' . $sClassName . '.php');
@unlink($sPath . 'om' . PATH_SEP . 'Base' . $sClassName . 'Peer.php');
}
catch (Exception $oError) {
throw($oError);
@@ -1119,7 +1168,10 @@ var additionalTablesDataDelete = function(sUID, sKeys) {
}
$sClassPeerName = $sClassName . 'Peer';
$oCriteria = new Criteria('workflow');
$con = Propel::getConnection($aData['DBS_UID']);
$oCriteria = new Criteria($aData['DBS_UID']);
var_dump($aData['DBS_UID']);
print_r($oCriteria);
//eval('$oCriteria->addSelectColumn(' . $sClassPeerName . '::PM_UNIQUE_ID);');
eval('$oCriteria->addSelectColumn("\'1\' AS DUMMY");');
foreach ($aData['FIELDS'] as $aField) {
@@ -1147,6 +1199,47 @@ var additionalTablesDataDelete = function(sUID, sKeys) {
}
}
function getAllData($sUID, $start=NULL, $limit=NULL)
{
$aData = $this->load($sUID, true);
$sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
$sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME']));
if (file_exists ($sPath . $sClassName . '.php') ) {
require_once $sPath . $sClassName . '.php';
} else {
return null;
}
$sClassPeerName = $sClassName . 'Peer';
$con = Propel::getConnection($aData['DBS_UID']);
$oCriteria = new Criteria($aData['DBS_UID']);
eval('$oCriteria->addSelectColumn("\'1\' AS DUMMY");');
foreach ($aData['FIELDS'] as $aField) {
eval('$oCriteria->addSelectColumn(' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ');');
}
$oCriteriaCount = clone $oCriteria;
$count = $sClassPeerName::doCount($oCriteria);
if (isset($limit)) {
$oCriteria->setLimit($limit);
}
if (isset($start)) {
$oCriteria->setOffset($start);
}
$rs = $sClassPeerName::doSelectRS($oCriteria);
$rs->setFetchmode (ResultSet::FETCHMODE_ASSOC);
$rows = Array();
while ($rs->next()) {
$rows[] = $rs->getRow();
}
return array('rows' => $rows, 'count' => $count);
}
function checkClassNotExist($sUID) {
try {
$aData = $this->load($sUID, true);
@@ -1366,6 +1459,8 @@ var additionalTablesDataDelete = function(sUID, sKeys) {
public function populateReportTable($sTableName, $sConnection = 'rp', $sType = 'NORMAL', $aFields = array(), $sProcessUid = '', $sGrid = '')
{
require_once "classes/model/Application.php";
$con = Propel::getConnection($sConnection);
$stmt = $con->createStatement();
if ($sType == 'GRID') {
@@ -1862,6 +1957,8 @@ var additionalTablesDataDelete = function(sUID, sKeys) {
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$addTables = Array();
$proUids = Array();
while( $oDataset->next() ) {
$row = $oDataset->getRow();
$row['PRO_TITLE'] = $row['PRO_DESCRIPTION'] = '';

View File

@@ -0,0 +1,243 @@
<?php
class pmTables extends Controller
{
public $debug = true;
public function index($httpData)
{
global $RBAC;
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
G::LoadClass('configuration');
$c = new Configurations();
$configPage = $c->getConfiguration('additionalTablesList', 'pageSize','',$_SESSION['USER_LOGGED']);
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$this->includeExtJS('pmTables/list', $this->debug);
$this->setView('pmTables/list');
//assigning js variables
$this->setJSVar('FORMATS',$c->getFormats());
$this->setJSVar('CONFIG', $Config);
$this->setJSVar('PRO_UID', isset($_GET['PRO_UID'])? $_GET['PRO_UID'] : false);
//render content
G::RenderPage('publish', 'extJs');
}
public function edit($httpData)
{
$addTabUid = isset($_GET['id']) ? $_GET['id'] : false;
$table = false;
$repTabPluginPermissions = false;
if ($addTabUid !== false) { // if is a edit request
require_once 'classes/model/AdditionalTables.php';
require_once 'classes/model/Fields.php';
$tableFields = array();
$fieldsList = array();
$additionalTables = new AdditionalTables();
$table = $additionalTables->load($addTabUid, true);
// list the case fields
foreach ($table['FIELDS'] as $i=>$field) {
$table['FIELDS'][$i]['FLD_KEY'] = $field['FLD_KEY'] == '1' ? TRUE: FALSE;
$table['FIELDS'][$i]['FLD_NULL'] = $field['FLD_NULL'] == '1' ? TRUE: FALSE;
$table['FIELDS'][$i]['FLD_FILTER'] = $field['FLD_FILTER'] == '1' ? TRUE: FALSE;
array_push($tableFields, $field['FLD_DYN_NAME']);
}
//list dynaform fields
switch ($table['ADD_TAB_TYPE']) {
case 'NORMAL':
$fields = $this->_getDynafields($table['PRO_UID']);
foreach ($fields as $field) {
//select to not assigned fields for available grid
if (!in_array($field['name'], $tableFields)) {
$fieldsList[] = array(
'FIELD_UID' => $field['name'] . '-' . $field['type'],
'FIELD_NAME' => $field['name']
);
}
}
$this->setJSVar('avFieldsList', $fieldsList);
$repTabPluginPermissions = $this->_getSimpleReportPluginDef();
$this->setJSVar('_plugin_permissions', $repTabPluginPermissions);
break;
case 'GRID':
list($gridName, $gridId) = explode('-', $table['ADD_TAB_GRID']);
// $G_FORM = new Form($table['PRO_UID'] . '/' . $gridId, PATH_DYNAFORM, SYS_LANG, false);
// $gridFields = $G_FORM->getVars(false);
$fieldsList = array();
$gridFields = $this->_getGridDynafields($table['PRO_UID'], $gridId);
foreach ($gridFields as $gfield) {
if (!in_array($gfield['name'], $tableFields)) {
$fieldsList[] = array(
'FIELD_UID' => $gfield['name'] . '-' . $gfield['type'],
'FIELD_NAME' => $gfield['name']
);
}
}
$this->setJSVar('avFieldsList', $fieldsList);
$repTabPluginPermissions = $this->_getSimpleReportPluginDef();
break;
default:
break;
}
}
$jsFile = isset($httpData->tableType) && $httpData->tableType == 'report' ? 'editReport' : 'edit';
$this->includeExtJS('pmTables/' . $jsFile, $this->debug);
$this->setJSVar('ADD_TAB_UID', $addTabUid);
$this->setJSVar('PRO_UID', isset($_GET['PRO_UID'])? $_GET['PRO_UID'] : false);
$this->setJSVar('TABLE', $table);
$this->setJSVar('_plugin_permissions', $repTabPluginPermissions);
G::RenderPage('publish', 'extJs');
}
function data($httpData)
{
require_once 'classes/model/AdditionalTables.php';
$additionalTables = new AdditionalTables();
$tableDef = $additionalTables->load($httpData->id, true);
$this->includeExtJS('pmTables/data', $this->debug);
$this->setJSVar('tableDef', $tableDef);
//g::pr($tableDef['FIELDS']);
G::RenderPage('publish', 'extJs');
}
/**
* protected functions
*/
protected function _getSimpleReportPluginDef()
{
global $G_TMP_MENU;
$oMenu = new Menu();
$oMenu->load('setup');
$repTabPluginPermissions = false;
foreach( $oMenu->Options as $i=>$option) {
if ($oMenu->Types[$i] == 'private' && $oMenu->Id[$i] == 'PLUGIN_REPTAB_PERMISSIONS') {
$repTabPluginPermissions = array();
$repTabPluginPermissions['label'] = $oMenu->Labels[$i];
$repTabPluginPermissions['fn'] = $oMenu->Options[$i];
break;
}
}
return $repTabPluginPermissions;
}
protected function _getDynafields($proUid, $type = 'xmlform')
{
require_once 'classes/model/Dynaform.php';
$fields = array();
$fieldsNames = array();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(DynaformPeer::DYN_FILENAME);
$oCriteria->add(DynaformPeer::PRO_UID, $proUid);
$oCriteria->add(DynaformPeer::DYN_TYPE, $type);
$oDataset = DynaformPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$excludeFieldsList = array('title', 'subtitle', 'link', 'file', 'button', 'reset', 'submit',
'listbox', 'checkgroup', 'grid', 'javascript');
$labelFieldsTypeList = array('dropdown', 'checkbox', 'radiogroup', 'yesno');
while ($aRow = $oDataset->getRow()) {
if (file_exists(PATH_DYNAFORM . PATH_SEP . $aRow['DYN_FILENAME'] . '.xml')) {
$G_FORM = new Form($aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG);
if ($G_FORM->type == 'xmlform' || $G_FORM->type == '') {
foreach($G_FORM->fields as $fieldName => $fieldNode) {
if (!in_array($fieldNode->type, $excludeFieldsList) && !in_array($fieldName, $fieldsNames)) {
$fields[] = array('name' => $fieldName, 'type' => $fieldNode->type, 'label'=> $fieldNode->label);
$fieldsNames[] = $fieldName;
if (in_array($fieldNode->type, $labelFieldsTypeList) && !in_array($fieldName.'_label', $fieldsNames)) {
$fields[] = array('name' => $fieldName . '_label', 'type' => $fieldNode->type, 'label'=>$fieldNode->label . '_label');
$fieldsNames[] = $fieldName;
}
}
}
}
}
$oDataset->next();
}
return $fields;
}
protected function _getGridDynafields($proUid, $gridId)
{
$fields = array();
$fieldsNames = array();
$excludeFieldsList = array('title', 'subtitle', 'link', 'file', 'button', 'reset', 'submit',
'listbox', 'checkgroup', 'grid', 'javascript');
$labelFieldsTypeList = array('dropdown', 'checkbox', 'radiogroup', 'yesno');
$G_FORM = new Form($proUid . '/' . $gridId, PATH_DYNAFORM, SYS_LANG, false);
if ($G_FORM->type == 'grid') {
foreach($G_FORM->fields as $fieldName => $fieldNode) {
if (!in_array($fieldNode->type, $excludeFieldsList) && !in_array($fieldName, $fieldsNames)) {
$fields[] = array('name' => $fieldName, 'type' => $fieldNode->type, 'label'=> $fieldNode->label);
$fieldsNames[] = $fieldName;
if (in_array($fieldNode->type, $labelFieldsTypeList) && !in_array($fieldName.'_label', $fieldsNames)) {
$fields[] = array('name' => $fieldName . '_label', 'type' => $fieldNode->type, 'label'=>$fieldNode->label . '_label');
$fieldsNames[] = $fieldName;
}
}
}
}
return $fields;
}
protected function _getGridFields($proUid)
{
$aFields = array();
$aFieldsNames = array();
require_once 'classes/model/Dynaform.php';
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(DynaformPeer::DYN_FILENAME);
$oCriteria->add(DynaformPeer::PRO_UID, $proUid);
$oDataset = DynaformPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$G_FORM = new Form($aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG);
if ($G_FORM->type == 'xmlform') {
foreach($G_FORM->fields as $k => $v) {
if ($v->type == 'grid') {
if (!in_array($k, $aFieldsNames)) {
$aFields[] = array('name' => $k, 'xmlform' => str_replace($proUid . '/', '', $v->xmlGrid));
$aFieldsNames[] = $k;
}
}
}
}
$oDataset->next();
}
return $aFields;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -44,6 +44,8 @@ $G_TMP_MENU->AddIdRawOption('CLEAR_CACHE', 'clearCompiled', G::LoadTranslation('
if ($RBAC->userCanAccess('PM_SETUP') == 1) {
$G_TMP_MENU->AddIdRawOption('ADDITIONAL_TABLES', '../additionalTables/additionalTablesList', G::LoadTranslation('ID_ADDITIONAL_TABLES'), 'icon-tables.png','', 'settings');
$G_TMP_MENU->AddIdRawOption('REPORT_TABLES', '../reportTables/main', 'Report Tables', 'icon-tables.png','', 'settings');
$G_TMP_MENU->AddIdRawOption('PM_TABLES', '../pmTables', 'PM Tables 2', 'icon-tables.png','', 'settings');
}
$G_TMP_MENU->AddIdRawOption('WEBSERVICES', 'webServices', G::LoadTranslation('ID_WEB_SERVICES'), 'icon-webservices.png', '', 'settings');

View File

@@ -72,4 +72,4 @@ $oHeadPublisher->assign('NAMES', $arrNames);
$oHeadPublisher->assign('VALUES', $arrDescrip);
$oHeadPublisher->assign('CONFIG', $Config);
G::RenderPage('publish', 'extJs');
G::RenderPage('publish', 'extJs');

View File

@@ -78,7 +78,7 @@ Ext.onReady(function(){
contextMenu = new Ext.menu.Menu({
items: [editButton, deleteButton]
});
});
//This loop loads columns and fields to store and column model
for (var c=0; c<NAMES.length; c++){

View File

@@ -5,7 +5,7 @@ include_once PATH_THIRDPARTY . 'creole/CreoleTypes.php';
/**
* This class adds structure of '{tableName}' table to 'workflow' DatabaseMap object.
* This class adds structure of '{tableName}' table to '{connection}' DatabaseMap object.
*
*
*
@@ -57,7 +57,7 @@ class {className}MapBuilder {
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('workflow');
$this->dbMap = Propel::getDatabaseMap('{connection}');
$tMap = $this->dbMap->addTable('{tableName}');

View File

@@ -15,7 +15,7 @@ include_once '{pathClasses}/' . SYS_SYS . '/classes/{className}.php';
abstract class Base{className}Peer {
/** the default database name for this class */
const DATABASE_NAME = 'workflow';
const DATABASE_NAME = '{connection}';
/** the table name for this class */
const TABLE_NAME = '{tableName}';

View File

@@ -0,0 +1,287 @@
var newButton;
var editButton;
var deleteButton;
var importButton;
var backButton;
var store;
var cmodel;
var smodel;
var infoGrid;
Ext.onReady(function(){
pageSize = 20; //parseInt(CONFIG.pageSize);
newButton = new Ext.Action({
text: _('ID_ADD_ROW'),
iconCls: 'button_menu_ext ss_sprite ss_add',
handler: NewPMTableRow
});
editButton = new Ext.Action({
text: _('ID_EDIT'),
iconCls: 'button_menu_ext ss_sprite ss_pencil',
handler: EditPMTableRow,
disabled: true
});
deleteButton = new Ext.Action({
text: _('ID_DELETE'),
iconCls: 'button_menu_ext ss_sprite ss_delete',
handler: DeletePMTableRow,
disabled: true
});
importButton = new Ext.Action({
text: _('ID_IMPORT'),
iconCls: 'silk-add',
icon: '/images/import.gif',
handler: ImportPMTableCSV
});
backButton = new Ext.Action({
text: _('ID_BACK'),
iconCls: 'button_menu_ext ss_sprite ss_arrow_redo',
handler: BackPMList
});
contextMenu = new Ext.menu.Menu({
items: [editButton, deleteButton]
});
//This loop loads columns and fields to store and column model
_columns = new Array();
_fields = new Array();
if (tableDef.FIELDS.length !== 0) {
for (i in tableDef.FIELDS) {
_columns.push({
id: tableDef.FIELDS[i].FLD_NAME,
header: tableDef.FIELDS[i].FLD_DESCRIPTION,
dataIndex: tableDef.FIELDS[i].FLD_NAME,
width: 40
});
_fields.push({name: tableDef.FIELDS[i].FLD_NAME});
}
}
// smodel = new Ext.grid.CheckboxSelectionModel({
// listeners:{
// selectionchange: function(sm){
// var count_rows = sm.getCount();
// switch(count_rows){
// case 0:
// editButton.disable();
// deleteButton.disable();
// break;
// case 1:
// editButton.enable();
// deleteButton.enable();
// break;
// default:
// editButton.disable();
// deleteButton.disable();
// break;
// }
// }
// }
// });
store = new Ext.data.GroupingStore({
proxy : new Ext.data.HttpProxy({
url: '../pmTablesProxy/getData?id=' + tableDef.ADD_TAB_UID
}),
reader : new Ext.data.JsonReader({
root: 'rows',
totalProperty: 'count',
fields : _fields
})
});
cmodel = new Ext.grid.ColumnModel({
defaults: {
width: 50,
sortable: true
},
columns: _columns
});
storePageSize = new Ext.data.SimpleStore({
fields: ['size'],
data: [['20'],['30'],['40'],['50'],['100']],
autoLoad: true
});
comboPageSize = new Ext.form.ComboBox({
typeAhead : false,
mode : 'local',
triggerAction : 'all',
store: storePageSize,
valueField: 'size',
displayField: 'size',
width: 50,
editable: false,
listeners:{
select: function(c,d,i){
UpdatePageConfig(d.data['size']);
bbarpaging.pageSize = parseInt(d.data['size']);
bbarpaging.moveFirst();
}
}
});
comboPageSize.setValue(pageSize);
bbarpaging = new Ext.PagingToolbar({
pageSize: pageSize,
store: store,
displayInfo: true,
displayMsg: _('ID_GRID_PAGE_DISPLAYING_ROWS_MESSAGE') + '&nbsp; &nbsp; ',
emptyMsg: _('ID_GRID_PAGE_NO_ROWS_MESSAGE'),
items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]
});
infoGrid = new Ext.grid.GridPanel({
region: 'center',
layout: 'fit',
id: 'infoGrid',
height:1000,
autoWidth : true,
title : _('ID_PM_TABLE') + " : " + tableDef.ADD_TAB_NAME,
stateful : true,
stateId : 'grid',
enableColumnResize: true,
enableHdMenu: true,
frame:false,
columnLines: false,
viewConfig: {
forceFit:true
},
store: store,
cm: cmodel,
//sm: smodel,
tbar:[newButton,'-',editButton, deleteButton,'-',importButton,{xtype: 'tbfill' }, backButton],
bbar: bbarpaging,
listeners: {
rowdblclick: EditPMTableRow,
render: function(){
this.loadMask = new Ext.LoadMask(this.body, {msg:_('ID_LOADING_GRID')});
}
},
view: new Ext.grid.GroupingView({
forceFit:true,
groupTextTpl: '{text}'
})
});
infoGrid.on('rowcontextmenu',
function (grid, rowIndex, evt) {
var sm = grid.getSelectionModel();
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
},
this
);
infoGrid.on('contextmenu', function(evt){evt.preventDefault();}, this);
infoGrid.addListener('rowcontextmenu',onMessageContextMenu, this);
infoGrid.store.load();
viewport = new Ext.Viewport({
layout: 'fit',
autoScroll: false,
items: [infoGrid]
});
});
//Funtion Handles Context Menu Opening
onMessageContextMenu = function (grid, rowIndex, e) {
e.stopEvent();
var coords = e.getXY();
contextMenu.showAt([coords[0], coords[1]]);
};
/////JS FUNCTIONS
//Capitalize String Function
capitalize = function(s){
s = s.toLowerCase();
return s.replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } );
};
//Do Nothing Function
DoNothing = function(){};
//Load New PM Table Row Forms
NewPMTableRow = function(){
location.href = 'additionalTablesDataNew?sUID=' + TABLES.UID;
};
//Load PM Table Edition Row Form
EditPMTableRow = function(){
iGrid = Ext.getCmp('infoGrid');
rowsSelected = iGrid.getSelectionModel().getSelections();
var aRowsSeleted = (RetrieveRowsID(rowsSelected)).split(",") ;
var aTablesPKF = (TABLES.PKF).split(","); ;
var sParam = '';
for(var i=0;i<aTablesPKF.length; i++){
sParam += '&' + aTablesPKF[i] + '=' + aRowsSeleted[i];
}
location.href = 'additionalTablesDataEdit?sUID='+TABLES.UID+sParam;
};
//Confirm PM Table Row Deletion Tasks
DeletePMTableRow = function(){
iGrid = Ext.getCmp('infoGrid');
rowsSelected = iGrid.getSelectionModel().getSelections();
Ext.Msg.confirm(_('ID_CONFIRM'), _('ID_MSG_CONFIRM_DELETE_ROW'),
function(btn, text){
if (btn=="yes"){
var aRowsSeleted = (RetrieveRowsID(rowsSelected)).split(",") ;
var aTablesPKF = (TABLES.PKF).split(","); ;
var sParam = '';
for(var i=0;i<aTablesPKF.length; i++){
sParam += '&' + aTablesPKF[i] + '=' + aRowsSeleted[i];
}
location.href = 'additionalTablesDataDelete?sUID='+TABLES.UID+sParam;
}
});
};
//Load Import PM Table From CSV Source
ImportPMTableCSV = function(){
location.href = 'additionalTablesDataImportForm?sUID=' + TABLES.UID;
};
//Load PM Table List
BackPMList = function(){
location.href = 'additionalTablesList';
};
//Gets UIDs from a array of rows
RetrieveRowsID = function(rows){
var arrAux = new Array();
var arrPKF = new Array();
arrPKF = TABLES.PKF.split(',');
if(rows.length>0){
var c = 0;
for(var i=0; i<arrPKF.length; i++){
arrAux[i] = rows[c].get(arrPKF[i]);
}
}
return arrAux.join(',');
};
//Update Page Size Configuration
UpdatePageConfig = function(pageSize){
Ext.Ajax.request({
url: 'additionalTablesAjax',
params: {action:'updatePageSizeData', size: pageSize}
});
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
<div style="padding: 15px">
<div id="list-panel"></div>
</div>

File diff suppressed because it is too large Load Diff

View File

@@ -699,7 +699,8 @@ Ext.onReady(function(){
}, {
text:_("ID_CANCEL"),
handler: function() {
history.back();
proParam = PRO_UID !== false ? '?PRO_UID='+PRO_UID : '';
location.href = '../reportTables/main' + proParam; //history.back();
}
}]
});
@@ -797,7 +798,8 @@ function createReportTable()
result = Ext.util.JSON.decode(resp.responseText);
if (result.success) {
history.back();
proParam = PRO_UID !== false ? '?PRO_UID='+PRO_UID : '';
location.href = '../reportTables/main' + proParam; //history.back();
} else {
Ext.Msg.alert( _('ID_ERROR'), result.msg);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B