Improved Zoom Functionality

This commit is contained in:
girish
2011-02-24 10:13:34 +00:00
parent 661d090291
commit 58fd14666f
6 changed files with 55 additions and 40 deletions

View File

@@ -1241,7 +1241,7 @@ class processMap {
* @return string
*/
function addTask($sProcessUID = '', $iX = 0, $iY = 0) {
function addTask($sProcessUID = '', $iX = 0, $iY = 0,$iWidth = 165, $iHeight = 40) {
try {
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn('TAS_UID');
@@ -1279,7 +1279,7 @@ class processMap {
}
$oTask = new Task ( );
$oNewTask->label = G::LoadTranslation('ID_TASK') . ' ' . $iTaskNumber;
$oNewTask->uid = $oTask->create(array('PRO_UID' => $sProcessUID, 'TAS_TITLE' => $oNewTask->label, 'TAS_POSX' => $iX, 'TAS_POSY' => $iY));
$oNewTask->uid = $oTask->create(array('PRO_UID' => $sProcessUID, 'TAS_TITLE' => $oNewTask->label, 'TAS_POSX' => $iX, 'TAS_POSY' => $iY, 'TAS_WIDTH' => $iWidth, 'TAS_HEIGHT' => $iHeight));
$oNewTask->statusIcons = array();
$oNewTask->statusIcons[] = array('label' => '', 'icon' => '/images/alert.gif', 'message' => '', 'url' => '');
$oJSON = new Services_JSON ( );
@@ -6610,7 +6610,7 @@ function saveExtEvents($oData)
$aDataEvent['EVN_TYPE'] = $oData->evn_type;
if(preg_match("/Start/", $sEvn_type)){
if(isset($oData->tas_uid) && $oData->tas_uid != 'undefined') {
if(isset($oData->tas_uid) && $oData->tas_uid != '') {
$aDataTask['TAS_UID'] = $oData->tas_uid;
$aDataTask['TAS_START'] = $oData->tas_start;
$aDataTask['EVN_TYPE'] = $oData->evn_type;

View File

@@ -50,7 +50,7 @@ if ( isset ($_REQUEST['action']) ) {
echo $sOutput;
break;
case 'addTask':
$sOutput = $oProcessMap->addTask($oData->uid, $oData->position->x, $oData->position->y);
$sOutput = $oProcessMap->addTask($oData->uid, $oData->position->x, $oData->position->y,$oData->cordinate->x,$oData->cordinate->y);
echo $sOutput;
break;
case 'saveTaskPosition':

View File

@@ -1,7 +1,5 @@
bpmnEventEmptyStart=function(){
VectorFigure.call(this);
this.width = 30;
this.height = 30;
};
bpmnEventEmptyStart.prototype=new VectorFigure;
bpmnEventEmptyStart.prototype.type="bpmnEventEmptyStart";

View File

@@ -1069,7 +1069,7 @@ MyWorkflow.prototype.saveShape= function(oNewShape)
switch(actiontype)
{
case 'addTask':
urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","position":'+pos+'}';
urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","position":'+pos+',"cordinate":'+cordinates+'}';
break;
case 'updateTask':
urlparams = '?action='+actiontype+'&data={"uid":"'+ shapeId +'","boundary":"TIMER"}';
@@ -1161,6 +1161,7 @@ MyWorkflow.prototype.saveShape= function(oNewShape)
workflow.saveEvents(oNewShape);
}
else if(oNewShape.type.match(/End/) && oNewShape.type.match(/Event/)) {
if(workflow.currentSelection != null && workflow.currentSelection != '') //will check for standalone event
workflow.saveRoute(workflow.currentSelection,oNewShape);
}
else if(oNewShape.type.match(/Gateway/)) {
@@ -1516,6 +1517,8 @@ MyWorkflow.prototype.saveEvents = function(oEvent,sTaskUID)
var task_uid = new Array();
var next_task_uid = new Array();
var urlparams = '';
if(typeof sTaskUID == 'undefined') //Will be undefined for standalone events
sTaskUID = '';
if(oEvent.type.match(/Start/))
{
var tas_start = 'TRUE';
@@ -1553,6 +1556,11 @@ MyWorkflow.prototype.saveEvents = function(oEvent,sTaskUID)
}
// var staskUid = Ext.util.JSON.encode(task_uid);
// var sNextTaskUid = Ext.util.JSON.encode(next_task_uid);
if(typeof task_uid == 'undefined')
task_uid = '';
if(typeof next_task_uid == 'undefined')
next_task_uid = '';
urlparams = '?action=saveEvents&data={"tas_from":"'+task_uid+'","tas_to":"'+next_task_uid+'","evn_type":"'+oEvent.type+'","evn_uid":"'+oEvent.id+'"}';
}
@@ -1846,7 +1854,9 @@ MyWorkflow.prototype.zoom = function(sType)
for(f = 0;f<figures.getSize();f++){
var fig = figures.get(f);
loadMask.show();
if(typeof fig.limitFlag == 'undefined' || fig.limitFlag == false){
if(typeof fig.limitFlag == 'undefined')
fig.limitFlag = true;
if(fig.limitFlag == false){
fig.originalWidth = fig.getWidth();
fig.originalHeight = fig.getHeight();
fig.orgXPos = fig.getX();
@@ -1861,29 +1871,30 @@ MyWorkflow.prototype.zoom = function(sType)
}
//If zooming is 100% disable resizing of shapes again
if(sType == '1'){
fig.limitFlag = false;
fig.limitFlag = true;
}
var width = fig.originalWidth*sType;
var height = fig.originalHeight*sType;
if(fig.boundaryEvent == true){
if(fig.boundaryEvent == true) {
fig.x3 = fig.orgx3Pos *sType;
fig.y4 = fig.orgy4Pos *sType;
fig.y5 = fig.orgy5Pos *sType;
}
if(sType == '1.5' || sType == '2') {
var xPos = fig.orgXPos * sType * 0.5;
var yPos = fig.orgYPos * sType * 0.5;
}
else {
var xPos = fig.orgXPos * sType;
var yPos = fig.orgYPos * sType;
if(fig.type == 'bpmnTask'){
if (fig.getWidth() > 200 || this.getHeight() > 100) {
fig.limitFlag = false;
}
if (this.getWidth() < 165 || this.getHeight() < 40) {
fig.limitFlag = false;
}
if(fig.type == 'bpmnTask') {
fig.fontSize = parseInt(fig.orgFontSize) * sType;
//fig.bpmnText.drawStringRect(fig.taskName, fig.padleft, fig.padtop, fig.rectWidth, fig.rectheight, 'center');
fig.bpmnText.paint();
}
else if(fig.type == 'bpmnAnnotation'){
else if(fig.type == 'bpmnAnnotation') {
fig.fontSize = parseInt(fig.orgFontSize) * sType;
fig.bpmnText.paint();
}
@@ -1897,6 +1908,7 @@ MyWorkflow.prototype.redrawTaskText = function(fig){
//Setting font minimum limit
if(this.fontSize < 11)
this.fontSize = 11;
this.limitFlag = true;
fig.paint();
}
MyWorkflow.prototype.redrawAnnotationText = function(fig,sType){

View File

@@ -5,11 +5,15 @@ bpmnTask = function (oWorkflow) {
this.boundaryEvent = oWorkflow.boundaryEvent;
}
//Getting width and height from DB
if(typeof oWorkflow.task_width != 'undefined' && typeof oWorkflow.task_height != 'undefined' && oWorkflow.task_width != ''){
if(typeof oWorkflow.task_width != 'undefined' && typeof oWorkflow.task_height != 'undefined' && oWorkflow.task_width != '') {
this.width = oWorkflow.task_width;
this.height = oWorkflow.task_height;
this.originalWidth = oWorkflow.task_width;
this.originalHeight = oWorkflow.task_height
this.originalHeight = oWorkflow.task_height;
}
else{
else {
this.width = 165;
this.height = 40;
this.originalWidth = 165;
this.originalHeight = 40;
}
@@ -51,16 +55,20 @@ bpmnTask.prototype.paint = function () {
}
if(workflow.zoomfactor == 1) {
if ((this.getWidth() > 200 || this.getHeight() > 100) && this.limitFlag != true) {
this.width = this.originalWidth = 200;
this.height = this.originalHeight = 100;
if ((this.getWidth() > 200 || this.getHeight() > 100) && this.limitFlag == false) {
this.originalWidth = 200;
this.originalHeight = 100;
this.width = 200;
this.height = 100;
}
if ((this.getWidth() < 165 || this.getHeight() < 40) && this.limitFlag != true) {
this.width = this.originalWidth = 165;
this.height = this.originalHeight = 40;
if ((this.getWidth() < 165 || this.getHeight() < 40) && this.limitFlag == false) {
this.originalWidth = 165;
this.originalHeight = 40;
this.width = 165;
this.height = 40;
}
}
else{
else {
this.width = this.originalWidth * workflow.zoomfactor;
this.height = this.originalHeight * workflow.zoomfactor;
}

View File

@@ -876,8 +876,7 @@ Ext.onReady ( function() {
{
var xOffset = workflow.getAbsoluteX();
var yOffset = workflow.getAbsoluteY();
if(data.name == 'bpmnTask')
{
if(data.name == 'bpmnTask') {
workflow.boundaryEvent = false;
}
workflow.task_width='';
@@ -885,17 +884,15 @@ Ext.onReady ( function() {
NewShape = eval("new "+data.name+"(workflow)");
NewShape.x = e.xy[0];
NewShape.y = e.xy[1];
NewShape.limitFlag == false;
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
}
else if(data.name == 'bpmnTask'){
else if(data.name == 'bpmnTask') {
NewShape.actiontype = 'addTask';
workflow.saveShape(NewShape); //Saving Annotations when user drags and drops it
}
else if(data.name.match(/Event/)){
else if(data.name.match(/Event/)) {
NewShape.actiontype = 'addEvent';
NewShape.mode = 'ddEvent';
workflow.saveShape(NewShape); //Saving Annotations when user drags and drops it