diff --git a/addons/base/controllers/main.py b/addons/base/controllers/main.py index 870f3494320..9db66638b22 100644 --- a/addons/base/controllers/main.py +++ b/addons/base/controllers/main.py @@ -93,7 +93,7 @@ class Session(openerpweb.Controller): @openerpweb.jsonrequest def modules(self, req): - return {"modules": ["base", "base_hello", "base_calendar"]} + return {"modules": ["base", "base_hello", "base_calendar", "base_gantt"]} @openerpweb.jsonrequest def csslist(self, req, mods='base,base_hello'): diff --git a/addons/base/static/src/base.html b/addons/base/static/src/base.html index 8bb4793d42c..3bfadba0782 100644 --- a/addons/base/static/src/base.html +++ b/addons/base/static/src/base.html @@ -23,7 +23,11 @@ + + + + diff --git a/addons/base/static/src/js/base.js b/addons/base/static/src/js/base.js index 4833551c24e..5975bce8023 100644 --- a/addons/base/static/src/js/base.js +++ b/addons/base/static/src/js/base.js @@ -122,6 +122,7 @@ openerp.base = function(instance) { openerp.base.search(instance); openerp.base.list(instance); openerp.base.form(instance); + openerp.base.gantt(instance); }; // vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax: diff --git a/addons/base/static/src/xml/base.xml b/addons/base/static/src/xml/base.xml index 9a41ba630f3..7a982e631fe 100644 --- a/addons/base/static/src/xml/base.xml +++ b/addons/base/static/src/xml/base.xml @@ -167,6 +167,19 @@
+ + | ++ + | +
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ +Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+ + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
+ +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
+ +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
+ +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
+ +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+ + +a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
+ +b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
+ +c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+ +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
+ +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+ +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
+ +a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+ +b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+ +c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
+The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+ +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
+ +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+ +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
+ +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
+ +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
+ +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
+ +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
+ +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+ +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
+ +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+ +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
+ +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
+ +NO WARRANTY
+ +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+ +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ +
\ No newline at end of file
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/codebase/dhtmlxcommon.js b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/dhtmlxcommon.js
new file mode 100644
index 00000000000..208124b8c74
--- /dev/null
+++ b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/dhtmlxcommon.js
@@ -0,0 +1,933 @@
+dhtmlx=function(obj){
+ for (var a in obj) dhtmlx[a]=obj[a];
+ return dhtmlx; //simple singleton
+};
+dhtmlx.extend_api=function(name,map,ext){
+ var t = window[name];
+ if (!t) return; //component not defined
+ window[name]=function(obj){
+ if (obj && typeof obj == "object" && !obj.tagName){
+ var that = t.apply(this,(map._init?map._init(obj):arguments));
+ //global settings
+ for (var a in dhtmlx)
+ if (map[a]) this[map[a]](dhtmlx[a]);
+ //local settings
+ for (var a in obj){
+ if (map[a]) this[map[a]](obj[a]);
+ else if (a.indexOf("on")==0){
+ this.attachEvent(a,obj[a]);
+ }
+ }
+ } else
+ var that = t.apply(this,arguments);
+ if (map._patch) map._patch(this);
+ return that||this;
+ };
+ window[name].prototype=t.prototype;
+ if (ext)
+ dhtmlXHeir(window[name].prototype,ext);
+};
+
+dhtmlxAjax={
+ get:function(url,callback){
+ var t=new dtmlXMLLoaderObject(true);
+ t.async=(arguments.length<3);
+ t.waitCall=callback;
+ t.loadXML(url)
+ return t;
+ },
+ post:function(url,post,callback){
+ var t=new dtmlXMLLoaderObject(true);
+ t.async=(arguments.length<4);
+ t.waitCall=callback;
+ t.loadXML(url,true,post)
+ return t;
+ },
+ getSync:function(url){
+ return this.get(url,null,true)
+ },
+ postSync:function(url,post){
+ return this.post(url,post,null,true);
+ }
+}
+
+/**
+ * @desc: xmlLoader object
+ * @type: private
+ * @param: funcObject - xml parser function
+ * @param: object - jsControl object
+ * @param: async - sync/async mode (async by default)
+ * @param: rSeed - enable/disable random seed ( prevent IE caching)
+ * @topic: 0
+ */
+function dtmlXMLLoaderObject(funcObject, dhtmlObject, async, rSeed){
+ this.xmlDoc="";
+
+ if (typeof (async) != "undefined")
+ this.async=async;
+ else
+ this.async=true;
+
+ this.onloadAction=funcObject||null;
+ this.mainObject=dhtmlObject||null;
+ this.waitCall=null;
+ this.rSeed=rSeed||false;
+ return this;
+};
+/**
+ * @desc: xml loading handler
+ * @type: private
+ * @param: dtmlObject - xmlLoader object
+ * @topic: 0
+ */
+dtmlXMLLoaderObject.prototype.waitLoadFunction=function(dhtmlObject){
+ var once = true;
+ this.check=function (){
+ if ((dhtmlObject)&&(dhtmlObject.onloadAction != null)){
+ if ((!dhtmlObject.xmlDoc.readyState)||(dhtmlObject.xmlDoc.readyState == 4)){
+ if (!once)
+ return;
+
+ once=false; //IE 5 fix
+ if (typeof dhtmlObject.onloadAction == "function")
+ dhtmlObject.onloadAction(dhtmlObject.mainObject, null, null, null, dhtmlObject);
+
+ if (dhtmlObject.waitCall){
+ dhtmlObject.waitCall.call(this,dhtmlObject);
+ dhtmlObject.waitCall=null;
+ }
+ }
+ }
+ };
+ return this.check;
+};
+
+/**
+ * @desc: return XML top node
+ * @param: tagName - top XML node tag name (not used in IE, required for Safari and Mozilla)
+ * @type: private
+ * @returns: top XML node
+ * @topic: 0
+ */
+dtmlXMLLoaderObject.prototype.getXMLTopNode=function(tagName, oldObj){
+ if (this.xmlDoc.responseXML){
+ var temp = this.xmlDoc.responseXML.getElementsByTagName(tagName);
+ if(temp.length==0 && tagName.indexOf(":")!=-1)
+ var temp = this.xmlDoc.responseXML.getElementsByTagName((tagName.split(":"))[1]);
+ var z = temp[0];
+ } else
+ var z = this.xmlDoc.documentElement;
+
+ if (z){
+ this._retry=false;
+ return z;
+ }
+
+ if ((_isIE)&&(!this._retry)){
+ //fall back to MS.XMLDOM
+ var xmlString = this.xmlDoc.responseText;
+ var oldObj = this.xmlDoc;
+ this._retry=true;
+ this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
+ this.xmlDoc.async=false;
+ this.xmlDoc["loadXM"+"L"](xmlString);
+
+ return this.getXMLTopNode(tagName, oldObj);
+ }
+ dhtmlxError.throwError("LoadXML", "Incorrect XML", [
+ (oldObj||this.xmlDoc),
+ this.mainObject
+ ]);
+
+ return document.createElement("DIV");
+};
+
+/**
+ * @desc: load XML from string
+ * @type: private
+ * @param: xmlString - xml string
+ * @topic: 0
+ */
+dtmlXMLLoaderObject.prototype.loadXMLString=function(xmlString){
+ {
+ try{
+ var parser = new DOMParser();
+ this.xmlDoc=parser.parseFromString(xmlString, "text/xml");
+ }
+ catch (e){
+ this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
+ this.xmlDoc.async=this.async;
+ this.xmlDoc["loadXM"+"L"](xmlString);
+ }
+ }
+
+ this.onloadAction(this.mainObject, null, null, null, this);
+
+ if (this.waitCall){
+ this.waitCall();
+ this.waitCall=null;
+ }
+}
+/**
+ * @desc: load XML
+ * @type: private
+ * @param: filePath - xml file path
+ * @param: postMode - send POST request
+ * @param: postVars - list of vars for post request
+ * @topic: 0
+ */
+dtmlXMLLoaderObject.prototype.loadXML=function(filePath, postMode, postVars, rpc){
+ if (this.rSeed)
+ filePath+=((filePath.indexOf("?") != -1) ? "&" : "?")+"a_dhx_rSeed="+(new Date()).valueOf();
+ this.filePath=filePath;
+
+ if ((!_isIE)&&(window.XMLHttpRequest))
+ this.xmlDoc=new XMLHttpRequest();
+ else {
+ if (document.implementation&&document.implementation.createDocument){
+ this.xmlDoc=document.implementation.createDocument("", "", null);
+ this.xmlDoc.onload=new this.waitLoadFunction(this);
+ this.xmlDoc.load(filePath);
+ return;
+ } else
+ this.xmlDoc=new ActiveXObject("Microsoft.XMLHTTP");
+ }
+
+ if (this.async)
+ this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this);
+ this.xmlDoc.open(postMode ? "POST" : "GET", filePath, this.async);
+
+ if (rpc){
+ this.xmlDoc.setRequestHeader("User-Agent", "dhtmlxRPC v0.1 ("+navigator.userAgent+")");
+ this.xmlDoc.setRequestHeader("Content-type", "text/xml");
+ }
+
+ else if (postMode)
+ this.xmlDoc.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+
+ this.xmlDoc.setRequestHeader("X-Requested-With","XMLHttpRequest");
+ this.xmlDoc.send(null||postVars);
+
+ if (!this.async)
+ (new this.waitLoadFunction(this))();
+};
+/**
+ * @desc: destructor, cleans used memory
+ * @type: private
+ * @topic: 0
+ */
+dtmlXMLLoaderObject.prototype.destructor=function(){
+ 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.waitLoadFunction = null;
+ this.doSerialization = null;
+ this.xmlNodeToJSON = null;
+ this.getXMLTopNode = null;
+ this.setXSLParamValue = null;
+ return null;
+}
+
+dtmlXMLLoaderObject.prototype.xmlNodeToJSON = function(node){
+ var t={};
+ for (var i=0; i You can place this JavaScript Gantt Chart anywhere on your web page, attaching it
+ to any div object.
";tblInfo.rows[0].cells[0].innerHTML += "Duration: " + this.TaskInfo.Duration + " hours
";tblInfo.rows[0].cells[0].innerHTML += "Percent Complete: " + this.TaskInfo.PercentCompleted + "%
";if (this.predTask){tblInfo.rows[0].cells[0].innerHTML += "Predecessor Task: ";tblInfo.rows[0].cells[0].innerHTML += "*" + this.TaskInfo.PredecessorTask.Name + ""};if (this.TaskInfo.ChildTasks.length != 0){tblInfo.rows[0].cells[0].innerHTML += "Child Tasks: ";for (var i = 0;i < this.TaskInfo.ChildTasks.length;i++){tblInfo.rows[0].cells[0].innerHTML += (i == this.TaskInfo.ChildTasks.length - 1) ? ("*" + this.TaskInfo.ChildTasks[i].Name + "") : ("*" + this.TaskInfo.ChildTasks[i].Name + "")}};if (this.TaskInfo.ParentTask){tblInfo.rows[0].cells[0].innerHTML += "Parent Task: ";tblInfo.rows[0].cells[0].innerHTML += "*" + this.TaskInfo.ParentTask.Name + ""};this.Chart.divInfo.style.cssText = "z-index:2;position: absolute;display: inline;";if (posY + this.Chart.divInfo.lastChild.offsetHeight + 10 > this.Chart.oData.offsetHeight + this.Chart.oData.scrollTop){this.Chart.divInfo.style.top = (posY - this.Chart.divInfo.lastChild.offsetHeight - 10 - this.Chart.heightTaskItem) + "px"}else {this.Chart.divInfo.style.top = posY + "px"};if (this.Chart.divInfo.lastChild.offsetWidth + posX + 10 > this.Chart.oData.offsetWidth + this.Chart.oData.scrollLeft){this.Chart.divInfo.style.left = posX - (this.Chart.divInfo.lastChild.offsetWidth + posX + 20 - (this.Chart.oData.offsetWidth + this.Chart.oData.scrollLeft)) + "px"}else {this.Chart.divInfo.style.left = posX + "px"}};GanttTask.prototype.closePopUpInfo = function()
+{this.Chart.divInfo.style.display = "none"};GanttTask.prototype.createConnectingLinesPN = function()
+{var arrConnectingLinesNames = [];return arrConnectingLinesNames};GanttTask.prototype.createConnectingLinesDS = function()
+{var oData = this.Chart.oData.firstChild;var arrLines = [];var arrowImg = new Image();arrowImg.src = this.Chart.imgs + "arr.gif";var lineVerticalRight = document.createElement("div");var lineHorizontal = document.createElement("div");var posXPredecessorTask = parseInt(this.predTask.cTaskItem[0].style.left);var posYPredecessorTask = parseInt(this.predTask.cTaskItem[0].style.top);var posXChildTask = parseInt(this.cTaskItem[0].style.left);var posYChildTask = this.posY + 2;var widthChildTask = parseInt(this.predTask.cTaskItem[0].firstChild.firstChild.width);var widthPredecessorTask = parseInt(this.predTask.cTaskItem[0].firstChild.firstChild.width);if (posYPredecessorTask < posYChildTask){lineVerticalRight.style.cssText = "border-width: 0px 0px 0px 1px;border-style: solid;border-color: #4A8F43;margin: 0px;padding: 0px;z-index:0;font-size: 1px;position: absolute;" +
+ "height:" + (posYChildTask - this.Chart.heightTaskItem / 2 - posYPredecessorTask - 3) + "px;width:" + 1 + "px;left:" + (posXPredecessorTask + widthPredecessorTask - 20 ) + "px;top:" + (posYPredecessorTask + this.Chart.heightTaskItem) + "px;";lineHorizontal.style.cssText = "height:1px;border-color: #4A8F43;border-style: solid;border-width: 1px 0px 0px 0px;margin: 0px;padding: 0px;z-index:0;position: absolute;" +
+ "width:" + (15 + (posXChildTask - (widthPredecessorTask + posXPredecessorTask))) + "px;left:" + (posXPredecessorTask + widthPredecessorTask - 20 ) + "px;top:" + (posYChildTask + 2) + "px;";arrowImg.style.cssText = "margin: 0px;padding: 0px;width:7px;height:14px;position: absolute;left:" + (posXChildTask - 7) + "px;top:" + (posYChildTask - 1) + "px;"}else {lineVerticalRight.style.cssText = "border-width: 0px 0px 0px 1px;border-style: solid;border-color: #4A8F43;margin: 0px;padding: 0px;z-index:0;font-size: 1px;position: absolute;" +
+ "height:" + (posYPredecessorTask + 2 - posYChildTask) + "px;width:" + 1 + "px;left:" + (posXPredecessorTask + widthPredecessorTask - 20 ) + "px;top:" + (posYChildTask + 2) + "px;";lineHorizontal.style.cssText = "height:1px;border-color: #4A8F43;border-style: solid;border-width: 1px 0px 0px 0px;margin: 0px;padding: 0px;z-index:0;position: absolute;" +
+ "width:" + (15 + (posXChildTask - (widthPredecessorTask + posXPredecessorTask))) + "px;left:" + (posXPredecessorTask + widthPredecessorTask - 20 ) + "px;top:" + (posYChildTask + 2) + "px;";arrowImg.style.cssText = "margin: 0px;padding: 0px;width:7px;height:14px;position: absolute;left:" + (posXChildTask - 7) + "px;top:" + (posYChildTask - 1) + "px;"};oData.appendChild(lineVerticalRight);oData.appendChild(lineHorizontal);oData.appendChild(arrowImg);arrLines.push(lineVerticalRight);arrLines.push(arrowImg);arrLines.push(lineHorizontal);return arrLines};GanttTask.prototype.showChildTasks = function(task, isOpen)
+{if (isOpen){for (var i = 0;i < task.childTask.length;i++){if (task.childTask[i].cTaskItem[0].style.display == "none"){task.childTask[i].cTaskItem[0].style.display = "inline";task.childTask[i].cTaskNameItem[0].style.display = "inline";if (this.Chart.isShowDescTask){task.childTask[i].showDescTask()};task.isHide = false;if (task.childTask[i].cTaskNameItem[2]){task.childTask[i].cTaskNameItem[2].style.display = "inline";isOpen = task.childTask[i]._isOpen};for (var k = 0;k < task.childTask[i].cTaskItem[1].length;k++){task.childTask[i].cTaskItem[1][k].style.display = "inline"};for (var k = 0;k < task.childTask[i].cTaskNameItem[1].length;k++){task.childTask[i].cTaskNameItem[1][k].style.display = "inline"};this._heightHideTasks += this.Chart.heightTaskItem + 11;if (task.childTask[i].childTask.length > 0){this.showChildTasks(task.childTask[i], isOpen)}}}}};GanttTask.prototype.hideChildTasks = function(task)
+{for (var i = 0;i < task.childTask.length;i++){if (task.childTask[i].cTaskItem[0].style.display != "none"){task.childTask[i].cTaskItem[0].style.display = "none";task.childTask[i].cTaskNameItem[0].style.display = "none";if (this.Chart.isShowDescTask){task.childTask[i].hideDescTask()};task.isHide = true;if (task.childTask[i].cTaskNameItem[2]){task.childTask[i].cTaskNameItem[2].style.display = "none"};for (var k = 0;k < task.childTask[i].cTaskItem[1].length;k++){task.childTask[i].cTaskItem[1][k].style.display = "none"};for (var k = 0;k < task.childTask[i].cTaskNameItem[1].length;k++){task.childTask[i].cTaskNameItem[1][k].style.display = "none"};this._heightHideTasks += this.Chart.heightTaskItem + 11;if (task.childTask[i].childTask.length > 0){this.hideChildTasks(task.childTask[i])}}}};GanttTask.prototype.shiftCurrentTasks = function(task, height)
+{this.shiftNextTask(this, height);task.Project.shiftNextProject(task.Project, height)};GanttProject.prototype.shiftNextProject = function(project, height)
+{if (project.nextProject){project.nextProject.shiftProject(height);this.shiftNextProject(project.nextProject, height)}};GanttProject.prototype.shiftProject = function(height)
+{this.projectItem[0].style.top = parseInt(this.projectItem[0].style.top) + height + "px";if (this.Chart.isShowDescProject){this.descrProject.style.top = parseInt(this.descrProject.style.top) + height + "px"};if (this.Chart._showTreePanel){this.projectNameItem.style.top = parseInt(this.projectNameItem.style.top) + height + "px"};if (this.arrTasks.length > 0)this.shiftNextParentTask(this.arrTasks[0], height)};GanttProject.prototype.shiftTask = function(task, height)
+{if (this.Chart._showTreePanel){task.cTaskNameItem[0].style.top = parseInt(task.cTaskNameItem[0].style.top) + height + "px";if (task.cTaskNameItem[2]){task.cTaskNameItem[2].style.top = parseInt(task.cTaskNameItem[2].style.top) + height + "px"};if (task.parentTask && task.cTaskNameItem[1][0]){task.cTaskNameItem[1][0].style.top = parseInt(task.cTaskNameItem[1][0].style.top) + height + "px";task.cTaskNameItem[1][1].style.top = parseInt(task.cTaskNameItem[1][1].style.top) + height + "px"}};task.cTaskItem[0].style.top = parseInt(task.cTaskItem[0].style.top) + height + "px";if (this.Chart.isShowDescTask){task.descrTask.style.top = parseInt(task.descrTask.style.top) + height + "px"};if (task.cTaskItem[1][0]){task.cTaskItem[1][0].style.top = parseInt(task.cTaskItem[1][0].style.top) + height + "px";task.cTaskItem[1][1].style.top = parseInt(task.cTaskItem[1][1].style.top) + height + "px";task.cTaskItem[1][2].style.top = parseInt(task.cTaskItem[1][2].style.top) + height + "px"}};GanttProject.prototype.shiftNextParentTask = function(task, height)
+{this.shiftTask(task, height);this.shiftChildTasks(task, height);if (task.nextParentTask){this.shiftNextParentTask(task.nextParentTask, height)}};GanttProject.prototype.shiftChildTasks = function(task, height)
+{for (var i = 0;i < task.childTask.length;i++){this.shiftTask(task.childTask[i], height);if (task.childTask[i].childTask.length > 0){this.shiftChildTasks(task.childTask[i], height)}}};GanttTask.prototype.shiftTask = function(task, height)
+{if (this.Chart._showTreePanel){task.cTaskNameItem[0].style.top = parseInt(task.cTaskNameItem[0].style.top) + height + "px";if (task.cTaskNameItem[2]){task.cTaskNameItem[2].style.top = parseInt(task.cTaskNameItem[2].style.top) + height + "px"};if (task.parentTask){if (task.cTaskNameItem[1].length > 0)if ((parseInt(this.cTaskNameItem[0].style.top)> parseInt(task.parentTask.cTaskNameItem[0].style.top))
+ && (task.cTaskNameItem[1][0].style.display != "none")) {task.cTaskNameItem[1][0].style.height = parseInt(task.cTaskNameItem[1][0].style.height) + height + "px"}else {task.cTaskNameItem[1][0].style.top = parseInt(task.cTaskNameItem[1][0].style.top) + height + "px"};if (task.cTaskNameItem[1].length > 1)task.cTaskNameItem[1][1].style.top = parseInt(task.cTaskNameItem[1][1].style.top) + height + "px"}};task.cTaskItem[0].style.top = parseInt(task.cTaskItem[0].style.top) + height + "px";if (this.Chart.isShowDescTask){task.descrTask.style.top = parseInt(task.descrTask.style.top) + height + "px"};if (task.predTask){if (task.cTaskItem[1].length > 0)if (((parseInt(this.cTaskItem[0].style.top)> parseInt(task.predTask.cTaskItem[0].style.top)) ||
+ (this.cTaskItem[0].id == task.predTask.TaskInfo.Id)) &&
+ task.cTaskItem[1][0].style.display != "none") {task.cTaskItem[1][0].style.height = parseInt(task.cTaskItem[1][0].style.height) + height + "px"}else {task.cTaskItem[1][0].style.top = parseInt(task.cTaskItem[1][0].style.top) + height + "px"};if (task.cTaskItem[1].length > 2){task.cTaskItem[1][1].style.top = parseInt(task.cTaskItem[1][1].style.top) + height + "px";task.cTaskItem[1][2].style.top = parseInt(task.cTaskItem[1][2].style.top) + height + "px"}}};GanttTask.prototype.shiftNextTask = function(task, height)
+{if (task.nextChildTask){this.shiftTask(task.nextChildTask, height);this.shiftChildTask(task.nextChildTask, height);this.shiftNextTask(task.nextChildTask, height)}else if (task.parentTask){this.shiftNextTask(task.parentTask, height)}else if (task.nextParentTask){this.shiftTask(task.nextParentTask, height);this.shiftChildTask(task.nextParentTask, height);this.shiftNextTask(task.nextParentTask, height)}};GanttTask.prototype.shiftChildTask = function(task, height)
+{for (var i = 0;i < task.childTask.length;i++){this.shiftTask(task.childTask[i], height);if (task.childTask[i].childTask.length > 0){this.shiftChildTask(task.childTask[i], height)}}};GanttChart.prototype.getPosOnDate = function(est)
+{return (est - this.startDate) / (60 * 60 * 1000) * this.hourInPixels};GanttChart.prototype.getWidthOnDuration = function(duration)
+{return Math.round(this.hourInPixelsWork * duration)};GanttTask.prototype.endMove = function()
+{var width = parseInt(this.cTaskItem[0].style.left) - this.posX;var est = this.getDateOnPosition(parseInt(this.cTaskItem[0].style.left));est = this.checkPos(est);this.wasMoved = this.TaskInfo.EST.valueOf() != est.valueOf();if (this.checkMove){width = this.Chart.getPosOnDate(est) - this.posX;this.moveCurrentTaskItem(width, this.moveChild);this.Project.shiftProjectItem()};this.checkMove = false;this.posX = 0;this.maxPosXMove = -1;this.minPosXMove = -1;this.cTaskItem[0].childNodes[1].firstChild.rows[0].cells[0].innerHTML = "";if (this.Chart._isFF)document.body.style.cursor = "";if (this.Chart._isIE)this.cTaskItem[0].childNodes[2].childNodes[0].style.cursor = ""};GanttTask.prototype.checkPos = function(est)
+{var h = est.getHours();if (h >= 12){est.setDate(est.getDate() + 1);est.setHours(0);if ((parseInt(this.cTaskItem[0].firstChild.firstChild.width)+ this.Chart.getPosOnDate(est) > this.maxPosXMove) && (this.maxPosXMove != -1))
+ {est.setDate(est.getDate() - 1);est.setHours(0)}}else if ((h < 12)&& (h != 0))
+ {est.setHours(0);if ((this.Chart.getPosOnDate(est)< this.minPosXMove))
+ {est.setDate(est.getDate() + 1)}};this.cTaskItem[0].style.left = this.Chart.getPosOnDate(est) + "px";return est};GanttTask.prototype.getMaxPosPredChildTaskItem = function()
+{var posPredChildTaskItem = 0;var nextPosPredChildTaskItem = 0;for (var i = 0;i < this.childPredTask.length;i++){nextPosPredChildTaskItem = this.getMaxPosPredChildTaskItemInTree(this.childPredTask[i]);if (nextPosPredChildTaskItem > posPredChildTaskItem){posPredChildTaskItem = nextPosPredChildTaskItem}};return posPredChildTaskItem};GanttTask.prototype.getMaxPosPredChildTaskItemInTree = function(task)
+{var currentPos = parseInt(task.cTaskItem[0].firstChild.firstChild.width) + parseInt(task.cTaskItem[0].style.left);var posPredChildTaskItem = 0;var nextPosPredChildTaskItem = 0;for (var i = 0;i < task.childPredTask.length;i++){nextPosPredChildTaskItem = this.getMaxPosPredChildTaskItemInTree(task.childPredTask[i]);if (nextPosPredChildTaskItem > posPredChildTaskItem){posPredChildTaskItem = nextPosPredChildTaskItem}};if (posPredChildTaskItem > currentPos){return posPredChildTaskItem}else
+ {return currentPos}};GanttProject.prototype.getTaskById = function(id)
+{for (var i = 0;i < this.arrTasks.length;i++){var task = this.searchTaskInTree(this.arrTasks[i], id);if (task)return task};return null};GanttProject.prototype.searchTaskInTree = function(task, id)
+{if (task.TaskInfo.Id == id){return task}else
+ {for (var i = 0;i < task.childTask.length;i++){if (task.childTask[i].TaskInfo.Id == id){return task.childTask[i]}else
+ {if (task.childTask[i].childTask.length > 0){var cTask = this.searchTaskInTree(task.childTask[i], id);if (cTask)return cTask}}}};return null};GanttProject.prototype.shiftProjectItem = function()
+{var posItemL = null;var posItemR = null;var posProjectItemL = parseInt(this.projectItem[0].style.left);var posProjectItemR = parseInt(this.projectItem[0].firstChild.style.width) + parseInt(this.projectItem[0].style.left);var widthProjectItem = parseInt(this.projectItem[0].firstChild.style.width);for (var t = 0;t < this.arrTasks.length;t++){var tmpPosItemL = parseInt(this.arrTasks[t].cTaskItem[0].style.left);var tmpPosItemR = parseInt(this.arrTasks[t].cTaskItem[0].style.left) + parseInt(this.arrTasks[t].cTaskItem[0].firstChild.firstChild.width);if (!posItemL){posItemL = tmpPosItemL};if (!posItemR){posItemR = tmpPosItemR};if (posItemL > tmpPosItemL){posItemL = tmpPosItemL};if (posItemR < tmpPosItemR){posItemR = tmpPosItemR}};if (posItemL != posProjectItemL){this.Project.StartDate = new Date(this.Chart.startDate);this.Project.StartDate.setHours(this.Project.StartDate.getHours() + (posItemL / this.Chart.hourInPixels))};this.projectItem[0].style.left = posItemL + "px";this.resizeProjectItem(posItemR - posItemL);this.Duration = Math.round(parseInt(this.projectItem[0].firstChild.width) / (this.Chart.hourInPixelsWork));if (this.Chart.isShowDescProject){this.moveDescrProject()};this.addDayInPanelTime()};GanttProject.prototype.addDayInPanelTime = function()
+{var width = parseInt(this.projectItem[0].style.left) + parseInt(this.projectItem[0].firstChild.style.width) + 20;if (this.Chart.isShowDescProject){width += this.descrProject.offsetWidth};var table = this.Chart.panelTime.firstChild, tbody = table.firstChild;if (parseInt(tbody.offsetWidth)< width)
+ {var countDays = Math.round((width - parseInt(tbody.offsetWidth)) / this.Chart.dayInPixels);var row = tbody.rows[1];for (var n = 0;n < countDays;n++){this.Chart.addPointInTimePanel(row, table);this.Chart.addDayInPanelTime(row)};var w = this.Chart.dayInPixels * (row.cells.length);tbody.style.width = w + "px";this.Chart.panelTasks.style.width = (w-18) + "px"}};GanttProject.prototype.addEvent = function (elm, evType, fn, useCapture)
+{if (elm.addEventListener){elm.addEventListener(evType, fn, useCapture);return true}else if (elm.attachEvent){return elm.attachEvent('on' + evType, fn)}else {elm['on' + evType] = fn}};GanttProject.prototype.getPopUpInfo = function(object, event)
+{var posX = object.offsetLeft + ((event.layerX == null) ? event.offsetX : event.layerX);var posY = object.offsetTop + this.Chart.heightTaskItem + 6;var tblInfo = this.Chart.divInfo.lastChild;tblInfo.rows[0].cells[0].innerHTML = "
";tblInfo.rows[0].cells[0].innerHTML += "Duration: " + this.Duration + " hours
";tblInfo.rows[0].cells[0].innerHTML += "Percent Complete: " + this.percentCompleted + "%
";this.Chart.divInfo.style.cssText = "z-index:2;position: absolute;display: inline;";if (posY + this.Chart.divInfo.lastChild.offsetHeight + 6 > this.Chart.oData.offsetHeight + this.Chart.oData.scrollTop){this.Chart.divInfo.style.top = (posY - this.Chart.divInfo.lastChild.offsetHeight - 10 - this.Chart.heightTaskItem) + "px"}else {this.Chart.divInfo.style.top = posY + "px"};if (this.Chart.divInfo.lastChild.offsetWidth + posX + 10 > this.Chart.oData.offsetWidth + this.Chart.oData.scrollLeft){this.Chart.divInfo.style.left = posX - (this.Chart.divInfo.lastChild.offsetWidth + posX + 20 - (this.Chart.oData.offsetWidth + this.Chart.oData.scrollLeft)) + "px"}else {this.Chart.divInfo.style.left = posX + "px"}};GanttProject.prototype.closePopUpInfo = function()
+{this.Chart.divInfo.style.display = "none"};GanttProject.prototype.resizeProjectItem = function(width)
+{var percentCompleted = this.percentCompleted;if (percentCompleted > 0 && percentCompleted < 100){this.projectItem[0].firstChild.style.width = width + "px";this.projectItem[0].firstChild.width = width + "px";this.projectItem[0].style.width = width + "px";this.projectItem[0].firstChild.rows[0].cells[0].firstChild.style.width = Math.round(width * percentCompleted / 100) + "px";this.projectItem[0].firstChild.rows[0].cells[1].firstChild.style.width = Math.round(width * (100 - percentCompleted) / 100) + "px";this.projectItem[0].lastChild.firstChild.width = width + "px"}else if (percentCompleted == 0 || percentCompleted == 100){this.projectItem[0].firstChild.style.width = width + "px";this.projectItem[0].firstChild.width = width + "px";this.projectItem[0].style.width = width + "px";this.projectItem[0].firstChild.rows[0].cells[0].firstChild.style.width = width + "px";this.projectItem[0].lastChild.firstChild.width = width + "px"}};GanttTask.prototype.moveCurrentTaskItem = function(width, moveChild)
+{var taskItem = this.cTaskItem[0];this.TaskInfo.EST = new Date(this.Chart.startDate);this.TaskInfo.EST.setHours(this.TaskInfo.EST.getHours() + (parseInt(taskItem.style.left) / this.Chart.hourInPixels));if (this.Chart.isShowDescTask){this.showDescTask()};if (this.cTaskItem[1].length > 0){this.cTaskItem[1][2].style.width = parseInt(this.cTaskItem[1][2].style.width) + width + "px";this.cTaskItem[1][1].style.left = parseInt(this.cTaskItem[1][1].style.left) + width + "px"};for (var i = 0;i < this.childTask.length;i++){if (!this.childTask[i].predTask){this.moveChildTaskItems(this.childTask[i], width, moveChild)}};for (var i = 0;i < this.childPredTask.length;i++){this.moveChildTaskItems(this.childPredTask[i], width, moveChild)}};GanttTask.prototype.moveChildTaskItems = function(task, width, moveChild)
+{var taskItem = task.cTaskItem[0];if (moveChild){taskItem.style.left = parseInt(taskItem.style.left) + width + "px";task.addDayInPanelTime();task.TaskInfo.EST = new Date(this.Chart.startDate);task.TaskInfo.EST.setHours(task.TaskInfo.EST.getHours() + (parseInt(taskItem.style.left) / this.Chart.hourInPixels));for (var n = 0;n < task.cTaskItem[1].length;n++){task.cTaskItem[1][n].style.left = parseInt(task.cTaskItem[1][n].style.left) + width + "px"};for (var i = 0;i < task.childTask.length;i++){if (!task.childTask[i].predTask){this.moveChildTaskItems(task.childTask[i], width, moveChild)}};for (var i = 0;i < task.childPredTask.length;i++){this.moveChildTaskItems(task.childPredTask[i], width, moveChild)}}else
+ {if (task.cTaskItem[1].length > 0){task.cTaskItem[1][2].style.left = parseInt(task.cTaskItem[1][2].style.left) + width + "px";task.cTaskItem[1][2].style.width = parseInt(task.cTaskItem[1][2].style.width) - width + "px";task.cTaskItem[1][0].style.left = parseInt(task.cTaskItem[1][0].style.left) + width + "px"}};if (this.Chart.isShowDescTask){task.moveDescTask()}};GanttTask.prototype.addDayInPanelTime = function()
+{var taskItem = this.cTaskItem[0];var width = parseInt(taskItem.style.left) + parseInt(taskItem.firstChild.firstChild.width) + 20;if (this.Chart.isShowDescTask){width += this.descrTask.offsetWidth};var table = this.Chart.panelTime.firstChild, tbody = table.firstChild;if (parseInt(tbody.offsetWidth)< width)
+ {var row = tbody.rows[1];var countDays = Math.round((width + 20 - parseInt(tbody.offsetWidth)) / this.Chart.dayInPixels);for (var n = 0;n < countDays;n++){this.Chart.addPointInTimePanel(row, table);this.Chart.addDayInPanelTime(row)};var w = this.Chart.dayInPixels * (row.cells.length);tbody.style.width = w + "px";this.Chart.panelTasks.style.width = (w-18) + "px"}};GanttTask.prototype.getDateOnPosition = function(position)
+{var date = new Date(this.Chart.startDate);date.setHours(date.getHours() + (position / this.Chart.hourInPixels));return date};GanttTask.prototype.moveItem = function(event)
+{var pageX = event.screenX;var posTaskItem = (this.posX + (pageX - this.MouseX));var widthTaskItem = parseInt(this.cTaskItem[0].childNodes[0].firstChild.width);var posTaskItemR = posTaskItem + widthTaskItem;if (this.checkMove){var date = this.getDateOnPosition(posTaskItem);var res = this.Chart.callEvent("onTaskDragging", [this,date])!==false;if (res && ((this.minPosXMove <= posTaskItem))
+ && ((posTaskItemR <= this.maxPosXMove) || (this.maxPosXMove == -1)))
+ {this.moveTaskItem(posTaskItem)}}};GanttTask.prototype.moveTaskItem = function(posX)
+{this.addDayInPanelTime();this.cTaskItem[0].style.left = posX + "px";var date = this.getDateOnPosition(posX);this.cTaskItem[0].childNodes[1].firstChild.rows[0].cells[0].innerHTML = date.getDate() + '.' + (date.getMonth() + 1) + '.' + date.getUTCFullYear()};GanttTask.prototype.resizeItem = function(event)
+{if (this.checkResize){var MouseX = event.screenX;var widthTaskItem = this.taskItemWidth + (MouseX - this.MouseX);var countHours = Math.round(widthTaskItem / this.Chart.hourInPixelsWork);if (this.Chart.callEvent("onTaskResizing", [this,countHours])===false) return;if (widthTaskItem >= this.taskItemWidth){if ((widthTaskItem <= this.maxWidthResize)|| (this.maxWidthResize == -1))
+ {this.resizeTaskItem(widthTaskItem);this.addDayInPanelTime()}else if ((this.maxWidthResize != -1)&& (widthTaskItem > this.maxWidthResize))
+ {this.resizeTaskItem(this.maxWidthResize)}}else if (widthTaskItem <= this.taskItemWidth){if (widthTaskItem >= this.minWidthResize){this.resizeTaskItem(widthTaskItem)}else if (widthTaskItem < this.minWidthResize){this.resizeTaskItem(this.minWidthResize)}}}};GanttTask.prototype.resizeTaskItem = function(width)
+{var taskItem = this.cTaskItem[0];var countHours = Math.round(width / this.Chart.hourInPixelsWork);var c = taskItem.childNodes[0].firstChild.rows[0].cells[0];if (c){c.firstChild.style.width = parseInt(c.width) * width / 100 + "px"};c = taskItem.childNodes[0].firstChild.rows[0].cells[1];if (c){c.firstChild.style.width = parseInt(c.width) * width / 100 + "px"};taskItem.childNodes[0].firstChild.width = width + "px";taskItem.childNodes[1].firstChild.width = width + "px";this.cTaskItem[0].childNodes[1].firstChild.rows[0].cells[0].innerHTML = countHours;taskItem.childNodes[2].childNodes[0].style.width = width + "px";taskItem.childNodes[2].childNodes[1].style.left = width - 10 + "px"};GanttTask.prototype.endResizeItem = function()
+{var taskItem = this.cTaskItem[0];this.wasResized = this.taskItemWidth != parseInt(taskItem.childNodes[0].firstChild.width);if (this.wasResized){var posXL = taskItem.offsetLeft;var posXR = taskItem.offsetLeft + parseInt(taskItem.childNodes[0].firstChild.width);this.TaskInfo.Duration = Math.round((posXR - posXL) / this.Chart.hourInPixelsWork);if (this.childPredTask.length > 0){for (var j = 0;j < this.childPredTask.length;j++){this.childPredTask[j].cTaskItem[1][2].style.width = parseInt(this.childPredTask[j].cTaskItem[1][2].style.width) - (parseInt(taskItem.childNodes[0].firstChild.width) - this.taskItemWidth) + "px";this.childPredTask[j].cTaskItem[1][2].style.left = parseInt(this.childPredTask[j].cTaskItem[1][2].style.left) + (parseInt(taskItem.childNodes[0].firstChild.width) - this.taskItemWidth) + "px";this.childPredTask[j].cTaskItem[1][0].style.left = parseInt(this.childPredTask[j].cTaskItem[1][0].style.left) + (parseInt(taskItem.childNodes[0].firstChild.width) - this.taskItemWidth) + "px"}}};this.cTaskItem[0].childNodes[1].firstChild.rows[0].cells[0].innerHTML = "";this.checkResize = false;this.taskItemWidth = 0;this.MouseX = 0;if (this.Chart.isShowDescTask){this.showDescTask()};this.Project.shiftProjectItem();if (this.Chart._isFF)document.body.style.cursor = ""};GanttProject.prototype.moveDescrProject = function()
+{this.descrProject.style.left = (parseInt(this.projectItem[0].style.left) + this.Duration * this.Chart.hourInPixelsWork + 10);this.descrProject.innerHTML = this.getDescStr()};GanttProject.prototype.showDescrProject = function()
+{var posX = (parseInt(this.projectItem[0].style.left) + this.Duration * this.Chart.hourInPixelsWork + 10);this.descrProject.style.left = posX + "px";this.descrProject.style.visibility = 'visible';this.descrProject.innerHTML = this.getDescStr()};GanttProject.prototype.hideDescrProject = function()
+{this.descrProject.style.visibility = 'hidden'};GanttProject.prototype.getDescStr = function()
+{var str = '', delim = ", ";for (var i = 0;i < this.Chart.paramShowProject.length;i++){switch (this.Chart.paramShowProject[i]) {case "Name":
+ if (str != "")str += delim;str += this.Project[this.Chart.paramShowProject[i]];break;case "StartDate":
+ if (str != "")str += delim;var d = this.Project[this.Chart.paramShowProject[i]];str += d.getDate() + "." + (d.getMonth() + 1) + "." + d.getFullYear();break;case "Duration":
+ if (str != "")str += delim;str += this[this.Chart.paramShowProject[i]] + "h";break;case "percentCompleted":
+ if (str != "")str += delim;str += this[this.Chart.paramShowProject[i]] + "%";break;default:
+ break}};return str};GanttProject.prototype.createDescrProject = function()
+{var posX = (this.posX + this.Duration * this.Chart.hourInPixelsWork + 10);var divDesc = document.createElement("div");divDesc.style.cssText += ";z-index:1;position:absolute;left:" + posX + "px;top:" + this.posY + "px;";divDesc.innerHTML = this.getDescStr();divDesc.className = "descProject";this.descrProject = divDesc;if (this.Project.ParentTasks.length == 0){this.descrProject.style.visibility = 'hidden'};if (this.Chart._showTooltip){var self = this;var getPopUpInfo = function(e) {if ((!self.Chart._isMove)&& (!self.Chart._isResize)) self.getPopUpInfo(self.descrProject, e)};var closePopUpInfo = function() {self.closePopUpInfo()};this.addEvent(divDesc, 'mouseover', getPopUpInfo, false);this.addEvent(divDesc, 'mouseout', closePopUpInfo, false)};return divDesc};GanttProject.prototype.createProjectItem = function()
+{var self = this;this.percentCompleted = this.getPercentCompleted();this.Duration = this.getDuration();var projectItem = document.createElement("div");projectItem.id = this.Project.Id;projectItem.style.cssText = ";z-index:1;position: absolute;left:" + this.posX + "px;top:" + this.posY + "px;";projectItem.style.width = this.Duration * this.Chart.hourInPixelsWork + "px";var tblProjectItem = document.createElement("table");projectItem.appendChild(tblProjectItem);tblProjectItem.cellPadding = "0";tblProjectItem.cellSpacing = "0";tblProjectItem.style.cssText = "border: solid 1px #BC810D;";var width = this.Duration * this.Chart.hourInPixelsWork;tblProjectItem.width = ((width == 0) ? 1 : width) + "px";tblProjectItem.style.width = ((width == 0) ? 1 : width) + "px";var rowprojectItem = tblProjectItem.insertRow(tblProjectItem.rows.length);if (this.percentCompleted != -1){if (this.percentCompleted != 0){var cellprojectItem = document.createElement("TD");rowprojectItem.appendChild(cellprojectItem);cellprojectItem.width = this.percentCompleted + "%";cellprojectItem.style.lineHeight = "1px";var imgPr = document.createElement("img");imgPr.style.width = (this.percentCompleted * this.Duration * this.Chart.hourInPixelsWork) / 100 + "px";imgPr.style.height = this.Chart.heightTaskItem + "px";cellprojectItem.appendChild(imgPr);imgPr.src = this.Chart.imgs + "parentnode_filled.png"};if (this.percentCompleted != 100){var cellprojectItem = document.createElement("TD");rowprojectItem.appendChild(cellprojectItem);cellprojectItem.width = (100 - this.percentCompleted) + "%";cellprojectItem.style.lineHeight = "1px";var imgPr = document.createElement("img");imgPr.style.width = ((100 - this.percentCompleted) * this.Duration * this.Chart.hourInPixelsWork) / 100 + "px";imgPr.style.height = this.Chart.heightTaskItem + "px";cellprojectItem.appendChild(imgPr);imgPr.src = this.Chart.imgs + "progress_bg.png"}}else
+ {var cellprojectItem = document.createElement("TD");rowprojectItem.appendChild(cellprojectItem);cellprojectItem.width = "1px";cellprojectItem.style.lineHeight = "1px";var imgPr = document.createElement("img");imgPr.style.width = "1px";imgPr.style.height = this.Chart.heightTaskItem;cellprojectItem.appendChild(imgPr);imgPr.src = this.Chart.imgs + "progress_bg.png"};var divTaskInfo = document.createElement("div");divTaskInfo.style.cssText = "text-align:center;z-index:2;position:absolute;left:0px;top:0px;";var tblTaskInfo = document.createElement("table");divTaskInfo.appendChild(tblTaskInfo);tblTaskInfo.cellPadding = "0";tblTaskInfo.cellSpacing = "0";tblTaskInfo.height = this.Chart.heightTaskItem + "px";tblTaskInfo.width = ((this.Duration * this.Chart.hourInPixelsWork == 0) ? 1 : this.Duration * this.Chart.hourInPixelsWork) + "px";var rowTaskInfo = tblTaskInfo.insertRow(0);var cellTaskInfo = document.createElement("td");cellTaskInfo.align = "center";cellTaskInfo.vAlign = "top";cellTaskInfo.height = this.Chart.heightTaskItem + "px";cellTaskInfo.className = "moveInfo";cellTaskInfo.style.cssText = ";white-space:nowrap;";rowTaskInfo.appendChild(cellTaskInfo);projectItem.appendChild(divTaskInfo);if (this.Project.ParentTasks.length == 0){projectItem.style.display = "none"};if (this.Chart._showTooltip){var getPopUpInfo = function(e) {if ((!self.Chart._isMove)&& (!self.Chart._isResize)) self.getPopUpInfo(self.projectItem[0], e)};var closePopUpInfo = function() {self.closePopUpInfo()};this.addEvent(divTaskInfo, 'mouseover', getPopUpInfo, false);this.addEvent(divTaskInfo, 'mouseout', closePopUpInfo, false)};return projectItem};GanttProject.prototype.createProjectNameItem = function()
+{var self = this;var divName = document.createElement("div");divName.style.cssText = "cursor:pointer;color:#003366;font-weight:bold;font-size:12px;font-family:Tahoma,Arial;white-space:nowrap;height:15px;z-index:1;position:absolute;left:" + 5 + "px;top:" + this.posY + "px;";divName.innerHTML = this.Project.Name;divName.title = this.Project.Name;if (this.Chart.isShowConMenu){var showContMenu = function(event) {if (self.Chart.contextMenu.clear)self.Chart.contextMenu.clear();var hideContMenu = null;if (!self.Chart._isIE){hideContMenu = function() {self.Chart.contextMenu.hideContextMenu();self.Chart.content.removeEventListener("mousedown", hideContMenu, false)}}else
+ {hideContMenu = function() {self.Chart.contextMenu.hideContextMenu();self.Chart.content.detachEvent("mousedown", hideContMenu)}};self.Chart.content.onmousedown = hideContMenu;if (!self.Chart._isIE){event.stopPropagation()}else
+ {event.cancelBubble = true};self.Chart._showContextMenu(event, self)};if (this.Chart._isIE){this.addEvent(divName, "contextmenu", function(e) {showContMenu(e);return false}, false)}else
+ {this.addEvent(divName, "contextmenu", function(e) {e.preventDefault();showContMenu(e)}, false)}};return divName};GanttProject.prototype.getPercentCompleted = function()
+{var sum = 0;var percentCompleted = 0;for (var i = 0;i < this.Project.ParentTasks.length;i++){sum += parseInt(this.Project.ParentTasks[i].PercentCompleted)};if (this.Project.ParentTasks.length != 0){return percentCompleted = Math.round(sum / this.Project.ParentTasks.length)}else {return percentCompleted = -1}};GanttProject.prototype.getDuration = function()
+{var duration = 0;var tmpDuration = 0;if (this.Project.ParentTasks.length > 0){for (var i = 0;i < this.Project.ParentTasks.length;i++){tmpDuration = this.Project.ParentTasks[i].Duration * 24 / this.Chart.hoursInDay + (this.Project.ParentTasks[i].EST - this.Chart.startDate) / (60 * 60 * 1000);if (tmpDuration > duration){duration = tmpDuration}};return ((duration - this.posX) / 24) * this.Chart.hoursInDay}else
+ {return 0}};GanttProject.prototype.getId = function()
+{return this.Project.Id};GanttProject.prototype.getName = function()
+{return this.Project.Name};GanttProject.prototype.getStartDate = function()
+{return this.Project.StartDate};GanttTask.prototype.addEvent = function (elm, evType, fn, useCapture)
+{if (elm.addEventListener){elm.addEventListener(evType, fn, useCapture);return true}else if (elm.attachEvent){return elm.attachEvent('on' + evType, fn)}else {elm['on' + evType] = fn}};GanttTask.prototype.startMove = function (event)
+{this.moveChild = event.ctrlKey;this.MouseX = event.screenX;this.getMoveInfo();this.checkMove = true;if (this.Chart.isShowDescTask){this.hideDescTask()};if (this.Chart._isFF)document.body.style.cursor = "move";if (this.Chart._isIE)event.srcElement.style.cursor = "move"};GanttTask.prototype.showDescTask = function()
+{var posX = (parseInt(this.cTaskItem[0].style.left) + this.TaskInfo.Duration * this.Chart.hourInPixelsWork + 10);this.descrTask.style.left = posX + "px";this.descrTask.innerHTML = this.getDescStr();this.descrTask.style.visibility = 'visible'};GanttTask.prototype.hideDescTask = function()
+{this.descrTask.style.visibility = 'hidden'};GanttTask.prototype.getDescStr = function()
+{var str = '', delim = ", ";for (var i = 0;i < this.Chart.paramShowTask.length;i++){var prop = this.Chart.paramShowTask[i], propValue = this.TaskInfo[prop];switch (prop) {case "Name":
+ if (str != "")str += delim;str += propValue;break;case "EST":
+ if (str != "")str += delim;str += propValue.getDate() + "." + (propValue.getMonth() + 1) + "." + propValue.getFullYear();break;case "S-F":
+ if (str != "")str += delim;propValue = this.TaskInfo["EST"];str += propValue.getDate() + "." + (propValue.getMonth() + 1) + "." + propValue.getFullYear() + " - ";propValue = this.getFinishDate();str += propValue.getDate() + "." + (propValue.getMonth() + 1) + "." + propValue.getFullYear();break;case "Duration":
+ if (str != "")str += delim;str += propValue + "h";break;case "PercentCompleted":
+ if (str != "")str += delim;str += propValue + "%";break;default:
+ break}};return str};GanttTask.prototype.getId = function()
+{return this.TaskInfo.Id};GanttTask.prototype.getName = function()
+{return this.TaskInfo.Name};GanttTask.prototype.getDuration = function()
+{return this.TaskInfo.Duration};GanttTask.prototype.getEST = function()
+{return this.TaskInfo.EST};GanttTask.prototype.getFinishDate = function()
+{var date = new Date(this.TaskInfo.EST);date.setDate(date.getDate() + parseInt((this.TaskInfo["Duration"]-1)/this.Chart.hoursInDay+1)-1);return date};GanttTask.prototype.getPercentCompleted = function()
+{return this.TaskInfo.PercentCompleted};GanttTask.prototype.getPredecessorTaskId = function()
+{return this.TaskInfo.PredecessorTaskId ? this.TaskInfo.PredecessorTaskId : null};GanttTask.prototype.getParentTaskId = function()
+{return this.parentTask ? this.parentTask.getId() : null};GanttTask.prototype.moveDescTask = function()
+{var posX = (parseInt(this.cTaskItem[0].style.left) + this.TaskInfo.Duration * this.Chart.hourInPixelsWork + 10);this.descrTask.style.left = posX + "px"};GanttTask.prototype.getMoveInfo = function()
+{this.posX = parseInt(this.cTaskItem[0].style.left);var widthTaskItem = parseInt(this.cTaskItem[0].childNodes[0].firstChild.width);var posParentTaskItem = (this.parentTask == null) ? 0 : parseInt(this.parentTask.cTaskItem[0].style.left);var posPredTaskItem = (this.predTask == null) ? 0 : parseInt(this.predTask.cTaskItem[0].style.left) + parseInt(this.predTask.cTaskItem[0].childNodes[0].firstChild.width);var widthParentTaskItem = (this.parentTask == null) ? 0 : parseInt(this.parentTask.cTaskItem[0].childNodes[0].firstChild.width);var childPredPosX = 0;var childParentPosX = 0;var childParentPosXR = 0;if (this.childPredTask.length > 0){var posChildTaskItem = null;for (var n = 0;n < this.childPredTask.length;n++){if ((!posChildTaskItem)|| ((posChildTaskItem) && (posChildTaskItem > parseInt(this.childPredTask[n].cTaskItem[0].style.left))))
+ {posChildTaskItem = parseInt(this.childPredTask[n].cTaskItem[0].style.left)}};childPredPosX = posChildTaskItem};if (this.childTask.length > 0){var posChildTaskItemR = null;for (var n = 0;n < this.childTask.length;n++){if ((!posChildTaskItemR)|| ((posChildTaskItemR) && (posChildTaskItemR > (parseInt(this.childTask[n].cTaskItem[0].style.left)))))
+ {posChildTaskItemR = parseInt(this.childTask[n].cTaskItem[0].style.left)}};childParentPosXR = posChildTaskItemR;var posChildTaskItem = null;for (var n = 0;n < this.childTask.length;n++){if ((!posChildTaskItem)|| ((posChildTaskItem) && (posChildTaskItem < (parseInt(this.childTask[n].cTaskItem[0].style.left) + parseInt(this.childTask[n].cTaskItem[0].firstChild.firstChild.width)))))
+ {posChildTaskItem = parseInt(this.childTask[n].cTaskItem[0].style.left) + parseInt(this.childTask[n].cTaskItem[0].firstChild.firstChild.width)}};childParentPosX = posChildTaskItem};if (!this.moveChild){if (this.childPredTask.length > 0){if (this.maxPosXMove < childPredPosX)this.maxPosXMove = childPredPosX};if (this.childTask.length > 0){if ((this.childPredTask.length > 0)&& (this.maxPosXMove - widthTaskItem) > childParentPosXR) this.maxPosXMove = this.maxPosXMove - ((this.maxPosXMove - widthTaskItem) - childParentPosXR);if (!(this.childPredTask.length > 0)) this.maxPosXMove = childParentPosXR + widthTaskItem;this.minPosXMove = (childParentPosX - widthTaskItem)};if (posParentTaskItem > 0){if ((!(this.childPredTask.length > 0)) && (this.childTask.length > 0)) {if (this.maxPosXMove > posParentTaskItem + widthParentTaskItem){this.maxPosXMove = posParentTaskItem + widthParentTaskItem}};if (this.minPosXMove <= posParentTaskItem){this.minPosXMove = posParentTaskItem};if ((!(this.childTask.length > 0)) && (!(this.childPredTask.length > 0))) {this.maxPosXMove = posParentTaskItem + widthParentTaskItem}else if ((!(this.childTask.length > 0)) && (this.childPredTask.length > 0)) {if ((posParentTaskItem + widthParentTaskItem)> posPredTaskItem) {this.maxPosXMove = childPredPosX}}};if (posPredTaskItem > 0){if (this.minPosXMove <= posPredTaskItem){this.minPosXMove = posPredTaskItem}};if ((posPredTaskItem == 0)&& (posParentTaskItem == 0)) {if (this.minPosXMove <= this.Chart.initialPos){this.minPosXMove = this.Chart.initialPos}}}else
+ {if ((posParentTaskItem > 0)&& (posPredTaskItem == 0))
+ {this.minPosXMove = posParentTaskItem;this.maxPosXMove = posParentTaskItem + widthParentTaskItem}else if ((posParentTaskItem == 0)&& (posPredTaskItem == 0))
+ {this.minPosXMove = this.Chart.initialPos;this.maxPosXMove = -1}else if ((posParentTaskItem > 0)&& (posPredTaskItem > 0))
+ {this.minPosXMove = posPredTaskItem;this.maxPosXMove = posParentTaskItem + widthParentTaskItem}else if ((posParentTaskItem == 0)&& (posPredTaskItem > 0))
+ {this.minPosXMove = posPredTaskItem;this.maxPosXMove = -1};if ((this.parentTask)&& (this.childPredTask.length > 0))
+ {var posChildTaskItem = this.getMaxPosPredChildTaskItem(this);var posParentTaskItem = parseInt(this.parentTask.cTaskItem[0].style.left) + parseInt(this.parentTask.cTaskItem[0].firstChild.firstChild.width);this.maxPosXMove = this.posX + widthTaskItem + posParentTaskItem - posChildTaskItem}}};GanttTask.prototype.startResize = function(event)
+{this.MouseX = event.screenX;this.getResizeInfo();if (this.Chart.isShowDescTask){this.hideDescTask()};this.checkResize = true;this.taskItemWidth = parseInt(this.cTaskItem[0].firstChild.firstChild.width);if (this.Chart._isFF)document.body.style.cursor = "e-resize"};GanttTask.prototype.getResizeInfo = function()
+{var taskItem = this.cTaskItem[0];var posParentTaskItem = (this.parentTask == null) ? 0 : parseInt(this.parentTask.cTaskItem[0].style.left);var widthParentTaskItem = (this.parentTask == null) ? 0 : parseInt(this.parentTask.cTaskItem[0].childNodes[0].firstChild.width);var posTaskItem = parseInt(this.cTaskItem[0].style.left);var childPredPosX = 0;var childParentPosX = 0;if (this.childPredTask.length > 0){var posChildTaskItem = null;for (var n = 0;n < this.childPredTask.length;n++){if ((!posChildTaskItem)|| ((posChildTaskItem) && (posChildTaskItem > parseInt(this.childPredTask[n].cTaskItem[0].style.left))))
+ {posChildTaskItem = parseInt(this.childPredTask[n].cTaskItem[0].style.left)}};childPredPosX = posChildTaskItem};if (this.childTask.length > 0){var posChildTaskItem = null;for (var n = 0;n < this.childTask.length;n++){if ((!posChildTaskItem)|| ((posChildTaskItem) && (posChildTaskItem < (parseInt(this.childTask[n].cTaskItem[0].style.left) + parseInt(this.childTask[n].cTaskItem[0].firstChild.firstChild.width)))))
+ {posChildTaskItem = parseInt(this.childTask[n].cTaskItem[0].style.left) + parseInt(this.childTask[n].cTaskItem[0].firstChild.firstChild.width)}};childParentPosX = posChildTaskItem};this.minWidthResize = this.Chart.dayInPixels;if (this.childTask.length > 0){this.minWidthResize = childParentPosX - posTaskItem};if ((this.childPredTask.length > 0)&& (!this.parentTask))
+ {this.maxWidthResize = childPredPosX - posTaskItem}else if ((this.childPredTask.length > 0)&& (this.parentTask))
+ {var w1 = posParentTaskItem + widthParentTaskItem - posTaskItem;var w2 = childPredPosX - posTaskItem;this.maxWidthResize = Math.min(w1, w2)}else if ((this.childPredTask.length == 0)&& (this.parentTask))
+ {this.maxWidthResize = posParentTaskItem + widthParentTaskItem - posTaskItem}};GanttTask.prototype.createTaskItem = function()
+{var self = this;this.posX = this.Chart.getPosOnDate(this.TaskInfo.EST);var itemControl = document.createElement("div");itemControl.id = this.TaskInfo.Id;itemControl.style.cssText = ";z-index:1;position:absolute;left:" + this.posX + "px;top:" + this.posY + "px;";var divTaskItem = document.createElement("div");itemControl.appendChild(divTaskItem);divTaskItem.style.cssText = "z-index:1;position: absolute;left:0px;top:0px;";var tblTaskItem = document.createElement("table");divTaskItem.appendChild(tblTaskItem);tblTaskItem.cellPadding = "0";tblTaskItem.cellSpacing = "0";tblTaskItem.width = this.TaskInfo.Duration * this.Chart.hourInPixelsWork + "px";tblTaskItem.style.cssText = "border: solid 1px #6589A9;";var rowTblTask = tblTaskItem.insertRow(tblTaskItem.rows.length);if (this.TaskInfo.PercentCompleted != 0){var cellTblTask = document.createElement("td");rowTblTask.appendChild(cellTblTask);cellTblTask.height = this.Chart.heightTaskItem + "px";cellTblTask.width = this.TaskInfo.PercentCompleted + "%";cellTblTask.style.lineHeight = "1px";var imgPr = document.createElement("img");imgPr.style.width = (this.TaskInfo.PercentCompleted * this.TaskInfo.Duration * this.Chart.hourInPixelsWork) / 100 + "px";imgPr.style.height = this.Chart.heightTaskItem + "px";cellTblTask.appendChild(imgPr);imgPr.src = this.Chart.imgs + "progress_filled.png"};if (this.TaskInfo.PercentCompleted != 100){var cellTblTask = document.createElement("td");rowTblTask.appendChild(cellTblTask);cellTblTask.height = this.Chart.heightTaskItem + "px";cellTblTask.width = (100 - this.TaskInfo.PercentCompleted) + "%";cellTblTask.style.lineHeight = "1px";var imgPrF = document.createElement("img");imgPrF.style.width = ((100 - this.TaskInfo.PercentCompleted) * this.TaskInfo.Duration * this.Chart.hourInPixelsWork) / 100 + "px";imgPrF.style.height = this.Chart.heightTaskItem + "px";cellTblTask.appendChild(imgPrF);imgPrF.src = this.Chart.imgs + "progress_bg.png"};if (this.Chart.isEditable){var divTaskInfo = document.createElement("div");divTaskInfo.style.cssText = "text-align:center;font-size:9px;z-index:2;position: absolute;left:0px;top:0px;";var tblTaskInfo = document.createElement("table");divTaskInfo.appendChild(tblTaskInfo);tblTaskInfo.cellPadding = "0";tblTaskInfo.cellSpacing = "0";tblTaskInfo.height = this.Chart.heightTaskItem + "px";tblTaskInfo.width = this.TaskInfo.Duration * this.Chart.hourInPixelsWork + "px";var rowTaskInfo = tblTaskInfo.insertRow(0);var cellTaskInfo = document.createElement("TD");cellTaskInfo.align = "center";cellTaskInfo.vAlign = "top";cellTaskInfo.height = this.Chart.heightTaskItem + "px";cellTaskInfo.className = "moveInfo";cellTaskInfo.style.cssText = ";white-space:nowrap;font-size:9px";rowTaskInfo.appendChild(cellTaskInfo);itemControl.appendChild(divTaskInfo)};var divTaskName = document.createElement("div");itemControl.appendChild(divTaskName);divTaskName.style.cssText = ";z-index:2;position: absolute;left:0px;top:0px;";var divMove = document.createElement("div");divMove.innerHTML = "";if (this.Chart._isIE){divMove.style.background = "#000000";divMove.style.filter = "alpha(opacity=0)"};divMove.style.height = this.Chart.heightTaskItem + "px";divMove.style.width = this.TaskInfo.Duration * this.Chart.hourInPixelsWork + "px";divTaskName.appendChild(divMove);if (this.Chart._showTooltip){var getPopUpInfo = function(e) {if ((!self.Chart._isMove)&& (!self.Chart._isResize)) self.getPopUpInfo(self.cTaskItem[0], e)};var closePopUpInfo = function() {self.closePopUpInfo()};this.addEvent(divMove, 'mouseover', getPopUpInfo, false);this.addEvent(divMove, 'mouseout', closePopUpInfo, false)};var taskClick = function() {self.Chart.callEvent("onTaskClick", [self])};this.addEvent(divMove, 'click', taskClick, false);if (this.Chart.isEditable){var divResize = document.createElement("div");divResize.style.cssText = ";z-index:10;position: absolute;left:" + (this.TaskInfo.Duration * this.Chart.hourInPixelsWork - 10) + "px;top:0px;";divResize.style.height = this.Chart.heightTaskItem + "px";divResize.style.width = "10px";divResize.innerHTML = "";divTaskName.appendChild(divResize);var startMove = function(e) {if (self.Chart.callEvent("onTaskStartDrag", [self])===false) return;var moveItem = function(e1) {if (self.checkMove)self.moveItem(e1)};var endMove = function() {if (self.checkMove){self.endMove();self.Chart._isMove = false;if (self.Chart._isIE){document.body.releaseCapture();document.detachEvent("onmousemove", moveItem);document.detachEvent("onmouseup", endMove)}else {document.removeEventListener("mousemove", moveItem, true);document.removeEventListener("mouseup", endMove, true)};if (self.wasMoved)self.Chart.callEvent("onTaskEndDrag", [self])}};self.addEvent(document, 'mousemove', moveItem, true);self.addEvent(document, 'mouseup', endMove, true);if (self.Chart._showTooltip)self.closePopUpInfo();self.startMove(e);self.Chart._isMove = true;if (self.Chart._isIE)document.body.setCapture(false)};var startResize = function(e) {if (self.Chart.callEvent("onTaskStartResize", [self])===false) return;var resizeItem = function(e1) {if (self.checkResize)self.resizeItem(e1)};var endResizeItem = function() {if (self.checkResize){self.endResizeItem();self.Chart._isResize = false;if (self.Chart._isIE){document.body.releaseCapture();document.detachEvent("onmousemove", resizeItem);document.detachEvent("onmouseup", endResizeItem)}else {document.removeEventListener("mousemove", resizeItem, true);document.removeEventListener("mouseup", endResizeItem, true)};if (self.wasResized)self.Chart.callEvent("onTaskEndResize", [self])}};self.addEvent(document, 'mousemove', resizeItem, false);self.addEvent(document, 'mouseup', endResizeItem, false);self.startResize(e);if (self.Chart._isIE)document.body.setCapture(false);self.Chart._isResize = true};this.addEvent(divMove, 'mousedown', startMove, false);this.addEvent(divResize, 'mousedown', startResize, false);var setCursorResize = function(e2) {if (!self.Chart._isMove)(e2.srcElement?e2.srcElement:e2.target).style.cursor = "e-resize"};var setCursorStandart = function(e3) {if (!self.checkResize)(e3.srcElement?e3.srcElement:e3.target).style.cursor = ""};this.addEvent(divResize, 'mouseover', setCursorResize, false);this.addEvent(divResize, 'mouseout', setCursorStandart, false)};return itemControl};GanttTask.prototype.createTaskNameItem = function(hasChildren)
+{var self = this;var divName = document.createElement("div");divName.id = this.TaskInfo.Id;divName.style.cssText = "cursor:pointer;white-space:nowrap;height:15px;z-index:1;position:absolute;left:20px;top: " + this.posY + "px;";if (hasChildren)divName.style.fontWeight = "bold";divName.className = "taskNameItem";divName.title = this.TaskInfo.Name;divName.innerHTML = this.TaskInfo.Name;if (this.Chart.isShowConMenu){var showContMenu = function(event) {if (self.Chart.contextMenu.clear)self.Chart.contextMenu.clear();var hideContMenu = function() {self.Chart.contextMenu.hideContextMenu();if (self.Chart._isIE)self.Chart.content.detachEvent("mousedown", hideContMenu);else
+ self.Chart.content.removeEventListener("mousedown", hideContMenu, false)};self.Chart.content.onmousedown = hideContMenu;if (!self.Chart._isIE){event.stopPropagation()}else
+ {event.cancelBubble = true};self.Chart._showContextMenu(event, self)};if (this.Chart._isIE){this.addEvent(divName, "contextmenu", function(e) {showContMenu(e);return false}, false)}else
+ {this.addEvent(divName, "contextmenu", function(e) {e.preventDefault();showContMenu(e)}, false)}};return divName};GanttTask.prototype.createTaskDescItem = function()
+{var posX = (this.posX + this.TaskInfo.Duration * this.Chart.hourInPixelsWork + 10);var divDesc = document.createElement("div");divDesc.style.cssText += ";z-index:1;position:absolute;left:" + posX + "px;top:" + this.posY + "px;";divDesc.innerHTML = this.getDescStr();divDesc.className = "descTask";this.descrTask = divDesc;if (this.Chart._showTooltip){var self = this;var getPopUpInfo = function(e) {if ((!self.Chart._isMove)&& (!self.Chart._isResize)) self.getPopUpInfo(self.descrTask, e)};var closePopUpInfo = function() {self.closePopUpInfo()};this.addEvent(divDesc, 'mouseover', getPopUpInfo, false);this.addEvent(divDesc, 'mouseout', closePopUpInfo, false)};return divDesc};GanttTask.prototype.checkWidthTaskNameItem = function()
+{if (this.cTaskNameItem[0].offsetWidth + this.cTaskNameItem[0].offsetLeft > this.Chart.maxWidthPanelNames){var width = this.cTaskNameItem[0].offsetWidth + this.cTaskNameItem[0].offsetLeft - this.Chart.maxWidthPanelNames;var countChar = Math.round(width / (this.cTaskNameItem[0].offsetWidth / this.cTaskNameItem[0].firstChild.length));var tName = this.TaskInfo.Name.substring(0, this.cTaskNameItem[0].firstChild.length - countChar - 3);tName += "...";this.cTaskNameItem[0].innerHTML = tName}};GanttTask.prototype.create = function()
+{var containerTasks = this.Chart.oData.firstChild;var containerNames = null;if (this.Chart._showTreePanel)containerNames = this.Chart.panelNames.firstChild;var predecessorTask = this.TaskInfo.PredecessorTask;var parentTask = this.TaskInfo.ParentTask;var isCParentTask = (this.TaskInfo.ChildTasks.length > 0);var self = this;this.cTaskItem = [];this.cTaskNameItem = [];if (!parentTask){if (this.TaskInfo.previousParentTask){this.previousParentTask = this.Project.getTaskById(this.TaskInfo.previousParentTask.Id);var lastChildTask = this.Chart.getLastChildTask(this.previousParentTask);this.posY = parseInt(lastChildTask.cTaskItem[0].style.top) + this.Chart.heightTaskItem + 11;this.previousParentTask.nextParentTask = this}else {this.posY = parseInt(this.Project.projectItem[0].style.top) + this.Chart.heightTaskItem + 11}};if (parentTask){var task = this.Project.getTaskById(this.TaskInfo.ParentTask.Id);this.parentTask = task;if (this.TaskInfo.previousChildTask){this.previousChildTask = this.Project.getTaskById(this.TaskInfo.previousChildTask.Id);var lastChildTask = this.Chart.getLastChildTask(this.previousChildTask);this.posY = parseInt(lastChildTask.cTaskItem[0].style.top) + this.Chart.heightTaskItem + 11;this.previousChildTask.nextChildTask = this}else {this.posY = parseInt(task.cTaskItem[0].style.top) + this.Chart.heightTaskItem + 11};task.childTask.push(this)};if (predecessorTask){var task = this.Project.getTaskById(predecessorTask.Id);this.predTask = task;task.childPredTask.push(this)};this.cTaskItem.push(this.createTaskItem());containerTasks.appendChild(this.cTaskItem[0]);if (this.Chart.panelNames){this.cTaskNameItem.push(this.createTaskNameItem(isCParentTask));this.Chart.panelNames.firstChild.appendChild(this.cTaskNameItem[0])};if (this.Chart.isShowDescTask){containerTasks.appendChild(this.createTaskDescItem())};var arrConnectingLines = [];if (predecessorTask)arrConnectingLines = this.createConnectingLinesDS();this.cTaskItem.push(arrConnectingLines);if (this.Chart.panelNames){var arrConnectingLinesNames = [];if (parentTask){this.cTaskNameItem[0].style.left = parseInt(this.parentTask.cTaskNameItem[0].style.left) + 15 + "px";arrConnectingLinesNames = this.createConnectingLinesPN()};this.checkWidthTaskNameItem();var treeImg = null;if (isCParentTask)treeImg = this.createTreeImg();this.cTaskNameItem.push(arrConnectingLinesNames);this.cTaskNameItem.push(treeImg)};this.addDayInPanelTime();return this};GanttTask.prototype.createTreeImg = function()
+{var self = this;var treeImg = new Image();treeImg.src = this.Chart.imgs + "minus.gif";treeImg.id = this.TaskInfo.Id;treeImg.onclick = function()
+ {if (self._isOpen){this.src = self.Chart.imgs + "plus.gif";self._isOpen = false;self.hideChildTasks(self);self.shiftCurrentTasks(self, -self._heightHideTasks)}else
+ {this.src = self.Chart.imgs + "minus.gif";self._isOpen = true;self.shiftCurrentTasks(self, self._heightHideTasks);self.showChildTasks(self, true);self._heightHideTasks = 0}};this.Chart.panelNames.firstChild.appendChild(treeImg);treeImg.style.cssText = "cursor:pointer;left:" + (parseInt(this.cTaskNameItem[0].style.left) - 12) + "px;top:" + (parseInt(this.cTaskNameItem[0].style.top) + 3) + "px;z-index:12;position:absolute;";return treeImg};GanttChart.prototype.getLastChildTask = function(task)
+{if (task.childTask.length > 0){return this.getLastChildTask(task.childTask[task.childTask.length - 1])}else
+ {return task}};dhtmlXMLSenderObject = function(ganttChart)
+{this.xmlHttp = this.createXMLHttpRequest();this.isProcessed = false;this.path = null;this.filename = null;this.Chart = ganttChart};dhtmlXMLSenderObject.prototype.createXMLHttpRequest = function()
+{if (window.XMLHttpRequest){return new XMLHttpRequest()}else if (window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP")}};dhtmlXMLSenderObject.prototype.sendData = function(filename, path, xmlData)
+{var self = this;this.path = path;this.filename = filename;if ((this.path == null)|| (this.path == ""))
+ {this.Chart.Error.throwError("DATA_SEND_ERROR", 3, null);return};if ((this.filename == null)|| (this.filename == ""))
+ {this.Chart.Error.throwError("DATA_SEND_ERROR", 4, null);return};this.isProcessed = true;this.xmlHttp.open("POST", this.path, true);if (this.Chart._isFF){this.xmlHttp.onerror = function() {self.xmlHttp.onreadystatechange = null;self.xmlHttp.abort();self.isProcessed = false}};this.xmlHttp.onreadystatechange = function() {self.getStatus()};this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");this.xmlHttp.send("data=" + encodeURI(xmlData) + "&filename=" + filename)};dhtmlXMLSenderObject.prototype.getStatus = function()
+{if (this.xmlHttp.readyState == 4){var _status = "";try {_status = this.xmlHttp.status}catch(e) {this.Chart.Error.throwError("DATA_SEND_ERROR", 1, null);return 0};switch (_status) {case 0:
+ this.Chart.Error.throwError("DATA_SEND_ERROR", 1, null);break;case 404:
+ this.Chart.Error.throwError("DATA_SEND_ERROR", 5, [this.path]);break;case 500:
+ this.Chart.Error.throwError("DATA_SEND_ERROR", 2, null);break;case 12029:
+ this.Chart.Error.throwError("DATA_SEND_ERROR", 1, null);break;default:
+ if (!(_status >= 200 && _status < 300 || _status == 304))
+ {this.Chart.Error.throwError("DATA_SEND_ERROR", 0, null)};break};this.isProcessed = false}};function GanttError() {this.catches = [];this._errors = [];this._init();return this};GanttError.prototype._init = function()
+{this._errors[0] = "Connection error";this._errors[1] = "Cannot connect";this._errors[2] = "Server error";this._errors[3] = "Path is null or empty";this._errors[4] = "Filename is null or empty";this._errors[5] = "File (%0) is not found";this._errors[6] = "Percent Complete should be a number";this._errors[7] = "Percent Complete should be <= 100";this._errors[8] = "Percent Complete should be >= 0";this._errors[9] = "Increase duration of task(%0)";this._errors[10] = "Reduce duration of task(%0)";this._errors[11] = "Increase EST of child task (%0)";this._errors[12] = "Reduce EST of task (%0)";this._errors[13] = "The project (%0) is added";this._errors[14] = "Start Date of the project < start Date of the control";this._errors[15] = "Task (%0) cannot be the child of predecessor task(%1)";this._errors[16] = "Time of the termination of predecessor task(%0) > EST of child task(%1)";this._errors[17] = "The Predecessor (%0) task does not exist";this._errors[18] = "The EST of task (%0) < start date of the control";this._errors[19] = "Time of the termination of parent task (%0) < time of the termination of child task(%1)";this._errors[20] = "The EST of task (%0) < EST of parent task(%1)";this._errors[21] = "The parent task (%0) does not exist";this._errors[22] = "The task (%0) is added";this._errors[23] = "The project (%0) is added";this._errors[24] = "Task (%0) EST < project (%1) startDate";this._errors[25] = "Parent task (%0) EST cannot be null";this._errors[26] = "Predecessor task (%0) position error. Reduce duration of predecessor task (%0) or increase EST of child task (%1)";this._errors[27] = "Predecessor task (%0) does not exist";this._errors[28] = "Increase duration of parent task (%0) or reduce EST of child task (%1) or reduce duration of child task(%1)";this._errors[29] = "Reduce EST of parent task (%0) or increase EST of child task (%1)";this._errors[30] = "The task(%0) does not exist";this._errors[31] = "The project(%0) does not exist";this._errors[32] = "Predecessor task(%0) and child task(%1) should have the same parent";this._errors[33] = "Reduce EST of parent task (%0) or increase EST of child task (%1)";this._errors[34] = "EST of task(%0) < start date of the project(%1)";this._errors[35] = "Percent Complete should be <= 100 and >= 0";this._errors[36] = "You may not connect a task to itself.";this._errors[37] = "Cannot parse this XML string."};GanttError.prototype.catchError = function(type, handler) {this.catches[type] = handler};GanttError.prototype.getErrorString = function(str, params)
+{if (!params){return str}else {for (var i = 0;i < params.length;i++){var re = new RegExp("%" + i, "gi");str = str.replace(re, params[i])};return str}};GanttError.prototype.throwError = function(type, description, params) {if (this.catches[type]){var index = parseInt(description);var errorStr = this.getErrorString(this._errors[index], params);return this.catches[type](type, errorStr, params)};return null};function contextMenu(chart)
+{this.Chart = chart;this.TabContainer = null;this.MenuPanel = null;this.tabPanel = null;this.arrTabs = [];this.isShow = false;this.hideDiv = null;this._init()};contextMenu.prototype._init = function()
+{this.createMenuPanel();this.createHideDiv();this.createTabContainer();this.createTabPanel();var self = this;var arrItems = [];var tab1 = this.createTab(1, "Rename task", "t", true, this);tab1.addItem(1, "New name", document.createElement("input"), "text", function() {tab1.arrItems[0].control.focus()});tab1.addItem(2, "Rename", document.createElement("input"), "button",
+ function() {var name = tab1.arrItems[0].control.value;try {tab1.object.setName(name);tab1.hide()}catch(e) {}});var tab2 = this.createTab(2, "Delete task", "t", true, this);tab2.addItem(1, "Delete", document.createElement("input"), "button",
+ function()
+ {try {tab2.object.Project.deleteTask(tab2.object.TaskInfo.Id);tab2.hide()}catch(e) {}});var tab3 = this.createTab(3, "Set EST", "t", true, this);tab3.addItem(1, "EST", document.createElement("input"), "text", function() {tab3.arrItems[0].control.focus()});tab3.addItem(2, "Move children", document.createElement("input"), "checkbox", function() {tab3.arrItems[1].control.focus()});tab3.addItem(3, "Update", document.createElement("input"), "button",
+ function() {var isMoveChild = tab3.arrItems[1].control.checked;var arr = tab3.arrItems[0].control.value.split(".");var est = (arr.length < 3) ? null : (new Date(arr[2], parseInt(arr[1]) - 1, arr[0]));try {if (tab3.object.setEST(est, isMoveChild)) tab3.hide()}catch(e) {}});var tab4 = this.createTab(4, "Set duration", "t", true, this);tab4.addItem(1, "Duration", document.createElement("input"), "text", function() {tab4.arrItems[0].control.focus()});tab4.addItem(2, "Update", document.createElement("input"), "button",
+ function() {var d = tab4.arrItems[0].control.value;try {if (tab4.object.setDuration(d)) tab4.hide()}catch(e) {}});var tab5 = this.createTab(5, "Set % complete", "t", true, this);tab5.addItem(1, "Percent Complete", document.createElement("input"), "text", function() {tab5.arrItems[0].control.focus()});tab5.addItem(2, "Update", document.createElement("input"), "button",
+ function() {var p = tab5.arrItems[0].control.value;try {if (tab5.object.setPercentCompleted(p)) tab5.hide()}catch(e) {}});var tab13 = this.createTab(13, "Set predecessor", "t", true, this);tab13.addItem(1, "Predecessor", document.createElement("input"), "text", function() {tab13.arrItems[0].control.focus()});tab13.addItem(2, "Update", document.createElement("input"), "button",
+ function() {var p = tab13.arrItems[0].control.value;try {if (tab13.object.setPredecessor(p)) tab13.hide()}catch(e) {}});var tab6 = this.createTab(6, "Rename project", "p", true, this);tab6.addItem(1, "New name", document.createElement("input"), "text", function() {tab6.arrItems[0].control.focus()});tab6.addItem(2, "Rename", document.createElement("input"), "button",
+ function() {var name = tab6.arrItems[0].control.value;try {tab6.object.setName(name);tab6.hide()}catch(e) {}});var tab7 = this.createTab(7, "Delete project", "p", true, this);tab7.addItem(1, "Delete", document.createElement("input"), "button",
+ function() {try {tab7.object.Chart.deleteProject(tab7.object.Project.Id);tab7.hide()}catch(e) {}});var tab8 = this.createTab(8, "Set % complete", "p", true, this);tab8.addItem(1, "Percent Complete", document.createElement("input"), "text", function() {tab8.arrItems[0].control.focus()});tab8.addItem(2, "Update", document.createElement("input"), "button",
+ function() {var p = tab8.arrItems[0].control.value;try {if (tab8.object.setPercentCompleted(p)) tab8.hide()}catch(e) {}});var tab9 = this.createTab(9, "Add new task", "p", true, this);tab9.addItem(1, "Id", document.createElement("input"), "text", function() {tab9.arrItems[0].control.focus()});tab9.addItem(2, "Name", document.createElement("input"), "text", function() {tab9.arrItems[1].control.focus()});tab9.addItem(3, "EST", document.createElement("input"), "text", function() {tab9.arrItems[2].control.focus()});tab9.addItem(4, "Duration", document.createElement("input"), "text", function() {tab9.arrItems[3].control.focus()});tab9.addItem(5, "Percent complete", document.createElement("input"), "text", function() {tab9.arrItems[4].control.focus()});tab9.addItem(6, "Parent task id", document.createElement("input"), "text", function() {tab9.arrItems[5].control.focus()});tab9.addItem(7, "Pred task id", document.createElement("input"), "text", function() {tab9.arrItems[6].control.focus()});tab9.addItem(9, "Insert", document.createElement("input"), "button",
+ function() {try {var id = tab9.arrItems[0].control.value;var name = tab9.arrItems[1].control.value;var arr = tab9.arrItems[2].control.value.split(".");var est = (arr.length < 3) ? null : (new Date(arr[2], parseInt(arr[1]) - 1, arr[0]));var duration = tab9.arrItems[3].control.value;var pc = tab9.arrItems[4].control.value;var parentTaskId = tab9.arrItems[5].control.value;var predTaskId = tab9.arrItems[6].control.value;if (tab9.object.insertTask(id, name, est, duration, pc, predTaskId, parentTaskId)) tab9.hide()}catch(e) {}});var tab11 = this.createTab(11, "Add successor task", "t", true, this);tab11.addItem(1, "Id", document.createElement("input"), "text", function() {tab11.arrItems[0].control.focus()});tab11.addItem(2, "Name", document.createElement("input"), "text", function() {tab11.arrItems[1].control.focus()});tab11.addItem(3, "EST", document.createElement("input"), "text", function() {tab11.arrItems[2].control.focus()});tab11.addItem(4, "Duration", document.createElement("input"), "text", function() {tab11.arrItems[3].control.focus()});tab11.addItem(5, "Percent complete", document.createElement("input"), "text", function() {tab11.arrItems[4].control.focus()});tab11.addItem(6, "Insert", document.createElement("input"), "button",
+ function() {try {var pr = tab11.object.Project;var id = tab11.arrItems[0].control.value;var name = tab11.arrItems[1].control.value;var arr = tab11.arrItems[2].control.value.split(".");var est = (arr.length < 3) ? null : (new Date(arr[2], parseInt(arr[1]) - 1, arr[0]));var duration = tab11.arrItems[3].control.value;var pc = tab11.arrItems[4].control.value;var parentTaskId = (tab11.object.parentTask == null) ? "" : tab11.object.parentTask.TaskInfo.Id;var predTaskId = tab11.object.TaskInfo.Id;if (pr.insertTask(id, name, est, duration, pc, predTaskId, parentTaskId)) tab11.hide()}catch(e) {}});var tab10 = this.createTab(10, "Add child task", "t", true, this);tab10.addItem(1, "Id", document.createElement("input"), "text", function() {tab10.arrItems[0].control.focus()});tab10.addItem(2, "Name", document.createElement("input"), "text", function() {tab10.arrItems[1].control.focus()});tab10.addItem(3, "EST", document.createElement("input"), "text", function() {tab10.arrItems[2].control.focus()});tab10.addItem(4, "Duration", document.createElement("input"), "text", function() {tab10.arrItems[3].control.focus()});tab10.addItem(5, "Percent complete", document.createElement("input"), "text", function() {tab10.arrItems[4].control.focus()});tab10.addItem(6, "Insert", document.createElement("input"), "button",
+ function() {try {var pr = tab10.object.Project;var id = tab10.arrItems[0].control.value;var name = tab10.arrItems[1].control.value;var arr = tab10.arrItems[2].control.value.split(".");var est = (arr.length < 3) ? null : (new Date(arr[2], parseInt(arr[1]) - 1, arr[0]));var duration = tab10.arrItems[3].control.value;var pc = tab10.arrItems[4].control.value;var parentTaskId = tab10.object.TaskInfo.Id;var predTaskId = "";if (pr.insertTask(id, name, est, duration, pc, predTaskId, parentTaskId)) tab10.hide()}catch(e) {}});var tab12 = this.createTab(12, "-Insert new project-", "p", false, this);tab12.addItem(1, "Id", document.createElement("input"), "text", function() {tab12.arrItems[0].control.focus()});tab12.addItem(2, "Name", document.createElement("input"), "text", function() {tab12.arrItems[1].control.focus()});tab12.addItem(3, "Start date", document.createElement("input"), "text", function() {tab12.arrItems[2].control.focus()});tab12.addItem(4, "Insert", document.createElement("input"), "button",
+ function() {try {var id = tab12.arrItems[0].control.value;var namePr = tab12.arrItems[1].control.value;var arr = tab12.arrItems[2].control.value.split(".");var startDatePr = (arr.length < 3) ? null : (new Date(arr[2], parseInt(arr[1]) - 1, arr[0]));if (self.Chart.insertProject(id, namePr, startDatePr)) tab12.hide()}catch(e) {}})};contextMenu.prototype.createHideDiv = function()
+{this.hideDiv = document.createElement("div");this.hideDiv.style.position = "absolute";this.hideDiv.style.left = "0px";this.hideDiv.style.top = "0px";this.Chart.content.appendChild(this.hideDiv);this.hideDiv.style.zIndex = 12;this.hideDiv.style.display = "none";this.hideDiv.style.background = "#7D7E7D";this.hideDiv.style.cssText += ";-moz-opacity: 0.5;filter: alpha(opacity=50);opacity:.50;";this.hideDiv.style.width = this.Chart.content.offsetWidth + 2 + "px";this.hideDiv.style.height = this.Chart.content.offsetHeight + 2 + "px"};contextMenu.prototype.createMenuPanel = function()
+{this.MenuPanel = document.createElement("div");this.MenuPanel.style.visibility = "hidden";this.MenuPanel.style.cssText += ";z-index:10;";this.MenuPanel.style.position = "absolute";this.Chart.content.appendChild(this.MenuPanel);this.MenuPanel.innerHTML = "";this.MenuPanel.firstChild.className = "contextMenu";this.MenuPanel.firstChild.cellPadding = 0;this.MenuPanel.firstChild.cellSpacing = 0;this.MenuPanel.firstChild.style.cssText += ";background:url(" + this.Chart.imgs + "menu/menu_bg.png);"};contextMenu.prototype.createTabPanel = function()
+{this.tabPanel = document.createElement("div");this.tabPanel.style.visibility = "hidden";this.tabPanel.style.zIndex = "30";this.TabContainer.firstChild.rows[0].cells[0].appendChild(this.tabPanel);this.tabPanel.style.width = "385px";this.tabPanel.style.height = "290px";this.tabPanel.innerHTML = "
";this.tabPanel.firstChild.cellPadding = 0;this.tabPanel.firstChild.cellSpacing = 0;this.tabPanel.firstChild.style.cssText = "width:385px;border: 1px solid #808080;";this.tabPanel.firstChild.rows[0].cells[0].style.cssText = ";height:26px;background:url(" + this.Chart.imgs + "/menu/window_tr.png);background-repeat: no-repeat;color:#fff;font-size:14px;font-weight: bold;font-family: Tahoma, Arial";this.tabPanel.firstChild.rows[0].cells[0].align = "center";this.tabPanel.firstChild.rows[1].cells[0].style.cssText = ";height:270px;background:#F7F7F7;";this.tabPanel.firstChild.rows[1].cells[0].innerHTML = "";this.tabPanel.firstChild.rows[1].cells[0].firstChild.style.cssText = "width:250px;font-size:11px;font-family:Tahoma,Arial;";this.tabPanel.firstChild.rows[1].cells[0].align = "center"};contextMenu.prototype.addItemMenuPanel = function(tab)
+{var self = this;var row = this.MenuPanel.firstChild.insertRow(this.MenuPanel.firstChild.rows.length);var cell = document.createElement('td');cell.innerHTML = tab.Description;cell.style.cssText = "padding-left:10px;height:18px;";this.addEvent(cell, "mousedown", function() {tab.show()}, false);cell.onmouseover = function() {this.style.background = "url(" + self.Chart.imgs + "menu/menu_selection.png)"};cell.onmouseout = function() {this.style.background = ""};row.appendChild(cell)};contextMenu.prototype.showContextMenu = function(x, y, object)
+{if (object.constructor == GanttTask){for (var i = 0;i < this.arrTabs.length;i++){if (this.arrTabs[i].type == "t"){this.arrTabs[i].object = object;this.addItemMenuPanel(this.arrTabs[i])}}}else if (object.constructor == GanttProject){for (var i = 0;i < this.arrTabs.length;i++){if (this.arrTabs[i].type == "p"){this.arrTabs[i].object = object;this.addItemMenuPanel(this.arrTabs[i])}}};this.isShow = true;this.MenuPanel.style.cssText += ";z-index:15;";this.MenuPanel.style.visibility = "visible";this.MenuPanel.style.top = parseInt(y) + this.Chart.heightTaskItem - this.Chart.oData.scrollTop + 5 + "px";this.MenuPanel.style.left = x};contextMenu.prototype.hideContextMenu = function()
+{this.isShow = false;this.MenuPanel.style.visibility = "hidden"};contextMenu.prototype.clear = function()
+{this.MenuPanel.removeChild(this.MenuPanel.firstChild);this.MenuPanel.innerHTML = "
";this.MenuPanel.firstChild.className = "contextMenu";this.MenuPanel.firstChild.cellPadding = 0;this.MenuPanel.firstChild.cellSpacing = 0;this.MenuPanel.firstChild.style.cssText += ";background:url(" + this.Chart.imgs + "menu/menu_bg.png);"};contextMenu.prototype.createTab = function(id, desc, type, showOInfo, menu)
+{var tab = new contextMenuTab(id, desc, type, showOInfo, menu);this.arrTabs.push(tab);return tab};contextMenu.prototype.createTabContainer = function()
+{this.TabContainer = document.createElement("div");this.TabContainer.style.position = "absolute";this.TabContainer.style.top = "0px";this.TabContainer.style.left = "0px";this.TabContainer.style.visibility = "hidden";this.TabContainer.style.zIndex = "50";this.Chart.content.appendChild(this.TabContainer);this.TabContainer.innerHTML = "
";this.TabContainer.firstChild.style.cssText = ";width:100%;height:100%;";this.TabContainer.firstChild.rows[0].cells[0].align = "center";this.TabContainer.style.width = this.Chart.content.offsetWidth + 2 + "px";this.TabContainer.style.height = this.Chart.content.offsetHeight + 2 + "px"};contextMenu.prototype.getTabById = function(id)
+{for (var i = 0;i < this.arrTabs.length;i++){if (this.arrTabs[i].Id == id){return this.arrTabs[i]}};return null};function contextMenuTab(id, description, type, showOInfo, contextMenu)
+{this.Id = id;this.arrItems = [];this.TabItemContainer = null;this.Description = description;this.contextMenu = contextMenu;this.type = type;this.object = null;this.showObjectInfo = showOInfo};contextMenu.prototype.addEvent = function (elm, evType, fn, useCapture)
+{if (elm.addEventListener){elm.addEventListener(evType, fn, useCapture);return true}else if (elm.attachEvent){return elm.attachEvent('on' + evType, fn)}else {elm['on' + evType] = fn}};contextMenuTab.prototype.addItem = function(id, name, control, type, handler)
+{if (handler){control.onclick = handler};control.type = type;if (type == "button"){control.value = name};var tabItem = new contextMenuTabItem(id, name, control, this);this.arrItems.push(tabItem)};contextMenuTab.prototype.show = function()
+{this.contextMenu.hideDiv.style.display = "inline";this.contextMenu.TabContainer.style.visibility = "visible";var self = this;this.contextMenu.tabPanel.firstChild.rows[0].cells[0].innerHTML = this.Description;this.contextMenu.tabPanel.style.visibility = "visible";var t = this.contextMenu.tabPanel.firstChild.rows[1].cells[0].firstChild;var c,c2,r = null;if (this.showObjectInfo){if (this.object){if (this.object.constructor == GanttTask){this.insertData(t, "Id", this.object.TaskInfo.Id);this.insertData(t, "Name", this.object.TaskInfo.Name);this.insertData(t, "Duration", this.object.TaskInfo.Duration + " hrs");this.insertData(t, "Percent complete", this.object.TaskInfo.PercentCompleted + "%");this.insertData(t, "EST", this.object.TaskInfo.EST.getDate() + "." + (this.object.TaskInfo.EST.getMonth() + 1) + "." + this.object.TaskInfo.EST.getFullYear());this.insertData(t, "Predecessor", this.object.TaskInfo.PredecessorTaskId)}else
+ {this.insertData(t, "Id", this.object.Project.Id);this.insertData(t, "Name", this.object.Project.Name);this.insertData(t, "Start date", this.object.Project.StartDate.getDate() + "." + (this.object.Project.StartDate.getMonth() + 1) + "." + this.object.Project.StartDate.getFullYear())}}};var btnCell = null;for (var i = 0;i < this.arrItems.length;i++){if (this.arrItems[i].control.type == "button"){r = t.insertRow(t.rows.length);c = r.insertCell(r.cells.length);btnCell = r.insertCell(r.cells.length);btnCell.appendChild(this.arrItems[i].control)}else
+ {r = t.insertRow(t.rows.length);c = r.insertCell(r.cells.length);c2 = r.insertCell(r.cells.length);c.innerHTML = this.arrItems[i].Name;c2.appendChild(this.arrItems[i].control)}};var b = document.createElement("input");b.type = "button";b.value = "Cancel";b.onclick = function()
+ {self.hide()};if (!btnCell){r = t.insertRow(t.rows.length);c = r.insertCell(r.cells.length);btnCell = r.insertCell(r.cells.length)}else {b.style.marginLeft = "10px"};btnCell.appendChild(b)};contextMenuTab.prototype.hide = function()
+{this.contextMenu.tabPanel.style.visibility = "hidden";var t = this.contextMenu.tabPanel.firstChild.rows[1].cells[0].firstChild;t.parentNode.removeChild(t);this.contextMenu.tabPanel.firstChild.rows[1].cells[0].innerHTML = "";this.contextMenu.tabPanel.firstChild.rows[1].cells[0].firstChild.style.cssText = "width:250px;font-size:11px;font-family:Tahoma,Arial;";this.contextMenu.hideDiv.style.display = "none";this.contextMenu.TabContainer.style.visibility = "hidden"};contextMenuTab.prototype.insertData = function(t, name, value)
+{var c,c2,r = null;r = t.insertRow(t.rows.length);c = r.insertCell(r.cells.length);c.style.cssText = "width:100px";c.innerHTML = name;c2 = r.insertCell(r.cells.length);c2.innerHTML = value};contextMenuTab.prototype.insertControl = function(t, name, value)
+{var c,c2,r = null;r = t.insertRow(t.rows.length);c = r.insertCell(r.cells.length);c.innerHTML = name;c2 = r.insertCell(r.cells.length);c2.appendChild(value)};function contextMenuTabItem(id, name, control, tab)
+{this.Id = id;this.Name = name;this.control = control;this.tab = tab};
+//v.1.3 build 9733
+
+/*
+Copyright DHTMLX LTD. http://www.dhtmlx.com
+*/
\ No newline at end of file
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/arr.gif b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/arr.gif
new file mode 100644
index 00000000000..3bd086371b2
Binary files /dev/null and b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/arr.gif differ
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/bg.png b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/bg.png
new file mode 100644
index 00000000000..9d495780d13
Binary files /dev/null and b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/bg.png differ
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/bg_week.png b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/bg_week.png
new file mode 100644
index 00000000000..68376a9c70d
Binary files /dev/null and b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/bg_week.png differ
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/menu/menu_bg.png b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/menu/menu_bg.png
new file mode 100644
index 00000000000..02f41eaf5d8
Binary files /dev/null and b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/menu/menu_bg.png differ
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/menu/menu_selection.png b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/menu/menu_selection.png
new file mode 100644
index 00000000000..aa35f7dcf5f
Binary files /dev/null and b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/menu/menu_selection.png differ
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/menu/window_tr.png b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/menu/window_tr.png
new file mode 100644
index 00000000000..556058d6b22
Binary files /dev/null and b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/menu/window_tr.png differ
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/minus.gif b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/minus.gif
new file mode 100644
index 00000000000..470c6736e72
Binary files /dev/null and b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/minus.gif differ
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/parentnode_filled.png b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/parentnode_filled.png
new file mode 100644
index 00000000000..1d08f670c44
Binary files /dev/null and b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/parentnode_filled.png differ
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/plus.gif b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/plus.gif
new file mode 100644
index 00000000000..ff22238004d
Binary files /dev/null and b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/plus.gif differ
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/progress_bg.png b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/progress_bg.png
new file mode 100644
index 00000000000..69205da45a8
Binary files /dev/null and b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/progress_bg.png differ
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/progress_filled.png b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/progress_filled.png
new file mode 100644
index 00000000000..8be117b1ad2
Binary files /dev/null and b/addons/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/progress_filled.png differ
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/index.html b/addons/base_gantt/static/lib/dhtmlxGantt/index.html
new file mode 100644
index 00000000000..5196d426ca6
--- /dev/null
+++ b/addons/base_gantt/static/lib/dhtmlxGantt/index.html
@@ -0,0 +1,107 @@
+
+
+
Initialize object on page
+
+
+
+
+
+
+
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/readme.txt b/addons/base_gantt/static/lib/dhtmlxGantt/readme.txt
new file mode 100644
index 00000000000..fc2627d9fb7
--- /dev/null
+++ b/addons/base_gantt/static/lib/dhtmlxGantt/readme.txt
@@ -0,0 +1,7 @@
+dhtmlxGantt v.1.3 Standard edition build 100805
+
+This component is allowed to be used under GPL, othervise you need to obtain Commercial or Enterise License
+to use it in non-GPL project. Please contact sales@dhtmlx.com for details.
+
+
+(c) DHTMLX Ltd.
\ No newline at end of file
diff --git a/addons/base_gantt/static/lib/dhtmlxGantt/sources/dhtmlxcommon.js b/addons/base_gantt/static/lib/dhtmlxGantt/sources/dhtmlxcommon.js
new file mode 100644
index 00000000000..7f68a0a702c
--- /dev/null
+++ b/addons/base_gantt/static/lib/dhtmlxGantt/sources/dhtmlxcommon.js
@@ -0,0 +1,938 @@
+/*
+Copyright DHTMLX LTD. http://www.dhtmlx.com
+To use this component please contact sales@dhtmlx.com to obtain license
+*/
+
+dhtmlx=function(obj){
+ for (var a in obj) dhtmlx[a]=obj[a];
+ return dhtmlx; //simple singleton
+};
+dhtmlx.extend_api=function(name,map,ext){
+ var t = window[name];
+ if (!t) return; //component not defined
+ window[name]=function(obj){
+ if (obj && typeof obj == "object" && !obj.tagName){
+ var that = t.apply(this,(map._init?map._init(obj):arguments));
+ //global settings
+ for (var a in dhtmlx)
+ if (map[a]) this[map[a]](dhtmlx[a]);
+ //local settings
+ for (var a in obj){
+ if (map[a]) this[map[a]](obj[a]);
+ else if (a.indexOf("on")==0){
+ this.attachEvent(a,obj[a]);
+ }
+ }
+ } else
+ var that = t.apply(this,arguments);
+ if (map._patch) map._patch(this);
+ return that||this;
+ };
+ window[name].prototype=t.prototype;
+ if (ext)
+ dhtmlXHeir(window[name].prototype,ext);
+};
+
+dhtmlxAjax={
+ get:function(url,callback){
+ var t=new dtmlXMLLoaderObject(true);
+ t.async=(arguments.length<3);
+ t.waitCall=callback;
+ t.loadXML(url)
+ return t;
+ },
+ post:function(url,post,callback){
+ var t=new dtmlXMLLoaderObject(true);
+ t.async=(arguments.length<4);
+ t.waitCall=callback;
+ t.loadXML(url,true,post)
+ return t;
+ },
+ getSync:function(url){
+ return this.get(url,null,true)
+ },
+ postSync:function(url,post){
+ return this.post(url,post,null,true);
+ }
+}
+
+/**
+ * @desc: xmlLoader object
+ * @type: private
+ * @param: funcObject - xml parser function
+ * @param: object - jsControl object
+ * @param: async - sync/async mode (async by default)
+ * @param: rSeed - enable/disable random seed ( prevent IE caching)
+ * @topic: 0
+ */
+function dtmlXMLLoaderObject(funcObject, dhtmlObject, async, rSeed){
+ this.xmlDoc="";
+
+ if (typeof (async) != "undefined")
+ this.async=async;
+ else
+ this.async=true;
+
+ this.onloadAction=funcObject||null;
+ this.mainObject=dhtmlObject||null;
+ this.waitCall=null;
+ this.rSeed=rSeed||false;
+ return this;
+};
+/**
+ * @desc: xml loading handler
+ * @type: private
+ * @param: dtmlObject - xmlLoader object
+ * @topic: 0
+ */
+dtmlXMLLoaderObject.prototype.waitLoadFunction=function(dhtmlObject){
+ var once = true;
+ this.check=function (){
+ if ((dhtmlObject)&&(dhtmlObject.onloadAction != null)){
+ if ((!dhtmlObject.xmlDoc.readyState)||(dhtmlObject.xmlDoc.readyState == 4)){
+ if (!once)
+ return;
+
+ once=false; //IE 5 fix
+ if (typeof dhtmlObject.onloadAction == "function")
+ dhtmlObject.onloadAction(dhtmlObject.mainObject, null, null, null, dhtmlObject);
+
+ if (dhtmlObject.waitCall){
+ dhtmlObject.waitCall.call(this,dhtmlObject);
+ dhtmlObject.waitCall=null;
+ }
+ }
+ }
+ };
+ return this.check;
+};
+
+/**
+ * @desc: return XML top node
+ * @param: tagName - top XML node tag name (not used in IE, required for Safari and Mozilla)
+ * @type: private
+ * @returns: top XML node
+ * @topic: 0
+ */
+dtmlXMLLoaderObject.prototype.getXMLTopNode=function(tagName, oldObj){
+ if (this.xmlDoc.responseXML){
+ var temp = this.xmlDoc.responseXML.getElementsByTagName(tagName);
+ if(temp.length==0 && tagName.indexOf(":")!=-1)
+ var temp = this.xmlDoc.responseXML.getElementsByTagName((tagName.split(":"))[1]);
+ var z = temp[0];
+ } else
+ var z = this.xmlDoc.documentElement;
+
+ if (z){
+ this._retry=false;
+ return z;
+ }
+
+ if ((_isIE)&&(!this._retry)){
+ //fall back to MS.XMLDOM
+ var xmlString = this.xmlDoc.responseText;
+ var oldObj = this.xmlDoc;
+ this._retry=true;
+ this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
+ this.xmlDoc.async=false;
+ this.xmlDoc["loadXM"+"L"](xmlString);
+
+ return this.getXMLTopNode(tagName, oldObj);
+ }
+ dhtmlxError.throwError("LoadXML", "Incorrect XML", [
+ (oldObj||this.xmlDoc),
+ this.mainObject
+ ]);
+
+ return document.createElement("DIV");
+};
+
+/**
+ * @desc: load XML from string
+ * @type: private
+ * @param: xmlString - xml string
+ * @topic: 0
+ */
+dtmlXMLLoaderObject.prototype.loadXMLString=function(xmlString){
+ {
+ try{
+ var parser = new DOMParser();
+ this.xmlDoc=parser.parseFromString(xmlString, "text/xml");
+ }
+ catch (e){
+ this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
+ this.xmlDoc.async=this.async;
+ this.xmlDoc["loadXM"+"L"](xmlString);
+ }
+ }
+
+ this.onloadAction(this.mainObject, null, null, null, this);
+
+ if (this.waitCall){
+ this.waitCall();
+ this.waitCall=null;
+ }
+}
+/**
+ * @desc: load XML
+ * @type: private
+ * @param: filePath - xml file path
+ * @param: postMode - send POST request
+ * @param: postVars - list of vars for post request
+ * @topic: 0
+ */
+dtmlXMLLoaderObject.prototype.loadXML=function(filePath, postMode, postVars, rpc){
+ if (this.rSeed)
+ filePath+=((filePath.indexOf("?") != -1) ? "&" : "?")+"a_dhx_rSeed="+(new Date()).valueOf();
+ this.filePath=filePath;
+
+ if ((!_isIE)&&(window.XMLHttpRequest))
+ this.xmlDoc=new XMLHttpRequest();
+ else {
+ if (document.implementation&&document.implementation.createDocument){
+ this.xmlDoc=document.implementation.createDocument("", "", null);
+ this.xmlDoc.onload=new this.waitLoadFunction(this);
+ this.xmlDoc.load(filePath);
+ return;
+ } else
+ this.xmlDoc=new ActiveXObject("Microsoft.XMLHTTP");
+ }
+
+ if (this.async)
+ this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this);
+ this.xmlDoc.open(postMode ? "POST" : "GET", filePath, this.async);
+
+ if (rpc){
+ this.xmlDoc.setRequestHeader("User-Agent", "dhtmlxRPC v0.1 ("+navigator.userAgent+")");
+ this.xmlDoc.setRequestHeader("Content-type", "text/xml");
+ }
+
+ else if (postMode)
+ this.xmlDoc.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+
+ this.xmlDoc.setRequestHeader("X-Requested-With","XMLHttpRequest");
+ this.xmlDoc.send(null||postVars);
+
+ if (!this.async)
+ (new this.waitLoadFunction(this))();
+};
+/**
+ * @desc: destructor, cleans used memory
+ * @type: private
+ * @topic: 0
+ */
+dtmlXMLLoaderObject.prototype.destructor=function(){
+ 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.waitLoadFunction = null;
+ this.doSerialization = null;
+ this.xmlNodeToJSON = null;
+ this.getXMLTopNode = null;
+ this.setXSLParamValue = null;
+ return null;
+}
+
+dtmlXMLLoaderObject.prototype.xmlNodeToJSON = function(node){
+ var t={};
+ for (var i=0; i
";
+ tblInfo.rows[0].cells[0].innerHTML += "Duration: " + this.TaskInfo.Duration + " hours
";
+ tblInfo.rows[0].cells[0].innerHTML += "Percent Complete: " + this.TaskInfo.PercentCompleted + "%
";
+
+ //show predecessor task
+ if (this.predTask)
+ {
+ tblInfo.rows[0].cells[0].innerHTML += "Predecessor Task: ";
+ tblInfo.rows[0].cells[0].innerHTML += "*" + this.TaskInfo.PredecessorTask.Name + "";
+ }
+
+ //show child tasks
+ if (this.TaskInfo.ChildTasks.length != 0) {
+ tblInfo.rows[0].cells[0].innerHTML += "Child Tasks: ";
+ for (var i = 0; i < this.TaskInfo.ChildTasks.length; i++)
+ {
+ tblInfo.rows[0].cells[0].innerHTML += (i == this.TaskInfo.ChildTasks.length - 1) ? ("*" + this.TaskInfo.ChildTasks[i].Name + "") : ("*" + this.TaskInfo.ChildTasks[i].Name + "");
+ }
+ }
+
+ //show parent task
+ if (this.TaskInfo.ParentTask) {
+ tblInfo.rows[0].cells[0].innerHTML += "Parent Task: ";
+ tblInfo.rows[0].cells[0].innerHTML += "*" + this.TaskInfo.ParentTask.Name + "";
+ }
+
+ this.Chart.divInfo.style.cssText = "z-index:2;position: absolute;display: inline;";
+
+ if (posY + this.Chart.divInfo.lastChild.offsetHeight + 10 > this.Chart.oData.offsetHeight + this.Chart.oData.scrollTop) {
+ this.Chart.divInfo.style.top = (posY - this.Chart.divInfo.lastChild.offsetHeight - 10 - this.Chart.heightTaskItem) + "px";
+ }
+ else {
+ this.Chart.divInfo.style.top = posY + "px";
+ }
+
+ if (this.Chart.divInfo.lastChild.offsetWidth + posX + 10 > this.Chart.oData.offsetWidth + this.Chart.oData.scrollLeft) {
+ this.Chart.divInfo.style.left = posX - (this.Chart.divInfo.lastChild.offsetWidth + posX + 20 - (this.Chart.oData.offsetWidth + this.Chart.oData.scrollLeft)) + "px";
+
+ } else {
+ this.Chart.divInfo.style.left = posX + "px";
+ }
+
+};
+/**
+ * @desc: close a window in browser with the data of task
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.closePopUpInfo = function()
+{
+ this.Chart.divInfo.style.display = "none";
+};
+/**
+ * @desc: creation connecting lines in panel of names
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.createConnectingLinesPN = function()
+{
+ var arrConnectingLinesNames = [];
+
+ /*var lineVerticalLeft = document.createElement("div");
+ lineVerticalLeft.style.cssText = "border-width: 0px 0px 0px 1px; border-style: dotted; border-color: #C0C4C0; margin: 0px; padding: 0px;z-index:10;position: absolute;" +
+ "height:" + (this.cTaskNameItem[0].offsetTop - this.parentTask.cTaskNameItem[0].offsetTop) + "px;" +
+ "top:" + (this.parentTask.cTaskNameItem[0].offsetTop + 5) + "px;" +
+ "left:" + (this.parentTask.cTaskNameItem[0].offsetLeft - 9) + "px;";
+ lineVerticalLeft.innerHTML = " ";
+ this.Chart.panelNames.firstChild.appendChild(lineVerticalLeft);
+
+ var LineHorizontalLeft = document.createElement("div");
+ LineHorizontalLeft.noShade = true;
+ LineHorizontalLeft.color = "#000000";
+ LineHorizontalLeft.style.cssText = "left:" + (this.parentTask.cTaskNameItem[0].offsetLeft - 9) + "px;top:" + (this.cTaskNameItem[0].offsetTop + 5) + "px;z-index:10;" +
+ "height:" + 1 + "px;width:" + (this.cTaskNameItem[0].offsetLeft - this.parentTask.cTaskNameItem[0].offsetLeft + 4 ) + "px;position: absolute;border-width: 1px 0px 0px 0px;font-size: 1px;border-style: dotted; border-color: #C0C4C0;margin: 0px; padding: 0px;";
+ this.Chart.panelNames.firstChild.appendChild(LineHorizontalLeft);
+
+ arrConnectingLinesNames.push(lineVerticalLeft);
+ arrConnectingLinesNames.push(LineHorizontalLeft);*/
+
+ return arrConnectingLinesNames;
+
+};
+/**
+ * @desc: creation connecting lines in panel oData
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.createConnectingLinesDS = function()
+{
+ var oData = this.Chart.oData.firstChild;
+ var arrLines = [];
+
+ var arrowImg = new Image();
+ arrowImg.src = this.Chart.imgs + "arr.gif";
+
+ //vertical line
+ var lineVerticalRight = document.createElement("div");
+
+ //horizontal line
+ var lineHorizontal = document.createElement("div");
+
+ var posXPredecessorTask = parseInt(this.predTask.cTaskItem[0].style.left);
+ var posYPredecessorTask = parseInt(this.predTask.cTaskItem[0].style.top);
+
+ var posXChildTask = parseInt(this.cTaskItem[0].style.left);
+ var posYChildTask = this.posY + 2;
+
+ //width task item
+ var widthChildTask = parseInt(this.predTask.cTaskItem[0].firstChild.firstChild.width);
+ var widthPredecessorTask = parseInt(this.predTask.cTaskItem[0].firstChild.firstChild.width);
+
+ if (posYPredecessorTask < posYChildTask)
+ {
+ lineVerticalRight.style.cssText = "border-width: 0px 0px 0px 1px; border-style: solid; border-color: #4A8F43;margin: 0px; padding: 0px;z-index:0;font-size: 1px;position: absolute;" +
+ "height:" + (posYChildTask - this.Chart.heightTaskItem / 2 - posYPredecessorTask - 3) + "px;width:" + 1 + "px;left:" + (posXPredecessorTask + widthPredecessorTask - 20 ) + "px;top:" + (posYPredecessorTask + this.Chart.heightTaskItem) + "px;";
+
+ lineHorizontal.style.cssText = "height:1px;border-color: #4A8F43;border-style: solid;border-width: 1px 0px 0px 0px;margin: 0px; padding: 0px;z-index:0;position: absolute;" +
+ "width:" + (15 + (posXChildTask - (widthPredecessorTask + posXPredecessorTask))) + "px;left:" + (posXPredecessorTask + widthPredecessorTask - 20 ) + "px;top:" + (posYChildTask + 2) + "px;";
+
+ arrowImg.style.cssText = "margin: 0px; padding: 0px;width:7px;height:14px;position: absolute;left:" + (posXChildTask - 7) + "px;top:" + (posYChildTask - 1) + "px;";
+ } else {
+ lineVerticalRight.style.cssText = "border-width: 0px 0px 0px 1px; border-style: solid; border-color: #4A8F43;margin: 0px; padding: 0px;z-index:0;font-size: 1px;position: absolute;" +
+ "height:" + (posYPredecessorTask + 2 - posYChildTask) + "px;width:" + 1 + "px;left:" + (posXPredecessorTask + widthPredecessorTask - 20 ) + "px;top:" + (posYChildTask + 2) + "px;";
+
+ lineHorizontal.style.cssText = "height:1px;border-color: #4A8F43;border-style: solid;border-width: 1px 0px 0px 0px;margin: 0px; padding: 0px;z-index:0;position: absolute;" +
+ "width:" + (15 + (posXChildTask - (widthPredecessorTask + posXPredecessorTask))) + "px;left:" + (posXPredecessorTask + widthPredecessorTask - 20 ) + "px;top:" + (posYChildTask + 2) + "px;";
+
+ arrowImg.style.cssText = "margin: 0px; padding: 0px;width:7px;height:14px;position: absolute;left:" + (posXChildTask - 7) + "px;top:" + (posYChildTask - 1) + "px;";
+ }
+ oData.appendChild(lineVerticalRight);
+ oData.appendChild(lineHorizontal);
+ oData.appendChild(arrowImg);
+
+ arrLines.push(lineVerticalRight);
+ arrLines.push(arrowImg);
+ arrLines.push(lineHorizontal);
+
+ return arrLines;
+};
+/**
+ * @desc: Shows current tasks
+ * @param: task - GanttTask object.
+ * @type: private
+ * @topic: 3
+ */
+GanttTask.prototype.showChildTasks = function(task, isOpen)
+{
+ if (isOpen)
+ {
+ for (var i = 0; i < task.childTask.length; i++)
+ {
+ if (task.childTask[i].cTaskItem[0].style.display == "none") {
+ task.childTask[i].cTaskItem[0].style.display = "inline";
+ task.childTask[i].cTaskNameItem[0].style.display = "inline";
+ if (this.Chart.isShowDescTask) {
+ task.childTask[i].showDescTask();
+ }
+
+ task.isHide = false;
+
+ if (task.childTask[i].cTaskNameItem[2]) {
+ task.childTask[i].cTaskNameItem[2].style.display = "inline";
+ isOpen = task.childTask[i]._isOpen;
+ }
+
+ for (var k = 0; k < task.childTask[i].cTaskItem[1].length; k++) {
+ task.childTask[i].cTaskItem[1][k].style.display = "inline";
+
+ }
+ for (var k = 0; k < task.childTask[i].cTaskNameItem[1].length; k++) {
+ task.childTask[i].cTaskNameItem[1][k].style.display = "inline";
+ }
+
+ this._heightHideTasks += this.Chart.heightTaskItem + 11;
+
+ if (task.childTask[i].childTask.length > 0) {
+ this.showChildTasks(task.childTask[i], isOpen);
+ }
+
+ }
+ }
+ }
+};
+/**
+ * @desc: hide child task
+ * @param: task - (object) GanttTask
+ * @type: private
+ * @topic: 3
+ */
+GanttTask.prototype.hideChildTasks = function(task)
+{
+ for (var i = 0; i < task.childTask.length; i++)
+ {
+ if (task.childTask[i].cTaskItem[0].style.display != "none")
+ {
+ task.childTask[i].cTaskItem[0].style.display = "none";
+ task.childTask[i].cTaskNameItem[0].style.display = "none";
+ if (this.Chart.isShowDescTask) {
+ task.childTask[i].hideDescTask();
+ }
+ task.isHide = true;
+
+ if (task.childTask[i].cTaskNameItem[2]) {
+ task.childTask[i].cTaskNameItem[2].style.display = "none";
+ }
+
+ for (var k = 0; k < task.childTask[i].cTaskItem[1].length; k++) {
+ task.childTask[i].cTaskItem[1][k].style.display = "none";
+ }
+ for (var k = 0; k < task.childTask[i].cTaskNameItem[1].length; k++) {
+ task.childTask[i].cTaskNameItem[1][k].style.display = "none";
+ }
+
+ this._heightHideTasks += this.Chart.heightTaskItem + 11;
+
+ if (task.childTask[i].childTask.length > 0) {
+ this.hideChildTasks(task.childTask[i]);
+ }
+
+ }
+ }
+};
+/**
+ * @desc: shift current tasks
+ * @param: task - (object) GanttTask
+ * @param: height - specifies height on which tasks are shifted
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.shiftCurrentTasks = function(task, height)
+{
+ this.shiftNextTask(this, height);
+ task.Project.shiftNextProject(task.Project, height);
+};
+
+GanttProject.prototype.shiftNextProject = function(project, height)
+{
+ if (project.nextProject) {
+ project.nextProject.shiftProject(height);
+ this.shiftNextProject(project.nextProject, height);
+ }
+
+};
+GanttProject.prototype.shiftProject = function(height)
+{
+ this.projectItem[0].style.top = parseInt(this.projectItem[0].style.top) + height + "px";
+ if (this.Chart.isShowDescProject) {
+ this.descrProject.style.top = parseInt(this.descrProject.style.top) + height + "px";
+ }
+
+ if (this.Chart._showTreePanel) {
+ this.projectNameItem.style.top = parseInt(this.projectNameItem.style.top) + height + "px";
+ }
+ if (this.arrTasks.length > 0)
+ this.shiftNextParentTask(this.arrTasks[0], height);
+
+};
+GanttProject.prototype.shiftTask = function(task, height)
+{
+ if (this.Chart._showTreePanel) {
+
+ task.cTaskNameItem[0].style.top = parseInt(task.cTaskNameItem[0].style.top) + height + "px";
+ if (task.cTaskNameItem[2]) {
+ task.cTaskNameItem[2].style.top = parseInt(task.cTaskNameItem[2].style.top) + height + "px";
+ }
+ if (task.parentTask && task.cTaskNameItem[1][0])
+ {
+ task.cTaskNameItem[1][0].style.top = parseInt(task.cTaskNameItem[1][0].style.top) + height + "px";
+ task.cTaskNameItem[1][1].style.top = parseInt(task.cTaskNameItem[1][1].style.top) + height + "px";
+ }
+ }
+
+ task.cTaskItem[0].style.top = parseInt(task.cTaskItem[0].style.top) + height + "px";
+ if (this.Chart.isShowDescTask) {
+ task.descrTask.style.top = parseInt(task.descrTask.style.top) + height + "px";
+ }
+ if (task.cTaskItem[1][0])
+ {
+ task.cTaskItem[1][0].style.top = parseInt(task.cTaskItem[1][0].style.top) + height + "px";
+ task.cTaskItem[1][1].style.top = parseInt(task.cTaskItem[1][1].style.top) + height + "px";
+ task.cTaskItem[1][2].style.top = parseInt(task.cTaskItem[1][2].style.top) + height + "px";
+ }
+};
+GanttProject.prototype.shiftNextParentTask = function(task, height)
+{
+ this.shiftTask(task, height);
+ this.shiftChildTasks(task, height);
+
+ if (task.nextParentTask) {
+ this.shiftNextParentTask(task.nextParentTask, height);
+ }
+
+};
+GanttProject.prototype.shiftChildTasks = function(task, height)
+{
+ for (var i = 0; i < task.childTask.length; i++)
+ {
+ this.shiftTask(task.childTask[i], height);
+ if (task.childTask[i].childTask.length > 0) {
+ this.shiftChildTasks(task.childTask[i], height);
+ }
+
+ }
+};
+
+GanttTask.prototype.shiftTask = function(task, height)
+{
+ if (this.Chart._showTreePanel) {
+ task.cTaskNameItem[0].style.top = parseInt(task.cTaskNameItem[0].style.top) + height + "px";
+ if (task.cTaskNameItem[2]) {
+ task.cTaskNameItem[2].style.top = parseInt(task.cTaskNameItem[2].style.top) + height + "px";
+ }
+ if (task.parentTask)
+ {
+ if (task.cTaskNameItem[1].length > 0) if ((parseInt(this.cTaskNameItem[0].style.top) > parseInt(task.parentTask.cTaskNameItem[0].style.top))
+ && (task.cTaskNameItem[1][0].style.display != "none")) {
+ task.cTaskNameItem[1][0].style.height = parseInt(task.cTaskNameItem[1][0].style.height) + height + "px";
+ } else {
+ task.cTaskNameItem[1][0].style.top = parseInt(task.cTaskNameItem[1][0].style.top) + height + "px";
+ }
+ if (task.cTaskNameItem[1].length > 1) task.cTaskNameItem[1][1].style.top = parseInt(task.cTaskNameItem[1][1].style.top) + height + "px";
+ }
+ }
+
+ task.cTaskItem[0].style.top = parseInt(task.cTaskItem[0].style.top) + height + "px";
+ if (this.Chart.isShowDescTask) {
+ task.descrTask.style.top = parseInt(task.descrTask.style.top) + height + "px";
+ }
+ if (task.predTask)
+ {
+ if (task.cTaskItem[1].length > 0) if (((parseInt(this.cTaskItem[0].style.top) > parseInt(task.predTask.cTaskItem[0].style.top)) ||
+ (this.cTaskItem[0].id == task.predTask.TaskInfo.Id)) &&
+ task.cTaskItem[1][0].style.display != "none") {
+ task.cTaskItem[1][0].style.height = parseInt(task.cTaskItem[1][0].style.height) + height + "px";
+ } else {
+ task.cTaskItem[1][0].style.top = parseInt(task.cTaskItem[1][0].style.top) + height + "px";
+ }
+ if (task.cTaskItem[1].length > 2) {
+ task.cTaskItem[1][1].style.top = parseInt(task.cTaskItem[1][1].style.top) + height + "px";
+ task.cTaskItem[1][2].style.top = parseInt(task.cTaskItem[1][2].style.top) + height + "px";
+ }
+ }
+};
+GanttTask.prototype.shiftNextTask = function(task, height)
+{
+ if (task.nextChildTask) {
+ this.shiftTask(task.nextChildTask, height);
+ this.shiftChildTask(task.nextChildTask, height);
+ this.shiftNextTask(task.nextChildTask, height);
+
+ } else if (task.parentTask) {
+ this.shiftNextTask(task.parentTask, height);
+
+ } else if (task.nextParentTask) {
+ this.shiftTask(task.nextParentTask, height);
+ this.shiftChildTask(task.nextParentTask, height);
+ this.shiftNextTask(task.nextParentTask, height);
+ }
+};
+GanttTask.prototype.shiftChildTask = function(task, height)
+{
+ for (var i = 0; i < task.childTask.length; i++)
+ {
+ this.shiftTask(task.childTask[i], height);
+ if (task.childTask[i].childTask.length > 0) {
+ this.shiftChildTask(task.childTask[i], height);
+ }
+ }
+};
+
+/**
+ * @desc: get position of the task on EST
+ * @param: est - time of the beginning of the task
+ * @type: private
+ * @topic: 4
+ */
+GanttChart.prototype.getPosOnDate = function(est)
+{
+ return (est - this.startDate) / (60 * 60 * 1000) * this.hourInPixels;
+};
+/**
+ * @desc: get width on duration
+ * @param: duration - duration of current task
+ * @type: private
+ * @topic: 4
+ */
+GanttChart.prototype.getWidthOnDuration = function(duration)
+{
+ return Math.round(this.hourInPixelsWork * duration);
+};
+/**
+ * @desc: end of dragging of task
+ * @type: private
+ * @topic: 5
+ */
+GanttTask.prototype.endMove = function()
+{
+ var width = parseInt(this.cTaskItem[0].style.left) - this.posX;
+ var est = this.getDateOnPosition(parseInt(this.cTaskItem[0].style.left));
+ est = this.checkPos(est);
+
+ this.wasMoved = this.TaskInfo.EST.valueOf() != est.valueOf();
+
+ if (this.checkMove) {
+ width = this.Chart.getPosOnDate(est) - this.posX;
+ this.moveCurrentTaskItem(width, this.moveChild);
+ this.Project.shiftProjectItem();
+ }
+
+ this.checkMove = false;
+ this.posX = 0;
+ this.maxPosXMove = -1;
+ this.minPosXMove = -1;
+ this.cTaskItem[0].childNodes[1].firstChild.rows[0].cells[0].innerHTML = "";
+
+ if (this.Chart._isFF) document.body.style.cursor = "";
+ if (this.Chart._isIE) this.cTaskItem[0].childNodes[2].childNodes[0].style.cursor = "";
+};
+
+GanttTask.prototype.checkPos = function(est)
+{
+ var h = est.getHours();
+ if (h >= 12)
+ {
+ est.setDate(est.getDate() + 1);
+ est.setHours(0);
+
+ if ((parseInt(this.cTaskItem[0].firstChild.firstChild.width) + this.Chart.getPosOnDate(est) > this.maxPosXMove) && (this.maxPosXMove != -1))
+ {
+ est.setDate(est.getDate() - 1);
+ est.setHours(0);
+ }
+
+
+ } else if ((h < 12) && (h != 0))
+ {
+ est.setHours(0);
+ if ((this.Chart.getPosOnDate(est) < this.minPosXMove))
+ {
+ est.setDate(est.getDate() + 1);
+ }
+ }
+ this.cTaskItem[0].style.left = this.Chart.getPosOnDate(est) + "px";
+
+ return est;
+
+};
+
+/**
+ * @desc: returns max position of child task
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.getMaxPosPredChildTaskItem = function()
+{
+ var posPredChildTaskItem = 0;
+ var nextPosPredChildTaskItem = 0;
+
+ for (var i = 0; i < this.childPredTask.length; i++)
+ {
+ nextPosPredChildTaskItem = this.getMaxPosPredChildTaskItemInTree(this.childPredTask[i]);
+ if (nextPosPredChildTaskItem > posPredChildTaskItem)
+ {
+ posPredChildTaskItem = nextPosPredChildTaskItem;
+ }
+ }
+ return posPredChildTaskItem;
+
+};
+/**
+ * @desc: returns max position of child task in tree
+ * @param: task - (object) task
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.getMaxPosPredChildTaskItemInTree = function(task)
+{
+ var currentPos = parseInt(task.cTaskItem[0].firstChild.firstChild.width) + parseInt(task.cTaskItem[0].style.left);
+ var posPredChildTaskItem = 0;
+ var nextPosPredChildTaskItem = 0;
+
+ for (var i = 0; i < task.childPredTask.length; i++)
+ {
+ nextPosPredChildTaskItem = this.getMaxPosPredChildTaskItemInTree(task.childPredTask[i]);
+ if (nextPosPredChildTaskItem > posPredChildTaskItem)
+ {
+ posPredChildTaskItem = nextPosPredChildTaskItem;
+ }
+ }
+
+ if (posPredChildTaskItem > currentPos)
+ {
+ return posPredChildTaskItem;
+ }
+ else
+ {
+ return currentPos;
+ }
+
+};
+/**
+ * @desc: get task by id
+ * @param: id - Id of GanttTask
+ * @type: public
+ * @topic: 2
+ */
+GanttProject.prototype.getTaskById = function(id)
+{
+ for (var i = 0; i < this.arrTasks.length; i++)
+ {
+ var task = this.searchTaskInTree(this.arrTasks[i], id);
+ if (task) return task;
+
+ }
+ return null;
+};
+/**
+ * @desc: search GanttTask in child tasks
+ * @param: task - (object) parent GanttTask
+ * @param: id - Id of GanttTask
+ * @type: private
+ * @topic: 2
+ */
+GanttProject.prototype.searchTaskInTree = function(task, id)
+{
+ if (task.TaskInfo.Id == id)
+ {
+ return task;
+
+ } else
+ {
+ for (var i = 0; i < task.childTask.length; i++)
+ {
+ if (task.childTask[i].TaskInfo.Id == id)
+ {
+ return task.childTask[i];
+ }
+ else
+ {
+ if (task.childTask[i].childTask.length > 0)
+ {
+ var cTask = this.searchTaskInTree(task.childTask[i], id);
+ if (cTask) return cTask;
+ }
+ }
+ }
+ }
+
+ return null;
+};
+/**
+ * @desc: shift current projectItem
+ * @type: private
+ * @topic: 4
+ */
+GanttProject.prototype.shiftProjectItem = function()
+{
+ var posItemL = null;
+ var posItemR = null;
+ var posProjectItemL = parseInt(this.projectItem[0].style.left);
+ var posProjectItemR = parseInt(this.projectItem[0].firstChild.style.width) + parseInt(this.projectItem[0].style.left);
+ var widthProjectItem = parseInt(this.projectItem[0].firstChild.style.width);
+
+ for (var t = 0; t < this.arrTasks.length; t++)
+ {
+ var tmpPosItemL = parseInt(this.arrTasks[t].cTaskItem[0].style.left);
+ var tmpPosItemR = parseInt(this.arrTasks[t].cTaskItem[0].style.left) + parseInt(this.arrTasks[t].cTaskItem[0].firstChild.firstChild.width);
+
+ if (!posItemL) {
+ posItemL = tmpPosItemL;
+ }
+ if (!posItemR) {
+ posItemR = tmpPosItemR;
+ }
+
+
+ if (posItemL > tmpPosItemL) {
+ posItemL = tmpPosItemL;
+ }
+
+ if (posItemR < tmpPosItemR) {
+ posItemR = tmpPosItemR;
+ }
+
+ }
+
+ if (posItemL != posProjectItemL)
+ {
+ this.Project.StartDate = new Date(this.Chart.startDate);
+ this.Project.StartDate.setHours(this.Project.StartDate.getHours() + (posItemL / this.Chart.hourInPixels));
+ }
+
+ this.projectItem[0].style.left = posItemL + "px";
+ this.resizeProjectItem(posItemR - posItemL);
+
+ this.Duration = Math.round(parseInt(this.projectItem[0].firstChild.width) / (this.Chart.hourInPixelsWork));
+ if (this.Chart.isShowDescProject) {
+ this.moveDescrProject();
+ }
+ this.addDayInPanelTime();
+
+};
+/**
+ * @desc: add one day
+ * @type: private
+ * @topic: 4
+ */
+GanttProject.prototype.addDayInPanelTime = function()
+{
+ var width = parseInt(this.projectItem[0].style.left) + parseInt(this.projectItem[0].firstChild.style.width) + 20;
+ if (this.Chart.isShowDescProject) {
+ width += this.descrProject.offsetWidth;
+ }
+
+ var table = this.Chart.panelTime.firstChild, tbody = table.firstChild;
+ if (parseInt(tbody.offsetWidth) < width)
+ {
+ var countDays = Math.round((width - parseInt(tbody.offsetWidth)) / this.Chart.dayInPixels);
+ var row = tbody.rows[1];
+ for (var n = 0; n < countDays; n++)
+ {
+ this.Chart.addPointInTimePanel(row, table);
+ this.Chart.addDayInPanelTime(row);
+ }
+ var w = this.Chart.dayInPixels * (row.cells.length);
+ tbody.style.width = w + "px";
+ this.Chart.panelTasks.style.width = (w-18) + "px";
+ }
+};
+/**
+ * @desc: add event
+ * @param: elm - current element
+ * @param: evType - string that specifies any of the standard DHTML Events
+ * @param: fn - pointer that specifies the function to call when sEvent fires
+ * @type: private
+ * @topic: 5
+ */
+GanttProject.prototype.addEvent = function (elm, evType, fn, useCapture)
+{
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ return elm.attachEvent('on' + evType, fn);
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+};
+/**
+ * @desc: shows popup info
+ * @param: event - (object)event
+ * @type: private
+ * @topic: 4
+ */
+GanttProject.prototype.getPopUpInfo = function(object, event)
+{
+ //this.projectItem[0]
+ var posX = object.offsetLeft + ((event.layerX == null) ? event.offsetX : event.layerX);
+ var posY = object.offsetTop + this.Chart.heightTaskItem + 6;
+
+ var tblInfo = this.Chart.divInfo.lastChild;
+ tblInfo.rows[0].cells[0].innerHTML = "
";
+ tblInfo.rows[0].cells[0].innerHTML += "Duration: " + this.Duration + " hours
";
+ tblInfo.rows[0].cells[0].innerHTML += "Percent Complete: " + this.percentCompleted + "%
";
+
+ this.Chart.divInfo.style.cssText = "z-index:2;position: absolute;display: inline;";
+
+ if (posY + this.Chart.divInfo.lastChild.offsetHeight + 6 > this.Chart.oData.offsetHeight + this.Chart.oData.scrollTop)
+ {
+ this.Chart.divInfo.style.top = (posY - this.Chart.divInfo.lastChild.offsetHeight - 10 - this.Chart.heightTaskItem) + "px";
+ }
+ else {
+ this.Chart.divInfo.style.top = posY + "px";
+ }
+
+ if (this.Chart.divInfo.lastChild.offsetWidth + posX + 10 > this.Chart.oData.offsetWidth + this.Chart.oData.scrollLeft)
+ {
+ this.Chart.divInfo.style.left = posX - (this.Chart.divInfo.lastChild.offsetWidth + posX + 20 - (this.Chart.oData.offsetWidth + this.Chart.oData.scrollLeft)) + "px";
+
+ } else {
+ this.Chart.divInfo.style.left = posX + "px";
+ }
+};
+/**
+ * @desc: hides pop up info
+ * @type: private
+ * @topic: 4
+ */
+GanttProject.prototype.closePopUpInfo = function()
+{
+ this.Chart.divInfo.style.display = "none";
+};
+/**
+ * @desc: resize projectItem
+ * @param: width - new width
+ * @type: private
+ * @topic: 4
+ */
+GanttProject.prototype.resizeProjectItem = function(width)
+{
+ var percentCompleted = this.percentCompleted;
+ if (percentCompleted > 0 && percentCompleted < 100)
+ {
+ this.projectItem[0].firstChild.style.width = width + "px";
+ this.projectItem[0].firstChild.width = width + "px";
+ this.projectItem[0].style.width = width + "px";
+ this.projectItem[0].firstChild.rows[0].cells[0].firstChild.style.width = Math.round(width * percentCompleted / 100) + "px";
+ this.projectItem[0].firstChild.rows[0].cells[1].firstChild.style.width = Math.round(width * (100 - percentCompleted) / 100) + "px";
+ this.projectItem[0].lastChild.firstChild.width = width + "px";
+
+ } else if (percentCompleted == 0 || percentCompleted == 100)
+ {
+ this.projectItem[0].firstChild.style.width = width + "px";
+ this.projectItem[0].firstChild.width = width + "px";
+ this.projectItem[0].style.width = width + "px";
+ this.projectItem[0].firstChild.rows[0].cells[0].firstChild.style.width = width + "px";
+ this.projectItem[0].lastChild.firstChild.width = width + "px";
+ }
+};
+/**
+ * @desc: Moving of current task
+ * @param: width - length of shift of the task
+ * @param: moveChild - true, if move children together
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.moveCurrentTaskItem = function(width, moveChild)
+{
+ var taskItem = this.cTaskItem[0];
+ this.TaskInfo.EST = new Date(this.Chart.startDate);
+ this.TaskInfo.EST.setHours(this.TaskInfo.EST.getHours() + (parseInt(taskItem.style.left) / this.Chart.hourInPixels));
+ if (this.Chart.isShowDescTask) {
+ this.showDescTask();
+ }
+
+ if (this.cTaskItem[1].length > 0) {
+ this.cTaskItem[1][2].style.width = parseInt(this.cTaskItem[1][2].style.width) + width + "px";
+ this.cTaskItem[1][1].style.left = parseInt(this.cTaskItem[1][1].style.left) + width + "px";
+ }
+
+ for (var i = 0; i < this.childTask.length; i++) {
+ if (!this.childTask[i].predTask) {
+ this.moveChildTaskItems(this.childTask[i], width, moveChild);
+ }
+ }
+
+ for (var i = 0; i < this.childPredTask.length; i++) {
+ this.moveChildTaskItems(this.childPredTask[i], width, moveChild);
+ }
+
+};
+/**
+ * @desc: Moving of child tasks
+ * @param: task - (object) GanttTask
+ * @param: width - length of shift of the task
+ * @param: moveChild - true, if move children together
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.moveChildTaskItems = function(task, width, moveChild)
+{
+ var taskItem = task.cTaskItem[0];
+
+ if (moveChild)
+ {
+ taskItem.style.left = parseInt(taskItem.style.left) + width + "px";
+ task.addDayInPanelTime();
+ task.TaskInfo.EST = new Date(this.Chart.startDate);
+ task.TaskInfo.EST.setHours(task.TaskInfo.EST.getHours() + (parseInt(taskItem.style.left) / this.Chart.hourInPixels));
+
+ for (var n = 0; n < task.cTaskItem[1].length; n++) {
+ task.cTaskItem[1][n].style.left = parseInt(task.cTaskItem[1][n].style.left) + width + "px";
+ }
+
+ for (var i = 0; i < task.childTask.length; i++) {
+ if (!task.childTask[i].predTask) {
+ this.moveChildTaskItems(task.childTask[i], width, moveChild);
+ }
+ }
+
+ for (var i = 0; i < task.childPredTask.length; i++) {
+ this.moveChildTaskItems(task.childPredTask[i], width, moveChild);
+ }
+ }
+ else
+ {
+ if (task.cTaskItem[1].length > 0)
+ {
+ task.cTaskItem[1][2].style.left = parseInt(task.cTaskItem[1][2].style.left) + width + "px";
+ task.cTaskItem[1][2].style.width = parseInt(task.cTaskItem[1][2].style.width) - width + "px";
+ task.cTaskItem[1][0].style.left = parseInt(task.cTaskItem[1][0].style.left) + width + "px";
+ }
+ }
+ if (this.Chart.isShowDescTask) {
+ task.moveDescTask();
+ }
+};
+/**
+ * @desc: Addition of new day in panel of time
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.addDayInPanelTime = function()
+{
+ var taskItem = this.cTaskItem[0];
+ var width = parseInt(taskItem.style.left) + parseInt(taskItem.firstChild.firstChild.width) + 20;
+ if (this.Chart.isShowDescTask) {
+ width += this.descrTask.offsetWidth;
+ }
+
+ var table = this.Chart.panelTime.firstChild, tbody = table.firstChild;
+ if (parseInt(tbody.offsetWidth) < width)
+ {
+ var row = tbody.rows[1];
+ var countDays = Math.round((width + 20 - parseInt(tbody.offsetWidth)) / this.Chart.dayInPixels);
+ for (var n = 0; n < countDays; n++)
+ {
+ this.Chart.addPointInTimePanel(row, table);
+ this.Chart.addDayInPanelTime(row);
+ }
+ var w = this.Chart.dayInPixels * (row.cells.length);
+ tbody.style.width = w + "px";
+ this.Chart.panelTasks.style.width = (w-18) + "px";
+ }
+};
+/**
+ * @desc: return of date on position of task
+ * @param: position - current position of task
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.getDateOnPosition = function(position)
+{
+ var date = new Date(this.Chart.startDate);
+ date.setHours(date.getHours() + (position / this.Chart.hourInPixels));
+ return date;
+};
+/**
+ * @desc: moving of current task
+ * @param: event - (object) event
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.moveItem = function(event)
+{
+ var pageX = event.screenX;
+ var posTaskItem = (this.posX + (pageX - this.MouseX));
+ var widthTaskItem = parseInt(this.cTaskItem[0].childNodes[0].firstChild.width);
+ var posTaskItemR = posTaskItem + widthTaskItem;
+
+ if (this.checkMove)
+ {
+ var date = this.getDateOnPosition(posTaskItem);
+ var res = this.Chart.callEvent("onTaskDragging", [this,date])!==false;
+ if (res && ((this.minPosXMove <= posTaskItem))
+ && ((posTaskItemR <= this.maxPosXMove) || (this.maxPosXMove == -1)))
+ {
+ this.moveTaskItem(posTaskItem);
+ }
+ }
+};
+/**
+ * @desc: shift taskItem
+ * @param: posX - position of task
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.moveTaskItem = function(posX)
+{
+ this.addDayInPanelTime();
+ this.cTaskItem[0].style.left = posX + "px";
+ var date = this.getDateOnPosition(posX);
+ this.cTaskItem[0].childNodes[1].firstChild.rows[0].cells[0].innerHTML = date.getDate() + '.' + (date.getMonth() + 1) + '.' + date.getUTCFullYear();
+};
+/**
+ * @desc: resize current task
+ * @param: event - (object) event
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.resizeItem = function(event)
+{
+ if (this.checkResize)
+ {
+ var MouseX = event.screenX;
+ var widthTaskItem = this.taskItemWidth + (MouseX - this.MouseX);
+
+ var countHours = Math.round(widthTaskItem / this.Chart.hourInPixelsWork);
+ if (this.Chart.callEvent("onTaskResizing", [this,countHours])===false) return;
+
+ if (widthTaskItem >= this.taskItemWidth)
+ {
+ if ((widthTaskItem <= this.maxWidthResize) || (this.maxWidthResize == -1))
+ {
+ this.resizeTaskItem(widthTaskItem);
+ this.addDayInPanelTime();
+
+ } else if ((this.maxWidthResize != -1) && (widthTaskItem > this.maxWidthResize))
+ {
+ this.resizeTaskItem(this.maxWidthResize);
+ }
+ } else if (widthTaskItem <= this.taskItemWidth)
+ {
+ if (widthTaskItem >= this.minWidthResize)
+ {
+ this.resizeTaskItem(widthTaskItem);
+ }
+ else if (widthTaskItem < this.minWidthResize)
+ {
+ this.resizeTaskItem(this.minWidthResize);
+ }
+ }
+ }
+};
+/**
+ * @desc: resize current taskItem
+ * @param: width - width of current taskItem
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.resizeTaskItem = function(width)
+{
+ var taskItem = this.cTaskItem[0];
+ var countHours = Math.round(width / this.Chart.hourInPixelsWork);
+ var c = taskItem.childNodes[0].firstChild.rows[0].cells[0];
+ if (c)
+ {
+ c.firstChild.style.width = parseInt(c.width) * width / 100 + "px";
+ }
+ c = taskItem.childNodes[0].firstChild.rows[0].cells[1];
+ if (c)
+ {
+ c.firstChild.style.width = parseInt(c.width) * width / 100 + "px";
+ }
+
+ taskItem.childNodes[0].firstChild.width = width + "px";
+ taskItem.childNodes[1].firstChild.width = width + "px";
+
+ //resize info
+ this.cTaskItem[0].childNodes[1].firstChild.rows[0].cells[0].innerHTML = countHours;
+ taskItem.childNodes[2].childNodes[0].style.width = width + "px";
+ taskItem.childNodes[2].childNodes[1].style.left = width - 10 + "px";
+};
+/**
+ * @desc: end of stretch of task
+ * @param: event - (object) event
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.endResizeItem = function()
+{
+ var taskItem = this.cTaskItem[0];
+ this.wasResized = this.taskItemWidth != parseInt(taskItem.childNodes[0].firstChild.width);
+ if (this.wasResized)
+ {
+ var posXL = taskItem.offsetLeft;
+ var posXR = taskItem.offsetLeft + parseInt(taskItem.childNodes[0].firstChild.width);
+ this.TaskInfo.Duration = Math.round((posXR - posXL) / this.Chart.hourInPixelsWork);
+ if (this.childPredTask.length > 0)
+ {
+ for (var j = 0; j < this.childPredTask.length; j++)
+ {
+ this.childPredTask[j].cTaskItem[1][2].style.width = parseInt(this.childPredTask[j].cTaskItem[1][2].style.width) - (parseInt(taskItem.childNodes[0].firstChild.width) - this.taskItemWidth) + "px";
+ this.childPredTask[j].cTaskItem[1][2].style.left = parseInt(this.childPredTask[j].cTaskItem[1][2].style.left) + (parseInt(taskItem.childNodes[0].firstChild.width) - this.taskItemWidth) + "px";
+ this.childPredTask[j].cTaskItem[1][0].style.left = parseInt(this.childPredTask[j].cTaskItem[1][0].style.left) + (parseInt(taskItem.childNodes[0].firstChild.width) - this.taskItemWidth) + "px";
+ }
+ }
+ }
+ this.cTaskItem[0].childNodes[1].firstChild.rows[0].cells[0].innerHTML = "";
+ this.checkResize = false;
+ this.taskItemWidth = 0;
+ this.MouseX = 0;
+ if (this.Chart.isShowDescTask) {
+ this.showDescTask();
+ }
+ this.Project.shiftProjectItem();
+
+ if (this.Chart._isFF) document.body.style.cursor = "";
+};
+
+GanttProject.prototype.moveDescrProject = function()
+{
+ this.descrProject.style.left = (parseInt(this.projectItem[0].style.left) + this.Duration * this.Chart.hourInPixelsWork + 10);
+ this.descrProject.innerHTML = this.getDescStr();
+};
+
+GanttProject.prototype.showDescrProject = function()
+{
+ var posX = (parseInt(this.projectItem[0].style.left) + this.Duration * this.Chart.hourInPixelsWork + 10);
+ this.descrProject.style.left = posX + "px";
+ this.descrProject.style.visibility = 'visible';
+ this.descrProject.innerHTML = this.getDescStr();
+};
+
+GanttProject.prototype.hideDescrProject = function()
+{
+ this.descrProject.style.visibility = 'hidden';
+};
+
+GanttProject.prototype.getDescStr = function()
+{
+ var str = '', delim = ", ";
+
+ for (var i = 0; i < this.Chart.paramShowProject.length; i++) {
+
+ switch (this.Chart.paramShowProject[i]) {
+ case "Name":
+ if (str != "")str += delim;
+ str += this.Project[this.Chart.paramShowProject[i]];
+ break;
+ case "StartDate":
+ if (str != "")str += delim;
+ var d = this.Project[this.Chart.paramShowProject[i]];
+ str += d.getDate() + "." + (d.getMonth() + 1) + "." + d.getFullYear();
+ break;
+ case "Duration":
+ if (str != "")str += delim;
+ str += this[this.Chart.paramShowProject[i]] + "h";
+ break;
+ case "percentCompleted":
+ if (str != "")str += delim;
+ str += this[this.Chart.paramShowProject[i]] + "%";
+ break;
+
+ default:
+ break;
+ }
+
+ }
+ return str;
+};
+
+
+GanttProject.prototype.createDescrProject = function()
+{
+ var posX = (this.posX + this.Duration * this.Chart.hourInPixelsWork + 10);
+ var divDesc = document.createElement("div");
+ divDesc.style.cssText += ";z-index:1;position:absolute;left:" + posX + "px;top:" + this.posY + "px;";
+ divDesc.innerHTML = this.getDescStr();
+ divDesc.className = "descProject";
+ this.descrProject = divDesc;
+
+ if (this.Project.ParentTasks.length == 0) {
+ this.descrProject.style.visibility = 'hidden';
+ }
+
+ if (this.Chart._showTooltip)
+ {
+ var self = this;
+ var getPopUpInfo = function(e) {
+ if ((!self.Chart._isMove) && (!self.Chart._isResize)) self.getPopUpInfo(self.descrProject, e);
+ };
+ var closePopUpInfo = function() {
+ self.closePopUpInfo();
+ };
+
+ this.addEvent(divDesc, 'mouseover', getPopUpInfo, false);
+ this.addEvent(divDesc, 'mouseout', closePopUpInfo, false);
+ }
+ return divDesc;
+};
+
+/**
+ * @desc: creation of projectItem
+ * @type: private
+ * @topic: 0
+ */
+GanttProject.prototype.createProjectItem = function()
+{
+ var self = this;
+ this.percentCompleted = this.getPercentCompleted();
+ this.Duration = this.getDuration();
+
+ var projectItem = document.createElement("div");
+ projectItem.id = this.Project.Id;
+ projectItem.style.cssText = ";z-index:1;position: absolute;left:" + this.posX + "px;top:" + this.posY + "px;";
+ projectItem.style.width = this.Duration * this.Chart.hourInPixelsWork + "px";
+
+ var tblProjectItem = document.createElement("table");
+ projectItem.appendChild(tblProjectItem);
+ tblProjectItem.cellPadding = "0";
+ tblProjectItem.cellSpacing = "0";
+ tblProjectItem.style.cssText = "border: solid 1px #BC810D;";
+ var width = this.Duration * this.Chart.hourInPixelsWork;
+ tblProjectItem.width = ((width == 0) ? 1 : width) + "px";
+ tblProjectItem.style.width = ((width == 0) ? 1 : width) + "px";
+
+ var rowprojectItem = tblProjectItem.insertRow(tblProjectItem.rows.length);
+
+ if (this.percentCompleted != -1)
+ {
+ if (this.percentCompleted != 0)
+ {
+ var cellprojectItem = document.createElement("TD");
+ rowprojectItem.appendChild(cellprojectItem);
+ cellprojectItem.width = this.percentCompleted + "%";
+ cellprojectItem.style.lineHeight = "1px";
+ var imgPr = document.createElement("img");
+ imgPr.style.width = (this.percentCompleted * this.Duration * this.Chart.hourInPixelsWork) / 100 + "px";
+ imgPr.style.height = this.Chart.heightTaskItem + "px";
+ cellprojectItem.appendChild(imgPr);
+ imgPr.src = this.Chart.imgs + "parentnode_filled.png";
+
+ }
+
+ if (this.percentCompleted != 100)
+ {
+ var cellprojectItem = document.createElement("TD");
+ rowprojectItem.appendChild(cellprojectItem);
+ cellprojectItem.width = (100 - this.percentCompleted) + "%";
+ cellprojectItem.style.lineHeight = "1px";
+ var imgPr = document.createElement("img");
+ imgPr.style.width = ((100 - this.percentCompleted) * this.Duration * this.Chart.hourInPixelsWork) / 100 + "px";
+ imgPr.style.height = this.Chart.heightTaskItem + "px";
+ cellprojectItem.appendChild(imgPr);
+ imgPr.src = this.Chart.imgs + "progress_bg.png";
+ }
+
+ } else
+ {
+ var cellprojectItem = document.createElement("TD");
+ rowprojectItem.appendChild(cellprojectItem);
+ cellprojectItem.width = "1px";
+ cellprojectItem.style.lineHeight = "1px";
+ var imgPr = document.createElement("img");
+ imgPr.style.width = "1px";
+ imgPr.style.height = this.Chart.heightTaskItem;
+ cellprojectItem.appendChild(imgPr);
+ imgPr.src = this.Chart.imgs + "progress_bg.png";
+
+ }
+
+ var divTaskInfo = document.createElement("div");
+ divTaskInfo.style.cssText = "text-align:center;z-index:2;position:absolute;left:0px;top:0px;";
+ //
+
+ var tblTaskInfo = document.createElement("table");
+ divTaskInfo.appendChild(tblTaskInfo);
+ tblTaskInfo.cellPadding = "0";
+ tblTaskInfo.cellSpacing = "0";
+ tblTaskInfo.height = this.Chart.heightTaskItem + "px";
+ tblTaskInfo.width = ((this.Duration * this.Chart.hourInPixelsWork == 0) ? 1 : this.Duration * this.Chart.hourInPixelsWork) + "px";
+
+ var rowTaskInfo = tblTaskInfo.insertRow(0);
+ var cellTaskInfo = document.createElement("td");
+ cellTaskInfo.align = "center";
+ cellTaskInfo.vAlign = "top";
+ cellTaskInfo.height = this.Chart.heightTaskItem + "px";
+ cellTaskInfo.className = "moveInfo";
+ cellTaskInfo.style.cssText = ";white-space:nowrap;";
+ rowTaskInfo.appendChild(cellTaskInfo);
+ projectItem.appendChild(divTaskInfo);
+
+ if (this.Project.ParentTasks.length == 0)
+ {
+ projectItem.style.display = "none";
+
+ }
+
+ if (this.Chart._showTooltip)
+ {
+ var getPopUpInfo = function(e) {
+ if ((!self.Chart._isMove) && (!self.Chart._isResize)) self.getPopUpInfo(self.projectItem[0], e);
+ };
+ var closePopUpInfo = function() {
+ self.closePopUpInfo();
+ };
+
+ this.addEvent(divTaskInfo, 'mouseover', getPopUpInfo, false);
+ this.addEvent(divTaskInfo, 'mouseout', closePopUpInfo, false);
+ }
+ return projectItem;
+};
+/**
+ * @desc: Creation of projectNameItem
+ * @type: private
+ * @topic: 0
+ */
+GanttProject.prototype.createProjectNameItem = function()
+{
+ var self = this;
+ var divName = document.createElement("div");
+ divName.style.cssText = "cursor:pointer;color:#003366;font-weight:bold;font-size:12px;font-family:Tahoma,Arial;white-space:nowrap;height:15px;z-index:1;position:absolute;left:" + 5 + "px;top:" + this.posY + "px;";
+ divName.innerHTML = this.Project.Name;
+ divName.title = this.Project.Name;
+ if (this.Chart.isShowConMenu)
+ {
+ var showContMenu = function(event) {
+
+ if (self.Chart.contextMenu.clear) self.Chart.contextMenu.clear();
+
+ var hideContMenu = null;
+ if (!self.Chart._isIE)
+ {
+ hideContMenu = function() {
+ self.Chart.contextMenu.hideContextMenu();
+ self.Chart.content.removeEventListener("mousedown", hideContMenu, false);
+ };
+
+ } else
+ {
+ hideContMenu = function() {
+ self.Chart.contextMenu.hideContextMenu();
+ self.Chart.content.detachEvent("mousedown", hideContMenu);
+ };
+ }
+
+ self.Chart.content.onmousedown = hideContMenu;
+
+ if (!self.Chart._isIE)
+ {
+ event.stopPropagation();
+
+ } else
+ {
+ event.cancelBubble = true;
+ }
+
+ self.Chart._showContextMenu(event, self);
+
+ };
+
+ if (this.Chart._isIE)
+ {
+ this.addEvent(divName, "contextmenu", function(e) {
+ showContMenu(e);
+ return false;
+ }, false);
+
+ } else
+ {
+ this.addEvent(divName, "contextmenu", function(e) {
+ e.preventDefault();
+ showContMenu(e);
+ }, false);
+ }
+
+ }
+ return divName;
+};
+/**
+ * @desc: calculates and returns percent completed of project
+ * @type: public
+ * @topic: 0
+ */
+GanttProject.prototype.getPercentCompleted = function()
+{
+ var sum = 0;
+ var percentCompleted = 0;
+
+ for (var i = 0; i < this.Project.ParentTasks.length; i++) {
+ sum += parseInt(this.Project.ParentTasks[i].PercentCompleted);
+ }
+ if (this.Project.ParentTasks.length != 0) {
+ return percentCompleted = Math.round(sum / this.Project.ParentTasks.length);
+ }
+ else {
+ return percentCompleted = -1;
+ }
+};
+/**
+ * @desc: calculates and returns the duration of project in hours
+ * @type: public
+ * @topic: 0
+ */
+GanttProject.prototype.getDuration = function()
+{
+ var duration = 0;
+ var tmpDuration = 0;
+ if (this.Project.ParentTasks.length > 0)
+ {
+ for (var i = 0; i < this.Project.ParentTasks.length; i++)
+ {
+ tmpDuration = this.Project.ParentTasks[i].Duration * 24 / this.Chart.hoursInDay + (this.Project.ParentTasks[i].EST - this.Chart.startDate) / (60 * 60 * 1000);
+ if (tmpDuration > duration)
+ {
+ duration = tmpDuration;
+ }
+ }
+ return ((duration - this.posX) / 24) * this.Chart.hoursInDay;
+
+ } else
+ {
+ return 0;
+ }
+
+};
+/**
+ * @desc: returns id of project.
+ * @type: public
+ * @topic: 0
+ */
+GanttProject.prototype.getId = function()
+{
+ return this.Project.Id;
+};
+/**
+ * @desc: returns name of project.
+ * @type: public
+ * @topic: 0
+ */
+GanttProject.prototype.getName = function()
+{
+ return this.Project.Name;
+};
+/**
+ * @desc: returns start date of project.
+ * @type: public
+ * @topic: 0
+ */
+GanttProject.prototype.getStartDate = function()
+{
+ return this.Project.StartDate;
+};
+
+/**
+ * @desc: add event
+ * @param: elm - current element
+ * @param: evType - string that specifies any of the standard DHTML Events
+ * @param: fn - pointer that specifies the function to call when sEvent fires
+ * @type: private
+ * @topic: 5
+ */
+GanttTask.prototype.addEvent = function (elm, evType, fn, useCapture)
+{
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ return elm.attachEvent('on' + evType, fn);
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+};
+/**
+ * @desc: the beginning of movement of task
+ * @param: event - (object)event
+ * @type: private
+ * @topic: 5
+ */
+GanttTask.prototype.startMove = function (event)
+{
+ this.moveChild = event.ctrlKey;
+ this.MouseX = event.screenX;
+
+ this.getMoveInfo();
+
+ this.checkMove = true;
+
+ if (this.Chart.isShowDescTask) {
+ this.hideDescTask();
+ }
+ if (this.Chart._isFF) document.body.style.cursor = "move";
+ if (this.Chart._isIE) event.srcElement.style.cursor = "move";
+};
+
+GanttTask.prototype.showDescTask = function()
+{
+ var posX = (parseInt(this.cTaskItem[0].style.left) + this.TaskInfo.Duration * this.Chart.hourInPixelsWork + 10);
+ this.descrTask.style.left = posX + "px";
+ this.descrTask.innerHTML = this.getDescStr();
+ this.descrTask.style.visibility = 'visible';
+
+};
+GanttTask.prototype.hideDescTask = function()
+{
+ this.descrTask.style.visibility = 'hidden';
+};
+GanttTask.prototype.getDescStr = function()
+{
+ var str = '', delim = ", ";
+ for (var i = 0; i < this.Chart.paramShowTask.length; i++) {
+ var prop = this.Chart.paramShowTask[i], propValue = this.TaskInfo[prop];
+ switch (prop) {
+ case "Name":
+ if (str != "")str += delim;
+ str += propValue;
+ break;
+ case "EST":
+ if (str != "")str += delim;
+ str += propValue.getDate() + "." + (propValue.getMonth() + 1) + "." + propValue.getFullYear();
+ break;
+ case "S-F":
+ if (str != "")str += delim;
+ propValue = this.TaskInfo["EST"];
+ str += propValue.getDate() + "." + (propValue.getMonth() + 1) + "." + propValue.getFullYear() + " - ";
+ propValue = this.getFinishDate();
+ str += propValue.getDate() + "." + (propValue.getMonth() + 1) + "." + propValue.getFullYear();
+ break;
+ case "Duration":
+ if (str != "")str += delim;
+ str += propValue + "h";
+ break;
+ case "PercentCompleted":
+ if (str != "")str += delim;
+ str += propValue + "%";
+ break;
+ default:
+ break;
+ }
+ }
+ return str;
+};
+/**
+ * @desc: returns id of task
+ * @type: public
+ * @topic: 0
+ */
+GanttTask.prototype.getId = function()
+{
+ return this.TaskInfo.Id;
+};
+/**
+ * @desc: returns name of task
+ * @type: public
+ * @topic: 0
+ */
+GanttTask.prototype.getName = function()
+{
+ return this.TaskInfo.Name;
+};
+/**
+ * @desc: returns duration of task (in hours)
+ * @type: public
+ * @topic: 0
+ */
+GanttTask.prototype.getDuration = function()
+{
+ return this.TaskInfo.Duration;
+};
+/**
+ * @desc: returns EST of task
+ * @type: public
+ * @topic: 0
+ */
+GanttTask.prototype.getEST = function()
+{
+ return this.TaskInfo.EST;
+};
+/**
+ * @desc: calculates and returns FinishDate of task
+ * @type: public
+ * @topic: 0
+ */
+GanttTask.prototype.getFinishDate = function()
+{
+ var date = new Date(this.TaskInfo.EST);
+ date.setDate(date.getDate() + parseInt((this.TaskInfo["Duration"]-1)/this.Chart.hoursInDay+1)-1);
+ return date;
+};
+/**
+ * @desc: returns PercentCompleted of task
+ * @type: public
+ * @topic: 0
+ */
+GanttTask.prototype.getPercentCompleted = function()
+{
+ return this.TaskInfo.PercentCompleted;
+};
+/**
+ * @desc: returns PredecessorTaskId of task
+ * @type: public
+ * @topic: 0
+ */
+GanttTask.prototype.getPredecessorTaskId = function()
+{
+ return this.TaskInfo.PredecessorTaskId ? this.TaskInfo.PredecessorTaskId : null;
+};
+/**
+ * @desc: returns ParentTaskId of task
+ * @type: public
+ * @topic: 0
+ */
+GanttTask.prototype.getParentTaskId = function()
+{
+ return this.parentTask ? this.parentTask.getId() : null;
+};
+
+GanttTask.prototype.moveDescTask = function()
+{
+ var posX = (parseInt(this.cTaskItem[0].style.left) + this.TaskInfo.Duration * this.Chart.hourInPixelsWork + 10);
+ this.descrTask.style.left = posX + "px";
+};
+
+/**
+ * @desc: Defines max and min position of movement
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.getMoveInfo = function()
+{
+ this.posX = parseInt(this.cTaskItem[0].style.left);
+ var widthTaskItem = parseInt(this.cTaskItem[0].childNodes[0].firstChild.width);
+ var posParentTaskItem = (this.parentTask == null) ? 0 : parseInt(this.parentTask.cTaskItem[0].style.left);
+ var posPredTaskItem = (this.predTask == null) ? 0 : parseInt(this.predTask.cTaskItem[0].style.left) + parseInt(this.predTask.cTaskItem[0].childNodes[0].firstChild.width);
+ var widthParentTaskItem = (this.parentTask == null) ? 0 : parseInt(this.parentTask.cTaskItem[0].childNodes[0].firstChild.width);
+
+ var childPredPosX = 0;
+ var childParentPosX = 0;
+ var childParentPosXR = 0;
+ if (this.childPredTask.length > 0)
+ {
+ var posChildTaskItem = null;
+ for (var n = 0; n < this.childPredTask.length; n++)
+ {
+ if ((!posChildTaskItem) || ((posChildTaskItem) && (posChildTaskItem > parseInt(this.childPredTask[n].cTaskItem[0].style.left))))
+ {
+ posChildTaskItem = parseInt(this.childPredTask[n].cTaskItem[0].style.left);
+ }
+ }
+ childPredPosX = posChildTaskItem;
+ }
+ if (this.childTask.length > 0)
+ {
+ var posChildTaskItemR = null;
+ for (var n = 0; n < this.childTask.length; n++)
+ {
+ if ((!posChildTaskItemR) || ((posChildTaskItemR) && (posChildTaskItemR > (parseInt(this.childTask[n].cTaskItem[0].style.left)))))
+ {
+ posChildTaskItemR = parseInt(this.childTask[n].cTaskItem[0].style.left);
+ }
+ }
+ childParentPosXR = posChildTaskItemR;
+
+ var posChildTaskItem = null;
+ for (var n = 0; n < this.childTask.length; n++)
+ {
+ if ((!posChildTaskItem) || ((posChildTaskItem) && (posChildTaskItem < (parseInt(this.childTask[n].cTaskItem[0].style.left) + parseInt(this.childTask[n].cTaskItem[0].firstChild.firstChild.width)))))
+ {
+ posChildTaskItem = parseInt(this.childTask[n].cTaskItem[0].style.left) + parseInt(this.childTask[n].cTaskItem[0].firstChild.firstChild.width);
+ }
+ }
+
+ childParentPosX = posChildTaskItem;
+ }
+
+ if (!this.moveChild)
+ {
+ if (this.childPredTask.length > 0) {
+ if (this.maxPosXMove < childPredPosX) this.maxPosXMove = childPredPosX;
+ }
+ if (this.childTask.length > 0) {
+ if ((this.childPredTask.length > 0) && (this.maxPosXMove - widthTaskItem) > childParentPosXR) this.maxPosXMove = this.maxPosXMove - ((this.maxPosXMove - widthTaskItem) - childParentPosXR);
+ if (!(this.childPredTask.length > 0)) this.maxPosXMove = childParentPosXR + widthTaskItem;
+ this.minPosXMove = (childParentPosX - widthTaskItem);
+ }
+
+ if (posParentTaskItem > 0)
+ {
+ if ((!(this.childPredTask.length > 0)) && (this.childTask.length > 0)) {
+ if (this.maxPosXMove > posParentTaskItem + widthParentTaskItem) {
+ this.maxPosXMove = posParentTaskItem + widthParentTaskItem;
+ }
+ }
+ if (this.minPosXMove <= posParentTaskItem) {
+ this.minPosXMove = posParentTaskItem;
+ }
+ if ((!(this.childTask.length > 0)) && (!(this.childPredTask.length > 0))) {
+ this.maxPosXMove = posParentTaskItem + widthParentTaskItem;
+
+ } else if ((!(this.childTask.length > 0)) && (this.childPredTask.length > 0)) {
+ if ((posParentTaskItem + widthParentTaskItem) > posPredTaskItem) {
+ this.maxPosXMove = childPredPosX;
+ }
+ }
+ }
+
+ if (posPredTaskItem > 0) {
+ if (this.minPosXMove <= posPredTaskItem) {
+ this.minPosXMove = posPredTaskItem;
+ }
+ }
+ if ((posPredTaskItem == 0) && (posParentTaskItem == 0)) {
+ if (this.minPosXMove <= this.Chart.initialPos) {
+ this.minPosXMove = this.Chart.initialPos;
+ }
+ }
+ } else
+ {
+ if ((posParentTaskItem > 0) && (posPredTaskItem == 0))
+ {
+ this.minPosXMove = posParentTaskItem;
+ this.maxPosXMove = posParentTaskItem + widthParentTaskItem;
+
+ } else if ((posParentTaskItem == 0) && (posPredTaskItem == 0))
+ {
+ this.minPosXMove = this.Chart.initialPos;
+ this.maxPosXMove = -1;
+
+ } else if ((posParentTaskItem > 0) && (posPredTaskItem > 0))
+ {
+ this.minPosXMove = posPredTaskItem;
+ this.maxPosXMove = posParentTaskItem + widthParentTaskItem;
+
+ } else if ((posParentTaskItem == 0) && (posPredTaskItem > 0))
+ {
+ this.minPosXMove = posPredTaskItem;
+ this.maxPosXMove = -1;
+ }
+
+ if ((this.parentTask) && (this.childPredTask.length > 0))
+ {
+ var posChildTaskItem = this.getMaxPosPredChildTaskItem(this);
+ var posParentTaskItem = parseInt(this.parentTask.cTaskItem[0].style.left) + parseInt(this.parentTask.cTaskItem[0].firstChild.firstChild.width);
+ this.maxPosXMove = this.posX + widthTaskItem + posParentTaskItem - posChildTaskItem;
+ }
+ }
+};
+/**
+ * @desc: The beginning of extension of task
+ * @param: event - (object) event
+ * @type: private
+ * @topic: 5
+ */
+GanttTask.prototype.startResize = function(event)
+{
+ this.MouseX = event.screenX;
+ this.getResizeInfo();
+ if (this.Chart.isShowDescTask) {
+ this.hideDescTask();
+ }
+ this.checkResize = true;
+ this.taskItemWidth = parseInt(this.cTaskItem[0].firstChild.firstChild.width);
+ if (this.Chart._isFF)document.body.style.cursor = "e-resize";
+
+};
+/**
+ * @desc: Defines max and min position of stretchings
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.getResizeInfo = function()
+{
+ var taskItem = this.cTaskItem[0];
+ var posParentTaskItem = (this.parentTask == null) ? 0 : parseInt(this.parentTask.cTaskItem[0].style.left);
+ var widthParentTaskItem = (this.parentTask == null) ? 0 : parseInt(this.parentTask.cTaskItem[0].childNodes[0].firstChild.width);
+ var posTaskItem = parseInt(this.cTaskItem[0].style.left);
+
+ var childPredPosX = 0;
+ var childParentPosX = 0;
+ if (this.childPredTask.length > 0)
+ {
+ var posChildTaskItem = null;
+ for (var n = 0; n < this.childPredTask.length; n++)
+ {
+ if ((!posChildTaskItem) || ((posChildTaskItem) && (posChildTaskItem > parseInt(this.childPredTask[n].cTaskItem[0].style.left))))
+ {
+ posChildTaskItem = parseInt(this.childPredTask[n].cTaskItem[0].style.left);
+
+ }
+ }
+ childPredPosX = posChildTaskItem;
+ }
+
+ if (this.childTask.length > 0)
+ {
+ var posChildTaskItem = null;
+ for (var n = 0; n < this.childTask.length; n++)
+ {
+ if ((!posChildTaskItem) || ((posChildTaskItem) && (posChildTaskItem < (parseInt(this.childTask[n].cTaskItem[0].style.left) + parseInt(this.childTask[n].cTaskItem[0].firstChild.firstChild.width)))))
+ {
+ posChildTaskItem = parseInt(this.childTask[n].cTaskItem[0].style.left) + parseInt(this.childTask[n].cTaskItem[0].firstChild.firstChild.width);
+ }
+ }
+
+ childParentPosX = posChildTaskItem;
+ }
+
+ this.minWidthResize = this.Chart.dayInPixels;
+
+ if (this.childTask.length > 0)
+ {
+ this.minWidthResize = childParentPosX - posTaskItem;
+ }
+
+ if ((this.childPredTask.length > 0) && (!this.parentTask))
+ {
+ this.maxWidthResize = childPredPosX - posTaskItem;
+
+ } else if ((this.childPredTask.length > 0) && (this.parentTask))
+ {
+ var w1 = posParentTaskItem + widthParentTaskItem - posTaskItem;
+ var w2 = childPredPosX - posTaskItem;
+ this.maxWidthResize = Math.min(w1, w2);
+
+ } else if ((this.childPredTask.length == 0) && (this.parentTask))
+ {
+ this.maxWidthResize = posParentTaskItem + widthParentTaskItem - posTaskItem;
+ }
+
+};
+/**
+ * @desc: creation of taskItem
+ * @type: private
+ * @topic: 0
+ */
+GanttTask.prototype.createTaskItem = function()
+{
+ var self = this;
+ this.posX = this.Chart.getPosOnDate(this.TaskInfo.EST);
+
+ var itemControl = document.createElement("div");
+ itemControl.id = this.TaskInfo.Id;
+ itemControl.style.cssText = ";z-index:1;position:absolute;left:" + this.posX + "px;top:" + this.posY + "px;";
+
+ var divTaskItem = document.createElement("div");
+ itemControl.appendChild(divTaskItem);
+ divTaskItem.style.cssText = "z-index:1;position: absolute;left:0px;top:0px;";
+
+ var tblTaskItem = document.createElement("table");
+ divTaskItem.appendChild(tblTaskItem);
+ tblTaskItem.cellPadding = "0";
+ tblTaskItem.cellSpacing = "0";
+ tblTaskItem.width = this.TaskInfo.Duration * this.Chart.hourInPixelsWork + "px";
+ tblTaskItem.style.cssText = "border: solid 1px #6589A9;";
+
+ var rowTblTask = tblTaskItem.insertRow(tblTaskItem.rows.length);
+
+ if (this.TaskInfo.PercentCompleted != 0)
+ {
+ var cellTblTask = document.createElement("td");
+ rowTblTask.appendChild(cellTblTask);
+ cellTblTask.height = this.Chart.heightTaskItem + "px";
+ cellTblTask.width = this.TaskInfo.PercentCompleted + "%";
+ cellTblTask.style.lineHeight = "1px";
+ var imgPr = document.createElement("img");
+ imgPr.style.width = (this.TaskInfo.PercentCompleted * this.TaskInfo.Duration * this.Chart.hourInPixelsWork) / 100 + "px";
+ imgPr.style.height = this.Chart.heightTaskItem + "px";
+ cellTblTask.appendChild(imgPr);
+ imgPr.src = this.Chart.imgs + "progress_filled.png";
+ }
+
+ if (this.TaskInfo.PercentCompleted != 100)
+ {
+ var cellTblTask = document.createElement("td");
+ rowTblTask.appendChild(cellTblTask);
+ cellTblTask.height = this.Chart.heightTaskItem + "px";
+ cellTblTask.width = (100 - this.TaskInfo.PercentCompleted) + "%";
+ cellTblTask.style.lineHeight = "1px";
+ var imgPrF = document.createElement("img");
+ imgPrF.style.width = ((100 - this.TaskInfo.PercentCompleted) * this.TaskInfo.Duration * this.Chart.hourInPixelsWork) / 100 + "px";
+ imgPrF.style.height = this.Chart.heightTaskItem + "px";
+ cellTblTask.appendChild(imgPrF);
+ imgPrF.src = this.Chart.imgs + "progress_bg.png";
+
+ }
+
+ if (this.Chart.isEditable)
+ {
+ var divTaskInfo = document.createElement("div");
+ divTaskInfo.style.cssText = "text-align:center;font-size:9px;z-index:2;position: absolute;left:0px;top:0px;";
+
+ var tblTaskInfo = document.createElement("table");
+ divTaskInfo.appendChild(tblTaskInfo);
+ tblTaskInfo.cellPadding = "0";
+ tblTaskInfo.cellSpacing = "0";
+ tblTaskInfo.height = this.Chart.heightTaskItem + "px";
+ tblTaskInfo.width = this.TaskInfo.Duration * this.Chart.hourInPixelsWork + "px";
+
+ var rowTaskInfo = tblTaskInfo.insertRow(0);
+ var cellTaskInfo = document.createElement("TD");
+ cellTaskInfo.align = "center";
+ cellTaskInfo.vAlign = "top";
+ cellTaskInfo.height = this.Chart.heightTaskItem + "px";
+ cellTaskInfo.className = "moveInfo";
+ cellTaskInfo.style.cssText = ";white-space:nowrap;font-size:9px";
+ rowTaskInfo.appendChild(cellTaskInfo);
+ itemControl.appendChild(divTaskInfo);
+ }
+
+ var divTaskName = document.createElement("div");
+ itemControl.appendChild(divTaskName);
+ divTaskName.style.cssText = ";z-index:2;position: absolute;left:0px;top:0px;";
+
+ var divMove = document.createElement("div");
+ divMove.innerHTML = "";
+ if (this.Chart._isIE)
+ {
+ divMove.style.background = "#000000";
+ divMove.style.filter = "alpha(opacity=0)";
+ }
+ divMove.style.height = this.Chart.heightTaskItem + "px";
+ divMove.style.width = this.TaskInfo.Duration * this.Chart.hourInPixelsWork + "px";
+ divTaskName.appendChild(divMove);
+
+ if (this.Chart._showTooltip)
+ {
+ var getPopUpInfo = function(e) {
+ if ((!self.Chart._isMove) && (!self.Chart._isResize)) self.getPopUpInfo(self.cTaskItem[0], e);
+ };
+ var closePopUpInfo = function() {
+ self.closePopUpInfo();
+ };
+
+ this.addEvent(divMove, 'mouseover', getPopUpInfo, false);
+ this.addEvent(divMove, 'mouseout', closePopUpInfo, false);
+ }
+
+ var taskClick = function() {
+ self.Chart.callEvent("onTaskClick", [self]);
+ };
+ this.addEvent(divMove, 'click', taskClick, false);
+
+ if (this.Chart.isEditable)
+ {
+ //Create resize area
+ var divResize = document.createElement("div");
+ divResize.style.cssText = ";z-index:10;position: absolute;left:" + (this.TaskInfo.Duration * this.Chart.hourInPixelsWork - 10) + "px;top:0px;";
+ divResize.style.height = this.Chart.heightTaskItem + "px";
+ divResize.style.width = "10px";
+ divResize.innerHTML = "";
+ divTaskName.appendChild(divResize);
+
+ var startMove = function(e) {
+ if (self.Chart.callEvent("onTaskStartDrag", [self])===false) return;
+
+ var moveItem = function(e1) {
+ if (self.checkMove) self.moveItem(e1);
+ };
+ var endMove = function() {
+ if (self.checkMove) {
+ self.endMove();
+ self.Chart._isMove = false;
+ if (self.Chart._isIE)
+ {
+ document.body.releaseCapture();
+ document.detachEvent("onmousemove", moveItem);
+ document.detachEvent("onmouseup", endMove);
+ } else {
+ document.removeEventListener("mousemove", moveItem, true);
+ document.removeEventListener("mouseup", endMove, true);
+ }
+ if (self.wasMoved) self.Chart.callEvent("onTaskEndDrag", [self]);
+ }
+ };
+ self.addEvent(document, 'mousemove', moveItem, true);
+ self.addEvent(document, 'mouseup', endMove, true);
+
+ if (self.Chart._showTooltip) self.closePopUpInfo();
+ self.startMove(e);
+ self.Chart._isMove = true;
+ if (self.Chart._isIE) document.body.setCapture(false);
+ };
+
+ var startResize = function(e) {
+ if (self.Chart.callEvent("onTaskStartResize", [self])===false) return;
+
+ var resizeItem = function(e1) {
+ if (self.checkResize)self.resizeItem(e1);
+ };
+
+ var endResizeItem = function() {
+ if (self.checkResize) {
+ self.endResizeItem();
+ self.Chart._isResize = false;
+ if (self.Chart._isIE)
+ {
+ document.body.releaseCapture();
+ document.detachEvent("onmousemove", resizeItem);
+ document.detachEvent("onmouseup", endResizeItem);
+ } else {
+ document.removeEventListener("mousemove", resizeItem, true);
+ document.removeEventListener("mouseup", endResizeItem, true);
+ }
+ if (self.wasResized) self.Chart.callEvent("onTaskEndResize", [self]);
+ }
+ };
+
+ self.addEvent(document, 'mousemove', resizeItem, false);
+ self.addEvent(document, 'mouseup', endResizeItem, false);
+
+ self.startResize(e);
+ if (self.Chart._isIE) document.body.setCapture(false);
+ self.Chart._isResize = true;
+ };
+
+ this.addEvent(divMove, 'mousedown', startMove, false);
+ this.addEvent(divResize, 'mousedown', startResize, false);
+
+ var setCursorResize = function(e2) {
+ if (!self.Chart._isMove) (e2.srcElement?e2.srcElement:e2.target).style.cursor = "e-resize";
+ };
+ var setCursorStandart = function(e3) {
+ if (!self.checkResize) (e3.srcElement?e3.srcElement:e3.target).style.cursor = "";
+ };
+
+ this.addEvent(divResize, 'mouseover', setCursorResize, false);
+ this.addEvent(divResize, 'mouseout', setCursorStandart, false);
+ }
+ return itemControl;
+};
+/**
+ * @desc: creation of taskNameItem
+ * @type: private
+ * @topic: 0
+ */
+GanttTask.prototype.createTaskNameItem = function(hasChildren)
+{
+ var self = this;
+ var divName = document.createElement("div");
+ divName.id = this.TaskInfo.Id;
+ divName.style.cssText = "cursor:pointer;white-space:nowrap;height:15px;z-index:1;position:absolute;left:20px;top: " + this.posY + "px;";
+ if (hasChildren) divName.style.fontWeight = "bold";
+ divName.className = "taskNameItem";
+ divName.title = this.TaskInfo.Name;
+ divName.innerHTML = this.TaskInfo.Name;
+ if (this.Chart.isShowConMenu)
+ {
+ var showContMenu = function(event) {
+
+ if (self.Chart.contextMenu.clear) self.Chart.contextMenu.clear();
+
+ var hideContMenu = function() {
+ self.Chart.contextMenu.hideContextMenu();
+ if (self.Chart._isIE)
+ self.Chart.content.detachEvent("mousedown", hideContMenu);
+ else
+ self.Chart.content.removeEventListener("mousedown", hideContMenu, false);
+ };
+
+ self.Chart.content.onmousedown = hideContMenu;
+
+ if (!self.Chart._isIE)
+ {
+ event.stopPropagation();
+ } else
+ {
+ event.cancelBubble = true;
+ }
+
+ self.Chart._showContextMenu(event, self);
+
+ };
+
+ if (this.Chart._isIE)
+ {
+ this.addEvent(divName, "contextmenu", function(e) {
+ showContMenu(e);
+ return false;
+ }, false);
+
+ } else
+ {
+ this.addEvent(divName, "contextmenu", function(e) {
+ e.preventDefault();
+ showContMenu(e);
+ }, false);
+ }
+ }
+ return divName;
+};
+
+
+GanttTask.prototype.createTaskDescItem = function()
+{
+ var posX = (this.posX + this.TaskInfo.Duration * this.Chart.hourInPixelsWork + 10);
+ var divDesc = document.createElement("div");
+ divDesc.style.cssText += ";z-index:1;position:absolute;left:" + posX + "px;top:" + this.posY + "px;";
+ divDesc.innerHTML = this.getDescStr();
+ divDesc.className = "descTask";
+ this.descrTask = divDesc;
+
+ if (this.Chart._showTooltip)
+ {
+ var self = this;
+ var getPopUpInfo = function(e) {
+ if ((!self.Chart._isMove) && (!self.Chart._isResize)) self.getPopUpInfo(self.descrTask, e);
+ };
+ var closePopUpInfo = function() {
+ self.closePopUpInfo();
+ };
+
+ this.addEvent(divDesc, 'mouseover', getPopUpInfo, false);
+ this.addEvent(divDesc, 'mouseout', closePopUpInfo, false);
+ }
+ return divDesc;
+};
+
+/**
+ * @desc: check Width of taskNameItem
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.checkWidthTaskNameItem = function()
+{
+ if (this.cTaskNameItem[0].offsetWidth + this.cTaskNameItem[0].offsetLeft > this.Chart.maxWidthPanelNames)
+ {
+ var width = this.cTaskNameItem[0].offsetWidth + this.cTaskNameItem[0].offsetLeft - this.Chart.maxWidthPanelNames;
+ var countChar = Math.round(width / (this.cTaskNameItem[0].offsetWidth / this.cTaskNameItem[0].firstChild.length));
+ var tName = this.TaskInfo.Name.substring(0, this.cTaskNameItem[0].firstChild.length - countChar - 3);
+ tName += "...";
+ this.cTaskNameItem[0].innerHTML = tName;
+ }
+
+};
+/**
+ * @desc: creation of GanttTask
+ * @type: private
+ * @topic: 0
+ */
+GanttTask.prototype.create = function()
+{
+ var containerTasks = this.Chart.oData.firstChild;
+ var containerNames = null;
+ if (this.Chart._showTreePanel) containerNames = this.Chart.panelNames.firstChild;
+ var predecessorTask = this.TaskInfo.PredecessorTask;
+ var parentTask = this.TaskInfo.ParentTask;
+ var isCParentTask = (this.TaskInfo.ChildTasks.length > 0);
+ var self = this;
+
+ this.cTaskItem = [];
+ this.cTaskNameItem = [];
+
+ //creation arrTasks
+ if (!parentTask)
+ {
+ if (this.TaskInfo.previousParentTask) {
+ this.previousParentTask = this.Project.getTaskById(this.TaskInfo.previousParentTask.Id);
+ var lastChildTask = this.Chart.getLastChildTask(this.previousParentTask);
+ this.posY = parseInt(lastChildTask.cTaskItem[0].style.top) + this.Chart.heightTaskItem + 11;
+ this.previousParentTask.nextParentTask = this;
+
+ } else {
+ this.posY = parseInt(this.Project.projectItem[0].style.top) + this.Chart.heightTaskItem + 11;
+ }
+ }
+
+ if (parentTask) {
+ var task = this.Project.getTaskById(this.TaskInfo.ParentTask.Id);
+ this.parentTask = task;
+
+ if (this.TaskInfo.previousChildTask) {
+ this.previousChildTask = this.Project.getTaskById(this.TaskInfo.previousChildTask.Id);
+ var lastChildTask = this.Chart.getLastChildTask(this.previousChildTask);
+ this.posY = parseInt(lastChildTask.cTaskItem[0].style.top) + this.Chart.heightTaskItem + 11;
+ this.previousChildTask.nextChildTask = this;
+
+ } else {
+ this.posY = parseInt(task.cTaskItem[0].style.top) + this.Chart.heightTaskItem + 11;
+ }
+ task.childTask.push(this);
+ }
+
+ if (predecessorTask) {
+ var task = this.Project.getTaskById(predecessorTask.Id);
+ this.predTask = task;
+ task.childPredTask.push(this);
+ }
+
+ //creation task item
+ this.cTaskItem.push(this.createTaskItem());
+ containerTasks.appendChild(this.cTaskItem[0]);
+
+ if (this.Chart.panelNames) {
+ this.cTaskNameItem.push(this.createTaskNameItem(isCParentTask));
+ this.Chart.panelNames.firstChild.appendChild(this.cTaskNameItem[0]);
+ }
+
+ if (this.Chart.isShowDescTask) {
+ containerTasks.appendChild(this.createTaskDescItem());
+ }
+
+ //Create Connecting Lines
+ var arrConnectingLines = [];
+ if (predecessorTask) arrConnectingLines = this.createConnectingLinesDS();
+ this.cTaskItem.push(arrConnectingLines);
+
+ if (this.Chart.panelNames)
+ {
+ //Create Connecting Lines
+ var arrConnectingLinesNames = [];
+ if (parentTask)
+ {
+ this.cTaskNameItem[0].style.left = parseInt(this.parentTask.cTaskNameItem[0].style.left) + 15 + "px";
+ arrConnectingLinesNames = this.createConnectingLinesPN();
+ }
+ this.checkWidthTaskNameItem();
+
+ var treeImg = null;
+ if (isCParentTask) treeImg = this.createTreeImg();
+
+ this.cTaskNameItem.push(arrConnectingLinesNames);
+ this.cTaskNameItem.push(treeImg);
+ }
+ this.addDayInPanelTime();
+ return this;
+};
+
+/**
+ * @desc: creation of image of node
+ * @type: private
+ * @topic: 4
+ */
+GanttTask.prototype.createTreeImg = function()
+{
+ var self = this;
+ var treeImg = new Image();
+ treeImg.src = this.Chart.imgs + "minus.gif";
+ treeImg.id = this.TaskInfo.Id;
+
+ treeImg.onclick = function()
+ {
+ if (self._isOpen)
+ {
+ this.src = self.Chart.imgs + "plus.gif";
+ self._isOpen = false;
+ self.hideChildTasks(self);
+ self.shiftCurrentTasks(self, -self._heightHideTasks);
+ }
+ else
+ {
+ this.src = self.Chart.imgs + "minus.gif";
+ self._isOpen = true;
+ self.shiftCurrentTasks(self, self._heightHideTasks);
+ self.showChildTasks(self, true);
+ self._heightHideTasks = 0;
+ }
+ };
+
+ this.Chart.panelNames.firstChild.appendChild(treeImg);
+ treeImg.style.cssText = "cursor:pointer;left:" + (parseInt(this.cTaskNameItem[0].style.left) - 12) + "px;top:" + (parseInt(this.cTaskNameItem[0].style.top) + 3) + "px;z-index:12;position:absolute;";
+
+ return treeImg;
+};
+/**
+ * @desc: returns last child of GanttTask
+ * @type: private
+ * @topic: 2
+ */
+GanttChart.prototype.getLastChildTask = function(task)
+{
+ if (task.childTask.length > 0)
+ {
+ return this.getLastChildTask(task.childTask[task.childTask.length - 1]);
+
+ } else
+ {
+ return task;
+ }
+
+};
+/**
+ * @desc: dhtmlXMLSenderObject constructor
+ * @type: public
+ * @topic: 0
+ */
+dhtmlXMLSenderObject = function(ganttChart)
+{
+ this.xmlHttp = this.createXMLHttpRequest();
+ this.isProcessed = false;
+ this.path = null;
+ this.filename = null;
+ this.Chart = ganttChart;
+};
+/**
+ * @desc: creation (object) XMLHttpRequest
+ * @type: private
+ * @topic: 4
+ */
+dhtmlXMLSenderObject.prototype.createXMLHttpRequest = function()
+{
+ if (window.XMLHttpRequest) {
+ return new XMLHttpRequest();
+ }
+ else if (window.ActiveXObject) {
+ return new ActiveXObject("Microsoft.XMLHTTP");
+ }
+};
+/**
+ * @desc: Sends the data on a server
+ * @type: private
+ * @topic: 6
+ */
+dhtmlXMLSenderObject.prototype.sendData = function(filename, path, xmlData)
+{
+ var self = this;
+ this.path = path;
+ this.filename = filename;
+
+ if ((this.path == null) || (this.path == ""))
+ {
+ this.Chart.Error.throwError("DATA_SEND_ERROR", 3, null);
+ return;
+ }
+ if ((this.filename == null) || (this.filename == ""))
+ {
+ this.Chart.Error.throwError("DATA_SEND_ERROR", 4, null);
+ return;
+ }
+
+ this.isProcessed = true;
+ this.xmlHttp.open("POST", this.path, true);
+ if (this.Chart._isFF)
+ {
+ this.xmlHttp.onerror = function() {
+ self.xmlHttp.onreadystatechange = null;
+ self.xmlHttp.abort();
+ self.isProcessed = false;
+ }
+ }
+ this.xmlHttp.onreadystatechange = function() {
+ self.getStatus();
+ };
+ this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ this.xmlHttp.send("data=" + encodeURI(xmlData) + "&filename=" + filename);
+
+
+};
+/**
+ * @desc: Returns the status of operation
+ * @type: private
+ * @topic: 4
+ */
+dhtmlXMLSenderObject.prototype.getStatus = function()
+{
+ if (this.xmlHttp.readyState == 4)
+ {
+
+ var _status = "";
+ try {
+ _status = this.xmlHttp.status;
+
+ } catch(e) {
+ this.Chart.Error.throwError("DATA_SEND_ERROR", 1, null);
+ return 0;
+ }
+
+ switch (_status) {
+
+ case 0:
+ this.Chart.Error.throwError("DATA_SEND_ERROR", 1, null);
+ //this.xmlHttp.abort();
+ break;
+ case 404:
+ this.Chart.Error.throwError("DATA_SEND_ERROR", 5, [this.path]);
+ //this.xmlHttp.abort();
+ break;
+ case 500:
+ this.Chart.Error.throwError("DATA_SEND_ERROR", 2, null);
+ //this.xmlHttp.abort();
+ break;
+ case 12029:
+ this.Chart.Error.throwError("DATA_SEND_ERROR", 1, null);
+ //this.xmlHttp.abort();
+ break;
+ default:
+ if (!(_status >= 200 && _status < 300 || _status == 304))
+ {
+ this.Chart.Error.throwError("DATA_SEND_ERROR", 0, null);
+ //this.xmlHttp.abort();
+ }
+ break;
+ }
+ this.isProcessed = false;
+
+ }
+};
+/**
+ * @desc: GanttError constructor
+ * @type: private
+ * @topic: 0
+ */
+function GanttError() {
+
+ this.catches = [];
+ this._errors = [];
+ this._init();
+
+ return this;
+}
+/**
+ * @desc: initialization of control errors
+ * @type: private
+ * @topic: 4
+ */
+GanttError.prototype._init = function()
+{
+ //connection errors
+ this._errors[0] = "Connection error";
+ this._errors[1] = "Cannot connect";
+ this._errors[2] = "Server error";
+ this._errors[3] = "Path is null or empty";
+ this._errors[4] = "Filename is null or empty";
+ this._errors[5] = "File (%0) is not found";
+
+ //API errors
+ this._errors[6] = "Percent Complete should be a number";
+ this._errors[7] = "Percent Complete should be <= 100";
+ this._errors[8] = "Percent Complete should be >= 0";
+ this._errors[9] = "Increase duration of task(%0)";
+ this._errors[10] = "Reduce duration of task(%0)";
+ this._errors[11] = "Increase EST of child task (%0)";
+ this._errors[12] = "Reduce EST of task (%0)";
+ this._errors[13] = "The project (%0) is added";
+ this._errors[14] = "Start Date of the project < start Date of the control";
+ this._errors[15] = "Task (%0) cannot be the child of predecessor task(%1)";
+ this._errors[16] = "Time of the termination of predecessor task(%0) > EST of child task(%1)";
+ this._errors[17] = "The Predecessor (%0) task does not exist";
+ this._errors[18] = "The EST of task (%0) < start date of the control";
+ this._errors[19] = "Time of the termination of parent task (%0) < time of the termination of child task(%1)";
+ this._errors[20] = "The EST of task (%0) < EST of parent task(%1)";
+ this._errors[21] = "The parent task (%0) does not exist";
+ this._errors[22] = "The task (%0) is added";
+ this._errors[23] = "The project (%0) is added";
+ this._errors[24] = "Task (%0) EST < project (%1) startDate";
+ this._errors[25] = "Parent task (%0) EST cannot be null";
+ this._errors[26] = "Predecessor task (%0) position error. Reduce duration of predecessor task (%0) or increase EST of child task (%1)";
+ this._errors[27] = "Predecessor task (%0) does not exist";
+ this._errors[28] = "Increase duration of parent task (%0) or reduce EST of child task (%1) or reduce duration of child task(%1)";
+ this._errors[29] = "Reduce EST of parent task (%0) or increase EST of child task (%1)";
+ this._errors[30] = "The task(%0) does not exist";
+ this._errors[31] = "The project(%0) does not exist";
+ this._errors[32] = "Predecessor task(%0) and child task(%1) should have the same parent";
+ this._errors[33] = "Reduce EST of parent task (%0) or increase EST of child task (%1)";
+ this._errors[34] = "EST of task(%0) < start date of the project(%1)";
+ this._errors[35] = "Percent Complete should be <= 100 and >= 0";
+ this._errors[36] = "You may not connect a task to itself.";
+ this._errors[37] = "Cannot parse this XML string.";
+};
+/**
+ * @desc: bind type of exception with handler
+ * @param: type - type of error
+ * @param: handler - handler name
+ * @type: private
+ * @topic: 4
+ */
+GanttError.prototype.catchError = function(type, handler) {
+
+ this.catches[type] = handler;
+};
+/**
+ * @desc: get error string
+ * @param: str - error message
+ * @param: params - replace %i params in message
+ * @type: private
+ * @topic: 4
+ */
+GanttError.prototype.getErrorString = function(str, params)
+{
+ if (!params) {
+ return str;
+ } else {
+ for (var i = 0; i < params.length; i++) {
+
+ var re = new RegExp("%" + i, "gi");
+ str = str.replace(re, params[i]);
+
+ }
+ return str;
+ }
+};
+/**
+ * @desc: throw error
+ * @param: type - type of error
+ * @param: description - description of error
+ * @param: params - current data
+ * @type: private
+ * @topic: 4
+ */
+GanttError.prototype.throwError = function(type, description, params) {
+ if (this.catches[type])
+ {
+ var index = parseInt(description);
+ var errorStr = this.getErrorString(this._errors[index], params);
+ return this.catches[type](type, errorStr, params);
+ }
+ return null;
+};
+
+function contextMenu(chart)
+{
+ this.Chart = chart;
+ this.TabContainer = null;
+ this.MenuPanel = null;
+ this.tabPanel = null;
+ this.arrTabs = [];
+ this.isShow = false;
+ this.hideDiv = null;
+ this._init();
+}
+
+contextMenu.prototype._init = function()
+{
+ this.createMenuPanel();
+ this.createHideDiv();
+ this.createTabContainer();
+ this.createTabPanel();
+
+ var self = this;
+ var arrItems = [];
+
+ var tab1 = this.createTab(1, "Rename task", "t", true, this);
+ tab1.addItem(1, "New name", document.createElement("input"), "text", function() {
+ tab1.arrItems[0].control.focus();
+ });
+ tab1.addItem(2, "Rename", document.createElement("input"), "button",
+ function() {
+ var name = tab1.arrItems[0].control.value;
+ try {
+ tab1.object.setName(name);
+ tab1.hide();
+ } catch(e) {
+
+ }
+ }
+ );
+
+ var tab2 = this.createTab(2, "Delete task", "t", true, this);
+ tab2.addItem(1, "Delete", document.createElement("input"), "button",
+ function()
+ {
+ try {
+ tab2.object.Project.deleteTask(tab2.object.TaskInfo.Id);
+ tab2.hide();
+ }
+ catch(e) {
+
+ }
+ }
+ );
+ var tab3 = this.createTab(3, "Set EST", "t", true, this);
+ tab3.addItem(1, "EST", document.createElement("input"), "text", function() {
+ tab3.arrItems[0].control.focus();
+ });
+ tab3.addItem(2, "Move children", document.createElement("input"), "checkbox", function() {
+ tab3.arrItems[1].control.focus();
+ });
+ tab3.addItem(3, "Update", document.createElement("input"), "button",
+ function() {
+ var isMoveChild = tab3.arrItems[1].control.checked;
+ var arr = tab3.arrItems[0].control.value.split(".");
+ var est = (arr.length < 3) ? null : (new Date(arr[2], parseInt(arr[1]) - 1, arr[0]));
+ try {
+ if (tab3.object.setEST(est, isMoveChild)) tab3.hide();
+ } catch(e) {
+
+ }
+ }
+ );
+
+ var tab4 = this.createTab(4, "Set duration", "t", true, this);
+ tab4.addItem(1, "Duration", document.createElement("input"), "text", function() {
+ tab4.arrItems[0].control.focus();
+ });
+ tab4.addItem(2, "Update", document.createElement("input"), "button",
+ function() {
+ var d = tab4.arrItems[0].control.value;
+ try {
+ if (tab4.object.setDuration(d)) tab4.hide();
+ } catch(e) {
+
+ }
+ }
+ );
+
+ var tab5 = this.createTab(5, "Set % complete", "t", true, this);
+ tab5.addItem(1, "Percent Complete", document.createElement("input"), "text", function() {
+ tab5.arrItems[0].control.focus();
+ });
+ tab5.addItem(2, "Update", document.createElement("input"), "button",
+ function() {
+ var p = tab5.arrItems[0].control.value;
+ try {
+ if (tab5.object.setPercentCompleted(p)) tab5.hide();
+ } catch(e) {
+
+ }
+ }
+ );
+
+ var tab13 = this.createTab(13, "Set predecessor", "t", true, this);
+ tab13.addItem(1, "Predecessor", document.createElement("input"), "text", function() {
+ tab13.arrItems[0].control.focus();
+ });
+ tab13.addItem(2, "Update", document.createElement("input"), "button",
+ function() {
+ var p = tab13.arrItems[0].control.value;
+ try {
+ if (tab13.object.setPredecessor(p)) tab13.hide();
+ } catch(e) {
+
+ }
+ }
+ );
+
+ var tab6 = this.createTab(6, "Rename project", "p", true, this);
+ tab6.addItem(1, "New name", document.createElement("input"), "text", function() {
+ tab6.arrItems[0].control.focus();
+ });
+ tab6.addItem(2, "Rename", document.createElement("input"), "button",
+ function() {
+ var name = tab6.arrItems[0].control.value;
+ try {
+ tab6.object.setName(name);
+ tab6.hide();
+ } catch(e) {
+
+ }
+ }
+ );
+
+ var tab7 = this.createTab(7, "Delete project", "p", true, this);
+ tab7.addItem(1, "Delete", document.createElement("input"), "button",
+ function() {
+ try {
+ tab7.object.Chart.deleteProject(tab7.object.Project.Id);
+ tab7.hide();
+ } catch(e) {
+
+ }
+ }
+ );
+
+ var tab8 = this.createTab(8, "Set % complete", "p", true, this);
+ tab8.addItem(1, "Percent Complete", document.createElement("input"), "text", function() {
+ tab8.arrItems[0].control.focus();
+ });
+ tab8.addItem(2, "Update", document.createElement("input"), "button",
+ function() {
+ var p = tab8.arrItems[0].control.value;
+ try {
+ if (tab8.object.setPercentCompleted(p)) tab8.hide();
+ } catch(e) {
+
+ }
+ }
+ );
+
+ var tab9 = this.createTab(9, "Add new task", "p", true, this);
+ tab9.addItem(1, "Id", document.createElement("input"), "text", function() {
+ tab9.arrItems[0].control.focus();
+ });
+ tab9.addItem(2, "Name", document.createElement("input"), "text", function() {
+ tab9.arrItems[1].control.focus();
+ });
+ tab9.addItem(3, "EST", document.createElement("input"), "text", function() {
+ tab9.arrItems[2].control.focus();
+ });
+ tab9.addItem(4, "Duration", document.createElement("input"), "text", function() {
+ tab9.arrItems[3].control.focus();
+ });
+ tab9.addItem(5, "Percent complete", document.createElement("input"), "text", function() {
+ tab9.arrItems[4].control.focus();
+ });
+ tab9.addItem(6, "Parent task id", document.createElement("input"), "text", function() {
+ tab9.arrItems[5].control.focus();
+ });
+ tab9.addItem(7, "Pred task id", document.createElement("input"), "text", function() {
+ tab9.arrItems[6].control.focus();
+ });
+
+ tab9.addItem(9, "Insert", document.createElement("input"), "button",
+ function() {
+ try {
+ var id = tab9.arrItems[0].control.value;
+ var name = tab9.arrItems[1].control.value;
+ var arr = tab9.arrItems[2].control.value.split(".");
+ var est = (arr.length < 3) ? null : (new Date(arr[2], parseInt(arr[1]) - 1, arr[0]));
+ var duration = tab9.arrItems[3].control.value;
+ var pc = tab9.arrItems[4].control.value;
+ var parentTaskId = tab9.arrItems[5].control.value;
+ var predTaskId = tab9.arrItems[6].control.value;
+ if (tab9.object.insertTask(id, name, est, duration, pc, predTaskId, parentTaskId)) tab9.hide();
+
+ } catch(e) {
+
+ }
+ }
+ );
+
+ var tab11 = this.createTab(11, "Add successor task", "t", true, this);
+ tab11.addItem(1, "Id", document.createElement("input"), "text", function() {
+ tab11.arrItems[0].control.focus();
+ });
+ tab11.addItem(2, "Name", document.createElement("input"), "text", function() {
+ tab11.arrItems[1].control.focus();
+ });
+ tab11.addItem(3, "EST", document.createElement("input"), "text", function() {
+ tab11.arrItems[2].control.focus();
+ });
+ tab11.addItem(4, "Duration", document.createElement("input"), "text", function() {
+ tab11.arrItems[3].control.focus();
+ });
+ tab11.addItem(5, "Percent complete", document.createElement("input"), "text", function() {
+ tab11.arrItems[4].control.focus();
+ });
+ tab11.addItem(6, "Insert", document.createElement("input"), "button",
+ function() {
+ try {
+ var pr = tab11.object.Project;
+ var id = tab11.arrItems[0].control.value;
+ var name = tab11.arrItems[1].control.value;
+ var arr = tab11.arrItems[2].control.value.split(".");
+ var est = (arr.length < 3) ? null : (new Date(arr[2], parseInt(arr[1]) - 1, arr[0]));
+ var duration = tab11.arrItems[3].control.value;
+ var pc = tab11.arrItems[4].control.value;
+ var parentTaskId = (tab11.object.parentTask == null) ? "" : tab11.object.parentTask.TaskInfo.Id;
+ var predTaskId = tab11.object.TaskInfo.Id;
+ if (pr.insertTask(id, name, est, duration, pc, predTaskId, parentTaskId)) tab11.hide();
+
+ } catch(e) {
+ //
+ }
+ }
+ );
+
+ var tab10 = this.createTab(10, "Add child task", "t", true, this);
+ tab10.addItem(1, "Id", document.createElement("input"), "text", function() {
+ tab10.arrItems[0].control.focus();
+ });
+ tab10.addItem(2, "Name", document.createElement("input"), "text", function() {
+ tab10.arrItems[1].control.focus();
+ });
+ tab10.addItem(3, "EST", document.createElement("input"), "text", function() {
+ tab10.arrItems[2].control.focus();
+ });
+ tab10.addItem(4, "Duration", document.createElement("input"), "text", function() {
+ tab10.arrItems[3].control.focus();
+ });
+ tab10.addItem(5, "Percent complete", document.createElement("input"), "text", function() {
+ tab10.arrItems[4].control.focus();
+ });
+ tab10.addItem(6, "Insert", document.createElement("input"), "button",
+ function() {
+ try {
+ var pr = tab10.object.Project;
+ var id = tab10.arrItems[0].control.value;
+ var name = tab10.arrItems[1].control.value;
+ var arr = tab10.arrItems[2].control.value.split(".");
+ var est = (arr.length < 3) ? null : (new Date(arr[2], parseInt(arr[1]) - 1, arr[0]));
+ var duration = tab10.arrItems[3].control.value;
+ var pc = tab10.arrItems[4].control.value;
+ var parentTaskId = tab10.object.TaskInfo.Id;
+ var predTaskId = "";
+ if (pr.insertTask(id, name, est, duration, pc, predTaskId, parentTaskId)) tab10.hide();
+
+ } catch(e) {
+ //
+ }
+ }
+ );
+
+ var tab12 = this.createTab(12, "-Insert new project-", "p", false, this);
+ tab12.addItem(1, "Id", document.createElement("input"), "text", function() {
+ tab12.arrItems[0].control.focus();
+ });
+ tab12.addItem(2, "Name", document.createElement("input"), "text", function() {
+ tab12.arrItems[1].control.focus();
+ });
+ tab12.addItem(3, "Start date", document.createElement("input"), "text", function() {
+ tab12.arrItems[2].control.focus();
+ });
+ tab12.addItem(4, "Insert", document.createElement("input"), "button",
+ function() {
+ try {
+
+ var id = tab12.arrItems[0].control.value;
+ var namePr = tab12.arrItems[1].control.value;
+ var arr = tab12.arrItems[2].control.value.split(".");
+ var startDatePr = (arr.length < 3) ? null : (new Date(arr[2], parseInt(arr[1]) - 1, arr[0]));
+ if (self.Chart.insertProject(id, namePr, startDatePr)) tab12.hide();
+
+ } catch(e) {
+
+ }
+ }
+ );
+};
+
+contextMenu.prototype.createHideDiv = function()
+{
+ this.hideDiv = document.createElement("div");
+ this.hideDiv.style.position = "absolute";
+ this.hideDiv.style.left = "0px";
+ this.hideDiv.style.top = "0px";
+ this.Chart.content.appendChild(this.hideDiv);
+ this.hideDiv.style.zIndex = 12;
+ this.hideDiv.style.display = "none";
+ this.hideDiv.style.background = "#7D7E7D";
+ this.hideDiv.style.cssText += ";-moz-opacity: 0.5;filter: alpha(opacity=50);opacity:.50;";
+ this.hideDiv.style.width = this.Chart.content.offsetWidth + 2 + "px";
+ this.hideDiv.style.height = this.Chart.content.offsetHeight + 2 + "px";
+
+};
+
+contextMenu.prototype.createMenuPanel = function()
+{
+ this.MenuPanel = document.createElement("div");
+ this.MenuPanel.style.visibility = "hidden";
+ this.MenuPanel.style.cssText += ";z-index:10;";
+ this.MenuPanel.style.position = "absolute";
+ this.Chart.content.appendChild(this.MenuPanel);
+ this.MenuPanel.innerHTML = "";
+ this.MenuPanel.firstChild.className = "contextMenu";
+
+ this.MenuPanel.firstChild.cellPadding = 0;
+ this.MenuPanel.firstChild.cellSpacing = 0;
+ this.MenuPanel.firstChild.style.cssText += ";background:url(" + this.Chart.imgs + "menu/menu_bg.png);";
+};
+contextMenu.prototype.createTabPanel = function()
+{
+ this.tabPanel = document.createElement("div");
+ this.tabPanel.style.visibility = "hidden";
+ this.tabPanel.style.zIndex = "30";
+ this.TabContainer.firstChild.rows[0].cells[0].appendChild(this.tabPanel);
+ this.tabPanel.style.width = "385px";
+ this.tabPanel.style.height = "290px";
+ this.tabPanel.innerHTML = "
";
+ this.tabPanel.firstChild.cellPadding = 0;
+ this.tabPanel.firstChild.cellSpacing = 0;
+ this.tabPanel.firstChild.style.cssText = "width:385px;border: 1px solid #808080;";
+ this.tabPanel.firstChild.rows[0].cells[0].style.cssText = ";height:26px;background:url(" + this.Chart.imgs + "/menu/window_tr.png);background-repeat: no-repeat;color:#fff;font-size:14px;font-weight: bold;font-family: Tahoma, Arial";
+ this.tabPanel.firstChild.rows[0].cells[0].align = "center";
+ this.tabPanel.firstChild.rows[1].cells[0].style.cssText = ";height:270px;background:#F7F7F7;";
+ this.tabPanel.firstChild.rows[1].cells[0].innerHTML = "";
+ this.tabPanel.firstChild.rows[1].cells[0].firstChild.style.cssText = "width:250px;font-size:11px;font-family:Tahoma,Arial;";
+ this.tabPanel.firstChild.rows[1].cells[0].align = "center";
+};
+
+contextMenu.prototype.addItemMenuPanel = function(tab)
+{
+ var self = this;
+ var row = this.MenuPanel.firstChild.insertRow(this.MenuPanel.firstChild.rows.length);
+ var cell = document.createElement('td');
+ cell.innerHTML = tab.Description;
+ cell.style.cssText = "padding-left:10px;height:18px;";
+
+ this.addEvent(cell, "mousedown", function() {
+ tab.show();
+ }, false);
+
+
+ cell.onmouseover = function() {
+ this.style.background = "url(" + self.Chart.imgs + "menu/menu_selection.png)";
+ };
+ cell.onmouseout = function() {
+ this.style.background = "";
+ };
+
+ row.appendChild(cell);
+};
+
+contextMenu.prototype.showContextMenu = function(x, y, object)
+{
+ if (object.constructor == GanttTask)
+ {
+ for (var i = 0; i < this.arrTabs.length; i++) {
+ if (this.arrTabs[i].type == "t")
+ {
+ this.arrTabs[i].object = object;
+ this.addItemMenuPanel(this.arrTabs[i]);
+ }
+ }
+ } else if (object.constructor == GanttProject)
+ {
+ for (var i = 0; i < this.arrTabs.length; i++) {
+ if (this.arrTabs[i].type == "p")
+ {
+ this.arrTabs[i].object = object;
+ this.addItemMenuPanel(this.arrTabs[i]);
+ }
+ }
+ }
+
+ this.isShow = true;
+ this.MenuPanel.style.cssText += ";z-index:15;";
+ this.MenuPanel.style.visibility = "visible";
+
+ this.MenuPanel.style.top = parseInt(y) + this.Chart.heightTaskItem - this.Chart.oData.scrollTop + 5 + "px";
+ this.MenuPanel.style.left = x;
+
+};
+contextMenu.prototype.hideContextMenu = function()
+{
+ this.isShow = false;
+ this.MenuPanel.style.visibility = "hidden";
+
+};
+contextMenu.prototype.clear = function()
+{
+ this.MenuPanel.removeChild(this.MenuPanel.firstChild);
+ this.MenuPanel.innerHTML = "
";
+ this.MenuPanel.firstChild.className = "contextMenu";
+ this.MenuPanel.firstChild.cellPadding = 0;
+ this.MenuPanel.firstChild.cellSpacing = 0;
+ this.MenuPanel.firstChild.style.cssText += ";background:url(" + this.Chart.imgs + "menu/menu_bg.png);";
+};
+contextMenu.prototype.createTab = function(id, desc, type, showOInfo, menu)
+{
+ var tab = new contextMenuTab(id, desc, type, showOInfo, menu);
+ this.arrTabs.push(tab);
+ return tab;
+};
+contextMenu.prototype.createTabContainer = function()
+{
+ this.TabContainer = document.createElement("div");
+ this.TabContainer.style.position = "absolute";
+ this.TabContainer.style.top = "0px";
+ this.TabContainer.style.left = "0px";
+ this.TabContainer.style.visibility = "hidden";
+ this.TabContainer.style.zIndex = "50";
+ this.Chart.content.appendChild(this.TabContainer);
+ this.TabContainer.innerHTML = "
";
+ this.TabContainer.firstChild.style.cssText = ";width:100%;height:100%;";
+ this.TabContainer.firstChild.rows[0].cells[0].align = "center";
+ this.TabContainer.style.width = this.Chart.content.offsetWidth + 2 + "px";
+ this.TabContainer.style.height = this.Chart.content.offsetHeight + 2 + "px";
+
+};
+
+contextMenu.prototype.getTabById = function(id)
+{
+ for (var i = 0; i < this.arrTabs.length; i++) {
+ if (this.arrTabs[i].Id == id) {
+ return this.arrTabs[i];
+ }
+ }
+ return null;
+};
+function contextMenuTab(id, description, type, showOInfo, contextMenu)
+{
+ this.Id = id;
+ this.arrItems = [];
+ this.TabItemContainer = null;
+ this.Description = description;
+ this.contextMenu = contextMenu;
+ this.type = type;
+ this.object = null;
+ this.showObjectInfo = showOInfo;
+
+}
+
+/**
+ * @desc: add event
+ * @param: elm - current element
+ * @param: evType - string that specifies any of the standard DHTML Events
+ * @param: fn - pointer that specifies the function to call when sEvent fires
+ * @type: private
+ * @topic: 5
+ */
+contextMenu.prototype.addEvent = function (elm, evType, fn, useCapture)
+{
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ return elm.attachEvent('on' + evType, fn);
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+};
+
+contextMenuTab.prototype.addItem = function(id, name, control, type, handler)
+{
+ if (handler) {
+ control.onclick = handler;
+ }
+ control.type = type;
+ if (type == "button")
+ {
+ control.value = name;
+ }
+ var tabItem = new contextMenuTabItem(id, name, control, this);
+ this.arrItems.push(tabItem);
+};
+
+contextMenuTab.prototype.show = function()
+{
+ this.contextMenu.hideDiv.style.display = "inline";
+ this.contextMenu.TabContainer.style.visibility = "visible";
+
+ var self = this;
+ this.contextMenu.tabPanel.firstChild.rows[0].cells[0].innerHTML = this.Description;
+ this.contextMenu.tabPanel.style.visibility = "visible";
+ var t = this.contextMenu.tabPanel.firstChild.rows[1].cells[0].firstChild;
+ var c,c2,r = null;
+
+ if (this.showObjectInfo)
+ {
+ if (this.object) {
+ if (this.object.constructor == GanttTask) {
+ this.insertData(t, "Id", this.object.TaskInfo.Id);
+ this.insertData(t, "Name", this.object.TaskInfo.Name);
+ this.insertData(t, "Duration", this.object.TaskInfo.Duration + " hrs");
+ this.insertData(t, "Percent complete", this.object.TaskInfo.PercentCompleted + "%");
+ this.insertData(t, "EST", this.object.TaskInfo.EST.getDate() + "." + (this.object.TaskInfo.EST.getMonth() + 1) + "." + this.object.TaskInfo.EST.getFullYear());
+ this.insertData(t, "Predecessor", this.object.TaskInfo.PredecessorTaskId);
+ } else
+ {
+ this.insertData(t, "Id", this.object.Project.Id);
+ this.insertData(t, "Name", this.object.Project.Name);
+ this.insertData(t, "Start date", this.object.Project.StartDate.getDate() + "." + (this.object.Project.StartDate.getMonth() + 1) + "." + this.object.Project.StartDate.getFullYear());
+ }
+ }
+ }
+
+ var btnCell = null;
+ for (var i = 0; i < this.arrItems.length; i++) {
+ if (this.arrItems[i].control.type == "button")
+ {
+ r = t.insertRow(t.rows.length);
+ c = r.insertCell(r.cells.length);
+ btnCell = r.insertCell(r.cells.length);
+ btnCell.appendChild(this.arrItems[i].control);
+
+ } else
+ {
+ r = t.insertRow(t.rows.length);
+ c = r.insertCell(r.cells.length);
+ c2 = r.insertCell(r.cells.length);
+ c.innerHTML = this.arrItems[i].Name;
+ c2.appendChild(this.arrItems[i].control);
+
+ }
+ }
+
+ var b = document.createElement("input");
+ b.type = "button";
+ b.value = "Cancel";
+ b.onclick = function()
+ {
+ self.hide();
+ };
+
+ if (!btnCell) {
+ r = t.insertRow(t.rows.length);
+ c = r.insertCell(r.cells.length);
+ btnCell = r.insertCell(r.cells.length);
+ } else {
+ b.style.marginLeft = "10px";
+ }
+ btnCell.appendChild(b);
+};
+contextMenuTab.prototype.hide = function()
+{
+ this.contextMenu.tabPanel.style.visibility = "hidden";
+ var t = this.contextMenu.tabPanel.firstChild.rows[1].cells[0].firstChild;
+ t.parentNode.removeChild(t);
+ this.contextMenu.tabPanel.firstChild.rows[1].cells[0].innerHTML = "";
+ this.contextMenu.tabPanel.firstChild.rows[1].cells[0].firstChild.style.cssText = "width:250px;font-size:11px;font-family:Tahoma,Arial;";
+
+ this.contextMenu.hideDiv.style.display = "none";
+ this.contextMenu.TabContainer.style.visibility = "hidden";
+};
+
+contextMenuTab.prototype.insertData = function(t, name, value)
+{
+ var c,c2,r = null;
+ r = t.insertRow(t.rows.length);
+ c = r.insertCell(r.cells.length);
+ c.style.cssText = "width:100px";
+ c.innerHTML = name;
+ c2 = r.insertCell(r.cells.length);
+ c2.innerHTML = value;
+
+};
+contextMenuTab.prototype.insertControl = function(t, name, value)
+{
+ var c,c2,r = null;
+ r = t.insertRow(t.rows.length);
+ c = r.insertCell(r.cells.length);
+ c.innerHTML = name;
+ c2 = r.insertCell(r.cells.length);
+ c2.appendChild(value);
+};
+
+function contextMenuTabItem(id, name, control, tab)
+{
+ this.Id = id;
+ this.Name = name;
+ this.control = control;
+ this.tab = tab;
+
+}
diff --git a/addons/base_gantt/static/src/gantt.js b/addons/base_gantt/static/src/gantt.js
new file mode 100644
index 00000000000..0e65fb48b5b
--- /dev/null
+++ b/addons/base_gantt/static/src/gantt.js
@@ -0,0 +1,227 @@
+/*---------------------------------------------------------
+ * OpenERP base_gantt
+ *---------------------------------------------------------*/
+
+openerp.base.gantt = function (openerp) {
+openerp.base.views.add('gantt', 'openerp.base.GanttView');
+openerp.base.GanttView = openerp.base.Controller.extend({
+
+ init: function(view_manager, session, element_id, dataset, view_id) {
+ this._super(session, element_id);
+ this.view_manager = view_manager;
+ this.dataset = dataset;
+ this.model = dataset.model;
+ this.view_id = view_id;
+ this.fields_views = {};
+ this.widgets = {};
+ this.widgets_counter = 0;
+ this.fields = {};
+ this.datarecord = {};
+ this.calendar_fields = {};
+ },
+ do_show: function () {
+ // TODO: re-trigger search
+ this.$element.show();
+ },
+ do_hide: function () {
+ this.$element.hide();
+ },
+ start: function() {
+ this.rpc("/base_gantt/ganttview/load", {"model": this.model, "view_id": this.view_id}, this.on_loaded);
+ },
+ on_loaded: function(data) {
+ this.fields_view = data.fields_view;
+ var self = this;
+ this.name = this.fields_view.name || this.fields_view.arch.attrs.string;
+ this.view_id = this.fields_view.view_id;
+
+ this.date_start = this.fields_view.arch.attrs.date_start;
+ this.date_delay = this.fields_view.arch.attrs.date_delay;
+ this.date_stop = this.fields_view.arch.attrs.date_stop;
+ this.color_field = this.fields_view.arch.attrs.color;
+
+ this.day_length = this.fields_view.arch.attrs.day_length || 8;
+ this.colors = this.fields_view.arch.attrs.colors;
+ this.fields = this.fields_view.fields;
+
+ this.text = this.fields_view.arch.children[0].children[0].attrs.name;
+ this.parent = this.fields_view.arch.children[0].attrs.link;
+
+ this.calendar_fields['parent'] = {'name': this.parent};
+ this.calendar_fields['date_start'] = {'name': this.date_start};
+ this.calendar_fields['text'] = {'name': this.text};
+ if(this.date_delay)
+ this.calendar_fields['date_delay'] = {'name': this.date_delay};
+ if(this.date_stop)
+ this.calendar_fields['date_stop'] = {'name': this.date_stop};
+
+ this.calendar_fields['day_length'] = this.day_length;
+ this.rpc('/base_gantt/ganttview/get_events',
+ {'model': this.model,
+ 'fields': this.fields,
+ 'color_field': this.color_field,
+ 'day_length': this.day_length,
+ 'calendar_fields': this.calendar_fields,
+ 'colors': this.colors,
+ 'info_fields': this.info_fields
+ },
+ function(res) {
+ self.create_gantt();
+ self.load_event(res);
+ })
+ this.$element.html(QWeb.render("GanttView", {"view": this, "fields_view": this.fields_view}));
+
+ },
+ convert_date_format: function(date) {
+ date=date+"";
+ if(typeof (date)!="string"||date.length===0){
+ return null;
+ }
+ var iso=date.split("-");
+ if(iso.length===0){
+ return null;
+ }
+ var day = iso[2];
+ var iso_hours = day.split(' ');
+
+ if (iso_hours.length > 1) {
+ day = iso_hours[0];
+ var iso_date_hours = iso_hours[1].split(':')
+ var new_date = new Date(iso[0], iso[1] - 1, day);
+ new_date.setHours(iso_date_hours[0]);
+ new_date.setMinutes(iso_date_hours[1]);
+ new_date.setSeconds(iso_date_hours[2]);
+ }
+ else {
+ var new_date = new Date(iso[0], iso[1] - 1, day);
+ }
+ new_date.setFullYear(iso[0]);
+ new_date.setMonth(iso[1]-1);
+ new_date.setDate(day);
+ return new_date;
+ },
+
+ create_gantt: function() {
+ ganttChartControl = new GanttChart();
+ ganttChartControl.setImagePath("/base_gantt/static/lib/dhtmlxGantt/codebase/imgs/");
+ ganttChartControl.setEditable(true);
+ ganttChartControl.showTreePanel(true);
+ ganttChartControl.showContextMenu(true);
+ ganttChartControl.showDescTask(true,'d,s-f');
+ ganttChartControl.showDescProject(true,'n,d');
+ },
+ load_event: function(res) {
+ var self = this
+ var result = res.result;
+ var sidebar = res.sidebar;
+ var project_id = new Array();
+ var project = new Array();
+ var j = -1;
+ var self = this;
+ for (i in result) {
+
+ var parent_id = result[i]['parent'][0];
+ var parent_name = result[i]['parent'][1];
+
+ if (jQuery.inArray(parent_id, project_id) == -1){
+ if (parent_id == undefined){
+ parent_name = "";
+ }
+ j = j + 1;
+ project[j] = new GanttProjectInfo(parent_id, parent_name, new Date(2011, 1, 1));
+ project_id[j] = parent_id;
+ }
+
+ var id = result[i]['id'];
+ var text = result[i]['text'];
+ var start_date = this.convert_date_format(result[i]['start_date']);
+ var duration = result[i]['duration'];
+
+ var task = new GanttTaskInfo(id, text, start_date, duration, 100, "");
+
+ k = project_id.indexOf(parent_id);
+ project[k].addTask(task);
+
+ }
+ for (i in project_id){
+ ganttChartControl.addProject(project[i]);
+ }
+ ganttChartControl.create("GanttDiv");
+ ganttChartControl.attachEvent("onTaskEndResize", function(task) {self.on_task_end_resize(task);})
+ ganttChartControl.attachEvent("onTaskEndDrag", function(task) {self.on_task_end_drag(task);})
+
+ //Create Sidebar
+ if (jQuery('#cal-sidebar-option').length == 0){
+ jQuery('#gantt-sidebar').append(
+ jQuery('
',{'width':'100%','cellspacing': 0, 'cellpadding': 0, 'id':'cal-sidebar-option'})
+ )
+ for(s in sidebar) {
+ jQuery('#cal-sidebar-option').append(
+ jQuery('
').append(
+ jQuery(' ').append(
+ jQuery('