1.) Added Process supervisor => Supervisor Extjs form

2.) Added Process supervisor => Dynaform Extjs form
3.) Added Process supervisor => Input Document Extjs form
4.) Added Database Connection  Extjs form
This commit is contained in:
safan
2010-12-17 14:18:47 +00:00
parent a30c207c3e
commit d7246dad60
8 changed files with 1202 additions and 5 deletions

View File

@@ -128,7 +128,14 @@ if ( isset ($_REQUEST['action']) ) {
echo $sOutput; echo $sOutput;
break; break;
case 'saveInterMessageEvent': case 'assignProcessUser':
$oProcessMap->assignProcessUser($oData->PRO_UID, $oData->USR_UID);
break;
case 'removeProcessUser':
$oProcessMap->removeProcessUser($oData->PU_UID);
break;
case 'saveInterMessageEvent':
$aData['TAS_UID'] = $oData->uid; $aData['TAS_UID'] = $oData->uid;
$aData['TAS_SEND_LAST_EMAIL'] = strtoupper($oData->tas_send); $aData['TAS_SEND_LAST_EMAIL'] = strtoupper($oData->tas_send);
$aData['TAS_DEF_MESSAGE'] = $oData->data; $aData['TAS_DEF_MESSAGE'] = $oData->data;

View File

@@ -0,0 +1,18 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
if ( isset($_GET['pid'] ) )
{
$rows = $oProcessMap->getExtCriteriaDBSList($_GET['pid']);
}
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print json_encode($result);
}
catch ( Exception $e ) {
print json_encode ( $e->getMessage() );
}
?>

View File

@@ -0,0 +1,40 @@
<?php
try
{
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
$processUID = $_GET['pid'];
$action = $_GET['action'];
switch($action)
{
case 'process_User':
$rows = $oProcessMap->listExtProcessesUser($processUID);
break;
case 'availableProcessesUser':
$rows = $oProcessMap->listExtNoProcessesUser($processUID);
break;
case 'supervisorDynaforms':
$rows = $oProcessMap->getExtSupervisorDynaformsList($processUID);
break;
case 'availableSupervisorDynaforms':
$rows = $oProcessMap->getExtAvailableSupervisorDynaformsList($processUID);
break;
case 'supervisorInputDoc':
$rows = $oProcessMap->getExtSupervisorInputsList($processUID);
break;
case 'availableSupervisorInputDoc':
$rows = $oProcessMap->getExtAvailableSupervisorInputsList($processUID);
break;
}
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print json_encode( $result ) ;
}
catch ( Exception $e ) {
print json_encode ( $e->getMessage() );
}
?>

View File

@@ -21,3 +21,4 @@ try
catch ( Exception $e ) { catch ( Exception $e ) {
print json_encode ( $e->getMessage() ); print json_encode ( $e->getMessage() );
} }
?>

View File

@@ -78,9 +78,10 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
$aData = $_POST; //For Extjs (Since we are not using form in ExtJS) $aData = $_POST; //For Extjs (Since we are not using form in ExtJS)
if(isset($aData['FIELDS'])) if(isset($aData['FIELDS']))
{ {
//$test = '{"1":{"TESTID":"1223","PRO_VARIABLE":"saaa"},"2":{"TESTID":"420","PRO_VARIABLE":"sas"}}'; $test = '{"1":{"TESTID":"1223","PRO_VARIABLE":"saaa"},"2":{"TESTID":"420","PRO_VARIABLE":"sas"}}';
//$aData['FIELDS'] = (array)$oJSON->decode($test); //$aData['FIELDS'] = (array)$oJSON->decode($test);
$oData = $oJSON->decode($_POST['FIELDS']); $oData = json_decode($_POST['FIELDS']);
//$oData1 = $oJSON->decode($test);
$aData['FIELDS'] = ''; $aData['FIELDS'] = '';
for($i=0;$i<count($oData);$i++) for($i=0;$i<count($oData);$i++)
{ {
@@ -99,7 +100,7 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
if (!isset($aData['ADD_TABLE'])||$aData['ADD_TABLE']==""){ if (!isset($aData['ADD_TABLE'])||$aData['ADD_TABLE']==""){
$aFields=$dynaform->create( $aData ); $aFields=$dynaform->create( $aData );
} else { } else {
$aFields=$dynaform->createFromPMTable( $aData, $aData['ADD_TABLE']); // $aFields=$dynaform->createFromPMTable( $aData, $aData['ADD_TABLE']);
} }
$aData['DYN_UID']=$dynaform->getDynUid(); $aData['DYN_UID']=$dynaform->getDynUid();
$dynaform->update( $aData ); $dynaform->update( $aData );

View File

@@ -325,6 +325,658 @@ ProcessMapContext.prototype.processPermission= function()
Ext.MessageBox.alert('Status','Process Permission'); Ext.MessageBox.alert('Status','Process Permission');
} }
ProcessMapContext.prototype.processSupervisors= function()
{
var pro_uid = workflow.getUrlVars();
var processUserFields = Ext.data.Record.create([
{name: 'PU_UID',type: 'string'},
{name: 'USR_UID',type: 'string'},
{name: 'PU_TYPE',type: 'string'},
{name: 'USR_FIRSTNAME',type: 'string'},
{name: 'USR_LASTNAME',type: 'string'},
{name: 'USR_EMAIL',type: 'string'}
]);
var editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});
var btnAdd = new Ext.Button({
id: 'btnAdd',
text: 'Assign Supervisor',
iconCls: 'application_add',
handler: function(){
var User = grid.getStore();
var e = new processUserFields({
PU_UID: '',
USR_UID: '',
PU_TYPE: '',
//USR_FIRSTNAME: '',
USR_LASTNAME: '',
USR_EMAIL: ''
});
//storeUsers.reload();
if(availableProcessesUser.data.items.length == 0)
Ext.MessageBox.alert ('Status','No supervisors are available. All supervisors have been already assigned.');
else
{
editor.stopEditing();
processUser.insert(0, e);
grid.getView().refresh();
//grid.getSelectionModel().selectRow(0);
editor.startEditing(0, 0);
}
}
});
var btnRemove = new Ext.Button({
id: 'btnRemove',
text: 'Remove Supervisor',
iconCls: 'application_delete',
handler: function (s) {
editor.stopEditing();
var s = grid.getSelectionModel().getSelections();
for(var i = 0, r; r = s[i]; i++){
//First Deleting assigned users from Database
var puID = r.data.PU_UID;
var urlparams = '?action=removeProcessUser&data={"PU_UID":"'+puID+'"}';
//if USR_UID is properly defined (i.e. set to valid value) then only delete the row
//else its a BLANK ROW for which Ajax should not be called.
if(r.data.PU_UID != "")
{
Ext.Ajax.request({
url : 'processes_Ajax.php'+urlparams,
method: 'GET',
success: function(response) {
Ext.MessageBox.alert ('Status','Supervisor has been removed successfully from Process.');
//Secondly deleting from Grid
processUser.remove(r);
//Reloading available user store
processUser.reload();
availableProcessesUser.reload();
}
});
}
else
processUser.remove(r);
}
}
});
var tb = new Ext.Toolbar({
items: [btnAdd, btnRemove]
});
// create the Data Store of users that are already assigned to a process supervisor
var processUser = new Ext.data.JsonStore({
root : 'data',
totalProperty: 'totalCount',
idProperty : 'gridIndex',
remoteSort : true,
fields : processUserFields,
proxy: new Ext.data.HttpProxy({
url: 'proxyProcessSupervisors?pid='+pro_uid+'&action=process_User'
})
});
processUser.load();
// create the Data Store of users that are not assigned to a process supervisor
var availableProcessesUser = new Ext.data.JsonStore({
root : 'data',
url : 'proxyProcessSupervisors?pid='+pro_uid+'&action=availableProcessesUser',
totalProperty : 'totalCount',
idProperty : 'gridIndex',
remoteSort : false, //true,
autoLoad : true,
fields : processUserFields
});
var grid = new Ext.grid.GridPanel({
store: processUser,
id : 'mygrid',
//cm: cm,
loadMask: true,
loadingText: 'Loading...',
renderTo: 'cases-grid',
frame: false,
autoHeight:false,
clicksToEdit: 1,
minHeight:400,
height :400,
layout: 'fit',
plugins: [editor],
columns: [
new Ext.grid.RowNumberer(),
{
id: 'USR_FIRSTNAME',
header: 'First Name',
dataIndex: 'USR_FIRSTNAME',
width: 200,
sortable: true,
editor: new Ext.form.ComboBox({
xtype: 'combo',
fieldLabel: 'Users_groups',
hiddenName: 'number',
store : availableProcessesUser,
displayField : 'USR_FIRSTNAME' ,
valueField : 'USR_FIRSTNAME',
name : 'USR_FIRSTNAME',
triggerAction: 'all',
emptyText: 'Select Supervisor',
allowBlank: false,
onSelect: function(record, index){
var User = grid.getStore();
var selectedrowIndex = '0';
User.data.items[selectedrowIndex].data.PU_UID = record.data.PU_UID;
User.data.items[selectedrowIndex].data.USR_UID = record.data.USR_UID;
User.data.items[selectedrowIndex].data.PU_TYPE = record.data.PU_TYPE;
//User.data.items[selectedrowIndex].data.USR_FIRSTNAME = record.data.USR_FIRSTNAME;
User.data.items[selectedrowIndex].data.USR_LASTNAME = record.data.USR_LASTNAME;
User.data.items[selectedrowIndex].data.USR_EMAIL = record.data.USR_EMAIL;
Ext.getCmp("lastname").setValue(record.data.USR_LASTNAME);
this.setValue(record.data[this.valueField || this.displayField]);
this.collapse();
}
})
},{
//id: 'USR_LASTNAME',
header: 'Last Name',
dataIndex: 'USR_LASTNAME',
width: 200,
editable: false,
editor: new Ext.form.TextField({
id: 'lastname',
allowBlank : true
})
}
],
stripeRows: true,
viewConfig: {forceFit: true},
tbar: tb
});
availableProcessesUser.load();
editor.on({
scope: this,
afteredit: function(roweditor, changes, record, rowIndex) {
var userID = record.data.USR_UID;
var urlparams = '?action=assignProcessUser&data={"PRO_UID":"'+pro_uid+'","USR_UID":"'+userID+'"}';
Ext.Ajax.request({
url: 'processes_Ajax.php'+urlparams,
method: 'GET',
success: function (response) { // When saving data success
Ext.MessageBox.alert ('Status','Supervisor has been successfully assigned to a Process');
processUser.reload();
availableProcessesUser.reload();
},
failure: function () { // when saving data failed
Ext.MessageBox.alert ('Status','Failed saving Supervisor Assigned to process');
}
});
}
});
var window = new Ext.Window({
title: 'Assign Process Supervisor',
collapsible: false,
maximizable: false,
width: 400,
height: 350,
minWidth: 200,
minHeight: 150,
layout: 'fit',
plain: true,
bodyStyle: 'padding:5px;',
buttonAlign: 'center',
items: grid
});
window.show();
}
ProcessMapContext.prototype.processDynaform= function()
{
var pro_uid = workflow.getUrlVars();
var supervisorDynaformsFields = Ext.data.Record.create([
{name: 'DYN_TITLE',type: 'string'},
{name: 'STEP_UID',type: 'string'},
{name: 'STEP_UID_OBJ',type: 'string'},
{name: 'STEP_TYPE_OBJ',type: 'string'},
{name: 'STEP_POSITION',type: 'string'},
{name: 'DYN_UID',type: 'string'}
]);
var editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});
var btnAdd = new Ext.Button({
id: 'btnAdd',
text: 'Assign Dynaform',
iconCls: 'application_add',
handler: function(){
var User = grid.getStore();
var e = new supervisorDynaformsFields({
DYN_UID: '',
STEP_UID: '',
STEP_UID_OBJ: '',
STEP_TYPE_OBJ: '',
STEP_POSITION: ''
});
//storeUsers.reload();
if(availableSupervisorDynaforms.data.items.length == 0)
Ext.MessageBox.alert ('Status','No dynaform are available. All dynaforms have been already assigned.');
else
{
editor.stopEditing();
supervisorDynaforms.insert(0, e);
grid.getView().refresh();
//grid.getSelectionModel().selectRow(0);
editor.startEditing(0, 0);
}
}
});
var btnRemove = new Ext.Button({
id: 'btnRemove',
text: 'Remove Dynaform',
iconCls: 'application_delete',
handler: function (s) {
editor.stopEditing();
var s = grid.getSelectionModel().getSelections();
for(var i = 0, r; r = s[i]; i++){
//First Deleting assigned users from Database
var dynUID = r.data.DYN_UID;
var stepUID = r.data.STEP_UID;
var sPos = r.data.STEP_POSITION;
//if DYN_UID is properly defined (i.e. set to valid value) then only delete the row
//else its a BLANK ROW for which Ajax should not be called.
if(r.data.DYN_UID != "")
{
Ext.Ajax.request({
url : '../steps/steps_SupervisorAjax.php',
method: 'POST',
params: {
STEP_UID : stepUID,
PRO_UID : pro_uid,
DYN_UID : dynUID,
STEP_POSITION : sPos,
action : 'removeSupervisorDynaform'
},
success: function(response) {
Ext.MessageBox.alert ('Status','Dynaform has been removed successfully from Process.');
//Secondly deleting from Grid
supervisorDynaforms.remove(r);
//Reloading available user store
supervisorDynaforms.reload();
availableSupervisorDynaforms.reload();
}
});
}
else
supervisorDynaforms.remove(r);
}
}
});
var tb = new Ext.Toolbar({
items: [btnAdd, btnRemove]
});
// create the Data Store of users that are already assigned to a process supervisor
var supervisorDynaforms = new Ext.data.JsonStore({
root : 'data',
totalProperty: 'totalCount',
idProperty : 'gridIndex',
remoteSort : true,
fields : supervisorDynaformsFields,
proxy: new Ext.data.HttpProxy({
url: 'proxyProcessSupervisors?pid='+pro_uid+'&action=supervisorDynaforms'
})
});
supervisorDynaforms.load();
// create the Data Store of users that are not assigned to a process supervisor
var availableSupervisorDynaforms = new Ext.data.JsonStore({
root : 'data',
url : 'proxyProcessSupervisors?pid='+pro_uid+'&action=availableSupervisorDynaforms',
totalProperty : 'totalCount',
idProperty : 'gridIndex',
remoteSort : false, //true,
autoLoad : true,
fields : supervisorDynaformsFields
});
var grid = new Ext.grid.GridPanel({
store: supervisorDynaforms,
id : 'mygrid',
//cm: cm,
loadMask: true,
loadingText: 'Loading...',
renderTo: 'cases-grid',
frame: false,
autoHeight:false,
clicksToEdit: 1,
minHeight:400,
height :400,
layout: 'fit',
plugins: [editor],
columns: [
new Ext.grid.RowNumberer(),
{
id: 'DYN_TITLE',
header: 'Title',
dataIndex: 'DYN_TITLE',
width: 200,
sortable: true,
editor: new Ext.form.ComboBox({
xtype: 'combo',
fieldLabel: 'Users_groups',
hiddenName: 'number',
store : availableSupervisorDynaforms,
displayField : 'DYN_TITLE' ,
valueField : 'DYN_TITLE',
name : 'DYN_TITLE',
triggerAction: 'all',
emptyText: 'Select Dynaform',
allowBlank: false,
onSelect: function(record, index){
var User = grid.getStore();
var selectedrowIndex = '0';
User.data.items[selectedrowIndex].data.STEP_UID = record.data.STEP_UID;
User.data.items[selectedrowIndex].data.STEP_UID_OBJ = record.data.STEP_UID_OBJ;
User.data.items[selectedrowIndex].data.STEP_TYPE_OBJ = record.data.STEP_TYPE_OBJ;
User.data.items[selectedrowIndex].data.STEP_POSITION = record.data.STEP_POSITION;
User.data.items[selectedrowIndex].data.DYN_UID = record.data.DYN_UID;
this.setValue(record.data[this.valueField || this.displayField]);
this.collapse();
}
})
}
],
stripeRows: true,
viewConfig: {forceFit: true},
tbar: tb
});
//availableSupervisorDynaforms.load();
editor.on({
scope: this,
afteredit: function(roweditor, changes, record, rowIndex) {
var dynUID = record.data.DYN_UID;
//var urlparams = '?action=assignsupervisorDynaforms&data={"PRO_UID":"'+pro_uid+'","USR_UID":"'+userID+'"}';
Ext.Ajax.request({
url : '../steps/steps_SupervisorAjax.php',
method: 'POST',
params: {
action : 'assignSupervisorDynaform',
PRO_UID : pro_uid,
DYN_UID : dynUID
},
success: function (response) { // When saving data success
Ext.MessageBox.alert ('Status','Dynaform has been successfully assigned to a Process');
supervisorDynaforms.reload();
availableSupervisorDynaforms.reload();
},
failure: function () { // when saving data failed
Ext.MessageBox.alert ('Status','Failed saving Dynaform Assigned to process');
}
});
}
});
var window = new Ext.Window({
title: 'Assign Dynaform',
collapsible: false,
maximizable: false,
width: 400,
height: 350,
minWidth: 200,
minHeight: 150,
layout: 'fit',
plain: true,
bodyStyle: 'padding:5px;',
buttonAlign: 'center',
items: grid
});
window.show();
}
ProcessMapContext.prototype.processIODoc= function()
{
var pro_uid = workflow.getUrlVars();
var supervisorInputDocFields = Ext.data.Record.create([
{name: 'INP_DOC_TITLE',type: 'string'},
{name: 'STEP_UID',type: 'string'},
{name: 'STEP_UID_OBJ',type: 'string'},
{name: 'STEP_TYPE_OBJ',type: 'string'},
{name: 'STEP_POSITION',type: 'string'},
{name: 'INP_DOC_UID',type: 'string'}
]);
var editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});
var btnAdd = new Ext.Button({
id: 'btnAdd',
text: 'Assign Input Document',
iconCls: 'application_add',
handler: function(){
var User = grid.getStore();
var e = new supervisorInputDocFields({
INP_DOC_UID: '',
STEP_UID: '',
STEP_UID_OBJ: '',
STEP_TYPE_OBJ: '',
STEP_POSITION: ''
});
//storeUsers.reload();
if(availableSupervisorInputDoc.data.items.length == 0)
Ext.MessageBox.alert ('Status','No Input Document are available. All Input Document have been already assigned.');
else
{
editor.stopEditing();
supervisorInputDoc.insert(0, e);
grid.getView().refresh();
//grid.getSelectionModel().selectRow(0);
editor.startEditing(0, 0);
}
}
});
var btnRemove = new Ext.Button({
id: 'btnRemove',
text: 'Remove Input Document',
iconCls: 'application_delete',
handler: function (s) {
editor.stopEditing();
var s = grid.getSelectionModel().getSelections();
for(var i = 0, r; r = s[i]; i++){
//First Deleting assigned users from Database
var inputDocUID = r.data.INP_DOC_UID;
var stepUID = r.data.STEP_UID;
var sPos = r.data.STEP_POSITION;
//if DYN_UID is properly defined (i.e. set to valid value) then only delete the row
//else its a BLANK ROW for which Ajax should not be called.
if(r.data.DYN_UID != "")
{
Ext.Ajax.request({
url : '../steps/steps_SupervisorAjax.php',
method: 'POST',
params: {
STEP_UID : stepUID,
PRO_UID : pro_uid,
INP_DOC_UID : inputDocUID,
STEP_POSITION : sPos,
action : 'removeSupervisorInput'
},
success: function(response) {
Ext.MessageBox.alert ('Status','Input Document has been removed successfully from Process.');
//Secondly deleting from Grid
supervisorInputDoc.remove(r);
//Reloading available user store
supervisorInputDoc.reload();
availableSupervisorInputDoc.reload();
}
});
}
else
supervisorInputDoc.remove(r);
}
}
});
var tb = new Ext.Toolbar({
items: [btnAdd, btnRemove]
});
// create the Data Store of users that are already assigned to a process supervisor
var supervisorInputDoc = new Ext.data.JsonStore({
root : 'data',
totalProperty: 'totalCount',
idProperty : 'gridIndex',
remoteSort : true,
fields : supervisorInputDocFields,
proxy: new Ext.data.HttpProxy({
url: 'proxyProcessSupervisors?pid='+pro_uid+'&action=supervisorInputDoc'
})
});
supervisorInputDoc.load();
// create the Data Store of users that are not assigned to a process supervisor
var availableSupervisorInputDoc = new Ext.data.JsonStore({
root : 'data',
url : 'proxyProcessSupervisors?pid='+pro_uid+'&action=availableSupervisorInputDoc',
totalProperty : 'totalCount',
idProperty : 'gridIndex',
remoteSort : false, //true,
autoLoad : true,
fields : supervisorInputDocFields
});
var grid = new Ext.grid.GridPanel({
store: supervisorInputDoc,
id : 'mygrid',
//cm: cm,
loadMask: true,
loadingText: 'Loading...',
renderTo: 'cases-grid',
frame: false,
autoHeight:false,
clicksToEdit: 1,
minHeight:400,
height :400,
layout: 'fit',
plugins: [editor],
columns: [
new Ext.grid.RowNumberer(),
{
id: 'INP_DOC_TITLE',
header: 'Title',
dataIndex: 'INP_DOC_TITLE',
width: 200,
sortable: true,
editor: new Ext.form.ComboBox({
xtype: 'combo',
fieldLabel: 'Users_groups',
hiddenName: 'number',
store : availableSupervisorInputDoc,
displayField : 'INP_DOC_TITLE' ,
valueField : 'INP_DOC_TITLE',
name : 'INP_DOC_TITLE',
triggerAction: 'all',
emptyText: 'Select Input Document',
allowBlank: false,
onSelect: function(record, index){
var User = grid.getStore();
var selectedrowIndex = '0';
User.data.items[selectedrowIndex].data.STEP_UID = record.data.STEP_UID;
User.data.items[selectedrowIndex].data.STEP_UID_OBJ = record.data.STEP_UID_OBJ;
User.data.items[selectedrowIndex].data.STEP_TYPE_OBJ = record.data.STEP_TYPE_OBJ;
User.data.items[selectedrowIndex].data.STEP_POSITION = record.data.STEP_POSITION;
User.data.items[selectedrowIndex].data.INP_DOC_UID = record.data.INP_DOC_UID;
this.setValue(record.data[this.valueField || this.displayField]);
this.collapse();
}
})
}
],
stripeRows: true,
viewConfig: {forceFit: true},
tbar: tb
});
//availableSupervisorInputDoc.load();
editor.on({
scope: this,
afteredit: function(roweditor, changes, record, rowIndex) {
var inputDocUID = record.data.INP_DOC_UID;
//var urlparams = '?action=assignsupervisorInputDoc&data={"PRO_UID":"'+pro_uid+'","USR_UID":"'+userID+'"}';
Ext.Ajax.request({
url : '../steps/steps_SupervisorAjax.php',
method: 'POST',
params: {
action : 'assignSupervisorInput',
PRO_UID : pro_uid,
INP_DOC_UID : inputDocUID
},
success: function (response) { // When saving data success
Ext.MessageBox.alert ('Status','Input Document has been successfully assigned to a Process');
supervisorInputDoc.reload();
availableSupervisorInputDoc.reload();
},
failure: function () { // when saving data failed
Ext.MessageBox.alert ('Status','Failed saving Input Document Assigned to process');
}
});
}
});
var window = new Ext.Window({
title: 'Assign Dynaform',
collapsible: false,
maximizable: false,
width: 400,
height: 350,
minWidth: 200,
minHeight: 150,
layout: 'fit',
plain: true,
bodyStyle: 'padding:5px;',
buttonAlign: 'center',
items: grid
});
window.show();
}
ProcessMapContext.prototype.caseTracker= function() ProcessMapContext.prototype.caseTracker= function()
{ {
Ext.MessageBox.alert('Status','Case Tracker'); Ext.MessageBox.alert('Status','Case Tracker');

View File

@@ -1379,3 +1379,457 @@ ProcessOptions.prototype.addOutputDoc= function(_5625)
} }
ProcessOptions.prototype.dbConnection = function()
{
var pro_uid = workflow.getUrlVars();
//Database store code starts here
var dbConnFields = Ext.data.Record.create([
{ name: 'DBS_UID',type: 'string'},
{ name: 'DBS_TYPE',type: 'string'},
{ name: 'DBS_SERVER',type: 'string'},
{ name: 'DBS_DATABASE_NAME',type: 'string'},
{ name: 'DBS_USERNAME',type: 'string'},
{ name: 'DBS_PASSWORD',type: 'string'},
{ name: 'DBS_PORT',type: 'string'},
{ name: 'DBS_DESCRIPTION',type: 'string'}
]);
var btnNew = new Ext.Button({
id: 'btnNew',
text: 'New',
iconCls: 'application_add',
handler: function () {
formWindow.show();
}
});
var btnRemove = new Ext.Button({
id: 'btnRemove',
text: 'Delete',
iconCls: 'application_delete',
handler: function (s) {
editor.stopEditing();
var s = dbGrid.getSelectionModel().getSelections();
for(var i = 0, r; r = s[i]; i++){
//First Deleting step from Database using Ajax
var dbUID = r.data.DBS_UID;
//if STEP_UID is properly defined (i.e. set to valid value) then only delete the row
//else its a BLANK ROW for which Ajax should not be called.
if(r.data.DBS_UID != "")
{
Ext.Ajax.request({
url : '../dbConnections/dbConnectionsAjax.php',
method: 'POST',
params: {
dbs_uid : dbUID,
action :'deleteDbConnection'
},
success: function(response) {
Ext.MessageBox.alert ('Status','Step has been removed successfully.');
//Secondly deleting from Grid
dbStore.remove(r);
//Reloading store after removing steps
dbStore.reload();
}
});
}
else
dbStore.remove(r);
}
}
});
var tb = new Ext.Toolbar({
items: [btnNew, btnRemove]
});
var editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});
var dbStore = new Ext.data.JsonStore({
root : 'data',
totalProperty: 'totalCount',
idProperty : 'gridIndex',
remoteSort : true,
fields : dbConnFields,
proxy: new Ext.data.HttpProxy({
url: 'proxyDatabaseConn.php?pid='+pro_uid
})
});
dbStore.load();
var dbGridColumn = new Ext.grid.ColumnModel({
columns: [
new Ext.grid.RowNumberer(),
{
id: 'DBS_TYPE',
header: 'Type',
dataIndex: 'DBS_TYPE',
//width: 100,
editable: false,
sortable: true,
editor: new Ext.form.TextField({
//allowBlank: false
})
},{
id: 'DBS_SERVER',
header: 'Server',
dataIndex: 'DBS_SERVER',
//width: 100,
sortable: true,
editor: new Ext.form.TextField({
//allowBlank: false
})
},{
id: 'DBS_DATABASE_NAME',
header: 'Database Name',
dataIndex: 'DBS_DATABASE_NAME',
//width: 100,
sortable: true,
editor: new Ext.form.TextField({
//allowBlank: false
})
},{
id: 'DBS_DESCRIPTION',
header: 'Description',
dataIndex: 'DBS_DESCRIPTION',
width: 100,
sortable: true,
editor: new Ext.form.TextField({
//allowBlank: false
})
}
]
});
var dbGrid = new Ext.grid.GridPanel({
store: dbStore,
id : 'mygrid',
loadMask: true,
loadingText: 'Loading...',
renderTo: 'cases-grid',
frame: false,
autoHeight:false,
clicksToEdit: 1,
width:450,
minHeight:400,
height :400,
layout: 'fit',
cm: dbGridColumn,
stripeRows: true,
tbar: tb,
viewConfig: {forceFit: true}
});
var dbconnForm =new Ext.FormPanel({
// title:"Add new Database Source",
monitorValid :true,
defaults :{ autoScroll:true },
width:450,
height:360,
bodyStyle: 'padding:5px;',
items:[{
xtype: 'combo',
width: 150,
mode: 'local',
editable: false,
fieldLabel: 'Engine',
triggerAction: 'all',
forceSelection: true,
name: 'DBS_TYPE',
displayField: 'name',
//emptyText : 'Select Format',
valueField : 'value',
value : 'Select',
store: new Ext.data.JsonStore({
fields : ['name', 'value'],
data : [
{name : 'Select', value: 'select'},
{name : 'MySql', value: 'MySql'},
{name : 'PostGreSql', value: 'PostGreSql'},
{name : 'Microsoft SQL server', value: 'Microsoft SQL server'}
]}),
onSelect: function(record, index) {
//Show-Hide Format Type Field
if(record.data.value == 'MySql')
{Ext.getCmp("encode").show();
Ext.getCmp("postgre").hide();
Ext.getCmp("port").setValue('3306')}
else if(record.data.value == 'PostGreSql')
{Ext.getCmp("postgre").show();
Ext.getCmp("encode").hide();
Ext.getCmp("port").setValue('5432')}
else
{Ext.getCmp("sqlserver").show();
Ext.getCmp("postgre").hide();
Ext.getCmp("port").setValue('1433')}
this.setValue(record.data[this.valueField || this.displayField]);
this.collapse();
}
},
{
xtype: 'fieldset',
id: 'encode',
border:false,
hidden: true,
items: [{
xtype: 'combo',
width: 150,
mode: 'local',
editable: false,
fieldLabel: 'Encode',
triggerAction: 'all',
forceSelection: true,
//dataIndex : 'ENGINE',
displayField: 'name',
valueField: 'value',
name: 'DBS_ENCODE',
value: 'big5',
store: new Ext.data.JsonStore({
fields : ['name', 'value'],
data : [
{name:'big5', value: 'big5'},
{name:'dec8', value:'dec8' },
{name:'cp850', value:'cp850'},
{name:'hp8', value:'hp8' },
{name:'koi8r', value:'koi8r'},
{name:'latin1', value:'latin1'},
{name:'latin2', value:'latin2'},
{name:'swe7', value:'swe7' },
{name:'ascii', value:'ascii'},
{name:'ujis', value:'ujis' },
{name:'sjis', value:'sjis' },
{name:'hebrew', value:'hebrew'},
{name:'tis620', value:'tis620' },
{name:'euckr', value:'euckr'},
{name:'koi8u', value:'koi8u' },
{name:'gb2312', value:'gb2312'},
{name:'greek', value:'greek'},
{name:'cp1250', value:'cp1250'},
{name:'gbk', value:'gbk' },
{name:'latin5', value:'latin5' },
{name:'armscii8', value:'armscii8'},
{name:'utf8', value:'utf8' },
{name:'ucs2', value:'ucs2'},
{name:'cp866', value:'cp866'},
{name:'keybcs2', value:'keybcs2' },
{name:'macce', value:'macce'},
{name:'macroman', value:'macroman' },
{name:'cp852', value:'cp852' },
{name:'latin7', value:'atin7' },
{name:'cp1251', value:'cp1251'},
{name:'cp1256', value:'cp1256'},
{name:'cp1257', value:'cp1257'},
{name:'binary', value:'binary'},
{name:'geostd8', value:'geostd8'},
{name:'cp932', value:'cp932'},
{name:'eucjpms', value:'eucjpms'}
]})
}]
//displayField: 'name',
//emptyText : 'Select Format',
// valueField : 'value',
// value : 'Select'
}, {
xtype: 'fieldset',
id: 'postgre',
border:false,
hidden: true,
items:[{
xtype: 'combo',
width: 150,
mode: 'local',
// hidden: true,
editable:false,
fieldLabel: 'Encode',
triggerAction: 'all',
forceSelection: true,
//dataIndex : 'ENGINE',
displayField: 'name',
valueField: 'value',
name: 'DBS_ENCODE',
value: 'BIG5',
store: new Ext.data.JsonStore({
fields : ['name', 'value'],
data :[
{name:"BIG5", value:"BIG5"},
{name:"EUC_CN", value:"EUC_CN"},
{name:"EUC_JP", value:"EUC_JP"},
{name:"EUC_KR", value:"EUC_KR"},
{name:"EUC_TW", value:"EUC_TW"},
{name:"GB18030", value:"GB18030"},
{name:"GBK", value:"GBK"},
{name:"ISO_8859_5", value:"ISO_8859_5"},
{name:"ISO_8859_6", value:"ISO_8859_6"},
{name:"ISO_8859_7", value:"ISO_8859_7"},
{name:"ISO_8859_8", value: "ISO_8859_8"},
{name:"JOHAB", value:"JOHAB"},
{name:"KOI8", value: "KOI8"},
{name:"selected", value: "LATIN1"},
{name:"LATIN2", value:"LATIN2"},
{name:"LATIN3", value:"LATIN3"},
{name:"LATIN4", value: "LATIN4"},
{name:"LATIN5", value:"LATIN5"},
{name:"LATIN6", value: "LATIN6"},
{name:"LATIN7", value:"LATIN7"},
{name:"LATIN8", value:"LATIN8"},
{name:"LATIN9", value:"LATIN9"},
{name:"LATIN10", value:"LATIN10"},
{name:"SJIS", value:"SJIS"},
{name:"SQL_ASCII", value:"SQL_ASCII"},
{name:"UHC", value: "UHC"},
{name:"UTF8", value: "UTF8"},
{name:"WIN866", value: "WIN866"},
{name:"WIN874", value:"WIN874"},
{name:"WIN1250", value:"WIN1250"},
{name:"WIN1251", value:"WIN1251"},
{name:"WIN1252", value:"WIN1252"},
{name:"WIN1256", value:"WIN1256"},
{name:"WIN1258", value:"WIN1258"}
]})
}]
//displayField: 'name',
//emptyText : 'Select Format',
// valueField : 'value',
// value : 'Select'
}, {
xtype: 'fieldset',
id: 'sqlserver',
border:false,
hidden: true,
items:[{
xtype: 'combo',
width: 150,
mode: 'local',
// hidden: true,
editable: false,
fieldLabel: 'Encode',
triggerAction: 'all',
forceSelection: true,
//dataIndex : 'ENGINE',
displayField: 'name',
valueField: 'value',
name: 'DBS_ENCODE',
store: new Ext.data.JsonStore({
fields : ['name', 'value'],
data : [
{name:'utf8', value: 'utf8'}
]})
}]
//displayField: 'name',
//emptyText : 'Select Format',
// valueField : 'value',
// value : 'Select'
}, {
xtype: 'textfield',
fieldLabel: 'Server',
name: 'DBS_SERVER',
allowBlank: false
}, {
xtype: 'textfield',
fieldLabel: 'Database name',
name: 'DBS_DATABASE_NAME',
allowBlank: false
},{
xtype: 'textfield',
fieldLabel: 'Username',
name: 'DBS_USERNAME',
allowBlank: false
}, {
xtype: 'textfield',
fieldLabel: 'Password',
name: 'DBS_PASSWORD',
allowBlank: true
}, {
xtype: 'textfield',
fieldLabel: 'Port',
name: 'DBS_PORT',
id:'port',
allowBlank: false
}, {
xtype: 'textarea',
fieldLabel: 'Description',
name: 'DBS_DESCRIPTION',
allowBlank: true,
width: 250,
height:120
}
],
buttons: [{
text: 'Save',
formBind :true,
handler: function(){
var getForm = dbconnForm.getForm().getValues();
var Type = getForm.DBS_TYPE;
var Server = getForm.DBS_SERVER;
var DatabaseName = getForm.DBS_DATABASE_NAME;
var Username = getForm.DBS_USERNAME;
var Password = getForm.DBS_PASSWORD;
var Port = getForm.DBS_PORT;
var Description = getForm.DBS_DESCRIPTION;
Ext.Ajax.request({
url : '../dbConnections/dbConnectionsAjax.php',
method: 'POST',
params:{
type :Type,
server :Server,
db_name :DatabaseName,
user :Username ,
passwd :Password,
port :Port,
desc :Description,
action :'saveConnection'
},
success: function(response) {
Ext.MessageBox.alert ('Status','Connection Saved Successfully.');
}
});
//var getData = getstore.data.items;
//taskExtObj.saveTaskUsers(getData);
formWindow.close();
dbStore.reload();
}
},{
text: 'Cancel',
handler: function(){
// when this button clicked,
formWindow.close();
}
}],
buttonAlign : 'center'
})
var formWindow = new Ext.Window({
title: 'Add new Database Source',
collapsible: false,
maximizable: true,
width: 450,
//autoHeight: true,
height: 400,
//layout: 'fit',
plain: true,
bodyStyle: 'padding:5px;',
items: dbconnForm
});
var gridWindow = new Ext.Window({
title: 'Database Source List',
collapsible: false,
maximizable: true,
width: 450,
height: 400,
layout: 'fit',
plain: true,
bodyStyle: 'padding:5px;',
buttonAlign: 'center',
items: dbGrid
});
gridWindow.show();
}

View File

@@ -152,7 +152,12 @@ Ext.onReady ( function() {
handler : function() { handler : function() {
processObj.addOutputDoc(); processObj.addOutputDoc();
} }
},{text: 'Trigger'},{text: 'Report Table'},{text: 'Database Connection'}] },{text: 'Trigger'},{text: 'Report Table'},
{
text: 'Database Connection',handler : function() {
processObj.dbConnection();
}
}]
}) })
}, },
@@ -219,6 +224,25 @@ Ext.onReady ( function() {
text: 'Process Permission', text: 'Process Permission',
handler: ProcessMapObj.processPermission, handler: ProcessMapObj.processPermission,
scope: this scope: this
},{
text: 'Process Supervisor',
menu: { // <-- submenu by nested config object
items: [
// stick any markup in a menu
{
text: 'Supervisors',
handler: ProcessMapObj.processSupervisors
},
{
text: 'DynaForm',
handler: ProcessMapObj.processDynaform
},
{
text: 'Input Documents',
handler: ProcessMapObj.processIODoc
}
]
}
},{ },{
text: 'Case Tracker', text: 'Case Tracker',
handler: ProcessMapObj.caseTracker, handler: ProcessMapObj.caseTracker,