diff --git a/htdocs/includes/jsgantt/jsgantt.css b/htdocs/includes/jsgantt/jsgantt.css index 78a7e83e971..7acf9318347 100644 --- a/htdocs/includes/jsgantt/jsgantt.css +++ b/htdocs/includes/jsgantt/jsgantt.css @@ -1,242 +1,53 @@ -/* Sample CSS for jsGanttImproved v1.7.3 */ -div.gantt { font-family:tahoma, arial, verdana, Sans-serif; font-size:10px; color: #2F2F2F; } -.gantt table { border-collapse: collapse; } -.gantt td { padding: 0px; } +// These are the class/styles used by various objects in GanttChart. However, Firefox has problems deciphering class style when DIVs are embedded in other DIVs. -/* cell defaults */ -.gmajorheading, -.gminorheading, -.gminorheadingwkend, -.gtaskcell, -.gtaskcellwkend { height: 19px; font-size: 12px; border: #efefef 1px solid; text-align: center; cursor: default } -.gtasklist { height: 19px; min-width: 5px; max-width: 5px; width: 5px; border: #efefef 1px solid; border-right: none; } /* all three width values set just to make sure - helps resizing code */ +// GanttChart makes heavy use of embedded DIVS, thus the style are often embedded directly in the objects html. If this could be resolved with Firefox, it would -/* Additional values for some cell elements */ -.gtaskheading, -.gmajorheading, -.gminorheading { background-color: #ffffff; font-weight: bold; font-size: 9px; white-space: nowrap; } -.gtaskcellwkend, -.gminorheadingwkend { background-color: #f7f7f7; font-weight: bold; font-size: 9px; white-space: nowrap; } -td.gtaskcell { text-align: left } -td.gspanning { border-left: none; border-right: none; } -.gtaskcelldiv { position: relative; } - -/* Task list defaults */ -.gtaskheading, -.gname, -.gtaskname, -.gresource, -.gduration, -.gpccomplete, -.gstartdate, -.genddate { height: 18px; white-space: nowrap; border: #efefef 1px solid; } - -/* Additional values for some task list elements */ -.gresource, -.gduration, -.gpccomplete, -.gstartdate div, /* needed for IE8 */ -.gstartdate { text-align: center; min-width: 70px; max-width: 70px; width: 70px; font-size: 10px; } -.genddate div, /* needed for IE8 */ -.genddate { text-align: center; min-width: 70px; max-width: 70px; width: 70px; font-size: 10px; } -.gtaskheading { text-align: center; } -.gtaskname div, /* needed for IE8 */ -.gtaskname { min-width: 170px; max-width: 170px; width: 170px;/* font-size: 9px;*/ border-left: none; } - -.gselector { text-align: left; white-space: nowrap; min-width: 170px; max-width: 170px; width: 170px; } - -.gformlabel { position:relative; top:0px; cursor:pointer; border: #ffffff 1px solid; margin-left: 2px; padding-left: 2px; padding-right: 2px; } -span.gformlabel:hover, -span.gselected { background-color: #dbecff; border: #cccccc 1px solid;} - -span.gfoldercollapse { color:#000000; cursor:pointer; font-weight:bold; font-size: 12px; font-family: Courier, "Courier New", monospace; } - -.gtasktableh, -.gtasktable { border-right: #efefef 1px solid; } -.gcharttable { border: #efefef 1px solid; } /* for some reason firefox needs this */ - -/* Differentiate Group, Milestone and Ordinary task items (applied to row) */ -.ggroupitem { background-color: #fbfbfb; font-weight: bold; } -.gmileitem, -.glineitem { background-color: #ffffff; } - -/* highlight row (applied to row) */ -.gitemhighlight td { background-image: none; background-color: #fffaaa;} - -/* task bar caption text styles */ -.gmilecaption, -.ggroupcaption, -.gcaption { font-weight: normal; font-size: 9px; text-align: left; white-space: nowrap; top:1px; position: absolute; top:2px; } - -.ggroupcaption, -.gcaption { right: -126px; } - -/* Task complete %age bar shared attributes */ -.gtaskcomplete { float:left; overflow: hidden; } - -/* Task complete %age bar */ -.gtaskcomplete { height:5px; background-color:#000000; margin-top:4px; opacity:0.4; filter: alpha(opacity=40); } - -/* Milestones */ -.gmilestone { font-size: 14px; position: absolute; top: -2px; } -.gmdtop { top: 2px; overflow: hidden; width:0px; height:0px; border-bottom: 5px solid black; border-left: 5px solid transparent; border-top: 5px solid transparent; border-right: 5px solid transparent;} -.gmdbottom { top: 2px; overflow: hidden; width:0px; height:0px; border-top: 5px solid black; border-left: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 5px solid transparent;} - -/* Task bar shared attributes */ -.ggroupblack, -.gtaskblue, -.gtaskred, -.gtaskgreen, -.gtaskyellow, -.gtaskpurple, -.gtaskpink { height: 13px; filter: alpha(opacity=90); opacity:0.9; margin-top: 1px; } - -/* Task bars - ggroupblack is set as the default class on the task if it is undefined */ -.ggroupblack { height: 7px; background: #000000; margin-top: 2px; } -.ggroupblackendpointleft { overflow: hidden; width:0px; height:0px; top: 2px; border-top: 4px solid black; border-left: 4px solid transparent; border-bottom: 4px solid transparent; border-right: 4px solid transparent; float: left; } -.ggroupblackendpointright { overflow: hidden; width:0px; height:0px; top: 2px; border-top: 4px solid black; border-left: 4px solid transparent; border-bottom: 4px solid transparent; border-right: 4px solid transparent; float: right; } -.ggroupblackcomplete { float:left; overflow: hidden; height:3px; filter: alpha(opacity=80); opacity:0.8; background-color:#777777; margin-top:2px; margin-bottom: 2px; } -.gtaskblue { - background: rgb(58,132,195); /* Old browsers */ - background: linear-gradient(to bottom, rgba(58,132,195,1) 0%,rgba(65,154,214,1) 20%,rgba(75,184,240,1) 40%,rgba(58,139,194,1) 70%,rgba(38,85,139,1) 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4bb8f0', endColorstr='#3a84c3',GradientType=0 ); /* IE6-9 */ -} -.gtaskred { - background: rgb(196,58,58); /* Old browsers */ - background: linear-gradient(to bottom, rgba(196,58,58,1) 0%,rgba(211,65,65,1) 20%,rgba(239,76,76,1) 40%,rgba(196,58,58,1) 70%,rgba(135,37,37,1) 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ef4c4c', endColorstr='#c43a3a',GradientType=0 ); /* IE6-9 */ -} -.gtaskgreen { - background: rgb(80,193,58); /* Old browsers */ - background: linear-gradient(to bottom, rgba(80,193,58,1) 0%,rgba(88,209,64,1) 20%,rgba(102,237,75,1) 40%,rgba(80,193,58,1) 70%,rgba(53,132,37,1) 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#66ED4B', endColorstr='#50c13a',GradientType=0 ); /* IE6-9 */ -} -.gtaskyellow { - background: rgb(247,228,56); /* Old browsers */ - background: linear-gradient(to bottom, rgba(247,228,56,1) 0%,rgba(239,239,55,1) 20%,rgba(255,255,58,1) 40%,rgba(242,236,55,1) 70%,rgba(241,218,54,1) 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffff3a', endColorstr='#f7e438',GradientType=0 ); /* IE6-9 */ -} -.gtaskpurple { - background: rgb(193,58,193); /* Old browsers */ - background: linear-gradient(to bottom, rgba(193,58,193,1) 0%,rgba(211,65,211,1) 20%,rgba(239,76,239,1) 40%,rgba(193,58,193,1) 70%,rgba(137,38,137,1) 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ef4cef', endColorstr='#892689',GradientType=0 ); /* IE6-9 */ -} -.gtaskpink { - background: rgb(249,177,245); /* Old browsers */ - background: linear-gradient(to bottom, rgba(249,177,245,1) 0%,rgba(247,192,243,1) 20%,rgba(247,202,244,1) 40%,rgba(249,192,246,1) 70%,rgba(252,174,247,1) 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7caf4', endColorstr='#fcaef7',GradientType=0 ); /* IE6-9 */ -} -.gtaskbluecomplete, -.gtaskredcomplete, -.gtaskgreencomplete, -.gtaskyellowcomplete, -.gtaskpurplecomplete, -.gtaskpinkcomplete { float:left; overflow: hidden; height:5px; filter: alpha(opacity=40); opacity:0.4; background-color: #000000; margin-top:4px; } - -/* Printer friendly styles - we could use these all the time but they are not as pretty! */ -/* note that "@media print" is not supported in IE6 or 7. Fully patched IE8 should be OK */ -@media print { - .ggroupblack { height:0px; border-top: 7px solid; border-color: #000000; } - .gtaskblue { height:0px; border-top: 13px solid; border-color: rgb(58,132,195); } - .gtaskred { height:0px; border-top: 13px solid; border-color: rgb(196,58,58); } - .gtaskgreen { height:0px; border-top: 13px solid; border-color: rgb(80,193,58); } - .gtaskyellow { height:0px; border-top: 13px solid; border-color: rgb(247,228,56); } - .gtaskpurple { height:0px; border-top: 13px solid; border-color: rgb(193,58,193); } - .gtaskpink { height:0px; border-top: 13px solid; border-color: rgb(249,177,245); } - - .gtaskbluecomplete, - .gtaskredcomplete, - .gtaskgreencomplete, - .gtaskyellowcomplete, - .gtaskpurplecomplete, - .gtaskpinkcomplete { height:0px; filter: alpha(opacity=40); opacity:0.4; margin-top: -9px; border-top: 5px solid; border-color: #000000; } - .ggroupblackcomplete { height: 0px; filter: alpha(opacity=80); opacity:0.8; margin-top:-5px; border-top:3px solid; border-color:#777777; } -} - -/* END Task bar styles */ -.glinev { border-left: 1px solid; width: 0px; } -.glineh { border-top: 1px solid; height: 0px; } - -.gDepFS, -.gDepSS, -.gDepSF, -.gDepFF { border-color: #26558b; } -.gDepFSArw, -.gDepSSArw { overflow: hidden; width:0px; height:0px; border-bottom: 4px solid transparent; border-left: 4px solid #26558b; border-top: 4px solid transparent; border-right: 4px solid transparent;} -.gDepFFArw, -.gDepSFArw { overflow: hidden; width:0px; height:0px; border-bottom: 4px solid transparent; border-left: 4px solid transparent; border-top: 4px solid transparent; border-right: 4px solid #26558b;} -.gCurDate { border-color: #0000ff; } +// make alot of the code look simpleer/cleaner without all the embedded styles -div.gtaskbarcontainer { z-index: 1; position: absolute; top: 0px } -.JSGanttToolTip {position: absolute; display: block; z-index: 2;} -.JSGanttToolTipcont {font-family: tahoma, arial, verdana; font-size: 10px; display: block; background: #ffffff; color: #656565} -.gTaskInfo {background: #dbecff; width: 400px; border: #656565 1px solid; border-radius: 10px; padding: 4px 6px 4px 6px; float: left;} -.gTtTitle {display: block; font-size: 12px; font-weight: bold; color: #404040; margin-left: 4px; margin-bottom: 1em;} -.gTaskLabel {font-size: 11px; font-weight: bold; color: #656565; margin-left: 4px;} -.gTaskText {position:absolute; left: 90px; padding-top: 1px; font-size: 10px; font-weight: normal; color: #656565;} -.gTaskNotes {font-size: 11px; font-weight: normal; color: #323232; padding: 0 15px; display: block;} -.gTIn {padding-top: 10px;} +..gantt { font-family:tahoma, arial, verdana; font-size:10px;} -.gantt { min-width: 1064px; /* 2x LC width */ } -.gchartcontainer { padding-left: 532px; /* LC width */ } -.gcontainercol { position: relative; float: left; } /* Add a max-height value here if wanted */ -.glistgrid { width: 532px; /* LC width */ margin-left: -100%; right: 532px; /* LC width */ padding-right: 0px; padding-left: 0px; padding-bottom: 0px; padding-top: 0px; background-color: #ffffff; overflow: hidden; } -.glistlbl { width: 532px; /* LC width */ margin-left: -100%; right: 532px; /* LC width */ padding-right: 0px; padding-left: 0px; padding-bottom: 0px; padding-top: 0px; background-color: #ffffff; overflow: hidden; } -.glabelfooter { clear: both; } -.ggridfooter { clear: both; } +..gdatehead { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; HEIGHT: 18px } -/*.rhscrpad { width: 150px; position: absolute; top: 0px; height: 1px; }*/ +..ghead { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 24px; HEIGHT: 20px } -.gchartgrid { width: 100%; padding-right: 0px; padding-left: 0px; padding-bottom: 0px; padding-top: 0px; background-color: #ffffff; position: relative; overflow: auto; min-height: 0%; } -.gchartlbl { width: 100%; padding-right: 0px; padding-left: 0px; padding-bottom: 0px; padding-top: 0px; background-color: #ffffff; position: relative; overflow: hidden; } +..gname { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; WIDTH: 18px; HEIGHT: 18px } -/* Old Internet Explorer version hacks */ -.gantt { _height: 100% } /* otherwise the chart disappears! */ -div .gantt { _width: 1064px; } /* ie6 fixed width */ -div.gchartlbl, -div.gchartgrid { _width: 532px; } /* ie6 fixed width */ -div.glistlbl, -div.glistgrid { - *right: 0px; /* ie7 pulls the content too far left with the negative margin */ - _right: 532px; /* but ie6 fixed width needs this */ - _margin-left: -532px; /* ie6 fixed width */ -} -div.gchartgrid { *padding-bottom: 20px; *overflow-y: hidden; } /* variable height design, no need for vertical scroll */ -td.gmajorheading div { *overflow: hidden; } /* stops resizing fixed width columns if the text is too wide */ -td.gspanning div { *overflow: hidden; } /* stops resizing fixed width columns if the text is too wide */ +..ghead A { FONT-SIZE: 10px; COLOR: #000000; TEXT-DECORATION: none } -/* border transparency tricks */ -.ggroupblackendpointleft { _border-top: 4px solid black; _border-left: 4px solid pink; _border-bottom: 4px solid pink; _border-right: 4px solid pink; _filter: chroma(color=pink); } -.ggroupblackendpointright { _border-top: 4px solid black; _border-left: 4px solid pink; _border-bottom: 4px solid pink; _border-right: 4px solid pink;_filter: chroma(color=pink); } +..gheadwkend A { FONT-SIZE: 10px; COLOR: #000000; TEXT-DECORATION: none } -.gmdtop { _border-left: 5px solid pink; _border-top: 5px solid pink; _border-right: 5px solid pink; _filter: chroma(color=pink);} -.gmdbottom { _border-left: 5px solid pink; _border-bottom: 5px solid pink; _border-right: 5px solid pink; _filter: chroma(color=pink);} +..gheadwkend { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 24px; HEIGHT: 20px; background-color: #cfcfcf } -.gDepFSArw, -.gDepSSArw { _border-bottom: 4px solid pink; _border-top: 4px solid pink; _border-right: 4px solid pink; _filter: chroma(color=pink);} -.gDepFFArw, -.gDepSFArw { _border-bottom: 4px solid pink; _border-left: 4px solid pink; _border-top: 4px solid pink; _filter: chroma(color=pink);} +..gfiller { BORDER-TOP: #efefef 1px solid; BORDER-LEFT: #efefef 1px solid; WIDTH: 18px; HEIGHT: 18px } -/* Workaround for odd bug in old versions of Opera - no other browser needs this */ -.glinediv {position: absolute; top: 0px; left: 0px;} +..gfillerwkend { BORDER-LEFT: #efefef 1px solid; WIDTH: 18px; HEIGHT: 18px; BACKGROUND-COLOR: #cfcfcf } + +..gitem { BORDER-TOP: #cccccc 1px solid; WIDTH: 18px; HEIGHT: 18px } + +..gitemwkend { BORDER-TOP: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; WIDTH: 18px; HEIGHT: 18px } + +..gmilestone { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 14px; OVERFLOW: hidden; BORDER-LEFT: #efefef 1px solid; WIDTH: 18px; HEIGHT: 18px} + +..gmilestonewkend { BORDER-TOP: #efefef 1px solid; BORDER-LEFT: #cccccc 1px solid; WIDTH: 18px; HEIGHT: 18px} + +..btn { BORDER-RIGHT: #ffffff; BORDER-TOP: #ffffff; FONT-WEIGHT: bold; FONT-SIZE: 10px; BORDER-LEFT: #ffffff; WIDTH: 12px; COLOR: #cccccc; BORDER-BOTTOM: #ffffff; BACKGROUND-COLOR: #ffffff } + +..hrcomplete { BORDER-RIGHT: #000000 2px solid; PADDING-RIGHT: 0px; BORDER-TOP: #000000 2px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; BORDER-LEFT: #000000 2px solid; WIDTH: 20px; COLOR: #000000; PADDING-TOP: 0px; BORDER-BOTTOM: #000000 2px solid; HEIGHT: 4px } + +..hrhalfcomplete { BORDER-RIGHT: #000000 2px solid; BORDER-TOP: #000000 2px solid; BORDER-LEFT: #000000 2px solid; WIDTH: 9px; COLOR: #000000; BORDER-BOTTOM: #000000 2px solid; HEIGHT: 4px } + +..gweekend { font-family:tahoma, arial, verdana; font-size:11px; background-color:#EEEEEE; text-align:center; } + +..gtask { font-family:tahoma, arial, verdana; font-size:11px; background-color:#00FF00; text-align:center; } + +..gday { font-family:tahoma, arial, verdana; font-size:11px; text-align:center; } + +..gcomplete { background-color:black; height:5px; overflow: auto; margin-top:4px; } + +DIV.scroll { BORDER-RIGHT: #efefef 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: #efefef 1px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; OVERFLOW: hidden; BORDER-LEFT: #efefef 1px solid; WIDTH: 420px; PADDING-TOP: 0px; BORDER-BOTTOM: #efefef 1px solid; BACKGROUND-COLOR: #ffffff } + +DIV.scroll2 { position:relative; PADDING-RIGHT: 0px; overflow:auto ;overflow-x:scroll;overflow-y:hidden; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; WIDTH: 482px; PADDING-TOP: 0px; BACKGROUND-COLOR: #ffffff } -/* if using setUseSingleCell(1) the following is a suggested set of CSS3 styles to recreate the table grid - won't work on old browsers -.ggrouphour td, -.gmilehour td, -.gitemhour td { background-size: 19px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 18px); width: 100%; height: 19px; } -.ggroupday td, -.gmileday td, -.gitemday td { background-size: 19px 1px, 133px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 18px), linear-gradient(to left, #f7f7f7 39px, transparent 1px, transparent 92px); width: 100%; height: 19px; } -.ggroupweek td, -.gmileweek td, -.gitemweek td { background-size: 37px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 36px); width: 100%; height: 19px; } -.ggroupmonth td, -.gmilemonth td, -.gitemmonth td { background-size: 37px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 36px); width: 100%; height: 19px; } -.ggroupquarter td, -.gmilequarter td, -.gitemquarter td { background-size: 19px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 18px); width: 100%; height: 19px; } -*/ diff --git a/htdocs/includes/jsgantt/jsgantt.js b/htdocs/includes/jsgantt/jsgantt.js index 3360d832ec6..2447a068bf7 100644 --- a/htdocs/includes/jsgantt/jsgantt.js +++ b/htdocs/includes/jsgantt/jsgantt.js @@ -1,2575 +1,2315 @@ /* - _ ___ _____ _ _____ ____ ____ - (_) / _ \ \_ \ / ||___ | ___| |___ \ - | |/ /_\/ / /\/ | | / /|___ \ __) | - | / /_\\/\/ /_ | |_ / /_ ___) | / __/ - _/ \____/\____/ |_(_)_/(_)____(_)_____| - |__/ - jsGanttImproved 1.7.5.2 - Copyright (c) 2013-2016, Paul Geldart All rights reserved. +Copyright (c) 2009, Shlomy Gantz BlueBrick Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of Shlomy Gantz or BlueBrick Inc. nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY SHLOMY GANTZ/BLUEBRICK INC. ''AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL SHLOMY GANTZ/BLUEBRICK INC. BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* LDR Modified to replace hard coded values by i18[key] +*/ - The current version of this code can be found at https://code.google.com/p/jsgantt-improved/ +/** +* JSGantt component is a UI control that displays gantt charts based by using CSS and HTML +* @module jsgantt +* @title JSGantt +*/ - * Copyright (c) 2013-2016, Paul Geldart. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Paul Geldart nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY PAUL GELDART. ''AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL PAUL GELDART BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +var JSGantt; if (!JSGantt) JSGantt = {}; - This project is based on jsGantt 1.2, (which can be obtained from - https://code.google.com/p/jsgantt/) and remains under the original BSD license. - The original project license follows: +var vTimeout = 0; +var vBenchTime = new Date().getTime(); - Copyright (c) 2009, Shlomy Gantz BlueBrick Inc. All rights reserved. +/** +* Creates a task (one row) in gantt object +* @class TaskItem +* @namespace JSGantt +* @constructor +* @for JSGantt - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Shlomy Gantz or BlueBrick Inc. nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY SHLOMY GANTZ/BLUEBRICK INC. ''AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL SHLOMY GANTZ/BLUEBRICK INC. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -var JSGantt; if (!JSGantt) JSGantt={}; - -var vBenchTime=new Date().getTime(); - -JSGantt.isIE=function () +* @param pID {Number} Task unique numeric ID +* @param pName {String} Task Name +* @param pStart {Date} Task start date/time (not required for pGroup=1 ) +* @param pEnd {Date} Task end date/time, you can set the end time to 12:00 to indicate half-day (not required for pGroup=1 ) +* @param pColor {String} Task bar RGB value +* @param pLink {String} Task URL, clicking on the task will redirect to this url. Leave empty if you do not with the Task also serve as a link +* @param pMile {Boolean} Determines whether task is a milestone (1=Yes,0=No) +* @param pRes {String} Resource to perform the task +* @param pComp {Number} Percent complete (Number between 0 and 100) +* @param pGroup {Boolean} +* @param pParent {Number} ID of the parent task +* @param pOpen {Boolean} +* @param pDepend {String} Comma seperated list of IDs this task depends on +* @param pCaption {String} Caption to be used instead of default caption (Resource). +* note : you should use setCaption("Caption") in order to display the caption +* @return void +*/ +JSGantt.TaskItem = function(pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption) { - if(typeof document.all!='undefined') - { - if ('pageXOffset' in window) return false; // give IE9 and above the benefit of the doubt! - else return true; - } - else return false; + +/** +* The name of the attribute. +* @property vID +* @type String +* @default pID +* @private +*/ +var vID = pID; + +/** +* @property vName +* @type String +* @default pName +* @private +*/ +var vName = pName; + +/** +* @property vStart +* @type Datetime +* @default new Date() +* @private +*/ +var vStart = new Date(); + +/** +* @property vEnd +* @type Datetime +* @default new Date() +* @private +*/ +var vEnd = new Date(); + +/** +* @property vColor +* @type String +* @default pColor +* @private +*/ +var vColor = pColor; + +/** +* @property vLink +* @type String +* @default pLink +* @private +*/ +var vLink = pLink; + +/** +* @property vMile +* @type Boolean +* @default pMile +* @private +*/ +var vMile = pMile; + +/** +* @property vRes +* @type String +* @default pRes +* @private +*/ +var vRes = pRes; + +/** +* @property vComp +* @type Number +* @default pComp +* @private +*/ +var vComp = pComp; + +/** +* @property vGroup +* @type Boolean +* @default pGroup +* @private +*/ +var vGroup = pGroup; + +/** +* @property vParent +* @type Number +* @default pParent +* @private +*/ +var vParent = pParent; + +/** +* @property vOpen +* @type Boolean +* @default pOpen +* @private +*/ +var vOpen = pOpen; + +/** +* @property vDepend +* @type String +* @default pDepend +* @private +*/ +var vDepend = pDepend; + +/** +* @property vCaption +* @type String +* @default pCaption +* @private +*/ +var vCaption = pCaption; + +/** +* @property vDuration +* @type Number +* @default '' +* @private +*/ +var vDuration = ''; + +/** +* @property vLevel +* @type Number +* @default 0 +* @private +*/ +var vLevel = 0; + +/** +* @property vNumKid +* @type Number +* @default 0 +* @private +*/ +var vNumKid = 0; + +/** +* @property vVisible +* @type Boolean +* @default 0 +* @private +*/ +var vVisible = 1; + var x1, y1, x2, y2; + + + if (vGroup != 1) + { + vStart = JSGantt.parseDateStr(pStart,g.getDateInputFormat()); + vEnd = JSGantt.parseDateStr(pEnd,g.getDateInputFormat()); + } +/** +* Returns task ID +* @method getID +* @return {Number} +*/ + this.getID = function(){ return vID }; +/** +* Returns task name +* @method getName +* @return {String} +*/ + this.getName = function(){ return vName }; +/** +* Returns task start date +* @method getStart +* @return {Datetime} +*/ + this.getStart = function(){ return vStart}; +/** +* Returns task end date +* @method getEnd +* @return {Datetime} +*/ this.getEnd = function(){ return vEnd }; + +/** +* Returns task bar color (i.e. 00FF00) +* @method getColor +* @return {String} +*/ this.getColor = function(){ return vColor}; + +/** +* Returns task URL (i.e. http://www.jsgantt.com) +* @method getLink +* @return {String} +*/ this.getLink = function(){ return vLink }; + +/** +* Returns whether task is a milestone (1=Yes,0=No) +* @method getMile +* @return {Boolean} +*/ this.getMile = function(){ return vMile }; + +/** +* Returns task dependencies as list of values (i.e. 123,122) +* @method getDepend +* @return {String} +*/ this.getDepend = function(){ if(vDepend) return vDepend; else return null }; + +/** +* Returns task caption (if it exists) +* @method getCaption +* @return {String} +*/ this.getCaption = function(){ if(vCaption) return vCaption; else return ''; }; + +/** +* Returns task resource name as string +* @method getResource +* @return {String} +*/ this.getResource = function(){ if(vRes) return vRes; else return ' '; }; + +/** +* Returns task completion percent as numeric value +* @method getCompVal +* @return {Boolean} +*/ this.getCompVal = function(){ if(vComp) return vComp; else return 0; }; + +/** +* Returns task completion percent as formatted string (##%) +* @method getCompStr +* @return {String} +*/ this.getCompStr = function(){ if(vComp) return vComp+'%'; else return ''; }; + +/** +* Returns task duration as a fortmatted string based on the current selected format +* @method getDuration +* @param vFormat {String} selected format (minute,hour,day,week,month) +* @return {String} +*/ this.getDuration = function(vFormat){ + if (vMile) + vDuration = '-'; + else if (vFormat=='hour') + { + tmpPer = Math.ceil((this.getEnd() - this.getStart()) / ( 60 * 60 * 1000) ); + if(tmpPer == 1) + vDuration = '1 '+i18n["sHour"]; + else + vDuration = tmpPer + ' '+i18n["sHours"]; + } + + else if (vFormat=='minute') + { + tmpPer = Math.ceil((this.getEnd() - this.getStart()) / ( 60 * 1000) ); + if(tmpPer == 1) + vDuration = '1 '+i18n["sMinute"]; + else + vDuration = tmpPer + ' '+i18n["sMinutes"]; + } + + else { //if(vFormat == 'day') { + tmpPer = Math.ceil((this.getEnd() - this.getStart()) / (24 * 60 * 60 * 1000) + 1); + if(tmpPer == 1) vDuration = '1 '+i18n["sDay"]; + else vDuration = tmpPer + ' '+i18n["sDays"]; + } + + //else if(vFormat == 'week') { + // tmpPer = ((this.getEnd() - this.getStart()) / (24 * 60 * 60 * 1000) + 1)/7; + // if(tmpPer == 1) vDuration = '1 Week'; + // else vDuration = tmpPer + ' Weeks'; + //} + + //else if(vFormat == 'month') { + // tmpPer = ((this.getEnd() - this.getStart()) / (24 * 60 * 60 * 1000) + 1)/30; + // if(tmpPer == 1) vDuration = '1 Month'; + // else vDuration = tmpPer + ' Months'; + //} + + //else if(vFormat == 'quater') { + // tmpPer = ((this.getEnd() - this.getStart()) / (24 * 60 * 60 * 1000) + 1)/120; + // if(tmpPer == 1) vDuration = '1 Qtr'; + // else vDuration = tmpPer + ' Qtrs'; + //} + return( vDuration ) + }; + +/** +* Returns task parent ID +* @method getParent +* @return {Number} +*/ this.getParent = function(){ return vParent }; + +/** +* Returns whether task is a group (1=Yes,0=No) +* @method getGroup +* @return {Number} +*/ this.getGroup = function(){ return vGroup }; + +/** +* Returns whether task is open (1=Yes,0=No) +* @method getOpen +* @return {Boolean} +*/ this.getOpen = function(){ return vOpen }; + +/** +* Returns task tree level (0,1,2,3...) +* @method getLevel +* @return {Boolean} +*/ this.getLevel = function(){ return vLevel }; + +/** +* Returns the number of child tasks +* @method getNumKids +* @return {Number} +*/ this.getNumKids = function(){ return vNumKid }; + /** +* Returns the X position of the left side of the task bar on the graph (right side) +* @method getStartX +* @return {Number} +*/ this.getStartX = function(){ return x1 }; + +/** +* Returns the Y position of the top of the task bar on the graph (right side) +* @method getStartY +* @return {Number} +*/ this.getStartY = function(){ return y1 }; + +/** +* Returns the X position of the right of the task bar on the graph (right side) +* @method getEndX +* @return {Int} +*/ this.getEndX = function(){ return x2 }; + +/** +* Returns the Y position of the bottom of the task bar on the graph (right side) +* @method getEndY +* @return {Number} +*/ this.getEndY = function(){ return y2 }; + +/** +* Returns whether task is visible (1=Yes,0=No) +* @method getVisible +* @return {Boolean} +*/ this.getVisible = function(){ return vVisible }; + +/** +* Set task dependencies +* @method setDepend +* @param pDepend {String} A comma delimited list of task IDs the current task depends on. +* @return {void} +*/ this.setDepend = function(pDepend){ vDepend = pDepend;}; + +/** +* Set task start date/time +* @method setStart +* @param pStart {Datetime} +* @return {void} +*/ this.setStart = function(pStart){ vStart = pStart;}; + +/** +* Set task end date/time +* @method setEnd +* @param pEnd {Datetime} +* @return {void} +*/ this.setEnd = function(pEnd) { vEnd = pEnd; }; + +/** +* Set task tree level (0,1,2,3...) +* @method setLevel +* @param pLevel {Number} +* @return {void} +*/ this.setLevel = function(pLevel){ vLevel = pLevel;}; + +/** +* Set Number of children for the task +* @method setNumKid +* @param pNumKid {Number} +* @return {void} +*/ this.setNumKid = function(pNumKid){ vNumKid = pNumKid;}; + +/** +* Set task completion percentage +* @method setCompVal +* @param pCompVal {Number} +* @return {void} +*/ this.setCompVal = function(pCompVal){ vComp = pCompVal;}; + +/** +* Set a task bar starting position (left) +* @method setStartX +* @param pX {Number} +* @return {void} +*/ this.setStartX = function(pX) {x1 = pX; }; + +/** +* Set a task bar starting position (top) +* @method setStartY +* @param pY {Number} +* @return {String} +*/ this.setStartY = function(pY) {y1 = pY; }; + +/** +* Set a task bar starting position (right) +* @method setEndX +* @param pX {Number} +* @return {String} +*/ this.setEndX = function(pX) {x2 = pX; }; + +/** +* Set a task bar starting position (bottom) +* @method setEndY +* @param pY {Number} +* @return {String} +*/ this.setEndY = function(pY) {y2 = pY; }; + +/** +* Set task open/closed +* @method setOpen +* @param pOpen {Boolean} +* @return {void} +*/ this.setOpen = function(pOpen) {vOpen = pOpen; }; + +/** +* Set task visibility +* @method setVisible +* @param pVisible {Boolean} +* @return {void} +*/ this.setVisible = function(pVisible) {vVisible = pVisible; }; + }; + + +/** +* Creates the gant chart. for example: -JSGantt.TaskItem=function(pID, pName, pStart, pEnd, pClass, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGantt) +
var g = new JSGantt.GanttChart('g',document.getElementById('GanttChartDIV'), 'day');
+ +var g = new JSGantt.GanttChart( - assign the gantt chart to a javascript variable called 'g' +'g' - the name of the variable that was just assigned (will be used later so that gantt object can reference itself) +document.getElementById('GanttChartDIV') - reference to the DIV that will hold the gantt chart +'day' - default format will be by day + +* +* @class GanttChart +* @param pGanttVar {String} the name of the gantt chart variable +* @param pDiv {String} reference to the DIV that will hold the gantt chart +* @param pFormat {String} default format (minute,hour,day,week,month,quarter) +* @return void +*/ + +JSGantt.GanttChart = function(pGanttVar, pDiv, pFormat) { +/** +* The name of the gantt chart variable +* @property vGanttVar +* @type String +* @default pGanttVar +* @private +*/ var vGanttVar = pGanttVar; +/** +* The name of the gantt chart DIV +* @property vDiv +* @type String +* @default pDiv +* @private +*/ var vDiv = pDiv; +/** +* Selected format (minute,hour,day,week,month) +* @property vFormat +* @type String +* @default pFormat +* @private +*/ var vFormat = pFormat; +/** +* Show resource column +* @property vShowRes +* @type Number +* @default 1 +* @private +*/ var vShowRes = 1; +/** +* Show duration column +* @property vShowDur +* @type Number +* @default 1 +* @private +*/ var vShowDur = 1; +/** +* Show percent complete column +* @property vShowComp +* @type Number +* @default 1 +* @private +*/ var vShowComp = 1; +/** +* Show start date column +* @property vShowStartDate +* @type Number +* @default 1 +* @private +*/ var vShowStartDate = 1; +/** +* Show end date column +* @property vShowEndDate +* @type Number +* @default 1 +* @private +*/ var vShowEndDate = 1; +/** +* Date input format +* @property vDateInputFormat +* @type String +* @default "mm/dd/yyyy" +* @private +*/var vDateInputFormat = "mm/dd/yyyy"; +/** +* Date display format +* @property vDateDisplayFormat +* @type String +* @default "mm/dd/yy" +* @private +*/var vDateDisplayFormat = "mm/dd/yy"; - var vID=parseInt(document.createTextNode(pID).data); - var vName=document.createTextNode(pName).data; - var vStart=new Date(0); - var vEnd=new Date(0); - var vGroupMinStart=null; - var vGroupMinEnd=null; - var vClass=document.createTextNode(pClass).data; - var vLink=document.createTextNode(pLink).data; - var vMile=parseInt(document.createTextNode(pMile).data); - var vRes=document.createTextNode(pRes).data; - var vComp=parseFloat(document.createTextNode(pComp).data); - var vGroup=parseInt(document.createTextNode(pGroup).data); - var vParent=document.createTextNode(pParent).data; - var vOpen=(vGroup==2)?1:parseInt(document.createTextNode(pOpen).data); - var vDepend=new Array(); - var vDependType=new Array(); - var vCaption=document.createTextNode(pCaption).data; - var vDuration=''; - var vLevel=0; - var vNumKid=0; - var vVisible=1; - var vSortIdx=0; - var vToDelete=false; - var x1, y1, x2, y2; - var vNotes; - var vParItem=null; - var vCellDiv=null; - var vGantt=(pGantt instanceof JSGantt.GanttChart)? pGantt : g; //hack for backwards compatibility - var vBarDiv=null; - var vTaskDiv=null; - var vListChildRow=null; - var vChildRow=null; - var vGroupSpan=null; + var vNumUnits = 0; + var vCaptionType; + var vDepId = 1; + var vTaskList = new Array(); + var vFormatArr = new Array("day","week","month","quarter"); + var vQuarterArr = new Array(1,1,1,2,2,2,3,3,3,4,4,4); + var vMonthDaysArr = new Array(31,28,31,30,31,30,31,31,30,31,30,31); + var vMonthArr = new Array(i18n["January"],i18n["February"],i18n["March"],i18n["April"],i18n["May"],i18n["June"],i18n["July"],i18n["August"],i18n["September"],i18n["October"],i18n["November"],i18n["December"]); - vNotes=document.createElement('span'); - vNotes.className='gTaskNotes'; - if (pNotes!=null) - { - vNotes.innerHTML=pNotes; - JSGantt.stripUnwanted(vNotes); - } + +/** +* Set current display format (minute/hour/day/week/month/quarter) +* Only the first 4 arguments are used, for example: +*
+* g.setFormatArr("day","week","month");
+*
+* will show 3 formatting options (day/week/month) at the bottom right of the gantt chart
+* @method setFormatArr
+* @return {void}
+*/ this.setFormatArr = function() {
+ vFormatArr = new Array();
+ for(var i = 0; i < arguments.length; i++) {vFormatArr[i] = arguments[i];}
+ if(vFormatArr.length>4){vFormatArr.length=4;}
+ };
+/**
+* Show/Hide resource column
+* @param pShow {Number} 1=Show,0=Hide
+* @method setShowRes
+* @return {void}
+*/ this.setShowRes = function(pShow) { vShowRes = pShow; };
+/**
+* Show/Hide duration column
+* @param pShow {Number} 1=Show,0=Hide
+* @method setShowDur
+* @return {void}
+*/ this.setShowDur = function(pShow) { vShowDur = pShow; };
+/**
+* Show/Hide completed column
+* @param pShow {Number} 1=Show,0=Hide
+* @method setShowComp
+* @return {void}
+*/ this.setShowComp = function(pShow) { vShowComp = pShow; };
+/**
+* Show/Hide start date column
+* @param pShow {Number} 1=Show,0=Hide
+* @method setShowStartDate
+* @return {void}
+*/ this.setShowStartDate = function(pShow) { vShowStartDate = pShow; };
+/**
+* Show/Hide end date column
+* @param pShow {Number} 1=Show,0=Hide
+* @method setShowEndDate
+* @return {void}
+*/ this.setShowEndDate = function(pShow) { vShowEndDate = pShow; };
+/**
+* Overall date input format
+* @param pShow {String} (mm/dd/yyyy,dd/mm/yyyy,yyyy-mm-dd)
+* @method setDateInputFormat
+* @return {void}
+*/ this.setDateInputFormat = function(pShow) { vDateInputFormat = pShow; };
+/**
+* Overall date display format
+* @param pShow {String} (mm/dd/yyyy,dd/mm/yyyy,yyyy-mm-dd)
+* @method setDateDisplayFormat
+* @return {void}
+*/ this.setDateDisplayFormat = function(pShow) { vDateDisplayFormat = pShow; };
+/**
+* Set gantt caption
+* @param pType {String}
+Caption-Displays a custom caption set in TaskItem
+Resource-Displays task resource
+Duration-Displays task duration
+Complete-Displays task percent complete
';
+
+ if(vShowRes !=1) vNameWidth+=vStatusWidth;
+ if(vShowDur !=1) vNameWidth+=vStatusWidth;
+ if(vShowComp!=1) vNameWidth+=vStatusWidth;
+ if(vShowStartDate!=1) vNameWidth+=vStatusWidth;
+ if(vShowEndDate!=1) vNameWidth+=vStatusWidth;
+
+ // DRAW the Left-side of the chart (names, resources, comp%)
+ vLeftTable =
+ '
| ';
+
+ vMainTable += vLeftTable;
// Draw the Chart Rows
- var vRightHeader=document.createDocumentFragment();
- vTmpDiv=this.newNode(vRightHeader, 'div', vDivId+'gcharthead', 'gchartlbl gcontainercol');
- this.setChartHead(vTmpDiv);
- vTmpTab=this.newNode(vTmpDiv, 'table', vDivId+'chartTableh', 'gcharttableh');
- vTmpTBody=this.newNode(vTmpTab, 'tbody');
- vTmpRow=this.newNode(vTmpTBody, 'tr');
+ vRightTable =
+ '' +
+ ' ' +
+ '
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||