//>>built define("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(u,v,n,h,x,y,k,z,l,g,f,t,w,p){return v("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=g.create("div",{innerHTML:"\x26nbsp;",className:"ganttTaskLineVerticalLeft"},this.ganttChart.panelNames.firstChild), c=this.cTaskNameItem[0],d=this.parentTask.cTaskNameItem[0];f.set(b,{height:c.offsetTop-d.offsetTop+"px",top:d.offsetTop+5+"px",left:d.offsetLeft-9+"px"});var e=g.create("div",{noShade:!0,color:"#000000",className:"ganttTaskLineHorizontalLeft"},this.ganttChart.panelNames.firstChild);f.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=g.create("div",{className:"ganttImageArrow"}),d=document.createElement("div"),e=document.createElement("div"),m=f.get(this.predTask.cTaskItem[0],"left"),q=f.get(this.predTask.cTaskItem[0],"top"),r=f.get(this.cTaskItem[0],"left"),h=this.posY+2,k=parseInt(this.predTask.cTaskItem[0].firstChild.firstChild.width);qparseInt(a.parentTask.cTaskNameItem[0].style.top)&&"none"!=m[0].style.display?m[0].style.height=parseInt(m[0].style.height)+b+"px":m[0].style.top=parseInt(m[0].style.top)+b+"px",m[1].style.top=parseInt(m[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){n.forEach(a.childTask,function(a){this.shiftTask(a,b);0this.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;ca&&(a=b);return a},getMaxPosPredChildTaskItemInTree:function(a){var b=a.cTaskItem[0],b=parseInt(b.firstChild.firstChild.width)+f.get(b,"left"),c=0,d=0;n.forEach(a.childPredTask,function(a){d=this.getMaxPosPredChildTaskItemInTree(a);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=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=h.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(0parseInt(a.cTaskItem[0].style.left))g=parseInt(a.cTaskItem[0].style.left)},this);e=g}if(0parseInt(a.cTaskItem[0].style.left))k=parseInt(a.cTaskItem[0].style.left)},this);h=k;g=null;n.forEach(this.childTask,function(a){if(!g||g&&gh&&(this.maxPosXMove-=this.maxPosXMove-a-h),0b+d&&(this.maxPosXMove=b+d),this.minPosXMove<=b&&(this.minPosXMove=b),0c&&(this.maxPosXMove=e):this.maxPosXMove=b+d),0parseInt(a.cTaskItem[0].style.left))f=parseInt(a.cTaskItem[0].style.left)},this);d=f}0this.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);f.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";f.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",f.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,f.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){f.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=f.get(this.predTask.cTaskItem[0],"left"),g=f.get(this.predTask.cTaskItem[0],"top"),h=f.get(this.cTaskItem[0],"left"),k=this.posY+2,l=parseInt(this.predTask.cTaskItem[0].firstChild.firstChild.width);ge)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;bthis.maxPosXMove&&-1!=this.maxPosXMove||athis.maxWidthResize&&-1!=this.maxWidthResize||aa)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=g.create("td",{height:this.ganttChart.heightTaskItem+"px",width:a+"%"},b),c.style.lineHeight="1px",c=g.create("div",{className:"ganttImageTaskProgressFilled"},c),f.set(c,{width:a*this.taskItem.duration*this.ganttChart.pixelsPerWorkHour/100+"px",height:this.ganttChart.heightTaskItem+"px"}),c=g.create("td",{height:this.ganttChart.heightTaskItem+"px",width:100-a+"%"},b),c.style.lineHeight="1px",c=g.create("div",{className:"ganttImageTaskProgressBg"}, c),f.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%"):(l.remove(c.firstChild,"ganttImageTaskProgressFilled"),l.add(c.firstChild,"ganttImageTaskProgressBg")):100==a&&(0!=this.taskItem.percentage&&100!=this.taskItem.percentage?(d.parentNode.removeChild(d),c.width="100%"):(l.remove(c.firstChild,"ganttImageTaskProgressBg"), l.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())}})});