//>>built define("./GanttTaskItem ./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(u,v,w,x,t,n,z,A,q,B,p,d,l,y,C,r){return x("dojox.gantt.GanttProjectControl",[],{constructor:function(a,c){this.project=c;this.ganttChart=a;this.projectNameItem=this.projectItem=this.descrProject=null;this.posX=this.posY= 0;this.previousProject=this.nextProject=null;this.arrTasks=[];this.duration=this.percentage=0},checkWidthProjectNameItem:function(){if(this.projectNameItem.offsetWidth+this.projectNameItem.offsetLeft>this.ganttChart.maxWidthTaskNames){var a=this.project.name.substring(0,this.projectNameItem.firstChild.length-Math.round((this.projectNameItem.offsetWidth+this.projectNameItem.offsetLeft-this.ganttChart.maxWidthTaskNames)/(this.projectNameItem.offsetWidth/this.projectNameItem.firstChild.length))-3);this.projectNameItem.innerHTML= a+"..."}},refreshProjectItem:function(a){this.percentage=this.getPercentCompleted();l.set(a,{left:this.posX+"px",width:this.duration*this.ganttChart.pixelsPerWorkHour+"px"});var c=a.firstChild,b=this.duration*this.ganttChart.pixelsPerWorkHour;c.width=(0==b?1:b)+"px";c.style.width=(0==b?1:b)+"px";c=c.rows[0];-1!=this.percentage?(0!=this.percentage&&(b=c.firstChild,b.width=this.percentage+"%",b=b.firstChild,l.set(b,{width:(this.duration?this.percentage*this.duration*this.ganttChart.pixelsPerWorkHour/ 100:1)+"px",height:this.ganttChart.heightTaskItem+"px"})),100!=this.percentage&&(b=c.lastChild,b.width=100-this.percentage+"%",b=b.firstChild,l.set(b,{width:(this.duration?(100-this.percentage)*this.duration*this.ganttChart.pixelsPerWorkHour/100:1)+"px",height:this.ganttChart.heightTaskItem+"px"}))):(b=c.firstChild,b.width="1px",b=b.firstChild,l.set(b,{width:"1px",height:this.ganttChart.heightTaskItem+"px"}));c=a.lastChild.firstChild;l.set(c,{height:this.ganttChart.heightTaskItem+"px",width:(this.duration? this.duration*this.ganttChart.pixelsPerWorkHour:1)+"px"});c.rows[0].firstChild.height=this.ganttChart.heightTaskItem+"px";0==this.project.parentTasks.length&&(a.style.display="none");return a},refreshDescrProject:function(a){l.set(a,{left:this.posX+this.duration*this.ganttChart.pixelsPerWorkHour+10+"px"});0==this.project.parentTasks.length&&(this.descrProject.style.visibility="hidden");return a},postLoadData:function(){},refresh:function(){this.posX=(this.project.startDate-this.ganttChart.startDate)/ 36E5*this.ganttChart.pixelsPerHour;this.refreshProjectItem(this.projectItem[0]);this.refreshDescrProject(this.projectItem[0].nextSibling);return this},create:function(){var a=this.ganttChart.contentData.firstChild;this.posX=(this.project.startDate-this.ganttChart.startDate)/36E5*this.ganttChart.pixelsPerHour;if(this.previousProject)if(0f&&(a=f);cc){b.firstChild.style.width=a+"px";b.firstChild.width=a+"px";b.style.width=a+"px";var e=b.firstChild.rows[0];e.cells[0].firstChild.style.width=Math.round(a* c/100)+"px";e.cells[0].firstChild.style.height=this.ganttChart.heightTaskItem+"px";e.cells[1].firstChild.style.width=Math.round(a*(100-c)/100)+"px";e.cells[1].firstChild.style.height=this.ganttChart.heightTaskItem+"px";b.lastChild.firstChild.width=a+"px"}else if(0==c||100==c)b.firstChild.style.width=a+"px",b.firstChild.width=a+"px",b.style.width=a+"px",e=b.firstChild.rows[0],e.cells[0].firstChild.style.width=a+"px",e.cells[0].firstChild.style.height=this.ganttChart.heightTaskItem+"px",b.lastChild.firstChild.width= a+"px"},shiftDescrProject:function(){var a=parseInt(this.projectItem[0].style.left)+this.duration*this.ganttChart.pixelsPerWorkHour+10;this.descrProject.style.left=a+"px";this.descrProject.innerHTML=this.getDescStr()},showDescrProject:function(){var a=parseInt(this.projectItem[0].style.left)+this.duration*this.ganttChart.pixelsPerWorkHour+10;this.descrProject.style.left=a+"px";this.descrProject.style.visibility="visible";this.descrProject.innerHTML=this.getDescStr()},hideDescrProject:function(){this.descrProject.style.visibility= "hidden"},getDescStr:function(){return this.duration/this.ganttChart.hsPerDay+" days, "+this.duration+" hours"},createDescrProject:function(){var a=this.posX+this.duration*this.ganttChart.pixelsPerWorkHour+10,c=d.create("div",{innerHTML:this.getDescStr(),className:"ganttDescProject"});l.set(c,{left:a+"px",top:this.posY+"px"});this.descrProject=c;0==this.project.parentTasks.length&&(this.descrProject.style.visibility="hidden");return c},createProjectItem:function(){this.percentage=this.getPercentCompleted(); this.duration=this.getDuration();var a=d.create("div",{id:this.project.id,className:"ganttProjectItem"});l.set(a,{left:this.posX+"px",top:this.posY+"px",width:this.duration*this.ganttChart.pixelsPerWorkHour+"px"});var c=d.create("table",{cellPadding:"0",cellSpacing:"0",className:"ganttTblProjectItem"},a),b=this.duration*this.ganttChart.pixelsPerWorkHour;c.width=(0==b?1:b)+"px";c.style.width=(0==b?1:b)+"px";c=c.insertRow(c.rows.length);-1!=this.percentage?(0!=this.percentage&&(b=d.create("td",{width:this.percentage+ "%"},c),b.style.lineHeight="1px",b=d.create("div",{className:"ganttImageProgressFilled"},b),l.set(b,{width:this.percentage*this.duration*this.ganttChart.pixelsPerWorkHour/100+"px",height:this.ganttChart.heightTaskItem+"px"})),100!=this.percentage&&(b=d.create("td",{width:100-this.percentage+"%"},c),b.style.lineHeight="1px",b=d.create("div",{className:"ganttImageProgressBg"},b),l.set(b,{width:(100-this.percentage)*this.duration*this.ganttChart.pixelsPerWorkHour/100+"px",height:this.ganttChart.heightTaskItem+ "px"}))):(b=d.create("td",{width:"1px"},c),b.style.lineHeight="1px",b=d.create("div",{className:"ganttImageProgressBg"},b),l.set(b,{width:"1px",height:this.ganttChart.heightTaskItem+"px"}));c=d.create("div",{className:"ganttDivTaskInfo"});b=d.create("table",{cellPadding:"0",cellSpacing:"0",height:this.ganttChart.heightTaskItem+"px",width:(0==this.duration*this.ganttChart.pixelsPerWorkHour?1:this.duration*this.ganttChart.pixelsPerWorkHour)+"px"},c).insertRow(0);d.create("td",{align:"center",vAlign:"top", height:this.ganttChart.heightTaskItem+"px",className:"ganttMoveInfo"},b);a.appendChild(c);0==this.project.parentTasks.length&&(a.style.display="none");return a},createProjectNameItem:function(){var a=d.create("div",{className:"ganttProjectNameItem",innerHTML:this.project.name,title:this.project.name});l.set(a,{left:"5px",top:this.posY+"px"});y.set(a,"tabIndex",0);this.ganttChart.isShowConMenu&&(this.ganttChart._events.push(q(a,"mouseover",n.hitch(this,function(c){p.add(a,"ganttProjectNameItemHover"); clearTimeout(this.ganttChart.menuTimer);this.ganttChart.tabMenu.clear();this.ganttChart.tabMenu.show(c.target,this)}))),this.ganttChart._events.push(q(a,"keydown",n.hitch(this,function(a){a.keyCode==r.ENTER&&(this.ganttChart.tabMenu.clear(),this.ganttChart.tabMenu.show(a.target,this));!this.ganttChart.tabMenu.isShow||a.keyCode!=r.LEFT_ARROW&&a.keyCode!=r.RIGHT_ARROW||w(this.ganttChart.tabMenu.menuPanel.firstChild.rows[0].cells[0]);this.ganttChart.tabMenu.isShow&&a.keyCode==r.ESCAPE&&this.ganttChart.tabMenu.hide()}))), this.ganttChart._events.push(q(a,"mouseout",n.hitch(this,function(){p.remove(a,"ganttProjectNameItemHover");clearTimeout(this.ganttChart.menuTimer);this.ganttChart.menuTimer=setTimeout(n.hitch(this,function(){this.ganttChart.tabMenu.hide()}),200)}))),this.ganttChart._events.push(q(this.ganttChart.tabMenu.menuPanel,"mouseover",n.hitch(this,function(){clearTimeout(this.ganttChart.menuTimer)}))),this.ganttChart._events.push(q(this.ganttChart.tabMenu.menuPanel,"keydown",n.hitch(this,function(){this.ganttChart.tabMenu.isShow&& event.keyCode==r.ESCAPE&&this.ganttChart.tabMenu.hide()}))),this.ganttChart._events.push(q(this.ganttChart.tabMenu.menuPanel,"mouseout",n.hitch(this,function(){clearTimeout(this.ganttChart.menuTimer);this.ganttChart.menuTimer=setTimeout(n.hitch(this,function(){this.ganttChart.tabMenu.hide()}),200)}))));return a},getPercentCompleted:function(){var a=0;t.forEach(this.project.parentTasks,function(c){a+=parseInt(c.percentage)},this);return 0!=this.project.parentTasks.length?Math.round(a/this.project.parentTasks.length): -1},getDuration:function(){var a=0,c=0;return 0a&&(a=c)},this),(a-this.posX)/24*this.ganttChart.hsPerDay):0},deleteTask:function(a){if(a=this.getTaskById(a))this.deleteChildTask(a),this.ganttChart.checkPosition()},setName:function(a){a&&(this.project.name=a,this.projectNameItem.innerHTML=a,this.projectNameItem.title=a,this.checkWidthProjectNameItem(), this.descrProject.innerHTML=this.getDescStr(),this.adjustPanelTime())},setPercentCompleted:function(a){a=parseInt(a);if(isNaN(a)||100a)return!1;var c=this.projectItem[0].firstChild.rows[0],b=c.cells[0],e=c.cells[1];0a&&0this.percentage?(b.width=parseInt(a)+"%",b.firstChild.style.width=a*this.duration*this.ganttChart.pixelsPerWorkHour/100+"px",e.width=100-parseInt(a)+"%",e.firstChild.style.width=(100-a)*this.duration*this.ganttChart.pixelsPerWorkHour/100+"px"):(0== a||100==a)&&0this.percentage?0==a?(b.parentNode.removeChild(b),e.width="100%",e.firstChild.style.width=this.duration*this.ganttChart.pixelsPerWorkHour+"px"):100==a&&(e.parentNode.removeChild(e),b.width="100%",b.firstChild.style.width=this.duration*this.ganttChart.pixelsPerWorkHour+"px"):0!=a&&100!=a||0!=this.percentage&&100!=this.percentage?!(0a)||0!=this.percentage&&100!=this.percentage?-1==this.percentage&&(100==a?(p.remove(b.firstChild,"ganttImageProgressBg"),p.add(b.firstChild, "ganttImageProgressFilled")):100>a&&0d||100