This commit is contained in:
Paula Quispe
2019-11-22 15:01:08 -04:00
parent b3bfd850ba
commit 5968bd5b7b
9 changed files with 438 additions and 99 deletions

View File

@@ -0,0 +1,50 @@
<?php
use Faker\Generator as Faker;
use ProcessMaker\Model\AdditionalTables;
$factory->define(\ProcessMaker\Model\Fields::class, function (Faker $faker) {
return [
'FLD_UID' => G::generateUniqueID(),
'ADD_TAB_UID' => G::generateUniqueID(),
'FLD_INDEX' => 0,
'FLD_NAME' => 'VAR_' . $faker->sentence(1),
'FLD_DESCRIPTION' => $faker->sentence(2),
'FLD_TYPE' => 'VARCHAR',
'FLD_SIZE' => 255,
'FLD_NULL' => 1,
'FLD_AUTO_INCREMENT' => 0,
'FLD_KEY' => 1,
'FLD_TABLE_INDEX' => 0,
'FLD_FOREIGN_KEY' => 0,
'FLD_FOREIGN_KEY_TABLE' => '',
'FLD_DYN_NAME' => '',
'FLD_DYN_UID' => '',
'FLD_FILTER' => 0,
];
});
// Create columns from a table with the foreign keys
$factory->state(\ProcessMaker\Model\Fields::class, 'foreign_keys', function (Faker $faker) {
return [
'FLD_UID' => G::generateUniqueID(),
'ADD_TAB_UID' => function() {
$table = factory(AdditionalTables::class)->create(['ADD_TAB_OFFLINE' => 1]);
return $table->ADD_TAB_UID;
},
'FLD_INDEX' => 0,
'FLD_NAME' => 'VAR_' . $faker->sentence(1),
'FLD_DESCRIPTION' => $faker->sentence(2),
'FLD_TYPE' => 'VARCHAR',
'FLD_SIZE' => 255,
'FLD_NULL' => 1,
'FLD_AUTO_INCREMENT' => 0,
'FLD_KEY' => 1,
'FLD_TABLE_INDEX' => 0,
'FLD_FOREIGN_KEY' => 0,
'FLD_FOREIGN_KEY_TABLE' => '',
'FLD_DYN_NAME' => '',
'FLD_DYN_UID' => '',
'FLD_FILTER' => 0,
];
});

View File

@@ -0,0 +1,81 @@
<?php
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Model\Fields;
use Tests\TestCase;
class AdditionalTablesTest extends TestCase
{
/**
* Test belongs to ADD_TAB_UID
*
* @covers \ProcessMaker\Model\AdditionalTables::columns()
* @test
*/
public function it_has_a_columns_defined()
{
$table = factory(AdditionalTables::class)->create([
'ADD_TAB_UID' => function () {
return factory(Fields::class)->create()->ADD_TAB_UID;
}
]);
$this->assertInstanceOf(Fields::class, $table->columns);
}
/**
* Test scope query to get the offline tables
*
* @covers \ProcessMaker\Model\AdditionalTables::scopeOffline()
* @test
*/
public function it_filter_offline_table()
{
factory(AdditionalTables::class)->create(['ADD_TAB_OFFLINE' => 0]);
$table = factory(AdditionalTables::class)->create([
'ADD_TAB_OFFLINE' => 1
]);
$this->assertCount(1, $table->offline([$table->ADD_TAB_OFFLINE])->get());
}
/**
* Test get the structure of offline tables
*
* @covers \ProcessMaker\Model\AdditionalTables::getTablesOfflineStructure()
* @test
*/
public function it_get_structure_from_offline_tables()
{
factory(Fields::class)->states('foreign_keys')->create();
$results = AdditionalTables::getTablesOfflineStructure();
$this->assertNotEmpty($results);
foreach ($results as $row) {
$this->assertArrayHasKey('add_tab_uid', $row);
$this->assertArrayHasKey('add_tab_name', $row);
$this->assertArrayHasKey('add_tab_description', $row);
$this->assertArrayHasKey('add_tab_class_name', $row);
$this->assertArrayHasKey('fields', $row);
}
}
/**
* Test get the data of offline tables
*
* @covers \ProcessMaker\Model\AdditionalTables::getTablesOfflineData()
* @test
*/
public function it_get_data_from_offline_tables()
{
factory(Fields::class)->states('foreign_keys')->create();
$results = AdditionalTables::getTablesOfflineData();
$this->assertNotEmpty($results);
foreach ($results as $row) {
$this->assertArrayHasKey('add_tab_uid', $row);
$this->assertArrayHasKey('add_tab_name', $row);
$this->assertArrayHasKey('add_tab_description', $row);
$this->assertArrayHasKey('add_tab_class_name', $row);
$this->assertArrayHasKey('rows', $row);
}
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Model\Fields;
use Tests\TestCase;
class FieldsTest extends TestCase
{
/**
* Test belongs to ADD_TAB_UID
*
* @covers \ProcessMaker\Model\Fields::table()
* @test
*/
public function it_has_a_columns_defined()
{
$tableColumns = factory(Fields::class)->create([
'ADD_TAB_UID' => function () {
return factory(AdditionalTables::class)->create()->ADD_TAB_UID;
}
]);
$this->assertInstanceOf(AdditionalTables::class, $tableColumns->table);
}
/**
* Test scope and the query with a specific ADD_TAB_UID
*
* @covers \ProcessMaker\Model\Fields::scopeTable()
* @covers \ProcessMaker\Model\Fields::getFields()
* @test
*/
public function it_get_fields_from_specific_table()
{
$fields = factory(Fields::class)->create();
$result = Fields::getFields($fields->ADD_TAB_UID);
$this->assertNotEmpty($result);
}
}

View File

@@ -20,7 +20,7 @@ class Table
* *
* @return array * @return array
*/ */
public function getTables($pro_uid = '', $reportFlag = false) public function getTables($pro_uid = '', $reportFlag = false, $offline = false)
{ {
//VALIDATION //VALIDATION
if ($reportFlag) { if ($reportFlag) {

View File

@@ -2,6 +2,7 @@
namespace ProcessMaker\Model; namespace ProcessMaker\Model;
use AdditionalTables as ModelAdditionalTables;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class AdditionalTables extends Model class AdditionalTables extends Model
@@ -9,4 +10,84 @@ class AdditionalTables extends Model
protected $table = 'ADDITIONAL_TABLES'; protected $table = 'ADDITIONAL_TABLES';
public $timestamps = false; public $timestamps = false;
/**
* Get the fields related to the table belongs to
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function columns()
{
return $this->belongsTo(Fields::class, 'ADD_TAB_UID', 'ADD_TAB_UID');
}
/**
* Scope a query to get the offline tables
*
* @param \Illuminate\Database\Eloquent\Builder $query
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeOffline($query)
{
return $query->where('ADD_TAB_OFFLINE', '=', 1);
}
/**
* Get the structure of offline tables
*
* @return array
*/
public static function getTablesOfflineStructure()
{
$query = AdditionalTables::query()->select([
'ADD_TAB_UID',
'ADD_TAB_NAME',
'ADD_TAB_DESCRIPTION',
'ADD_TAB_CLASS_NAME'
]);
$query->offline();
$results = $query->get();
$data = [];
$results->each(function ($item, $key) use (&$data) {
$data[$key] = array_change_key_case($item->toArray(), CASE_LOWER);
$data[$key]['fields'] = Fields::getFields($item->ADD_TAB_UID);
});
return $data;
}
/**
* Get the data of offline tables
*
* @return array
*/
public static function getTablesOfflineData()
{
$query = AdditionalTables::query()->select([
'ADD_TAB_UID',
'ADD_TAB_NAME',
'ADD_TAB_DESCRIPTION',
'ADD_TAB_CLASS_NAME'
]);
$query->offline();
$results = $query->get();
$data = [];
$results->each(function ($item, $key) use (&$data) {
$data[$key] = array_change_key_case($item->toArray(), CASE_LOWER);
$additionalTables = new ModelAdditionalTables();
$result = $additionalTables->getAllData($item->ADD_TAB_UID);
if (empty($result['rows'])) {
$data[$key]['rows'] = [];
} else {
foreach ($result['rows'] as $i => $row) {
$data[$key]['rows'][$i] = $row;
}
}
});
return $data;
}
} }

View File

@@ -0,0 +1,55 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
class Fields extends Model
{
protected $table = 'FIELDS';
public $timestamps = false;
/**
* Get the fields related to the table belongs to
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function table()
{
return $this->belongsTo(AdditionalTables::class, 'ADD_TAB_UID', 'ADD_TAB_UID');
}
/**
* Scope a query to get the offline tables
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $tabUid
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeTable($query, $tabUid)
{
return $query->where('ADD_TAB_UID', '=', $tabUid);
}
/**
* Get the offline tables
*
* @param string $tabUid
*
* @return array
*/
public static function getFields($tabUid)
{
$query = Fields::query();
$query->table($tabUid);
$results = $query->get();
$data = [];
$results->each(function ($item, $key) use (&$data) {
$data[$key] = array_change_key_case($item->toArray(), CASE_LOWER);
});
return $data;
}
}

View File

@@ -1,9 +1,11 @@
<?php <?php
namespace ProcessMaker\Services\Api; namespace ProcessMaker\Services\Api;
use Exception; use Exception;
use Luracast\Restler\RestException; use Luracast\Restler\RestException;
use ProcessMaker\BusinessModel\Table as BusinessModelTable; use ProcessMaker\BusinessModel\Table as BusinessModelTable;
use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Services\Api; use ProcessMaker\Services\Api;
/** /**
@@ -14,85 +16,137 @@ use ProcessMaker\Services\Api;
class Pmtable extends Api class Pmtable extends Api
{ {
/** /**
* @return array * Get a list of the PM tables in the workspace. It does not include any Report Table
* *
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com> * @url GET
* @copyright Colosa - Bolivia * @status 200
*
* @param boolean $offline {@from path}
*
* @return array
* @throws RestException
* *
* @access protected * @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES} * @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @url GET * @link https://wiki.processmaker.com/3.1/REST_API_Administration/PM_Tables#PM_Tables_List:_GET_.2Fpmtable
*/ */
public function doGetPmTables() public function doGetPmTables($offline = false)
{ {
try { try {
$oPmTable = new \ProcessMaker\BusinessModel\Table(); if ($offline) {
$response = $oPmTable->getTables(); $response = AdditionalTables::getTablesOfflineStructure();
} else {
$pmTable = new BusinessModelTable();
$response = $pmTable->getTables();
}
return $response; return $response;
} catch (\Exception $e) { } catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
} }
} }
/** /**
* @param string $pmt_uid {@min 1} {@max 32} * Get the data of the offline PM tables
*
* @url GET /offline/data
* @status 200
*
* @param boolean $compress {@from path}
*
* @return array * @return array
* *
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com> * @throws RestException
* @copyright Colosa - Bolivia
* *
* @access protected * @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES} * @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @link https://wiki.processmaker.com/3.1/REST_API_Administration/PM_Tables#PM_Tables_List:_GET_.2Fpmtable
*/
public function doGetPmTablesDataOffline($compress = true)
{
try {
$data = AdditionalTables::getTablesOfflineData();
if ($compress) {
$json = json_encode($data);
$compressed = gzcompress($json, 5);
echo $compressed;
} else {
return $data;
}
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get the structure from a specific PM Table, including a list of its fields and their properties.
*
* @url GET /:pmt_uid * @url GET /:pmt_uid
* @status 200
*
* @param string $pmt_uid {@min 1} {@max 32}
*
* @return array
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @link https://wiki.processmaker.com/3.1/REST_API_Administration/PM_Tables#Get_PM_Table_Structure:_GET_.2Fpmtable.2F.7Bpmt_uid.7D
*/ */
public function doGetPmTable($pmt_uid) public function doGetPmTable($pmt_uid)
{ {
try { try {
$oPmTable = new \ProcessMaker\BusinessModel\Table(); $oPmTable = new BusinessModelTable();
$response = $oPmTable->getTable($pmt_uid); $response = $oPmTable->getTable($pmt_uid);
return $response; return $response;
} catch (\Exception $e) { } catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
} }
} }
/** /**
* Get the data from a PM table
*
* @url GET /:pmt_uid/data
* @status 200
*
* @param string $pmt_uid {@min 1} {@max 32} * @param string $pmt_uid {@min 1} {@max 32}
* @param string $filter * @param string $filter
* @param string $q * @param string $q
* @return array
* *
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com> * @return array
* @copyright Colosa - Bolivia * @throws RestException
* *
* @access protected * @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES} * @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @url GET /:pmt_uid/data *
*/ */
public function doGetPmTableData($pmt_uid, $filter = null, $q = "") public function doGetPmTableData($pmt_uid, $filter = null, $q = "")
{ {
try { try {
$oPmTable = new \ProcessMaker\BusinessModel\Table(); $oPmTable = new BusinessModelTable();
$response = $oPmTable->getTableData($pmt_uid, null, $filter, false, $q); $response = $oPmTable->getTableData($pmt_uid, null, $filter, false, $q);
return $response; return $response;
} catch (\Exception $e) { } catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
} }
} }
/** /**
* Create a new PM Table
*
* @url POST
* @status 201
*
* @param array $request_data * @param array $request_data
* @param string $pmt_tab_name {@from body} * @param string $pmt_tab_name {@from body}
* @param string $pmt_tab_dsc {@from body} * @param string $pmt_tab_dsc {@from body}
* @return array
* *
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com> * @return array
* @copyright Colosa - Bolivia * @throws RestException
* *
* @access protected * @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES} * @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @url POST
* @status 201
*/ */
public function doPostPmTable( public function doPostPmTable(
$request_data, $request_data,
@@ -100,58 +154,58 @@ class Pmtable extends Api
$pmt_tab_dsc = '' $pmt_tab_dsc = ''
) { ) {
try { try {
$oReportTable = new \ProcessMaker\BusinessModel\Table(); $oReportTable = new BusinessModelTable();
$response = $oReportTable->saveTable($request_data); $response = $oReportTable->saveTable($request_data);
if (isset($response['pro_uid'])) { if (isset($response['pro_uid'])) {
unset($response['pro_uid']); unset($response['pro_uid']);
} }
return $response; return $response;
} catch (\Exception $e) { } catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
} }
} }
/** /**
* @param string $pmt_uid {@min 1} {@max 32} * Add a new record to a PM Table
* *
* @param array $request_data
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @url POST /:pmt_uid/data * @url POST /:pmt_uid/data
* @status 201 * @status 201
*
* @param string $pmt_uid {@min 1} {@max 32}
* @param array $request_data
*
* @return array
* @throws RestException
* @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
*/ */
public function doPostPmTableData( public function doPostPmTableData(
$pmt_uid, $pmt_uid,
$request_data $request_data
) { ) {
try { try {
$oReportTable = new \ProcessMaker\BusinessModel\Table(); $oReportTable = new BusinessModelTable();
$response = $oReportTable->saveTableData($pmt_uid, $request_data); $response = $oReportTable->saveTableData($pmt_uid, $request_data);
return $response; return $response;
} catch (\Exception $e) { } catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
} }
} }
/** /**
* Update pm-table. * Update the structure of a PM table.
* *
* @url PUT /:pmt_uid * @url PUT /:pmt_uid
* @status 200
* *
* @param string $pmt_uid {@min 1} {@max 32} * @param string $pmt_uid {@min 1} {@max 32}
* @param array $request_data * @param array $request_data
* *
* @return void * @return void
* @throw RestException * @throws RestException
* *
* @access protected * @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES} * @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @throws RestException
*/ */
public function doPutPmTable( public function doPutPmTable(
$pmt_uid, $pmt_uid,
@@ -167,9 +221,10 @@ class Pmtable extends Api
} }
/** /**
* Update pm-table data. * Update the data of an existing record in a PM table.
* *
* @url PUT /:pmt_uid/data * @url PUT /:pmt_uid/data
* @status 200
* *
* @param string $pmt_uid {@min 1} {@max 32} * @param string $pmt_uid {@min 1} {@max 32}
* @param array $request_data * @param array $request_data
@@ -185,37 +240,47 @@ class Pmtable extends Api
$request_data $request_data
) { ) {
try { try {
$oReportTable = new \ProcessMaker\BusinessModel\Table(); $oReportTable = new BusinessModelTable();
$response = $oReportTable->updateTableData($pmt_uid, $request_data); $response = $oReportTable->updateTableData($pmt_uid, $request_data);
return $response; return $response;
} catch (\Exception $e) { } catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
} }
} }
/** /**
* Delete a specified PM table and all its data.
*
* @url DELETE /:pmt_uid
* @status 200
*
* @param string $pmt_uid {@min 1} {@max 32} * @param string $pmt_uid {@min 1} {@max 32}
* *
* @return void * @return void
* * @throws RestException
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* *
* @access protected * @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES} * @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @url DELETE /:pmt_uid
*/ */
public function doDeletePmTable($pmt_uid) public function doDeletePmTable($pmt_uid)
{ {
try { try {
$oReportTable = new \ProcessMaker\BusinessModel\Table(); $oReportTable = new BusinessModelTable();
$response = $oReportTable->deleteTable($pmt_uid); $response = $oReportTable->deleteTable($pmt_uid);
} catch (\Exception $e) { } catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
} }
} }
/** /**
* Delete a record from a PM table, by specifying its primary key(s). The PM Table can have up to 3 primary key
* fields.
*
* @url DELETE /:pmt_uid/data/:key1/:value1
* @url DELETE /:pmt_uid/data/:key1/:value1/:key2/:value2
* @url DELETE /:pmt_uid/data/:key1/:value1/:key2/:value2/:key3/:value3
* @status 200
*
* @param string $pmt_uid {@min 1} {@max 32} * @param string $pmt_uid {@min 1} {@max 32}
* @param string $key1 {@min 1} * @param string $key1 {@min 1}
* @param string $value1 {@min 1} * @param string $value1 {@min 1}
@@ -225,15 +290,10 @@ class Pmtable extends Api
* @param string $value3 * @param string $value3
* *
* @return array * @return array
* * @throws RestException
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* *
* @access protected * @access protected
* @class AccessControl {@permission PM_SETUP_PM_TABLES} * @class AccessControl {@permission PM_SETUP_PM_TABLES}
* @url DELETE /:pmt_uid/data/:key1/:value1
* @url DELETE /:pmt_uid/data/:key1/:value1/:key2/:value2
* @url DELETE /:pmt_uid/data/:key1/:value1/:key2/:value2/:key3/:value3
*/ */
public function doDeletePmTableData($pmt_uid, $key1, $value1, $key2 = '', $value2 = '', $key3 = '', $value3 = '') public function doDeletePmTableData($pmt_uid, $key1, $value1, $key2 = '', $value2 = '', $key3 = '', $value3 = '')
{ {
@@ -245,10 +305,10 @@ class Pmtable extends Api
if ($key3 != '') { if ($key3 != '') {
$rows[$key3] = $value3; $rows[$key3] = $value3;
} }
$oReportTable = new \ProcessMaker\BusinessModel\Table(); $oReportTable = new BusinessModelTable();
$response = $oReportTable->deleteTableData($pmt_uid, $rows); $response = $oReportTable->deleteTableData($pmt_uid, $rows);
return $response; return $response;
} catch (\Exception $e) { } catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
} }
} }

View File

@@ -1,6 +1,5 @@
/** /**
* PM tables Edit * PM tables Edit
* @author Erik A. O. <erik@colosa.com>
*/ */
var store; var store;
@@ -99,14 +98,13 @@ Ext.onReady(function () {
listeners: {rowdblclick: AssignFieldsAction} listeners: {rowdblclick: AssignFieldsAction}
}); });
//selecion model for table columns grid //selection model for table columns grid
sm = new Ext.grid.RowSelectionModel({ sm = new Ext.grid.RowSelectionModel({
selectSingle: false, selectSingle: false,
listeners: { listeners: {
selectionchange: function (sm) { selectionchange: function (sm) {
switch (sm.getCount()) { switch (sm.getCount()) {
case 0: case 0:
//Ext.getCmp('removeButton').disable();
Ext.getCmp('editColumn').disable(); Ext.getCmp('editColumn').disable();
Ext.getCmp('removeColumn').disable(); Ext.getCmp('removeColumn').disable();
break; break;
@@ -115,7 +113,6 @@ Ext.onReady(function () {
Ext.getCmp('removeColumn').enable(); Ext.getCmp('removeColumn').enable();
break; break;
default: default:
//Ext.getCmp('removeButton').enable();
Ext.getCmp('editColumn').disable(); Ext.getCmp('editColumn').disable();
Ext.getCmp('removeColumn').enable(); Ext.getCmp('removeColumn').enable();
break; break;
@@ -196,7 +193,6 @@ Ext.onReady(function () {
if (valueInputField) { if (valueInputField) {
this.setValue(this.getValue().replace(/\s/g, '').toUpperCase()); this.setValue(this.getValue().replace(/\s/g, '').toUpperCase());
} else { } else {
//Ext.Msg.alert(_('ID_WARNING'), _('ID_FIELD_NAME'));
this.setValue(''); this.setValue('');
} }
} }
@@ -232,7 +228,7 @@ Ext.onReady(function () {
} else { } else {
return true; return true;
} }
}, }
} }
}, { }, {
id: 'field_type', id: 'field_type',
@@ -286,7 +282,7 @@ Ext.onReady(function () {
flagShowMessageError = 1; flagShowMessageError = 1;
} }
}//select }
} }
}) })
}, { }, {
@@ -481,7 +477,6 @@ Ext.onReady(function () {
//table columns grid //table columns grid
assignedGrid = new Ext.grid.GridPanel({ assignedGrid = new Ext.grid.GridPanel({
//title: 'Columns',
region: 'center', region: 'center',
id: 'assignedGrid', id: 'assignedGrid',
ddGroup: 'availableGridDDGroup', ddGroup: 'availableGridDDGroup',
@@ -553,7 +548,6 @@ Ext.onReady(function () {
}); });
assignedGrid.getSelectionModel().on('selectionchange', function (sm) { assignedGrid.getSelectionModel().on('selectionchange', function (sm) {
//alert('s');
}); });
// (vertical) selection buttons // (vertical) selection buttons
@@ -588,9 +582,7 @@ Ext.onReady(function () {
FieldsPanel = new Ext.Panel({ FieldsPanel = new Ext.Panel({
//title: _('ID_FIELDS'),
region: 'center', region: 'center',
//autoWidth : true,
width: 150, width: 150,
layout: 'hbox', layout: 'hbox',
defaults: {flex: 1}, //auto stretch defaults: {flex: 1}, //auto stretch
@@ -702,7 +694,6 @@ Ext.onReady(function () {
fieldLabel: _("ID_DB_CONNECTION"), fieldLabel: _("ID_DB_CONNECTION"),
hiddenName: 'DBS_UID', hiddenName: 'DBS_UID',
store: dbConnectionsStore, store: dbConnectionsStore,
//value: 'rp',
valueField: 'DBS_UID', valueField: 'DBS_UID',
displayField: 'DBS_NAME', displayField: 'DBS_NAME',
triggerAction: 'all', triggerAction: 'all',
@@ -765,8 +756,6 @@ Ext.onReady(function () {
] ]
}); });
//items.push(comboDbConnections);
var frmDetails = new Ext.FormPanel({ var frmDetails = new Ext.FormPanel({
id: 'frmDetails', id: 'frmDetails',
region: 'north', region: 'north',
@@ -777,7 +766,6 @@ Ext.onReady(function () {
frame: true, frame: true,
height: 170, height: 170,
items: items, items: items,
//tbar : tbar,
waitMsgTarget: true, waitMsgTarget: true,
defaults: { defaults: {
allowBlank: false, allowBlank: false,
@@ -786,7 +774,6 @@ Ext.onReady(function () {
} }
}); });
southPanel = new Ext.FormPanel({ southPanel = new Ext.FormPanel({
region: 'south', region: 'south',
buttons: [ buttons: [
@@ -849,7 +836,6 @@ Ext.onReady(function () {
}); });
// actions // actions
function createReportTable() function createReportTable()
{ {
var tableName = Ext.getCmp('REP_TAB_NAME').getValue().trim(); var tableName = Ext.getCmp('REP_TAB_NAME').getValue().trim();
@@ -1006,7 +992,6 @@ function _showDebugWin(content)
modal: false, modal: false,
autoScroll: true, autoScroll: true,
maximizable: true, maximizable: true,
//closeAction: 'hide',
maximizable: false, maximizable: false,
items: [], items: [],
x: 0, x: 0,
@@ -1019,7 +1004,6 @@ function _showDebugWin(content)
function addColumn() { function addColumn() {
var PMRow = assignedGrid.getStore().recordType; var PMRow = assignedGrid.getStore().recordType;
//var meta = mapPMFieldType(records[i].data['FIELD_UID']);
var row = new PMRow({ var row = new PMRow({
uid: '', uid: '',
field_uid: '', field_uid: '',
@@ -1164,7 +1148,7 @@ function editorFieldsEnableDisable(fieldTypeValue, fieldNull, fieldPrimaryKey, f
} }
} }
////ASSIGNBUTON FUNCTIONALITY //Assign button functionality
AssignFieldsAction = function () { AssignFieldsAction = function () {
var records, i; var records, i;
@@ -1306,7 +1290,6 @@ var DDLoadFields = function () {
//add on target grid //add on target grid
for (i = 0; i < records.length; i++) { for (i = 0; i < records.length; i++) {
//arrAux[r] = records[r].data['FIELD_UID'];
var meta = mapPMFieldType(records[i].data['FIELD_UID']); var meta = mapPMFieldType(records[i].data['FIELD_UID']);
var row = new PMRow({ var row = new PMRow({
uid: '', uid: '',
@@ -1329,7 +1312,6 @@ var DDLoadFields = function () {
return true; return true;
} }
}); });
//sw_func_groups = true;
}; };
function loadTableRowsFromArray(records) function loadTableRowsFromArray(records)

View File

@@ -1,3 +1,7 @@
/**
* PM tables list
*/
var newButton; var newButton;
var editButton; var editButton;
var deleteButton; var deleteButton;
@@ -20,7 +24,7 @@ var currentSelectedRow = -1;
var extensionPmt = 'pmt'; var extensionPmt = 'pmt';
Ext.onReady(function () { Ext.onReady(function () {
///Keyboard Events // Keyboard Events
new Ext.KeyMap(document, { new Ext.KeyMap(document, {
key: Ext.EventObject.F5, key: Ext.EventObject.F5,
fn: function (keycode, e) { fn: function (keycode, e) {
@@ -62,13 +66,6 @@ Ext.onReady(function () {
var flagProcessmap = (typeof ('flagProcessmap') != 'undefined') ? flagProcessmap : 0; var flagProcessmap = (typeof ('flagProcessmap') != 'undefined') ? flagProcessmap : 0;
/*if (PRO_UID !== false) {
newMenuOptions.push({
text: _('ID_NEW_REPORT_TABLE_OLD'),
handler: NewReportTableOld
});
}*/
if (PRO_UID !== false) { if (PRO_UID !== false) {
newButton = new Ext.Action({ newButton = new Ext.Action({
id: 'newButton', id: 'newButton',
@@ -424,14 +421,14 @@ Ext.onReady(function () {
infoGrid.store.load(); infoGrid.store.load();
}); });
//Funtion Handles Context Menu Opening //Function Handles Context Menu Opening
onMessageContextMenu = function (grid, rowIndex, e) { onMessageContextMenu = function (grid, rowIndex, e) {
e.stopEvent(); e.stopEvent();
var coords = e.getXY(); var coords = e.getXY();
contextMenu.showAt([coords[0], coords[1]]); contextMenu.showAt([coords[0], coords[1]]);
}; };
/////JS FUNCTIONS // JS Functions
//Capitalize String Function //Capitalize String Function
capitalize = function (s) { capitalize = function (s) {
@@ -454,9 +451,6 @@ NewReportTable = function () {
}; };
NewReportTableOld = function () { NewReportTableOld = function () {
//location.href = 'reportTables/edit?PRO_UID='+PRO_UID+'&tableType=report';
//parent.reportTables2();
//parent.Pm.data.render.buildingBlocks.injector('reportTables2');
location.href = 'reportTables/reportTables_Edit?PRO_UID=' + PRO_UID; location.href = 'reportTables/reportTables_Edit?PRO_UID=' + PRO_UID;
}; };
@@ -544,7 +538,6 @@ ImportPMTable = function () {
resizable: false, resizable: false,
items: [ items: [
new Ext.FormPanel({ new Ext.FormPanel({
/*renderTo: 'form-panel',*/
id: 'uploader', id: 'uploader',
fileUpload: true, fileUpload: true,
width: 400, width: 400,
@@ -604,7 +597,6 @@ ImportPMTable = function () {
plain: true, plain: true,
html: '<h3>' + _('ID_IMPORTING_ERROR') + '</h3>' + result.message, html: '<h3>' + _('ID_IMPORTING_ERROR') + '</h3>' + result.message,
items: [], items: [],
buttons: [{ buttons: [{
text: 'Close', text: 'Close',
handler: function () { handler: function () {
@@ -700,7 +692,6 @@ PMTableData = function ()
var row = Ext.getCmp('infoGrid').getSelectionModel().getSelected(); var row = Ext.getCmp('infoGrid').getSelectionModel().getSelected();
var type = row.get('PRO_UID'); var type = row.get('PRO_UID');
//location.href = 'pmTables/data?id='+row.get('ADD_TAB_UID');
if (row.get('TYPE') != '') { if (row.get('TYPE') != '') {
PMExt.info(_('ID_INFO'), _('ID_DATA_LIST_NOT_AVAILABLE_FOR_OLDVER')); PMExt.info(_('ID_INFO'), _('ID_DATA_LIST_NOT_AVAILABLE_FOR_OLDVER'));
return; return;
@@ -715,7 +706,6 @@ PMTableData = function ()
modal: true, modal: true,
maximizable: true, maximizable: true,
constrain: true, constrain: true,
//closeAction:'hide',
plain: true, plain: true,
items: [{ items: [{
xtype: "iframepanel", xtype: "iframepanel",