//>>built
define("dojox/gantt/contextMenuTab","./GanttTaskControl dijit/Menu dijit/Dialog dijit/form/NumberSpinner dijit/form/Button dijit/form/CheckBox dijit/form/DateTextBox dijit/form/TimeTextBox dijit/form/TextBox dijit/form/Form dijit/registry dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/_base/html dojo/date/locale dojo/request dojo/dom dojo/dom-class dojo/domReady!".split(" "),function(m,w,p,n,x,y,q,z,r,A,t,u,v,f,B,C,D,E,h){return u("dojox.gantt.contextMenuTab",[],{constructor:function(a,
c,b,e,d,g){this.id=a;this.arrItems=[];this.TabItemContainer=null;this.Description=c;this.tabMenu=d;this.type=b;this.object=null;this.showObjectInfo=e;this.withDefaultValue=g},preValueValidation:function(a){for(var c=0;c<a.length;c++){var b=a[c];if(b.required&&!b.control.textbox.value)return!1}return!0},encodeDate:function(a){return a.getFullYear()+"."+(a.getMonth()+1)+"."+a.getDate()},decodeDate:function(a){a=a.split(".");return 3>a.length?"":new Date(a[0],parseInt(a[1])-1,a[2])},renameTaskAction:function(){var a=
this.arrItems[0].control.textbox.value;0>=f.trim(a).length||!this.preValueValidation(this.arrItems)||(this.object.setName(a),this.hide())},deleteAction:function(){this.preValueValidation(this.arrItems)&&(this.object.project.deleteTask(this.object.taskItem.id),this.hide(),this.tabMenu.ganttChart.resource&&this.tabMenu.ganttChart.resource.reConstruct())},durationUpdateAction:function(){var a=this.arrItems[0].control.textbox.value;this.preValueValidation(this.arrItems)&&(this.object.setDuration(a)?(this.hide(),
this.tabMenu.ganttChart.resource&&this.tabMenu.ganttChart.resource.refresh()):alert("Duration out of Range"))},cpUpdateAction:function(){var a=this.arrItems[0].control.textbox.value;this.preValueValidation(this.arrItems)&&(this.object.setPercentCompleted(a)?this.hide():alert("Complete Percentage out of Range"))},ownerUpdateAction:function(){var a=this.arrItems[0].control.textbox.value;this.preValueValidation(this.arrItems)&&(this.object.setTaskOwner(a)?(this.hide(),this.tabMenu.ganttChart.resource&&
this.tabMenu.ganttChart.resource.reConstruct()):alert("Task owner not Valid"))},ptUpdateAction:function(){var a=this.arrItems[0].control.textbox.value;this.preValueValidation(this.arrItems)&&(this.object.setPreviousTask(a)?this.hide():alert("Please verify the Previous Task ("+a+")  and adjust its Time Range"))},renameProjectAction:function(){var a=this.arrItems[0].control.textbox.value;0>=f.trim(a).length||!this.preValueValidation(this.arrItems)||(this.object.setName(a),this.hide())},deleteProjectAction:function(){this.preValueValidation(this.arrItems)&&
(this.object.ganttChart.deleteProject(this.object.project.id),this.hide(),this.tabMenu.ganttChart.resource&&this.tabMenu.ganttChart.resource.reConstruct())},cpProjectAction:function(){var a=this.arrItems[0].control.textbox.value;this.preValueValidation(this.arrItems)&&(this.object.setPercentCompleted(a)?this.hide():alert("Percentage not Acceptable"))},addTaskAction:function(){if(this.preValueValidation(this.arrItems)){var a=this.arrItems[0].control.textbox.value,c=this.arrItems[1].control.textbox.value,
b=this.decodeDate(this.arrItems[2].control.textbox.value),e=this.arrItems[3].control.textbox.value,d=this.arrItems[4].control.textbox.value,g=this.arrItems[5].control.textbox.value,k=this.arrItems[6].control.textbox.value,l=this.arrItems[7].control.textbox.value;0>=f.trim(a).length||(this.object.insertTask(a,c,b,e,d,l,g,k)?(this.hide(),this.tabMenu.ganttChart.resource&&this.tabMenu.ganttChart.resource.reConstruct()):alert("Please adjust your Customization"))}},addSuccessorTaskAction:function(){if(this.preValueValidation(this.arrItems)){var a=
this.object.project,c=this.arrItems[0].control.textbox.value,b=this.arrItems[1].control.textbox.value,e=this.decodeDate(this.arrItems[2].control.textbox.value),d=this.arrItems[3].control.textbox.value,g=this.arrItems[4].control.textbox.value,k=this.arrItems[5].control.textbox.value;0>=f.trim(c).length||(a.insertTask(c,b,e,d,g,this.object.taskItem.id,k,this.object.parentTask?this.object.parentTask.taskItem.id:"")?(this.hide(),this.tabMenu.ganttChart.resource&&this.tabMenu.ganttChart.resource.reConstruct()):
alert("Please adjust your Customization"))}},addChildTaskAction:function(){if(this.preValueValidation(this.arrItems)){var a=this.object.project,c=this.arrItems[0].control.textbox.value,b=this.arrItems[1].control.textbox.value,e=this.decodeDate(this.arrItems[2].control.textbox.value),d=this.arrItems[3].control.textbox.value,g=this.arrItems[4].control.textbox.value,k=this.arrItems[5].control.textbox.value,l=this.object.taskItem.id;0>=f.trim(c).length||(a.insertTask(c,b,e,d,g,"",k,l)?(this.hide(),this.tabMenu.ganttChart.resource&&
this.tabMenu.ganttChart.resource.reConstruct()):alert("Please adjust your Customization"))}},addProjectAction:function(){if(this.preValueValidation(this.arrItems)){var a=this.arrItems[0].control.textbox.value,c=this.arrItems[1].control.textbox.value,b=this.decodeDate(this.arrItems[2].control.textbox.value);0>=f.trim(a).length||0>=f.trim(c).length||(this.tabMenu.ganttChart.insertProject(a,c,b)?(this.hide(),this.tabMenu.ganttChart.resource&&this.tabMenu.ganttChart.resource.reConstruct()):alert("Please adjust your Customization"))}},
addAction:function(a){this.actionFunc=this[a]},addItem:function(a,c,b,e){var d="startTime"==b||"startDate"==b?new q({type:"text",constraints:{datePattern:"yyyy.M.d",strict:!0}}):"percentage"==b?new n({constraints:{max:100,min:0}}):"duration"==b?new n({constraints:{min:0}}):new r;this.arrItems.push({id:a,name:c,control:d,tab:this,key:b,required:e})},show:function(){this.tabMenu.tabPanelDlg=this.tabMenu.tabPanelDlg||t.byId(this.tabMenu.tabPanelDlgId)||new p({title:"Settings"});try{this.tabMenu.tabPanelDlg.show()}catch(d){return}this.tabMenu.tabPanelDlg.titleNode.innerHTML=
this.Description;var a=this.tabMenu.paneContentArea.firstChild.rows[1].cells[0].firstChild,c,b=null;this.showObjectInfo&&this.object&&(this.object.constructor==m?(this.insertData(a,"Id",this.object.taskItem.id),this.insertData(a,"Name",this.object.taskItem.name),this.insertData(a,"Start Time",this.encodeDate(this.object.taskItem.startTime)),this.insertData(a,"Duration (hours)",this.object.taskItem.duration+" hours"),this.insertData(a,"Percent Complete (%)",this.object.taskItem.percentage+"%"),this.insertData(a,
"Task Assignee",this.object.taskItem.taskOwner),this.insertData(a,"Previous Task Id",this.object.taskItem.previousTaskId)):(this.insertData(a,"Id",this.object.project.id),this.insertData(a,"Name",this.object.project.name),this.insertData(a,"Start date",this.encodeDate(this.object.project.startDate))));b=a.insertRow(a.rows.length);var e=b.insertCell(b.cells.length);e.colSpan=2;e.innerHTML="\x3chr/\x3e";b=a.insertRow(a.rows.length);e=b.insertCell(b.cells.length);e.colSpan=2;h.add(e,"ganttMenuDialogInputCellHeader");
e.innerHTML="Customization: "+this.Description;v.forEach(this.arrItems,function(d){b=a.insertRow(a.rows.length);e=b.insertCell(b.cells.length);h.add(e,"ganttMenuDialogInputCell");c=b.insertCell(b.cells.length);h.add(c,"ganttMenuDialogInputCellValue");e.innerHTML=d.name;c.appendChild(d.control.domNode);this.withDefaultValue&&this.object?d.control.textbox.value=this.object.constructor==m?"startTime"==d.key?this.encodeDate(this.object.taskItem.startTime):d.key?this.object.taskItem[d.key]:"":"startDate"==
d.key?this.encodeDate(this.object.project.startDate):d.key?this.object.project[d.key]||this.object[d.key]||"":"":d.control.textbox.placeholder=d.required?"---required---":"---optional---"},this);this.tabMenu.ok.onClick=f.hitch(this,this.actionFunc);this.tabMenu.cancel.onClick=f.hitch(this,this.hide)},hide:function(){try{this.tabMenu.tabPanelDlg.hide()}catch(c){this.tabMenu.tabPanelDlg.destroy()}var a=this.tabMenu.paneContentArea.firstChild.rows[1].cells[0];a.firstChild.parentNode.removeChild(a.firstChild);
a.innerHTML="\x3ctable\x3e\x3c/table\x3e";h.add(a.firstChild,"ganttDialogContentCell")},insertData:function(a,c,b){a=a.insertRow(a.rows.length);var e=a.insertCell(a.cells.length);h.add(e,"ganttMenuDialogDescCell");e.innerHTML=c;c=a.insertCell(a.cells.length);h.add(c,"ganttMenuDialogDescCellValue");c.innerHTML=b}})});