diff --git a/phpgwapi/js/dhtmlxGantt/codebase/dhtmlxgantt.js b/phpgwapi/js/dhtmlxGantt/codebase/dhtmlxgantt.js index 962001cb13..7c93f947fb 100644 --- a/phpgwapi/js/dhtmlxGantt/codebase/dhtmlxgantt.js +++ b/phpgwapi/js/dhtmlxGantt/codebase/dhtmlxgantt.js @@ -1,8 +1,240 @@ -/* -This software is allowed to use under GPL or you need to obtain Commercial or Enterise License - to use it in non-GPL project. Please contact sales@dhtmlx.com for details -*/ -function dtmlXMLLoaderObject(t,e,n,i){return this.xmlDoc="",this.async="undefined"!=typeof n?n:!0,this.onloadAction=t||null,this.mainObject=e||null,this.waitCall=null,this.rSeed=i||!1,this}function callerFunction(t,e){return this.handler=function(n){return n||(n=window.event),t(n,e),!0},this.handler}function getAbsoluteLeft(t){return getOffset(t).left}function getAbsoluteTop(t){return getOffset(t).top}function getOffsetSum(t){for(var e=0,n=0;t;)e+=parseInt(t.offsetTop),n+=parseInt(t.offsetLeft),t=t.offsetParent;return{top:e,left:n}}function getOffsetRect(t){var e=t.getBoundingClientRect(),n=document.body,i=document.documentElement,a=window.pageYOffset||i.scrollTop||n.scrollTop,s=window.pageXOffset||i.scrollLeft||n.scrollLeft,r=i.clientTop||n.clientTop||0,o=i.clientLeft||n.clientLeft||0,d=e.top+a-r,l=e.left+s-o;return{top:Math.round(d),left:Math.round(l)}}function getOffset(t){return t.getBoundingClientRect?getOffsetRect(t):getOffsetSum(t)}function convertStringToBoolean(t){switch("string"==typeof t&&(t=t.toLowerCase()),t){case"1":case"true":case"yes":case"y":case 1:case!0:return!0;default:return!1}}function getUrlSymbol(t){return-1!=t.indexOf("?")?"&":"?"}function dhtmlDragAndDropObject(){return window.dhtmlDragAndDrop?window.dhtmlDragAndDrop:(this.lastLanding=0,this.dragNode=0,this.dragStartNode=0,this.dragStartObject=0,this.tempDOMU=null,this.tempDOMM=null,this.waitDrag=0,window.dhtmlDragAndDrop=this,this)}function _dhtmlxError(){return this.catches||(this.catches=new Array),this}function dhtmlXHeir(t,e){for(var n in e)"function"==typeof e[n]&&(t[n]=e[n]);return t}function dhtmlxEvent(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on"+e,n)}function dhtmlxDetachEvent(t,e,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent&&t.detachEvent("on"+e,n)}function dhtmlxDnD(t,e){e&&(this._settings=e),dhtmlxEventable(this),dhtmlxEvent(t,"mousedown",dhtmlx.bind(function(e){this.dragStart(t,e)},this))}function dataProcessor(t){return this.serverProcessor=t,this.action_param="!nativeeditor_status",this.object=null,this.updatedRows=[],this.autoUpdate=!0,this.updateMode="cell",this._tMode="GET",this.post_delim="_",this._waitMode=0,this._in_progress={},this._invalid={},this.mandatoryFields=[],this.messages=[],this.styles={updated:"font-weight:bold;",inserted:"font-weight:bold;",deleted:"text-decoration : line-through;",invalid:"background-color:FFE0E0;",invalid_cell:"border-bottom:2px solid red;",error:"color:red;",clear:"font-weight:normal;text-decoration:none;"},this.enableUTFencoding(!0),dhtmlxEventable(this),this}dhtmlx=function(t){for(var e in t)dhtmlx[e]=t[e];return dhtmlx},dhtmlx.extend_api=function(t,e,n){var i=window[t];i&&(window[t]=function(t){if(t&&"object"==typeof t&&!t.tagName){var n=i.apply(this,e._init?e._init(t):arguments);for(var a in dhtmlx)e[a]&&this[e[a]](dhtmlx[a]);for(var a in t)e[a]?this[e[a]](t[a]):0==a.indexOf("on")&&this.attachEvent(a,t[a])}else var n=i.apply(this,arguments);return e._patch&&e._patch(this),n||this},window[t].prototype=i.prototype,n&&dhtmlXHeir(window[t].prototype,n))},dhtmlxAjax={get:function(t,e){var n=new dtmlXMLLoaderObject(!0);return n.async=arguments.length<3,n.waitCall=e,n.loadXML(t),n},post:function(t,e,n){var i=new dtmlXMLLoaderObject(!0);return i.async=arguments.length<4,i.waitCall=n,i.loadXML(t,!0,e),i},getSync:function(t){return this.get(t,null,!0)},postSync:function(t,e){return this.post(t,e,null,!0)}},dtmlXMLLoaderObject.count=0,dtmlXMLLoaderObject.prototype.waitLoadFunction=function(t){var e=!0;return this.check=function(){if(t&&null!=t.onloadAction&&(!t.xmlDoc.readyState||4==t.xmlDoc.readyState)){if(!e)return;e=!1,dtmlXMLLoaderObject.count++,"function"==typeof t.onloadAction&&t.onloadAction(t.mainObject,null,null,null,t),t.waitCall&&(t.waitCall.call(this,t),t.waitCall=null)}},this.check},dtmlXMLLoaderObject.prototype.getXMLTopNode=function(t,e){if(this.xmlDoc.responseXML){var n=this.xmlDoc.responseXML.getElementsByTagName(t);if(0==n.length&&-1!=t.indexOf(":"))var n=this.xmlDoc.responseXML.getElementsByTagName(t.split(":")[1]);var i=n[0]}else var i=this.xmlDoc.documentElement;if(i)return this._retry=!1,i;if(!this._retry&&_isIE){this._retry=!0;var e=this.xmlDoc;return this.loadXMLString(this.xmlDoc.responseText.replace(/^[\s]+/,""),!0),this.getXMLTopNode(t,e)}return dhtmlxError.throwError("LoadXML","Incorrect XML",[e||this.xmlDoc,this.mainObject]),document.createElement("DIV")},dtmlXMLLoaderObject.prototype.loadXMLString=function(t,e){if(_isIE)this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM"),this.xmlDoc.async=this.async,this.xmlDoc.onreadystatechange=function(){},this.xmlDoc.loadXML(t);else{var n=new DOMParser;this.xmlDoc=n.parseFromString(t,"text/xml")}e||(this.onloadAction&&this.onloadAction(this.mainObject,null,null,null,this),this.waitCall&&(this.waitCall(),this.waitCall=null))},dtmlXMLLoaderObject.prototype.loadXML=function(t,e,n,i){this.rSeed&&(t+=(-1!=t.indexOf("?")?"&":"?")+"a_dhx_rSeed="+(new Date).valueOf()),this.filePath=t,this.xmlDoc=!_isIE&&window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),this.async&&(this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this)),this.xmlDoc.open(e?"POST":"GET",t,this.async),i?(this.xmlDoc.setRequestHeader("User-Agent","dhtmlxRPC v0.1 ("+navigator.userAgent+")"),this.xmlDoc.setRequestHeader("Content-type","text/xml")):e&&this.xmlDoc.setRequestHeader("Content-type","application/x-www-form-urlencoded"),this.xmlDoc.setRequestHeader("X-Requested-With","XMLHttpRequest"),this.xmlDoc.send(null||n),this.async||new this.waitLoadFunction(this)()},dtmlXMLLoaderObject.prototype.destructor=function(){return this._filterXPath=null,this._getAllNamedChilds=null,this._retry=null,this.async=null,this.rSeed=null,this.filePath=null,this.onloadAction=null,this.mainObject=null,this.xmlDoc=null,this.doXPath=null,this.doXPathOpera=null,this.doXSLTransToObject=null,this.doXSLTransToString=null,this.loadXML=null,this.loadXMLString=null,this.doSerialization=null,this.xmlNodeToJSON=null,this.getXMLTopNode=null,this.setXSLParamValue=null,null},dtmlXMLLoaderObject.prototype.xmlNodeToJSON=function(t){for(var e={},n=0;n_FFrv)&&window.dhtmlDragAndDrop.calculateFramePosition());try{parent.dhtmlDragAndDrop&&parent!=window&&parent!=t&&parent.dhtmlDragAndDrop.initFrameRoute(window)}catch(n){}for(var i=0;i-1&&(_isChrome=!0),-1!=navigator.userAgent.indexOf("Safari")||-1!=navigator.userAgent.indexOf("Konqueror")?(_KHTMLrv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Safari")+7,5)),_KHTMLrv>525?(_isFF=!0,_FFrv=1.9):_isKHTML=!0):-1!=navigator.userAgent.indexOf("Opera")?(_isOpera=!0,_OperaRv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Opera")+6,3))):-1!=navigator.appName.indexOf("Microsoft")?(_isIE=!0,-1==navigator.appVersion.indexOf("MSIE 8.0")&&-1==navigator.appVersion.indexOf("MSIE 9.0")&&-1==navigator.appVersion.indexOf("MSIE 10.0")||"BackCompat"==document.compatMode||(_isIE=8)):(_isFF=!0,_FFrv=parseFloat(navigator.userAgent.split("rv:")[1])),dtmlXMLLoaderObject.prototype.doXPath=function(t,e,n,i){if(_isKHTML||!_isIE&&!window.XPathResult)return this.doXPathOpera(t,e);if(_isIE)return e||(e=this.xmlDoc.nodeName?this.xmlDoc:this.xmlDoc.responseXML),e||dhtmlxError.throwError("LoadXML","Incorrect XML",[e||this.xmlDoc,this.mainObject]),null!=n&&e.setProperty("SelectionNamespaces","xmlns:xsl='"+n+"'"),"single"==i?e.selectSingleNode(t):e.selectNodes(t)||new Array(0);var a=e;e||(e=this.xmlDoc.nodeName?this.xmlDoc:this.xmlDoc.responseXML),e||dhtmlxError.throwError("LoadXML","Incorrect XML",[e||this.xmlDoc,this.mainObject]),-1!=e.nodeName.indexOf("document")?a=e:(a=e,e=e.ownerDocument);var s=XPathResult.ANY_TYPE;"single"==i&&(s=XPathResult.FIRST_ORDERED_NODE_TYPE);var r=new Array,o=e.evaluate(t,a,function(){return n},s,null);if(s==XPathResult.FIRST_ORDERED_NODE_TYPE)return o.singleNodeValue;for(var d=o.iterateNext();d;)r[r.length]=d,d=o.iterateNext();return r},_dhtmlxError.prototype.catchError=function(t,e){this.catches[t]=e},_dhtmlxError.prototype.throwError=function(t,e,n){return this.catches[t]?this.catches[t](t,e,n):this.catches.ALL?this.catches.ALL(t,e,n):(alert("Error type: "+arguments[0]+"\nDescription: "+arguments[1]),null)},window.dhtmlxError=new _dhtmlxError,dtmlXMLLoaderObject.prototype.doXPathOpera=function(t,e){var n=t.replace(/[\/]+/gi,"/").split("/"),i=null,a=1;if(!n.length)return[];if("."==n[0])i=[e];else{if(""!=n[0])return[];i=(this.xmlDoc.responseXML||this.xmlDoc).getElementsByTagName(n[a].replace(/\[[^\]]*\]/g,"")),a++}for(a;a
"+t+"
"}function a(t){g.area||(g.area=document.createElement("DIV"),g.area.className="dhtmlx_message_area",g.area.style[g.position]="5px",document.body.appendChild(g.area)),g.hide(t.id);var e=document.createElement("DIV");return e.innerHTML="
"+t.text+"
",e.className="dhtmlx-info dhtmlx-"+t.type,e.onclick=function(){g.hide(t.id),t=null},"bottom"==g.position&&g.area.firstChild?g.area.insertBefore(e,g.area.firstChild):g.area.appendChild(e),t.expire>0&&(g.timers[t.id]=window.setTimeout(function(){g.hide(t.id)},t.expire)),g.pull[t.id]=e,e=null,t.id}function s(e,n,a){var s=document.createElement("DIV");s.className=" dhtmlx_modal_box dhtmlx-"+e.type,s.setAttribute("dhxbox",1);var r="";if(e.width&&(s.style.width=e.width),e.height&&(s.style.height=e.height),e.title&&(r+='
'+e.title+"
"),r+='
'+(e.content?"":e.text)+'
',n&&(r+=i(e.ok||"OK",!0)),a&&(r+=i(e.cancel||"Cancel",!1)),e.buttons)for(var o=0;o",s.innerHTML=r,e.content){var d=e.content;"string"==typeof d&&(d=document.getElementById(d)),"none"==d.style.display&&(d.style.display=""),s.childNodes[e.title?1:0].appendChild(d)}return s.onclick=function(n){n=n||event;var i=n.target||n.srcElement;if(i.className||(i=i.parentNode),"dhtmlx_popup_button"==i.className.split(" ")[0]){var a=i.getAttribute("result");a="true"==a||("false"==a?!1:a),t(e,a)}},e.box=s,(n||a)&&(c=e),s}function r(t,i,a){var r=t.tagName?t:s(t,i,a);t.hidden||n(!0),document.body.appendChild(r);var o=Math.abs(Math.floor(((window.innerWidth||document.documentElement.offsetWidth)-r.offsetWidth)/2)),d=Math.abs(Math.floor(((window.innerHeight||document.documentElement.offsetHeight)-r.offsetHeight)/2));return r.style.top="top"==t.position?"-3px":d+"px",r.style.left=o+"px",r.onkeydown=e,r.focus(),t.hidden&&dhtmlx.modalbox.hide(r),r}function o(t){return r(t,!0,!1)}function d(t){return r(t,!0,!0)}function l(t){return r(t)}function h(t,e,n){return"object"!=typeof t&&("function"==typeof e&&(n=e,e=""),t={text:t,type:e,callback:n}),t}function _(t,e,n,i){return"object"!=typeof t&&(t={text:t,type:e,expire:n,id:i}),t.id=t.id||g.uid(),t.expire=t.expire||g.expire,t}var c=null;document.attachEvent?document.attachEvent("onkeydown",e):document.addEventListener("keydown",e,!0),dhtmlx.alert=function(){var t=h.apply(this,arguments);return t.type=t.type||"confirm",o(t)},dhtmlx.confirm=function(){var t=h.apply(this,arguments);return t.type=t.type||"alert",d(t)},dhtmlx.modalbox=function(){var t=h.apply(this,arguments);return t.type=t.type||"alert",l(t)},dhtmlx.modalbox.hide=function(t){for(;t&&t.getAttribute&&!t.getAttribute("dhxbox");)t=t.parentNode;t&&(t.parentNode.removeChild(t),n(!1))};var g=dhtmlx.message=function(t){t=_.apply(this,arguments),t.type=t.type||"info";var e=t.type.split("-")[0];switch(e){case"alert":return o(t);case"confirm":return d(t);case"modalbox":return l(t);default:return a(t)}};g.seed=(new Date).valueOf(),g.uid=function(){return g.seed++},g.expire=4e3,g.keyboard=!0,g.position="top",g.pull={},g.timers={},g.hideAll=function(){for(var t in g.pull)g.hide(t)},g.hide=function(t){var e=g.pull[t];e&&e.parentNode&&(window.setTimeout(function(){e.parentNode.removeChild(e),e=null},2e3),e.className+=" hidden",g.timers[t]&&window.clearTimeout(g.timers[t]),delete g.pull[t])}}(),gantt={version:"2.0.0"},dhtmlxEventable=function(obj){obj._silent_mode=!1,obj._silentStart=function(){this._silent_mode=!0},obj._silentEnd=function(){this._silent_mode=!1},obj.attachEvent=function(t,e,n){return t="ev_"+t.toLowerCase(),this[t]||(this[t]=new this._eventCatcher(n||this)),t+":"+this[t].addEvent(e)},obj.callEvent=function(t,e){return this._silent_mode?!0:(t="ev_"+t.toLowerCase(),this[t]?this[t].apply(this,e):!0)},obj.checkEvent=function(t){return!!this["ev_"+t.toLowerCase()]},obj._eventCatcher=function(obj){var dhx_catch=[],z=function(){for(var t=!0,e=0;ethis.config.sensitivity){if(this.config.started=!0,this.config.ignore=!1,this.callEvent("onBeforeDragStart",[t,e])===!1)return this.config.ignore=!0,!0;var r=this.config.marker=document.createElement("div");r.className="gantt_drag_marker",r.innerHTML="Dragging object",document.body.appendChild(r),this.callEvent("onAfterDragStart",[t,e])}else this.config.ignore=!0}this.config.ignore||(e.pos=this.getPosition(e),this.config.marker.style.left=e.pos.x+"px",this.config.marker.style.top=e.pos.y+"px",this.callEvent("onDragMove",[t,e]))},dragEnd:function(){this.config.marker&&(this.config.marker.parentNode.removeChild(this.config.marker),this.config.marker=null,this.callEvent("onDragEnd",[])),document.body.className=document.body.className.replace(" gantt_noselect","")},getPosition:function(t){var e=0,n=0;return t=t||window.event,t.pageX||t.pageY?(e=t.pageX,n=t.pageY):(t.clientX||t.clientY)&&(e=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,n=t.clientY+document.body.scrollTop+document.documentElement.scrollTop),{x:e,y:n}}},gantt._init_grid=function(){this._click.gantt_close=dhtmlx.bind(function(t,e){this.close(e)},this),this._click.gantt_open=dhtmlx.bind(function(t,e){this.open(e)},this),this._click.gantt_row=dhtmlx.bind(function(t,e,n){if(null!==e){var i=this.getTaskNode(e),a=Math.max(i.offsetLeft-this.config.task_scroll_offset,0);this._scroll_task_area(a),this.callEvent("onTaskRowClick",[e,n])}},this),this._click.gantt_grid_head_cell=dhtmlx.bind(function(t,e,n){var i=n.getAttribute("column_id");if(this.callEvent("onGridHeaderClick",[i,t]))if("add"==i)this._click.gantt_add(t,0);else if(this.config.sort){var a=this._sort&&this._sort.direction&&this._sort.name==i?this._sort.direction:"desc";a="desc"==a?"asc":"desc",this._sort={name:i,direction:a},this._render_grid_header(),this.sort(i,"desc"==a)}},this),!this.config.sort&&this.config.order_branch&&this._init_dnd(),this._click.gantt_add=dhtmlx.bind(function(t,e){var n=e?this.getTask(e):!1,i="";if(n)i=n.start_date;else{var a=this._order[0];i=a?this.getTask(a).start_date:this.getState().min_date}n&&(n.$open=!0);var s={text:gantt.locale.labels.new_task,start_date:this.templates.xml_format(i),duration:1,progress:0,parent:e};this.callEvent("onTaskCreated",[s]),this.addTask(s),this.showTask(s.id),this.config.details_on_create&&this.showLightbox(s.id)},this)},gantt._render_grid=function(){this._calc_grid_width(),this._render_grid_header()},gantt._calc_grid_width=function(){if(this.config.autofit){for(var t=this.config.columns,e=0,n=[],i=[],a=0;a0?n.length:i.length>0?i.length:1),n.length>0)for(var o=r/(n.length?n.length:1),a=0;an+o.width&&(o.width=this.config.grid_width-n),n+=o.width;var d=this._sort&&o.name==this._sort.name?"
":"",l="gantt_grid_head_cell"+(" gantt_grid_head_"+o.name)+(r?" gantt_last_cell":"")+this.templates.grid_header_class(o.name,o),h="width:"+(o.width-(r?1:0))+"px;",_=o.label||i["column_"+o.name];_=_||"";var c="
"+_+d+"
";e.push(c)}this.$grid_scale.style.height=this.config.scale_height-1+"px",this.$grid_scale.style.lineHeight=a+"px",this.$grid_scale.style.width=n-1+"px",this.$grid_scale.innerHTML=e.join("")},gantt._render_grid_item=function(t){for(var e=this.config.columns,n=[],i=0;i
":(s=o.template?o.template(t):t[o.name],s instanceof Date&&(s=this.templates.date_grid(s)),s="
"+s+"
");var d="gantt_cell"+(r?" gantt_last_cell":""),l="";if(o.tree){for(var h=0;h0;_?(l+=this.templates.grid_open(t),l+=this.templates.grid_folder(t)):(l+=this.templates.grid_blank(t),l+=this.templates.grid_file(t))}var c="width:"+(o.width-(r?1:0))+"px;";dhtmlx.defined(o.align)&&(c+="text-align:"+o.align+";"),a="
"+l+s+"
",n.push(a)}var d=0===t.$index%2?"":" odd";if(d+=t.$transparent?" gantt_transparent":"",this.templates.grid_row_class){var g=this.templates.grid_row_class.call(this,t.start_date,t.end_date,t);g&&(d+=" "+g)}this.getState().selected_task==t.id&&(d+=" gantt_selected");var u=document.createElement("div");return u.className="gantt_row"+d,u.style.height=this.config.row_height+"px",u.style.lineHeight=gantt.config.row_height+"px",u.setAttribute(this.config.task_attribute,t.id),u.innerHTML=n.join(""),u},gantt.open=function(t){gantt._set_item_state(t,!0),this.callEvent("onTaskOpened",[t])},gantt.close=function(t){gantt._set_item_state(t,!1),this.callEvent("onTaskClosed",[t])},gantt._set_item_state=function(t,e){t&&this._pull[t]&&(this._pull[t].$open=e,this.refreshData())},gantt.getTaskIndex=function(t){for(var e=this._branches[this.getTask(t).parent],n=0;nr&&e--}this._branch_update(a.parent,t),s=this._branches[n];var o=s[e];o?s=s.slice(0,e).concat([t]).concat(s.slice(e)):s.push(t),a.parent=n,this._branches[n]=s,this.refreshData() -},gantt._init_dnd=function(){var t=new dhtmlxDnD(this.$grid_data,{updates_per_second:60});dhtmlx.defined(this.config.dnd_sensitivity)&&(t.config.sensitivity=this.config.dnd_sensitivity),t.attachEvent("onBeforeDragStart",dhtmlx.bind(function(t,e){var n=this._locateHTML(e);return n?(this.hideQuickInfo&&this._hideQuickInfo(),void 0):!1},this)),t.attachEvent("onAfterDragStart",dhtmlx.bind(function(e,n){var i=this._locateHTML(n);t.config.marker.innerHTML=i.outerHTML,t.config.id=this.locate(n);var a=this.getTask(t.config.id);a.$open=!1,a.$transparent=!0,this.refreshData()},this)),t.attachEvent("onDragMove",dhtmlx.bind(function(e,n){var i=t.config,a=this._get_position(this.$grid_data),s=a.x+10,r=n.pos.y-10;ra.y+this.$grid_data.offsetHeight-this.config.row_height&&(r=a.y+this.$grid_data.offsetHeight-this.config.row_height),i.marker.style.left=s+"px",i.marker.style.top=r+"px";var o=document.elementFromPoint(a.x-document.body.scrollLeft+1,r-document.body.scrollTop),d=this.locate(o);if(this.isTaskExists(d)){var l=gantt._get_position(o),h=this.getTask(d),_=this.getTask(t.config.id);if(l.y+o.offsetHeight/2=a;a++)i+=t[a];return i},setSumWidth:function(t,e,n,i){var a=e.width;void 0===i&&(i=a.length-1),void 0===n&&(n=0);var s=i-n+1;if(!(n>a.length-1||0>=s||i>a.length-1)&&t){var r=this.getSum(a,n,i),o=t-r;this.adjustSize(o,a,n,i),this.adjustSize(-o,a,i+1),e.full_width=this.getSum(a)}},splitSize:function(t,e){for(var n=[],i=0;e>i;i++)n[i]=0;return this.adjustSize(t,n),n},adjustSize:function(t,e,n,i){n||(n=0),void 0===i&&(i=e.length-1);for(var a=i-n+1,s=this.getSum(e,n,i),r=0,o=n;i>=o;o++){var d=Math.floor(t*(s?e[o]/s:1/a));e[o]+=d,r+=d}e[e.length-1]+=t-r},sortScales:function(t){function e(t,e){var n=new Date(1970,0,1);return gantt.date.add(n,e,t)-n}t.sort(function(t,n){return e(t.unit,t.step)=h;h++)if(+s[h]!=+a[l]);else{var _=this.getSum(t.width,r,h-1),c=this.getSum(e.width,d,l-1);c!=_&&this.setSumWidth(_,e,d,l-1),r=h,d=l}},eachColumn:function(t,e,n){var i=new Date(gantt._min_date),a=new Date(gantt._max_date);gantt.date[t+"_start"]&&(i=gantt.date[t+"_start"](i));for(var s=new Date(i);+a>+s;)n.call(this,new Date(s)),s=gantt.date.add(s,e,t)},formatScales:function(t){var e=t.trace_x,n=0,i=t.width.length-1,a=0;if(+e[0]<+gantt._min_date&&n!=i){var s=Math.floor(t.width[0]*((e[1]-gantt._min_date)/(e[1]-e[0])));a+=t.width[0]-s,t.width[0]=s,e[0]=new Date(gantt._min_date)}var r=e.length-1,o=e[r],d=gantt.date.add(o,t.step,t.unit);if(+d>+gantt._max_date&&r>0){var s=t.width[r]-Math.floor(t.width[r]*((d-gantt._max_date)/(d-o)));a+=t.width[r]-s,t.width[r]=s}if(a){for(var l=this.getSum(t.width),h=0,_=0;_t.x?this.dirs.right:e.y>t.y?this.dirs.down:this.dirs.up}},gantt._y_from_ind=function(t){return t*gantt.config.row_height},gantt._path_builder={path:[],clear:function(){this.path=[]},current:function(){return this.path[this.path.length-1]},point:function(t){return t?(this.path.push(dhtmlx.copy(t)),t):this.current()},point_to:function(t,e,n){n=n?{x:n.x,y:n.y}:dhtmlx.copy(this.point());var i=gantt._drawer.dirs;switch(t){case i.left:n.x-=e;break;case i.right:n.x+=e;break;case i.up:n.y-=e;break;case i.down:n.y+=e}return this.point(n)},get_points:function(t){var e=this.get_endpoint(t),n=gantt.config,i=e.e_y-e.y,a=e.e_x-e.x,s=gantt._drawer.dirs;this.clear(),this.point({x:e.x,y:e.y});var r=2*n.link_arrow_size,o=e.e_x>e.x;if(t.type==gantt.config.links.start_to_start)this.point_to(s.left,r),o?(this.point_to(s.down,i),this.point_to(s.right,a)):(this.point_to(s.right,a),this.point_to(s.down,i)),this.point_to(s.right,r);else if(t.type==gantt.config.links.finish_to_start)if(o=e.e_x>e.x+2*r,this.point_to(s.right,r),o)a-=r,this.point_to(s.down,i),this.point_to(s.right,a);else{a-=2*r;var d=i>0?1:-1;this.point_to(s.down,d*(n.row_height/2)),this.point_to(s.right,a),this.point_to(s.down,d*(Math.abs(i)-n.row_height/2)),this.point_to(s.right,r)}else t.type==gantt.config.links.finish_to_finish&&(this.point_to(s.right,r),o?(this.point_to(s.right,a),this.point_to(s.down,i)):(this.point_to(s.down,i),this.point_to(s.right,a)),this.point_to(s.left,r));return this.path},get_endpoint:function(t){var e,n,i=gantt.config.links,a=gantt._get_visible_order(t.source),s=gantt._get_visible_order(t.target);return t.type==i.start_to_start?(e=gantt._pull[t.source].start_date,n=gantt._pull[t.target].start_date):t.type==i.finish_to_finish?(e=gantt._pull[t.source].end_date,n=gantt._pull[t.target].end_date):t.type==i.finish_to_start?(e=gantt._pull[t.source].end_date,n=gantt._pull[t.target].start_date):dhtmlx.assert(!1,"Invalid link type"),{x:gantt.posFromDate(e),e_x:gantt.posFromDate(n),y:gantt._y_from_ind(a),e_y:gantt._y_from_ind(s)}}},gantt._init_links_dnd=function(){function t(t){var e=n(),i=["gantt_link_tooltip"];e.from&&e.to&&(gantt.isLinkAllowed(e.from,e.to,e.from_start,e.to_start)?i.push("gantt_allowed_link"):i.push("gantt_invalid_link"));var a=gantt.templates.drag_link_class(e.from,e.from_start,e.to,e.to_start);a&&i.push(a);var s="
"+gantt.templates.drag_link(e.from,e.from_start,e.to,e.to_start)+"
";t.innerHTML=s}function e(t,e){t.style.left=e.x+5+"px",t.style.top=e.y+5+"px"}function n(){return{from:gantt._link_source_task,to:gantt._link_target_task,from_start:gantt._link_source_task_start,to_start:gantt._link_target_task_start}}function i(){gantt._link_source_task=gantt._link_source_task_start=gantt._link_target_task=gantt._link_target_task_start=null}function a(t,e,i,a){var d=o(),l=n(),h=["gantt_link_direction"];gantt.templates.link_direction_class&&h.push(gantt.templates.link_direction_class(l.from,l.from_start,l.to,l.to_start));var _=Math.sqrt(Math.pow(i-t,2)+Math.pow(a-e,2));if(_=Math.max(0,_-3)){d.className=h.join(" ");var c=(a-e)/(i-t),g=Math.atan(c);2==r(t,i,e,a)?g+=Math.PI:3==r(t,i,e,a)&&(g-=Math.PI);var u=Math.sin(g),f=Math.cos(g),p=Math.round(e),m=Math.round(t),v=["-webkit-transform: rotate("+g+"rad)","-moz-transform: rotate("+g+"rad)","-ms-transform: rotate("+g+"rad)","-o-transform: rotate("+g+"rad)","transform: rotate("+g+"rad)","width:"+Math.round(_)+"px"];if(-1!=window.navigator.userAgent.indexOf("MSIE 8.0")){v.push('-ms-filter: "'+s(u,f)+'"');var x=Math.abs(Math.round(t-i)),k=Math.abs(Math.round(a-e));switch(r(t,i,e,a)){case 1:p-=k;break;case 2:m-=x,p-=k;break;case 3:m-=x}}v.push("top:"+p+"px"),v.push("left:"+m+"px"),d.style.cssText=v.join(";")}}function s(t,e){return"progid:DXImageTransform.Microsoft.Matrix(M11 = "+e+","+"M12 = -"+t+","+"M21 = "+t+","+"M22 = "+e+","+"SizingMethod = 'auto expand'"+")"}function r(t,e,n,i){return e>=t?n>=i?1:4:n>=i?2:3}function o(){return l._direction||(l._direction=document.createElement("div"),gantt.$task_links.appendChild(l._direction)),l._direction}function d(){l._direction&&(l._direction.parentNode&&l._direction.parentNode.removeChild(l._direction),l._direction=null)}var l=new dhtmlxDnD(this.$task_bars,{sensitivity:0,updates_per_second:60}),h="task_left",_="gantt_link_point",c="gantt_link_control";l.attachEvent("onBeforeDragStart",dhtmlx.bind(function(t,e){var n=e.target||e.srcElement;if(i(),gantt.getState().drag_id)return!1;if(gantt._locate_css(n,_)){gantt._locate_css(n,h)&&(gantt._link_source_task_start=!0);var a=gantt._link_source_task=this.locate(e),s=gantt.getTask(a);return this._dir_start={y:gantt._y_from_ind(gantt._get_visible_order(a))+gantt.config.row_height/2,x:gantt.posFromDate(gantt._link_source_task_start?s.start_date:s.end_date)},!0}return!1},this)),l.attachEvent("onAfterDragStart",dhtmlx.bind(function(){t(l.config.marker)},this)),l.attachEvent("onDragMove",dhtmlx.bind(function(n,i){var s=l.config,r=l.getPosition(i);e(s.marker,r);var o=gantt._is_link_drop_area(i),d=gantt._link_target_task,_=gantt._link_landing,c=gantt._link_target_task_start,g=gantt.locate(i);if(o)var u=!1,u=!!gantt._locate_css(i,h),o=!!g;if(gantt._link_target_task=g,gantt._link_landing=o,gantt._link_target_task_start=u,o){var f=gantt.getTask(g),p=Math.floor((i.srcElement||i.target).offsetWidth/2);this._dir_end={y:gantt._y_from_ind(gantt._get_visible_order(g))+gantt.config.row_height/2,x:gantt.posFromDate(u?f.start_date:f.end_date)+(u?-1:1)*p}}else this._dir_end=gantt._get_mouse_pos(i);var m=!(_==o&&d==g&&c==u);return m&&(d&&gantt.refreshTask(d,!1),g&&gantt.refreshTask(g,!1)),m&&t(s.marker),a(this._dir_start.x,this._dir_start.y,this._dir_end.x,this._dir_end.y),!0},this)),l.attachEvent("onDragEnd",dhtmlx.bind(function(){var t=n();if(t.from&&t.to&&t.from!=t.to){var e=gantt._get_link_type(t.from_start,t.to_start);e&&gantt.addLink({source:t.from,target:t.to,type:e})}i(),t.from&&gantt.refreshTask(t.from,!1),t.to&&gantt.refreshTask(t.to,!1),d()},this)),gantt._is_link_drop_area=function(t){return!!gantt._locate_css(t,c)}},gantt._get_link_state=function(){return{link_landing_area:this._link_landing,link_target_id:this._link_target_task,link_target_start:this._link_target_task_start,link_source_id:this._link_source_task,link_source_start:this._link_source_task_start}},gantt._init_tasks=function(){function t(t,e,n,i){for(var a=0;a-1?i.$target[0]:i.$source[0]),a&&this._delete_link_handler(a,t),!1},this),this._tasks_dnd.init(),this._init_links_dnd(),this._taskRenderer=gantt._task_renderer("line",this._render_task_element,this.$task_bars),this._linkRenderer=gantt._task_renderer("links",this._render_link_element,this.$task_links),this._gridRenderer=gantt._task_renderer("grid_items",this._render_grid_item,this.$grid_data),this._bgRenderer=gantt._task_renderer("bg_lines",this._render_bg_line,this.$task_bg),this.attachEvent("onTaskIdChange",function(e,n){var i=this._get_task_renderers();t(i,e,n,this.getTask(n))}),this.attachEvent("onLinkIdChange",function(e,n){var i=this._get_link_renderers();t(i,e,n,this.getLink(n))})},gantt._get_task_renderers=function(){return[this._taskRenderer,this._gridRenderer,this._bgRenderer]},gantt._get_link_renderers=function(){return[this._linkRenderer]},gantt._delete_link_handler=function(t,e){if(t&&this.callEvent("onLinkDblClick",[t,e])){var n="",i=gantt.locale.labels.link+" "+this.templates.link_description(this.getLink(t))+" "+gantt.locale.labels.confirm_link_deleting;window.setTimeout(function(){gantt._dhtmlx_confirm(i,n,function(){gantt.deleteLink(t)})},gantt.config.touch?300:1)}},gantt.getTaskNode=function(t){return this._taskRenderer.rendered[t]},gantt.getLinkNode=function(t){return this._linkRenderer.rendered[t]},gantt._get_tasks_data=function(){for(var t=[],e=0;e+i&&(i=new Date(t.end_date))},"0"),this.eachTask(function(t){t.start_date&&+t.start_date<+a&&(a=new Date(t.start_date))},"0"),this._min_date=a,this._max_date=i,i&&i!=-1/0||(this._min_date=new Date,this._max_date=new Date(this._min_date)),this._min_date=this.date[t+"_start"](this._min_date),+this._min_date==+a&&(this._min_date=this.date.add(this.date[t+"_start"](this._min_date),-1,t)),this._max_date=this.date[t+"_start"](this._max_date),this._max_date=this.date.add(this._max_date,1,t)},gantt._prepare_scale_html=function(t){var e=[],n=null,i=null,a=null;(t.template||t.date)&&(i=t.template||this.date.date_to_str(t.date)),a=t.css||gantt.templates.scale_cell_class;for(var s=0;s"+r+"";e.push(_)}return e.join("")},gantt._render_tasks_scales=function(){this._init_tasks_range(),this._scroll_resize(),this._set_sizes();var t=this._scale_helpers,e=[t.primaryScale()].concat(this.config.subscales);t.sortScales(e);for(var n=t.prepareConfigs(e,this.config.min_column_width,this.$task.offsetWidth,this.config.scale_height-1),i=this._tasks=n[n.length-1],a=[],s=this.templates.scale_row_class,r=0;r'+this._prepare_scale_html(n[r])+"")}this.$task_scale.style.height=this.config.scale_height-1+"px",this.$task_data.style.width=this.$task_scale.style.width=i.full_width+this.$scroll_ver.offsetWidth+"px",this.$task_links.style.width=this.$task_bars.style.width=i.full_width+"px",e=a.join(""),this.$task_scale.innerHTML=e},gantt._render_bg_line=function(t){for(var e=gantt._tasks,n=e.count,i=[],a=0;n>a;a++){var s=e.width[a],r="width:"+s+"px;",o="gantt_task_cell"+(a==n-1?" gantt_last_cell":"");h=this.templates.task_cell_class(t,e.trace_x[a]),h&&(o+=" "+h);var d="
";i.push(d)}var l=0!==t.$index%2,h=gantt.templates.task_row_class(t.start_date,t.end_date,t),_="gantt_task_row"+(l?" odd":"")+(h?" "+h:"");this.getState().selected_task==t.id&&(_+=" gantt_selected");var c=document.createElement("div");return c.className=_,c.style.height=gantt.config.row_height+"px",c.setAttribute(this.config.task_attribute,t.id),c.innerHTML=i.join(""),c},gantt._adjust_scales=function(){if(this.config.fit_tasks){var t=+this._min_date,e=+this._max_date;if(this._init_tasks_range(),+this._min_date!=t||+this._max_date!=e)return this.render(),this.callEvent("onScaleAdjusted",[]),!0}return!1},gantt.refreshTask=function(t,e){var n=this._get_task_renderers(),i=this.getTask(t);if(i&&this.isTaskVisible(t))for(var a=0;a=+a.min_date&&t.appendChild(i(e+" task_left"))},gantt._render_task_element=function(t){if(!(+t.start_date<+this._max_date&&+t.end_date>+this._min_date))return!1;var e=this._get_task_coord(t),n=this.posFromDate(t.end_date),i=this.config,a=this._tasks.bar_height;a=Math.min(a,this.config.row_height);var s=Math.floor((this.config.row_height-a)/2),r=document.createElement("div"),o=Math.round(n-e.x);r.setAttribute(this.config.task_attribute,t.id),r.appendChild(gantt._render_task_content(t,o)),r.className=this._combine_item_class("gantt_task_line",this.templates.task_class(t.start_date,t.end_date,t),t.id),r.style.cssText=["left:"+e.x+"px","top:"+(s+e.y)+"px","height:"+a+"px","line-height:"+a+"px","width:"+o+"px"].join(";");var d=this._render_leftside_content(t);return d&&r.appendChild(d),d=this._render_rightside_content(t),d&&r.appendChild(d),i.show_progress&&this._render_task_progress(t,r,o),i.drag_resize&&!this._is_flex_task(t)&&gantt._render_pair(r,"gantt_task_drag",t,function(t){var e=document.createElement("div");return e.className=t,e}),i.drag_links&&gantt._render_pair(r,"gantt_link_control",t,function(t){var e=document.createElement("div");e.className=t,e.style.cssText=["height:"+a+"px","line-height:"+a+"px"].join(";");var n=document.createElement("div");return n.className="gantt_link_point",e.appendChild(n),e}),r},gantt._render_side_content=function(t,e,n){if(!e)return null;var i=e(t.start_date,t.end_date,t);if(!i)return null;var a=document.createElement("div");return a.className="gantt_side_content "+n,a.innerHTML=i,a},gantt._render_leftside_content=function(t){var e="gantt_left "+gantt._get_link_crossing_css(!0,t);return gantt._render_side_content(t,this.templates.leftside_text,e)},gantt._render_rightside_content=function(t){var e="gantt_right "+gantt._get_link_crossing_css(!1,t);return gantt._render_side_content(t,this.templates.rightside_text,e)},gantt._get_conditions=function(t){return t?{$source:[gantt.config.links.start_to_start],$target:[gantt.config.links.start_to_start,gantt.config.links.finish_to_start]}:{$source:[gantt.config.links.finish_to_start,gantt.config.links.finish_to_finish],$target:[gantt.config.links.finish_to_finish]}},gantt._get_link_crossing_css=function(t,e){var n=gantt._get_conditions(t);for(var i in n)for(var a=e[i],s=0;st||t>e.full_width)return null;for(var n=0,i=0;i+e.width[n]=0,"Invalid day index");for(var n=Math.floor(e),i=e%1,a=0,s=1;n>=s;s++)a+=gantt._tasks.width[s-1];return i&&(a+=n=this._max_date)return n.length;for(var i=0;is;s++)this.render_item(e[s],a);i.appendChild(a)},replace_item:function(t,e){var n=this.rendered[t];n&&n.parentNode&&n.parentNode.replaceChild(e,n),this.rendered[t]=e},remove_item:function(t){var e=this.rendered[t];e&&e.parentNode&&e.parentNode.removeChild(e),delete this.rendered[t]},change_id:function(t,e){this.rendered[e]=this.rendered[t],delete this.rendered[t]},rendered:this._task_area_pulls[t],node:n},this._task_area_renderers[t])},gantt.showTask=function(t){var e=this.getTaskNode(t),n=Math.max(e.offsetLeft-this.config.task_scroll_offset,0),i=e.offsetTop-(this.$task_data.offsetHeight-this.config.row_height)/2;this._scroll_task_area(n,i)},gantt._pull={},gantt._branches={},gantt._order=[],gantt._lpull={},gantt.load=function(t,e,n){dhtmlx.assert(arguments.length,"Invalid load arguments"),this.callEvent("onLoadStart",[]);var i="json",a=null;arguments.length>=3?(i=e,a=n):"string"==typeof arguments[1]?i=arguments[1]:"function"==typeof arguments[1]&&(a=arguments[1]),dhtmlxAjax.get(t,dhtmlx.bind(function(t){this.on_load(t,i),"function"==typeof a&&a.call(this)},this))},gantt.parse=function(t,e){this.on_load({xmlDoc:{responseText:t}},e)},gantt.serialize=function(t){return t=t||"json",this[t].serialize()},gantt.on_load=function(t,e){e||(e="json"),dhtmlx.assert(this[e],"Invalid data type:'"+e+"'");var n=t.xmlDoc.responseText,i=this[e].parse(n,t);this._process_loading(i),this.callEvent("onLoadEnd",[])},gantt._process_loading=function(t){t.collections&&this._load_collections(t.collections);for(var e={},n=t.data,i=0;in;n++)if(e[n]==t)return n;return-1},gantt.eachTask=function(t,e,n){e=e||0,n=n||this;var i=this._branches[e];if(i)for(var a=0;a"},_copyObject:function(t){var e=gantt.templates.xml_format(t.start_date),n=gantt.templates.xml_format(t.end_date);return""},serialize:function(){var t=[],e=[];gantt.eachTask(function(e){t.push(this._copyObject(e))},0,this);for(var n in gantt._lpull)e.push(this._copyLink(gantt._lpull[n]));return""+t.join("")+""+e.join("")+""}},gantt.oldxml={parse:function(t,e){e=gantt.xml._getXML(t,e,"projects");var n={collections:{links:[]}},i=n.data=[];xml=e.doXPath("//task");for(var a=0;at&&i.push(s)}}else for(var a in n)i.push(n[a]);return i},gantt.isTaskExists=function(t){return dhtmlx.defined(this._pull[t])},gantt.isTaskVisible=function(t){if(!this._pull[t])return!1;if(!(+this._pull[t].start_date<+this._max_date&&+this._pull[t].end_date>+this._min_date))return!1;for(var e=0,n=this._order.length;n>e;e++)if(this._order[e]==t)return!0;return!1},gantt.updateTask=function(t,e){return dhtmlx.defined(e)||(e=this.getTask(t)),this.callEvent("onBeforeTaskUpdate",[t,e])===!1?!1:(this._pull[e.id]=e,this._update_parents(e.id),this.refreshTask(e.id),this.callEvent("onAfterTaskUpdate",[t,e]),this._sync_order(),this._adjust_scales(),void 0)},gantt.addTask=function(t,e){return dhtmlx.defined(e)||(e=t.parent||0),dhtmlx.defined(this._pull[e])||(e=0),t.parent=e,t=this._init_task(t),this.callEvent("onBeforeTaskAdd",[t.id,t])===!1?!1:(this._pull[t.id]=t,this._branches[t.parent]||(this._branches[t.parent]=[]),this._branches[t.parent].push(t.id),this.refreshData(),this.callEvent("onAfterTaskAdd",[t.id,t]),this._adjust_scales(),t.id)},gantt.deleteTask=function(t){return this._deleteTask(t)},gantt._deleteTask=function(t,e){var n=this.getTask(t);if(!e&&this.callEvent("onBeforeTaskDelete",[t,n])===!1)return!1;!e&&this._dp&&this._dp.setUpdateMode("off");var i=this._branches[n.id]||[];this._selected_task==t&&(this._selected_task=null);for(var a=0;a0;)this.deleteLink(n.$source[0]);for(;n.$target.length>0;)this.deleteLink(n.$target[0]);return delete this._pull[t],delete this._branches[t],this._branch_update(n.parent,t),e||(this.callEvent("onAfterTaskDelete",[t,n]),this.refreshData()),!0},gantt.clearAll=function(){this._pull={},this._branches={},this._order=[],this._order_full=[],this._lpull={},this.refreshData(),this.callEvent("onClear",[])},gantt.changeTaskId=function(t,e){var n=this._pull[e]=this._pull[t];this._pull[e].id=e,delete this._pull[t];for(var i in this._pull)this._pull[i].parent==t&&(this._pull[i].parent=e);this._lightbox_id==t&&(this._lightbox_id=e),this._branch_update(n.parent,t,e),this._sync_order(),this.callEvent("onTaskIdChange",[t,e])},gantt._branch_update=function(t,e,n){var i=this._branches[t];if(i){for(var a=[],s=0;s+i&&(i=new Date(t.end_date))},n.id),i&&(n.end_date=i)}if(n.$no_start){var a=1/0;this.eachTask(function(t){+t.start_date<+a&&(a=new Date(t.start_date))},n.id),1/0!=a&&(n.start_date=a)}(n.$no_end||n.$no_start)&&(this._update_task_duration(n),e||this.refreshTask(n.id,!0)),n.parent&&this.isTaskExists(n.parent)&&this._update_parents(n.parent,e)}},gantt._round_date=function(t,e,n){for(var i=gantt.date[n+"_start"](new Date(this._min_date));+t>+i;)i=gantt.date.add(i,e,n);var a=gantt.date.add(i,-1*e,n);return Math.abs(t-a)i[t];return e&&(a=!a),a?1:-1}:t,s=this._branches[n];if(s){for(var r=[],o=s.length-1;o>=0;o--)r[o]=this._pull[s[o]];r.sort(a);for(var o=0;o 
",gantt.showLightbox=function(t){if(t&&this.callEvent("onBeforeLightbox",[t])){var e=this.getLightbox();this._center_lightbox(e),this.showCover(),this._fill_lightbox(t,e),this.callEvent("onLightbox",[t])}},gantt._get_timepicker_step=function(){if(this.config.round_dnd_dates){var t=gantt._tasks,e=this._get_line(t.unit)*t.step/60;return e>=1440&&(e=this.config.time_step),e}return this.config.time_step},gantt.getLabel=function(t,e){for(var n=this.config.lightbox.sections,i=0;i
"+this.locale.labels[i[a]]+"
";i=this.config.buttons_right;for(var a in i)n+="
"+this.locale.labels[i[a]]+"
";n+="",t.innerHTML=n,gantt.config.drag_lightbox&&(t.firstChild.onmousedown=gantt._ready_to_dnd,t.firstChild.onselectstart=function(){return!1},t.firstChild.style.cursor="pointer",gantt._init_dnd_events()),document.body.insertBefore(t,document.body.firstChild),this._lightbox=t;var s=this.config.lightbox.sections;n=this._render_sections(s);for(var r=t.getElementsByTagName("div"),a=0;a
"+this.locale.labels["button_"+t[n].button]+"
"),this.config.wide_form&&(e+="
"),e+="
"+a+this.locale.labels["section_"+t[n].name]+"
"+i.render.call(this,t[n]),e+="
"}}return e},gantt.resizeLightbox=function(){var t=this._lightbox;if(t){var e=t.childNodes[1];e.style.height="0px",e.style.height=e.scrollHeight+"px",t.style.height=e.scrollHeight+this.config.lightbox_additional_height+"px",e.style.height=e.scrollHeight+"px"}},gantt._center_lightbox=function(t){if(t){t.style.display="block";var e=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop,n=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft,i=window.innerHeight||document.documentElement.clientHeight;t.style.top=e?Math.round(e+Math.max((i-t.offsetHeight)/2,0))+"px":Math.round(Math.max((i-t.offsetHeight)/2,0)+9)+"px",t.style.left=document.documentElement.scrollWidth>document.body.offsetWidth?Math.round(n+(document.body.offsetWidth-t.offsetWidth)/2)+"px":Math.round((document.body.offsetWidth-t.offsetWidth)/2)+"px"}},gantt.showCover=function(){this._cover=document.createElement("DIV"),this._cover.className="dhx_cal_cover";var t=void 0!==document.height?document.height:document.body.offsetHeight,e=document.documentElement?document.documentElement.scrollHeight:0;this._cover.style.height=Math.max(t,e)+"px",document.body.appendChild(this._cover)},gantt._init_lightbox_events=function(){gantt.lightbox_events={},gantt.lightbox_events.dhx_save_btn=function(){gantt._save_lightbox()},gantt.lightbox_events.dhx_delete_btn=function(){gantt.callEvent("onLightboxDelete",[gantt._lightbox_id])&&gantt.$click.buttons["delete"](gantt._lightbox_id)},gantt.lightbox_events.dhx_cancel_btn=function(){gantt._cancel_lightbox()},gantt.lightbox_events["default"]=function(t,e){if(e.getAttribute("dhx_button"))gantt.callEvent("onLightboxButton",[e.className,e,t]);else{var n,i,a;-1!=e.className.indexOf("dhx_custom_button")&&(-1!=e.className.indexOf("dhx_custom_button_")?(n=e.parentNode.getAttribute("index"),a=e.parentNode.parentNode):(n=e.getAttribute("index"),a=e.parentNode,e=e.firstChild)),n&&(i=gantt.form_blocks[gantt.config.lightbox.sections[n].type],i.button_click(n,e,a,a.nextSibling))}},dhtmlxEvent(gantt.getLightbox(),"click",function(t){t=t||window.event;var e=t.target?t.target:t.srcElement;if(e.className||(e=e.previousSibling),e&&e.className&&0===e.className.indexOf("dhx_btn_set")&&(e=e.firstChild),e&&e.className){var n=dhtmlx.defined(gantt.lightbox_events[e.className])?gantt.lightbox_events[e.className]:gantt.lightbox_events["default"];return n(t,e)}return!1}),gantt.getLightbox().onkeydown=function(t){switch((t||event).keyCode){case gantt.keys.edit_save:if((t||event).shiftKey)return;gantt._save_lightbox();break;case gantt.keys.edit_cancel:gantt._cancel_lightbox()}}},gantt._cancel_lightbox=function(){this.callEvent("onLightboxCancel",[this._lightbox_id,this.$new]),this.hideLightbox()},gantt._save_lightbox=function(){var t=this.getLightboxValues();this.callEvent("onLightboxSave",[this._lightbox_id,t,!!t.$new])&&(t.$new?this.addTask(t):(dhtmlx.mixin(this.getTask(t.id),t,!0),this.updateTask(t.id)),this.refreshData(),this.hideLightbox())},gantt.getLightboxValues=function(){for(var t=dhtmlx.mixin({},this.getTask(this._lightbox_id)),e=this.config.lightbox.sections,n=0;n0&&(r+=" "),d){case"%Y":t._time_format_order[2]=o,t._time_format_order.size++,r+=" ";break;case"%m":t._time_format_order[1]=o,t._time_format_order.size++,r+="";break;case"%d":t._time_format_order[0]=o,t._time_format_order.size++,r+="";break;case"%H:%i":var a=1440,s=0;t._time_format_order[3]=o,t._time_format_order.size++,r+=""}}return r},_fill_lightbox_select:function(t,e,n,i){if(t[e+i[0]].value=n.getDate(),t[e+i[1]].value=n.getMonth(),t[e+i[2]].value=n.getFullYear(),dhtmlx.defined(i[3])){var a=60*n.getHours()+n.getMinutes();a=Math.round(a/gantt._get_timepicker_step())*gantt._get_timepicker_step(),t[e+i[3]].value=a}},template:{render:function(t){var e=(t.height||"30")+"px";return"
"},set_value:function(t,e){t.innerHTML=e||""},get_value:function(t){return t.innerHTML||""},focus:function(){}},textarea:{render:function(t){var e=(t.height||"130")+"px";return"
"},set_value:function(t,e){t.firstChild.value=e||""},get_value:function(t){return t.firstChild.value},focus:function(t){var e=t.firstChild;gantt._focus(e,!0)}},select:{render:function(t){for(var e=(t.height||"23")+"px",n="
"},set_value:function(t,e,n,i){var a=t.firstChild;!a._dhx_onchange&&i.onchange&&(a.onchange=i.onchange,a._dhx_onchange=!0),"undefined"==typeof e&&(e=(a.options[0]||{}).value),a.value=e||""},get_value:function(t){return t.firstChild.value},focus:function(t){var e=t.firstChild;gantt._focus(e,!0)}},time:{render:function(t){var e=this.form_blocks.getTimePicker.call(this,t),n="
"+e+"  –  "+e+"
";return n},set_value:function(t,e,n,i){function a(){var t=new Date(r[o[2]].value,r[o[1]].value,r[o[0]].value,0,0),e=new Date(t.getTime()+1e3*60*gantt.config.event_duration);this.form_blocks._fill_lightbox_select(r,o.size,e,o,s)}var s=this.config,r=t.getElementsByTagName("select"),o=i._time_format_order;if(i._time_format_size,s.auto_end_date&&s.event_duration)for(var d=0;4>d;d++)r[d].onchange=a;this.form_blocks._fill_lightbox_select(r,0,n.start_date,o,s),this.form_blocks._fill_lightbox_select(r,o.size,n.end_date,o,s)},get_value:function(t,e,n){var i=t.getElementsByTagName("select"),a=n._time_format_order,s=0,r=0;if(dhtmlx.defined(a[3])){var o=parseInt(i[a[3]].value,10);s=Math.floor(o/60),r=o%60}if(e.start_date=new Date(i[a[2]].value,i[a[1]].value,i[a[0]].value,s,r),s=r=0,dhtmlx.defined(a[3])){var o=parseInt(i[a.size+a[3]].value,10);s=Math.floor(o/60),r=o%60}return e.end_date=new Date(i[a[2]+a.size].value,i[a[1]+a.size].value,i[a[0]+a.size].value,s,r),e.end_date<=e.start_date&&(e.end_date=gantt.date.add(e.start_date,gantt._get_timepicker_step(),"minute")),{start_date:new Date(e.start_date),end_date:new Date(e.end_date)}},focus:function(t){gantt._focus(t.getElementsByTagName("select")[0])}},duration:{render:function(t){var e=this.form_blocks.getTimePicker.call(this,t);e="
"+e+"
";var n=this.locale.labels[this._tasks.unit+"s"],i="
"+n+"
",a="
"+e+" "+i+"
";return a},set_value:function(t,e,n,i){function a(){var e=gantt.form_blocks.duration._get_start_date.call(gantt,t,i),n=gantt.form_blocks.duration._get_duration.call(gantt,t,i),a=gantt.date.add(e,n,gantt._tasks.unit);_.innerHTML=gantt.templates.task_date(a)}function s(t){var e=l.value;e=parseInt(e,10),window.isNaN(e)&&(e=0),e+=t,1>e&&(e=1),l.value=e,a()}var r=this.config,o=t.getElementsByTagName("select"),d=t.getElementsByTagName("input"),l=d[1],h=[d[0],d[2]],_=t.getElementsByTagName("span")[0],c=i._time_format_order;h[0].onclick=dhtmlx.bind(function(){s(-1*this.config.duration_step)},this),h[1].onclick=dhtmlx.bind(function(){s(1*this.config.duration_step)},this),o[0].onchange=a,o[1].onchange=a,o[2].onchange=a,o[3]&&(o[3].onchange=a),l.onkeydown=dhtmlx.bind(function(t){t=t||window.event;var e=t.charCode||t.keyCode||t.which;return 40==e?(s(-1*this.config.duration_step),!1):38==e?(s(1*this.config.duration_step),!1):(window.setTimeout(function(){a() -},1),void 0)},this),l.onchange=dhtmlx.bind(function(){a()},this),this.form_blocks._fill_lightbox_select(o,0,n.start_date,c,r);var g,u=gantt._tasks.unit;g=n.end_date?(n.end_date.valueOf()-n.start_date.valueOf())/(1e3*this._get_line(u)):n.duration,g=Math.round(g),l.value=g,a()},_get_start_date:function(t,e){var n=t.getElementsByTagName("select"),i=e._time_format_order,a=0,s=0;if(dhtmlx.defined(i[3])){var r=parseInt(n[i[3]].value,10);a=Math.floor(r/60),s=r%60}return new Date(n[i[2]].value,n[i[1]].value,n[i[0]].value,a,s)},_get_duration:function(t){var e=t.getElementsByTagName("input")[1];return e=parseInt(e.value,10),window.isNaN(e)&&(e=1),0>e&&(e*=-1),e},get_value:function(t,e,n){e.start_date=this.form_blocks.duration._get_start_date(t,n);var i=this.form_blocks.duration._get_duration(t,n);return e.end_date=this.date.add(e.start_date,i,this._tasks.unit),e.duration=i,{start_date:new Date(e.start_date),end_date:new Date(e.end_date)}},focus:function(t){gantt._focus(t.getElementsByTagName("select")[0])}}},gantt._is_lightbox_timepicker=function(){for(var t=this.config.lightbox.sections,e=0;e
",this.$grid_scale=this.$grid.childNodes[0],this.$grid_data=this.$grid.childNodes[1],this.$task.innerHTML="
",this.$task_scale=this.$task.childNodes[0],this.$task_data=this.$task.childNodes[1],this.$task_bg=this.$task_data.childNodes[0],this.$task_links=this.$task_data.childNodes[1],this.$task_bars=this.$task_data.childNodes[2]},gantt.$click={buttons:{edit:function(t){gantt.showLightbox(t)},"delete":function(t){var e=gantt.locale.labels.confirm_deleting,n=gantt.locale.labels.confirm_deleting_title;gantt._dhtmlx_confirm(e,n,function(){gantt.deleteTask(t),gantt.hideLightbox()})}}},gantt._set_sizes=function(){this._x=this._obj.clientWidth,this._y=this._obj.clientHeight,this._x<20||this._y<20||(this.$grid.style.height=this.$task.style.height=this._y-this.$scroll_hor.offsetHeight-2+"px",this.$grid_data.style.height=this.$task_data.style.height=this._y-(this.config.scale_height||0)-this.$scroll_hor.offsetHeight-2+"px",this.$grid.style.width=this.config.grid_width-1+"px",this.$grid_data.style.width=this.config.grid_width-1+"px",this.$task.style.width=this._x-this.config.grid_width-2+"px")},gantt.getScrollState=function(){return{x:this.$task.scrollLeft,y:this.$task_data.scrollTop}},gantt.scrollTo=function(t,e){null!==t&&(this.$task.scrollLeft=t),null!==e&&(this.$task_data.scrollTop=e)},gantt._on_resize=gantt.setSizes=function(){gantt._set_sizes(),gantt._scroll_resize()},gantt.render=function(){if(this._render_grid(),this._render_tasks_scales(),this._scroll_resize(),this._on_resize(),this._render_data(),this.config.initial_scroll){var t=this._order[0]||0;t&&this.showTask(t)}},gantt._set_scroll_events=function(){dhtmlxEvent(this.$scroll_hor,"scroll",function(){if(!gantt._touch_scroll_active){var t=gantt.$scroll_hor.scrollLeft;gantt._scroll_task_area(t)}}),dhtmlxEvent(this.$scroll_ver,"scroll",function(){if(!gantt._touch_scroll_active){var t=gantt.$scroll_ver.scrollTop;gantt.$grid_data.scrollTop=t,gantt._scroll_task_area(null,t)}}),dhtmlxEvent(this.$task,"scroll",function(){var t=gantt.$task.scrollLeft;gantt.$scroll_hor.scrollLeft=t}),dhtmlxEvent(this.$task_data,"scroll",function(){var t=gantt.$task_data.scrollTop;gantt.$scroll_ver.scrollTop=gantt.$grid_data.scrollTop=t}),dhtmlxEvent(gantt.$container,"mousewheel",function(t){if(t.wheelDeltaX){var e=t.wheelDeltaX/-40,n=gantt.$task.scrollLeft+30*e;gantt._scroll_task_area(n,null),gantt.$scroll_hor.scrollTop=i}else{var e=t.wheelDelta/-40;"undefined"==typeof t.wheelDelta&&(e=t.detail);var i=gantt.$grid_data.scrollTop+30*e;gantt._scroll_task_area(null,i),gantt.$scroll_ver.scrollTop=i}return t.preventDefault&&t.preventDefault(),t.cancelBubble=!0,!1})},gantt._scroll_resize=function(){if(!(this._x<20||this._y<20)){var t=this.config.grid_width,e=this._x-t,n=this._y-this.config.scale_height,i=this.$task_data.offsetWidth-this.config.scroll_size,a=this.config.row_height*this._order.length,s=i>e,r=a>n;this.$scroll_hor.style.display=s?"block":"none",this.$scroll_hor.style.height=(s?this.config.scroll_size:0)+"px",this.$scroll_hor.style.width=this._x-(r?this.config.scroll_size:2)+"px",this.$scroll_hor.firstChild.style.width=i+t+this.config.scroll_size+2+"px",this.$scroll_ver.style.display=r?"block":"none",this.$scroll_ver.style.width=(r?this.config.scroll_size:0)+"px",this.$scroll_ver.style.height=this._y-(s?this.config.scroll_size:0)-this.config.scale_height+"px",this.$scroll_ver.style.top=this.config.scale_height+"px",this.$scroll_ver.firstChild.style.height=this.config.scale_height+a+"px"}},gantt.locate=function(t){var e=gantt._get_target_node(t);if("gantt_task_cell"==e.className)return null;for(var n=arguments[1]||this.config.task_attribute;e;){if(e.getAttribute){var i=e.getAttribute(n);if(i)return i}e=e.parentNode}return null},gantt._get_target_node=function(t){var e;return t.tagName?e=t:(t=t||window.event,e=t.target||t.srcElement),e},gantt._trim=function(t){var e=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};return e.apply(t)},gantt._locate_css=function(t,e,n){void 0===n&&(n=!0);for(var i=gantt._get_target_node(t),a="";i;){if(a=i.className){var s=a.indexOf(e);if(s>=0){if(!n)return i;var r=0===s||!gantt._trim(a.charAt(s-1)),o=s+e.length>=a.length||!gantt._trim(a.charAt(s+e.length));if(r&&o)return i}}i=i.parentNode}return null},gantt._locateHTML=function(t,e){var n=gantt._get_target_node(t);for(e=e||this.config.task_attribute;n;){if(n.getAttribute){var i=n.getAttribute(e);if(i)return n}n=n.parentNode}return null},gantt.getTaskRowNode=function(t){for(var e=this.$grid_data.childNodes,n=this.config.task_attribute,i=0;in?!0:t._on_timeout?!1:(setTimeout(function(){delete t._on_timeout},n),t._on_timeout=!0)},gantt.selectTask=function(t){if(this.config.select_task){if(t){if(this._selected_task==t)return this._selected_task;if(!this.callEvent("onBeforeTaskSelected",[t]))return!1;this.unselectTask(),this._selected_task=t,this.refreshTask(t),this.callEvent("onTaskSelected",[t])}return this._selected_task}},gantt.unselectTask=function(){var t=this._selected_task;t&&(this._selected_task=null,this.refreshTask(t),this.callEvent("onTaskUnselected",[t]))},gantt.getSelectedId=function(){return dhtmlx.defined(this._selected_task)?this._selected_task:null},gantt.date={init:function(){for(var t=gantt.locale.date.month_short,e=gantt.locale.date.month_short_hash={},n=0;nt?"0"+t:t},copy:function(t){return new Date(t.valueOf())},date_to_str:function(t,e){return t=t.replace(/%[a-zA-Z]/g,function(t){switch(t){case"%d":return'"+gantt.date.to_fixed(date.getDate())+"';case"%m":return'"+gantt.date.to_fixed((date.getMonth()+1))+"';case"%j":return'"+date.getDate()+"';case"%n":return'"+(date.getMonth()+1)+"';case"%y":return'"+gantt.date.to_fixed(date.getFullYear()%100)+"';case"%Y":return'"+date.getFullYear()+"';case"%D":return'"+gantt.locale.date.day_short[date.getDay()]+"';case"%l":return'"+gantt.locale.date.day_full[date.getDay()]+"';case"%M":return'"+gantt.locale.date.month_short[date.getMonth()]+"';case"%F":return'"+gantt.locale.date.month_full[date.getMonth()]+"';case"%h":return'"+gantt.date.to_fixed((date.getHours()+11)%12+1)+"';case"%g":return'"+((date.getHours()+11)%12+1)+"';case"%G":return'"+date.getHours()+"';case"%H":return'"+gantt.date.to_fixed(date.getHours())+"';case"%i":return'"+gantt.date.to_fixed(date.getMinutes())+"';case"%a":return'"+(date.getHours()>11?"pm":"am")+"';case"%A":return'"+(date.getHours()>11?"PM":"AM")+"';case"%s":return'"+gantt.date.to_fixed(date.getSeconds())+"';case"%W":return'"+gantt.date.to_fixed(gantt.date.getISOWeek(date))+"';default:return t}}),e&&(t=t.replace(/date\.get/g,"date.getUTC")),new Function("date",'return "'+t+'";')},str_to_date:function(t,e){for(var n="var temp=date.match(/[a-zA-Z]+|[0-9]+/g);",i=t.match(/%[a-zA-Z]/g),a=0;a50?1900:2000);";break;case"%g":case"%G":case"%h":case"%H":n+="set[3]=temp["+a+"]||0;";break;case"%i":n+="set[4]=temp["+a+"]||0;";break;case"%Y":n+="set[0]=temp["+a+"]||0;";break;case"%a":case"%A":n+="set[3]=set[3]%12+((temp["+a+"]||'').toLowerCase()=='am'?0:12);";break;case"%s":n+="set[5]=temp["+a+"]||0;";break;case"%M":n+="set[1]=gantt.locale.date.month_short_hash[temp["+a+"]]||0;";break;case"%F":n+="set[1]=gantt.locale.date.month_full_hash[temp["+a+"]]||0;"}var s="set[0],set[1],set[2],set[3],set[4],set[5]";return e&&(s=" Date.UTC("+s+")"),new Function("date","var set=[0,0,1,0,0,0]; "+n+" return new Date("+s+");")},getISOWeek:function(t){if(!t)return!1;var e=t.getDay();0===e&&(e=7);var n=new Date(t.valueOf());n.setDate(t.getDate()+(4-e));var i=n.getFullYear(),a=Math.round((n.getTime()-new Date(i,0,1).getTime())/864e5),s=1+Math.floor(a/7);return s},getUTCISOWeek:function(t){return this.getISOWeek(t)},convert_to_utc:function(t){return new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())},parseDate:function(t,e){return"string"==typeof t&&(dhtmlx.defined(e)&&(e="string"==typeof e?dhtmlx.defined(gantt.templates[e])?gantt.templates[e]:gantt.date.str_to_date(e):gantt.templates.xml_date),t=e(t)),t}},gantt.config||(gantt.config={}),gantt.config||(gantt.config={}),gantt.templates||(gantt.templates={}),function(){dhtmlx.mixin(gantt.config,{links:{finish_to_start:"0",start_to_start:"1",finish_to_finish:"2"},duration_unit:"day",min_duration:36e5,xml_date:"%d-%m-%Y %H:%i",api_date:"%d-%m-%Y %H:%i",start_on_monday:!0,server_utc:!1,show_progress:!0,fit_tasks:!1,select_task:!0,readonly:!1,date_grid:"%Y-%m-%d",drag_links:!0,drag_progress:!0,drag_resize:!0,drag_move:!0,drag_mode:{resize:"resize",progress:"progress",move:"move",ignore:"ignore"},round_dnd_dates:!0,link_wrapper_width:20,autofit:!0,columns:[{name:"text",tree:!0,width:"*"},{name:"start_date",align:"center"},{name:"duration",align:"center"},{name:"add",width:"44"}],step:1,scale_unit:"day",subscales:[],time_step:60,duration_step:1,date_scale:"%d %M",task_date:"%d %F %Y",time_picker:"%H:%i",task_attribute:"task_id",link_attribute:"link_id",buttons_left:["dhx_save_btn","dhx_cancel_btn"],buttons_right:["dhx_delete_btn"],lightbox:{sections:[{name:"description",height:70,map_to:"text",type:"textarea",focus:!0},{name:"time",height:72,type:"duration",map_to:"auto"}]},drag_lightbox:!0,sort:!1,details_on_create:!0,details_on_dblclick:!0,initial_scroll:!0,task_scroll_offset:100,task_height:"full",min_column_width:70}),gantt.keys={edit_save:13,edit_cancel:27},gantt._init_template=function(t,e){this.config[t]&&!this.config[t].$used&&(e&&this.templates[t]||(this.templates[t]=this.date.date_to_str(this.config[t])),this.config[t]=new String(this.config[t]),this.config[t].$used=!0)},gantt._init_templates=function(){var t=gantt.locale.labels;t.dhx_save_btn=t.icon_save,t.dhx_cancel_btn=t.icon_cancel,t.dhx_delete_btn=t.icon_delete;var e=this.date.date_to_str,n=this.config;gantt._init_template("date_scale",!0),gantt._init_template("date_grid",!0),gantt._init_template("task_date",!0),dhtmlx.mixin(this.templates,{xml_date:this.date.str_to_date(n.xml_date,n.server_utc),xml_format:e(n.xml_date,n.server_utc),api_date:this.date.str_to_date(n.api_date),progress_text:function(){return""},grid_header_class:function(){return""},task_text:function(t,e,n){return n.text},task_class:function(){return""},grid_row_class:function(){return""},task_row_class:function(){return""},task_cell_class:function(){return""},scale_cell_class:function(){return""},scale_row_class:function(){return""},task_class:function(){return""},grid_indent:function(){return"
"},grid_folder:function(t){return"
"},grid_file:function(){return"
"},grid_open:function(t){return"
"},grid_blank:function(){return"
"},task_time:function(t,e){return gantt.templates.task_date(t)+" - "+gantt.templates.task_date(e)},time_picker:e(n.time_picker),link_class:function(){return""},link_description:function(t){var e=gantt.getTask(t.source),n=gantt.getTask(t.target);return""+e.text+""+n.text+""},drag_link:function(t,e,n,i){t=gantt.getTask(t);var a=gantt.locale.labels,s=""+t.text+" "+(e?a.link_start:a.link_end)+"
";return n&&(n=gantt.getTask(n),s+=" "+n.text+" "+(i?a.link_start:a.link_end)+"
"),s},drag_link_class:function(t,e,n,i){var a="";if(t&&n){var s=gantt.isLinkAllowed(t,n,e,i);a=" "+(s?"gantt_link_allow":"gantt_link_deny")}return"gantt_link_tooltip"+a}}),this.callEvent("onTemplatesReady",[])}}(),window.jQuery&&!function(t){var e=[];t.fn.dhx_gantt=function(n){if("string"!=typeof n){var i=[];return this.each(function(){if(this&&this.getAttribute&&!this.getAttribute("dhxgantt")){for(var t in n)"data"!=t&&(gantt.config[t]=n[t]);gantt.init(this),n.data&&gantt.parse(n.data),i.push(gantt)}}),1===i.length?i[0]:i}return e[n]?e[n].apply(this,[]):(t.error("Method "+n+" does not exist on jQuery.dhx_gantt"),void 0)}}(jQuery),window.dhtmlx&&(dhtmlx.attaches||(dhtmlx.attaches={}),dhtmlx.attaches.attachGantt=function(t,e){var n=document.createElement("DIV");n.id="gantt_"+dhtmlx.uid(),n.style.width="100%",n.style.height="100%",n.cmp="grid",document.body.appendChild(n),this.attachObject(n.id);var i=this.vs[this.av];i.grid=gantt,gantt.init(n.id,t,e),n.firstChild.style.border="none",i.gridId=n.id,i.gridObj=n;var a="_viewRestore";return this.vs[this[a]()].grid}),gantt.locale={date:{month_full:["January","February","March","April","May","June","July","August","September","October","November","December"],month_short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],day_full:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],day_short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},labels:{new_task:"New task",icon_save:"Save",icon_cancel:"Cancel",icon_details:"Details",icon_edit:"Edit",icon_delete:"Delete",confirm_closing:"",confirm_deleting:"Task will be deleted permanently, are you sure?",section_description:"Description",section_time:"Time period",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years"}},gantt.skins.skyblue={config:{grid_width:350,row_height:27,scale_height:27,task_height:24,link_line_width:1,link_arrow_size:8,lightbox_additional_height:75},_second_column_width:95,_third_column_width:80},gantt.skins.meadow={config:{grid_width:350,row_height:27,scale_height:30,task_height:24,link_line_width:2,link_arrow_size:6,lightbox_additional_height:72},_second_column_width:95,_third_column_width:80},gantt.skins.terrace={config:{grid_width:360,row_height:35,scale_height:35,task_height:24,link_line_width:2,link_arrow_size:6,lightbox_additional_height:75},_second_column_width:90,_third_column_width:70},gantt.skins.broadway={config:{grid_width:360,row_height:35,scale_height:35,task_height:24,link_line_width:1,link_arrow_size:7,lightbox_additional_height:86},_second_column_width:90,_third_column_width:80,_lightbox_template:"
 
",_config_buttons_left:{},_config_buttons_right:{dhx_delete_btn:"icon_delete",dhx_save_btn:"icon_save"}},gantt.config.touch_drag=50,gantt.config.touch=!0,gantt._init_touch_events=function(){"force"!=this.config.touch&&(this.config.touch=this.config.touch&&(-1!=navigator.userAgent.indexOf("Mobile")||-1!=navigator.userAgent.indexOf("iPad")||-1!=navigator.userAgent.indexOf("Android")||-1!=navigator.userAgent.indexOf("Touch"))),this.config.touch&&(window.navigator.msPointerEnabled?this._touch_events(["MSPointerMove","MSPointerDown","MSPointerUp"],function(t){return t.pointerType==t.MSPOINTER_TYPE_MOUSE?null:t},function(t){return!t||t.pointerType==t.MSPOINTER_TYPE_MOUSE}):this._touch_events(["touchmove","touchstart","touchend"],function(t){return t.touches&&t.touches.length>1?null:t.touches[0]?{target:t.target,pageX:t.touches[0].pageX,pageY:t.touches[0].pageY}:t},function(){return!1}))},gantt._touch_events=function(t,e,n){function i(t){return t&&t.preventDefault&&t.preventDefault(),(t||event).cancelBubble=!0,!1}var a,s=0,r=!1,o=!1,d=null;this._gantt_touch_event_ready||(this._gantt_touch_event_ready=1,dhtmlxEvent(document.body,t[0],function(t){if(!n(t)&&r){var l=e(t);if(l&&d){var h=d.pageX-l.pageX,_=d.pageY-l.pageY;!o&&(Math.abs(h)>5||Math.abs(_)>5)&&(gantt._touch_scroll_active=o=!0,s=0,a=gantt.getScrollState()),o&&gantt.scrollTo(a.x+h,a.y+_)}return i(t)}})),dhtmlxEvent(this.$container,"contextmenu",function(t){return r?i(t):void 0}),dhtmlxEvent(this.$container,t[1],function(t){if(!n(t)){if(t.touches&&t.touches.length>1)return r=!1,void 0;if(r=!0,d=e(t),d&&s){var a=new Date;500>a-s?(gantt._on_dblclick(d),i(t)):s=a}else s=new Date}}),dhtmlxEvent(this.$container,t[2],function(t){n(t)||(gantt._touch_scroll_active=r=o=!1)})}; \ No newline at end of file +/* +dhtmlxGantt v.2.1.1 Standard This software is covered by GPL license. You also can obtain Commercial or Enterprise license to use it in non-GPL project - please contact sales@dhtmlx.com. Usage without proper license is prohibited. (c) Dinamenta, UAB. +*/ +function dtmlXMLLoaderObject(t,e,n,i){return this.xmlDoc="",this.async="undefined"!=typeof n?n:!0,this.onloadAction=t||null,this.mainObject=e||null,this.waitCall=null,this.rSeed=i||!1,this}function callerFunction(t,e){return this.handler=function(n){return n||(n=window.event),t(n,e),!0},this.handler}function getAbsoluteLeft(t){return getOffset(t).left}function getAbsoluteTop(t){return getOffset(t).top}function getOffsetSum(t){for(var e=0,n=0;t;)e+=parseInt(t.offsetTop),n+=parseInt(t.offsetLeft),t=t.offsetParent; +return{top:e,left:n}}function getOffsetRect(t){var e=t.getBoundingClientRect(),n=document.body,i=document.documentElement,a=window.pageYOffset||i.scrollTop||n.scrollTop,s=window.pageXOffset||i.scrollLeft||n.scrollLeft,r=i.clientTop||n.clientTop||0,o=i.clientLeft||n.clientLeft||0,d=e.top+a-r,l=e.left+s-o;return{top:Math.round(d),left:Math.round(l)}}function getOffset(t){return t.getBoundingClientRect?getOffsetRect(t):getOffsetSum(t)}function convertStringToBoolean(t){switch("string"==typeof t&&(t=t.toLowerCase()),t){case"1":case"true":case"yes":case"y":case 1:case!0:return!0; +default:return!1}}function getUrlSymbol(t){return-1!=t.indexOf("?")?"&":"?"}function dhtmlDragAndDropObject(){return window.dhtmlDragAndDrop?window.dhtmlDragAndDrop:(this.lastLanding=0,this.dragNode=0,this.dragStartNode=0,this.dragStartObject=0,this.tempDOMU=null,this.tempDOMM=null,this.waitDrag=0,window.dhtmlDragAndDrop=this,this)}function _dhtmlxError(){return this.catches||(this.catches=[]),this}function dhtmlXHeir(t,e){for(var n in e)"function"==typeof e[n]&&(t[n]=e[n]);return t}function dhtmlxEvent(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on"+e,n) +}function dhtmlxDetachEvent(t,e,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent&&t.detachEvent("on"+e,n)}function dhtmlxDnD(t,e){e&&(this._settings=e),dhtmlxEventable(this),dhtmlxEvent(t,"mousedown",dhtmlx.bind(function(e){this.dragStart(t,e)},this))}function dataProcessor(t){return this.serverProcessor=t,this.action_param="!nativeeditor_status",this.object=null,this.updatedRows=[],this.autoUpdate=!0,this.updateMode="cell",this._tMode="GET",this.post_delim="_",this._waitMode=0,this._in_progress={},this._invalid={},this.mandatoryFields=[],this.messages=[],this.styles={updated:"font-weight:bold;",inserted:"font-weight:bold;",deleted:"text-decoration : line-through;",invalid:"background-color:FFE0E0;",invalid_cell:"border-bottom:2px solid red;",error:"color:red;",clear:"font-weight:normal;text-decoration:none;"},this.enableUTFencoding(!0),dhtmlxEventable(this),this +}window.dhtmlx||(dhtmlx=function(t){for(var e in t)dhtmlx[e]=t[e];return dhtmlx}),dhtmlx.extend_api=function(t,e,n){var i=window[t];i&&(window[t]=function(t){var n;if(t&&"object"==typeof t&&!t.tagName){n=i.apply(this,e._init?e._init(t):arguments);for(var a in dhtmlx)e[a]&&this[e[a]](dhtmlx[a]);for(var a in t)e[a]?this[e[a]](t[a]):0===a.indexOf("on")&&this.attachEvent(a,t[a])}else n=i.apply(this,arguments);return e._patch&&e._patch(this),n||this},window[t].prototype=i.prototype,n&&dhtmlXHeir(window[t].prototype,n)) +},dhtmlxAjax={get:function(t,e){var n=new dtmlXMLLoaderObject(!0);return n.async=arguments.length<3,n.waitCall=e,n.loadXML(t),n},post:function(t,e,n){var i=new dtmlXMLLoaderObject(!0);return i.async=arguments.length<4,i.waitCall=n,i.loadXML(t,!0,e),i},getSync:function(t){return this.get(t,null,!0)},postSync:function(t,e){return this.post(t,e,null,!0)}},dtmlXMLLoaderObject.count=0,dtmlXMLLoaderObject.prototype.waitLoadFunction=function(t){var e=!0;return this.check=function(){if(t&&t.onloadAction&&(!t.xmlDoc.readyState||4==t.xmlDoc.readyState)){if(!e)return; +e=!1,dtmlXMLLoaderObject.count++,"function"==typeof t.onloadAction&&t.onloadAction(t.mainObject,null,null,null,t),t.waitCall&&(t.waitCall.call(this,t),t.waitCall=null)}},this.check},dtmlXMLLoaderObject.prototype.getXMLTopNode=function(t,e){var n;if(this.xmlDoc.responseXML){var i=this.xmlDoc.responseXML.getElementsByTagName(t);if(0===i.length&&-1!=t.indexOf(":"))var i=this.xmlDoc.responseXML.getElementsByTagName(t.split(":")[1]);n=i[0]}else n=this.xmlDoc.documentElement;if(n)return this._retry=!1,n; +if(!this._retry&&_isIE){this._retry=!0;var e=this.xmlDoc;return this.loadXMLString(this.xmlDoc.responseText.replace(/^[\s]+/,""),!0),this.getXMLTopNode(t,e)}return dhtmlxError.throwError("LoadXML","Incorrect XML",[e||this.xmlDoc,this.mainObject]),document.createElement("DIV")},dtmlXMLLoaderObject.prototype.loadXMLString=function(t,e){if(_isIE)this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM"),this.xmlDoc.async=this.async,this.xmlDoc.onreadystatechange=function(){},this.xmlDoc.loadXML(t);else{var n=new DOMParser; +this.xmlDoc=n.parseFromString(t,"text/xml")}e||(this.onloadAction&&this.onloadAction(this.mainObject,null,null,null,this),this.waitCall&&(this.waitCall(),this.waitCall=null))},dtmlXMLLoaderObject.prototype.loadXML=function(t,e,n,i){this.rSeed&&(t+=(-1!=t.indexOf("?")?"&":"?")+"a_dhx_rSeed="+(new Date).valueOf()),this.filePath=t,this.xmlDoc=!_isIE&&window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),this.async&&(this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this)),this.xmlDoc.open(e?"POST":"GET",t,this.async),i?(this.xmlDoc.setRequestHeader("User-Agent","dhtmlxRPC v0.1 ("+navigator.userAgent+")"),this.xmlDoc.setRequestHeader("Content-type","text/xml")):e&&this.xmlDoc.setRequestHeader("Content-type","application/x-www-form-urlencoded"),this.xmlDoc.setRequestHeader("X-Requested-With","XMLHttpRequest"),this.xmlDoc.send(null||n),this.async||new this.waitLoadFunction(this)() +},dtmlXMLLoaderObject.prototype.destructor=function(){return this._filterXPath=null,this._getAllNamedChilds=null,this._retry=null,this.async=null,this.rSeed=null,this.filePath=null,this.onloadAction=null,this.mainObject=null,this.xmlDoc=null,this.doXPath=null,this.doXPathOpera=null,this.doXSLTransToObject=null,this.doXSLTransToString=null,this.loadXML=null,this.loadXMLString=null,this.doSerialization=null,this.xmlNodeToJSON=null,this.getXMLTopNode=null,this.setXSLParamValue=null,null},dtmlXMLLoaderObject.prototype.xmlNodeToJSON=function(t){for(var e={},n=0;n_FFrv)&&window.dhtmlDragAndDrop.calculateFramePosition()); +try{parent.dhtmlDragAndDrop&&parent!=window&&parent!=t&&parent.dhtmlDragAndDrop.initFrameRoute(window)}catch(n){}for(var i=0;i-1&&(_isChrome=!0),-1!=navigator.userAgent.indexOf("Safari")||-1!=navigator.userAgent.indexOf("Konqueror")?(_KHTMLrv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Safari")+7,5)),_KHTMLrv>525?(_isFF=!0,_FFrv=1.9):_isKHTML=!0):-1!=navigator.userAgent.indexOf("Opera")?(_isOpera=!0,_OperaRv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Opera")+6,3))):-1!=navigator.appName.indexOf("Microsoft")?(_isIE=!0,-1==navigator.appVersion.indexOf("MSIE 8.0")&&-1==navigator.appVersion.indexOf("MSIE 9.0")&&-1==navigator.appVersion.indexOf("MSIE 10.0")||"BackCompat"==document.compatMode||(_isIE=8)):"Netscape"==navigator.appName&&-1!=navigator.userAgent.indexOf("Trident")?_isIE=8:(_isFF=!0,_FFrv=parseFloat(navigator.userAgent.split("rv:")[1])),dtmlXMLLoaderObject.prototype.doXPath=function(t,e,n,i){if(_isKHTML||!_isIE&&!window.XPathResult)return this.doXPathOpera(t,e); +if(_isIE)return e||(e=this.xmlDoc.nodeName?this.xmlDoc:this.xmlDoc.responseXML),e||dhtmlxError.throwError("LoadXML","Incorrect XML",[e||this.xmlDoc,this.mainObject]),n&&e.setProperty("SelectionNamespaces","xmlns:xsl='"+n+"'"),"single"==i?e.selectSingleNode(t):e.selectNodes(t)||new Array(0);var a=e;e||(e=this.xmlDoc.nodeName?this.xmlDoc:this.xmlDoc.responseXML),e||dhtmlxError.throwError("LoadXML","Incorrect XML",[e||this.xmlDoc,this.mainObject]),-1!=e.nodeName.indexOf("document")?a=e:(a=e,e=e.ownerDocument); +var s=XPathResult.ANY_TYPE;"single"==i&&(s=XPathResult.FIRST_ORDERED_NODE_TYPE);var r=[],o=e.evaluate(t,a,function(){return n},s,null);if(s==XPathResult.FIRST_ORDERED_NODE_TYPE)return o.singleNodeValue;for(var d=o.iterateNext();d;)r[r.length]=d,d=o.iterateNext();return r},_dhtmlxError.prototype.catchError=function(t,e){this.catches[t]=e},_dhtmlxError.prototype.throwError=function(t,e,n){return this.catches[t]?this.catches[t](t,e,n):this.catches.ALL?this.catches.ALL(t,e,n):(window.alert("Error type: "+arguments[0]+"\nDescription: "+arguments[1]),null) +},window.dhtmlxError=new _dhtmlxError,dtmlXMLLoaderObject.prototype.doXPathOpera=function(t,e){var n=t.replace(/[\/]+/gi,"/").split("/"),i=null,a=1;if(!n.length)return[];if("."==n[0])i=[e];else{if(""!==n[0])return[];i=(this.xmlDoc.responseXML||this.xmlDoc).getElementsByTagName(n[a].replace(/\[[^\]]*\]/g,"")),a++}for(a;a
"+t+"
"}function a(t){g.area||(g.area=document.createElement("DIV"),g.area.className="dhtmlx_message_area",g.area.style[g.position]="5px",document.body.appendChild(g.area)),g.hide(t.id);var e=document.createElement("DIV");return e.innerHTML="
"+t.text+"
",e.className="dhtmlx-info dhtmlx-"+t.type,e.onclick=function(){g.hide(t.id),t=null +},"bottom"==g.position&&g.area.firstChild?g.area.insertBefore(e,g.area.firstChild):g.area.appendChild(e),t.expire>0&&(g.timers[t.id]=window.setTimeout(function(){g.hide(t.id)},t.expire)),g.pull[t.id]=e,e=null,t.id}function s(e,n,a){var s=document.createElement("DIV");s.className=" dhtmlx_modal_box dhtmlx-"+e.type,s.setAttribute("dhxbox",1);var r="";if(e.width&&(s.style.width=e.width),e.height&&(s.style.height=e.height),e.title&&(r+='
'+e.title+"
"),r+='
'+(e.content?"":e.text)+'
',n&&(r+=i(e.ok||"OK",!0)),a&&(r+=i(e.cancel||"Cancel",!1)),e.buttons)for(var o=0;othis.config.sensitivity){if(this.config.started=!0,this.config.ignore=!1,this.callEvent("onBeforeDragStart",[t,e])===!1)return this.config.ignore=!0,!0;var r=this.config.marker=document.createElement("div");r.className="gantt_drag_marker",r.innerHTML="Dragging object",document.body.appendChild(r),this.callEvent("onAfterDragStart",[t,e])}else this.config.ignore=!0}this.config.ignore||(e.pos=this.getPosition(e),this.config.marker.style.left=e.pos.x+"px",this.config.marker.style.top=e.pos.y+"px",this.callEvent("onDragMove",[t,e])) +},dragEnd:function(){this.config.marker&&(this.config.marker.parentNode.removeChild(this.config.marker),this.config.marker=null,this.callEvent("onDragEnd",[])),document.body.className=document.body.className.replace(" gantt_noselect","")},getPosition:function(t){var e=0,n=0;return t=t||window.event,t.pageX||t.pageY?(e=t.pageX,n=t.pageY):(t.clientX||t.clientY)&&(e=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,n=t.clientY+document.body.scrollTop+document.documentElement.scrollTop),{x:e,y:n} +}},gantt._init_grid=function(){this._click.gantt_close=dhtmlx.bind(function(t,e){this.close(e)},this),this._click.gantt_open=dhtmlx.bind(function(t,e){this.open(e)},this),this._click.gantt_row=dhtmlx.bind(function(t,e,n){if(null!==e){var i=this.getTaskNode(e),a=Math.max(i.offsetLeft-this.config.task_scroll_offset,0);this.scrollTo(a),this.callEvent("onTaskRowClick",[e,n])}},this),this._click.gantt_grid_head_cell=dhtmlx.bind(function(t,e,n){var i=n.getAttribute("column_id");if(this.callEvent("onGridHeaderClick",[i,t]))if("add"==i)this._click.gantt_add(t,this.config.root_id); +else if(this.config.sort){var a=this._sort&&this._sort.direction&&this._sort.name==i?this._sort.direction:"desc";a="desc"==a?"asc":"desc",this._sort={name:i,direction:a},this._render_grid_header(),this.sort(i,"desc"==a)}},this),!this.config.sort&&this.config.order_branch&&this._init_dnd(),this._click.gantt_add=dhtmlx.bind(function(t,e){if(!this.config.readonly){var n=e?this.getTask(e):!1,i="";if(n)i=n.start_date;else{var a=this._order[0];i=a?this.getTask(a).start_date:this.getState().min_date}n&&(n.$open=!0); +var s={text:gantt.locale.labels.new_task,start_date:this.templates.xml_format(i),duration:1,progress:0,parent:e};s.id=dhtmlx.uid(),this.callEvent("onTaskCreated",[s]),this.config.details_on_create?(s.$new=!0,this._pull[s.id]=this._init_task(s),this._add_branch(s),s.$level=this._item_level(s),this.selectTask(s.id),this.refreshData(),this.showLightbox(s.id)):(this.addTask(s),this.showTask(s.id),this.selectTask(s.id))}},this)},gantt._render_grid=function(){this._is_grid_visible()&&(this._calc_grid_width(),this._render_grid_header()) +},gantt._calc_grid_width=function(){if(this.config.autofit){for(var t=this.config.columns,e=0,n=[],i=[],a=0;a0?n.length:i.length>0?i.length:1)}if(n.length>0)for(var o=r/(n.length?n.length:1),a=0;an+o.width&&(o.width=this._get_grid_width()-n),n+=o.width;var d=this._sort&&o.name==this._sort.name?"
":"",l=["gantt_grid_head_cell","gantt_grid_head_"+o.name,r?"gantt_last_cell":"",this.templates.grid_header_class(o.name,o)].join(" "),_="width:"+(o.width-(r?1:0))+"px;",h=o.label||i["column_"+o.name];h=h||"";var c="
"+h+d+"
";e.push(c)}this.$grid_scale.style.height=this.config.scale_height-1+"px",this.$grid_scale.style.lineHeight=a+"px",this.$grid_scale.style.width=n-1+"px",this.$grid_scale.innerHTML=e.join("") +},gantt._render_grid_item=function(t){if(!gantt._is_grid_visible())return null;for(var e=this.config.columns,n=[],i=0;i
":(s=o.template?o.template(t):t[o.name],s instanceof Date&&(s=this.templates.date_grid(s)),s="
"+s+"
");var d="gantt_cell"+(r?" gantt_last_cell":""),l="";if(o.tree){for(var _=0;_0; +h?(l+=this.templates.grid_open(t),l+=this.templates.grid_folder(t)):(l+=this.templates.grid_blank(t),l+=this.templates.grid_file(t))}var c="width:"+(o.width-(r?1:0))+"px;";dhtmlx.defined(o.align)&&(c+="text-align:"+o.align+";"),a="
"+l+s+"
",n.push(a)}var d=t.$index%2===0?"":" odd";if(d+=t.$transparent?" gantt_transparent":"",this.templates.grid_row_class){var g=this.templates.grid_row_class.call(this,t.start_date,t.end_date,t);g&&(d+=" "+g)}this.getState().selected_task==t.id&&(d+=" gantt_selected"); +var u=document.createElement("div");return u.className="gantt_row"+d,u.style.height=this.config.row_height+"px",u.style.lineHeight=gantt.config.row_height+"px",u.setAttribute(this.config.task_attribute,t.id),u.innerHTML=n.join(""),u},gantt.open=function(t){gantt._set_item_state(t,!0),this.callEvent("onTaskOpened",[t])},gantt.close=function(t){gantt._set_item_state(t,!1),this.callEvent("onTaskClosed",[t])},gantt._set_item_state=function(t,e){t&&this._pull[t]&&(this._pull[t].$open=e,this.refreshData()) +},gantt._is_grid_visible=function(){return this.config.grid_width&&this.config.show_grid},gantt._get_grid_width=function(){return this._is_grid_visible()?this._is_chart_visible()?this.config.grid_width:this._x:0},gantt.getTaskIndex=function(t){for(var e=this._branches[this.getTask(t).parent],n=0;nr&&e--}this._replace_branch_child(a.parent,t),s=this._branches[n];var o=s[e];o?s=s.slice(0,e).concat([t]).concat(s.slice(e)):s.push(t),a.parent=n,this._branches[n]=s,this.refreshData()},gantt._init_dnd=function(){var t=new dhtmlxDnD(this.$grid_data,{updates_per_second:60});dhtmlx.defined(this.config.dnd_sensitivity)&&(t.config.sensitivity=this.config.dnd_sensitivity),t.attachEvent("onBeforeDragStart",dhtmlx.bind(function(t,e){var n=this._locateHTML(e); +if(!n)return!1;this.hideQuickInfo&&this._hideQuickInfo();var i=this.locate(e);return this.callEvent("onRowDragStart",[i,e.target||e.srcElement,e])?void 0:!1},this)),t.attachEvent("onAfterDragStart",dhtmlx.bind(function(e,n){var i=this._locateHTML(n);t.config.marker.innerHTML=i.outerHTML,t.config.id=this.locate(n);var a=this.getTask(t.config.id);a.$open=!1,a.$transparent=!0,this.refreshData()},this)),t.lastTaskOfLevel=function(t){for(var e=gantt._order,n=gantt._pull,i=null,a=0,s=e.length;s>a;a++)n[e[a]].$level==t&&(i=n[e[a]]); +return i?i.id:null},t.attachEvent("onDragMove",dhtmlx.bind(function(e,n){var i=t.config,a=this._get_position(this.$grid_data),s=a.x+10,r=n.pos.y-10;ra.y+this.$grid_data.offsetHeight-this.config.row_height&&(r=a.y+this.$grid_data.offsetHeight-this.config.row_height),i.marker.style.left=s+"px",i.marker.style.top=r+"px";var o=document.elementFromPoint(a.x-document.body.scrollLeft+1,r-document.body.scrollTop),d=this.locate(o),l=this.getTask(t.config.id);if(this.isTaskExists(d)||(d=t.lastTaskOfLevel(l.$level),d==t.config.id&&(d=null)),this.isTaskExists(d)){var _=gantt._get_position(o),h=this.getTask(d); +if(_.y+o.offsetHeight/2=a;a++)i+=t[a];return i},setSumWidth:function(t,e,n,i){var a=e.width;void 0===i&&(i=a.length-1),void 0===n&&(n=0);var s=i-n+1;if(!(n>a.length-1||0>=s||i>a.length-1)){var r=this.getSum(a,n,i),o=t-r; +this.adjustSize(o,a,n,i),this.adjustSize(-o,a,i+1),e.full_width=this.getSum(a)}},splitSize:function(t,e){for(var n=[],i=0;e>i;i++)n[i]=0;return this.adjustSize(t,n),n},adjustSize:function(t,e,n,i){n||(n=0),void 0===i&&(i=e.length-1);for(var a=i-n+1,s=this.getSum(e,n,i),r=0,o=n;i>=o;o++){var d=Math.floor(t*(s?e[o]/s:1/a));s-=e[o],t-=d,a--,e[o]+=d,r+=d}e[e.length-1]+=t},sortScales:function(t){function e(t,e){var n=new Date(1970,0,1);return gantt.date.add(n,e,t)-n}t.sort(function(t,n){return e(t.unit,t.step)=0;o--){var d=o==t.length-1,l=this.initScaleConfig(t[o]);d&&this.processIgnores(l),this.initColSizes(l,e,s,a[o]),this.limitVisibleRange(l),d&&(s=l.full_width),r.unshift(l)}for(var o=0;o=h;h++)+r[h]!=+s[_]||(a&&a.apply(this,[l,_,o,h]),o=h,l=_)},alineScaleColumns:function(t,e,n,i){this.iterateScales(t,e,n,i,function(n,i,a,s){var r=this.getSum(t.width,a,s-1),o=this.getSum(e.width,n,i-1);o!=r&&this.setSumWidth(r,e,n,i-1)})},eachColumn:function(t,e,n){var i=new Date(gantt._min_date),a=new Date(gantt._max_date);gantt.date[t+"_start"]&&(i=gantt.date[t+"_start"](i)); +for(var s=new Date(i);+a>+s;)n.call(this,new Date(s)),s=gantt.date.add(s,e,t)},limitVisibleRange:function(t){var e=t.trace_x,n=0,i=t.width.length-1,a=0;if(+e[0]<+gantt._min_date&&n!=i){var s=Math.floor(t.width[0]*((e[1]-gantt._min_date)/(e[1]-e[0])));a+=t.width[0]-s,t.width[0]=s,e[0]=new Date(gantt._min_date)}var r=e.length-1,o=e[r],d=gantt.date.add(o,t.step,t.unit);if(+d>+gantt._max_date&&r>0){var s=t.width[r]-Math.floor(t.width[r]*((d-gantt._max_date)/(d-o)));a+=t.width[r]-s,t.width[r]=s}if(a){for(var l=this.getSum(t.width),_=0,h=0;ht.x?this.dirs.right:e.y>t.y?this.dirs.down:this.dirs.up +}},gantt._y_from_ind=function(t){return t*gantt.config.row_height},gantt._path_builder={path:[],clear:function(){this.path=[]},current:function(){return this.path[this.path.length-1]},point:function(t){return t?(this.path.push(dhtmlx.copy(t)),t):this.current()},point_to:function(t,e,n){n=n?{x:n.x,y:n.y}:dhtmlx.copy(this.point());var i=gantt._drawer.dirs;switch(t){case i.left:n.x-=e;break;case i.right:n.x+=e;break;case i.up:n.y-=e;break;case i.down:n.y+=e}return this.point(n)},get_points:function(t){var e=this.get_endpoint(t),n=gantt.config,i=e.e_y-e.y,a=e.e_x-e.x,s=gantt._drawer.dirs; +this.clear(),this.point({x:e.x,y:e.y});var r=2*n.link_arrow_size,o=e.e_x>e.x;if(t.type==gantt.config.links.start_to_start)this.point_to(s.left,r),o?(this.point_to(s.down,i),this.point_to(s.right,a)):(this.point_to(s.right,a),this.point_to(s.down,i)),this.point_to(s.right,r);else if(t.type==gantt.config.links.finish_to_start)if(o=e.e_x>e.x+2*r,this.point_to(s.right,r),o)a-=r,this.point_to(s.down,i),this.point_to(s.right,a);else{a-=2*r;var d=i>0?1:-1;this.point_to(s.down,d*(n.row_height/2)),this.point_to(s.right,a),this.point_to(s.down,d*(Math.abs(i)-n.row_height/2)),this.point_to(s.right,r) +}else if(t.type==gantt.config.links.finish_to_finish)this.point_to(s.right,r),o?(this.point_to(s.right,a),this.point_to(s.down,i)):(this.point_to(s.down,i),this.point_to(s.right,a)),this.point_to(s.left,r);else if(t.type==gantt.config.links.start_to_finish)if(o=e.e_x>e.x-2*r,this.point_to(s.left,r),o){a+=2*r;var d=i>0?1:-1;this.point_to(s.down,d*(n.row_height/2)),this.point_to(s.right,a),this.point_to(s.down,d*(Math.abs(i)-n.row_height/2)),this.point_to(s.left,r)}else a+=r,this.point_to(s.down,i),this.point_to(s.right,a); +return this.path},get_endpoint:function(t){var e=gantt.config.links,n=!1,i=!1;t.type==e.start_to_start?n=i=!0:t.type==e.finish_to_finish?n=i=!1:t.type==e.finish_to_start?(n=!1,i=!0):t.type==e.start_to_finish?(n=!0,i=!1):dhtmlx.assert(!1,"Invalid link type");var a=gantt._get_task_visible_pos(gantt._pull[t.source],n),s=gantt._get_task_visible_pos(gantt._pull[t.target],i);return{x:a.x,e_x:s.x,y:a.y,e_y:s.y}}},gantt._init_links_dnd=function(){function t(t,e,n){var i=gantt._get_task_pos(t,!!e);return i.y+=gantt._get_task_height()/2,n=n||0,i.x+=(e?-1:1)*n,i +}function e(t){var e=i(),n=["gantt_link_tooltip"];e.from&&e.to&&n.push(gantt.isLinkAllowed(e.from,e.to,e.from_start,e.to_start)?"gantt_allowed_link":"gantt_invalid_link");var a=gantt.templates.drag_link_class(e.from,e.from_start,e.to,e.to_start);a&&n.push(a);var s="
"+gantt.templates.drag_link(e.from,e.from_start,e.to,e.to_start)+"
";t.innerHTML=s}function n(t,e){t.style.left=e.x+5+"px",t.style.top=e.y+5+"px"}function i(){return{from:gantt._link_source_task,to:gantt._link_target_task,from_start:gantt._link_source_task_start,to_start:gantt._link_target_task_start} +}function a(){gantt._link_source_task=gantt._link_source_task_start=gantt._link_target_task=null,gantt._link_target_task_start=!0}function s(t,e,n,a){var s=d(),l=i(),_=["gantt_link_direction"];gantt.templates.link_direction_class&&_.push(gantt.templates.link_direction_class(l.from,l.from_start,l.to,l.to_start));var h=Math.sqrt(Math.pow(n-t,2)+Math.pow(a-e,2));if(h=Math.max(0,h-3)){s.className=_.join(" ");var c=(a-e)/(n-t),g=Math.atan(c);2==o(t,n,e,a)?g+=Math.PI:3==o(t,n,e,a)&&(g-=Math.PI);var u=Math.sin(g),f=Math.cos(g),p=Math.round(e),m=Math.round(t),v=["-webkit-transform: rotate("+g+"rad)","-moz-transform: rotate("+g+"rad)","-ms-transform: rotate("+g+"rad)","-o-transform: rotate("+g+"rad)","transform: rotate("+g+"rad)","width:"+Math.round(h)+"px"]; +if(-1!=window.navigator.userAgent.indexOf("MSIE 8.0")){v.push('-ms-filter: "'+r(u,f)+'"');var k=Math.abs(Math.round(t-n)),x=Math.abs(Math.round(a-e));switch(o(t,n,e,a)){case 1:p-=x;break;case 2:m-=k,p-=x;break;case 3:m-=k}}v.push("top:"+p+"px"),v.push("left:"+m+"px"),s.style.cssText=v.join(";")}}function r(t,e){return"progid:DXImageTransform.Microsoft.Matrix(M11 = "+e+",M12 = -"+t+",M21 = "+t+",M22 = "+e+",SizingMethod = 'auto expand')"}function o(t,e,n,i){return e>=t?n>=i?1:4:n>=i?2:3}function d(){return _._direction||(_._direction=document.createElement("div"),gantt.$task_links.appendChild(_._direction)),_._direction +}function l(){_._direction&&(_._direction.parentNode&&_._direction.parentNode.removeChild(_._direction),_._direction=null)}var _=new dhtmlxDnD(this.$task_bars,{sensitivity:0,updates_per_second:60}),h="task_left",c="task_right",g="gantt_link_point",u="gantt_link_control";_.attachEvent("onBeforeDragStart",dhtmlx.bind(function(e,n){if(gantt.config.readonly)return!1;var i=n.target||n.srcElement;if(a(),gantt.getState().drag_id)return!1;if(gantt._locate_css(i,g)){gantt._locate_css(i,h)&&(gantt._link_source_task_start=!0); +var s=gantt._link_source_task=this.locate(n),r=gantt.getTask(s),o=0;return r.type==gantt.config.types.milestone&&(o=(gantt._get_visible_milestone_width()-gantt._get_milestone_width())/2),this._dir_start=t(r,!!gantt._link_source_task_start,o),!0}return!1},this)),_.attachEvent("onAfterDragStart",dhtmlx.bind(function(){e(_.config.marker)},this)),_.attachEvent("onDragMove",dhtmlx.bind(function(i,a){var r=_.config,o=_.getPosition(a);n(r.marker,o);var d=gantt._is_link_drop_area(a),l=gantt._link_target_task,h=gantt._link_landing,g=gantt._link_target_task_start,f=gantt.locate(a),p=!0; +if(d&&(p=!gantt._locate_css(a,c),d=!!f),gantt._link_target_task=f,gantt._link_landing=d,gantt._link_target_task_start=p,d){var m=gantt.getTask(f),v=gantt._locate_css(a,u),k=0;v&&(k=Math.floor(v.offsetWidth/2)),this._dir_end=t(m,!!gantt._link_target_task_start,k)}else this._dir_end=gantt._get_mouse_pos(a);var x=!(h==d&&l==f&&g==p);return x&&(l&&gantt.refreshTask(l,!1),f&&gantt.refreshTask(f,!1)),x&&e(r.marker),s(this._dir_start.x,this._dir_start.y,this._dir_end.x,this._dir_end.y),!0},this)),_.attachEvent("onDragEnd",dhtmlx.bind(function(){var t=i(); +if(t.from&&t.to&&t.from!=t.to){var e=gantt._get_link_type(t.from_start,t.to_start);e&&gantt.addLink({source:t.from,target:t.to,type:e})}a(),t.from&&gantt.refreshTask(t.from,!1),t.to&&gantt.refreshTask(t.to,!1),l()},this)),gantt._is_link_drop_area=function(t){return!!gantt._locate_css(t,u)}},gantt._get_link_state=function(){return{link_landing_area:this._link_landing,link_target_id:this._link_target_task,link_target_start:this._link_target_task_start,link_source_id:this._link_source_task,link_source_start:this._link_source_task_start} +},gantt._init_tasks=function(){function t(t,e,n,i){for(var a=0;a-1?i.$target[0]:i.$source[0]),a&&this._delete_link_handler(a,t),!1},this),this._tasks_dnd.init(),this._init_links_dnd();var e=this._create_filter("_filter_task","_is_grid_visible"),n=this._create_filter("_filter_task","_is_chart_visible"),i=this._create_filter("_filter_link","_is_chart_visible");this._taskRenderer=gantt._task_renderer("line",this._render_task_element,this.$task_bars,n),this._linkRenderer=gantt._task_renderer("links",this._render_link_element,this.$task_links,i),this._gridRenderer=gantt._task_renderer("grid_items",this._render_grid_item,this.$grid_data,e),this._bgRenderer=gantt._task_renderer("bg_lines",this._render_bg_line,this.$task_bg,n),this.attachEvent("onTaskIdChange",function(e,n){var i=this._get_task_renderers(); +t(i,e,n,this.getTask(n))}),this.attachEvent("onLinkIdChange",function(e,n){var i=this._get_link_renderers();t(i,e,n,this.getLink(n))})},gantt._create_filter=function(t){return t instanceof Array||(t=Array.prototype.slice.call(arguments,0)),function(e){for(var n=!0,i=0,a=t.length;a>i;i++){var s=t[i];gantt[s]&&(n=n&&gantt[s].apply(gantt,[e.id,e])!==!1)}return n}},gantt._is_chart_visible=function(){return!!this.config.show_chart},gantt._filter_task=function(t,e){var n=null,i=null;return this.config.start_date&&this.config.end_date&&(n=this.config.start_date.valueOf(),i=this.config.end_date.valueOf(),+e.start_date>i||+e.end_date<+n)?!1:!0 +},gantt._filter_link=function(t,e){return this.config.show_links&&gantt.isTaskVisible(e.source)&&gantt.isTaskVisible(e.target)?this.callEvent("onBeforeLinkDisplay",[t,e]):!1},gantt._get_task_renderers=function(){return[this._taskRenderer,this._gridRenderer,this._bgRenderer]},gantt._get_link_renderers=function(){return[this._linkRenderer]},gantt._delete_link_handler=function(t,e){if(t&&this.callEvent("onLinkDblClick",[t,e])){if(this.config.readonly)return;var n="",i=gantt.locale.labels.link+" "+this.templates.link_description(this.getLink(t))+" "+gantt.locale.labels.confirm_link_deleting; +window.setTimeout(function(){gantt._dhtmlx_confirm(i,n,function(){gantt.deleteLink(t)})},gantt.config.touch?300:1)}},gantt.getTaskNode=function(t){return this._taskRenderer.rendered[t]},gantt.getLinkNode=function(t){return this._linkRenderer.rendered[t]},gantt._get_tasks_data=function(){for(var t=[],e=0;e+i&&(i=new Date(t.end_date))},this.config.root_id),this.eachTask(function(t){t.start_date&&+t.start_date<+a&&(a=new Date(t.start_date)) +},this.config.root_id),this._min_date=a,this._max_date=i,i&&i!=-1/0||(this._min_date=new Date,this._max_date=new Date(this._min_date)),this._min_date=this.date[t+"_start"](this._min_date),+this._min_date==+a&&(this._min_date=this.date.add(this.date[t+"_start"](this._min_date),-1,t)),this._max_date=this.date[t+"_start"](this._max_date),this._max_date=this.date.add(this._max_date,1,t)},gantt._prepare_scale_html=function(t){var e=[],n=null,i=null,a=null;(t.template||t.date)&&(i=t.template||this.date.date_to_str(t.date)),a=t.css||gantt.templates.scale_cell_class; +for(var s=0;s"+r+"";e.push(h)}}return e.join("")},gantt._render_tasks_scales=function(){this._init_tasks_range(),this._scroll_resize(),this._set_sizes();var t="",e=0,n=0,i=0;if(this._is_chart_visible()){var a=this._scale_helpers,s=[a.primaryScale()].concat(this.config.subscales); +i=this.config.scale_height-1,a.sortScales(s);for(var r=this._get_resize_options(),o=r.x?0:this.$task.offsetWidth,d=a.prepareConfigs(s,this.config.min_column_width,o,i),l=this._tasks=d[d.length-1],_=[],h=this.templates.scale_row_class,c=0;c'+this._prepare_scale_html(d[c])+"")}t=_.join(""),e=l.full_width+this.$scroll_ver.offsetWidth+"px",n=l.full_width+"px",i+="px" +}this.$task.style.display=this._is_chart_visible()?"":"none",this.$task_scale.style.height=i,this.$task_data.style.width=this.$task_scale.style.width=e,this.$task_links.style.width=this.$task_bars.style.width=n,this.$task_scale.innerHTML=t},gantt._render_bg_line=function(t){var e=gantt._tasks,n=e.count,i=[];if(gantt.config.show_task_cells)for(var a=0;n>a;a++){var s=e.width[a],r="",o="";if(s>0){r="width:"+s+"px;",o="gantt_task_cell"+(a==n-1?" gantt_last_cell":""),_=this.templates.task_cell_class(t,e.trace_x[a]),_&&(o+=" "+_); +var d="
";i.push(d)}}var l=t.$index%2!==0,_=gantt.templates.task_row_class(t.start_date,t.end_date,t),h="gantt_task_row"+(l?" odd":"")+(_?" "+_:"");this.getState().selected_task==t.id&&(h+=" gantt_selected");var c=document.createElement("div");return c.className=h,c.style.height=gantt.config.row_height+"px",c.setAttribute(this.config.task_attribute,t.id),c.innerHTML=i.join(""),c},gantt._adjust_scales=function(){if(this.config.fit_tasks){var t=+this._min_date,e=+this._max_date; +if(this._init_tasks_range(),+this._min_date!=t||+this._max_date!=e)return this.render(),this.callEvent("onScaleAdjusted",[]),!0}return!1},gantt.refreshTask=function(t,e){var n=this._get_task_renderers(),i=this.getTask(t);if(i&&this.isTaskVisible(t))for(var a=0;a=+a.min_date&&t.appendChild(i(e+" task_left"))},gantt._get_task_height=function(){var t=this.config.task_height;return"full"==t&&(t=this.config.row_height-5),t=Math.min(t,this.config.row_height),Math.max(t,0)},gantt._get_milestone_width=function(){return this._get_task_height()},gantt._get_visible_milestone_width=function(){var t=gantt._get_task_height();return Math.sqrt(2*t*t)},gantt._get_task_width=function(t){return Math.round(this._get_task_pos(t,!1).x-this._get_task_pos(t,!0).x) +},gantt._render_task_element=function(t){var e=this._get_task_pos(t),n=this.config,i=this._get_task_height(),a=Math.floor((this.config.row_height-i)/2);t.type==n.types.milestone&&n.link_line_width>1&&(a+=1);var s=document.createElement("div"),r=gantt._get_task_width(t),o=this._get_safe_type(t.type);s.setAttribute(this.config.task_attribute,t.id),s.appendChild(gantt._render_task_content(t,r)),s.className=this._combine_item_class("gantt_task_line",this.templates.task_class(t.start_date,t.end_date,t),t.id),s.style.cssText=["left:"+e.x+"px","top:"+(a+e.y)+"px","height:"+i+"px","line-height:"+i+"px","width:"+r+"px"].join(";"); +var d=this._render_leftside_content(t);return d&&s.appendChild(d),d=this._render_rightside_content(t),d&&s.appendChild(d),n.show_progress&&o!=this.config.types.milestone&&this._render_task_progress(t,s,r),this.config.readonly||(n.drag_resize&&!this._is_flex_task(t)&&o!=this.config.types.milestone&&gantt._render_pair(s,"gantt_task_drag",t,function(t){var e=document.createElement("div");return e.className=t,e}),n.drag_links&&gantt._render_pair(s,"gantt_link_control",t,function(t){var e=document.createElement("div"); +e.className=t,e.style.cssText=["height:"+i+"px","line-height:"+i+"px"].join(";");var n=document.createElement("div");return n.className="gantt_link_point",e.appendChild(n),e})),s},gantt._render_side_content=function(t,e,n){if(!e)return null;var i=e(t.start_date,t.end_date,t);if(!i)return null;var a=document.createElement("div");return a.className="gantt_side_content "+n,a.innerHTML=i,a},gantt._render_leftside_content=function(t){var e="gantt_left "+gantt._get_link_crossing_css(!0,t);return gantt._render_side_content(t,this.templates.leftside_text,e) +},gantt._render_rightside_content=function(t){var e="gantt_right "+gantt._get_link_crossing_css(!1,t);return gantt._render_side_content(t,this.templates.rightside_text,e)},gantt._get_conditions=function(t){return t?{$source:[gantt.config.links.start_to_start],$target:[gantt.config.links.start_to_start,gantt.config.links.finish_to_start]}:{$source:[gantt.config.links.finish_to_start,gantt.config.links.finish_to_finish],$target:[gantt.config.links.finish_to_finish]}},gantt._get_link_crossing_css=function(t,e){var n=gantt._get_conditions(t); +for(var i in n)for(var a=e[i],s=0;st||t>e.full_width)return null;for(var n=0,i=0;i+e.width[n]=0,"Invalid day index");for(var n=Math.floor(e),i=e%1,a=0,s=1;n>=s;s++)a+=gantt._tasks.width[s-1];return i&&(a+=n=this._max_date)return n.length;for(var a=0;as;s++)this.render_item(e[s],a);i.appendChild(a)},replace_item:function(t,e){var n=this.rendered[t];n&&n.parentNode&&n.parentNode.replaceChild(e,n),this.rendered[t]=e},remove_item:function(t){var e=this.rendered[t]; +e&&e.parentNode&&e.parentNode.removeChild(e),delete this.rendered[t]},change_id:function(t,e){this.rendered[e]=this.rendered[t],delete this.rendered[t]},rendered:this._task_area_pulls[t],node:n},this._task_area_renderers[t])},gantt._pull={},gantt._branches={},gantt._order=[],gantt._lpull={},gantt.load=function(t,e,n){dhtmlx.assert(arguments.length,"Invalid load arguments"),this.callEvent("onLoadStart",[]);var i="json",a=null;arguments.length>=3?(i=e,a=n):"string"==typeof arguments[1]?i=arguments[1]:"function"==typeof arguments[1]&&(a=arguments[1]),dhtmlxAjax.get(t,dhtmlx.bind(function(t){this.on_load(t,i),"function"==typeof a&&a.call(this) +},this))},gantt.parse=function(t,e){this.on_load({xmlDoc:{responseText:t}},e)},gantt.serialize=function(t){return t=t||"json",this[t].serialize()},gantt.on_load=function(t,e){e||(e="json"),dhtmlx.assert(this[e],"Invalid data type:'"+e+"'");var n=t.xmlDoc.responseText,i=this[e].parse(n,t);this._process_loading(i),this.callEvent("onLoadEnd",[])},gantt._process_loading=function(t){t.collections&&this._load_collections(t.collections);for(var e=t.data,n=0;nn;n++)if(e[n]==t)return n;return-1},gantt.eachTask=function(t,e,n){e=e||this.config.root_id,n=n||this;var i=this._branches[e];if(i)for(var a=0;a"},_copyObject:function(t){var e=gantt.templates.xml_format(t.start_date),n=gantt.templates.xml_format(t.end_date);return""},serialize:function(){var t=[],e=[];gantt.eachTask(function(e){t.push(this._copyObject(e)) +},this.config.root_id,this);for(var n in gantt._lpull)e.push(this._copyLink(gantt._lpull[n]));return""+t.join("")+""+e.join("")+""}},gantt.oldxml={parse:function(t,e){e=gantt.xml._getXML(t,e,"projects");for(var n={collections:{links:[]}},i=n.data=[],a=e.doXPath("//task"),s=0;se;e++)if(this.units[e]==t)return e;dhtmlx.assert(!1,"Incorrect duration unit")},_timestamp:function(t){var e=null;return t.day||0===t.day?e=t.day:t.date&&(e=gantt.date.date_part(new Date(t.date)).valueOf()),e},set_time:function(t){var e=void 0!==t.hours?t.hours:!0,n=this._timestamp(t);null!==n?this.dates[n]=e:this.hours=e},unset_time:function(t){if(t){var e=this._timestamp(t); +null!==e&&delete this.dates[e]}else this.hours=[]},is_working_unit:function(t,e,n){return gantt.config.work_time?(void 0===n&&(n=this._get_unit_order(e)),void 0===n?!1:n&&!this.is_working_unit(t,this.units[n-1],n-1)?!1:this["is_work_"+e]?this["is_work_"+e](t):!0):!0},is_work_day:function(t){var e=this.get_working_hours(t);return e instanceof Array?e.length>0:!1},is_work_hour:function(t){for(var e=this.get_working_hours(t),n=t.getHours(),i=0;i=e[i]&&ns;){var r=gantt.date.add(a,i,n); +this.is_working_unit(i>0?a:r,n)&&s++,a=r}return a},get_closest_worktime:function(t){if(this.is_working_unit(t.date,t.unit))return t.date;var e=t.unit,n=gantt.date[e+"_start"](t.date),i=new Date(n),a=new Date(n),s=!0,r=3e3,o=0,d="any"==t.dir||!t.dir,l=1;for("past"==t.dir&&(l=-1);!this.is_working_unit(n,e);)if(d&&(n=s?i:a,l=-1*l),n=gantt.date.add(n,l,e),d&&(s?i=n:a=n),s=!s,o++,o>r)return dhtmlx.assert(!1,"Invalid working time check"),!1;return(n==a||"past"==t.dir)&&(n=gantt.date.add(n,1,e)),n}},gantt.getTask=function(t){return dhtmlx.assert(this._pull[t]),this._pull[t] +},gantt.getTaskByTime=function(t,e){var n=this._pull,i=[];if(t||e){t=+t||-1/0,e=+e||1/0;for(var a in n){var s=n[a];+s.start_datet&&i.push(s)}}else for(var a in n)i.push(n[a]);return i},gantt.isTaskExists=function(t){return dhtmlx.defined(this._pull[t])},gantt.isTaskVisible=function(t){if(!this._pull[t])return!1;if(!(+this._pull[t].start_date<+this._max_date&&+this._pull[t].end_date>+this._min_date))return!1;for(var e=0,n=this._order.length;n>e;e++)if(this._order[e]==t)return!0;return!1 +},gantt.updateTask=function(t,e){return dhtmlx.defined(e)||(e=this.getTask(t)),this.callEvent("onBeforeTaskUpdate",[t,e])===!1?!1:(this._pull[e.id]=e,this._is_parent_sync(e)||this._resync_parent(e),this._update_parents(e.id),this.refreshTask(e.id),this.callEvent("onAfterTaskUpdate",[t,e]),this._sync_order(),void this._adjust_scales())},gantt._add_branch=function(t){this._branches[t.parent]||(this._branches[t.parent]=[]);for(var e=this._branches[t.parent],n=!1,i=0,a=e.length;a>i;i++)if(e[i]==t.id){n=!0; +break}n||e.push(t.id),this._sync_parent(t),this._sync_order()},gantt._move_branch=function(t,e,n){t.parent=n,this._sync_parent(t),this._replace_branch_child(e,t.id),n?this._add_branch(t):delete this._branches[t.id],t.$level=this._item_level(t),this._sync_order()},gantt._resync_parent=function(t){this._move_branch(t,t.$rendered_parent,t.parent)},gantt._sync_parent=function(t){t.$rendered_parent=t.parent},gantt._is_parent_sync=function(t){return t.$rendered_parent==t.parent},gantt._replace_branch_child=function(t,e,n){var i=this._branches[t]; +if(i){for(var a=[],s=0;s0;)this.deleteLink(n.$source[0]);for(;n.$target.length>0;)this.deleteLink(n.$target[0]);return delete this._pull[t],this._move_branch(n,n.parent,null),e||(this.callEvent("onAfterTaskDelete",[t,n]),this.refreshData()),!0 +},gantt.clearAll=function(){this._pull={},this._branches={},this._order=[],this._order_full=[],this._lpull={},this.refreshData(),this.callEvent("onClear",[])},gantt._update_flags=function(t,e){this._lightbox_id==t&&(this._lightbox_id=e),this._selected_task==t&&(this._selected_task=e),this._tasks_dnd.drag&&this._tasks_dnd.drag.id==t&&(this._tasks_dnd.drag.id=e)},gantt.changeTaskId=function(t,e){var n=this._pull[e]=this._pull[t];this._pull[e].id=e,delete this._pull[t];for(var i in this._pull)this._pull[i].parent==t&&(this._pull[i].parent=e); +this._update_flags(t,e),this._replace_branch_child(n.parent,t,e),this.callEvent("onTaskIdChange",[t,e])},gantt._get_duration_unit=function(){return 1e3*gantt._get_line(this.config.duration_unit)||this.config.duration_unit},gantt._get_safe_type=function(t){for(var e in this.config.types)if(this.config.types[e]==t)return t;return gantt.config.types.task},gantt._get_type_name=function(t){for(var e in this.config.types)if(this.config.types[e]==t)return e;return"task"},gantt.getWorkHours=function(t){return this._working_time_helper.get_working_hours(t) +},gantt.setWorkTime=function(t){this._working_time_helper.set_time(t)},gantt.isWorkTime=function(t,e){var n=this._working_time_helper;return n.is_working_unit(t,e||this.config.duration_unit)},gantt.getClosestWorkTime=function(t){var e=this._working_time_helper;return t instanceof Date&&(t={date:t}),t.dir=t.dir||"any",t.unit=t.unit||this.config.duration_unit,e.get_closest_worktime(t)},gantt.calculateDuration=function(t,e){var n=this._working_time_helper;return n.get_work_units_between(t,e,this.config.duration_unit,this.config.duration_step) +},gantt.calculateEndDate=function(t,e){var n=this._working_time_helper,i=e>=0?1:-1;return n.add_worktime(t,Math.abs(e),this.config.duration_unit,i*this.config.duration_step)},gantt._init_task=function(t){return dhtmlx.defined(t.id)||(t.id=dhtmlx.uid()),t.start_date&&(t.start_date=gantt.date.parseDate(t.start_date,"xml_date")),t.end_date&&(t.end_date=gantt.date.parseDate(t.end_date,"xml_date")),t.start_date&&!t.end_date&&t.duration&&(t.end_date=this.calculateEndDate(t.start_date,t.duration)),gantt.config.work_time&&gantt.config.correct_work_time&&(t.start_date&&(t.start_date=gantt.getClosestWorkTime(t.start_date)),t.end_date&&(t.end_date=gantt.getClosestWorkTime(t.end_date))),gantt._init_task_timing(t),t.$source=[],t.$target=[],t.parent=t.parent||this.config.root_id,t.$open=dhtmlx.defined(t.open)?t.open:!1,t.$level=this._item_level(t),t +},gantt._init_task_timing=function(t){void 0===t.$rendered_type?t.$rendered_type=t.type:t.$rendered_type!=t.type&&(delete t.$no_end,delete t.$no_start,t.$rendered_type=t.type),void 0!==t.$no_end&&void 0!==t.$no_start||t.type==this.config.types.milestone||(t.type==this.config.types.project?t.$no_end=t.$no_start=!0:(t.$no_end=!(t.end_date||t.duration),t.$no_start=!t.start_date)),t.type==this.config.types.milestone&&(t.end_date=t.start_date),t.start_date&&t.end_date&&(t.duration=this.calculateDuration(t.start_date,t.end_date)),t.duration=t.duration||0 +},gantt._is_flex_task=function(t){return!(!t.$no_end&&!t.$no_start)},gantt._update_parents=function(t,e){if(t){for(var n=this.getTask(t);!n.$no_end&&!n.$no_start&&n.parent&&this.isTaskExists(n.parent);)n=this.getTask(n.parent);if(n.$no_end){var i=0;this.eachTask(function(t){t.end_date&&+t.end_date>+i&&(i=new Date(t.end_date))},n.id),i&&(n.end_date=i)}if(n.$no_start){var a=1/0;this.eachTask(function(t){t.start_date&&+t.start_date<+a&&(a=new Date(t.start_date))},n.id),1/0!=a&&(n.start_date=a)}(n.$no_end||n.$no_start)&&(this._init_task_timing(n),e||this.refreshTask(n.id,!0)),n.parent&&this.isTaskExists(n.parent)&&this._update_parents(n.parent,e) +}},gantt.isChildOf=function(t,e){if(!this.isTaskExists(t))return!1;if(e===this.config.root_id)return this.isTaskExists(t);for(var n=this.getTask(t);n&&this.isTaskExists(n.parent);)if(n=this.getTask(n.parent),n&&n.id==e)return!0;return!1},gantt._get_closest_date=function(t){for(var e=t.date,n=t.step,i=t.unit,a=gantt.date[i+"_start"](new Date(this._min_date));+e>+a;)a=gantt.date.add(a,n,i);var s=gantt.date.add(a,-1*n,i);return t.dir&&"future"==t.dir?a:t.dir&&"past"==t.dir?s:Math.abs(e-s)i[t];return e&&(a=!a),a?1:-1 +}:t,s=this._branches[n];if(s){for(var r=[],o=s.length-1;o>=0;o--)r[o]=this._pull[s[o]];r.sort(a);for(var o=0;o 
",gantt.showLightbox=function(t){if(t&&!this.config.readonly&&this.callEvent("onBeforeLightbox",[t])){var e=this.getTask(t),n=this.getLightbox(this._get_safe_type(e.type)); +this._center_lightbox(n),this.showCover(),this._fill_lightbox(t,n),this.callEvent("onLightbox",[t])}},gantt._get_timepicker_step=function(){if(this.config.round_dnd_dates){var t=gantt._tasks,e=this._get_line(t.unit)*t.step/60;return e>=1440&&(e=this.config.time_step),e}return this.config.time_step},gantt.getLabel=function(t,e){for(var n=this._get_typed_lightbox_config(),i=0;i
"+this.locale.labels[a[s]]+"
";a=this.config.buttons_right;for(var s in a)i+="
"+this.locale.labels[a[s]]+"
";i+="",e.innerHTML=i,gantt.config.drag_lightbox&&(e.firstChild.onmousedown=gantt._ready_to_dnd,e.firstChild.onselectstart=function(){return!1 +},e.firstChild.style.cursor="pointer",gantt._init_dnd_events()),document.body.insertBefore(e,document.body.firstChild),this._lightbox=e;var r=this._get_typed_lightbox_config(t);i=this._render_sections(r);for(var o=e.getElementsByTagName("div"),s=0;s
"+this.locale.labels["button_"+t[n].button]+"
"),this.config.wide_form&&(e+="
"),e+="
"+s+this.locale.labels["section_"+t[n].name]+"
"+i.render.call(this,t[n]),e+="
"}}return e},gantt.resizeLightbox=function(){var t=this._lightbox; +if(t){var e=t.childNodes[1];e.style.height="0px",e.style.height=e.scrollHeight+"px",t.style.height=e.scrollHeight+this.config.lightbox_additional_height+"px",e.style.height=e.scrollHeight+"px"}},gantt._center_lightbox=function(t){if(t){t.style.display="block";var e=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop,n=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft,i=window.innerHeight||document.documentElement.clientHeight;t.style.top=e?Math.round(e+Math.max((i-t.offsetHeight)/2,0))+"px":Math.round(Math.max((i-t.offsetHeight)/2,0)+9)+"px",t.style.left=document.documentElement.scrollWidth>document.body.offsetWidth?Math.round(n+(document.body.offsetWidth-t.offsetWidth)/2)+"px":Math.round((document.body.offsetWidth-t.offsetWidth)/2)+"px" +}},gantt.showCover=function(){if(!this._cover){this._cover=document.createElement("DIV"),this._cover.className="dhx_cal_cover";var t=void 0!==document.height?document.height:document.body.offsetHeight,e=document.documentElement?document.documentElement.scrollHeight:0;this._cover.style.height=Math.max(t,e)+"px",document.body.appendChild(this._cover)}},gantt._init_lightbox_events=function(){gantt.lightbox_events={},gantt.lightbox_events.dhx_save_btn=function(){gantt._save_lightbox()},gantt.lightbox_events.dhx_delete_btn=function(){gantt.callEvent("onLightboxDelete",[gantt._lightbox_id])&&gantt.$click.buttons["delete"](gantt._lightbox_id) +},gantt.lightbox_events.dhx_cancel_btn=function(){gantt._cancel_lightbox()},gantt.lightbox_events["default"]=function(t,e){if(e.getAttribute("dhx_button"))gantt.callEvent("onLightboxButton",[e.className,e,t]);else{var n,i,a;-1!=e.className.indexOf("dhx_custom_button")&&(-1!=e.className.indexOf("dhx_custom_button_")?(n=e.parentNode.getAttribute("index"),a=e.parentNode.parentNode):(n=e.getAttribute("index"),a=e.parentNode,e=e.firstChild));var s=gantt._get_typed_lightbox_config();n&&(i=gantt.form_blocks[s[n].type],i.button_click(n,e,a,a.nextSibling)) +}},dhtmlxEvent(gantt.getLightbox(),"click",function(t){t=t||window.event;var e=t.target?t.target:t.srcElement;if(e.className||(e=e.previousSibling),e&&e.className&&0===e.className.indexOf("dhx_btn_set")&&(e=e.firstChild),e&&e.className){var n=dhtmlx.defined(gantt.lightbox_events[e.className])?gantt.lightbox_events[e.className]:gantt.lightbox_events["default"];return n(t,e)}return!1}),gantt.getLightbox().onkeydown=function(t){switch((t||event).keyCode){case gantt.keys.edit_save:if((t||event).shiftKey)return; +gantt._save_lightbox();break;case gantt.keys.edit_cancel:gantt._cancel_lightbox()}}},gantt._cancel_lightbox=function(){var t=this.getLightboxValues();this.callEvent("onLightboxCancel",[this._lightbox_id,t.$new]),t.$new&&(this._deleteTask(t.id,!0),this.refreshData()),this.hideLightbox()},gantt._save_lightbox=function(){var t=this.getLightboxValues();this.callEvent("onLightboxSave",[this._lightbox_id,t,!!t.$new])&&(t.$new?(delete t.$new,this.addTask(t)):(dhtmlx.mixin(this.getTask(t.id),t,!0),this.updateTask(t.id)),this.refreshData(),this.hideLightbox()) +},gantt.getLightboxValues=function(){for(var t=dhtmlx.mixin({},this.getTask(this._lightbox_id)),e=this._get_typed_lightbox_config(),n=0;n0&&(o+=" ");var _="";switch(l){case"%Y":t._time_format_order[2]=d,t._time_format_order.size++;for(var h=a.getFullYear()-5,c=0;10>c;c++)_+="";break;case"%m":t._time_format_order[1]=d,t._time_format_order.size++;for(var c=0;12>c;c++)_+="";break;case"%d":t._time_format_order[0]=d,t._time_format_order.size++;for(var c=1;32>c;c++)_+="";break;case"%H:%i":var s=1440,r=0; +t._time_format_order[3]=d,t._time_format_order.size++;var c=r,g=a.getDate();for(t._time_values=[];s>c;){var u=this.templates.time_picker(a);_+="",t._time_values.push(c),a.setTime(a.valueOf()+60*this._get_timepicker_step()*1e3);var f=a.getDate()!=g?1:0;c=24*f*60+60*a.getHours()+a.getMinutes()}}if(_){var p=t.readonly?"disabled='disabled'":"",m=e?" style='display:none'":"";o+=""}}return o},_fill_lightbox_select:function(t,e,n,i){if(t[e+i[0]].value=n.getDate(),t[e+i[1]].value=n.getMonth(),t[e+i[2]].value=n.getFullYear(),dhtmlx.defined(i[3])){var a=60*n.getHours()+n.getMinutes(); +a=Math.round(a/gantt._get_timepicker_step())*gantt._get_timepicker_step(),t[e+i[3]].value=a}},template:{render:function(t){var e=(t.height||"30")+"px";return"
"},set_value:function(t,e){t.innerHTML=e||""},get_value:function(t){return t.innerHTML||""},focus:function(){}},textarea:{render:function(t){var e=(t.height||"130")+"px";return"
"},set_value:function(t,e){t.firstChild.value=e||"" +},get_value:function(t){return t.firstChild.value},focus:function(t){var e=t.firstChild;gantt._focus(e,!0)}},select:{render:function(t){for(var e=(t.height||"23")+"px",n="
"},set_value:function(t,e,n,i){var a=t.firstChild;!a._dhx_onchange&&i.onchange&&(a.onchange=i.onchange,a._dhx_onchange=!0),"undefined"==typeof e&&(e=(a.options[0]||{}).value),a.value=e||"" +},get_value:function(t){return t.firstChild.value},focus:function(t){var e=t.firstChild;gantt._focus(e,!0)}},time:{render:function(t){var e=this.form_blocks.getTimePicker.call(this,t),n=["
"];return n.push(e),t.single_date?(e=this.form_blocks.getTimePicker.call(this,t,!0),n.push("")):n.push("  –  "),n.push(e),n.push("
"),n.join("") +},set_value:function(t,e,n,i){{var a=this.config,s=t.getElementsByTagName("select"),r=i._time_format_order;i._time_format_size}if(a.auto_end_date)for(var o=function(){var t=new Date(s[r[2]].value,s[r[1]].value,s[r[0]].value,0,0),e=gantt.calculateEndDate(t,1);this.form_blocks._fill_lightbox_select(s,r.size,e,r,a)},d=0;4>d;d++)s[d].onchange=o;this.form_blocks._fill_lightbox_select(s,0,n.start_date,r,a),this.form_blocks._fill_lightbox_select(s,r.size,n.end_date,r,a)},get_value:function(t,e,n){var i=t.getElementsByTagName("select"),a=n._time_format_order,s=0,r=0; +if(dhtmlx.defined(a[3])){var o=parseInt(i[a[3]].value,10);s=Math.floor(o/60),r=o%60}if(e.start_date=new Date(i[a[2]].value,i[a[1]].value,i[a[0]].value,s,r),s=r=0,dhtmlx.defined(a[3])){var o=parseInt(i[a.size+a[3]].value,10);s=Math.floor(o/60),r=o%60}return e.end_date=new Date(i[a[2]+a.size].value,i[a[1]+a.size].value,i[a[0]+a.size].value,s,r),e.end_date<=e.start_date&&(e.end_date=gantt.date.add(e.start_date,gantt._get_timepicker_step(),"minute")),{start_date:new Date(e.start_date),end_date:new Date(e.end_date)} +},focus:function(t){gantt._focus(t.getElementsByTagName("select")[0])}},duration:{render:function(t){var e=this.form_blocks.getTimePicker.call(this,t);e="
"+e+"
";var n=this.locale.labels[this.config.duration_unit+"s"],i=t.single_date?' style="display:none"':"",a=t.readonly?" disabled='disabled'":"",s="
"+n+"
",r="
"+e+" "+s+"
"; +return r},set_value:function(t,e,n,i){function a(){var e=gantt.form_blocks.duration._get_start_date.call(gantt,t,i),n=gantt.form_blocks.duration._get_duration.call(gantt,t,i),a=gantt.calculateEndDate(e,n);h.innerHTML=gantt.templates.task_date(a)}function s(t){var e=l.value;e=parseInt(e,10),window.isNaN(e)&&(e=0),e+=t,1>e&&(e=1),l.value=e,a()}var r=this.config,o=t.getElementsByTagName("select"),d=t.getElementsByTagName("input"),l=d[1],_=[d[0],d[2]],h=t.getElementsByTagName("span")[0],c=i._time_format_order; +_[0].onclick=dhtmlx.bind(function(){s(-1*this.config.duration_step)},this),_[1].onclick=dhtmlx.bind(function(){s(1*this.config.duration_step)},this),o[0].onchange=a,o[1].onchange=a,o[2].onchange=a,o[3]&&(o[3].onchange=a),l.onkeydown=dhtmlx.bind(function(t){t=t||window.event;var e=t.charCode||t.keyCode||t.which;return 40==e?(s(-1*this.config.duration_step),!1):38==e?(s(1*this.config.duration_step),!1):void window.setTimeout(function(){a()},1)},this),l.onchange=dhtmlx.bind(function(){a()},this),this.form_blocks._fill_lightbox_select(o,0,n.start_date,c,r); +var g;g=n.end_date?gantt.calculateDuration(n.start_date,n.end_date):n.duration,g=Math.round(g),l.value=g,a()},_get_start_date:function(t,e){var n=t.getElementsByTagName("select"),i=e._time_format_order,a=0,s=0;if(dhtmlx.defined(i[3])){var r=parseInt(n[i[3]].value,10);a=Math.floor(r/60),s=r%60}return new Date(n[i[2]].value,n[i[1]].value,n[i[0]].value,a,s)},_get_duration:function(t){var e=t.getElementsByTagName("input")[1];return e=parseInt(e.value,10),window.isNaN(e)&&(e=1),0>e&&(e*=-1),e},get_value:function(t,e,n){e.start_date=this.form_blocks.duration._get_start_date(t,n); +var i=this.form_blocks.duration._get_duration(t,n);return e.end_date=this.calculateEndDate(e.start_date,i),e.duration=i,{start_date:new Date(e.start_date),end_date:new Date(e.end_date)}},focus:function(t){gantt._focus(t.getElementsByTagName("select")[0])}},typeselect:{render:function(t){var e=gantt.config.types,n=gantt.locale.labels,i=[];for(var a in e)i.push({key:e[a],label:n["type_"+a]});t.options=i;var s=t.onchange;return t.onchange=function(){gantt.getState().lightbox;gantt.changeLightboxType(this.value),"function"==typeof s&&s.apply(this,arguments) +},gantt.form_blocks.select.render.apply(this,arguments)},set_value:function(){return gantt.form_blocks.select.set_value.apply(this,arguments)},get_value:function(){return gantt.form_blocks.select.get_value.apply(this,arguments)},focus:function(){return gantt.form_blocks.select.focus.apply(this,arguments)}},parent:{_filter:function(t,e,n){var i=e.filter||function(){return!0};t=t.slice(0);for(var a=0;a
",this.$grid_scale=this.$grid.childNodes[0],this.$grid_data=this.$grid.childNodes[1],this.$task.innerHTML="
",this.$task_scale=this.$task.childNodes[0],this.$task_data=this.$task.childNodes[1],this.$task_bg=this.$task_data.childNodes[0],this.$task_links=this.$task_data.childNodes[1],this.$task_bars=this.$task_data.childNodes[2] +},gantt.$click={buttons:{edit:function(t){gantt.showLightbox(t)},"delete":function(t){var e=gantt.locale.labels.confirm_deleting,n=gantt.locale.labels.confirm_deleting_title;gantt._dhtmlx_confirm(e,n,function(){var e=gantt.getTask(t);e.$new?(gantt._deleteTask(t,!0),gantt.refreshData()):gantt.deleteTask(t),gantt.hideLightbox()})}}},gantt._calculate_content_height=function(){var t=this.config.scale_height,e=this._order.length*this.config.row_height,n=this._scroll_hor?this.config.scroll_size+1:0;return this._is_grid_visible()||this._is_chart_visible()?t+e+2+n:0 +},gantt._calculate_content_width=function(){{var t=this._get_grid_width(),e=this._tasks?this._tasks.full_width:0;this._scroll_ver?this.config.scroll_size+1:0}return this._is_chart_visible()||(e=0),this._is_grid_visible()||(t=0),t+e+1},gantt._get_resize_options=function(){var t={x:!1,y:!1};return"xy"==this.config.autosize?t.x=t.y=!0:"y"==this.config.autosize||this.config.autosize===!0?t.y=!0:"x"==this.config.autosize&&(t.x=!0),t},gantt._set_sizes=function(){var t=this._get_resize_options();if(t.y&&(this._obj.style.height=this._calculate_content_height()+"px"),t.x&&(this._obj.style.width=this._calculate_content_width()+"px"),this._y=this._obj.clientHeight,!(this._y<20)){this.$grid.style.height=this.$task.style.height=Math.max(this._y-this.$scroll_hor.offsetHeight-2,0)+"px"; +var e=Math.max(this._y-(this.config.scale_height||0)-this.$scroll_hor.offsetHeight-2,0);this.$grid_data.style.height=this.$task_data.style.height=e+"px";var n=Math.max(this._get_grid_width()-1,0);this.$grid.style.width=n+"px",this.$grid.style.display=0===n?"none":"",this._x=this._obj.clientWidth,this._x<20||(this.$grid_data.style.width=Math.max(this._get_grid_width()-1,0)+"px",this.$task.style.width=Math.max(this._x-this._get_grid_width()-2,0)+"px")}},gantt.getScrollState=function(){return{x:this.$task.scrollLeft,y:this.$task_data.scrollTop} +},gantt.scrollTo=function(t,e){1*t==t&&(this.$task.scrollLeft=t),1*e==e&&(this.$task_data.scrollTop=e,this.$grid_data.scrollTop=e)},gantt.showDate=function(t){var e=this.posFromDate(t),n=Math.max(e-this.config.task_scroll_offset,0);this.scrollTo(n)},gantt.showTask=function(t){var e=this.getTaskNode(t);if(e){var n=Math.max(e.offsetLeft-this.config.task_scroll_offset,0),i=e.offsetTop-(this.$task_data.offsetHeight-this.config.row_height)/2;this.scrollTo(n,i)}},gantt._on_resize=gantt.setSizes=function(){gantt._set_sizes(),gantt._scroll_resize() +},gantt.render=function(){if(this._render_grid(),this._render_tasks_scales(),this._scroll_resize(),this._on_resize(),this._render_data(),this.config.initial_scroll){var t=this._order[0]||this.config.root_id;t&&this.showTask(t)}this.callEvent("onGanttRender",[])},gantt._set_scroll_events=function(){dhtmlxEvent(this.$scroll_hor,"scroll",function(){if(!gantt._touch_scroll_active){var t=gantt.$scroll_hor.scrollLeft;gantt.scrollTo(t)}}),dhtmlxEvent(this.$scroll_ver,"scroll",function(){if(!gantt._touch_scroll_active){var t=gantt.$scroll_ver.scrollTop; +gantt.$grid_data.scrollTop=t,gantt.scrollTo(null,t)}}),dhtmlxEvent(this.$task,"scroll",function(){var t=gantt.$task.scrollLeft,e=gantt.$scroll_hor.scrollLeft;e!=t&&(gantt.$scroll_hor.scrollLeft=t)}),dhtmlxEvent(this.$task_data,"scroll",function(){var t=gantt.$task_data.scrollTop,e=gantt.$scroll_ver.scrollTop;e!=t&&(gantt.$scroll_ver.scrollTop=t)}),dhtmlxEvent(gantt.$container,"mousewheel",function(t){var e=gantt._get_resize_options();if(t.wheelDeltaX){if(e.x)return!0;var n=t.wheelDeltaX/-40,i=gantt.$task.scrollLeft+30*n; +gantt.scrollTo(i,null),gantt.$scroll_hor.scrollTop=a}else{if(e.y)return!0;var n=t.wheelDelta/-40;"undefined"==typeof t.wheelDelta&&(n=t.detail);var a=gantt.$grid_data.scrollTop+30*n;gantt.scrollTo(null,a),gantt.$scroll_ver.scrollTop=a}return t.preventDefault&&t.preventDefault(),t.cancelBubble=!0,!1})},gantt._scroll_resize=function(){if(!(this._x<20||this._y<20)){var t=this._get_grid_width(),e=this._x-t,n=this._y-this.config.scale_height,i=this.config.scroll_size+1,a=this.$task_data.offsetWidth-i,s=this.config.row_height*this._order.length,r=this._get_resize_options(),o=this._scroll_hor=r.x?!1:a>e,d=this._scroll_ver=r.y?!1:s>n; +this.$scroll_hor.style.display=o?"block":"none",this.$scroll_hor.style.height=(o?i:0)+"px",this.$scroll_hor.style.width=this._x-(d?i:2)+"px",this.$scroll_hor.firstChild.style.width=a+t+i+2+"px",this.$scroll_ver.style.display=d?"block":"none",this.$scroll_ver.style.width=(d?i:0)+"px",this.$scroll_ver.style.height=this._y-(o?i:0)-this.config.scale_height+"px",this.$scroll_ver.style.top=this.config.scale_height+"px",this.$scroll_ver.firstChild.style.height=this.config.scale_height+s+"px"}},gantt.locate=function(t){var e=gantt._get_target_node(t); +if("gantt_task_cell"==e.className)return null;for(var n=arguments[1]||this.config.task_attribute;e;){if(e.getAttribute){var i=e.getAttribute(n);if(i)return i}e=e.parentNode}return null},gantt._get_target_node=function(t){var e;return t.tagName?e=t:(t=t||window.event,e=t.target||t.srcElement),e},gantt._trim=function(t){var e=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};return e.apply(t)},gantt._locate_css=function(t,e,n){void 0===n&&(n=!0);for(var i=gantt._get_target_node(t),a="";i;){if(a=i.className){var s=a.indexOf(e); +if(s>=0){if(!n)return i;var r=0===s||!gantt._trim(a.charAt(s-1)),o=s+e.length>=a.length||!gantt._trim(a.charAt(s+e.length));if(r&&o)return i}}i=i.parentNode}return null},gantt._locateHTML=function(t,e){var n=gantt._get_target_node(t);for(e=e||this.config.task_attribute;n;){if(n.getAttribute){var i=n.getAttribute(e);if(i)return n}n=n.parentNode}return null},gantt.getTaskRowNode=function(t){for(var e=this.$grid_data.childNodes,n=this.config.task_attribute,i=0;in?!0:t._on_timeout?!1:(setTimeout(function(){delete t._on_timeout},n),t._on_timeout=!0,!0)},gantt.selectTask=function(t){if(!this.config.select_task)return!1; +if(t){if(this._selected_task==t)return this._selected_task;if(!this.callEvent("onBeforeTaskSelected",[t]))return!1;this.unselectTask(),this._selected_task=t,this.refreshTask(t),this.callEvent("onTaskSelected",[t])}return this._selected_task},gantt.unselectTask=function(){var t=this._selected_task;t&&(this._selected_task=null,this.refreshTask(t),this.callEvent("onTaskUnselected",[t]))},gantt.getSelectedId=function(){return dhtmlx.defined(this._selected_task)?this._selected_task:null},gantt.changeLightboxType=function(t){return this.getLightboxType()==t?!0:void gantt._silent_redraw_lightbox(t) +},gantt.date={init:function(){for(var t=gantt.locale.date.month_short,e=gantt.locale.date.month_short_hash={},n=0;nt?"0"+t:t},copy:function(t){return new Date(t.valueOf())},date_to_str:function(t,e){return t=t.replace(/%[a-zA-Z]/g,function(t){switch(t){case"%d":return'"+gantt.date.to_fixed(date.getDate())+"'; +case"%m":return'"+gantt.date.to_fixed((date.getMonth()+1))+"';case"%j":return'"+date.getDate()+"';case"%n":return'"+(date.getMonth()+1)+"';case"%y":return'"+gantt.date.to_fixed(date.getFullYear()%100)+"';case"%Y":return'"+date.getFullYear()+"';case"%D":return'"+gantt.locale.date.day_short[date.getDay()]+"';case"%l":return'"+gantt.locale.date.day_full[date.getDay()]+"';case"%M":return'"+gantt.locale.date.month_short[date.getMonth()]+"';case"%F":return'"+gantt.locale.date.month_full[date.getMonth()]+"'; +case"%h":return'"+gantt.date.to_fixed((date.getHours()+11)%12+1)+"';case"%g":return'"+((date.getHours()+11)%12+1)+"';case"%G":return'"+date.getHours()+"';case"%H":return'"+gantt.date.to_fixed(date.getHours())+"';case"%i":return'"+gantt.date.to_fixed(date.getMinutes())+"';case"%a":return'"+(date.getHours()>11?"pm":"am")+"';case"%A":return'"+(date.getHours()>11?"PM":"AM")+"';case"%s":return'"+gantt.date.to_fixed(date.getSeconds())+"';case"%W":return'"+gantt.date.to_fixed(gantt.date.getISOWeek(date))+"'; +default:return t}}),e&&(t=t.replace(/date\.get/g,"date.getUTC")),new Function("date",'return "'+t+'";')},str_to_date:function(t,e){for(var n="var temp=date.match(/[a-zA-Z]+|[0-9]+/g);",i=t.match(/%[a-zA-Z]/g),a=0;a50?1900:2000);";break;case"%g":case"%G":case"%h":case"%H":n+="set[3]=temp["+a+"]||0;";break;case"%i":n+="set[4]=temp["+a+"]||0;"; +break;case"%Y":n+="set[0]=temp["+a+"]||0;";break;case"%a":case"%A":n+="set[3]=set[3]%12+((temp["+a+"]||'').toLowerCase()=='am'?0:12);";break;case"%s":n+="set[5]=temp["+a+"]||0;";break;case"%M":n+="set[1]=gantt.locale.date.month_short_hash[temp["+a+"]]||0;";break;case"%F":n+="set[1]=gantt.locale.date.month_full_hash[temp["+a+"]]||0;"}var s="set[0],set[1],set[2],set[3],set[4],set[5]";return e&&(s=" Date.UTC("+s+")"),new Function("date","var set=[0,0,1,0,0,0]; "+n+" return new Date("+s+");")},getISOWeek:function(t){if(!t)return!1; +var e=t.getDay();0===e&&(e=7);var n=new Date(t.valueOf());n.setDate(t.getDate()+(4-e));var i=n.getFullYear(),a=Math.round((n.getTime()-new Date(i,0,1).getTime())/864e5),s=1+Math.floor(a/7);return s},getUTCISOWeek:function(t){return this.getISOWeek(t)},convert_to_utc:function(t){return new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())},parseDate:function(t,e){return"string"==typeof t&&(dhtmlx.defined(e)&&(e="string"==typeof e?dhtmlx.defined(gantt.templates[e])?gantt.templates[e]:gantt.date.str_to_date(e):gantt.templates.xml_date),t=e(t)),t +}},gantt.config||(gantt.config={}),gantt.config||(gantt.config={}),gantt.templates||(gantt.templates={}),function(){dhtmlx.mixin(gantt.config,{links:{finish_to_start:"0",start_to_start:"1",finish_to_finish:"2",start_to_finish:"3"},types:{task:"task",project:"project",milestone:"milestone"},duration_unit:"day",work_time:!1,correct_work_time:!1,skip_off_time:!1,autosize:!1,show_links:!0,show_task_cells:!0,show_chart:!0,show_grid:!0,min_duration:36e5,xml_date:"%d-%m-%Y %H:%i",api_date:"%d-%m-%Y %H:%i",start_on_monday:!0,server_utc:!1,show_progress:!0,fit_tasks:!1,select_task:!0,readonly:!1,date_grid:"%Y-%m-%d",drag_links:!0,drag_progress:!0,drag_resize:!0,drag_move:!0,drag_mode:{resize:"resize",progress:"progress",move:"move",ignore:"ignore"},round_dnd_dates:!0,link_wrapper_width:20,root_id:0,autofit:!0,columns:[{name:"text",tree:!0,width:"*"},{name:"start_date",align:"center"},{name:"duration",align:"center"},{name:"add",width:"44"}],step:1,scale_unit:"day",subscales:[],time_step:60,duration_step:1,date_scale:"%d %M",task_date:"%d %F %Y",time_picker:"%H:%i",task_attribute:"task_id",link_attribute:"link_id",buttons_left:["dhx_save_btn","dhx_cancel_btn"],buttons_right:["dhx_delete_btn"],lightbox:{sections:[{name:"description",height:70,map_to:"text",type:"textarea",focus:!0},{name:"time",height:72,type:"duration",map_to:"auto"}],project_sections:[{name:"description",height:70,map_to:"text",type:"textarea",focus:!0},{name:"type",type:"typeselect",map_to:"type"},{name:"time",height:72,type:"duration",readonly:!0,map_to:"auto"}],milestone_sections:[{name:"description",height:70,map_to:"text",type:"textarea",focus:!0},{name:"type",type:"typeselect",map_to:"type"},{name:"time",height:72,type:"duration",single_date:!0,map_to:"auto"}]},drag_lightbox:!0,sort:!1,details_on_create:!0,details_on_dblclick:!0,initial_scroll:!0,task_scroll_offset:100,task_height:"full",min_column_width:70}),gantt.keys={edit_save:13,edit_cancel:27},gantt._init_template=function(t,e){var n=this._reg_templates||{}; +this.config[t]&&n[t]!=this.config[t]&&(e&&this.templates[t]||(this.templates[t]=this.date.date_to_str(this.config[t]),n[t]=this.config[t])),this._reg_templates=n},gantt._init_templates=function(){var t=gantt.locale.labels;t.dhx_save_btn=t.icon_save,t.dhx_cancel_btn=t.icon_cancel,t.dhx_delete_btn=t.icon_delete;var e=this.date.date_to_str,n=this.config;gantt._init_template("date_scale",!0),gantt._init_template("date_grid",!0),gantt._init_template("task_date",!0),dhtmlx.mixin(this.templates,{xml_date:this.date.str_to_date(n.xml_date,n.server_utc),xml_format:e(n.xml_date,n.server_utc),api_date:this.date.str_to_date(n.api_date),progress_text:function(){return"" +},grid_header_class:function(){return""},task_text:function(t,e,n){return n.text},task_class:function(){return""},grid_row_class:function(){return""},task_row_class:function(){return""},task_cell_class:function(){return""},scale_cell_class:function(){return""},scale_row_class:function(){return""},grid_indent:function(){return"
"},grid_folder:function(t){return"
"},grid_file:function(){return"
" +},grid_open:function(t){return"
"},grid_blank:function(){return"
"},task_time:function(t,e){return gantt.templates.task_date(t)+" - "+gantt.templates.task_date(e)},time_picker:e(n.time_picker),link_class:function(){return""},link_description:function(t){var e=gantt.getTask(t.source),n=gantt.getTask(t.target);return""+e.text+""+n.text+""},drag_link:function(t,e,n,i){t=gantt.getTask(t); +var a=gantt.locale.labels,s=""+t.text+" "+(e?a.link_start:a.link_end)+"
";return n&&(n=gantt.getTask(n),s+=" "+n.text+" "+(i?a.link_start:a.link_end)+"
"),s},drag_link_class:function(t,e,n,i){var a="";if(t&&n){var s=gantt.isLinkAllowed(t,n,e,i);a=" "+(s?"gantt_link_allow":"gantt_link_deny")}return"gantt_link_tooltip"+a}}),this.callEvent("onTemplatesReady",[])}}(),window.jQuery&&!function(t){var e=[];t.fn.dhx_gantt=function(n){if(n=n||{},"string"!=typeof n){var i=[];return this.each(function(){if(this&&this.getAttribute&&!this.getAttribute("dhxgantt")){for(var t in n)"data"!=t&&(gantt.config[t]=n[t]); +gantt.init(this),n.data&&gantt.parse(n.data),i.push(gantt)}}),1===i.length?i[0]:i}return e[n]?e[n].apply(this,[]):void t.error("Method "+n+" does not exist on jQuery.dhx_gantt")}}(jQuery),window.dhtmlx&&(dhtmlx.attaches||(dhtmlx.attaches={}),dhtmlx.attaches.attachGantt=function(t,e){var n=document.createElement("DIV");n.id="gantt_"+dhtmlx.uid(),n.style.width="100%",n.style.height="100%",n.cmp="grid",document.body.appendChild(n),this.attachObject(n.id);var i=this.vs[this.av];i.grid=gantt,gantt.init(n.id,t,e),n.firstChild.style.border="none",i.gridId=n.id,i.gridObj=n; +var a="_viewRestore";return this.vs[this[a]()].grid}),gantt.locale={date:{month_full:["January","February","March","April","May","June","July","August","September","October","November","December"],month_short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],day_full:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],day_short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},labels:{new_task:"New task",icon_save:"Save",icon_cancel:"Cancel",icon_details:"Details",icon_edit:"Edit",icon_delete:"Delete",confirm_closing:"",confirm_deleting:"Task will be deleted permanently, are you sure?",section_description:"Description",section_time:"Time period",section_type:"Type",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years"}},gantt.skins.skyblue={config:{grid_width:350,row_height:27,scale_height:27,task_height:24,link_line_width:1,link_arrow_size:8,lightbox_additional_height:75},_second_column_width:95,_third_column_width:80},gantt.skins.meadow={config:{grid_width:350,row_height:27,scale_height:30,task_height:24,link_line_width:2,link_arrow_size:6,lightbox_additional_height:72},_second_column_width:95,_third_column_width:80},gantt.skins.terrace={config:{grid_width:360,row_height:35,scale_height:35,task_height:24,link_line_width:2,link_arrow_size:6,lightbox_additional_height:75},_second_column_width:90,_third_column_width:70},gantt.skins.broadway={config:{grid_width:360,row_height:35,scale_height:35,task_height:24,link_line_width:1,link_arrow_size:7,lightbox_additional_height:86},_second_column_width:90,_third_column_width:80,_lightbox_template:"
 
",_config_buttons_left:{},_config_buttons_right:{dhx_delete_btn:"icon_delete",dhx_save_btn:"icon_save"}},gantt.config.touch_drag=50,gantt.config.touch=!0,gantt._init_touch_events=function(){"force"!=this.config.touch&&(this.config.touch=this.config.touch&&(-1!=navigator.userAgent.indexOf("Mobile")||-1!=navigator.userAgent.indexOf("iPad")||-1!=navigator.userAgent.indexOf("Android")||-1!=navigator.userAgent.indexOf("Touch"))),this.config.touch&&(window.navigator.msPointerEnabled?this._touch_events(["MSPointerMove","MSPointerDown","MSPointerUp"],function(t){return t.pointerType==t.MSPOINTER_TYPE_MOUSE?null:t +},function(t){return!t||t.pointerType==t.MSPOINTER_TYPE_MOUSE}):this._touch_events(["touchmove","touchstart","touchend"],function(t){return t.touches&&t.touches.length>1?null:t.touches[0]?{target:t.target,pageX:t.touches[0].pageX,pageY:t.touches[0].pageY}:t},function(){return!1}))},gantt._touch_events=function(t,e,n){function i(t){return t&&t.preventDefault&&t.preventDefault(),(t||event).cancelBubble=!0,!1}var a,s=0,r=!1,o=!1,d=null;this._gantt_touch_event_ready||(this._gantt_touch_event_ready=1,dhtmlxEvent(document.body,t[0],function(t){if(!n(t)&&r){var l=e(t); +if(l&&d){var _=d.pageX-l.pageX,h=d.pageY-l.pageY;!o&&(Math.abs(_)>5||Math.abs(h)>5)&&(gantt._touch_scroll_active=o=!0,s=0,a=gantt.getScrollState()),o&&gantt.scrollTo(a.x+_,a.y+h)}return i(t)}})),dhtmlxEvent(this.$container,"contextmenu",function(t){return r?i(t):void 0}),dhtmlxEvent(this.$container,t[1],function(t){if(!n(t)){if(t.touches&&t.touches.length>1)return void(r=!1);if(r=!0,d=e(t),d&&s){var a=new Date;500>a-s?(gantt._on_dblclick(d),i(t)):s=a}else s=new Date}}),dhtmlxEvent(this.$container,t[2],function(t){n(t)||(gantt._touch_scroll_active=r=o=!1) +})}; +//# sourceMappingURL=sources/dhtmlxgantt.js.map \ No newline at end of file