| 1 |
- MWF.xDesktop.requireApp("process.ProcessDesigner","Property",null,false);MWF.xApplication.process.ProcessDesigner.Route=new Class({initialize:function(t,i){this.data=t;this.process=i;this.paper=this.process.paper;this.loaded=false;this.l1=8;this.l2=12;this.aj=25;this.corners=[];this.toSelf=false;this.isLineEvent=false;this.isTextEvent=false;this.isSetEvent=false;this.isArrowEvent=false;this.isPointEvent=false;this.checked=false;this.isBack=false;this.isBrokenLine=false;this.tmpbeginPoint=null;this.tmpEndPoint=null;this.toActivity=this.getNextActivity();this.positionPoints=this.getRoutePoint();if(!this.process.options.isView){this.listItem=new MWF.APPPD.Route.List(this);this.listItem.load()}},getRoutePoint:function(){var t=[];if(this.data.track){var i=this.data.track.split(/\s+/g);i.each(function(i){var s=i.split(/(?:,\s*){1}|(?:;\s*){1}/g);t.push({x:s[0],y:s[1]})}.bind(this))}return t},reload:function(t,i){if(this.toActivity&&this.fromActivity){if(this.toActivity.data.id==this.fromActivity.data.id){this.toSelf=true}else{this.toSelf=false}}this.getPoint(t,i);this.redraw()},load:function(t){if(this.process.isNewProcess){this.data.createTime=(new Date).format("db");this.data.updateTime=(new Date).format("db")}if(t)this.fromActivity=t;if(this.toActivity&&this.fromActivity){if(this.toActivity.data.id==this.fromActivity.data.id){this.toSelf=true}else{this.toSelf=false}}this.getPoint();this.draw();this.loaded=true},setActivity:function(t,i){if(t){if(this.toActivity){this.toActivity.fromRoutes.erase(this)}this.toActivity=t;this.data.activity=this.toActivity.data.id;this.data.activityType=this.toActivity.data.type;if(this.toActivity.fromRoutes.indexOf(this)==-1)this.toActivity.fromRoutes.push(this)}if(i){if(this.fromActivity){this.fromActivity.routes.erase(this);this.fromActivity.removeRouteData(this.data.id)}this.fromActivity=i;if(this.data.id)this.fromActivity.addRouteData(this.data.id);if(this.fromActivity.routes.indexOf(this)==-1)this.fromActivity.routes.push(this)}},getNextActivity:function(){var t=this.data.activity;var i=this.data.activityType;if(i){if(i.toLowerCase()=="begin"){if(this.process.begin.data.id==t){this.process.begin.fromRoutes.push(this);return this.process.begin}}else{var s=this.process[i+"s"][t];if(s){if(s.fromRoutes.indexOf(this)==-1)s.fromRoutes.push(this);return s}}}return null},redraw:function(){if(this.beginPoint&&this.endPoint){if(this.set){}else{this.set=this.paper.set()}if(this.point){this.point.show();this.point.attr("path",MWFRaphael.getCirclePath(this.beginPoint.x,this.beginPoint.y,3))}else{this.point=this.paper.circlePath(this.beginPoint.x,this.beginPoint.y,3);this.point.attr(this.process.css.route.decision.normal);this.set.push(this.point)}if(this.line){this.line.show();this.line.attr("path",this.getLinePath())}else{this.line=this.paper.path(this.getLinePath());this.line.toBack();this.line.attr(this.process.css.route.line.normal);this.set.push(this.line)}this.line.toBack();if(this.text){this.text.show();var t=this.getTextPoint();this.text.attr({text:this.data.name||MWF.APPPD.LP.unnamed,x:t.x,y:t.y})}else{this.text=this.createText();this.set.push(this.text)}if(this.arrow){this.arrow.show();var i=this.positionPoints.length?this.positionPoints[this.positionPoints.length-1]:this.beginPoint;this.arrow.attr("path",MWFRaphael.getArrowPath(i,this.endPoint,this.l1,this.l2,this.aj))}else{this.arrow=this.createArrow();this.arrow.attr(this.process.css.route.arrow.normal);this.set.push(this.arrow)}if(this.set){this.set.attr({transform:""});if(this.checked){if(this.process.currentSelected==this){this.point.attr(this.process.css.route.decision.selected);this.line.attr(this.process.css.route.line.selected);this.arrow.attr(this.process.css.route.arrow.selected);this.text.attr(this.process.css.route.linetext.selected)}else{this.point.attr(this.process.css.route.decision.normal);this.line.attr(this.process.css.route.line.normal);this.arrow.attr(this.process.css.route.arrow.normal);this.text.attr(this.process.css.route.linetext.normal)}}else{this.point.attr(this.process.css.route.decision["no-checked"]);this.line.attr(this.process.css.route.line["no-checked"]);this.arrow.attr(this.process.css.route.arrow["no-checked"]);this.text.attr(this.process.css.route.linetext["no-checked"])}if(this.isBack){this.set.toBack()}else{this.set.toFront()}}}else{if(this.point)this.point.hide();if(this.line)this.line.hide();if(this.arrow)this.arrow.hide();if(this.set)this.set.hide()}this.setListItemData();this.setEvent()},draw:function(){if(this.beginPoint&&this.endPoint){this.point=this.paper.circlePath(this.beginPoint.x,this.beginPoint.y,3);this.point.attr(this.process.css.route.decision.normal);this.line=this.paper.path(this.getLinePath());this.line.toBack();this.line.attr(this.process.css.route.line.normal);this.text=this.createText();this.arrow=this.createArrow();this.arrow.attr(this.process.css.route.arrow.normal);this.set=this.paper.set();this.set.push(this.point,this.line,this.arrow,this.text);this.point.data("bind",this);this.line.data("bind",this);this.arrow.data("bind",this);this.text.data("bind",this);if(!this.toSelf){this.positionPoints.each(function(t,i){this.createCorner(t,i)}.bind(this))}if(this.checked){if(this.process.currentSelected==this){this.point.attr(this.process.css.route.decision.selected);this.line.attr(this.process.css.route.line.selected);this.arrow.attr(this.process.css.route.arrow.selected);this.text.attr(this.process.css.route.linetext.selected)}else{this.point.attr(this.process.css.route.decision.normal);this.line.attr(this.process.css.route.line.normal);this.arrow.attr(this.process.css.route.arrow.normal);this.text.attr(this.process.css.route.linetext.normal)}}else{this.point.attr(this.process.css.route.decision["no-checked"]);this.line.attr(this.process.css.route.line["no-checked"]);this.arrow.attr(this.process.css.route.arrow["no-checked"]);this.text.attr(this.process.css.route.linetext["no-checked"])}if(this.isBack){this.set.toBack()}else{this.set.toFront()}}else{if(this.point)this.point.hide();if(this.line)this.line.hide();if(this.arrow)this.arrow.hide();if(this.text)this.text.hide();if(this.set)this.set.hide()}this.setEvent()},setEvent:function(){if(this.set){if(!this.isSetEvent){this.set.mousedown(function(t){this.selected();t.stopPropagation()}.bind(this));this.set.click(function(t){t.stopPropagation()}.bind(this));this.isSetEvent=true}}if(this.line){if(!this.isLineEvent){this.line.mousedown(function(t){if(!this.toSelf){var i=MWF.getOffset(t);this.checkBrokenLineBegin(i.offsetX,i.offsetY)}}.bind(this));this.isLineEvent=true}}if(this.arrow){if(!this.isArrowEvent){this.arrow.drag(function(t,i,s,e,o){this.arrowMove(t,i,s,e.e)}.bind(this),function(){this.arrowMoveStart()}.bind(this),function(){this.arrowMoveEnd()}.bind(this));this.arrow.hover(function(){var t=this.beginPoint;if(this.positionPoints.length){t=this.positionPoints[this.positionPoints.length-1]}t.x=t.x.toFloat();t.y=t.y.toFloat();var i=MWFRaphael.getArrowPath(t,this.endPoint,20,30,this.aj);this.arrow.attr("path",i)}.bind(this),function(){var t=this.beginPoint;if(this.positionPoints.length){t=this.positionPoints[this.positionPoints.length-1]}t.x=t.x.toFloat();t.y=t.y.toFloat();var i=MWFRaphael.getArrowPath(t,this.endPoint,this.l1,this.l2,this.aj);this.arrow.attr("path",i)}.bind(this))}this.isArrowEvent=true}if(this.point){if(!this.isPointEvent){this.point.drag(function(t,i,s,e,o){this.pointMove(t,i,s,e.e)}.bind(this),function(){this.pointMoveStart()}.bind(this),function(){this.pointMoveEnd()}.bind(this));this.point.hover(function(){var t=MWFRaphael.getCirclePath(this.beginPoint.x,this.beginPoint.y,8);this.point.attr("path",t)}.bind(this),function(){var t=MWFRaphael.getCirclePath(this.beginPoint.x,this.beginPoint.y,3);this.point.attr("path",t)}.bind(this))}this.isPointEvent=true}if(this.text){if(!this.isTextEvent){this.text.drag(function(t,i,s,e){this.textMove(t,i,s,e)}.bind(this),function(){this.textMoveStart()}.bind(this),function(){this.textMoveEnd()}.bind(this));this.isTextEvent=true}}},arrowMoveStart:function(){this.arrow.data("originalPoint",{x:this.endPoint.x,y:this.endPoint.y});this.process.isChangeRouteTo=true;this.process.currentChangeRoute=this},arrowMove:function(t,i,s,e){this.isBack=true;var o=this.arrow.data("originalPoint");this.endPoint={x:o.x+t-6,y:o.y+i-6};this.redraw()},arrowMoveEnd:function(){this.isBack=false;if(this.process.isChangeRouteTo){this.endPoint=this.arrow.data("originalPoint");this.redraw();this.process.isChangeRouteTo=false;this.process.currentChangeRoute=null}if(this.line)this.line.toFront()},pointMoveStart:function(){this.point.data("originalPoint",{x:this.beginPoint.x,y:this.beginPoint.y});this.process.isChangeRouteFrom=true;this.process.currentChangeRoute=this},pointMove:function(t,i,s,e){if(t>10||i>10)this.isBack=true;var o=this.point.data("originalPoint");this.beginPoint={x:o.x+t-4,y:o.y+i-4};this.redraw()},pointMoveEnd:function(){this.isBack=false;if(this.process.isChangeRouteFrom){this.beginPoint=this.point.data("originalPoint");this.redraw();this.process.isChangeRouteFrom=false;this.process.currentChangeRoute=null}if(this.line)this.line.toFront()},cornerBrokenLineBegin:function(t,i){if(!this.process.isCreateRoute){var s=MWF.getOffset(t);var e=s.offsetX;var o=s.offsetY;var n=this.corners.indexOf(i);if(n!=-1){this.process.brokenLineBeginMousemoveBind=function(t){this.doBeginBrokenLine(t,e,o,n-1,i,true)}.bind(this);this.process.brokenLineMouseupBind=function(){this.endBrokenLine()}.bind(this);this.paper.canvas.addEvent("mousemove",this.process.brokenLineBeginMousemoveBind);this.paper.canvas.addEvent("mouseup",this.process.brokenLineMouseupBind)}}},checkBrokenLineBegin:function(t,i){if(!this.process.isCreateRoute){var s=this.getNearIndex(this.positionPoints,{x:t,y:i});if(s===null){var e=this.getCornerPointIndex(t,i);this.process.brokenLineBeginMousemoveBind=function(s){this.doBeginBrokenLine(s,t,i,e)}.bind(this);this.process.brokenLineMouseupBind=function(){this.endBrokenLine()}.bind(this);this.paper.canvas.addEvent("mousemove",this.process.brokenLineBeginMousemoveBind);this.paper.canvas.addEvent("mouseup",this.process.brokenLineMouseupBind)}else{}}},getCornerPointIndex:function(t,i){cornerPointIndex=-1;var s=5e5;if(this.positionPoints.length){var e=this.positionPoints.concat(this.endPoint);e.unshift(this.beginPoint);for(var o=0;o<e.length-1;o++){var n=e[o];var r=e[o+1];var h=MWFRaphael.getMinDistance({x:t,y:i},n,r).h;if(h<s){s=h;cornerPointIndex=o-1}}}return cornerPointIndex},getNearIndex:function(t,i){for(var s=0;s<t.length;s++){var e=t[s];var o={x:e.x.toFloat(),y:e.y.toFloat()};var n=MWFRaphael.getPointDistance(i,o);if(n<=8){return s}}return null},endBrokenLine:function(){this.process.isBrokenLine=false;if(this.removeCorner){this.corners.splice(this.removeCorner.idx+1,1);this.removeCorner.corner.remove();this.positionPoints.splice(this.removeCorner.idx+1,1);this.removeCorner=null}this.isBrokenLine=false;this.data.track=this.positionPointsToString();this.paper.canvas.removeEvent("mouseup",this.process.brokenLineMouseupBind);this.paper.canvas.removeEvent("mousemove",this.process.brokenLineBeginMousemoveBind);this.paper.canvas.removeEvent("mousemove",this.process.brokenLineMousemoveBind)},positionPointsToString:function(){var t=[];this.positionPoints.each(function(i){t.push(i.x+","+i.y)});return t.join(" ")},doBeginBrokenLine:function(t,i,s,e,o,n){var r=this.positionPoints[e]||this.beginPoint;var h=this.positionPoints[e+2]||this.endPoint;var a=MWF.getOffset(t.event);var c=MWFRaphael.getMinDistance({x:a.offsetX,y:a.offsetY},r,h).h;if(c>6){this.process.isBrokenLine=true;this.isBrokenLine=true;if(!o||this.removeCorner){if(!n)this.positionPoints.splice(e+1,0,{x:a.offsetX,y:a.offsetY});if(this.removeCorner){o=this.removeCorner.corner;this.removeCorner=null}else{o=this.createCorner(this.positionPoints[e+1],e+1)}}o.attr(this.process.css.route.corner["default"]);this.paper.canvas.removeEvent("mousemove",this.process.brokenLineBeginMousemoveBind);this.reload();this.process.brokenLineMousemoveBind=function(t){this.doBrokenLine(t,e,o)}.bind(this);this.paper.canvas.addEvent("mousemove",this.process.brokenLineMousemoveBind)}},doBrokenLine:function(t,i,s){var e=MWF.getOffset(t.event);var o=e.offsetX;var n=e.offsetY;o=Raphael.snapTo(10,o,10);n=Raphael.snapTo(10,n,10);var r=this.positionPoints[i]||this.beginPoint;var h=this.positionPoints[i+2]||this.endPoint;var a=MWFRaphael.getMinDistance({x:o,y:n},r,h);var c=a.h;if(c<6){this.removeCorner={corner:s,idx:i};s.attr("path",MWFRaphael.getRectPath(a.p.x.toFloat()-2.5,a.p.y.toFloat()-2.5,5,5,0));if(this.positionPoints[i+1])this.positionPoints[i+1].x=a.p.x;if(this.positionPoints[i+1])this.positionPoints[i+1].y=a.p.y;this.reload();this.process.brokenLineBeginMousemoveBind=function(t){this.doBeginBrokenLine(t,o,n,i,null,true)}.bind(this);this.paper.canvas.removeEvent("mousemove",this.process.brokenLineMousemoveBind);this.paper.canvas.addEvent("mousemove",this.process.brokenLineBeginMousemoveBind)}else{if(Math.abs(r.x-o)<5)o=r.x;if(Math.abs(r.y-n)<5)n=r.y;if(Math.abs(h.x-o)<5)o=h.x;if(Math.abs(h.y-n)<5)n=h.y;var p=MWFRaphael.getRectPath(o-2.5,n-2.5,5,5,0);s.attr("path",p);if(this.positionPoints[i+1])this.positionPoints[i+1].x=o;if(this.positionPoints[i+1])this.positionPoints[i+1].y=n;this.reload()}},selected:function(){this.process.unSelectedAll();if(this.line)this.line.attr(this.process.css.route.line.selected);if(this.point)this.point.attr(this.process.css.route.decision.selected);if(this.arrow)this.arrow.attr(this.process.css.route.arrow.selected);if(this.text)this.text.attr(this.process.css.route.linetext.selected);this.corners.each(function(t){t.show()});this.process.currentSelected=this;if(this.listItem)this.listItem.selected();this.set.toFront();this.showProperty()},unSelected:function(){if(this.checked){this.point.attr(this.process.css.route.decision.normal);this.line.attr(this.process.css.route.line.normal);this.arrow.attr(this.process.css.route.arrow.normal);this.text.attr(this.process.css.route.linetext.normal)}else{this.point.attr(this.process.css.route.decision["no-checked"]);this.line.attr(this.process.css.route.line["no-checked"]);this.arrow.attr(this.process.css.route.arrow["no-checked"]);this.text.attr(this.process.css.route.linetext["no-checked"])}this.corners.each(function(t){t.hide()});this.process.currentSelected=null;if(this.listItem)this.listItem.unSelected();if(this.property)this.property.hide()},textMove:function(t,i,s,e){var s=this.text.moveX.toFloat()+parseFloat(t);var e=this.text.moveY.toFloat()+parseFloat(i);var o=this.getDefaultTextPoint();var n=MWFRaphael.getPointDistance(o,{x:s,y:e});if(n<5){this.text.attr({x:o.x,y:o.y})}else{this.text.attr({x:s,y:e})}},textMoveStart:function(){this.text.moveX=this.text.attr("x");this.text.moveY=this.text.attr("y")},textMoveEnd:function(){var t=this.text.attr("x");var i=this.text.attr("y");var s=this.getDefaultTextPoint();var e=MWFRaphael.getPointDistance(s,{x:t,y:i});if(e<5){this.data.position=""}else{t=t.toInt();i=i.toInt();this.data.position=t+","+i}},getLinePath:function(){var t="";if(this.beginPoint&&this.endPoint){t="M"+this.beginPoint.x+","+this.beginPoint.y;this.positionPoints.each(function(i,s){var e;var o;if(s==0){e=this.beginPoint}else{e=this.positionPoints[s-1]}if(this.positionPoints[s+1]){o=this.positionPoints[s+1]}else{o=this.endPoint}i.x=i.x.toFloat();i.y=i.y.toFloat();var n=MWFRaphael.getMinus(Math.abs(i.x-e.x),Math.abs(i.y-e.y),12);var r=MWFRaphael.getMinus(Math.abs(i.x-o.x),Math.abs(i.y-o.y),12);var h=null;var a=null;if(i.x>=e.x&&i.y>=e.y){h={x:i.x-n.x,y:i.y-n.y}}else if(i.x<=e.x&&i.y<=e.y){h={x:i.x+n.x,y:i.y+n.y}}else if(i.x>=e.x&&i.y<=e.y){h={x:i.x-n.x,y:i.y+n.y}}else if(i.x<=e.x&&i.y>=e.y){h={x:i.x+n.x,y:i.y-n.y}}if(i.x>=o.x&&i.y>=o.y){a={x:i.x-r.x,y:i.y-r.y}}else if(i.x<=o.x&&i.y<=o.y){a={x:i.x+r.x,y:i.y+r.y}}else if(i.x>=o.x&&i.y<=o.y){a={x:i.x-r.x,y:i.y+r.y}}else if(i.x<=o.x&&i.y>=o.y){a={x:i.x+r.x,y:i.y-r.y}}t+="L"+h.x+","+h.y;t+="Q"+i.x+", "+i.y+", "+a.x+","+a.y}.bind(this));t+="L"+this.endPoint.x+","+this.endPoint.y}return t},getDefaultTextPoint:function(){var t="";var i="";if(this.toSelf){t=this.positionPoints[2].x+(this.positionPoints[1].x-this.positionPoints[2].x)/2;i=this.positionPoints[2].y-8}else{var s=this.beginPoint;var e=this.endPoint;if(this.positionPoints[0])e=this.positionPoints[0];var o=(e.x.toFloat()-s.x.toFloat())*.4;var n=(e.y.toFloat()-s.y.toFloat())*.4;t=s.x.toFloat()+o;i=s.y.toFloat()+n}return{x:t,y:i}},getTextPoint:function(){var t="";var i="";if(this.data.position){var s=this.data.position.split(/(?:,\s*){1}|(?:;\s*){1}/g);t=s[0];i=s[1]}else{var e=this.getDefaultTextPoint();t=e.x;i=e.y}return{x:t,y:i}},createText:function(){var t=null;if(this.beginPoint&&this.endPoint){var i=this.getTextPoint();t=this.paper.text(i.x,i.y,this.data.name||MWF.APPPD.LP.unnamed);t.attr(this.process.css.route.linetext.normal);return t}},createArrow:function(){var t=this.beginPoint;if(this.positionPoints.length){t=this.positionPoints[this.positionPoints.length-1]}t.x=t.x.toFloat();t.y=t.y.toFloat();return this.paper.arrow(t,this.endPoint,this.l1,this.l2,this.aj)},createCorner:function(t,i){var s=this.paper.rectPath(t.x.toFloat()-2.5,t.y.toFloat()-2.5,5,5,0);s.data("position",t);s.attr(this.process.css.route.corner["default"]);s.hide();this.corners.splice(i,0,s);s.mousedown(function(t){this.cornerBrokenLineBegin(t,s)}.bind(this));this.set.push(s);return s},getPoint:function(t,i){var s=t;if(this.fromActivity){if(!s)s=this.fromActivity.shap.attr("path")}var e=i;if(this.toActivity){if(!e)e=this.toActivity.shap.attr("path")}if(s&&e){this.checked=true;if(this.toSelf){var o=this.fromActivity.center.x+this.fromActivity.width;var n=this.fromActivity.center.y;var r=this.fromActivity.center.x+this.fromActivity.width;var h=this.fromActivity.center.y-this.fromActivity.height;var a=this.fromActivity.center.x;var c=this.fromActivity.center.y-this.fromActivity.height;this.positionPoints=[];this.positionPoints.push({x:o,y:n});this.positionPoints.push({x:r,y:h});this.positionPoints.push({x:a,y:c});this.beginPoint={x:this.fromActivity.center.x+this.fromActivity.width/2,y:this.fromActivity.center.y};this.endPoint={x:this.fromActivity.center.x,y:this.fromActivity.center.y-this.fromActivity.height/2}}else{var p;var l;if(this.positionPoints[0]){p="M"+this.fromActivity.center.x+","+this.fromActivity.center.y+"L"+this.positionPoints[0].x+","+this.positionPoints[0].y;var d=this.positionPoints[this.positionPoints.length-1];l="M"+d.x+","+d.y+"L"+this.toActivity.center.x+","+this.toActivity.center.y}else{p="M"+this.fromActivity.center.x+","+this.fromActivity.center.y+"L"+this.toActivity.center.x+","+this.toActivity.center.y;l="M"+this.fromActivity.center.x+","+this.fromActivity.center.y+"L"+this.toActivity.center.x+","+this.toActivity.center.y}var f=Raphael.pathIntersection(p,s);var u=Raphael.pathIntersection(l,e);this.beginPoint=f[0];this.endPoint=u[0]}}if(!s&&e){this.checked=false;var v;var y;if(this.tmpBeginPoint){v=this.tmpBeginPoint.y.toFloat();y=this.tmpBeginPoint.x.toFloat()}else{v=this.toActivity.center.y.toFloat()-500;y=this.toActivity.center.x.toFloat()}var l="M"+y+","+v+"L"+this.toActivity.center.x+","+this.toActivity.center.y;var u=Raphael.pathIntersection(l,e);this.endPoint=u[0];this.beginPoint=this.tmpBeginPoint||{x:this.endPoint.x,y:this.endPoint.y-30};this.tmpBeginPoint=null}if(s&&!e){this.checked=false;var P;var x;if(this.tmpEndPoint){P=this.tmpEndPoint.y.toFloat();x=this.tmpEndPoint.x.toFloat()}else{P=this.fromActivity.center.y.toFloat()+500;x=this.fromActivity.center.x.toFloat()}var p="M"+this.fromActivity.center.x+","+this.fromActivity.center.y+"L"+x+","+P;var f=Raphael.pathIntersection(p,s);this.beginPoint=f[0];this.endPoint=this.tmpEndPoint||{x:this.beginPoint.x,y:this.beginPoint.y+30};this.tmpEndPoint=null}if(!s&&!e){this.checked=false;this.beginPoint={x:10,y:10};this.endPoint={x:10,y:30}}},setListItemData:function(){if(this.listItem){var t=this.data.name||MWF.APPPD.LP.unnamed;var i="";if(this.toActivity){i=this.toActivity.data.name;if(!i)i=MWF.APPPD.LP.unnamed}else{i=MWF.APPPD.LP.unknow}this.listItem.row.tds[1].set("text",t+" (to "+i+")")}},destroy:function(){if(this.fromActivity){this.fromActivity.removeRouteData(this.data.id);this.fromActivity.routes.erase(this)}if(this.listItem){this.listItem.row.tr.destroy()}var t={};var i={};for(rid in this.process.routes){if(rid!=this.data.id){t[rid]=this.process.routes[rid];i[rid]=this.process.routeDatas[rid]}else{this.process.routes[rid]=null;this.process.routeDatas[rid]=null}}this.process.routes=null;this.process.routeDatas=null;this.process.routes=t;this.process.routeDatas=i;this.process.process.routeList.erase(this.data);this.set.remove()},showProperty:function(){if(!this.property){this.property=new MWF.APPPD.Route.Property(this,{onPostLoad:function(){this.property.show()}.bind(this)});this.property.load()}else{this.property.show()}},_setEditProperty:function(t,i,s){if(t==="passExpired"||t==="passSameTarget"){if(this.data[t]){if(this.fromActivity){this.fromActivity.routes.each(function(i){if(i.data.id!==this.data.id){if(i.data[t]){i.data[t]=false;if(i.property){var s=i.property.propertyContent.getElementById(i.data.id+t);if(s)s.getElements("input")[1].set("checked",true)}}}}.bind(this))}}}}});MWF.xApplication.process.ProcessDesigner.Route.List=new Class({initialize:function(t){this.route=t;this.process=t.process;this.paper=this.route.paper},load:function(){var t=this.route.data.name||MWF.APPPD.LP.unnamed;var i="";if(this.route.toActivity){i=this.route.toActivity.data.name;if(!i)i=MWF.APPPD.LP.unnamed}else{i=MWF.APPPD.LP.unknow}this.row=this.process.routeTable.push([{content:" ",properties:{styles:this.process.css.route.icon}},{content:t+" (to "+i+")",properties:{styles:this.process.css.list.listText}},{content:'<img src="'+"/x_component_process_ProcessDesigner/$Process/default/icon/copy.png"+'" />',properties:{styles:this.process.css.list.listIcon,events:{click:this.copyRoute.bind(this)}}},{content:'<img src="'+"/x_component_process_ProcessDesigner/$Process/default/icon/delete.png"+'" />',properties:{styles:this.process.css.list.listIcon,events:{click:this.deleteRoute.bind(this)}}}]);this.row.tr.addEvent("click",function(){this.listSelected()}.bind(this))},copyRoute:function(){this.process.copyRoute(this.route)},deleteRoute:function(t){this.process.deleteRoute(t,this.route)},selected:function(){if(this.process.currentListSelected)this.process.currentListSelected.listUnSelected();this.row.tr.setStyles(this.process.css.list.listRowSelected);this.process.currentListSelected=this},unSelected:function(){this.process.currentListSelected=null;this.row.tr.setStyles(this.process.css.list.listRow)},listSelected:function(){this.route.selected()},listUnSelected:function(){this.route.unSelected()}});MWF.xApplication.process.ProcessDesigner.Route.Property=new Class({Implements:[Options,Events],Extends:MWF.APPPD.Property,initialize:function(t,i){this.setOptions(i);this.route=t;this.process=t.process;this.paper=this.process.paper;this.data=t.data;this.htmlPath="/x_component_process_ProcessDesigner/$Process/route.html"},setValue:function(t,i){this.data[t]=i;if(t=="name"){if(!i)this.data[t]=MWF.APPPD.LP.unnamed;this.route.reload()}},show:function(){if(!this.process.options.isView){if(!this.propertyContent){this.propertyContent=new Element("div",{styles:{overflow:"hidden"}}).inject(this.process.propertyListNode);this.process.panel.propertyTabPage.showTabIm();this.JsonTemplate=new MWF.widget.JsonTemplate(this.data,this.htmlString);this.propertyContent.set("html",this.JsonTemplate.load());this.process.panel.data=this.data;this.loadRouteCondition();this.setEditNodeEvent();this.setEditNodeStyles(this.propertyContent);this.loadPropertyTab();this.loadPersonInput();this.loadScriptInput();this.loadScriptText();this.loadConditionInput();this.loadFormSelect()}else{this.propertyContent.setStyle("display","block")}}},loadRouteCondition:function(){var t=this.propertyContent.getElement(".MWFRouteCondition");var i=this.route.fromActivity.type;if(i=="choice"||i=="condition"||i=="parallel"){if(!t){t=new Element("div.MWFTab",{title:MWF.APPPD.LP.condition,html:'<div class="MWFScriptText" name="scriptText"></div>'}).inject(this.propertyContent.getFirst())}}else{if(t)t.destroy()}}});
|