//>>built
define("dojox/gantt/GanttTaskControl","dijit/focus dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/date/locale dojo/request dojo/on dojo/dom dojo/dom-class dojo/dom-construct dojo/dom-style dojo/dom-attr dojo/dom-geometry dojo/keys dojo/domReady!".split(" "),function(w,x,t,m,z,A,p,B,q,l,g,v,y,u){return x("dojox.gantt.GanttTaskControl",[],{constructor:function(a,b,c){this.ganttChart=c;this.project=b;this.taskItem=a;this.moveChild=this.checkResize=this.checkMove=!1;this.minWidthResize=this.maxWidthResize=
this.minPosXMove=this.maxPosXMove=-1;this.taskItemWidth=this.mouseX=this.posY=this.posX=0;this.isHide=!1;this.hideTasksHeight=0;this.isExpanded=!0;this.predTask=this.parentTask=this.cTaskNameItem=this.cTaskItem=this.descrTask=null;this.childTask=[];this.childPredTask=[];this.previousParentTask=this.nextParentTask=this.previousChildTask=this.nextChildTask=null},createConnectingLinesPN:function(){var a=[],b=l.create("div",{innerHTML:"\x26nbsp;",className:"ganttTaskLineVerticalLeft"},this.ganttChart.panelNames.firstChild),
c=this.cTaskNameItem[0],d=this.parentTask.cTaskNameItem[0];g.set(b,{height:c.offsetTop-d.offsetTop+"px",top:d.offsetTop+5+"px",left:d.offsetLeft-9+"px"});var e=l.create("div",{noShade:!0,color:"#000000",className:"ganttTaskLineHorizontalLeft"},this.ganttChart.panelNames.firstChild);g.set(e,{left:d.offsetLeft-9+"px",top:c.offsetTop+5+"px",height:"1px",width:c.offsetLeft-d.offsetLeft+4+"px"});a.push(b);a.push(e);return a},createConnectingLinesDS:function(){var a=this.ganttChart.contentData.firstChild,
b=[],c=l.create("div",{className:"ganttImageArrow"}),d=document.createElement("div"),e=document.createElement("div"),f=g.get(this.predTask.cTaskItem[0],"left"),h=g.get(this.predTask.cTaskItem[0],"top"),k=g.get(this.cTaskItem[0],"left"),n=this.posY+2,r=parseInt(this.predTask.cTaskItem[0].firstChild.firstChild.width);h<n?(q.add(d,"ganttTaskLineVerticalRight"),g.set(d,{height:n-this.ganttChart.heightTaskItem/2-h-3+"px",width:"1px",left:f+r-20+"px",top:h+this.ganttChart.heightTaskItem+"px"}),q.add(e,
"ganttTaskLineHorizontal"),g.set(e,{width:15+(k-(r+f))+"px",left:f+r-20+"px",top:n+2+"px"}),q.add(c,"ganttTaskArrowImg")):(q.add(d,"ganttTaskLineVerticalRightPlus"),g.set(d,{height:h+2-n+"px",width:"1px",left:f+r-20+"px",top:n+2+"px"}),q.add(e,"ganttTaskLineHorizontalPlus"),g.set(e,{width:15+(k-(r+f))+"px",left:f+r-20+"px",top:n+2+"px"}),q.add(c,"ganttTaskArrowImgPlus"));g.set(c,{left:k-7+"px",top:n-1+"px"});a.appendChild(d);a.appendChild(e);a.appendChild(c);b.push(d);b.push(c);b.push(e);return b},
showChildTasks:function(a,b){if(b)for(var c=0;c<a.childTask.length;c++){var d=a.childTask[c],e=d.cTaskItem[0],f=d.cTaskNameItem[0],h=d.cTaskItem[1],k=d.cTaskNameItem[1],n=d.cTaskNameItem[2];if("none"==e.style.display){e.style.display="inline";f.style.display="inline";d.showDescTask();a.isHide=!1;n&&(n.style.display="inline",b=d.isExpanded);for(e=0;e<h.length;e++)h[e].style.display="inline";for(e=0;e<k.length;e++)k[e].style.display="inline";d.taskIdentifier&&(d.taskIdentifier.style.display="inline");
this.hideTasksHeight+=this.ganttChart.heightTaskItem+this.ganttChart.heightTaskItemExtra;0<d.childTask.length&&this.showChildTasks(d,b)}}},hideChildTasks:function(a){for(var b=0;b<a.childTask.length;b++){var c=a.childTask[b],d=c.cTaskItem[0],e=c.cTaskNameItem[0],f=c.cTaskItem[1],h=c.cTaskNameItem[1],k=c.cTaskNameItem[2];if("none"!=d.style.display){d.style.display="none";e.style.display="none";c.hideDescTask();a.isHide=!0;k&&(k.style.display="none");for(d=0;d<f.length;d++)f[d].style.display="none";
for(d=0;d<h.length;d++)h[d].style.display="none";c.taskIdentifier&&(c.taskIdentifier.style.display="none");this.hideTasksHeight+=this.ganttChart.heightTaskItem+this.ganttChart.heightTaskItemExtra;0<c.childTask.length&&this.hideChildTasks(c)}}},shiftCurrentTasks:function(a,b){this.shiftNextTask(this,b);a.project.shiftNextProject(a.project,b)},shiftTask:function(a,b){a.posY+=b;var c=a.cTaskItem[0],d=a.cTaskNameItem[0],e=a.cTaskItem[1],f=a.cTaskNameItem[1],h=a.cTaskNameItem[2];d.style.top=parseInt(d.style.top)+
b+"px";h&&(h.style.top=parseInt(h.style.top)+b+"px");a.parentTask&&(parseInt(this.cTaskNameItem[0].style.top)>parseInt(a.parentTask.cTaskNameItem[0].style.top)&&"none"!=f[0].style.display?f[0].style.height=parseInt(f[0].style.height)+b+"px":f[0].style.top=parseInt(f[0].style.top)+b+"px",f[1].style.top=parseInt(f[1].style.top)+b+"px");c.style.top=parseInt(c.style.top)+b+"px";a.descrTask.style.top=parseInt(a.descrTask.style.top)+b+"px";a.predTask&&((parseInt(this.cTaskItem[0].style.top)>parseInt(a.predTask.cTaskItem[0].style.top)||
this.cTaskItem[0].id==a.predTask.taskItem.id)&&"none"!=e[0].style.display?e[0].style.height=parseInt(e[0].style.height)+b+"px":e[0].style.top=parseInt(e[0].style.top)+b+"px",e[1].style.top=parseInt(e[1].style.top)+b+"px",e[2].style.top=parseInt(e[2].style.top)+b+"px")},shiftNextTask:function(a,b){a.nextChildTask?(this.shiftTask(a.nextChildTask,b),this.shiftChildTask(a.nextChildTask,b),this.shiftNextTask(a.nextChildTask,b)):a.parentTask?this.shiftNextTask(a.parentTask,b):a.nextParentTask&&(this.shiftTask(a.nextParentTask,
b),this.shiftChildTask(a.nextParentTask,b),this.shiftNextTask(a.nextParentTask,b))},shiftChildTask:function(a,b){t.forEach(a.childTask,function(c){this.shiftTask(c,b);0<c.childTask.length&&this.shiftChildTask(c,b)},this)},endMove:function(){var a=this.cTaskItem[0],b=g.get(a,"left")-this.posX;b=this.getDateOnPosition(g.get(a,"left"));b=this.checkPos(b);this.checkMove&&(b=this.ganttChart.getPosOnDate(b)-this.posX,this.moveCurrentTaskItem(b,this.moveChild),this.project.shiftProjectItem());this.checkMove=
!1;this.posX=0;this.minPosXMove=this.maxPosXMove=-1;a.childNodes[1].firstChild.rows[0].cells[0].innerHTML="";this.adjustPanelTime();this.ganttChart.resource&&this.ganttChart.resource.refresh()},checkPos:function(a){var b=this.cTaskItem[0],c=a.getHours();12<=c?(a.setDate(a.getDate()+1),a.setHours(0),parseInt(b.firstChild.firstChild.width)+this.ganttChart.getPosOnDate(a)>this.maxPosXMove&&-1!=this.maxPosXMove&&(a.setDate(a.getDate()-1),a.setHours(0))):12>c&&0!=c&&(a.setHours(0),this.ganttChart.getPosOnDate(a)<
this.minPosXMove&&a.setDate(a.getDate()+1));b.style.left=this.ganttChart.getPosOnDate(a)+"px";return a},getMaxPosPredChildTaskItem:function(){for(var a=0,b=0,c=0;c<this.childPredTask.length;c++)b=this.getMaxPosPredChildTaskItemInTree(this.childPredTask[c]),b>a&&(a=b);return a},getMaxPosPredChildTaskItemInTree:function(a){var b=a.cTaskItem[0];b=parseInt(b.firstChild.firstChild.width)+g.get(b,"left");var c=0,d=0;t.forEach(a.childPredTask,function(e){d=this.getMaxPosPredChildTaskItemInTree(e);d>c&&(c=
d)},this);return c>b?c:b},moveCurrentTaskItem:function(a,b){var c=this.cTaskItem[0];this.taskItem.startTime=new Date(this.ganttChart.startDate);this.taskItem.startTime.setHours(this.taskItem.startTime.getHours()+parseInt(c.style.left)/this.ganttChart.pixelsPerHour);this.showDescTask();c=this.cTaskItem[1];0<c.length&&(c[2].style.width=parseInt(c[2].style.width)+a+"px",c[1].style.left=parseInt(c[1].style.left)+a+"px");t.forEach(this.childTask,function(d){d.predTask||this.moveChildTaskItems(d,a,b)},
this);t.forEach(this.childPredTask,function(d){this.moveChildTaskItems(d,a,b)},this)},moveChildTaskItems:function(a,b,c){var d=a.cTaskItem[0];if(c){d.style.left=parseInt(d.style.left)+b+"px";a.adjustPanelTime();a.taskItem.startTime=new Date(this.ganttChart.startDate);a.taskItem.startTime.setHours(a.taskItem.startTime.getHours()+parseInt(d.style.left)/this.ganttChart.pixelsPerHour);var e=a.cTaskItem[1];t.forEach(e,function(f){f.style.left=parseInt(f.style.left)+b+"px"},this);t.forEach(a.childTask,
function(f){f.predTask||this.moveChildTaskItems(f,b,c)},this);t.forEach(a.childPredTask,function(f){this.moveChildTaskItems(f,b,c)},this)}else e=a.cTaskItem[1],0<e.length&&(d=e[0],e=e[2],e.style.left=parseInt(e.style.left)+b+"px",e.style.width=parseInt(e.style.width)-b+"px",d.style.left=parseInt(d.style.left)+b+"px");a.moveDescTask()},adjustPanelTime:function(){var a=this.cTaskItem[0];a=parseInt(a.style.left)+parseInt(a.firstChild.firstChild.width)+this.ganttChart.panelTimeExpandDelta;a+=this.descrTask.offsetWidth;
this.ganttChart.adjustPanelTime(a)},getDateOnPosition:function(a){var b=new Date(this.ganttChart.startDate);b.setHours(b.getHours()+a/this.ganttChart.pixelsPerHour);return b},moveItem:function(a){a=this.posX+(a.screenX-this.mouseX);var b=parseInt(this.cTaskItem[0].childNodes[0].firstChild.width);this.checkMove&&this.minPosXMove<=a&&(a+b<=this.maxPosXMove||-1==this.maxPosXMove)&&this.moveTaskItem(a)},moveTaskItem:function(a){var b=this.cTaskItem[0];b.style.left=a+"px";b.childNodes[1].firstChild.rows[0].cells[0].innerHTML=
this.getDateOnPosition(a).getDate()+"."+(this.getDateOnPosition(a).getMonth()+1)+"."+this.getDateOnPosition(a).getUTCFullYear()},resizeItem:function(a){this.checkResize&&(a=this.taskItemWidth+(a.screenX-this.mouseX),a>=this.taskItemWidth?a<=this.maxWidthResize||-1==this.maxWidthResize?this.resizeTaskItem(a):-1!=this.maxWidthResize&&a>this.maxWidthResize&&this.resizeTaskItem(this.maxWidthResize):a<=this.taskItemWidth&&(a>=this.minWidthResize?this.resizeTaskItem(a):a<this.minWidthResize&&this.resizeTaskItem(this.minWidthResize)))},
resizeTaskItem:function(a){var b=this.cTaskItem[0],c=Math.round(a/this.ganttChart.pixelsPerWorkHour),d=b.childNodes[0].firstChild.rows[0],e=d.cells[0];d=d.cells[1];e&&(e.firstChild.style.width=parseInt(e.width)*a/100+"px");d&&(d.firstChild.style.width=parseInt(d.width)*a/100+"px");b.childNodes[0].firstChild.width=a+"px";b.childNodes[1].firstChild.width=a+"px";this.cTaskItem[0].childNodes[1].firstChild.rows[0].cells[0].innerHTML=c;b=b.childNodes[2];b.childNodes[0].style.width=a+"px";b.childNodes[1].style.left=
a-10+"px"},endResizeItem:function(){var a=this.cTaskItem[0];if(this.taskItemWidth!=parseInt(a.childNodes[0].firstChild.width)){var b=a.offsetLeft,c=a.offsetLeft+parseInt(a.childNodes[0].firstChild.width);this.taskItem.duration=Math.round((c-b)/this.ganttChart.pixelsPerWorkHour);if(0<this.childPredTask.length)for(b=0;b<this.childPredTask.length;b++){var d=this.childPredTask[b].cTaskItem[1];c=d[0];d=d[2];var e=a.childNodes[0];d.style.width=parseInt(d.style.width)-(parseInt(e.firstChild.width)-this.taskItemWidth)+
"px";d.style.left=parseInt(d.style.left)+(parseInt(e.firstChild.width)-this.taskItemWidth)+"px";c.style.left=parseInt(c.style.left)+(parseInt(e.firstChild.width)-this.taskItemWidth)+"px"}}this.cTaskItem[0].childNodes[1].firstChild.rows[0].cells[0].innerHTML="";this.checkResize=!1;this.mouseX=this.taskItemWidth=0;this.showDescTask();this.project.shiftProjectItem();this.adjustPanelTime();this.ganttChart.resource&&this.ganttChart.resource.refresh()},startMove:function(a){this.moveChild=a.ctrlKey;this.mouseX=
a.screenX;this.getMoveInfo();this.checkMove=!0;this.hideDescTask()},showDescTask:function(){var a=parseInt(this.cTaskItem[0].style.left)+this.taskItem.duration*this.ganttChart.pixelsPerWorkHour+10;this.descrTask.style.left=a+"px";this.descrTask.innerHTML=this.objKeyToStr(this.getTaskOwner());this.descrTask.style.visibility="visible"},hideDescTask:function(){g.set(this.descrTask,"visibility","hidden")},buildResourceInfo:function(a){if(this.childTask&&0<this.childTask.length)for(var b=0;b<this.childTask.length;b++)this.childTask[b].buildResourceInfo(a);
if(0<m.trim(this.taskItem.taskOwner).length){var c=this.taskItem.taskOwner.split(";");for(b=0;b<c.length;b++){var d=c[b];0>=m.trim(d).length||(a[d]?a[d].push(this):a[d]=[this])}}},objKeyToStr:function(a,b){var c="";b=b||" ";if(a)for(var d in a)c+=b+d;return c},getTaskOwner:function(){var a={};if(0<m.trim(this.taskItem.taskOwner).length)for(var b=this.taskItem.taskOwner.split(";"),c=0;c<b.length;c++)a[b[c]]=1;t.forEach(this.childTask,function(d){m.mixin(a,d.getTaskOwner())},this);return a},moveDescTask:function(){var a=
parseInt(this.cTaskItem[0].style.left)+this.taskItem.duration*this.ganttChart.pixelsPerWorkHour+10;this.descrTask.style.left=a+"px"},getMoveInfo:function(){this.posX=parseInt(this.cTaskItem[0].style.left);var a=parseInt(this.cTaskItem[0].childNodes[0].firstChild.width),b=this.parentTask?parseInt(this.parentTask.cTaskItem[0].style.left):0,c=this.predTask?parseInt(this.predTask.cTaskItem[0].style.left)+parseInt(this.predTask.cTaskItem[0].childNodes[0].firstChild.width):0,d=this.parentTask?parseInt(this.parentTask.cTaskItem[0].childNodes[0].firstChild.width):
0,e=0,f=0,h=0;if(0<this.childPredTask.length){var k=null;t.forEach(this.childPredTask,function(r){if(!k||k&&k>parseInt(r.cTaskItem[0].style.left))k=parseInt(r.cTaskItem[0].style.left)},this);e=k}if(0<this.childTask.length){var n=null;t.forEach(this.childTask,function(r){if(!n||n&&n>parseInt(r.cTaskItem[0].style.left))n=parseInt(r.cTaskItem[0].style.left)},this);h=n;k=null;t.forEach(this.childTask,function(r){if(!k||k&&k<parseInt(r.cTaskItem[0].style.left)+parseInt(r.cTaskItem[0].firstChild.firstChild.width))k=
parseInt(r.cTaskItem[0].style.left)+parseInt(r.cTaskItem[0].firstChild.firstChild.width)},this);f=k}this.moveChild?(0<b&&0==c?(this.minPosXMove=b,this.maxPosXMove=b+d):0==b&&0==c?(this.minPosXMove=this.ganttChart.initialPos,this.maxPosXMove=-1):0<b&&0<c?(this.minPosXMove=c,this.maxPosXMove=b+d):0==b&&0<c&&(this.minPosXMove=c,this.maxPosXMove=-1),this.parentTask&&0<this.childPredTask.length&&(k=this.getMaxPosPredChildTaskItem(this),b=parseInt(this.parentTask.cTaskItem[0].style.left)+parseInt(this.parentTask.cTaskItem[0].firstChild.firstChild.width),
this.maxPosXMove=this.posX+a+b-k)):(0<this.childPredTask.length&&this.maxPosXMove<e&&(this.maxPosXMove=e),0<this.childTask.length&&(0<this.childPredTask.length&&this.maxPosXMove-a>h&&(this.maxPosXMove-=this.maxPosXMove-a-h),0<this.childPredTask.length||(this.maxPosXMove=h+a),this.minPosXMove=f-a),0<b&&((!(0<this.childPredTask.length)&&0<this.childTask.length&&this.maxPosXMove>b+d&&(this.maxPosXMove=b+d),this.minPosXMove<=b&&(this.minPosXMove=b),0<this.childTask.length||0<this.childPredTask.length)?
!(0<this.childTask.length)&&0<this.childPredTask.length&&b+d>c&&(this.maxPosXMove=e):this.maxPosXMove=b+d),0<c&&this.minPosXMove<=c&&(this.minPosXMove=c),0==c&&0==b&&this.minPosXMove<=this.ganttChart.initialPos&&(this.minPosXMove=this.ganttChart.initialPos))},startResize:function(a){this.mouseX=a.screenX;this.getResizeInfo();this.hideDescTask();this.checkResize=!0;this.taskItemWidth=parseInt(this.cTaskItem[0].firstChild.firstChild.width)},getResizeInfo:function(){var a=this.cTaskItem[0],b=this.parentTask?
parseInt(this.parentTask.cTaskItem[0].style.left):0,c=this.parentTask?parseInt(this.parentTask.cTaskItem[0].childNodes[0].firstChild.width):0;a=parseInt(a.style.left);var d=0,e=0;if(0<this.childPredTask.length){var f=null;t.forEach(this.childPredTask,function(h){if(!f||f&&f>parseInt(h.cTaskItem[0].style.left))f=parseInt(h.cTaskItem[0].style.left)},this);d=f}0<this.childTask.length&&(f=null,t.forEach(this.childTask,function(h){if(!f||f&&f<parseInt(h.cTaskItem[0].style.left)+parseInt(h.cTaskItem[0].firstChild.firstChild.width))f=
parseInt(h.cTaskItem[0].style.left)+parseInt(h.cTaskItem[0].firstChild.firstChild.width)},this),e=f);this.minWidthResize=this.ganttChart.pixelsPerDay;0<this.childTask.length&&(this.minWidthResize=e-a);0<this.childPredTask.length&&!this.parentTask?this.maxWidthResize=d-a:0<this.childPredTask.length&&this.parentTask?this.maxWidthResize=Math.min(b+c-a,d-a):0==this.childPredTask.length&&this.parentTask&&(this.maxWidthResize=b+c-a)},createTaskItem:function(){this.posX=this.ganttChart.getPosOnDate(this.taskItem.startTime);
var a=l.create("div",{id:this.taskItem.id,className:"ganttTaskItemControl"});g.set(a,{left:this.posX+"px",top:this.posY+"px"});var b=l.create("div",{className:"ganttTaskDivTaskItem"},a);b=l.create("table",{cellPadding:"0",cellSpacing:"0",width:this.taskItem.duration*this.ganttChart.pixelsPerWorkHour+"px",className:"ganttTaskTblTaskItem"},b);b=b.insertRow(b.rows.length);if(0!=this.taskItem.percentage){var c=l.create("td",{height:this.ganttChart.heightTaskItem+"px",width:this.taskItem.percentage+"%"},
b);c.style.lineHeight="1px";c=l.create("div",{className:"ganttImageTaskProgressFilled"},c);g.set(c,{width:this.taskItem.percentage*this.taskItem.duration*this.ganttChart.pixelsPerWorkHour/100+"px",height:this.ganttChart.heightTaskItem+"px"})}100!=this.taskItem.percentage&&(c=l.create("td",{height:this.ganttChart.heightTaskItem+"px",width:100-this.taskItem.percentage+"%"},b),c.style.lineHeight="1px",b=l.create("div",{className:"ganttImageTaskProgressBg"},c),g.set(b,{width:(100-this.taskItem.percentage)*
this.taskItem.duration*this.ganttChart.pixelsPerWorkHour/100+"px",height:this.ganttChart.heightTaskItem+"px"}));this.ganttChart.isContentEditable&&(b=l.create("div",{className:"ganttTaskDivTaskInfo"},a),b=l.create("table",{cellPadding:"0",cellSpacing:"0",height:this.ganttChart.heightTaskItem+"px",width:this.taskItem.duration*this.ganttChart.pixelsPerWorkHour+"px"},b).insertRow(0),l.create("td",{align:"center",vAlign:"top",height:this.ganttChart.heightTaskItem+"px",className:"ganttMoveInfo"},b),c=
l.create("div",{className:"ganttTaskDivTaskName"},a),b=l.create("div",{},c),l.create("input",{className:"ganttTaskDivMoveInput",type:"text"},b),g.set(b,{background:"#000000",opacity:0}),g.set(b,{height:this.ganttChart.heightTaskItem+"px",width:this.taskItem.duration*this.ganttChart.pixelsPerWorkHour+"px"}),c=l.create("div",{className:"ganttTaskDivResize"},c),l.create("input",{className:"ganttTaskDivResizeInput",type:"text"},c),g.set(c,{left:this.taskItem.duration*this.ganttChart.pixelsPerWorkHour-
10+"px",height:this.ganttChart.heightTaskItem+"px",width:"10px"}),this.ganttChart._events.push(p(b,"mousedown",m.hitch(this,function(d){this.moveMoveConn=p(document,"mousemove",m.hitch(this,function(e){this.checkMove&&this.moveItem(e)}));this.moveUpConn=p(document,"mouseup",m.hitch(this,function(){this.checkMove&&(this.endMove(),this.ganttChart.isMoving=!1,document.body.releaseCapture&&document.body.releaseCapture(),this.moveMoveConn.remove(),this.moveUpConn.remove())}));this.startMove(d);this.ganttChart.isMoving=
!0;document.body.setCapture&&document.body.setCapture(!1)}))),this.ganttChart._events.push(p(b,"mouseover",m.hitch(this,function(d){d.target&&(d.target.style.cursor="move")}))),this.ganttChart._events.push(p(b,"mouseout",m.hitch(this,function(d){d.target.style.cursor=""}))),this.ganttChart._events.push(p(c,"mousedown",m.hitch(this,function(d){this.resizeMoveConn=p(document,"mousemove",m.hitch(this,function(e){this.checkResize&&this.resizeItem(e)}));this.resizeUpConn=p(document,"mouseup",m.hitch(this,
function(){this.checkResize&&(this.endResizeItem(),this.ganttChart.isResizing=!1,document.body.releaseCapture&&document.body.releaseCapture(),this.resizeMoveConn.remove(),this.resizeUpConn.remove())}));this.startResize(d);this.ganttChart.isResizing=!0;document.body.setCapture&&document.body.setCapture(!1)}))),this.ganttChart._events.push(p(c,"mouseover",m.hitch(this,function(d){!this.ganttChart.isMoving&&!this.ganttChart.isResizing&&d.target&&(d.target.style.cursor="e-resize")}))),this.ganttChart._events.push(p(c,
"mouseout",m.hitch(this,function(d){!this.checkResize&&d.target&&(d.target.style.cursor="")}))));return a},createTaskNameItem:function(){var a=l.create("div",{id:this.taskItem.id,className:"ganttTaskTaskNameItem",title:this.taskItem.name+", id: "+this.taskItem.id+" ",innerHTML:this.taskItem.name});g.set(a,"top",this.posY+"px");v.set(a,"tabIndex",0);this.ganttChart.isShowConMenu&&(this.ganttChart._events.push(p(a,"mouseover",m.hitch(this,function(b){q.add(a,"ganttTaskTaskNameItemHover");clearTimeout(this.ganttChart.menuTimer);
this.ganttChart.tabMenu.clear();this.ganttChart.tabMenu.show(b.target,this)}))),this.ganttChart._events.push(p(a,"keydown",m.hitch(this,function(b){b.keyCode==u.ENTER&&(this.ganttChart.tabMenu.clear(),this.ganttChart.tabMenu.show(b.target,this));!this.ganttChart.tabMenu.isShow||b.keyCode!=u.LEFT_ARROW&&b.keyCode!=u.RIGHT_ARROW||w(this.ganttChart.tabMenu.menuPanel.firstChild.rows[0].cells[0]);this.ganttChart.tabMenu.isShow&&b.keyCode==u.ESCAPE&&this.ganttChart.tabMenu.hide()}))),this.ganttChart._events.push(p(a,
"mouseout",m.hitch(this,function(){q.remove(a,"ganttTaskTaskNameItemHover");clearTimeout(this.ganttChart.menuTimer);this.ganttChart.menuTimer=setTimeout(m.hitch(this,function(){this.ganttChart.tabMenu.hide()}),200)}))),this.ganttChart._events.push(p(this.ganttChart.tabMenu.menuPanel,"mouseover",m.hitch(this,function(){clearTimeout(this.ganttChart.menuTimer)}))),this.ganttChart._events.push(p(this.ganttChart.tabMenu.menuPanel,"keydown",m.hitch(this,function(b){this.ganttChart.tabMenu.isShow&&b.keyCode==
u.ESCAPE&&this.ganttChart.tabMenu.hide()}))),this.ganttChart._events.push(p(this.ganttChart.tabMenu.menuPanel,"mouseout",m.hitch(this,function(){clearTimeout(this.ganttChart.menuTimer);this.ganttChart.menuTimer=setTimeout(m.hitch(this,function(){this.ganttChart.tabMenu.hide()}),200)}))));return a},createTaskDescItem:function(){var a=this.posX+this.taskItem.duration*this.ganttChart.pixelsPerWorkHour+10,b=l.create("div",{innerHTML:this.objKeyToStr(this.getTaskOwner()),className:"ganttTaskDescTask"});
g.set(b,{left:a+"px",top:this.posY+"px"});return this.descrTask=b},checkWidthTaskNameItem:function(){if(this.cTaskNameItem[0].offsetWidth+this.cTaskNameItem[0].offsetLeft>this.ganttChart.maxWidthTaskNames){var a=this.taskItem.name.substring(0,this.cTaskNameItem[0].firstChild.length-Math.round((this.cTaskNameItem[0].offsetWidth+this.cTaskNameItem[0].offsetLeft-this.ganttChart.maxWidthTaskNames)/(this.cTaskNameItem[0].offsetWidth/this.cTaskNameItem[0].firstChild.length))-3);this.cTaskNameItem[0].innerHTML=
a+"..."}},refreshTaskItem:function(a){this.posX=this.ganttChart.getPosOnDate(this.taskItem.startTime);g.set(a,{left:this.posX+"px"});var b=a.childNodes[0].firstChild;b.width=(this.taskItem.duration?this.taskItem.duration*this.ganttChart.pixelsPerWorkHour:1)+"px";b=b.rows[0];if(0!=this.taskItem.percentage){var c=b.firstChild;c.height=this.ganttChart.heightTaskItem+"px";c.width=this.taskItem.percentage+"%";c.style.lineHeight="1px";g.set(c.firstChild,{width:(this.taskItem.duration?this.taskItem.percentage*
this.taskItem.duration*this.ganttChart.pixelsPerWorkHour/100:1)+"px",height:this.ganttChart.heightTaskItem+"px"})}100!=this.taskItem.percentage&&(c=b.lastChild,c.height=this.ganttChart.heightTaskItem+"px",c.width=100-this.taskItem.percentage+"%",c.style.lineHeight="1px",g.set(c.firstChild,{width:(this.taskItem.duration?(100-this.taskItem.percentage)*this.taskItem.duration*this.ganttChart.pixelsPerWorkHour/100:1)+"px",height:this.ganttChart.heightTaskItem+"px"}));this.ganttChart.isContentEditable&&
(b=a.childNodes[1].firstChild,b.height=this.ganttChart.heightTaskItem+"px",b.width=(this.taskItem.duration?this.taskItem.duration*this.ganttChart.pixelsPerWorkHour:1)+"px",b.rows[0].firstChild.height=this.ganttChart.heightTaskItem+"px",b=a.childNodes[2],c=b.firstChild,c.style.height=this.ganttChart.heightTaskItem+"px",c.style.width=(this.taskItem.duration?this.taskItem.duration*this.ganttChart.pixelsPerWorkHour:1)+"px",b=b.lastChild,g.set(b,{left:this.taskItem.duration*this.ganttChart.pixelsPerWorkHour-
10+"px"}),b.style.height=this.ganttChart.heightTaskItem+"px",b.style.width="10px");return a},refreshTaskDesc:function(a){g.set(a,{left:this.posX+this.taskItem.duration*this.ganttChart.pixelsPerWorkHour+10+"px"});return a},refreshConnectingLinesDS:function(a){var b=a[1],c=a[0],d=a[2],e=g.get(this.predTask.cTaskItem[0],"left"),f=g.get(this.predTask.cTaskItem[0],"top"),h=g.get(this.cTaskItem[0],"left"),k=this.posY+2,n=parseInt(this.predTask.cTaskItem[0].firstChild.firstChild.width);f<k?g.set(c,{height:k-
this.ganttChart.heightTaskItem/2-f-3+"px",left:e+n-20+"px"}):g.set(c,{height:f+2-k+"px",left:e+n-20+"px"});g.set(d,{width:15+(h-(n+e))+"px",left:e+n-20+"px"});g.set(b,{left:h-7+"px"});return a},postLoadData:function(){},refresh:function(){this.childTask&&0<this.childTask.length&&t.forEach(this.childTask,function(a){a.refresh()},this);this.refreshTaskItem(this.cTaskItem[0]);this.refreshTaskDesc(this.cTaskItem[0].nextSibling);this.taskItem.previousTask&&this.predTask&&this.refreshConnectingLinesDS(this.cTaskItem[1]);
return this},create:function(){var a=this.ganttChart.contentData.firstChild,b=this.taskItem.previousTask,c=this.taskItem.parentTask,d=0<this.taskItem.cldTasks.length;this.cTaskItem=[];this.cTaskNameItem=[];if(!c)if(this.taskItem.previousParentTask){this.previousParentTask=this.project.getTaskById(this.taskItem.previousParentTask.id);var e=this.ganttChart.getLastChildTask(this.previousParentTask);this.posY=parseInt(e.cTaskItem[0].style.top)+this.ganttChart.heightTaskItem+this.ganttChart.heightTaskItemExtra;
this.previousParentTask.nextParentTask=this}else this.posY=parseInt(this.project.projectItem[0].style.top)+this.ganttChart.heightTaskItem+this.ganttChart.heightTaskItemExtra;if(c){var f=this.project.getTaskById(this.taskItem.parentTask.id);this.parentTask=f;this.taskItem.previousChildTask?(this.previousChildTask=this.project.getTaskById(this.taskItem.previousChildTask.id),e=this.ganttChart.getLastChildTask(this.previousChildTask),this.posY=g.get(e.cTaskItem[0],"top")+this.ganttChart.heightTaskItem+
this.ganttChart.heightTaskItemExtra,this.previousChildTask.nextChildTask=this):this.posY=g.get(f.cTaskItem[0],"top")+this.ganttChart.heightTaskItem+this.ganttChart.heightTaskItemExtra;f.childTask.push(this)}b&&(this.predTask=f=this.project.getTaskById(b.id),f.childPredTask.push(this));this.cTaskItem.push(this.createTaskItem());a.appendChild(this.cTaskItem[0]);this.ganttChart.panelNames&&(this.cTaskNameItem.push(this.createTaskNameItem()),this.ganttChart.panelNames.firstChild.appendChild(this.cTaskNameItem[0]));
a.appendChild(this.createTaskDescItem());a=[];b&&(a=this.createConnectingLinesDS());this.cTaskItem.push(a);this.ganttChart.panelNames&&(b=[],c&&(this.cTaskNameItem[0].style.left=g.get(this.parentTask.cTaskNameItem[0],"left")+15+"px",b=this.createConnectingLinesPN()),this.checkWidthTaskNameItem(),this.checkPosition(),c=null,d&&(c=this.createTreeImg()),this.cTaskNameItem.push(b),this.cTaskNameItem.push(c));this.adjustPanelTime();return this},checkPosition:function(){if(this.ganttChart.withTaskId){var a=
y.getMarginBox(this.cTaskNameItem[0],!0);this.taskIdentifier?(this.childTask&&0<this.childTask.length&&t.forEach(this.childTask,function(b){b.checkPosition()},this),g.set(this.taskIdentifier,{left:a.l+a.w+4+"px",top:a.t-1+"px"})):(this.taskIdentifier=l.create("div",{id:"TaskId_"+this.taskItem.id,className:"ganttTaskIdentifier",title:this.taskItem.id,innerHTML:this.taskItem.id},this.cTaskNameItem[0].parentNode),g.set(this.taskIdentifier,{left:a.l+a.w+4+"px",top:a.t-1+"px"}))}},createTreeImg:function(){var a=
l.create("div",{id:this.taskItem.id,className:"ganttImageTreeCollapse"});v.set(a,"tabIndex",0);t.forEach(["click","keydown"],function(b){this.ganttChart._events.push(p(a,b,m.hitch(this,function(c){if("keydown"!=b||c.keyCode==u.ENTER)this.isExpanded?(q.remove(a,"ganttImageTreeCollapse"),q.add(a,"ganttImageTreeExpand"),this.isExpanded=!1,this.hideChildTasks(this),this.shiftCurrentTasks(this,-this.hideTasksHeight)):(q.remove(a,"ganttImageTreeExpand"),q.add(a,"ganttImageTreeCollapse"),this.isExpanded=
!0,this.shiftCurrentTasks(this,this.hideTasksHeight),this.showChildTasks(this,!0),this.hideTasksHeight=0),this.ganttChart.checkPosition()})))},this);this.ganttChart.panelNames.firstChild.appendChild(a);q.add(a,"ganttTaskTreeImage");g.set(a,{left:g.get(this.cTaskNameItem[0],"left")-12+"px",top:g.get(this.cTaskNameItem[0],"top")+3+"px"});return a},setPreviousTask:function(a){if(""==a)this.clearPredTask();else{var b=this.taskItem;if(b.id==a)return!1;var c=this.project.getTaskById(a);if(!c)return!1;var d=
c.taskItem,e=null==d.parentTask,f=null==b.parentTask;if(e&&!f||!e&&f||!e&&!f&&d.parentTask.id!=b.parentTask.id)return!1;e=b.startTime.getTime();if(d.startTime.getTime()+864E5*d.duration/c.ganttChart.hsPerDay>e)return!1;this.clearPredTask();this.ganttChart.checkPosPreviousTask(d,b)||this.ganttChart.correctPosPreviousTask(d,b,this);b.previousTaskId=a;b.previousTask=d;this.predTask=c;c.childPredTask.push(this);this.cTaskItem[1]=this.createConnectingLinesDS()}return!0},clearPredTask:function(){if(this.predTask){for(var a=
this.predTask.childPredTask,b=0;b<a.length;b++)if(a[b]==this){a.splice(b,1);break}for(b=0;b<this.cTaskItem[1].length;b++)this.cTaskItem[1][b].parentNode.removeChild(this.cTaskItem[1][b]);this.cTaskItem[1]=[];this.taskItem.previousTaskId=null;this.predTask=this.taskItem.previousTask=null}},setStartTime:function(a,b){this.moveChild=b;this.getMoveInfo();var c=this.ganttChart.getPosOnDate(a);if(parseInt(this.cTaskItem[0].firstChild.firstChild.width)+c>this.maxPosXMove&&-1!=this.maxPosXMove||c<this.minPosXMove)return this.minPosXMove=
this.maxPosXMove=-1,!1;this.cTaskItem[0].style.left=c;this.moveCurrentTaskItem(c-this.posX,b);this.project.shiftProjectItem();this.descrTask.innerHTML=this.objKeyToStr(this.getTaskOwner());this.adjustPanelTime();this.posX=0;this.minPosXMove=this.maxPosXMove=-1;return!0},setDuration:function(a){this.getResizeInfo();a=this.ganttChart.getWidthOnDuration(a);if(a>this.maxWidthResize&&-1!=this.maxWidthResize||a<this.minWidthResize)return!1;this.taskItemWidth=parseInt(this.cTaskItem[0].firstChild.firstChild.width);
this.resizeTaskItem(a);this.endResizeItem();this.descrTask.innerHTML=this.objKeyToStr(this.getTaskOwner());return!0},setTaskOwner:function(a){this.taskItem.taskOwner=null==a||void 0==a?"":a;this.descrTask.innerHTML=this.objKeyToStr(this.getTaskOwner());return!0},setPercentCompleted:function(a){a=parseInt(a);if(isNaN(a)||100<a||0>a)return!1;var b=this.cTaskItem[0].childNodes[0].firstChild.rows[0],c=b.cells[0],d=b.cells[1];if(0!=a&&100!=a)if(0!=this.taskItem.percentage&&100!=this.taskItem.percentage)c.width=
a+"%",d.width=100-a+"%";else{if(0==this.taskItem.percentage||100==this.taskItem.percentage)c.parentNode.removeChild(c),c=l.create("td",{height:this.ganttChart.heightTaskItem+"px",width:a+"%"},b),c.style.lineHeight="1px",c=l.create("div",{className:"ganttImageTaskProgressFilled"},c),g.set(c,{width:a*this.taskItem.duration*this.ganttChart.pixelsPerWorkHour/100+"px",height:this.ganttChart.heightTaskItem+"px"}),c=l.create("td",{height:this.ganttChart.heightTaskItem+"px",width:100-a+"%"},b),c.style.lineHeight=
"1px",c=l.create("div",{className:"ganttImageTaskProgressBg"},c),g.set(c,{width:(100-a)*this.taskItem.duration*this.ganttChart.pixelsPerWorkHour/100+"px",height:this.ganttChart.heightTaskItem+"px"})}else 0==a?0!=this.taskItem.percentage&&100!=this.taskItem.percentage?(c.parentNode.removeChild(c),d.width="100%"):(q.remove(c.firstChild,"ganttImageTaskProgressFilled"),q.add(c.firstChild,"ganttImageTaskProgressBg")):100==a&&(0!=this.taskItem.percentage&&100!=this.taskItem.percentage?(d.parentNode.removeChild(d),
c.width="100%"):(q.remove(c.firstChild,"ganttImageTaskProgressBg"),q.add(c.firstChild,"ganttImageTaskProgressFilled")));this.taskItem.percentage=a;this.taskItemWidth=parseInt(this.cTaskItem[0].firstChild.firstChild.width);this.resizeTaskItem(this.taskItemWidth);this.endResizeItem();this.descrTask.innerHTML=this.objKeyToStr(this.getTaskOwner());return!0},setName:function(a){a&&(this.taskItem.name=a,this.cTaskNameItem[0].innerHTML=a,this.cTaskNameItem[0].title=a,this.checkWidthTaskNameItem(),this.checkPosition(),
this.descrTask.innerHTML=this.objKeyToStr(this.getTaskOwner()),this.adjustPanelTime())}})});