From 3b8be6ca5986e9659c29e2835dc1452f488fbcf8 Mon Sep 17 00:00:00 2001 From: girish Date: Thu, 23 Dec 2010 14:45:54 +0000 Subject: [PATCH] worked on saving routes (while going reverse, adding route from down to up) --- .../engine/methods/bpmn/patterns_Ajax.php | 2 +- workflow/engine/templates/bpmn/MyWorkflow.js | 6 +- workflow/engine/templates/bpmn/bpmnShapes.js | 67 +++++++++++++++++-- 3 files changed, 65 insertions(+), 10 deletions(-) diff --git a/workflow/engine/methods/bpmn/patterns_Ajax.php b/workflow/engine/methods/bpmn/patterns_Ajax.php index 84669c7d4..a3cf131cb 100755 --- a/workflow/engine/methods/bpmn/patterns_Ajax.php +++ b/workflow/engine/methods/bpmn/patterns_Ajax.php @@ -92,7 +92,7 @@ switch ($aData['action']) { foreach ($aData['ROU_NEXT_TASK'] as $iKey => $aRow) { $aFields['PRO_UID'] = $aData['PROCESS']; - $aFields['TAS_UID'] = $aData['TASK']; + $aFields['TAS_UID'] = $aData['TASK'][0]; $aFields['ROU_NEXT_TASK'] = $aRow; $aFields['ROU_CASE'] = $iKey; $aFields['ROU_TYPE'] = $aData['ROU_TYPE']; diff --git a/workflow/engine/templates/bpmn/MyWorkflow.js b/workflow/engine/templates/bpmn/MyWorkflow.js index 1726ce6de..6a9e85392 100755 --- a/workflow/engine/templates/bpmn/MyWorkflow.js +++ b/workflow/engine/templates/bpmn/MyWorkflow.js @@ -1860,7 +1860,7 @@ MyWorkflow.prototype.saveEvents = function(oEvent,sTaskUID) if(response.responseText != '') { //Save Route - if(workflow.currentSelection.type == 'bpmnEventTimerInter'){ + if(workflow.currentSelection.type.match(/Inter/) && workflow.currentSelection.type.match(/Event/)){ workflow.currentSelection.id = response.responseText; var newObj = workflow.currentSelection; var preObj = new Array(); @@ -1885,7 +1885,7 @@ MyWorkflow.prototype.saveEvents = function(oEvent,sTaskUID) * @Param newObj Object * @Author Girish joshi */ -MyWorkflow.prototype.saveRoute = function(preObj,newObj) +MyWorkflow.prototype.saveRoute = function(preObj,newObj) { var pro_uid = this.getUrlVars(); @@ -2265,4 +2265,4 @@ MyWorkflow.prototype.zoom = function(sType) } } -} \ No newline at end of file +} diff --git a/workflow/engine/templates/bpmn/bpmnShapes.js b/workflow/engine/templates/bpmn/bpmnShapes.js index 57efe8c8e..cf039a195 100755 --- a/workflow/engine/templates/bpmn/bpmnShapes.js +++ b/workflow/engine/templates/bpmn/bpmnShapes.js @@ -272,7 +272,7 @@ InputPort.prototype.onDrop = function (port) { return; } if (this.parentNode.id == port.parentNode.id) {} else { - var newObj = new Array(); + /*var newObj = new Array(); newObj = this.workflow.currentSelection; var preObj = port.parentNode; newObj.sPortType =port.properties.name; @@ -284,7 +284,62 @@ InputPort.prototype.onDrop = function (port) { return; } _3f02.setConnection(new DecoratedConnection()); - this.parentNode.workflow.getCommandStack().execute(_3f02); + this.parentNode.workflow.getCommandStack().execute(_3f02);*/ + var _4070 = new CommandConnect(this.parentNode.workflow, port, this); + if (_4070.source.type == _4070.target.type) { + return; + } + _4070.setConnection(new DecoratedConnection()); + this.parentNode.workflow.getCommandStack().execute(_4070); + + //Saving Start Event + var preObj = new Array(); + var bpmnType = this.workflow.currentSelection.type; + if(bpmnType.match(/Event/) && bpmnType.match(/Start/) && port.parentNode.type.match(/Task/)) + { + var tas_uid = port.parentNode.id; + this.workflow.saveEvents(this.workflow.currentSelection,tas_uid); + } + else if(bpmnType.match(/End/) && bpmnType.match(/Event/) && port.parentNode.type.match(/Task/)) + { + preObj = this.workflow.currentSelection; + var newObj = port.parentNode; + newObj.conn = _4070.connection; + this.workflow.saveRoute(preObj,newObj); + } + else if(port.parentNode.type.match(/Task/) && bpmnType.match(/Inter/) && bpmnType.match(/Event/)) + { + var taskFrom = workflow.getStartEventConn(this,'sourcePort','InputPort'); + var taskTo = workflow.getStartEventConn(this,'targetPort','OutputPort'); + + if(typeof taskFrom[0] != 'undefined' || typeof taskTo[0] != 'undefined') + { + preObj.type = 'Task'; + preObj.taskFrom = taskFrom[0].value; + preObj.taskTo = taskTo[0].value; + + //save Event First + tas_uid = port.parentNode.id; + this.workflow.saveEvents(workflow.currentSelection,preObj); + } + } + else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Task/)) + { + + preObj = this.workflow.currentSelection; + newObj = port.parentNode; + newObj.conn = _4070.connection; + newObj.sPortType =port.properties.name; + preObj.sPortType =this.properties.name; + this.workflow.saveRoute(preObj,newObj); + } + else if(bpmnType.match(/Gateway/) && port.parentNode.type.match(/Task/)) + { + var shape = new Array(); + shape.type = ''; + preObj = this.workflow.currentSelection; + this.workflow.saveRoute(preObj,shape); + } } }; @@ -338,15 +393,15 @@ OutputPort.prototype.onDrop = function (port) { preObj.taskTo = taskTo[0].value; //save Event First - var tas_uid = port.parentNode.id; + tas_uid = port.parentNode.id; this.workflow.saveEvents(workflow.currentSelection,preObj); } } else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Task/)) { - var preObj = this.workflow.currentSelection; - var newObj = port.parentNode; + preObj = this.workflow.currentSelection; + newObj = port.parentNode; newObj.conn = _4070.connection; newObj.sPortType =port.properties.name; preObj.sPortType =this.properties.name; @@ -356,7 +411,7 @@ OutputPort.prototype.onDrop = function (port) { { var shape = new Array(); shape.type = ''; - var preObj = this.workflow.currentSelection; + preObj = this.workflow.currentSelection; this.workflow.saveRoute(preObj,shape); }