improving the dynaform list for new bpmn editor
This commit is contained in:
@@ -5129,6 +5129,7 @@ class processMap {
|
||||
}
|
||||
|
||||
//new functions
|
||||
//deprecated
|
||||
function getAllDynaformCount(){
|
||||
$c = $this->tmpCriteria;
|
||||
$c->clearSelectColumns();
|
||||
@@ -5150,10 +5151,11 @@ class processMap {
|
||||
*/
|
||||
function getExtDynaformsList($start, $limit, $sProcessUID = '')
|
||||
{
|
||||
//select the main fields for dynaform and the title and description from CONTENT Table
|
||||
$sDelimiter = DBAdapter::getStringDelimiter ();
|
||||
$oCriteria = new Criteria ( 'workflow' );
|
||||
$oCriteria->addSelectColumn ( DynaformPeer::DYN_UID );
|
||||
$oCriteria->addSelectColumn ( DynaformPeer::PRO_UID );
|
||||
//$oCriteria->addSelectColumn ( DynaformPeer::PRO_UID );
|
||||
$oCriteria->addSelectColumn ( DynaformPeer::DYN_TYPE );
|
||||
$oCriteria->addAsColumn ( 'DYN_TITLE', 'C1.CON_VALUE' );
|
||||
$oCriteria->addAsColumn ( 'DYN_DESCRIPTION', 'C2.CON_VALUE' );
|
||||
@@ -5170,10 +5172,11 @@ class processMap {
|
||||
$aConditions [] = array ('C2.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter );
|
||||
$oCriteria->addJoinMC ( $aConditions, Criteria::LEFT_JOIN );
|
||||
$oCriteria->add ( DynaformPeer::PRO_UID, $sProcessUID );
|
||||
$this->tmpCriteria = clone $oCriteria;
|
||||
|
||||
//if we have pagination, we use it and limit the query
|
||||
if($start != '')
|
||||
$oCriteria->setOffset($start);
|
||||
|
||||
if($limit != '')
|
||||
$oCriteria->setLimit($limit);
|
||||
|
||||
@@ -5181,23 +5184,82 @@ class processMap {
|
||||
$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next ();
|
||||
$dynaformArray = array ();
|
||||
$dynaformArray [] = array ('d' => 'char' );
|
||||
$gridLabel = G::LoadTranslation( 'ID_GRID' );
|
||||
$normalLabel = G::LoadTranslation( 'ID_NORMAL' );
|
||||
|
||||
while ( $aRow = $oDataset->getRow () ) {
|
||||
//this is a trick to copy the description and title from other language when the current language does not exist for this content row.
|
||||
if (($aRow ['DYN_TITLE'] == NULL)||($aRow ['DYN_TITLE'] == "")) { // There is no transaltion for this Document name, try to get/regenerate the label
|
||||
|
||||
$aRow ['DYN_TITLE'] = Content::Load("DYN_TITLE","",$aRow ['DYN_UID'],SYS_LANG);
|
||||
|
||||
}
|
||||
if (($aRow ['DYN_DESCRIPTION'] == NULL)||($aRow ['DYN_DESCRIPTION'] == "")) { // There is no transaltion for this Document name, try to get/regenerate the label
|
||||
|
||||
$aRow ['DYN_DESCRIPTION'] = Content::Load("DYN_DESCRIPTION","",$aRow ['DYN_UID'],SYS_LANG);
|
||||
|
||||
}
|
||||
|
||||
if ( $aRow['DYN_TYPE'] == 'grid' ) $aRow['DYN_TYPE'] = $gridLabel;
|
||||
if ( $aRow['DYN_TYPE'] == 'xmlform' ) $aRow['DYN_TYPE'] = $normalLabel;
|
||||
$aRow['TAS_EDIT'] = 0;
|
||||
$aRow['TAS_VIEW'] = 0;
|
||||
$dynaformArray [] = $aRow;
|
||||
$oDataset->next ();
|
||||
}
|
||||
$result = array();
|
||||
|
||||
return $dynaformArray;
|
||||
//Now count how many times the dynaform was used in different tasks in VIEW mode,
|
||||
$groupbyCriteria = new Criteria ( 'workflow' );
|
||||
$groupbyCriteria->clearSelectColumns();
|
||||
$groupbyCriteria->addSelectColumn ( StepPeer::STEP_UID_OBJ );
|
||||
$groupbyCriteria->addSelectColumn('COUNT(TAS_UID)');
|
||||
$groupbyCriteria->add(StepPeer::PRO_UID, $sProcessUID );
|
||||
$groupbyCriteria->add(StepPeer::STEP_TYPE_OBJ, 'DYNAFORM' );
|
||||
$groupbyCriteria->add(StepPeer::STEP_MODE, 'VIEW');
|
||||
$groupbyCriteria->addGroupByColumn(StepPeer::STEP_UID_OBJ);
|
||||
$oDataset = DynaformPeer::doSelectRS ( $groupbyCriteria );
|
||||
$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next ();
|
||||
while ( $aRow = $oDataset->getRow () ) {
|
||||
foreach ( $dynaformArray as $key => $val ) {
|
||||
if ($val['DYN_UID'] == $aRow['STEP_UID_OBJ'] ) $dynaformArray[$key]['TAS_VIEW'] = $aRow['COUNT(TAS_UID)'] ;
|
||||
}
|
||||
$oDataset->next ();
|
||||
}
|
||||
|
||||
//Now count how many times the dynaform was used in different tasks in EDIT mode,
|
||||
$groupbyCriteria = new Criteria ( 'workflow' );
|
||||
$groupbyCriteria->clearSelectColumns();
|
||||
$groupbyCriteria->addSelectColumn ( StepPeer::STEP_UID_OBJ );
|
||||
$groupbyCriteria->addSelectColumn('COUNT(TAS_UID)');
|
||||
$groupbyCriteria->add(StepPeer::PRO_UID, $sProcessUID );
|
||||
$groupbyCriteria->add(StepPeer::STEP_TYPE_OBJ, 'DYNAFORM' );
|
||||
$groupbyCriteria->add(StepPeer::STEP_MODE, 'EDIT');
|
||||
$groupbyCriteria->addGroupByColumn(StepPeer::STEP_UID_OBJ);
|
||||
$oDataset = DynaformPeer::doSelectRS ( $groupbyCriteria );
|
||||
$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next ();
|
||||
while ( $aRow = $oDataset->getRow () ) {
|
||||
foreach ( $dynaformArray as $key => $val ) {
|
||||
if ($val['DYN_UID'] == $aRow['STEP_UID_OBJ'] ) $dynaformArray[$key]['TAS_EDIT'] = $aRow['COUNT(TAS_UID)'] ;
|
||||
}
|
||||
$oDataset->next ();
|
||||
}
|
||||
|
||||
//now query to get total dynaform for this process,
|
||||
//$counCriteria is used to count how many dynaforms there are in this process
|
||||
$countCriteria = new Criteria ( 'workflow' );
|
||||
$countCriteria->clearSelectColumns();
|
||||
$countCriteria->addSelectColumn('COUNT(*)');
|
||||
$countCriteria->add ( DynaformPeer::PRO_UID, $sProcessUID );
|
||||
$oDataset = DynaformPeer::doSelectRS($countCriteria);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
if( is_array($aRow) )
|
||||
$result['totalCount'] = $aRow[0];
|
||||
else
|
||||
$result['totalCount'] = 0;
|
||||
$result['data'] = $dynaformArray;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,34 +1,31 @@
|
||||
<?php
|
||||
G::LoadClass('processMap');
|
||||
$oProcessMap = new processMap(new DBConnection);
|
||||
//$_GET['sid'] gets STEP_UID and sTYPE(i.e BEFORE and AFTER) in format STEP_UID-sTYPE
|
||||
if(isset($_GET['stepid'])){
|
||||
G::LoadClass('processMap');
|
||||
$oProcessMap = new processMap(new DBConnection);
|
||||
|
||||
//$_GET['sid'] gets STEP_UID and sTYPE(i.e BEFORE and AFTER) in format STEP_UID-sTYPE
|
||||
if(isset($_GET['stepid'])){
|
||||
$aStepTypeId = explode('|',$_GET['stepid']);
|
||||
$_SESSION['stepUID'] = $_GET['stepid'];
|
||||
//$aStepTypeId = explode('-','2517180104cd42c25cc39e4071099227-BEFORE');
|
||||
$sStep = $aStepTypeId[0];
|
||||
$sType = $aStepTypeId[1];
|
||||
}
|
||||
}
|
||||
|
||||
//$_GET['sid'] gets STEP_UID and sTYPE(i.e BEFORE and AFTER) in format STEP_UID-sTYPE
|
||||
if(isset($_GET['stepid'])){
|
||||
//$_GET['sid'] gets STEP_UID and sTYPE(i.e BEFORE and AFTER) in format STEP_UID-sTYPE
|
||||
if(isset($_GET['stepid'])){
|
||||
$aStepTypeId = explode('|',$_GET['stepid']);
|
||||
$_SESSION['stepUID'] = $_GET['stepid'];
|
||||
//$aStepTypeId = explode('-','2517180104cd42c25cc39e4071099227-BEFORE');
|
||||
$sStep = $aStepTypeId[0];
|
||||
$sType = $aStepTypeId[1];
|
||||
}
|
||||
}
|
||||
|
||||
$start = isset($_POST['start'])? $_POST['start']: 0;
|
||||
$limit = isset($_POST['limit'])? $_POST['limit']: '';
|
||||
$start = isset($_POST['start'])? $_POST['start']: 0;
|
||||
$limit = isset($_POST['limit'])? $_POST['limit']: '';
|
||||
|
||||
switch($_GET['action'])
|
||||
{
|
||||
case 'getDynaformList':
|
||||
$rows = $oProcessMap->getExtDynaformsList($start, $limit, $_GET['pid']);
|
||||
$result['totalCount'] = $oProcessMap->getAllDynaformCount();
|
||||
array_shift($rows);
|
||||
$result['data'] = $rows;
|
||||
switch( $_GET['action'] ) {
|
||||
case 'getDynaformList' :
|
||||
$result = $oProcessMap->getExtDynaformsList($start, $limit, $_GET['pid']);
|
||||
print json_encode( $result ) ;
|
||||
break;
|
||||
|
||||
@@ -336,13 +333,12 @@ switch($_GET['action'])
|
||||
$result = $tmpData;
|
||||
echo $result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//$result['data'] = $rows;
|
||||
//print json_encode( $result ) ;
|
||||
/*$tmpData = json_encode( $rows ) ;
|
||||
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
|
||||
|
||||
$result = $tmpData;
|
||||
echo $result;*/
|
||||
?>
|
||||
|
||||
|
||||
@@ -46,9 +46,9 @@ if( $access != 1 ){
|
||||
}
|
||||
$processUID = $_GET['PRO_UID'];
|
||||
|
||||
if ( isset($_SESSION['PROCESSMAP']) && $_SESSION['PROCESSMAP'] == 'BPMN' ) {
|
||||
header ( "Location: ../bpmn/processmap?PRO_UID=". $processUID );
|
||||
}
|
||||
//if ( isset($_SESSION['PROCESSMAP']) && $_SESSION['PROCESSMAP'] == 'BPMN' ) {
|
||||
// header ( "Location: ../bpmn/processmap?PRO_UID=". $processUID );
|
||||
//}
|
||||
|
||||
$_SESSION['PROCESS'] = $processUID;
|
||||
$_SESSION['PROCESSMAP'] = 'LEIMNUD';
|
||||
|
||||
@@ -15,7 +15,9 @@ ProcessOptions.prototype.addDynaform= function(_5625)
|
||||
{name: 'DYN_UID'},
|
||||
{name: 'DYN_TYPE'},
|
||||
{name: 'DYN_TITLE'},
|
||||
{name: 'DYN_DISCRIPTION'},
|
||||
{name: 'DYN_DESCRIPTION'},
|
||||
{name: 'TAS_EDIT'},
|
||||
{name: 'TAS_VIEW'},
|
||||
{name: 'ACTION'}
|
||||
]);
|
||||
|
||||
@@ -111,6 +113,8 @@ ProcessOptions.prototype.addDynaform= function(_5625)
|
||||
items: [btnAdd, btnRemove]
|
||||
});
|
||||
|
||||
//taskDynaform? and groupingStore?
|
||||
//var taskDynaform = new Ext.data.GroupingStore({
|
||||
var taskDynaform = new Ext.data.GroupingStore({
|
||||
idProperty : 'gridIndex',
|
||||
reader : new Ext.data.JsonReader( {
|
||||
@@ -121,7 +125,7 @@ ProcessOptions.prototype.addDynaform= function(_5625)
|
||||
proxy : new Ext.data.HttpProxy({
|
||||
url: 'proxyExtjs?pid='+pro_uid+'&action=getDynaformList'
|
||||
}),
|
||||
sortInfo:{field: 'DYN_TITLE', direction: "ASC"}
|
||||
//sortInfo:{field: 'DYN_TITLE', direction: "ASC"}
|
||||
});
|
||||
taskDynaform.load({params:{start:0, limit:10}});
|
||||
|
||||
@@ -164,41 +168,41 @@ ProcessOptions.prototype.addDynaform= function(_5625)
|
||||
});
|
||||
//tablesFieldsStore.load();
|
||||
|
||||
var dynaformColumns = new Ext.grid.ColumnModel({
|
||||
var dynaformColumns = new Ext.grid.ColumnModel({
|
||||
defaults: {
|
||||
width: 200,
|
||||
width: 90,
|
||||
sortable: true
|
||||
},
|
||||
columns: [
|
||||
new Ext.grid.RowNumberer(),
|
||||
{
|
||||
id: 'DYN_TITLE',
|
||||
header: _('ID_TITLE_FIELD'),
|
||||
dataIndex: 'DYN_TITLE',
|
||||
width: 280,
|
||||
editable: false,
|
||||
editor: new Ext.form.TextField({
|
||||
allowBlank: false
|
||||
})
|
||||
},{
|
||||
id: 'ACTION',
|
||||
header: _('ID_TYPE'),
|
||||
dataIndex: 'ACTION',
|
||||
//width: 280,
|
||||
editable: false,
|
||||
editor: new Ext.form.TextField({
|
||||
allowBlank: false
|
||||
})
|
||||
},
|
||||
{
|
||||
dataIndex: 'DYN_TYPE',
|
||||
width: 90,
|
||||
},{
|
||||
sortable: false,
|
||||
header: _('ID_TAS_EDIT'),
|
||||
dataIndex: 'TAS_EDIT',
|
||||
width: 110
|
||||
},{
|
||||
sortable: false,
|
||||
header: _('ID_TAS_VIEW'),
|
||||
dataIndex: 'TAS_VIEW',
|
||||
width: 110
|
||||
},{
|
||||
sortable: false,
|
||||
width: 50,
|
||||
renderer: function(val, meta, record)
|
||||
{
|
||||
return String.format("<a href='../dynaforms/dynaforms_Editor?PRO_UID={0}&DYN_UID={1}' >Edit</a>",pro_uid,record.data.DYN_UID);
|
||||
}
|
||||
},
|
||||
{
|
||||
},{
|
||||
sortable: false,
|
||||
width: 60,
|
||||
renderer: function(val, meta, record)
|
||||
{
|
||||
return String.format("<input type='button' value='UID' onclick=workflow.createUIDButton('{0}');>",record.data.DYN_UID);
|
||||
@@ -248,7 +252,6 @@ var dynaformColumns = new Ext.grid.ColumnModel({
|
||||
//renderTo: 'cases-grid',
|
||||
frame: false,
|
||||
autoHeight:false,
|
||||
clicksToEdit: 1,
|
||||
minHeight:400,
|
||||
height :400,
|
||||
width: '',
|
||||
@@ -270,14 +273,12 @@ var dynaformColumns = new Ext.grid.ColumnModel({
|
||||
});
|
||||
|
||||
var dynaformDetails = new Ext.FormPanel({
|
||||
labelWidth: 100,
|
||||
buttonAlign: 'center',
|
||||
labelWidth : 100,
|
||||
buttonAlign : 'center',
|
||||
width : 490,
|
||||
height : 420,
|
||||
bodyStyle : 'padding:10px 0 0 10px;',
|
||||
//monitorValid : true,
|
||||
autoHeight: true,
|
||||
//defaults :{autoScroll:true},
|
||||
items:
|
||||
[{
|
||||
xtype: 'fieldset',
|
||||
@@ -301,7 +302,6 @@ var dynaformColumns = new Ext.grid.ColumnModel({
|
||||
inputValue: 'blankDyna',
|
||||
checked: true
|
||||
},
|
||||
|
||||
{
|
||||
boxLabel: _('ID_PM_DYNAFORM'),
|
||||
name: 'DYN_SOURCE',
|
||||
@@ -352,8 +352,8 @@ var dynaformColumns = new Ext.grid.ColumnModel({
|
||||
store: new Ext.data.JsonStore({
|
||||
fields : ['name', 'value'],
|
||||
data : [
|
||||
{name : 'Normal', value: 'Normal'},
|
||||
{name : 'Grid', value: 'Grid'},
|
||||
{name : _('ID_NORMAL'), value: 'Normal'},
|
||||
{name : _('ID_GRID') , value: 'Grid'},
|
||||
]
|
||||
})
|
||||
},{
|
||||
|
||||
Reference in New Issue
Block a user