Fixed start Event saving and deletion

This commit is contained in:
girish
2011-02-16 11:01:43 +00:00
parent 8cb0ad8c82
commit 3eae3bc0ea
4 changed files with 112 additions and 106 deletions

View File

@@ -6569,7 +6569,6 @@ function saveExtEvents($oData)
$aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE'; $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE';
$aDataEvent['EVN_TYPE'] = $oData->evn_type; $aDataEvent['EVN_TYPE'] = $oData->evn_type;
if(preg_match("/Start/", $sEvn_type)){ if(preg_match("/Start/", $sEvn_type)){
$aDataTask['TAS_UID'] = $oData->tas_uid; $aDataTask['TAS_UID'] = $oData->tas_uid;
$aDataTask['TAS_START'] = $oData->tas_start; $aDataTask['TAS_START'] = $oData->tas_start;

View File

@@ -40,8 +40,7 @@
$process = $oProcess->createProcessPM($oData->process); $process = $oProcess->createProcessPM($oData->process);
foreach($oData->tasks as $id => $value) foreach($oData->tasks as $id => $value)
{ {
if($value['TAS_TYPE'] == 'SUBPROCESS') if($value['TAS_TYPE'] == 'SUBPROCESS'){
{
$arraySubProcess[$countSubProcess]['0'] = $value['TAS_UID']; $arraySubProcess[$countSubProcess]['0'] = $value['TAS_UID'];
$arraySubProcess[$countSubProcess]['1'] = $value['TAS_TITLE']; $arraySubProcess[$countSubProcess]['1'] = $value['TAS_TITLE'];
$arraySubProcess[$countSubProcess]['2'] = $value['TAS_POSX']; $arraySubProcess[$countSubProcess]['2'] = $value['TAS_POSX'];
@@ -57,7 +56,7 @@
$arrayTasks[$countTasks]['4'] = $value['TAS_WIDTH']; $arrayTasks[$countTasks]['4'] = $value['TAS_WIDTH'];
$arrayTasks[$countTasks]['5'] = $value['TAS_HEIGHT']; $arrayTasks[$countTasks]['5'] = $value['TAS_HEIGHT'];
$arrayTasks[$countTasks]['6'] = $value['TAS_BOUNDARY']; $arrayTasks[$countTasks]['6'] = $value['TAS_BOUNDARY'];
/* if($value['TAS_START'] == 'TRUE'){ if($value['TAS_START'] == 'TRUE'){
$arrayEvents[$count]['0'] = G::generateUniqueID(); $arrayEvents[$count]['0'] = G::generateUniqueID();
if($value['TAS_EVN_UID'] == '') if($value['TAS_EVN_UID'] == '')
{ {
@@ -84,7 +83,7 @@
$arrayRoutes[$countRoutes]['4']= '2'; $arrayRoutes[$countRoutes]['4']= '2';
$count = $count+ 1; $count = $count+ 1;
$countRoutes = $countRoutes+ 1; $countRoutes = $countRoutes+ 1;
}*/ }
$countTasks = $countTasks + 1; $countTasks = $countTasks + 1;
} }
} }
@@ -122,7 +121,7 @@
$fields['TRANSITION'][$countRoutes]['4']= '1'; $fields['TRANSITION'][$countRoutes]['4']= '1';
$countRoutes = $countRoutes + 1; $countRoutes = $countRoutes + 1;
} }
else if($value['TAS_UID'] == '' && $value['EVN_TAS_UID_TO'] != ''){ //Check for Intermediate Events else if($value['TAS_UID'] == '' && $value['EVN_TAS_UID_TO'] != '' && ! preg_match("/Start/", $value['EVN_TYPE'])){ //Check for Intermediate Events
$evn_uid = $value['EVN_UID']; $evn_uid = $value['EVN_UID'];
$idTask = $value['EVN_TAS_UID_TO']; $idTask = $value['EVN_TAS_UID_TO'];

View File

@@ -191,6 +191,14 @@ if ( isset ($_REQUEST['action']) ) {
$aData['TAS_EVN_UID'] = ''; $aData['TAS_EVN_UID'] = '';
$oTask->update($aData); $oTask->update($aData);
break; break;
case 'deleteStartEvent':
$aData['TAS_UID'] = $oData->tas_uid;
$aData['TAS_START'] = $oData->tas_start;
$aData['TAS_EVN_UID'] = '';
$oTask->update($aData);
if(isset($oData->evn_uid))
$oEvent->remove($oData->evn_uid);
break;
case 'updateEvent': case 'updateEvent':
$aData['EVN_UID'] = $oData->evn_uid; $aData['EVN_UID'] = $oData->evn_uid;
$aData['EVN_TYPE'] = $oData->evn_type; $aData['EVN_TYPE'] = $oData->evn_type;

View File

@@ -1300,13 +1300,9 @@ MyWorkflow.prototype.deleteSilently= function(oShape)
*/ */
MyWorkflow.prototype.deleteShape= function(oShape) MyWorkflow.prototype.deleteShape= function(oShape)
{ {
//Initializing variables
var pro_uid = this.getUrlVars();
var shapeId = oShape.id; var shapeId = oShape.id;
var actiontype = oShape.actiontype; var actiontype = oShape.actiontype;
var shapeName = ''; var shapeName = '';
switch(actiontype) switch(actiontype)
{ {
case 'deleteTask': case 'deleteTask':
@@ -1324,19 +1320,27 @@ MyWorkflow.prototype.deleteShape= function(oShape)
this.urlparameter = urlparams; this.urlparameter = urlparams;
shapeName = 'Annotation'; shapeName = 'Annotation';
break; break;
case 'saveStartEvent': case 'deleteStartEvent':
var task_detail = this.getStartEventConn(this.currentSelection,'targetPort','OutputPort'); var task_detail = this.getStartEventConn(this.currentSelection,'targetPort','OutputPort');
var evn_uid = this.currentSelection.id;
if(task_detail.length > 0){ if(task_detail.length > 0){
var tas_uid = task_detail[0].value; var tas_uid = task_detail[0].value;
var tas_start = 'FALSE'; var tas_start = 'FALSE';
urlparams = '?action=saveStartEvent&data={"tas_uid":"'+tas_uid+'","tas_start":"'+tas_start+'"}'; this.urlparameter = '?action=deleteStartEvent&data={"tas_uid":"'+tas_uid+'","tas_start":"'+tas_start+'","evn_uid":"'+evn_uid+'"}';
this.urlparameter = urlparams;
shapeName = 'Start Event';
} }
else
this.urlparameter = '?action=deleteEvent&data={"uid":"'+evn_uid+'"}';
shapeName = 'Start Event';
break; break;
case 'deleteEndEvent': case 'deleteEndEvent':
shapeName = 'End Event'; shapeName = 'End Event';
oShape.workflow.getCommandStack().execute(new CommandDelete(oShape.workflow.getCurrentSelection())); var evn_uid = this.currentSelection.id;
this.urlparameter = '?action=deleteEvent&data={"uid":"'+evn_uid+'"}';
break;
case 'deleteInterEvent':
shapeName = 'Intermediate Event';
var evn_uid = this.currentSelection.id;
this.urlparameter = '?action=deleteEvent&data={"uid":"'+evn_uid+'"}';
break; break;
case 'deleteGateway': case 'deleteGateway':
shapeName = 'Gateway'; shapeName = 'Gateway';
@@ -1344,22 +1348,46 @@ MyWorkflow.prototype.deleteShape= function(oShape)
this.urlparameter = urlparams; this.urlparameter = urlparams;
break; break;
} }
if(typeof oShape.noAlert == 'undefined' || oShape.noAlert == null){
//Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete the '+ shapeName,this.showResult); Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete the '+ shapeName,this.showAjaxDialog);
}
if(oShape.noAlert == null) else{
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete the '+ shapeName,this.showResult); Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete the '+ shapeName,this.showDialog);
else }
workflow.showResult('yes');
} }
MyWorkflow.prototype.showResult = function(btn){ MyWorkflow.prototype.showAjaxDialog = function(btn){
//this.workflow.confirm = btn; //this.workflow.confirm = btn;
if(typeof workflow.urlparameter != 'undefined') if(typeof workflow.urlparameter != 'undefined'){
{
var url = workflow.urlparameter; var url = workflow.urlparameter;
if(btn == 'yes') if(btn == 'yes'){
//Check for End Event and delete from route table
if(workflow.currentSelection.type.match(/End/) && workflow.currentSelection.type.match(/Event/)){
var currentObj = workflow.currentSelection;
var ports = currentObj.getPorts();
var len =ports.data.length;
var conn = new Array();
for(var i=0; i<=len; i++){
if(typeof ports.data[i] === 'object')
conn[i] = ports.data[i].getConnections();
}
for(i = 0; i< conn.length ; i++)
{ {
if(typeof conn[i] != 'undefined')
for(var j = 0; j < conn[i].data.length ; j++)
{
if(typeof conn[i].data[j] != 'undefined'){
if(conn[i].data[j].targetPort.parentNode.id == currentObj.id){
route = conn[i].data[j];
break;
}
}
}
}
if(typeof route != 'undefined'){
workflow.deleteRoute(route,1);
}
}
Ext.Ajax.request({ Ext.Ajax.request({
url: "processes_Ajax.php"+ url, url: "processes_Ajax.php"+ url,
success: function(response) { success: function(response) {
@@ -1372,9 +1400,15 @@ MyWorkflow.prototype.showResult = function(btn){
workflow.getCommandStack().execute(new CommandDelete(workflow.getCurrentSelection())); workflow.getCommandStack().execute(new CommandDelete(workflow.getCurrentSelection()));
} }
} }
//Ext.example.msg('Button Click', 'You clicked the {0} button', btn);
}; };
MyWorkflow.prototype.showDialog = function(btn){
if(btn == 'yes'){
workflow.getCommandStack().execute(new CommandDelete(workflow.getCurrentSelection()));
}
};
/** /**
* ExtJs Menu on right click on Event Shape * ExtJs Menu on right click on Event Shape
* @Param oShape Object * @Param oShape Object
@@ -1765,19 +1799,15 @@ MyWorkflow.prototype.saveRoute = function(preObj,newObj)
} }
MyWorkflow.prototype.deleteRoute = function(oConn,iVal){ MyWorkflow.prototype.deleteRoute = function(oConn,iVal){
workflow.oConn = oConn; workflow.oConn = oConn;
var sourceObjType = oConn.sourcePort.parentNode.type; var sourceObjType = oConn.sourcePort.parentNode.type;
var targetObjType = oConn.targetPort.parentNode.type; var targetObjType = oConn.targetPort.parentNode.type;
var rou_uid = oConn.id; var rou_uid = oConn.id;
//Setting Condition for VALID ROUTE_UID present in Route Table //Setting Condition for VALID ROUTE_UID present in Route Table
//For start and gateway event, we dont have entry in ROUTE table //For start and gateway event, we dont have entry in ROUTE table
if(rou_uid != '' && !sourceObjType.match(/Gateway/) && !sourceObjType.match(/Start/) && !targetObjType.match(/Gateway/)) if(rou_uid != '' && !sourceObjType.match(/Gateway/) && !sourceObjType.match(/Start/) && !targetObjType.match(/Gateway/)){
{
workflow.urlDeleteparameter = '?action=deleteRoute&data={"uid":"'+ rou_uid +'"}'; workflow.urlDeleteparameter = '?action=deleteRoute&data={"uid":"'+ rou_uid +'"}';
} }
//Deleting route for Start event and also deleting start event //Deleting route for Start event and also deleting start event
else if(sourceObjType.match(/Start/)){ else if(sourceObjType.match(/Start/)){
var targetObj = oConn.targetPort.parentNode; //Task var targetObj = oConn.targetPort.parentNode; //Task
@@ -1786,7 +1816,6 @@ MyWorkflow.prototype.deleteRoute = function(oConn,iVal){
workflow.urlDeleteparameter = '?action=saveStartEvent&data={"tas_uid":"'+tas_uid+'","tas_start":"'+tas_start+'"}'; workflow.urlDeleteparameter = '?action=saveStartEvent&data={"tas_uid":"'+tas_uid+'","tas_start":"'+tas_start+'"}';
} }
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete the Event',this.showEventResult); Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete the Event',this.showEventResult);
} }
MyWorkflow.prototype.showEventResult = function(btn){ MyWorkflow.prototype.showEventResult = function(btn){
@@ -1834,61 +1863,32 @@ MyWorkflow.prototype.deleteEvent = function(eventObj){
MyWorkflow.prototype.getDeleteCriteria = function() MyWorkflow.prototype.getDeleteCriteria = function()
{ {
var shape = workflow.currentSelection.type; var shape = workflow.currentSelection.type;
switch (shape) {
case 'bpmnTask':
workflow.currentSelection.actiontype = 'deleteTask';
break;
case 'bpmnSubProcess':
workflow.currentSelection.actiontype = 'deleteSubProcess';
break;
case 'bpmnAnnotation':
workflow.currentSelection.actiontype = 'deleteText';
break;
case 'bpmnEventEmptyStart':
workflow.currentSelection.actiontype = 'saveStartEvent';
break;
case 'bpmnEventEmptyEnd':
//workflow.currentSelection.actiontype = 'deleteEndEvent';
var currentObj = workflow.currentSelection; var currentObj = workflow.currentSelection;
var ports = currentObj.getPorts(); if(shape.match(/Task/)){
var len =ports.data.length; workflow.currentSelection.actiontype = 'deleteTask';
}
else if(shape.match(/SubProcess/)){
workflow.currentSelection.actiontype = 'deleteSubProcess';
}
else if(shape.match(/Annotation/)){
workflow.currentSelection.actiontype = 'deleteText';
}
else if(shape.match(/Event/) && shape.match(/Start/)){
workflow.currentSelection.actiontype = 'deleteStartEvent';
}
else if(shape.match(/Event/) && shape.match(/End/)){
workflow.currentSelection.actiontype = 'deleteEndEvent';
//Get all the connection of the shape
var conn = new Array();
for(var i=0; i<=len; i++){
if(typeof ports.data[i] === 'object')
conn[i] = ports.data[i].getConnections();
} }
//Get ALL the connections for the specified PORT else if(shape.match(/Event/) && shape.match(/Inter/)){
for(i = 0; i< conn.length ; i++) workflow.currentSelection.actiontype = 'deleteInterEvent';
{
if(typeof conn[i] != 'undefined')
for(var j = 0; j < conn[i].data.length ; j++)
{
if(typeof conn[i].data[j] != 'undefined')
{
if(conn[i].data[j].targetPort.parentNode.id == currentObj.id){
route = conn[i].data[j];
break;
} }
} else if(shape.match(/Gateway/)){
}
}
if(typeof route != 'undefined')
{
workflow.deleteRoute(route,1);
}
break;
case shape.match(/Gateway/):
workflow.currentSelection.actiontype = 'deleteGateway'; workflow.currentSelection.actiontype = 'deleteGateway';
workflow.deleteShape(workflow.currentSelection); workflow.deleteShape(workflow.currentSelection);
break;
} }
if(workflow.currentSelection.actiontype != '') if(workflow.currentSelection.actiontype != '')
workflow.deleteShape(workflow.currentSelection); workflow.deleteShape(workflow.currentSelection);
} }
/** /**