From 84c77ee4433c5bcbabc8493213bcad33bb21f92d Mon Sep 17 00:00:00 2001 From: safan Date: Thu, 30 Dec 2010 09:38:25 +0000 Subject: [PATCH] Started with Report Tables (ExtJs) --- workflow/engine/classes/class.processMap.php | 28 ++ .../engine/methods/bpmn/proxyReportTables.php | 21 ++ .../engine/templates/bpmn/ProcessOptions.js | 278 ++++++++++++++++++ workflow/engine/templates/bpmn/processmap.js | 8 +- 4 files changed, 334 insertions(+), 1 deletion(-) create mode 100755 workflow/engine/methods/bpmn/proxyReportTables.php diff --git a/workflow/engine/classes/class.processMap.php b/workflow/engine/classes/class.processMap.php index bece65aca..b38562ecf 100644 --- a/workflow/engine/classes/class.processMap.php +++ b/workflow/engine/classes/class.processMap.php @@ -5752,4 +5752,32 @@ class processMap { BasePeer::doUpdate($oCriteria2, $oCriteria1, Propel::getConnection('workflow')); } } + function getExtReportTables($sProcessUID = '') { + $sDelimiter = DBAdapter::getStringDelimiter (); + $oCriteria = new Criteria('workflow'); + $oCriteria->addSelectColumn(ReportTablePeer::REP_TAB_UID); + $oCriteria->addSelectColumn(ReportTablePeer::PRO_UID); + // $oCriteria->addAsColumn ( 'REP_TAB_TITLE', 'C.CON_VALUE' ); + $oCriteria->addAsColumn('REP_TAB_TITLE', "CASE WHEN C.CON_VALUE IS NULL THEN (SELECT DISTINCT MAX(A.CON_VALUE) FROM CONTENT A WHERE A.CON_ID = REPORT_TABLE.REP_TAB_UID ) ELSE C.CON_VALUE END "); + $oCriteria->addAlias('C', 'CONTENT'); + $aConditions = array(); + $aConditions [] = array(ReportTablePeer::REP_TAB_UID, 'C.CON_ID'); + $aConditions [] = array('C.CON_CATEGORY', $sDelimiter . 'REP_TAB_TITLE' . $sDelimiter); + $aConditions [] = array('C.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter); + $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN); + $oCriteria->add(ReportTablePeer::PRO_UID, $sProcessUID); + + $oDataset = ReportTablePeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $aReportTable[] = array('REP_TAB_UID' => $aRow ['REP_TAB_UID'], 'REP_TAB_TITLE' => $aRow['REP_TAB_TITLE']); + $oDataset->next(); + } + return $aReportTable; + + } + + } + diff --git a/workflow/engine/methods/bpmn/proxyReportTables.php b/workflow/engine/methods/bpmn/proxyReportTables.php new file mode 100755 index 000000000..e7cc19990 --- /dev/null +++ b/workflow/engine/methods/bpmn/proxyReportTables.php @@ -0,0 +1,21 @@ +getMessage() ); + } +?> \ No newline at end of file diff --git a/workflow/engine/templates/bpmn/ProcessOptions.js b/workflow/engine/templates/bpmn/ProcessOptions.js index dbcb35fa5..a1567e7a3 100755 --- a/workflow/engine/templates/bpmn/ProcessOptions.js +++ b/workflow/engine/templates/bpmn/ProcessOptions.js @@ -2027,3 +2027,281 @@ ProcessOptions.prototype.addOutputDoc= function(_5625) }); gridWindow.show(); } + +ProcessOptions.prototype.addReportTable= function(_5625) +{ + var pro_uid = workflow.getUrlVars(); + + var reportFields = Ext.data.Record.create([ + { + name: 'REP_TAB_TITLE', + type: 'string' + } + + ]); + + var reportStore = new Ext.data.JsonStore({ + root : 'data', + totalProperty: 'totalCount', + idProperty : 'gridIndex', + remoteSort : true, + fields : reportFields, + proxy : new Ext.data.HttpProxy({ + url : 'proxyReportTables?pid='+pro_uid + }) + }); + + var reportColumns = new Ext.grid.ColumnModel({ + columns: [ + new Ext.grid.RowNumberer(), + { + id: 'REP_TAB_TITLE', + header: 'Title', + dataIndex: 'REP_TAB_TITLE', + width: 280, + editable: false, + editor: new Ext.form.TextField({ + //allowBlank: false + }) + } + ] + }); + + var btnAdd = new Ext.Button({ + id: 'btnAdd', + text: 'New Report Table', + iconCls: 'application_add', + handler: function () { + formWindow.show(); + } + }); + + + + var tb = new Ext.Toolbar({ + items: [btnAdd] + }); + + var reportGrid = new Ext.grid.GridPanel({ + store : reportStore, + id : 'mygrid', + loadMask : true, + loadingText : 'Loading...', + renderTo : 'cases-grid', + frame : false, + autoHeight :false, + clicksToEdit: 1, + minHeight :400, + height :400, + layout : 'fit', + cm : reportColumns, + stripeRows : true, + tbar : tb + //viewConfig : {forceFit: true} + }); + +var reportForm =new Ext.FormPanel({ + // title:"Add new Database Source", + collapsible: false, + maximizable: true, + width:450, + frame:true, + plain: true, + bodyStyle: 'padding:5px;', + buttonAlign: 'center', + + items:[{ + + xtype: 'textfield', + fieldLabel: 'Title', + name: 'REP_TAB_TITLE', + allowBlank: false + },{ + + xtype: 'textfield', + fieldLabel: 'Table Name', + name: 'REP_TAB_NAME', + allowBlank: false + }, + + { + + + xtype: 'combo', + width: 150, + mode: 'local', + editable: false, + fieldLabel: 'Type', + triggerAction: 'all', + forceSelection: true, + name: 'REP_TAB_TYPE', + displayField: 'name', + //emptyText : 'Select Format', + valueField : 'value', + value : 'global', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data : [ + {name : 'Global', value: 'global'}, + {name : 'Grid', value: 'grid'} + ]}), + onSelect: function(record, index) { + //Show-Hide Format Type Field + if(record.data.value == 'global') + {Ext.getCmp("fields").show(); + Ext.getCmp("gridfields").hide(); + } + else + {Ext.getCmp("gridfields").show(); + Ext.getCmp("fields").hide(); + + } + this.setValue(record.data[this.valueField || this.displayField]); + this.collapse(); + } + }, + { + xtype: 'fieldset', + id: 'fields', + border:false, + hidden: false, + items: [{ + xtype: 'multiselect', + width: 150, + mode: 'local', + // hidden: true, + editable: false, + fieldLabel: 'Fields', + triggerAction: 'all', + forceSelection: true, + //dataIndex : 'ENGINE', + name: 'FIELDS', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data : [ + + + ]}) + }] + //displayField: 'name', + //emptyText : 'Select Format', + // valueField : 'value', + // value : 'Select' + }, { + xtype: 'fieldset', + id: 'gridfields', + border:false, + hidden: true, + items:[{ + xtype: 'combo', + width: 150, + mode: 'local', + // hidden: true, + editable:false, + fieldLabel: 'Grid Fields', + triggerAction: 'all', + forceSelection: true, + //dataIndex : 'ENGINE', + displayField: 'name', + valueField: 'value', + name: 'DBS_ENCODE', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data : [ + + ]}) + }] + + + } + ] + }) + +var formWindow = new Ext.Window({ + title: 'New Report Table', + collapsible: false, + maximizable: true, + width: 450, + //autoHeight: true, + height: 400, + //layout: 'fit', + plain: true, + bodyStyle: 'padding:5px;', + buttonAlign: 'center', + items: reportForm, + buttons: [{ + text: 'Save', + handler: function(){ + var getForm = reportForm.getForm().getValues(); + var tableUID = getForm.REP_TAB_UID; + var Title = getForm.REP_TAB_TITLE; + var Name = getForm.REP_TAB_NAME; + var Type = getForm.REP_TAB_TYPE; + var Grid = getForm.REP_TAB_GRID; + var Fields = getForm.FIELDS; + var VariableName = getForm.REP_VAR_NAME; + var VariableType = getForm.REP_VAR_TYPE + + //if(dbConnUID=='') + + Ext.Ajax.request({ + url : '../reportTables/reportTables_Save.php', + method: 'POST', + params:{ + PRO_UID :pro_uid, + REP_TAB_UID :tableUID, + REP_TAB_TITLE :Title, + REP_TAB_NAME :Name, + REP_TAB_TYPE :Type , + REP_TAB_GRID :Grid, + FIELDS :Fields, + REP_VAR_NAME : VariableName, + REP_VAR_TYPE : VariableType + + + + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Report Table Saved Successfully.'); + } + }); + + /*else + { + Ext.Ajax.request({ + url : '../dbConnections/dbConnectionsAjax.php', + method: 'POST', + params:{ + dbs_uid :dbConnUID, + type :Type, + server :Server, + db_name :DatabaseName, + user :Username , + passwd :Password, + port :Port, + desc :Description, + action :'saveEditConnection' + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Connection Edited Successfully.'); + } + }); + }*/ + + + //var getData = getstore.data.items; + //taskExtObj.saveTaskUsers(getData); + + formWindow.close(); + // dbStore.reload(); + } + },{ + text: 'Cancel', + handler: function(){ + // when this button clicked, + formWindow.close(); + } + }] + }); +} + diff --git a/workflow/engine/templates/bpmn/processmap.js b/workflow/engine/templates/bpmn/processmap.js index d12144d1d..d6137f2fc 100755 --- a/workflow/engine/templates/bpmn/processmap.js +++ b/workflow/engine/templates/bpmn/processmap.js @@ -152,7 +152,13 @@ Ext.onReady ( function() { handler : function() { processObj.addOutputDoc(); } - },{text: 'Trigger'},{text: 'Report Table'}, + },{text: 'Trigger'}, + { + text: 'Report Table', + handler : function() { + processObj.addReportTable(); + } + }, { text: 'Database Connection',handler : function() { processObj.dbConnection();