BUG 0000 PM tables ver 2. (performance improvements)
This commit is contained in:
@@ -330,6 +330,9 @@ class Form extends XmlForm
|
|||||||
$values["{$k}_label"] .= ($i != 0 ? '|': '') . $v->options[$value];
|
$values["{$k}_label"] .= ($i != 0 ? '|': '') . $v->options[$value];
|
||||||
} else {
|
} else {
|
||||||
$query = G::replaceDataField($this->fields[$k]->sql,$newValues);
|
$query = G::replaceDataField($this->fields[$k]->sql,$newValues);
|
||||||
|
if(trim($query) == '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
//we do the query to the external connection and we've got the label
|
//we do the query to the external connection and we've got the label
|
||||||
$con = Propel::getConnection($this->fields[$k]->sqlConnection!=""?$this->fields[$k]->sqlConnection:"workflow");//use default connection workflow if connection is not defined. Same as Dynaforms
|
$con = Propel::getConnection($this->fields[$k]->sqlConnection!=""?$this->fields[$k]->sqlConnection:"workflow");//use default connection workflow if connection is not defined. Same as Dynaforms
|
||||||
|
|
||||||
@@ -361,6 +364,9 @@ class Form extends XmlForm
|
|||||||
$values["{$k}_label"] = $newValues["{$k}_label"] = $v->options[$newValues[$k]];
|
$values["{$k}_label"] = $newValues["{$k}_label"] = $v->options[$newValues[$k]];
|
||||||
} else {
|
} else {
|
||||||
$query = G::replaceDataField($this->fields[$k]->sql,$newValues);
|
$query = G::replaceDataField($this->fields[$k]->sql,$newValues);
|
||||||
|
if(trim($query) == '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
//we do the query to the external connection and we've got the label
|
//we do the query to the external connection and we've got the label
|
||||||
$con = Propel::getConnection($this->fields[$k]->sqlConnection!=""?$this->fields[$k]->sqlConnection:"workflow");
|
$con = Propel::getConnection($this->fields[$k]->sqlConnection!=""?$this->fields[$k]->sqlConnection:"workflow");
|
||||||
$stmt = $con->prepareStatement($query);
|
$stmt = $con->prepareStatement($query);
|
||||||
|
|||||||
@@ -37,6 +37,14 @@ class pmTables extends Controller
|
|||||||
|
|
||||||
$this->setJSVar('_PLUGIN_SIMPLEREPORTS', $this->_getSimpleReportPluginDef());
|
$this->setJSVar('_PLUGIN_SIMPLEREPORTS', $this->_getSimpleReportPluginDef());
|
||||||
|
|
||||||
|
if (isset($_SESSION['_cache_pmtables'])) {
|
||||||
|
unset($_SESSION['_cache_pmtables']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_SESSION['ADD_TAB_UID'])) {
|
||||||
|
unset($_SESSION['ADD_TAB_UID']);
|
||||||
|
}
|
||||||
|
|
||||||
//render content
|
//render content
|
||||||
G::RenderPage('publish', 'extJs');
|
G::RenderPage('publish', 'extJs');
|
||||||
}
|
}
|
||||||
@@ -52,66 +60,21 @@ class pmTables extends Controller
|
|||||||
$table = false;
|
$table = false;
|
||||||
$repTabPluginPermissions = false;
|
$repTabPluginPermissions = false;
|
||||||
$additionalTables = new AdditionalTables();
|
$additionalTables = new AdditionalTables();
|
||||||
$additionalTables = new AdditionalTables();
|
|
||||||
|
|
||||||
if ($addTabUid !== false) { // if is a edit request
|
if ($addTabUid !== false) { // if is a edit request
|
||||||
require_once 'classes/model/AdditionalTables.php';
|
require_once 'classes/model/AdditionalTables.php';
|
||||||
require_once 'classes/model/Fields.php';
|
|
||||||
$tableFields = array();
|
$tableFields = array();
|
||||||
$fieldsList = array();
|
$fieldsList = array();
|
||||||
|
|
||||||
$table = $additionalTables->load($addTabUid, true);
|
$table = $additionalTables->load($addTabUid, true);
|
||||||
|
$_SESSION['ADD_TAB_UID'] = $addTabUid;
|
||||||
// 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
|
//list dynaform fields
|
||||||
switch ($table['ADD_TAB_TYPE']) {
|
switch ($table['ADD_TAB_TYPE']) {
|
||||||
case 'NORMAL':
|
case 'NORMAL':
|
||||||
$fields = pmTablesProxy::_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']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sort($fieldsList);
|
|
||||||
$this->setJSVar('avFieldsList', $fieldsList);
|
|
||||||
$repTabPluginPermissions = $this->_getSimpleReportPluginDef();
|
|
||||||
$this->setJSVar('_plugin_permissions', $repTabPluginPermissions);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'GRID':
|
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 = pmTablesProxy::_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']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sort($fieldsList);
|
|
||||||
$this->setJSVar('avFieldsList', $fieldsList);
|
|
||||||
$repTabPluginPermissions = $this->_getSimpleReportPluginDef();
|
$repTabPluginPermissions = $this->_getSimpleReportPluginDef();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
|
|
||||||
protected $className;
|
protected $className;
|
||||||
protected $classPeerName;
|
protected $classPeerName;
|
||||||
|
protected $dynUid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get pmtables list
|
* get pmtables list
|
||||||
@@ -109,49 +110,68 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
|
|
||||||
$aFields['FIELDS'] = array();
|
$aFields['FIELDS'] = array();
|
||||||
$aFields['PRO_UID'] = $httpData->PRO_UID;
|
$aFields['PRO_UID'] = $httpData->PRO_UID;
|
||||||
|
$dynFields = array();
|
||||||
|
|
||||||
if(isset($httpData->TYPE) && $httpData->TYPE == 'GRID') {
|
if(isset($httpData->TYPE) && $httpData->TYPE == 'GRID') {
|
||||||
$aProcessGridFields = Array();
|
$aProcessGridFields = Array();
|
||||||
if (isset($httpData->GRID_UID)) {
|
if (isset($httpData->GRID_UID)) {
|
||||||
global $G_FORM;
|
|
||||||
list($gridName, $gridId) = explode('-', $httpData->GRID_UID);
|
list($gridName, $gridId) = explode('-', $httpData->GRID_UID);
|
||||||
|
$this->dynUid = $gridId;
|
||||||
|
|
||||||
$gridFields = $this->_getGridDynafields($httpData->PRO_UID, $gridId);
|
$httpData->textFilter = isset($httpData->textFilter) ? $httpData->textFilter : null;
|
||||||
|
$dynFields = $this->_getDynafields($aFields['PRO_UID'], 'grid', $httpData->start, $httpData->limit, $httpData->textFilter);
|
||||||
foreach ($gridFields as $gfield) {
|
}
|
||||||
$aProcessGridFields[] = array(
|
else {
|
||||||
'FIELD_UID' => $gfield['name'] . '-' . $gfield['type'],
|
if (isset($_SESSION['_cache_pmtables'])) {
|
||||||
'FIELD_NAME' => $gfield['name']
|
unset($_SESSION['_cache_pmtables']);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$gridFields = $this->_getGridFields($aFields['PRO_UID']);
|
$gridFields = $this->_getGridFields($aFields['PRO_UID']);
|
||||||
|
|
||||||
foreach ($gridFields as $gfield) {
|
foreach ($gridFields as $gfield) {
|
||||||
$aProcessGridFields[] = array(
|
$dynFields[] = array(
|
||||||
'FIELD_UID' => $gfield['name'] . '-' . $gfield['xmlform'],
|
'FIELD_UID' => $gfield['name'] . '-' . $gfield['xmlform'],
|
||||||
'FIELD_NAME' => $gfield['name']
|
'FIELD_NAME' => $gfield['name']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$resultList = $aProcessGridFields;
|
|
||||||
|
|
||||||
} else {
|
}
|
||||||
$aProcessFields = Array();
|
else {
|
||||||
$dynFields = $this->_getDynafields($aFields['PRO_UID']);
|
$httpData->textFilter = isset($httpData->textFilter) ? $httpData->textFilter : null;
|
||||||
|
$dynFields = $this->_getDynafields($aFields['PRO_UID'], 'xmlform', $httpData->start, $httpData->limit, $httpData->textFilter);
|
||||||
foreach ($dynFields as $dfield) {
|
|
||||||
$aProcessFields[] = array(
|
|
||||||
'FIELD_UID' => $dfield['name'] . '-' . $dfield['type'],
|
|
||||||
'FIELD_NAME' => $dfield['name']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$resultList = $aProcessFields;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sort($resultList);
|
return $dynFields;
|
||||||
|
}
|
||||||
|
|
||||||
return array('processFields'=>$resultList);
|
public function updateAvDynafields($httpData)
|
||||||
|
{
|
||||||
|
$indexes = explode(',', $httpData->indexes);
|
||||||
|
$fields = array();
|
||||||
|
$httpData->isset = $httpData->isset=='true'? true: false;
|
||||||
|
|
||||||
|
if (isset($_SESSION['_cache_pmtables']) && $_SESSION['_cache_pmtables']['pro_uid']== $httpData->PRO_UID) {
|
||||||
|
foreach ($indexes as $i) {
|
||||||
|
if (is_numeric($i)) {
|
||||||
|
if (isset($_SESSION['_cache_pmtables']['rows'][$i])) {
|
||||||
|
$_SESSION['_cache_pmtables']['rows'][$i]['_isset'] = $httpData->isset;
|
||||||
|
if ($httpData->isset) {
|
||||||
|
$_SESSION['_cache_pmtables']['count']++;
|
||||||
|
} else {
|
||||||
|
$_SESSION['_cache_pmtables']['count']--;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fields[] = $_SESSION['_cache_pmtables']['rows'][$i]['FIELD_NAME'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$index = $_SESSION['_cache_pmtables']['indexes'][$i];
|
||||||
|
$_SESSION['_cache_pmtables']['rows'][$index]['_isset'] = $httpData->isset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -813,7 +833,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
* @param $proUid
|
* @param $proUid
|
||||||
* @param $type [values:xmlform/grid]
|
* @param $type [values:xmlform/grid]
|
||||||
*/
|
*/
|
||||||
function _getDynafields($proUid, $type = 'xmlform')
|
function _getDynafields2($proUid, $type = 'xmlform')
|
||||||
{
|
{
|
||||||
require_once 'classes/model/Dynaform.php';
|
require_once 'classes/model/Dynaform.php';
|
||||||
$fields = array();
|
$fields = array();
|
||||||
@@ -856,6 +876,122 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _getDynafields($proUid, $type = 'xmlform', $start=null, $limit=null, $filter=null)
|
||||||
|
{
|
||||||
|
$cache = 1;
|
||||||
|
if (!isset($_SESSION['_cache_pmtables']) || (isset($_SESSION['_cache_pmtables']) && $_SESSION['_cache_pmtables']['pro_uid'] != $proUid)) {
|
||||||
|
require_once 'classes/model/Dynaform.php';
|
||||||
|
$cache = 0;
|
||||||
|
$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);
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($this->dynUid)) {
|
||||||
|
$oCriteria->add(DynaformPeer::DYN_UID, $this->dynUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
$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', 'radiogroup');
|
||||||
|
G::loadSystem('dynaformhandler');
|
||||||
|
$index = 0;
|
||||||
|
|
||||||
|
while ($aRow = $oDataset->getRow()) {
|
||||||
|
if (file_exists(PATH_DYNAFORM . PATH_SEP . $aRow['DYN_FILENAME'] . '.xml')) {
|
||||||
|
$dynaformHandler = new dynaformHandler(PATH_DYNAFORM . $aRow['DYN_FILENAME']. '.xml');
|
||||||
|
$nodeFieldsList = $dynaformHandler->getFields();
|
||||||
|
|
||||||
|
foreach($nodeFieldsList as $node) {
|
||||||
|
$arrayNode = $dynaformHandler->getArray($node);
|
||||||
|
$fieldName = $arrayNode['__nodeName__'];
|
||||||
|
$fieldType = $arrayNode['type'];
|
||||||
|
|
||||||
|
if (!in_array($fieldType, $excludeFieldsList) && !in_array($fieldName, $fieldsNames)) {
|
||||||
|
$fields[] = array(
|
||||||
|
'FIELD_UID' => $fieldName . '-' . $fieldType,
|
||||||
|
'FIELD_NAME' => $fieldName,
|
||||||
|
'_index' => $index++,
|
||||||
|
'_isset' => true
|
||||||
|
);
|
||||||
|
$fieldsNames[] = $fieldName;
|
||||||
|
|
||||||
|
if (in_array($fieldType, $labelFieldsTypeList) && !in_array($fieldName . '_label', $fieldsNames)) {
|
||||||
|
$fields[] = array(
|
||||||
|
'FIELD_UID' => $fieldName . '_label' . '-' . $fieldType,
|
||||||
|
'FIELD_NAME' => $fieldName . '_label',
|
||||||
|
'_index' => $index++,
|
||||||
|
'_isset' => true
|
||||||
|
);
|
||||||
|
$fieldsNames[] = $fieldName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$oDataset->next();
|
||||||
|
}
|
||||||
|
|
||||||
|
sort($fields);
|
||||||
|
|
||||||
|
// if is a editing
|
||||||
|
$fieldsEdit = array();
|
||||||
|
if (isset($_SESSION['ADD_TAB_UID'])) {
|
||||||
|
require_once 'classes/model/AdditionalTables.php';
|
||||||
|
|
||||||
|
$additionalTables = new AdditionalTables();
|
||||||
|
$table = $additionalTables->load($_SESSION['ADD_TAB_UID'], true);
|
||||||
|
|
||||||
|
foreach ($table['FIELDS'] as $i=>$field) {
|
||||||
|
array_push($fieldsEdit, $field['FLD_DYN_NAME']);
|
||||||
|
}
|
||||||
|
}//end editing
|
||||||
|
|
||||||
|
foreach($fields as $i => $field) {
|
||||||
|
$fields[$i]['_index'] = $i;
|
||||||
|
$indexes[$field['FIELD_NAME']] = $i;
|
||||||
|
|
||||||
|
if(in_array($field['FIELD_NAME'], $fieldsEdit)) {
|
||||||
|
$fields[$i]['_isset'] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION['_cache_pmtables']['pro_uid'] = $proUid;
|
||||||
|
$_SESSION['_cache_pmtables']['rows'] = $fields;
|
||||||
|
$_SESSION['_cache_pmtables']['count'] = count($fields);
|
||||||
|
$_SESSION['_cache_pmtables']['indexes'] = $indexes;
|
||||||
|
} //end reload
|
||||||
|
|
||||||
|
$fields = array();
|
||||||
|
$tmp = array();
|
||||||
|
|
||||||
|
foreach ($_SESSION['_cache_pmtables']['rows'] as $i => $row) {
|
||||||
|
if (isset($filter) && $filter != '') {
|
||||||
|
if ($row['_isset'] && stripos($row['FIELD_NAME'], $filter) !== false) {
|
||||||
|
$tmp[] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($row['_isset']) {
|
||||||
|
$tmp[] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$fields = array_slice($tmp, $start, $limit);
|
||||||
|
|
||||||
|
return array('cache'=>$cache, 'count'=>count($tmp), 'rows'=>$fields);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all dynaform grid fields from a process
|
* Get all dynaform grid fields from a process
|
||||||
* @param $proUid
|
* @param $proUid
|
||||||
@@ -895,27 +1031,38 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
*/
|
*/
|
||||||
function _getGridFields($proUid)
|
function _getGridFields($proUid)
|
||||||
{
|
{
|
||||||
|
require_once 'classes/model/Dynaform.php';
|
||||||
|
G::loadSystem('dynaformhandler');
|
||||||
$aFields = array();
|
$aFields = array();
|
||||||
$aFieldsNames = array();
|
$aFieldsNames = array();
|
||||||
require_once 'classes/model/Dynaform.php';
|
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
$oCriteria->addSelectColumn(DynaformPeer::DYN_FILENAME);
|
$oCriteria->addSelectColumn(DynaformPeer::DYN_FILENAME);
|
||||||
$oCriteria->add(DynaformPeer::PRO_UID, $proUid);
|
$oCriteria->add(DynaformPeer::PRO_UID, $proUid);
|
||||||
|
$oCriteria->add(DynaformPeer::DYN_TYPE, 'xmlform');
|
||||||
$oDataset = DynaformPeer::doSelectRS($oCriteria);
|
$oDataset = DynaformPeer::doSelectRS($oCriteria);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
|
|
||||||
while ($aRow = $oDataset->getRow()) {
|
while ($aRow = $oDataset->getRow()) {
|
||||||
$G_FORM = new Form($aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG);
|
//$G_FORM = new Form($aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG);
|
||||||
if ($G_FORM->type == 'xmlform') {
|
$dynaformHandler = new dynaformHandler(PATH_DYNAFORM . $aRow['DYN_FILENAME']. '.xml');
|
||||||
foreach($G_FORM->fields as $k => $v) {
|
$nodeFieldsList = $dynaformHandler->getFields();
|
||||||
if ($v->type == 'grid') {
|
|
||||||
if (!in_array($k, $aFieldsNames)) {
|
foreach($nodeFieldsList as $node) {
|
||||||
$aFields[] = array('name' => $k, 'xmlform' => str_replace($proUid . '/', '', $v->xmlGrid));
|
$arrayNode = $dynaformHandler->getArray($node);
|
||||||
$aFieldsNames[] = $k;
|
$fieldName = $arrayNode['__nodeName__'];
|
||||||
}
|
$fieldType = $arrayNode['type'];
|
||||||
|
|
||||||
|
if ($fieldType == 'grid') {
|
||||||
|
|
||||||
|
if (!in_array($fieldName, $aFieldsNames)) {
|
||||||
|
$aFields[] = array('name' => $fieldName, 'xmlform' => str_replace($proUid . '/', '', $arrayNode['xmlgrid']));
|
||||||
|
$aFieldsNames[] = $fieldName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
}
|
}
|
||||||
return $aFields;
|
return $aFields;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ var PROCESSMAP_STEP_EDIT = false;
|
|||||||
var PROCESSMAP_USER_EDIT = false;
|
var PROCESSMAP_USER_EDIT = false;
|
||||||
|
|
||||||
var processmapOutputsPanel;
|
var processmapOutputsPanel;
|
||||||
|
var _client = getClientWindowSize();
|
||||||
|
|
||||||
var processmap=function(){
|
var processmap=function(){
|
||||||
this.data={
|
this.data={
|
||||||
@@ -23,8 +24,8 @@ var processmap=function(){
|
|||||||
Hx = 460;
|
Hx = 460;
|
||||||
|
|
||||||
if(lanzado=='reportTables'){
|
if(lanzado=='reportTables'){
|
||||||
Wx = 800;
|
Wx = _client.width-20; //900;
|
||||||
Hx = 600;
|
Hx = _client.height-15; //600;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bbk = {
|
var bbk = {
|
||||||
@@ -163,8 +164,8 @@ var processmap=function(){
|
|||||||
iframe.setAttribute('id','reportTablesIframe');
|
iframe.setAttribute('id','reportTablesIframe');
|
||||||
iframe.src = '../pmTables?PRO_UID=' + this.options.uid;
|
iframe.src = '../pmTables?PRO_UID=' + this.options.uid;
|
||||||
iframe.style.border='0px';
|
iframe.style.border='0px';
|
||||||
iframe.style.width='786px';
|
iframe.style.width=_client.width-36;//'886px';
|
||||||
iframe.style.height='564px';
|
iframe.style.height=_client.height-60;//'564px';
|
||||||
panel.addContent(iframe);
|
panel.addContent(iframe);
|
||||||
}.extend(this),
|
}.extend(this),
|
||||||
dynaforms:function(){
|
dynaforms:function(){
|
||||||
|
|||||||
@@ -16,9 +16,12 @@ var assignAllButton;
|
|||||||
var removeButton;
|
var removeButton;
|
||||||
var removeAllButton;
|
var removeAllButton;
|
||||||
var tmp1 = new Array();
|
var tmp1 = new Array();
|
||||||
|
var pageSize = 50;
|
||||||
|
var mainMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
|
||||||
|
var bbarpaging;
|
||||||
//main
|
//main
|
||||||
Ext.onReady(function(){
|
Ext.onReady(function(){
|
||||||
|
mainMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
|
||||||
var fm = Ext.form;
|
var fm = Ext.form;
|
||||||
var fieldsCount = 0;
|
var fieldsCount = 0;
|
||||||
|
|
||||||
@@ -28,15 +31,31 @@ Ext.onReady(function(){
|
|||||||
url: '../pmTablesProxy/getDynafields'
|
url: '../pmTablesProxy/getDynafields'
|
||||||
}),
|
}),
|
||||||
reader : new Ext.data.JsonReader( {
|
reader : new Ext.data.JsonReader( {
|
||||||
root: 'processFields',
|
root: 'rows',
|
||||||
fields : [{name : 'FIELD_UID'}, {name : 'FIELD_NAME'}]
|
totalProperty: 'count',
|
||||||
|
fields : [
|
||||||
|
{name : 'FIELD_UID'},
|
||||||
|
{name : 'FIELD_NAME'},
|
||||||
|
{name : '_index'},
|
||||||
|
{name : '_isset'}
|
||||||
|
]
|
||||||
}),
|
}),
|
||||||
listeners: {
|
listeners: {
|
||||||
load: function() {
|
load: function() {
|
||||||
|
Ext.getCmp('availableGrid').store.sort();
|
||||||
|
storeA.setBaseParam('PRO_UID', (PRO_UID !== false? PRO_UID : Ext.getCmp('PROCESS').getValue()));
|
||||||
|
mainMask.hide();
|
||||||
|
assignedGrid._setTitle();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
baseParams: {
|
||||||
|
PRO_UID: ''
|
||||||
|
},
|
||||||
|
remoteSort: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
storeA.setDefaultSort('FIELD_NAME', 'asc');
|
||||||
|
|
||||||
//column model for available fields grid
|
//column model for available fields grid
|
||||||
cmodelA = new Ext.grid.ColumnModel({
|
cmodelA = new Ext.grid.ColumnModel({
|
||||||
defaults: {
|
defaults: {
|
||||||
@@ -49,6 +68,14 @@ Ext.onReady(function(){
|
|||||||
dataIndex: 'FIELD_UID',
|
dataIndex: 'FIELD_UID',
|
||||||
hidden:true,
|
hidden:true,
|
||||||
hideable:false
|
hideable:false
|
||||||
|
}, {
|
||||||
|
dataIndex:'_index',
|
||||||
|
hidden:true,
|
||||||
|
hideable:false
|
||||||
|
}, {
|
||||||
|
dataIndex:'_isset',
|
||||||
|
hidden:true,
|
||||||
|
hideable:false
|
||||||
}, {
|
}, {
|
||||||
header : _("ID_DYNAFORM_FIELDS"),
|
header : _("ID_DYNAFORM_FIELDS"),
|
||||||
dataIndex : 'FIELD_NAME',
|
dataIndex : 'FIELD_NAME',
|
||||||
@@ -69,6 +96,43 @@ Ext.onReady(function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
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: storeA,
|
||||||
|
displayInfo: true,
|
||||||
|
displayMsg: '{0} - {1} of {2}',
|
||||||
|
emptyMsg: 'No records'/*,
|
||||||
|
items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]*/
|
||||||
|
});
|
||||||
|
|
||||||
//grid for table columns grid
|
//grid for table columns grid
|
||||||
availableGrid = new Ext.grid.GridPanel({
|
availableGrid = new Ext.grid.GridPanel({
|
||||||
layout : 'fit',
|
layout : 'fit',
|
||||||
@@ -80,7 +144,7 @@ Ext.onReady(function(){
|
|||||||
autoWidth : true,
|
autoWidth : true,
|
||||||
stripeRows : true,
|
stripeRows : true,
|
||||||
height : 100,
|
height : 100,
|
||||||
width : 200,
|
width : '25%',
|
||||||
stateful : true,
|
stateful : true,
|
||||||
stateId : 'grid',
|
stateId : 'grid',
|
||||||
enableHdMenu : false,
|
enableHdMenu : false,
|
||||||
@@ -89,11 +153,50 @@ Ext.onReady(function(){
|
|||||||
cm : cmodelA,
|
cm : cmodelA,
|
||||||
sm : smodelA,
|
sm : smodelA,
|
||||||
store : storeA,
|
store : storeA,
|
||||||
|
//loadMask: {message:'Loading...'},
|
||||||
listeners : {
|
listeners : {
|
||||||
rowdblclick: AssignFieldsAction
|
rowdblclick: AssignFieldsAction
|
||||||
}
|
},
|
||||||
|
tbar: [
|
||||||
|
'->',
|
||||||
|
{
|
||||||
|
xtype: 'textfield',
|
||||||
|
id: 'searchTxt',
|
||||||
|
ctCls:'pm_search_text_field',
|
||||||
|
allowBlank: true,
|
||||||
|
width: 150,
|
||||||
|
emptyText: _('ID_ENTER_SEARCH_TERM'),
|
||||||
|
listeners: {
|
||||||
|
specialkey: function(f,e){
|
||||||
|
if (e.getKey() == e.ENTER) {
|
||||||
|
filterAvFields();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'X',
|
||||||
|
ctCls:'pm_search_x_button',
|
||||||
|
handler: function(){
|
||||||
|
Ext.getCmp('searchTxt').setValue('');
|
||||||
|
filterAvFields();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
text: 'Filter',
|
||||||
|
handler: function(){
|
||||||
|
filterAvFields();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
bbar: bbarpaging
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var filterAvFields = function() {
|
||||||
|
//availableGrid.store.load({params: {textFilter: Ext.getCmp('searchTxt').getValue()}});
|
||||||
|
//storeA.setParam('textFilter', Ext.getCmp('searchTxt').getValue());
|
||||||
|
storeA.reload({params: {textFilter: Ext.getCmp('searchTxt').getValue(), start: bbarpaging.cursor, limit: pageSize}});
|
||||||
|
}
|
||||||
|
|
||||||
//selecion model for table columns grid
|
//selecion model for table columns grid
|
||||||
sm = new Ext.grid.RowSelectionModel({
|
sm = new Ext.grid.RowSelectionModel({
|
||||||
selectSingle: false,
|
selectSingle: false,
|
||||||
@@ -106,8 +209,9 @@ Ext.onReady(function(){
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
var record = Ext.getCmp('assignedGrid').getSelectionModel().getSelected();
|
var record = Ext.getCmp('assignedGrid').getSelectionModel().getSelected();
|
||||||
|
Ext.getCmp('removeButton').enable();
|
||||||
|
|
||||||
if (record.data.field_dyn == '' && record.data.field_name != 'APP_UID' && record.data.field_name != 'APP_NUMBER' && record.data.field_name != 'ROW') {
|
if (record.data.field_dyn != '' && record.data.field_name != 'APP_UID' && record.data.field_name != 'APP_NUMBER' && record.data.field_name != 'ROW') {
|
||||||
Ext.getCmp('removeColumn').enable();
|
Ext.getCmp('removeColumn').enable();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -133,6 +237,14 @@ Ext.onReady(function(){
|
|||||||
dataIndex: 'uid',
|
dataIndex: 'uid',
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
dataIndex: '_index',
|
||||||
|
hidden: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: '_isset',
|
||||||
|
hidden: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'field_uid',
|
id: 'field_uid',
|
||||||
dataIndex: 'field_uid',
|
dataIndex: 'field_uid',
|
||||||
@@ -247,6 +359,8 @@ Ext.onReady(function(){
|
|||||||
store = new Ext.data.ArrayStore({
|
store = new Ext.data.ArrayStore({
|
||||||
fields: [
|
fields: [
|
||||||
{name: 'uid', type: 'string'},
|
{name: 'uid', type: 'string'},
|
||||||
|
{name: '_index'},
|
||||||
|
{name: '_isset'},
|
||||||
{name: 'field_uid', type: 'string'},
|
{name: 'field_uid', type: 'string'},
|
||||||
{name: 'field_key', type: 'string'},
|
{name: 'field_key', type: 'string'},
|
||||||
{name: 'field_name', type: 'string'},
|
{name: 'field_name', type: 'string'},
|
||||||
@@ -276,7 +390,7 @@ Ext.onReady(function(){
|
|||||||
|
|
||||||
//table columns grid
|
//table columns grid
|
||||||
assignedGrid = new Ext.grid.GridPanel({
|
assignedGrid = new Ext.grid.GridPanel({
|
||||||
//title: 'Columns',
|
title: 'New Report Table',
|
||||||
region : 'center',
|
region : 'center',
|
||||||
id : 'assignedGrid',
|
id : 'assignedGrid',
|
||||||
ddGroup : 'availableGridDDGroup',
|
ddGroup : 'availableGridDDGroup',
|
||||||
@@ -286,6 +400,7 @@ Ext.onReady(function(){
|
|||||||
sm : sm,
|
sm : sm,
|
||||||
store : store,
|
store : store,
|
||||||
plugins : [editor, checkColumn],
|
plugins : [editor, checkColumn],
|
||||||
|
loadMask: {message:'Loading...'},
|
||||||
tbar : [
|
tbar : [
|
||||||
{
|
{
|
||||||
icon: '/images/add-row-after.png',
|
icon: '/images/add-row-after.png',
|
||||||
@@ -333,6 +448,9 @@ Ext.onReady(function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
_setTitle: function() {
|
||||||
|
this.setTitle('Report Table: ' + Ext.getCmp('REP_TAB_NAME').getValue() + ' ('+store.getCount()+' columns)');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -497,7 +615,7 @@ Ext.onReady(function(){
|
|||||||
gridsListStore = new Ext.data.Store({
|
gridsListStore = new Ext.data.Store({
|
||||||
//autoLoad: true,
|
//autoLoad: true,
|
||||||
proxy : new Ext.data.HttpProxy({
|
proxy : new Ext.data.HttpProxy({
|
||||||
url: '../pmTablesProxy/availableFieldsReportTables',
|
url: '../pmTablesProxy/getDynafields',
|
||||||
method : 'POST'
|
method : 'POST'
|
||||||
}),
|
}),
|
||||||
baseParams : {
|
baseParams : {
|
||||||
@@ -505,7 +623,7 @@ Ext.onReady(function(){
|
|||||||
TYPE: 'GRID'
|
TYPE: 'GRID'
|
||||||
},
|
},
|
||||||
reader : new Ext.data.JsonReader( {
|
reader : new Ext.data.JsonReader( {
|
||||||
root : 'processFields',
|
//root : 'processFields',
|
||||||
fields : [{name : 'FIELD_UID'}, {name : 'FIELD_NAME'}]
|
fields : [{name : 'FIELD_UID'}, {name : 'FIELD_NAME'}]
|
||||||
}),
|
}),
|
||||||
listeners: {
|
listeners: {
|
||||||
@@ -595,9 +713,11 @@ Ext.onReady(function(){
|
|||||||
comboDbConnections.getStore().reload({params:{PRO_UID : Ext.getCmp('PROCESS').getValue()}});
|
comboDbConnections.getStore().reload({params:{PRO_UID : Ext.getCmp('PROCESS').getValue()}});
|
||||||
|
|
||||||
// loading available fields
|
// loading available fields
|
||||||
//if (TABLE.ADD_TAB_TYPE == 'NORMAL') {
|
//loadAvFieldsFromArray(avFieldsList);
|
||||||
loadAvFieldsFromArray(avFieldsList);
|
if (TABLE.ADD_TAB_TYPE == 'GRID')
|
||||||
//}
|
loadFieldsGrids();
|
||||||
|
else
|
||||||
|
loadFieldNormal();
|
||||||
|
|
||||||
// loading table fields
|
// loading table fields
|
||||||
loadTableRowsFromArray(TABLE.FIELDS);
|
loadTableRowsFromArray(TABLE.FIELDS);
|
||||||
@@ -662,7 +782,8 @@ Ext.onReady(function(){
|
|||||||
style:'text-transform: uppercase',
|
style:'text-transform: uppercase',
|
||||||
listeners:{
|
listeners:{
|
||||||
change: function(){
|
change: function(){
|
||||||
this.setValue(this.getValue().toUpperCase())
|
this.setValue(this.getValue().toUpperCase());
|
||||||
|
assignedGrid._setTitle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -746,7 +867,8 @@ Ext.onReady(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (TABLE === false) {
|
if (TABLE === false) {
|
||||||
loadFieldNormal();
|
if(TABLE.ADD_TAB_TYPE != 'GRID')
|
||||||
|
loadFieldNormal();
|
||||||
} //else if(typeof avFieldsList != 'undefined')
|
} //else if(typeof avFieldsList != 'undefined')
|
||||||
//loadAvFieldsFromArray(avFieldsList);
|
//loadAvFieldsFromArray(avFieldsList);
|
||||||
|
|
||||||
@@ -845,6 +967,10 @@ function createReportTable()
|
|||||||
//add custon column for assignedGrid
|
//add custon column for assignedGrid
|
||||||
function addColumn()
|
function addColumn()
|
||||||
{
|
{
|
||||||
|
if (!verifyTableLimit()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var PMRow = assignedGrid.getStore().recordType;
|
var PMRow = assignedGrid.getStore().recordType;
|
||||||
var row = new PMRow({
|
var row = new PMRow({
|
||||||
uid : '',
|
uid : '',
|
||||||
@@ -877,100 +1003,45 @@ function removeColumn()
|
|||||||
////ASSIGNBUTON FUNCTIONALITY
|
////ASSIGNBUTON FUNCTIONALITY
|
||||||
AssignFieldsAction = function(){
|
AssignFieldsAction = function(){
|
||||||
records = Ext.getCmp('availableGrid').getSelectionModel().getSelections();
|
records = Ext.getCmp('availableGrid').getSelectionModel().getSelections();
|
||||||
|
setReportFields(records);
|
||||||
for(i=0; i < records.length; i++){
|
|
||||||
var PMRow = assignedGrid.getStore().recordType;
|
|
||||||
var meta = mapPMFieldType(records[i].data['FIELD_UID']);
|
|
||||||
var row = new PMRow({
|
|
||||||
uid : '',
|
|
||||||
field_uid : records[i].data['FIELD_UID'],
|
|
||||||
field_dyn : records[i].data['FIELD_NAME'],
|
|
||||||
field_name : records[i].data['FIELD_NAME'].toUpperCase(),
|
|
||||||
field_label : records[i].data['FIELD_NAME'].toUpperCase(),
|
|
||||||
field_type : meta.type,
|
|
||||||
field_size : meta.size,
|
|
||||||
field_key : 0,
|
|
||||||
field_null : 1
|
|
||||||
});
|
|
||||||
|
|
||||||
store.add(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
//remove from source grid
|
|
||||||
Ext.each(records, Ext.getCmp('availableGrid').store.remove, Ext.getCmp('availableGrid').store);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//RemoveButton Functionality
|
//RemoveButton Functionality
|
||||||
RemoveFieldsAction = function(){
|
RemoveFieldsAction = function(){
|
||||||
|
|
||||||
records = Ext.getCmp('assignedGrid').getSelectionModel().getSelections();
|
records = Ext.getCmp('assignedGrid').getSelectionModel().getSelections();
|
||||||
var PMRow = availableGrid.getStore().recordType;
|
|
||||||
for(i=0; i < records.length; i++){
|
|
||||||
if (records[i].data['field_dyn'] != '' && records[i].data['field_name'] != 'APP_UID' && records[i].data['field_name'] != 'APP_NUMBER' && records[i].data['field_name'] != 'ROW') {
|
|
||||||
var row = new PMRow({
|
|
||||||
FIELD_UID : records[i].data['field_uid'],
|
|
||||||
FIELD_NAME : records[i].data['field_dyn']
|
|
||||||
});
|
|
||||||
availableGrid.getStore().add(row);
|
|
||||||
} else {
|
|
||||||
records[i] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//remove from source grid
|
//remove from source grid
|
||||||
Ext.each(records, Ext.getCmp('assignedGrid').store.remove, Ext.getCmp('assignedGrid').store);
|
unsetReportFields(records);
|
||||||
};
|
};
|
||||||
|
|
||||||
//AssignALLButton Functionality
|
//AssignALLButton Functionality
|
||||||
AssignAllFieldsAction = function(){
|
AssignAllFieldsAction = function(){
|
||||||
var available = Ext.getCmp('availableGrid');
|
var avStore = Ext.getCmp('availableGrid').getStore();
|
||||||
var allRows = available.getStore();
|
var records = new Array();
|
||||||
var arrAux = new Array();
|
|
||||||
records = new Array()
|
|
||||||
|
|
||||||
if (allRows.getCount() > 0){
|
if (avStore.getCount() > 0){
|
||||||
var PMRow = assignedGrid.getStore().recordType;
|
for (i=0; i < avStore.getCount(); i++){
|
||||||
for (i=0; i < allRows.getCount(); i++){
|
records[i] = avStore.getAt(i);
|
||||||
records[i] = allRows.getAt(i);
|
|
||||||
var meta = mapPMFieldType(records[i].data['FIELD_UID']);
|
|
||||||
var row = new PMRow({
|
|
||||||
uid : '',
|
|
||||||
field_uid : records[i].data['FIELD_UID'],
|
|
||||||
field_dyn : records[i].data['FIELD_NAME'],
|
|
||||||
field_name : records[i].data['FIELD_NAME'].toUpperCase(),
|
|
||||||
field_label : records[i].data['FIELD_NAME'].toUpperCase(),
|
|
||||||
field_type : meta.type,
|
|
||||||
field_size : meta.size,
|
|
||||||
field_key : 0,
|
|
||||||
field_null : 1
|
|
||||||
});
|
|
||||||
|
|
||||||
store.add(row);
|
|
||||||
}
|
}
|
||||||
//remove from source grid
|
setReportFields(records);
|
||||||
Ext.each(records, Ext.getCmp('availableGrid').store.remove, Ext.getCmp('availableGrid').store);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//RevomeALLButton Functionality
|
//RevomeALLButton Functionality
|
||||||
RemoveAllFieldsAction = function(){
|
RemoveAllFieldsAction = function(){
|
||||||
|
|
||||||
|
if (store.getCount() > 100) {
|
||||||
|
PMExt.info('Notice', 'This action was disabled to prevent low performance on your browser. This is because there is more than 100 records on the columns definition grid. <br/><br/>Please perform this action with manual selection only.');
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
var allRows = Ext.getCmp('assignedGrid').getStore();
|
var allRows = Ext.getCmp('assignedGrid').getStore();
|
||||||
var records = new Array();
|
var records = new Array();
|
||||||
if (allRows.getCount() > 0) {
|
if (allRows.getCount() > 0) {
|
||||||
var PMRow = availableGrid.getStore().recordType;
|
|
||||||
for (var i=0; i < allRows.getCount(); i++){
|
for (var i=0; i < allRows.getCount(); i++){
|
||||||
records[i] = allRows.getAt(i);
|
records[i] = allRows.getAt(i);
|
||||||
if (records[i].data['field_dyn'] != '' && records[i].data['field_name'] != 'APP_UID' && records[i].data['field_name'] != 'APP_NUMBER' && records[i].data['field_name'] != 'ROW') {
|
|
||||||
var row = new PMRow({
|
|
||||||
FIELD_UID : records[i].data['field_uid'],
|
|
||||||
FIELD_NAME : records[i].data['field_dyn']
|
|
||||||
});
|
|
||||||
availableGrid.getStore().add(row);
|
|
||||||
} else {
|
|
||||||
records[i] = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//remove from source grid
|
//remove from source grid
|
||||||
Ext.each(records, Ext.getCmp('assignedGrid').store.remove, Ext.getCmp('assignedGrid').store);
|
unsetReportFields(records);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -980,7 +1051,9 @@ loadFieldNormal = function(){
|
|||||||
Ext.getCmp('availableGrid').store.load({
|
Ext.getCmp('availableGrid').store.load({
|
||||||
params: {
|
params: {
|
||||||
action: "getDynafields",
|
action: "getDynafields",
|
||||||
PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue()
|
PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(),
|
||||||
|
start: 0,
|
||||||
|
limit: pageSize
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Ext.getCmp('assignedGrid').store.removeAll();
|
Ext.getCmp('assignedGrid').store.removeAll();
|
||||||
@@ -995,7 +1068,9 @@ loadFieldsGrids = function(){
|
|||||||
action: "getDynafields",
|
action: "getDynafields",
|
||||||
PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(),
|
PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(),
|
||||||
TYPE: 'GRID',
|
TYPE: 'GRID',
|
||||||
GRID_UID: Ext.getCmp('REP_TAB_GRID').getValue()
|
GRID_UID: Ext.getCmp('REP_TAB_GRID').getValue(),
|
||||||
|
start: 0,
|
||||||
|
limit: pageSize
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1023,28 +1098,8 @@ var DDLoadFields = function(){
|
|||||||
var availableGridDropTarget = new Ext.dd.DropTarget(availableGridDropTargetEl, {
|
var availableGridDropTarget = new Ext.dd.DropTarget(availableGridDropTargetEl, {
|
||||||
ddGroup : 'availableGridDDGroup',
|
ddGroup : 'availableGridDDGroup',
|
||||||
notifyDrop : function(ddSource, e, data){
|
notifyDrop : function(ddSource, e, data){
|
||||||
|
|
||||||
var records = ddSource.dragData.selections;
|
var records = ddSource.dragData.selections;
|
||||||
var PMRow = availableGrid.getStore().recordType;
|
unsetReportFields(records);
|
||||||
|
|
||||||
for (i=0; i < records.length; i++) {
|
|
||||||
if (records[i].data['field_dyn'] != '') {
|
|
||||||
var row = new PMRow({
|
|
||||||
FIELD_UID: records[i].data['field_uid'],
|
|
||||||
FIELD_NAME: records[i].data['field_dyn']
|
|
||||||
});
|
|
||||||
availableGrid.getStore().add(row);
|
|
||||||
} else {
|
|
||||||
if ( records[i].data['field_name'] == 'APP_UID'
|
|
||||||
|| records[i].data['field_name'] == 'APP_NUMBER'
|
|
||||||
|| records[i].data['field_name'] == 'ROW')
|
|
||||||
{
|
|
||||||
records[i] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ext.each(records, ddSource.grid.store.remove, ddSource.grid.store);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1054,37 +1109,104 @@ var DDLoadFields = function(){
|
|||||||
var assignedGridDropTarget = new Ext.dd.DropTarget(assignedGridDropTargetEl, {
|
var assignedGridDropTarget = new Ext.dd.DropTarget(assignedGridDropTargetEl, {
|
||||||
ddGroup : 'assignedGridDDGroup',
|
ddGroup : 'assignedGridDDGroup',
|
||||||
notifyDrop : function(ddSource, e, data){
|
notifyDrop : function(ddSource, e, data){
|
||||||
|
|
||||||
var records = ddSource.dragData.selections;
|
|
||||||
var PMRow = assignedGrid.getStore().recordType;
|
|
||||||
|
|
||||||
//add on target grid
|
//add on target grid
|
||||||
for (i=0; i < records.length; i++){
|
setReportFields(ddSource.dragData.selections)
|
||||||
//arrAux[r] = records[r].data['FIELD_UID'];
|
|
||||||
var meta = mapPMFieldType(records[i].data['FIELD_UID']);
|
|
||||||
var row = new PMRow({
|
|
||||||
uid : '',
|
|
||||||
field_uid : records[i].data['FIELD_UID'],
|
|
||||||
field_dyn : records[i].data['FIELD_NAME'],
|
|
||||||
field_name : records[i].data['FIELD_NAME'].toUpperCase(),
|
|
||||||
field_label : records[i].data['FIELD_NAME'].toUpperCase(),
|
|
||||||
field_type : meta.type,
|
|
||||||
field_size : meta.size,
|
|
||||||
field_key : 0,
|
|
||||||
field_null : 1
|
|
||||||
});
|
|
||||||
|
|
||||||
store.add(row);
|
|
||||||
}
|
|
||||||
//remove from source grid
|
|
||||||
Ext.each(records, availableGrid.store.remove, availableGrid.store);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//sw_func_groups = true;
|
//sw_func_groups = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function setReportFields(records) {
|
||||||
|
mainMask.show();
|
||||||
|
|
||||||
|
var PMRow = assignedGrid.getStore().recordType;
|
||||||
|
var indexes = new Array();
|
||||||
|
|
||||||
|
for (i=0; i < records.length; i++) {
|
||||||
|
if (!verifyTableLimit()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var meta = mapPMFieldType(records[i].data['FIELD_UID']);
|
||||||
|
var row = new PMRow({
|
||||||
|
uid : '',
|
||||||
|
field_uid : records[i].data['FIELD_UID'],
|
||||||
|
field_dyn : records[i].data['FIELD_NAME'],
|
||||||
|
field_name : records[i].data['FIELD_NAME'].toUpperCase(),
|
||||||
|
field_label : records[i].data['FIELD_NAME'].toUpperCase(),
|
||||||
|
field_type : meta.type,
|
||||||
|
field_size : meta.size,
|
||||||
|
field_key : 0,
|
||||||
|
field_null : 1,
|
||||||
|
_index : records[i].data['_index'] ? records[i].data['_index'] : records[i].data['FIELD_DYN']
|
||||||
|
});
|
||||||
|
|
||||||
|
store.add(row);
|
||||||
|
indexes.push(records[i].data['_index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove from source grid
|
||||||
|
Ext.each(records, availableGrid.store.remove, availableGrid.store);
|
||||||
|
|
||||||
|
//update on server
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url: '../pmTablesProxy/updateAvDynafields',
|
||||||
|
params: {
|
||||||
|
PRO_UID : PRO_UID !== false? PRO_UID : Ext.getCmp('PROCESS').getValue(),
|
||||||
|
indexes : indexes.join(','),
|
||||||
|
isset : false
|
||||||
|
},
|
||||||
|
success: function(resp){
|
||||||
|
result = Ext.util.JSON.decode(resp.responseText);
|
||||||
|
availableGrid.store.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function unsetReportFields(records) {
|
||||||
|
mainMask.show();
|
||||||
|
|
||||||
|
var PMRow = availableGrid.getStore().recordType;
|
||||||
|
var indexes = new Array();
|
||||||
|
|
||||||
|
for (i=0; i < records.length; i++) {
|
||||||
|
if (records[i].data['field_dyn'] != '') {
|
||||||
|
var row = new PMRow({
|
||||||
|
FIELD_UID: records[i].data['field_uid'],
|
||||||
|
FIELD_NAME: records[i].data['field_dyn']
|
||||||
|
});
|
||||||
|
availableGrid.getStore().add(row);
|
||||||
|
ix = records[i].data['_index'] != '' ? records[i].data['_index'] : records[i].data['field_dyn']
|
||||||
|
indexes.push(ix);
|
||||||
|
} else {
|
||||||
|
if ( records[i].data['field_name'] == 'APP_UID'
|
||||||
|
|| records[i].data['field_name'] == 'APP_NUMBER'
|
||||||
|
|| records[i].data['field_name'] == 'ROW')
|
||||||
|
{
|
||||||
|
records[i] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ext.each(records, assignedGrid.store.remove, assignedGrid.store);
|
||||||
|
|
||||||
|
//update on server
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url: '../pmTablesProxy/updateAvDynafields',
|
||||||
|
params: {
|
||||||
|
PRO_UID : PRO_UID !== false? PRO_UID : Ext.getCmp('PROCESS').getValue(),
|
||||||
|
indexes : indexes.join(','),
|
||||||
|
isset : true
|
||||||
|
},
|
||||||
|
success: function(resp){
|
||||||
|
result = Ext.util.JSON.decode(resp.responseText);
|
||||||
|
availableGrid.store.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function loadTableRowsFromArray(records)
|
function loadTableRowsFromArray(records)
|
||||||
{
|
{
|
||||||
var PMRow = assignedGrid.getStore().recordType;
|
var PMRow = assignedGrid.getStore().recordType;
|
||||||
@@ -1101,7 +1223,8 @@ function loadTableRowsFromArray(records)
|
|||||||
field_size : records[i].FLD_SIZE,
|
field_size : records[i].FLD_SIZE,
|
||||||
field_key : records[i].FLD_KEY,
|
field_key : records[i].FLD_KEY,
|
||||||
field_null : records[i].FLD_NULL,
|
field_null : records[i].FLD_NULL,
|
||||||
field_filter: records[i].FLD_FILTER == '1' ? true : false
|
field_filter: records[i].FLD_FILTER == '1' ? true : false,
|
||||||
|
_index : ''
|
||||||
});
|
});
|
||||||
|
|
||||||
store.add(row);
|
store.add(row);
|
||||||
@@ -1183,3 +1306,15 @@ Ext.override(Ext.form.TextField, {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function verifyTableLimit()
|
||||||
|
{
|
||||||
|
if( store.getCount() >= 255 ) {
|
||||||
|
mainMask.hide();
|
||||||
|
PMExt.info('Notice', 'The maximun limit of columns for a database table is 255, you already have them defined!');
|
||||||
|
assignedGrid._setTitle();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user