saving events on drag and drop
This commit is contained in:
@@ -6093,6 +6093,48 @@ function getExtTaskUsersAdHocCriteria($sTaskUID = '', $iType = 1) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
function saveExtddEvents($oData)
|
||||
{
|
||||
$oTask = new Task();
|
||||
$oEvent = new Event();
|
||||
$oEvn_uid = '';
|
||||
$aData['PRO_UID'] = $oData->uid;
|
||||
$aData['EVN_TYPE'] = $oData->tas_type;
|
||||
$aData['EVN_POSX'] = $oData->position->x;
|
||||
$aData['EVN_POSY'] = $oData->position->y;
|
||||
$aData['EVN_STATUS'] = 'ACTIVE';
|
||||
$aData['EVN_WHEN'] = '1';
|
||||
$aData['EVN_ACTION'] = '';
|
||||
|
||||
if(preg_match("/Inter/", $aData['EVN_TYPE'])){
|
||||
$aData['EVN_RELATED_TO'] = 'MULTIPLE';
|
||||
}
|
||||
if(preg_match("/Start/", $aData['EVN_TYPE']) || preg_match("/Inter/", $aData['EVN_TYPE'])){
|
||||
$aData['EVN_RELATED_TO'] = 'SINGLE';
|
||||
}
|
||||
if(isset($oData->tas_uid) && $oData->tas_uid != ''){
|
||||
$aData['TAS_UID'] = $oData->tas_uid;
|
||||
$oTaskData = $oTask->load($aData['TAS_UID']);
|
||||
if($oTaskData['TAS_EVN_UID'] == ''){
|
||||
$oEvn_uid = $oEvent->create($aData);
|
||||
}else{
|
||||
$aData['EVN_UID'] = $oTaskData['TAS_EVN_UID'];
|
||||
$oEvn_uid = $aData['EVN_UID'];
|
||||
$oEvent->update($aData);
|
||||
}
|
||||
$aTask['TAS_UID'] = $oData->tas_uid;
|
||||
$aTask['TAS_EVN_UID'] = $oEvn_uid;
|
||||
$aTask['TAS_START'] = 'TRUE';
|
||||
$oTask->update($aTask);
|
||||
}else{
|
||||
$oEvn_uid = $oEvent->create($aData);
|
||||
}
|
||||
$oNewTask->uid = $oEvn_uid;
|
||||
$oJSON = new Services_JSON ( );
|
||||
return $oJSON->encode($oNewTask);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,17 @@
|
||||
$countTasks = $countTasks + 1;
|
||||
}
|
||||
}
|
||||
//for Events
|
||||
foreach($oData->event as $id => $value)
|
||||
{
|
||||
if($value['TAS_UID'] == '' && $value['EVN_TAS_UID_FROM'] == '' && $value['EVN_TAS_UID_TO'] == ''){
|
||||
$arrayEvents[$count]['0'] = $value['EVN_UID'];
|
||||
$arrayEvents[$count]['1'] = $value['EVN_TYPE'];
|
||||
$arrayEvents[$count]['2'] = $value['EVN_POSX'];
|
||||
$arrayEvents[$count]['3'] = $value['EVN_POSY'];
|
||||
$count = $count+ 1;
|
||||
}
|
||||
}
|
||||
$lanes = $oProcess->createLanesNewPM($oData->lanes);
|
||||
$fields = $oProcess->createTransitionsPM($oData->tasks,$oData->routes,$arrayEvents,$count,$arrayRoutes,$countRoutes);
|
||||
//$subProcess = $oProcess->createSubProcessesPM($oData->subProcess);
|
||||
|
||||
@@ -191,6 +191,9 @@ if ( isset ($_REQUEST['action']) ) {
|
||||
$oEvent->update($aData);
|
||||
break;
|
||||
case 'addEvent':
|
||||
$sOutput = $oProcessMap->saveExtddEvents($oData);
|
||||
echo $sOutput;
|
||||
/*
|
||||
$aData['PRO_UID'] = $oData->uid;
|
||||
$aData['EVN_TYPE'] = $oData->tas_type;
|
||||
$aData['EVN_STATUS'] = 'ACTIVE';
|
||||
@@ -220,7 +223,7 @@ if ( isset ($_REQUEST['action']) ) {
|
||||
$aTask['TAS_EVN_UID'] = $oEvn_uid;
|
||||
$aTask['TAS_START'] = 'TRUE';
|
||||
$oTask->update($aTask);
|
||||
}
|
||||
}*/
|
||||
break;
|
||||
case 'deleteRoute':
|
||||
require_once 'classes/model/Route.php';
|
||||
|
||||
@@ -1099,9 +1099,11 @@ MyWorkflow.prototype.saveShape= function(oNewShape)
|
||||
urlparams = '?action='+actiontype+'&data={"tas_uid":"'+tas_uid+'","tas_start":"'+tas_start+'"}';
|
||||
break;
|
||||
case 'addEvent':
|
||||
var tas_uid = oNewShape.workflow.taskUid[0].value;
|
||||
var tas_uid='';
|
||||
if(typeof oNewShape.workflow != 'undefined' && oNewShape.workflow != null)
|
||||
tas_uid = oNewShape.workflow.taskUid[0].value;
|
||||
var tas_type = oNewShape.type;
|
||||
urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","tas_uid":"'+tas_uid+'","tas_type":"'+tas_type+'"}';
|
||||
urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","tas_uid":"'+tas_uid+'","tas_type":"'+tas_type+'","position":'+pos+'}';
|
||||
break;
|
||||
case 'updateEvent':
|
||||
var evn_uid = oNewShape.id
|
||||
|
||||
@@ -288,29 +288,22 @@ InputPort.prototype.onDrop = function (port) {
|
||||
var bpmnType = this.workflow.currentSelection.type;
|
||||
|
||||
//Routing from end event to task
|
||||
if(bpmnType.match(/End/) && bpmnType.match(/Event/) && port.parentNode.type.match(/Task/))
|
||||
{
|
||||
if(bpmnType.match(/End/) && bpmnType.match(/Event/) && port.parentNode.type.match(/Task/)){
|
||||
preObj = this.workflow.currentSelection; //end event
|
||||
var newObj = port.parentNode; //task
|
||||
newObj.conn = _4070.connection;
|
||||
newObj.reverse = 1; //setting reverse parameter if user is routing from down to up
|
||||
this.workflow.saveRoute(preObj,newObj);
|
||||
}
|
||||
|
||||
//Routing from task to start event
|
||||
else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Event/) && port.parentNode.type.match(/Start/))
|
||||
{
|
||||
else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Event/)){
|
||||
preObj = this.workflow.currentSelection; //task
|
||||
newObj = port.parentNode; //start event
|
||||
//newObj.reverse = 1; //setting reverse parameter if user is routing from down to up
|
||||
var tas_uid = preObj.id;
|
||||
this.workflow.saveEvents(newObj,tas_uid);
|
||||
}
|
||||
|
||||
//Routing from task to task
|
||||
else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Task/))
|
||||
{
|
||||
|
||||
else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Task/)){
|
||||
preObj = this.workflow.currentSelection;
|
||||
newObj = port.parentNode;
|
||||
newObj.conn = _4070.connection;
|
||||
@@ -318,35 +311,27 @@ InputPort.prototype.onDrop = function (port) {
|
||||
preObj.sPortType =this.properties.name;
|
||||
this.workflow.saveRoute(newObj,preObj);
|
||||
}
|
||||
|
||||
//Routing from task to gateway
|
||||
else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Gateway/))
|
||||
{
|
||||
else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Gateway/)){
|
||||
var shape = new Array();
|
||||
shape.type = '';
|
||||
preObj = this.workflow.currentSelection;
|
||||
newObj = port.parentNode;
|
||||
this.workflow.saveRoute(newObj,shape);
|
||||
}
|
||||
|
||||
//Routing from task to Intermediate event
|
||||
else if(port.parentNode.type.match(/Inter/) && port.parentNode.type.match(/Event/) && bpmnType.match(/Task/))
|
||||
{
|
||||
else if(port.parentNode.type.match(/Inter/) && port.parentNode.type.match(/Event/) && bpmnType.match(/Task/)){
|
||||
var taskFrom = workflow.getStartEventConn(this,'targetPort','OutputPort');
|
||||
var taskTo = workflow.getStartEventConn(this,'sourcePort','InputPort');
|
||||
|
||||
if(typeof taskFrom[0] != 'undefined' || typeof taskTo[0] != 'undefined')
|
||||
{
|
||||
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(preObj,workflow.currentSelection);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -362,7 +347,6 @@ OutputPort.prototype.onDrop = function (port) {
|
||||
else if (conn < 2) //If One connection exist then Do not Allow to connect
|
||||
connect = false;
|
||||
|
||||
|
||||
if (this.parentNode.id == port.parentNode.id || connect == false) {
|
||||
|
||||
} else {
|
||||
@@ -376,53 +360,41 @@ OutputPort.prototype.onDrop = function (port) {
|
||||
//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/))
|
||||
{
|
||||
if(bpmnType.match(/Event/) && port.parentNode.type.match(/Task/)){
|
||||
|
||||
var tas_uid = port.parentNode.id;
|
||||
this.workflow.saveEvents(this.workflow.currentSelection,tas_uid);
|
||||
}
|
||||
else if(bpmnType.match(/Task/) && port.parentNode.type.match(/End/) && port.parentNode.type.match(/Event/))
|
||||
{
|
||||
|
||||
}else if(bpmnType.match(/Task/) && port.parentNode.type.match(/End/) && port.parentNode.type.match(/Event/)){
|
||||
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/))
|
||||
{
|
||||
}/*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')
|
||||
{
|
||||
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/))
|
||||
{
|
||||
|
||||
}*/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);
|
||||
}
|
||||
//Routing from gateway to task
|
||||
else if(bpmnType.match(/Gateway/) && port.parentNode.type.match(/Task/))
|
||||
{
|
||||
}else if(bpmnType.match(/Gateway/) && port.parentNode.type.match(/Task/)){ //Routing from gateway to task
|
||||
var shape = new Array();
|
||||
shape.type = '';
|
||||
preObj = this.workflow.currentSelection;
|
||||
this.workflow.saveRoute(preObj,shape);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -538,29 +538,23 @@ win.on('move', function() {
|
||||
{
|
||||
workflow.boundaryEvent = false;
|
||||
}
|
||||
|
||||
workflow.task_width='';
|
||||
workflow.annotationName='';
|
||||
NewShape = eval("new "+data.name+"(workflow)");
|
||||
NewShape.x = e.xy[0];
|
||||
NewShape.y = e.xy[1];
|
||||
NewShape.actiontype = 'addTask';
|
||||
|
||||
if(data.name == 'bpmnAnnotation')
|
||||
{
|
||||
if(data.name == 'bpmnAnnotation'){
|
||||
NewShape.actiontype = 'addText';
|
||||
workflow.saveShape(NewShape); //Saving task when user drags and drops it
|
||||
}
|
||||
if(data.name == 'bpmnTask')
|
||||
{
|
||||
}else if(data.name == 'bpmnTask'){
|
||||
NewShape.actiontype = 'addTask';
|
||||
workflow.saveShape(NewShape); //Saving Annotations when user drags and drops it
|
||||
// NewShape.taskName = workflow.taskName;
|
||||
}else if(data.name.match(/Event/)){
|
||||
NewShape.actiontype = 'addEvent';
|
||||
workflow.saveShape(NewShape); //Saving Annotations when user drags and drops it
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var scrollLeft = workflow.getScrollLeft();
|
||||
var scrollTop = workflow.getScrollTop();
|
||||
workflow.addFigure(NewShape,e.xy[0]-xOffset+scrollLeft,e.xy[1]-yOffset+scrollTop);
|
||||
@@ -574,49 +568,38 @@ win.on('move', function() {
|
||||
//var totaltask = shapes[0].length; //shapes[0] is an array for all the tasks
|
||||
//var totalgateways = shapes[1].length; //shapes[1] is an array for all the gateways
|
||||
//var totalevents = shapes[2].length; //shapes[2] is an array for all the events
|
||||
if(typeof shapes.routes != 'undefined' && shapes.routes != ''){
|
||||
var totalroutes = shapes.routes.length; //shapes[3] is an array for all the routes
|
||||
|
||||
for(var i=0;i<=totalroutes-1;i++)
|
||||
{
|
||||
for(var i=0;i<=totalroutes-1;i++){
|
||||
var sourceid = shapes.routes[i][1]; //getting source id for connection from Routes array
|
||||
var targetid = shapes.routes[i][2]; //getting target id for connection from Routes array
|
||||
|
||||
//After creating all the shapes, check one by one shape id
|
||||
for(var conn =0; conn < this.workflow.figures.data.length ; conn++)
|
||||
{
|
||||
if(typeof this.workflow.figures.data[conn] === 'object')
|
||||
{
|
||||
for(var conn =0; conn < this.workflow.figures.data.length ; conn++){
|
||||
if(typeof this.workflow.figures.data[conn] === 'object'){
|
||||
if(sourceid == this.workflow.figures.data[conn].id){
|
||||
sourceObj = this.workflow.figures.data[conn];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(var conn =0; conn < this.workflow.figures.data.length ; conn++)
|
||||
{
|
||||
if(typeof this.workflow.figures.data[conn] === 'object')
|
||||
{
|
||||
for(var conn =0; conn < this.workflow.figures.data.length ; conn++){
|
||||
if(typeof this.workflow.figures.data[conn] === 'object'){
|
||||
//If End Process or Evaluate
|
||||
if(targetid == '-1' || typeof shapes.routes[i][5] != 'undefined' && shapes.routes[i][5] == 'EVALUATE')
|
||||
{
|
||||
if(targetid == '-1' || typeof shapes.routes[i][5] != 'undefined' && shapes.routes[i][5] == 'EVALUATE'){
|
||||
targetObj = eval("new bpmnEventEmptyEnd (this.workflow)");
|
||||
this.workflow.addFigure(targetObj,sourceObj.x+67,sourceObj.y+60);
|
||||
break;
|
||||
}
|
||||
else if(targetid == this.workflow.figures.data[conn].id ){
|
||||
}else if(targetid == this.workflow.figures.data[conn].id ){
|
||||
targetObj = this.workflow.figures.data[conn];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Making Connections
|
||||
var connObj = new DecoratedConnection();
|
||||
connObj.setSource(sourceObj.output1);
|
||||
connObj.setTarget(targetObj.input2);
|
||||
connObj.id = shapes.routes[i][0];
|
||||
this.workflow.addFigure(connObj);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user