completed custom triggers part and modified grid view for processmap context option

This commit is contained in:
safan
2011-02-18 14:13:57 +00:00
parent acdc517b37
commit 0835c879a4
6 changed files with 341 additions and 95 deletions

View File

@@ -3172,7 +3172,7 @@ class processMap {
}
//Obtain object and type
switch ($aRow ['OP_OBJ_TYPE']) {
case 'ANY' :
case 'ALL' :
$sObjectType = G::LoadTranslation('ID_ALL');
$sObject = G::LoadTranslation('ID_ALL');
break;
@@ -3316,7 +3316,7 @@ class processMap {
}
//Obtain object and type
switch ($aRow ['OP_OBJ_TYPE']) {
case 'ANY' :
case 'ALL' :
$sObjectType = G::LoadTranslation('ID_ALL');
$sObject = G::LoadTranslation('ID_ALL');
break;

View File

@@ -348,23 +348,7 @@ if ( isset ($_REQUEST['action']) ) {
//$cont = Content::addContent( 'SP_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] );
$cont = Content::addContent( 'TAS_TITLE', '', $_POST['TAS_PARENT'], $lang, $_POST['SPROCESS_NAME'] );
break;
case'saveSubprocessDetails11':
//$aTask=($_POST['TASKS']!=0)?$oTask->load($_POST['TASKS']):0;
require_once 'classes/model/SubProcess.php';
$oOP = new SubProcess();
$aData = array(
'SP_UID' => $_POST['SP_UID'],
'PRO_UID' => $_POST['PRO_UID'],
'PRO_PARENT' => $_POST['PRO_PARENT'],
'TAS_PARENT' => $_POST['TAS_PARENT'],
'SP_SYNCHRONOUS' => $_POST['SP_SYNCHRONOUS']
);
$oOP->update($aData);
//require_once 'classes/model/Content.php';
//$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
//$cont = Content::addContent( 'TAS_TITLE', '', $_POST['TAS_PARENT'], $lang, $_POST['SPROCESS_NAME'] );
break;
case 'subprocessProperties':
require_once 'classes/model/Content.php';
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
@@ -372,28 +356,28 @@ if ( isset ($_REQUEST['action']) ) {
$cont = Content::addContent( 'TAS_TITLE', '', $_POST['TAS_PARENT'], $lang, $_POST['SPROCESS_NAME'] );
break;
case 'deleteTriggers':
case 'deleteTriggers':
try{
require_once('classes/model/Triggers.php');
foreach($TRI_UIDS as $i=>$TRI_UID) {
$oTrigger = new Triggers();
$triggerObj=$oTrigger->load($_POST['TRI_UID']);
$oTrigger->remove($_POST['TRI_UID']);
require_once('classes/model/Triggers.php');
require_once('classes/model/StepTrigger.php');
$oStepTrigger = new StepTrigger();
$oStepTrigger->removeTrigger($_POST['TRI_UID']);
$TRI_UIDS = explode(',', $_POST['TRI_UID']);
foreach($TRI_UIDS as $i=>$TRI_UID) {
$oTrigger = new Triggers();
$triggerObj=$oTrigger->load($TRI_UID);
$oTrigger->remove($TRI_UID);
$oStepTrigger = new StepTrigger();
$oStepTrigger->removeTrigger($TRI_UID);
}
$result->success = true;
$result->message = G::LoadTranslation('ID_REPORTTABLE_REMOVED');
$result->message = G::LoadTranslation('ID_TRIGGERS_REMOVED');
}
catch (Exception $e) {
catch (Exception $e) {
$result->success = false;
$result->message = $e->getMessage();
}
print G::json_encode($result);
}
print G::json_encode($result);
break;
}
}
?>

View File

@@ -309,7 +309,25 @@
$result = $tmpData;
echo $result;
break;
case 'getSubProcessProperties':
if($_GET['type'] == 2) //Loading sub process details
{
$rows = $oProcessMap->subProcessExtProperties($_GET['pid'], $_GET['tid'],'','0');
$tmpData = json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
print $result;
}
else
{
$rows = $oProcessMap->subProcessExtProperties($_GET['pid'], $_GET['tid'],'',$_GET['type']);
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print json_encode( $result ) ;
}
break;
case 'getObjectPermission':
$rows = $oProcessMap->getExtObjectsPermissions($start, $limit,$_GET['pid']);
$result['totalCount'] = $oProcessMap->getAllObjectPermissionCount();
@@ -343,18 +361,18 @@
break;
case 'editTriggers':
require_once('classes/model/Triggers.php');
require_once('classes/model/Triggers.php');
if (isset($_GET['TRI_UID']))
{
$oTrigger = new Triggers();
$rows = $oTrigger->load($_GET['TRI_UID']);
}
$result['totalCount'] = count($rows);
$result['data'] = $rows;
print json_encode( $result ) ;
break;
$tmpData = json_encode( $rows ) ;
$tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
$result = $tmpData;
echo $result;
break;
}
//$result['data'] = $rows;
//print json_encode( $result ) ;

View File

@@ -36,7 +36,7 @@ $oStepTrigger = new StepTrigger();
$oStepTrigger->removeTrigger($_POST['TRI_UID']);
$result->success = true;
$result->msg = G::LoadTranslation('ID_REPORTTABLE_REMOVED');
$result->msg = G::LoadTranslation('ID_TRIGGERS_REMOVED');
}
catch (Exception $e) {

View File

@@ -644,8 +644,10 @@ ProcessOptions.prototype.dbConnection = function()
waitMsg:'Loading',
success:function(form, action) {
//Ext.MessageBox.alert('Message', 'Loaded OK');
Ext.getCmp("encode").show();
form.findField('DBS_ENCODE').setValue(action.result.data.DBS_ENCODE);
formWindow.show();
Ext.getCmp("DBS_UID").setValue(dbConnUID);
//Ext.getCmp("DBS_UID").setValue(dbConnUID);
},
failure:function(form, action) {
PMExt.notify( _('ID_STATUS') , _('ID_LOAD_FAILED') );
@@ -768,15 +770,8 @@ ProcessOptions.prototype.dbConnection = function()
width: 100,
sortable: true,
editor: new Ext.form.TextField({
//allowBlank: false
})
}/*,{
sortable: false,
renderer: function(val, meta, record)
{
return String.format("<input type='button' value='UID' onclick=workflow.createUIDButton('{0}');>",record.data.DBS_UID);
}
}*/
}
]
});
@@ -1118,7 +1113,7 @@ ProcessOptions.prototype.dbConnection = function()
handler: function(){
// testConnWindow.show();
Ext.fly('p3text').update('Working');
/*Ext.fly('p3text').update('Working');
mybar.wait({
interval:200,
duration:5000,
@@ -1160,7 +1155,7 @@ ProcessOptions.prototype.dbConnection = function()
PMExt.notify( _('ID_STATUS') , _('ID_DBS_CONNECTION_TEST') );
}
});
}
}*/
}
},{
text: _('ID_SAVE'),
@@ -2555,9 +2550,7 @@ ProcessOptions.prototype.addReportTable= function(_5625)
method: 'GET',
waitMsg:'Loading',
success:function(form, action) {
//Ext.MessageBox.alert('Message', 'Loaded OK');
formWindow.show();
Ext.getCmp("REP_TAB_UID").setValue(repTabUID);
},
failure:function(form, action) {
PMExt.notify( _('ID_STATUS') , _('ID_LOAD_FAILED') );
@@ -2858,7 +2851,7 @@ var reportForm =new Ext.FormPanel({
data : []
})
}]
}
},{xtype:'hidden', name:'REP_TAB_UID'}
], buttons: [{
text: _('ID_SAVE'),
formBind :true,
@@ -2950,6 +2943,7 @@ var formWindow = new Ext.Window({
ProcessOptions.prototype.addTriggers= function()
{
var ProcMapObj= new ProcessMapContext();
var triggerFields = Ext.data.Record.create([
{name: 'TRI_UID'},
{name: 'TRI_TITLE'},
@@ -2973,27 +2967,50 @@ ProcessOptions.prototype.addTriggers= function()
//edit report table Function
var editTriggers = function() {
editor.stopEditing();
var rowSelected = Ext.getCmp('triggerGrid').getSelectionModel().getSelections();
if( rowSelected.length == 0 ) {
PMExt.error('', _('ID_NO_SELECTION_WARNING'));
return false;
}
var triggerUID = rowSelected[0].get('TRI_UID');
triggersForm.form.load({
url :'proxyExtjs.php?pid='+pro_uid+'&triggerUid='+triggerUID+'&action=editTriggers',
method: 'GET',
waitMsg:'Loading',
success:function(form, action) {
formWindow.show();
//Ext.getCmp("TRI_UID").setValue(triggerUID);
},
failure:function(form, action) {
PMExt.notify( _('ID_STATUS') , _('ID_LOAD_FAILED') );
}
});
editor.stopEditing();
var rowSelected = Ext.getCmp('triggersGrid').getSelectionModel().getSelections();
if( rowSelected.length == 0 ) {
PMExt.error('', _('ID_NO_SELECTION_WARNING'));
return false;
}
var triggerUID = rowSelected[0].get('TRI_UID');
editTriggerForm.form.load({
url :'proxyExtjs.php?pid='+pro_uid+'&TRI_UID='+triggerUID+'&action=editTriggers',
method: 'GET',
waitMsg:'Loading',
success:function(form, action) {
editTriggerFormWindow.show();
//Ext.getCmp("TRI_UID").setValue(triggerUID);
},
failure:function(form, action) {
PMExt.notify( _('ID_STATUS') , _('ID_LOAD_FAILED') );
}
});
}
var editProperties = function(){
editor.stopEditing();
var rowSelected = Ext.getCmp('triggersGrid').getSelectionModel().getSelections();
if( rowSelected.length == 0 ) {
PMExt.error('', _('ID_NO_SELECTION_WARNING'));
return false;
}
var triggerUID = rowSelected[0].get('TRI_UID');
//editPropertiesFormWindow.show();
editPropertiesForm.form.load({
url :'proxyExtjs.php?pid='+pro_uid+'&TRI_UID='+triggerUID+'&action=editTriggers',
method: 'GET',
waitMsg:'Loading',
success:function(form, action) {
editPropertiesFormWindow.show();
//Ext.getCmp("TRI_UID").setValue(triggerUID);
},
failure:function(form, action) {
PMExt.notify( _('ID_STATUS') , _('ID_LOAD_FAILED') );
}
});
}
var removeTriggers = function() {
ids = Array();
@@ -3009,7 +3026,7 @@ ProcessOptions.prototype.addTriggers= function()
ids[i] = rowsSelected[i].get('TRI_UID');
ids = ids.join(',');
//First check whether selected Dynaform is assigned to a task steps or not.
//First check whether selected trigger has any dependencies or not
Ext.Ajax.request({
url : '../triggers/triggers_Ajax',
method: 'POST',
@@ -3021,10 +3038,10 @@ ProcessOptions.prototype.addTriggers= function()
success: function(response) {
var result = Ext.util.JSON.decode(response.responseText);
if( result.success ){
if( result.passed ) { //deleting the selected dyanoforms
PMExt.confirm(_('ID_CONFIRM'), _('ID_DELETE_DYNAFORM_CONFIRM'), function(){
if( result.passed ) { //deleting the selected triggers
PMExt.confirm(_('ID_CONFIRM'), _('ID_DELETE_TRIGGER_CONFIRM'), function(){
Ext.Ajax.request({
url : '../processes/processes_Ajax.php',
url : 'processes_Ajax.php',
method: 'POST',
params: {
action : 'deleteTriggers',
@@ -3052,7 +3069,7 @@ ProcessOptions.prototype.addTriggers= function()
}
});
}
//edit triggers button
//edit triggers button
var btnEdit = new Ext.Button({
id: 'btnEdit',
text: _('ID_EDIT'),
@@ -3067,6 +3084,13 @@ ProcessOptions.prototype.addTriggers= function()
handler: removeTriggers
});
var btnProperties = new Ext.Button({
id: 'btnProperty',
text: _('ID_Properties'),
//iconCls: 'button_menu_ext ss_sprite ss_delete',
handler: editProperties
});
var triggerStore = new Ext.data.GroupingStore({
idProperty : 'gridIndex',
reader : new Ext.data.JsonReader( {
@@ -3100,7 +3124,7 @@ ProcessOptions.prototype.addTriggers= function()
});
var tb = new Ext.Toolbar({
items: [btnAdd, btnEdit,btnRemove]
items: [btnAdd, btnEdit,btnProperties,btnRemove]
});
var triggersGrid = new Ext.grid.GridPanel({
@@ -3159,6 +3183,10 @@ ProcessOptions.prototype.addTriggers= function()
text: _('ID_EDIT'),
iconCls: 'button_menu_ext ss_sprite ss_pencil',
handler: editTriggers
},{
text: _('ID_PROPERTIES'),
//iconCls: 'button_menu_ext ss_sprite ss_pencil',
handler: editProperties
},{
text: _('ID_DELETE'),
icon: '/images/delete.png',
@@ -3166,7 +3194,7 @@ ProcessOptions.prototype.addTriggers= function()
},{
text: _('ID_UID'),
handler: function(){
var rowSelected = Ext.getCmp('triggerGrid').getSelectionModel().getSelected();
var rowSelected = Ext.getCmp('triggersGrid').getSelectionModel().getSelected();
workflow.createUIDButton(rowSelected.data.TRI_UID);
}
}
@@ -3176,7 +3204,7 @@ ProcessOptions.prototype.addTriggers= function()
var triggersForm = new Ext.FormPanel({
labelWidth : 100,
buttonAlign : 'center',
width : 450,
width : 400,
height : 350,
bodyStyle : 'padding:10px 0 0 10px;',
autoHeight: true,
@@ -3187,8 +3215,9 @@ var triggersForm = new Ext.FormPanel({
border:true,
name: 'TRI_TITLE',
fieldLabel: _('ID_TITLE'),
width: 150,
width: 300,
collapsible: false,
allowBlank: false,
labelAlign: 'top'
},
{
@@ -3197,8 +3226,8 @@ var triggersForm = new Ext.FormPanel({
name: 'TRI_DESCRIPTION',
hidden: false,
fieldLabel: _('ID_DESCRIPTION'),
width: 200,
height: 100
width: 300,
height: 120
},{
layout :'column',
border :false,
@@ -3207,8 +3236,9 @@ var triggersForm = new Ext.FormPanel({
layout : 'form',
border :false,
items : [{
xtype : 'textfield',
width : 200,
xtype : 'textarea',
width : 300,
height : 180,
name : 'TRI_WEBBOT',
anchor :'100%'
}]
@@ -3231,7 +3261,8 @@ var triggersForm = new Ext.FormPanel({
}
}]
}]
}], buttons: [{
}],
buttons: [{
text: _('ID_SAVE'),
//formBind :true,
handler: function(){
@@ -3290,6 +3321,7 @@ var triggersForm = new Ext.FormPanel({
}
}
});
formWindow.hide();
}
}
},{
@@ -3301,14 +3333,226 @@ var triggersForm = new Ext.FormPanel({
}]
});
var editTriggerForm = new Ext.FormPanel({
buttonAlign: 'center',
labelWidth : 10,
layout : 'fit',
width : 450,
height : 350,
//autoHeight: true,
items:
[{
layout :'column',
border :false,
items :[{
//columnWidth :.6,
layout : 'form',
border :false,
items : [{
xtype : 'textarea',
width : 380,
height : 320,
name : 'TRI_WEBBOT',
anchor :'100%'
}]
},{
//columnWidth :.4,
layout : 'form',
border :false,
items : [{
xtype :'button',
title : ' ',
width :50,
text : '@@',
name : 'selectorigin',
handler: function (s) {
workflow.variablesAction = 'form';
workflow.fieldName = 'TRI_WEBBOT' ;
workflow.variable = '@@',
workflow.formSelected = triggersForm;
var rowData = ProcMapObj.ExtVariables();
}
}]
}]
},{
xtype: 'hidden',
name: 'TRI_UID'
}],
buttons: [{
text: _('ID_SAVE'),
//formBind :true,
handler: function(){
var getForm = editTriggerForm.getForm().getValues();
var triggerUid = getForm.TRI_UID;
var condition = getForm.TRI_WEBBOT;
var desc = getForm.TRI_DESCRIPTION;
Ext.Ajax.request({
url : '../triggers/triggers_Save.php',
method: 'POST',
params:{
PRO_UID : pro_uid,
TRI_UID : triggerUid,
TRI_TYPE : 'SCRIPT',
TRI_WEBBOT : condition,
mode : 'ext'
},
success: function(response) {
var result = Ext.util.JSON.decode(response.responseText);
if( result.success ){
PMExt.notify( _('ID_STATUS') , result.msg);
//Reloading store after saving triggers
triggerStore.reload();
editTriggerFormWindow.hide();
} else {
PMExt.error(_('ID_ERROR'), result.msg);
}
}
});
}
},{
text: _('ID_CANCEL'),
handler: function(){
// when this button clicked,
editTriggerFormWindow.hide();
}
}]
});
var editPropertiesForm = new Ext.FormPanel({
labelWidth : 100,
buttonAlign : 'center',
width : 400,
height : 300,
bodyStyle : 'padding:10px 0 0 10px;',
autoHeight: true,
items:
[{
xtype: 'fieldset',
title: 'Trigger Information',
border:true,
id: 'trigger',
width: 400,
items:[{
xtype: 'textfield',
layout: 'fit',
border:true,
name: 'TRI_TITLE',
fieldLabel: _('ID_TITLE'),
width: 250,
allowBlank: false,
labelAlign: 'top'
},
{
xtype: 'textarea',
border:true,
name: 'TRI_DESCRIPTION',
hidden: false,
fieldLabel: _('ID_DESCRIPTION'),
width: 250,
height: 120
}]
},{
xtype: 'hidden',
name: 'TRI_UID'
}],
buttons: [{
text: _('ID_SAVE'),
//formBind :true,
handler: function(){
var getForm = editPropertiesForm.getForm().getValues();
var triggerUid = getForm.TRI_UID;
var title = getForm.TRI_TITLE;
var desc = getForm.TRI_DESCRIPTION;
//First check whether trigger name already exist or not
Ext.Ajax.request({
url : '../triggers/triggers_Save.php',
method: 'POST',
params: {
functions : 'lookforNameTrigger',
proUid : pro_uid,
NAMETRIGGER : title
},
success: function(response) {
var result = response.responseText;
if(result) {
//now save trigger
Ext.Ajax.request({
url : '../triggers/triggers_Save.php',
method: 'POST',
params:{
TRI_TITLE : title,
PRO_UID : pro_uid,
TRI_UID :triggerUid,
TRI_PARAM :'',
TRI_TYPE :'SCRIPT',
TRI_DESCRIPTION :desc,
mode :'ext'
},
success: function(response) {
var result = Ext.util.JSON.decode(response.responseText);
if( result.success ){
PMExt.notify( _('ID_STATUS') , result.msg);
//Reloading store after saving triggers
triggerStore.reload();
editPropertiesFormWindow.hide();
} else {
PMExt.error(_('ID_ERROR'), result.msg);
}
}
});
} else {
PMExt.error(_('ID_VALIDATION_ERROR'), 'There is a triggers with the same name in this process.');
}
}
});
editPropertiesFormWindow.hide();
}
},{
text: _('ID_CANCEL'),
handler: function(){
// when this button clicked,
editPropertiesFormWindow.hide();
}
}]
});
var editTriggerFormWindow = new Ext.Window({
title: _('ID_TRIGGERS'),
autoScroll: true,
collapsible: false,
width: 520,
//autoHeight: true,
height: 400,
layout: 'fit',
plain: true,
buttonAlign: 'center',
items: editTriggerForm
});
var editPropertiesFormWindow = new Ext.Window({
title: _('ID_EDIT_TRIGGERS'),
autoScroll: true,
collapsible: false,
width: 450,
//autoHeight: true,
height: 280,
layout: 'fit',
plain: true,
buttonAlign: 'center',
items: editPropertiesForm
});
var formWindow = new Ext.Window({
title: _('ID_TRIGGERS'),
autoScroll: true,
collapsible: false,
maximizable: true,
width: 450,
width: 510,
//autoHeight: true,
height: 350,
height: 420,
layout: 'fit',
plain: true,
buttonAlign: 'center',

View File

@@ -1655,7 +1655,7 @@ TaskContext.prototype.stepTriggers = function()
{
id: 'blank',
hidden : true,
width:0,
//width:0,
editable: true,
editor: new Ext.form.TextField({
allowBlank: true
@@ -1799,7 +1799,7 @@ TaskContext.prototype.stepTriggers = function()
xtype: 'fieldset',
//labelWidth: 120,
title:_('ID_ASSIGN_TRIGGERS'),
defaults: {width: 140, border:false},
//defaults: {width: 140, border:false},
autoHeight: true,
border: false,
items: [triggerGrid]
@@ -2262,7 +2262,7 @@ TaskContext.prototype.editSubProcessProperties= function(_3525)
loadingText : 'Loading...',
//renderTo : 'cases-grid',
frame : false,
autoHeight : false,
autoHeight : true,
autoScroll : true,
clicksToEdit: 1,
layout : 'form',
@@ -2316,7 +2316,7 @@ TaskContext.prototype.editSubProcessProperties= function(_3525)
loadingText : 'Loading...',
//renderTo : 'cases-grid',
frame : false,
autoHeight : false,
autoHeight : true,
autoScroll : true,
clicksToEdit: 1,
layout : 'form',