Updated Task Numbering for Task and "Adding Task from ProcessMap Context"

This commit is contained in:
girish
2011-02-01 14:02:11 +00:00
parent 862e1348ae
commit 613a2f8d42
5 changed files with 69 additions and 29 deletions

View File

@@ -1,7 +1,7 @@
bpmnLane = function (_30ab) { bpmnLane = function (_30ab) {
VectorFigure.call(this); VectorFigure.call(this);
this.setDimension(500, 300); 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; bpmnLane.prototype = new VectorFigure;

View File

@@ -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 //Deleting shapes silently on swapping task to sub process and vice-versa
MyWorkflow.prototype.deleteSilently= function(oShape) MyWorkflow.prototype.deleteSilently= function(oShape)
{ {
@@ -2136,7 +2167,8 @@ MyWorkflow.prototype.getDeleteCriteria = function()
switch (shape) { switch (shape) {
case 'bpmnTask': case 'bpmnTask':
workflow.currentSelection.actiontype = 'deleteTask'; workflow.currentSelection.actiontype = 'deleteTask';
workflow.taskNo--; if(workflow.taskNo > 0)
workflow.taskNo--;
break; break;
case 'bpmnSubProcess': case 'bpmnSubProcess':
workflow.currentSelection.actiontype = 'deleteSubProcess'; workflow.currentSelection.actiontype = 'deleteSubProcess';

View File

@@ -291,7 +291,14 @@ ProcessMapContext.prototype.exportProcess= function()
ProcessMapContext.prototype.addTask= 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() ProcessMapContext.prototype.horiLine= function()

View File

@@ -14,8 +14,6 @@ bpmnTask = function (_30ab) {
//Setting width and height values as per the zoom ratio //Setting width and height values as per the zoom ratio
if(typeof workflow.zoomTaskWidth != 'undefined' || typeof workflow.zoomTaskHeight != 'undefined') if(typeof workflow.zoomTaskWidth != 'undefined' || typeof workflow.zoomTaskHeight != 'undefined')
this.setDimension(workflow.zoomTaskWidth, workflow.zoomTaskHeight); 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 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; var fontSize = 11;
this.bpmnText.setFont('verdana', +fontSize+'px', Font.PLAIN); 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); // 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); // 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 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 if (conn == 0) //If no connection Exist then Allow connect
connect = true; connect = true;
else if (conn < 2) //If One connection exist then Do not Allow to connect 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 * taskNo will have Last Task count
* */ * */
if (_3896.newShapeName == 'bpmnTask') { if (_3896.newShapeName == 'bpmnTask') {
count = ++_3896.workflow.taskNo; count = ++workflow.taskNo;
_3896.workflow.taskName = 'Task ' + count; workflow.taskName = 'Task ' + count;
} }
workflow.subProcessName = 'Sub Process'; workflow.subProcessName = 'Sub Process';

View File

@@ -431,7 +431,8 @@ Ext.onReady ( function() {
//Creating Pool //Creating Pool
var oPool = new bpmnPool(workflow); var oPool = new bpmnPool(workflow);
//workflow.addFigure(oPool,100,70); //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; var count = 0;
this.taskName=''; this.taskName='';
droptarget.notifyDrop=function(dd, e, data) droptarget.notifyDrop=function(dd, e, data)
@@ -591,7 +592,7 @@ Ext.onReady ( function() {
break; break;
} }
} }
workflow.taskNo = 0;
//Create all shapes //Create all shapes
for(var j=0;j< shapeType.length;j++) for(var j=0;j< shapeType.length;j++)
{ {
@@ -603,14 +604,14 @@ Ext.onReady ( function() {
for(var k=0;k<shapes.tasks.length;k++){ for(var k=0;k<shapes.tasks.length;k++){
var task_boundary = shapes.tasks[k][6]; var task_boundary = shapes.tasks[k][6];
if(task_boundary != null && task_boundary == 'TIMER' && task_boundary == '') if(task_boundary != null && task_boundary == 'TIMER' && task_boundary == '')
_4562.workflow.boundaryEvent = true; workflow.boundaryEvent = true;
else else
_4562.workflow.boundaryEvent = false; workflow.boundaryEvent = false;
if(k != 0) if(k != 0)
_4562.workflow.taskNo++; workflow.taskNo++;
_4562.workflow.taskName = shapes.tasks[k][1]; workflow.taskName = shapes.tasks[k][1];
workflow.task_width = shapes.tasks[k][4]; workflow.task_width = shapes.tasks[k][4];
workflow.task_height = shapes.tasks[k][5]; workflow.task_height = shapes.tasks[k][5];
NewShape = eval("new bpmnTask(workflow)"); NewShape = eval("new bpmnTask(workflow)");
@@ -618,7 +619,7 @@ Ext.onReady ( function() {
NewShape.y = shapes.tasks[k][3]; NewShape.y = shapes.tasks[k][3];
NewShape.taskName = shapes.tasks[k][1]; NewShape.taskName = shapes.tasks[k][1];
workflow.setBoundary(NewShape); workflow.setBoundary(NewShape);
_4562.workflow.addFigure(NewShape, NewShape.x, NewShape.y); workflow.addFigure(NewShape, NewShape.x, NewShape.y);
NewShape.html.id = shapes.tasks[k][0]; NewShape.html.id = shapes.tasks[k][0];
NewShape.id = shapes.tasks[k][0]; NewShape.id = shapes.tasks[k][0];
} }
@@ -631,7 +632,7 @@ Ext.onReady ( function() {
NewShape.x = shapes.gateways[k][2]; NewShape.x = shapes.gateways[k][2];
NewShape.y = shapes.gateways[k][3]; NewShape.y = shapes.gateways[k][3];
workflow.setBoundary(NewShape); workflow.setBoundary(NewShape);
_4562.workflow.addFigure(NewShape, NewShape.x, NewShape.y); workflow.addFigure(NewShape, NewShape.x, NewShape.y);
//Setting newshape id to the old shape id //Setting newshape id to the old shape id
NewShape.html.id = shapes.gateways[k][0]; NewShape.html.id = shapes.gateways[k][0];
NewShape.id = shapes.gateways[k][0]; NewShape.id = shapes.gateways[k][0];
@@ -646,7 +647,7 @@ Ext.onReady ( function() {
NewShape.x = shapes.events[k][2]; NewShape.x = shapes.events[k][2];
NewShape.y = shapes.events[k][3]; NewShape.y = shapes.events[k][3];
workflow.setBoundary(NewShape); workflow.setBoundary(NewShape);
_4562.workflow.addFigure(NewShape, NewShape.x, NewShape.y); workflow.addFigure(NewShape, NewShape.x, NewShape.y);
//Setting newshape id to the old shape id //Setting newshape id to the old shape id
NewShape.html.id = shapes.events[k][0]; NewShape.html.id = shapes.events[k][0];
NewShape.id = shapes.events[k][0]; NewShape.id = shapes.events[k][0];
@@ -655,14 +656,14 @@ Ext.onReady ( function() {
break; break;
case 'annotations': case 'annotations':
for(var k=0;k<shapes.annotations.length;k++){ for(var k=0;k<shapes.annotations.length;k++){
_4562.workflow.annotationName = shapes.annotations[k][1]; workflow.annotationName = shapes.annotations[k][1];
workflow.anno_width = shapes.annotations[k][4]; workflow.anno_width = shapes.annotations[k][4];
workflow.anno_height = shapes.annotations[k][5]; workflow.anno_height = shapes.annotations[k][5];
NewShape = eval("new bpmnAnnotation(_4562.workflow)"); NewShape = eval("new bpmnAnnotation(_4562.workflow)");
NewShape.x = shapes.annotations[k][2]; NewShape.x = shapes.annotations[k][2];
NewShape.y = shapes.annotations[k][3]; NewShape.y = shapes.annotations[k][3];
workflow.setBoundary(NewShape); workflow.setBoundary(NewShape);
_4562.workflow.addFigure(NewShape, NewShape.x, NewShape.y); workflow.addFigure(NewShape, NewShape.x, NewShape.y);
//Setting newshape id to the old shape id //Setting newshape id to the old shape id
NewShape.html.id = shapes.annotations[k][0]; NewShape.html.id = shapes.annotations[k][0];
NewShape.id = shapes.annotations[k][0]; NewShape.id = shapes.annotations[k][0];
@@ -670,12 +671,12 @@ Ext.onReady ( function() {
break; break;
case 'subprocess': case 'subprocess':
for(var k=0;k<shapes.subprocess.length;k++){ for(var k=0;k<shapes.subprocess.length;k++){
_4562.workflow.subProcessName = shapes.subprocess[k][1]; workflow.subProcessName = shapes.subprocess[k][1];
NewShape = eval("new bpmnSubProcess(_4562.workflow)"); NewShape = eval("new bpmnSubProcess(_4562.workflow)");
NewShape.x = shapes.subprocess[k][2]; NewShape.x = shapes.subprocess[k][2];
NewShape.y = shapes.subprocess[k][3]; NewShape.y = shapes.subprocess[k][3];
workflow.setBoundary(NewShape); workflow.setBoundary(NewShape);
_4562.workflow.addFigure(NewShape, NewShape.x, NewShape.y); workflow.addFigure(NewShape, NewShape.x, NewShape.y);
//Setting newshape id to the old shape id //Setting newshape id to the old shape id
NewShape.html.id = shapes.subprocess[k][0]; NewShape.html.id = shapes.subprocess[k][0];
NewShape.id = shapes.subprocess[k][0]; NewShape.id = shapes.subprocess[k][0];
@@ -683,6 +684,8 @@ Ext.onReady ( function() {
break; break;
} }
} }
if(typeof(workflow.taskNo) != 'undefined')
workflow.taskNo++;
return shapes; return shapes;
} }