diff --git a/workflow/engine/templates/bpmn/Lane.js b/workflow/engine/templates/bpmn/Lane.js index 2c718eb92..bd1b12a80 100755 --- a/workflow/engine/templates/bpmn/Lane.js +++ b/workflow/engine/templates/bpmn/Lane.js @@ -1,7 +1,7 @@ bpmnLane = function (_30ab) { VectorFigure.call(this); this.setDimension(500, 300); - this.setTaskName(_30ab.taskNo); //It will set the Default Task Name with appropriate count While dragging a task on the canvas + // this.setTaskName(_30ab.taskNo); //It will set the Default Task Name with appropriate count While dragging a task on the canvas }; bpmnLane.prototype = new VectorFigure; diff --git a/workflow/engine/templates/bpmn/MyWorkflow.js b/workflow/engine/templates/bpmn/MyWorkflow.js index 03ac743a0..57a8a9d2f 100755 --- a/workflow/engine/templates/bpmn/MyWorkflow.js +++ b/workflow/engine/templates/bpmn/MyWorkflow.js @@ -1638,6 +1638,37 @@ MyWorkflow.prototype.saveShape= function(oNewShape) }); } +MyWorkflow.prototype.saveTask= function(actiontype,xpos,ypos) +{ + if(actiontype != '') + { + var pro_uid = this.getUrlVars(); + var actiontype = actiontype; + var pos = '{"x":'+xpos+',"y":'+ypos+'}'; + switch(actiontype) + { + case 'addTask': + urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","position":'+pos+'}'; + break; + + } + Ext.Ajax.request({ + url: "processes_Ajax.php"+ urlparams, + success: function(response) { + //Ext.Msg.alert (response.responseText); + if(response.responseText != 1 && response.responseText != "") + { + workflow.newTaskInfo = Ext.util.JSON.decode(response.responseText); + workflow.taskName = this.workflow.newTaskInfo.label; + workflow.task = eval("new bpmnTask(workflow) "); + workflow.addFigure(workflow.task, xpos, ypos); + workflow.task.html.id = workflow.newTaskInfo.uid; + workflow.task.id = workflow.newTaskInfo.uid; + } + } + }) + } +} //Deleting shapes silently on swapping task to sub process and vice-versa MyWorkflow.prototype.deleteSilently= function(oShape) { @@ -2136,7 +2167,8 @@ MyWorkflow.prototype.getDeleteCriteria = function() switch (shape) { case 'bpmnTask': workflow.currentSelection.actiontype = 'deleteTask'; - workflow.taskNo--; + if(workflow.taskNo > 0) + workflow.taskNo--; break; case 'bpmnSubProcess': workflow.currentSelection.actiontype = 'deleteSubProcess'; diff --git a/workflow/engine/templates/bpmn/ProcessMapContext.js b/workflow/engine/templates/bpmn/ProcessMapContext.js index 1458d260d..8097ad4b3 100755 --- a/workflow/engine/templates/bpmn/ProcessMapContext.js +++ b/workflow/engine/templates/bpmn/ProcessMapContext.js @@ -161,7 +161,7 @@ ProcessMapContext.prototype.exportProcess= function() workflow.FILENAME_LINK = ''; workflow.FILENAME_LINKXPDL = ''; - + var exportProcessForm = new Ext.FormPanel({ labelWidth : 120, // label settings here cascade unless overridden frame : true, @@ -291,7 +291,14 @@ ProcessMapContext.prototype.exportProcess= function() ProcessMapContext.prototype.addTask= function() { - Ext.MessageBox.alert('Status','Add Task'); + var count = ++workflow.taskNo; //Incrementing Task No and assigning it to a local variable + workflow.taskName = 'Task '+count; + var newShape = eval("new bpmnTask(workflow)"); + var xPos = workflow.contextX; + var yPos = workflow.contextY; + workflow.addFigure(newShape, xPos, yPos); + newShape.actiontype = 'addTask'; + workflow.saveShape(newShape); //Saving Annotations when user drags and drops it } ProcessMapContext.prototype.horiLine= function() @@ -1872,7 +1879,7 @@ ProcessMapContext.prototype.caseTrackerObjects= function() workflow.gridObjectRowSelected = rowSelected; var rowData = ProcMapObj.ExtVariables(); console.log(rowData); - + } }) @@ -1959,7 +1966,7 @@ ProcessMapContext.prototype.caseTrackerObjects= function() var cto_uid = record.data.CTO_UID; var condition = record.data.CTO_CONDITION; - + Ext.Ajax.request({ url : '../tracker/tracker_Ajax.php', method: 'POST', @@ -2145,7 +2152,7 @@ ProcessMapContext.prototype.ExtVariables = function() //getting selected row of variables var rowSelected = this.getSelectionModel().getSelected(); var rowLabel = rowSelected.data.variable; - + //Assigned new object with condition if(typeof getObjectGridRow.colModel != 'undefined') getObjectGridRow.colModel.config[3].editor.setValue(rowLabel); @@ -2199,7 +2206,7 @@ ProcessMapContext.prototype.ExtVariables = function() TAS_UID : taskId, TRI_UID : getObjectGridRow[0].data.TRI_UID, ST_TYPE : getObjectGridRow[0].data.ST_TYPE - + }, success: function (response){ Ext.MessageBox.alert ('Status','Objects has been edited successfully '); @@ -2282,7 +2289,7 @@ ProcessMapContext.prototype.ExtVariables = function() }) window.hide(); } - + break; case 'form': FormSelected = workflow.formSelected; diff --git a/workflow/engine/templates/bpmn/bpmnShapes.js b/workflow/engine/templates/bpmn/bpmnShapes.js index 6b698f01c..9f2e45f4e 100755 --- a/workflow/engine/templates/bpmn/bpmnShapes.js +++ b/workflow/engine/templates/bpmn/bpmnShapes.js @@ -14,8 +14,6 @@ bpmnTask = function (_30ab) { //Setting width and height values as per the zoom ratio if(typeof workflow.zoomTaskWidth != 'undefined' || typeof workflow.zoomTaskHeight != 'undefined') this.setDimension(workflow.zoomTaskWidth, workflow.zoomTaskHeight); - - this.taskName = _30ab.taskName; //It will set the Default Task Name with appropriate count While dragging a task on the canvas }; @@ -98,7 +96,7 @@ bpmnTask.prototype.paint = function () { var fontSize = 11; this.bpmnText.setFont('verdana', +fontSize+'px', Font.PLAIN); - this.bpmnText.drawStringRect(this.taskName, padleft, padtop, this.rectWidth, rectheight, 'center'); + this.bpmnText.drawStringRect(workflow.taskName, padleft, padtop, this.rectWidth, rectheight, 'center'); // tempcoord = this.coord_converter(this.getWidth(), this.getHeight(), this.taskName.length); // bpmnText.drawTextString(this.taskName, this.getWidth(), this.getHeight(), tempcoord.temp_x, tempcoord.temp_y); @@ -353,7 +351,7 @@ OutputPort.prototype.onDrop = function (port) { } var connect = true; - var conn = this.workflow.checkConnectionsExist(port, 'targetPort', 'OutputPort'); + var conn = port.workflow.checkConnectionsExist(port, 'targetPort', 'OutputPort'); if (conn == 0) //If no connection Exist then Allow connect connect = true; else if (conn < 2) //If One connection exist then Do not Allow to connect @@ -779,8 +777,8 @@ bpmnTask.prototype.addShapes = function (_3896) { * taskNo will have Last Task count * */ if (_3896.newShapeName == 'bpmnTask') { - count = ++_3896.workflow.taskNo; - _3896.workflow.taskName = 'Task ' + count; + count = ++workflow.taskNo; + workflow.taskName = 'Task ' + count; } workflow.subProcessName = 'Sub Process'; diff --git a/workflow/engine/templates/bpmn/processmap.js b/workflow/engine/templates/bpmn/processmap.js index c04b15a0c..6531a8aba 100755 --- a/workflow/engine/templates/bpmn/processmap.js +++ b/workflow/engine/templates/bpmn/processmap.js @@ -431,7 +431,8 @@ Ext.onReady ( function() { //Creating Pool var oPool = new bpmnPool(workflow); //workflow.addFigure(oPool,100,70); - workflow.taskNo= 0; //Initializing Count for the bpmnTask + if(workflow.taskNo == '') + workflow.taskNo= 0; //Initializing Count for the bpmnTask var count = 0; this.taskName=''; droptarget.notifyDrop=function(dd, e, data) @@ -591,26 +592,26 @@ Ext.onReady ( function() { break; } } - + workflow.taskNo = 0; //Create all shapes for(var j=0;j< shapeType.length;j++) { // _4562.workflow.taskNo=0; - + switch(shapeType[j]) { case 'tasks': for(var k=0;k