mdoc 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. data/.rubocop.yml +2 -0
  2. data/README.md +134 -47
  3. data/bin/mdoc +11 -32
  4. data/lib/mdoc/document/kramdown.rb +25 -0
  5. data/lib/mdoc/document.rb +87 -0
  6. data/lib/mdoc/meta.rb +14 -0
  7. data/lib/mdoc/options.rb +104 -0
  8. data/lib/mdoc/pipeline.rb +59 -0
  9. data/lib/mdoc/processor/add_title.rb +15 -0
  10. data/lib/mdoc/processor/add_toc.rb +11 -0
  11. data/lib/mdoc/processor/smart_code_block.rb +37 -0
  12. data/lib/mdoc/processor.rb +21 -0
  13. data/lib/mdoc/version.rb +3 -4
  14. data/lib/mdoc/writer.rb +18 -0
  15. data/lib/mdoc.rb +143 -2
  16. data/mdoc.gemspec +19 -19
  17. data/spec/add_title_spec.rb +10 -0
  18. data/spec/add_toc_spec.rb +12 -0
  19. data/spec/document_spec.rb +34 -0
  20. data/spec/execute_spec.rb +12 -0
  21. data/spec/find_doc_type_spec.rb +14 -0
  22. data/spec/fixtures/README.md +135 -0
  23. data/spec/fixtures/config/mdoc_a.cnf +1 -0
  24. data/spec/fixtures/config/mdoc_b.cnf +1 -0
  25. data/spec/fixtures/executes/a +0 -0
  26. data/spec/fixtures/executes/b +0 -0
  27. data/spec/fixtures/executes/c +0 -0
  28. data/spec/fixtures/general.txt +10 -0
  29. data/spec/fixtures/multikeys.html +18 -0
  30. data/{examples → spec/fixtures}/multikeys.md +10 -8
  31. data/{examples → spec/fixtures}/original.md +10 -10
  32. data/{examples → spec/fixtures}/pandoc.md +7 -7
  33. data/spec/fixtures/process.test.md +11 -0
  34. data/spec/fixtures/templates/default.html.erb +0 -0
  35. data/spec/fixtures/templates/pandoc.html.erb +0 -0
  36. data/spec/get_class_spec.rb +35 -0
  37. data/spec/kramdown_spec.rb +10 -0
  38. data/spec/meta_spec.rb +6 -0
  39. data/spec/options_spec.rb +66 -0
  40. data/spec/pipeline_spec.rb +95 -0
  41. data/spec/smart_code_block_spec.rb +10 -0
  42. data/spec/spec_helper.rb +40 -7
  43. data/spec/tpl_out_spec.rb +19 -0
  44. data/templates/default.html.erb +17 -0
  45. metadata +63 -25
  46. data/ROADMAP +0 -24
  47. data/config/members.yml +0 -16
  48. data/docs/css/jsgantt.css +0 -53
  49. data/docs/gantt.html +0 -237
  50. data/docs/js/jsgantt.js +0 -1681
  51. data/lib/mdoc/convert.rb +0 -92
  52. data/lib/mdoc/parser.rb +0 -80
  53. data/spec/parser_spec.rb +0 -32
data/docs/js/jsgantt.js DELETED
@@ -1,1681 +0,0 @@
1
- /*
2
- _ ___ _ _ _ ____
3
- (_)___ / _ \__ _ _ __ | |_| |_ / | |___ \
4
- | / __| / /_\/ _` | '_ \| __| __| | | __) |
5
- | \__ \/ /_\\ (_| | | | | |_| |_ | |_ / __/
6
- _/ |___/\____/\__,_|_| |_|\__|\__| |_(_)_____|
7
- |__/
8
-
9
- Copyright (c) 2009, Shlomy Gantz BlueBrick Inc. All rights reserved.
10
-
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions are met:
14
- * * Redistributions of source code must retain the above copyright
15
- * notice, this list of conditions and the following disclaimer.
16
- * * Redistributions in binary form must reproduce the above copyright
17
- * notice, this list of conditions and the following disclaimer in the
18
- * documentation and/or other materials provided with the distribution.
19
- * * Neither the name of Shlomy Gantz or BlueBrick Inc. nor the
20
- * names of its contributors may be used to endorse or promote products
21
- * derived from this software without specific prior written permission.
22
- *
23
- * THIS SOFTWARE IS PROVIDED BY SHLOMY GANTZ/BLUEBRICK INC. ''AS IS'' AND ANY
24
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
- * DISCLAIMED. IN NO EVENT SHALL SHLOMY GANTZ/BLUEBRICK INC. BE LIABLE FOR ANY
27
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
- */
34
-
35
- var JSGantt; if (!JSGantt) JSGantt = {};
36
-
37
- var vTimeout = 0;
38
- var vBenchTime = new Date().getTime();
39
-
40
- JSGantt.isIE = function () {
41
-
42
- if(typeof document.all != 'undefined')
43
- return true;
44
- else
45
- return false;
46
- }
47
-
48
-
49
- JSGantt.TaskItem = function(pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption)
50
- {
51
-
52
- var vID = pID;
53
- var vName = pName;
54
- var vStart = new Date();
55
- var vEnd = new Date();
56
- var vColor = pColor;
57
- var vLink = pLink;
58
- var vMile = pMile;
59
- var vRes = pRes;
60
- var vComp = pComp;
61
- var vGroup = pGroup;
62
- var vParent = pParent;
63
- var vOpen = pOpen;
64
- var vDepend = pDepend;
65
- var vCaption = pCaption;
66
- var vDuration = '';
67
- var vLevel = 0;
68
- var vNumKid = 0;
69
- var vVisible = 1;
70
- var x1, y1, x2, y2;
71
-
72
- if (vGroup != 1)
73
- {
74
- vStart = JSGantt.parseDateStr(pStart,g.getDateInputFormat());
75
- vEnd = JSGantt.parseDateStr(pEnd,g.getDateInputFormat());
76
- }
77
-
78
- this.getID = function(){ return vID };
79
- this.getName = function(){ return vName };
80
- this.getStart = function(){ return vStart};
81
- this.getEnd = function(){ return vEnd };
82
- this.getColor = function(){ return vColor};
83
- this.getLink = function(){ return vLink };
84
- this.getMile = function(){ return vMile };
85
- this.getDepend = function(){ if(vDepend) return vDepend; else return null };
86
- this.getCaption = function(){ if(vCaption) return vCaption; else return ''; };
87
- this.getResource = function(){ if(vRes) return vRes; else return '&nbsp'; };
88
- this.getCompVal = function(){ if(vComp) return vComp; else return 0; };
89
- this.getCompStr = function(){ if(vComp) return vComp+'%'; else return ''; };
90
-
91
- this.getDuration = function(vFormat){
92
- if (vMile)
93
- vDuration = '-';
94
- else if (vFormat=='hour')
95
- {
96
- tmpPer = Math.ceil((this.getEnd() - this.getStart()) / ( 60 * 60 * 1000) );
97
- if(tmpPer == 1)
98
- vDuration = '1 Hour';
99
- else
100
- vDuration = tmpPer + ' Hours';
101
- }
102
-
103
- else if (vFormat=='minute')
104
- {
105
- tmpPer = Math.ceil((this.getEnd() - this.getStart()) / ( 60 * 1000) );
106
- if(tmpPer == 1)
107
- vDuration = '1 Minute';
108
- else
109
- vDuration = tmpPer + ' Minutes';
110
- }
111
-
112
- else { //if(vFormat == 'day') {
113
- tmpPer = Math.ceil((this.getEnd() - this.getStart()) / (24 * 60 * 60 * 1000) + 1);
114
- if(tmpPer == 1) vDuration = '1 Day';
115
- else vDuration = tmpPer + ' Days';
116
- }
117
-
118
- //else if(vFormat == 'week') {
119
- // tmpPer = ((this.getEnd() - this.getStart()) / (24 * 60 * 60 * 1000) + 1)/7;
120
- // if(tmpPer == 1) vDuration = '1 Week';
121
- // else vDuration = tmpPer + ' Weeks';
122
- //}
123
-
124
- //else if(vFormat == 'month') {
125
- // tmpPer = ((this.getEnd() - this.getStart()) / (24 * 60 * 60 * 1000) + 1)/30;
126
- // if(tmpPer == 1) vDuration = '1 Month';
127
- // else vDuration = tmpPer + ' Months';
128
- //}
129
-
130
- //else if(vFormat == 'quater') {
131
- // tmpPer = ((this.getEnd() - this.getStart()) / (24 * 60 * 60 * 1000) + 1)/120;
132
- // if(tmpPer == 1) vDuration = '1 Qtr';
133
- // else vDuration = tmpPer + ' Qtrs';
134
- //}
135
- return( vDuration )
136
- };
137
-
138
- this.getParent = function(){ return vParent };
139
- this.getGroup = function(){ return vGroup };
140
- this.getOpen = function(){ return vOpen };
141
- this.getLevel = function(){ return vLevel };
142
- this.getNumKids = function(){ return vNumKid };
143
- this.getStartX = function(){ return x1 };
144
- this.getStartY = function(){ return y1 };
145
- this.getEndX = function(){ return x2 };
146
- this.getEndY = function(){ return y2 };
147
- this.getVisible = function(){ return vVisible };
148
- this.setDepend = function(pDepend){ vDepend = pDepend;};
149
- this.setStart = function(pStart){ vStart = pStart;};
150
- this.setEnd = function(pEnd) { vEnd = pEnd; };
151
- this.setLevel = function(pLevel){ vLevel = pLevel;};
152
- this.setNumKid = function(pNumKid){ vNumKid = pNumKid;};
153
- this.setCompVal = function(pCompVal){ vComp = pCompVal;};
154
- this.setStartX = function(pX) {x1 = pX; };
155
- this.setStartY = function(pY) {y1 = pY; };
156
- this.setEndX = function(pX) {x2 = pX; };
157
- this.setEndY = function(pY) {y2 = pY; };
158
- this.setOpen = function(pOpen) {vOpen = pOpen; };
159
- this.setVisible = function(pVisible) {vVisible = pVisible; };
160
-
161
- }
162
-
163
-
164
- // function that loads the main gantt chart properties and functions
165
- // pDiv: (required) this is a DIV object created in HTML
166
- // pStart: UNUSED - future use to force minimum chart date
167
- // pEnd: UNUSED - future use to force maximum chart date
168
- // pWidth: UNUSED - future use to force chart width and cause objects to scale to fit within that width
169
- // pShowRes: UNUSED - future use to turn on/off display of resource names
170
- // pShowDur: UNUSED - future use to turn on/off display of task durations
171
- // pFormat: (required) - used to indicate whether chart should be drawn in "day", "week", "month", or "quarter" format
172
- // pCationType - what type of Caption to show: Caption, Resource, Duration, Complete
173
- JSGantt.GanttChart = function(pGanttVar, pDiv, pFormat)
174
- {
175
-
176
- var vGanttVar = pGanttVar;
177
- var vDiv = pDiv;
178
- var vFormat = pFormat;
179
- var vShowRes = 1;
180
- var vShowDur = 1;
181
- var vShowComp = 1;
182
- var vShowStartDate = 1;
183
- var vShowEndDate = 1;
184
- var vDateInputFormat = "mm/dd/yyyy";
185
- var vDateDisplayFormat = "mm/dd/yy";
186
- var vNumUnits = 0;
187
- var vCaptionType;
188
- var vDepId = 1;
189
- var vTaskList = new Array();
190
- var vFormatArr = new Array("day","week","month","quarter");
191
- var vQuarterArr = new Array(1,1,1,2,2,2,3,3,3,4,4,4);
192
- var vMonthDaysArr = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
193
- var vMonthArr = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
194
- this.setFormatArr = function() {
195
- vFormatArr = new Array();
196
- for(var i = 0; i < arguments.length; i++) {vFormatArr[i] = arguments[i];}
197
- if(vFormatArr.length>4){vFormatArr.length=4;}
198
- };
199
- this.setShowRes = function(pShow) { vShowRes = pShow; };
200
- this.setShowDur = function(pShow) { vShowDur = pShow; };
201
- this.setShowComp = function(pShow) { vShowComp = pShow; };
202
- this.setShowStartDate = function(pShow) { vShowStartDate = pShow; };
203
- this.setShowEndDate = function(pShow) { vShowEndDate = pShow; };
204
- this.setDateInputFormat = function(pShow) { vDateInputFormat = pShow; };
205
- this.setDateDisplayFormat = function(pShow) { vDateDisplayFormat = pShow; };
206
- this.setCaptionType = function(pType) { vCaptionType = pType };
207
- this.setFormat = function(pFormat){
208
- vFormat = pFormat;
209
- this.Draw();
210
- };
211
-
212
- this.getShowRes = function(){ return vShowRes };
213
- this.getShowDur = function(){ return vShowDur };
214
- this.getShowComp = function(){ return vShowComp };
215
- this.getShowStartDate = function(){ return vShowStartDate };
216
- this.getShowEndDate = function(){ return vShowEndDate };
217
- this.getDateInputFormat = function() { return vDateInputFormat };
218
- this.getDateDisplayFormat = function() { return vDateDisplayFormat };
219
- this.getCaptionType = function() { return vCaptionType };
220
- this.CalcTaskXY = function ()
221
- {
222
- var vList = this.getList();
223
- var vTaskDiv;
224
- var vParDiv;
225
- var vLeft, vTop, vHeight, vWidth;
226
-
227
- for(i = 0; i < vList.length; i++)
228
- {
229
- vID = vList[i].getID();
230
- vTaskDiv = document.getElementById("taskbar_"+vID);
231
- vBarDiv = document.getElementById("bardiv_"+vID);
232
- vParDiv = document.getElementById("childgrid_"+vID);
233
-
234
- if(vBarDiv) {
235
- vList[i].setStartX( vBarDiv.offsetLeft );
236
- vList[i].setStartY( vParDiv.offsetTop+vBarDiv.offsetTop+6 );
237
- vList[i].setEndX( vBarDiv.offsetLeft + vBarDiv.offsetWidth );
238
- vList[i].setEndY( vParDiv.offsetTop+vBarDiv.offsetTop+6 );
239
- }
240
- }
241
- }
242
-
243
- this.AddTaskItem = function(value)
244
- {
245
- vTaskList.push(value);
246
- }
247
-
248
- this.getList = function() { return vTaskList };
249
-
250
- this.clearDependencies = function()
251
- {
252
- var parent = document.getElementById('rightside');
253
- var depLine;
254
- var vMaxId = vDepId;
255
- for ( i=1; i<vMaxId; i++ ) {
256
- depLine = document.getElementById("line"+i);
257
- if (depLine) { parent.removeChild(depLine); }
258
- }
259
- vDepId = 1;
260
- }
261
-
262
-
263
- // sLine: Draw a straight line (colored one-pixel wide DIV), need to parameterize doc item
264
- this.sLine = function(x1,y1,x2,y2) {
265
-
266
- vLeft = Math.min(x1,x2);
267
- vTop = Math.min(y1,y2);
268
- vWid = Math.abs(x2-x1) + 1;
269
- vHgt = Math.abs(y2-y1) + 1;
270
-
271
- vDoc = document.getElementById('rightside');
272
-
273
- // retrieve DIV
274
- var oDiv = document.createElement('div');
275
-
276
- oDiv.id = "line"+vDepId++;
277
- oDiv.style.position = "absolute";
278
- oDiv.style.margin = "0px";
279
- oDiv.style.padding = "0px";
280
- oDiv.style.overflow = "hidden";
281
- oDiv.style.border = "0px";
282
-
283
- // set attributes
284
- oDiv.style.zIndex = 0;
285
- oDiv.style.backgroundColor = "red";
286
-
287
- oDiv.style.left = vLeft + "px";
288
- oDiv.style.top = vTop + "px";
289
- oDiv.style.width = vWid + "px";
290
- oDiv.style.height = vHgt + "px";
291
-
292
- oDiv.style.visibility = "visible";
293
-
294
- vDoc.appendChild(oDiv);
295
-
296
- }
297
-
298
-
299
- // dLine: Draw a diaganol line (calc line x,y paisrs and draw multiple one-by-one sLines)
300
- this.dLine = function(x1,y1,x2,y2) {
301
-
302
- var dx = x2 - x1;
303
- var dy = y2 - y1;
304
- var x = x1;
305
- var y = y1;
306
-
307
- var n = Math.max(Math.abs(dx),Math.abs(dy));
308
- dx = dx / n;
309
- dy = dy / n;
310
- for ( i = 0; i <= n; i++ )
311
- {
312
- vx = Math.round(x);
313
- vy = Math.round(y);
314
- this.sLine(vx,vy,vx,vy);
315
- x += dx;
316
- y += dy;
317
- }
318
-
319
- }
320
-
321
- this.drawDependency =function(x1,y1,x2,y2)
322
- {
323
- if(x1 + 10 < x2)
324
- {
325
- this.sLine(x1,y1,x1+4,y1);
326
- this.sLine(x1+4,y1,x1+4,y2);
327
- this.sLine(x1+4,y2,x2,y2);
328
- this.dLine(x2,y2,x2-3,y2-3);
329
- this.dLine(x2,y2,x2-3,y2+3);
330
- this.dLine(x2-1,y2,x2-3,y2-2);
331
- this.dLine(x2-1,y2,x2-3,y2+2);
332
- }
333
- else
334
- {
335
- this.sLine(x1,y1,x1+4,y1);
336
- this.sLine(x1+4,y1,x1+4,y2-10);
337
- this.sLine(x1+4,y2-10,x2-8,y2-10);
338
- this.sLine(x2-8,y2-10,x2-8,y2);
339
- this.sLine(x2-8,y2,x2,y2);
340
- this.dLine(x2,y2,x2-3,y2-3);
341
- this.dLine(x2,y2,x2-3,y2+3);
342
- this.dLine(x2-1,y2,x2-3,y2-2);
343
- this.dLine(x2-1,y2,x2-3,y2+2);
344
- }
345
- }
346
-
347
- this.DrawDependencies = function () {
348
-
349
- //First recalculate the x,y
350
- this.CalcTaskXY();
351
-
352
- this.clearDependencies();
353
-
354
- var vList = this.getList();
355
- for(var i = 0; i < vList.length; i++)
356
- {
357
-
358
- vDepend = vList[i].getDepend();
359
- if(vDepend) {
360
-
361
- var vDependStr = vDepend + '';
362
- var vDepList = vDependStr.split(',');
363
- var n = vDepList.length;
364
-
365
- for(var k=0;k<n;k++) {
366
- var vTask = this.getArrayLocationByID(vDepList[k]);
367
-
368
- if(vList[vTask].getVisible()==1)
369
- this.drawDependency(vList[vTask].getEndX(),vList[vTask].getEndY(),vList[i].getStartX()-1,vList[i].getStartY())
370
- }
371
- }
372
- }
373
- }
374
-
375
-
376
- this.getArrayLocationByID = function(pId) {
377
-
378
- var vList = this.getList();
379
- for(var i = 0; i < vList.length; i++)
380
- {
381
- if(vList[i].getID()==pId)
382
- return i;
383
- }
384
- }
385
-
386
-
387
- this.Draw = function()
388
- {
389
- var vMaxDate = new Date();
390
- var vMinDate = new Date();
391
- var vTmpDate = new Date();
392
- var vNxtDate = new Date();
393
- var vCurrDate = new Date();
394
- var vTaskLeft = 0;
395
- var vTaskRight = 0;
396
- var vNumCols = 0;
397
- var vID = 0;
398
- var vMainTable = "";
399
- var vLeftTable = "";
400
- var vRightTable = "";
401
- var vDateRowStr = "";
402
- var vItemRowStr = "";
403
- var vColWidth = 0;
404
- var vColUnit = 0;
405
- var vChartWidth = 0;
406
- var vNumDays = 0;
407
- var vDayWidth = 0;
408
- var vStr = "";
409
- var vNameWidth = 220;
410
- var vStatusWidth = 70;
411
- var vLeftWidth = 15 + 220 + 70 + 70 + 70 + 70 + 70;
412
-
413
- if(vTaskList.length > 0)
414
- {
415
-
416
- // Process all tasks preset parent date and completion %
417
- JSGantt.processRows(vTaskList, 0, -1, 1, 1);
418
-
419
- // get overall min/max dates plus padding
420
- vMinDate = JSGantt.getMinDate(vTaskList, vFormat);
421
- vMaxDate = JSGantt.getMaxDate(vTaskList, vFormat);
422
-
423
- // Calculate chart width variables. vColWidth can be altered manually to change each column width
424
- // May be smart to make this a parameter of GanttChart or set it based on existing pWidth parameter
425
- if(vFormat == 'day') {
426
- vColWidth = 18;
427
- vColUnit = 1;
428
- }
429
- else if(vFormat == 'week') {
430
- vColWidth = 37;
431
- vColUnit = 7;
432
- }
433
- else if(vFormat == 'month') {
434
- vColWidth = 37;
435
- vColUnit = 30;
436
- }
437
- else if(vFormat == 'quarter') {
438
- vColWidth = 60;
439
- vColUnit = 90;
440
- }
441
-
442
- else if(vFormat=='hour')
443
- {
444
- vColWidth = 18;
445
- vColUnit = 1;
446
- }
447
-
448
- else if(vFormat=='minute')
449
- {
450
- vColWidth = 18;
451
- vColUnit = 1;
452
- }
453
-
454
- vNumDays = (Date.parse(vMaxDate) - Date.parse(vMinDate)) / ( 24 * 60 * 60 * 1000);
455
- vNumUnits = vNumDays / vColUnit;
456
-
457
-
458
- vChartWidth = vNumUnits * vColWidth + 1;
459
- vDayWidth = (vColWidth / vColUnit) + (1/vColUnit);
460
-
461
- vMainTable =
462
- '<TABLE id=theTable cellSpacing=0 cellPadding=0 border=0><TBODY><TR>' +
463
- '<TD vAlign=top bgColor=#ffffff>';
464
-
465
- if(vShowRes !=1) vNameWidth+=vStatusWidth;
466
- if(vShowDur !=1) vNameWidth+=vStatusWidth;
467
- if(vShowComp!=1) vNameWidth+=vStatusWidth;
468
- if(vShowStartDate!=1) vNameWidth+=vStatusWidth;
469
- if(vShowEndDate!=1) vNameWidth+=vStatusWidth;
470
-
471
- // DRAW the Left-side of the chart (names, resources, comp%)
472
- vLeftTable =
473
- '<DIV class=scroll id=leftside style="width:' + vLeftWidth + 'px"><TABLE cellSpacing=0 cellPadding=0 border=0><TBODY>' +
474
- '<TR style="HEIGHT: 17px">' +
475
- ' <TD style="WIDTH: 15px; HEIGHT: 17px"></TD>' +
476
- ' <TD style="WIDTH: ' + vNameWidth + 'px; HEIGHT: 17px"><NOBR></NOBR></TD>';
477
-
478
- if(vShowRes ==1) vLeftTable += ' <TD style="WIDTH: ' + vStatusWidth + 'px; HEIGHT: 17px"></TD>' ;
479
- if(vShowDur ==1) vLeftTable += ' <TD style="WIDTH: ' + vStatusWidth + 'px; HEIGHT: 17px"></TD>' ;
480
- if(vShowComp==1) vLeftTable += ' <TD style="WIDTH: ' + vStatusWidth + 'px; HEIGHT: 17px"></TD>' ;
481
- if(vShowStartDate==1) vLeftTable += ' <TD style="WIDTH: ' + vStatusWidth + 'px; HEIGHT: 17px"></TD>' ;
482
- if(vShowEndDate==1) vLeftTable += ' <TD style="WIDTH: ' + vStatusWidth + 'px; HEIGHT: 17px"></TD>' ;
483
-
484
- vLeftTable +=
485
- '<TR style="HEIGHT: 20px">' +
486
- ' <TD style="BORDER-TOP: #efefef 1px solid; WIDTH: 15px; HEIGHT: 20px"></TD>' +
487
- ' <TD style="BORDER-TOP: #efefef 1px solid; WIDTH: ' + vNameWidth + 'px; HEIGHT: 20px"><NOBR></NOBR></TD>' ;
488
-
489
- if(vShowRes ==1) vLeftTable += ' <TD style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 60px; HEIGHT: 20px" align=center nowrap>Resource</TD>' ;
490
- if(vShowDur ==1) vLeftTable += ' <TD style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 60px; HEIGHT: 20px" align=center nowrap>Duration</TD>' ;
491
- if(vShowComp==1) vLeftTable += ' <TD style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 60px; HEIGHT: 20px" align=center nowrap>% Comp.</TD>' ;
492
- if(vShowStartDate==1) vLeftTable += ' <TD style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 60px; HEIGHT: 20px" align=center nowrap>Start Date</TD>' ;
493
- if(vShowEndDate==1) vLeftTable += ' <TD style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 60px; HEIGHT: 20px" align=center nowrap>End Date</TD>' ;
494
-
495
- vLeftTable += '</TR>';
496
-
497
- for(i = 0; i < vTaskList.length; i++)
498
- {
499
- if( vTaskList[i].getGroup()) {
500
- vBGColor = "f3f3f3";
501
- vRowType = "group";
502
- } else {
503
- vBGColor = "ffffff";
504
- vRowType = "row";
505
- }
506
-
507
- vID = vTaskList[i].getID();
508
-
509
- if(vTaskList[i].getVisible() == 0)
510
- vLeftTable += '<TR id=child_' + vID + ' bgcolor=#' + vBGColor + ' style="display:none" onMouseover=g.mouseOver(this,' + vID + ',"left","' + vRowType + '") onMouseout=g.mouseOut(this,' + vID + ',"left","' + vRowType + '")>' ;
511
- else
512
- vLeftTable += '<TR id=child_' + vID + ' bgcolor=#' + vBGColor + ' onMouseover=g.mouseOver(this,' + vID + ',"left","' + vRowType + '") onMouseout=g.mouseOut(this,' + vID + ',"left","' + vRowType + '")>' ;
513
-
514
- vLeftTable +=
515
- ' <TD class=gdatehead style="WIDTH: 15px; HEIGHT: 20px; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid;">&nbsp;</TD>' +
516
- ' <TD class=gname style="WIDTH: ' + vNameWidth + 'px; HEIGHT: 20px; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px;" nowrap><NOBR><span style="color: #aaaaaa">';
517
-
518
- for(j=1; j<vTaskList[i].getLevel(); j++) {
519
- vLeftTable += '&nbsp&nbsp&nbsp&nbsp';
520
- }
521
-
522
- vLeftTable += '</span>';
523
-
524
- if( vTaskList[i].getGroup()) {
525
- if( vTaskList[i].getOpen() == 1)
526
- vLeftTable += '<SPAN id="group_' + vID + '" style="color:#000000; cursor:pointer; font-weight:bold; FONT-SIZE: 12px;" onclick="JSGantt.folder(' + vID + ','+vGanttVar+');'+vGanttVar+'.DrawDependencies();">&ndash;</span><span style="color:#000000">&nbsp</SPAN>' ;
527
- else
528
- vLeftTable += '<SPAN id="group_' + vID + '" style="color:#000000; cursor:pointer; font-weight:bold; FONT-SIZE: 12px;" onclick="JSGantt.folder(' + vID + ','+vGanttVar+');'+vGanttVar+'.DrawDependencies();">+</span><span style="color:#000000">&nbsp</SPAN>' ;
529
-
530
- } else {
531
-
532
- vLeftTable += '<span style="color: #000000; font-weight:bold; FONT-SIZE: 12px;">&nbsp&nbsp&nbsp</span>';
533
- }
534
-
535
- vLeftTable +=
536
- '<span onclick=JSGantt.taskLink("' + vTaskList[i].getLink() + '",300,200); style="cursor:pointer"> ' + vTaskList[i].getName() + '</span></NOBR></TD>' ;
537
-
538
- if(vShowRes ==1) vLeftTable += ' <TD class=gname style="WIDTH: 60px; HEIGHT: 20px; TEXT-ALIGN: center; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid;" align=center><NOBR>' + vTaskList[i].getResource() + '</NOBR></TD>' ;
539
- if(vShowDur ==1) vLeftTable += ' <TD class=gname style="WIDTH: 60px; HEIGHT: 20px; TEXT-ALIGN: center; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid;" align=center><NOBR>' + vTaskList[i].getDuration(vFormat) + '</NOBR></TD>' ;
540
- if(vShowComp==1) vLeftTable += ' <TD class=gname style="WIDTH: 60px; HEIGHT: 20px; TEXT-ALIGN: center; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid;" align=center><NOBR>' + vTaskList[i].getCompStr() + '</NOBR></TD>' ;
541
- if(vShowStartDate==1) vLeftTable += ' <TD class=gname style="WIDTH: 60px; HEIGHT: 20px; TEXT-ALIGN: center; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid;" align=center><NOBR>' + JSGantt.formatDateStr( vTaskList[i].getStart(), vDateDisplayFormat) + '</NOBR></TD>' ;
542
- if(vShowEndDate==1) vLeftTable += ' <TD class=gname style="WIDTH: 60px; HEIGHT: 20px; TEXT-ALIGN: center; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid;" align=center><NOBR>' + JSGantt.formatDateStr( vTaskList[i].getEnd(), vDateDisplayFormat) + '</NOBR></TD>' ;
543
-
544
- vLeftTable += '</TR>';
545
-
546
- }
547
-
548
- // DRAW the date format selector at bottom left. Another potential GanttChart parameter to hide/show this selector
549
- vLeftTable += '</TD></TR>' +
550
- '<TR><TD border=1 colspan=5 align=left style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 11px; BORDER-LEFT: #efefef 1px solid; height=18px">&nbsp;&nbsp;Powered by <a href=http://www.jsgantt.com>jsGantt</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format:';
551
-
552
- if (vFormatArr.join().indexOf("minute")!=-1) {
553
- if (vFormat=='minute') vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" VALUE="minute" checked>Minute';
554
- else vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" onclick=JSGantt.changeFormat("minute",'+vGanttVar+'); VALUE="minute">Minute';
555
- }
556
-
557
- if (vFormatArr.join().indexOf("hour")!=-1) {
558
- if (vFormat=='hour') vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" VALUE="hour" checked>Hour';
559
- else vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" onclick=JSGantt.changeFormat("hour",'+vGanttVar+'); VALUE="hour">Hour';
560
- }
561
-
562
- if (vFormatArr.join().indexOf("day")!=-1) {
563
- if (vFormat=='day') vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" VALUE="day" checked>Day';
564
- else vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" onclick=JSGantt.changeFormat("day",'+vGanttVar+'); VALUE="day">Day';
565
- }
566
-
567
- if (vFormatArr.join().indexOf("week")!=-1) {
568
- if (vFormat=='week') vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" VALUE="week" checked>Week';
569
- else vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" onclick=JSGantt.changeFormat("week",'+vGanttVar+') VALUE="week">Week';
570
- }
571
-
572
- if (vFormatArr.join().indexOf("month")!=-1) {
573
- if (vFormat=='month') vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" VALUE="month" checked>Month';
574
- else vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" onclick=JSGantt.changeFormat("month",'+vGanttVar+') VALUE="month">Month';
575
- }
576
-
577
- if (vFormatArr.join().indexOf("quarter")!=-1) {
578
- if (vFormat=='quarter') vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" VALUE="quarter" checked>Quarter';
579
- else vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" onclick=JSGantt.changeFormat("quarter",'+vGanttVar+') VALUE="quarter">Quarter';
580
- }
581
-
582
- // vLeftTable += '<INPUT TYPE=RADIO NAME="other" VALUE="other" style="display:none"> .';
583
-
584
- vLeftTable += '</TD></TR></TBODY></TABLE></TD>';
585
-
586
- vMainTable += vLeftTable;
587
-
588
- // Draw the Chart Rows
589
- vRightTable =
590
- '<TD style="width: ' + vChartWidth + 'px;" vAlign=top bgColor=#ffffff>' +
591
- '<DIV class=scroll2 id=rightside>' +
592
- '<TABLE style="width: ' + vChartWidth + 'px;" cellSpacing=0 cellPadding=0 border=0>' +
593
- '<TBODY><TR style="HEIGHT: 18px">';
594
-
595
- vTmpDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate());
596
- vTmpDate.setHours(0);
597
- vTmpDate.setMinutes(0);
598
-
599
- // Major Date Header
600
- while(Date.parse(vTmpDate) <= Date.parse(vMaxDate))
601
- {
602
- vStr = vTmpDate.getFullYear() + '';
603
- vStr = vStr.substring(2,4);
604
-
605
-
606
- if(vFormat == 'minute')
607
- {
608
- vRightTable += '<td class=gdatehead style="FONT-SIZE: 12px; HEIGHT: 19px;" align=center colspan=60>' ;
609
- vRightTable += JSGantt.formatDateStr(vTmpDate, vDateDisplayFormat) + ' ' + vTmpDate.getHours() + ':00 -' + vTmpDate.getHours() + ':59 </td>';
610
- vTmpDate.setHours(vTmpDate.getHours()+1);
611
- }
612
-
613
- if(vFormat == 'hour')
614
- {
615
- vRightTable += '<td class=gdatehead style="FONT-SIZE: 12px; HEIGHT: 19px;" align=center colspan=24>' ;
616
- vRightTable += JSGantt.formatDateStr(vTmpDate, vDateDisplayFormat) + '</td>';
617
- vTmpDate.setDate(vTmpDate.getDate()+1);
618
- }
619
-
620
- if(vFormat == 'day')
621
- {
622
- vRightTable += '<td class=gdatehead style="FONT-SIZE: 12px; HEIGHT: 19px;" align=center colspan=7>' +
623
- JSGantt.formatDateStr(vTmpDate,vDateDisplayFormat.substring(0,5)) + ' - ';
624
- vTmpDate.setDate(vTmpDate.getDate()+6);
625
- vRightTable += JSGantt.formatDateStr(vTmpDate, vDateDisplayFormat) + '</td>';
626
- vTmpDate.setDate(vTmpDate.getDate()+1);
627
- }
628
- else if(vFormat == 'week')
629
- {
630
- vRightTable += '<td class=gdatehead align=center style="FONT-SIZE: 12px; HEIGHT: 19px;" width='+vColWidth+'px>`'+ vStr + '</td>';
631
- vTmpDate.setDate(vTmpDate.getDate()+7);
632
- }
633
- else if(vFormat == 'month')
634
- {
635
- vRightTable += '<td class=gdatehead align=center style="FONT-SIZE: 12px; HEIGHT: 19px;" width='+vColWidth+'px>`'+ vStr + '</td>';
636
- vTmpDate.setDate(vTmpDate.getDate() + 1);
637
- while(vTmpDate.getDate() > 1)
638
- {
639
- vTmpDate.setDate(vTmpDate.getDate() + 1);
640
- }
641
- }
642
- else if(vFormat == 'quarter')
643
- {
644
- vRightTable += '<td class=gdatehead align=center style="FONT-SIZE: 12px; HEIGHT: 19px;" width='+vColWidth+'px>`'+ vStr + '</td>';
645
- vTmpDate.setDate(vTmpDate.getDate() + 81);
646
- while(vTmpDate.getDate() > 1)
647
- {
648
- vTmpDate.setDate(vTmpDate.getDate() + 1);
649
- }
650
- }
651
-
652
- }
653
-
654
- vRightTable += '</TR><TR>';
655
-
656
- // Minor Date header and Cell Rows
657
- vTmpDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate());
658
- vNxtDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate());
659
- vNumCols = 0;
660
-
661
- while(Date.parse(vTmpDate) <= Date.parse(vMaxDate))
662
- {
663
- if (vFormat == 'minute')
664
- {
665
-
666
- if( vTmpDate.getMinutes() ==0 )
667
- vWeekdayColor = "ccccff";
668
- else
669
- vWeekdayColor = "ffffff";
670
-
671
-
672
- vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">' + vTmpDate.getMinutes() + '</div></td>';
673
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px; BORDER-LEFT: #efefef 1px solid; cursor: default;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
674
- vTmpDate.setMinutes(vTmpDate.getMinutes() + 1);
675
- }
676
-
677
- else if (vFormat == 'hour')
678
- {
679
-
680
- if( vTmpDate.getHours() ==0 )
681
- vWeekdayColor = "ccccff";
682
- else
683
- vWeekdayColor = "ffffff";
684
-
685
-
686
- vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">' + vTmpDate.getHours() + '</div></td>';
687
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; cursor: default;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
688
- vTmpDate.setHours(vTmpDate.getHours() + 1);
689
- }
690
-
691
- else if(vFormat == 'day' )
692
- {
693
- if( JSGantt.formatDateStr(vCurrDate,'mm/dd/yyyy') == JSGantt.formatDateStr(vTmpDate,'mm/dd/yyyy')) {
694
- vWeekdayColor = "ccccff";
695
- vWeekendColor = "9999ff";
696
- vWeekdayGColor = "bbbbff";
697
- vWeekendGColor = "8888ff";
698
- } else {
699
- vWeekdayColor = "ffffff";
700
- vWeekendColor = "cfcfcf";
701
- vWeekdayGColor = "f3f3f3";
702
- vWeekendGColor = "c3c3c3";
703
- }
704
-
705
- if(vTmpDate.getDay() % 6 == 0) {
706
- vDateRowStr += '<td class="gheadwkend" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekendColor + ' align=center><div style="width: '+vColWidth+'px">' + vTmpDate.getDate() + '</div></td>';
707
- vItemRowStr += '<td class="gheadwkend" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px;HEIGHT: 20px; BORDER-LEFT: #efefef 1px solid; cursor: default;" bgcolor=#' + vWeekendColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp</div></td>';
708
- }
709
- else {
710
- vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">' + vTmpDate.getDate() + '</div></td>';
711
- if( JSGantt.formatDateStr(vCurrDate,'mm/dd/yyyy') == JSGantt.formatDateStr(vTmpDate,'mm/dd/yyyy'))
712
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px; BORDER-LEFT: #efefef 1px solid; cursor: default;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
713
- else
714
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; cursor: default;" align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
715
- }
716
-
717
- vTmpDate.setDate(vTmpDate.getDate() + 1);
718
-
719
- }
720
-
721
- else if(vFormat == 'week')
722
- {
723
-
724
- vNxtDate.setDate(vNxtDate.getDate() + 7);
725
-
726
- if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate )
727
- vWeekdayColor = "ccccff";
728
- else
729
- vWeekdayColor = "ffffff";
730
-
731
- if(vNxtDate <= vMaxDate) {
732
- vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center width:'+vColWidth+'px><div style="width: '+vColWidth+'px">' + (vTmpDate.getMonth()+1) + '/' + vTmpDate.getDate() + '</div></td>';
733
- if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate )
734
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
735
- else
736
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid;" align=center><div style="width:'+ vColWidth +'px">&nbsp&nbsp</div></td>';
737
-
738
- } else {
739
- vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid; bgcolor=#' + vWeekdayColor + ' BORDER-RIGHT: #efefef 1px solid;" align=center width:'+vColWidth+'px><div style="width: '+vColWidth+'px">' + (vTmpDate.getMonth()+1) + '/' + vTmpDate.getDate() + '</div></td>';
740
- if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate )
741
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
742
- else
743
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
744
-
745
- }
746
-
747
- vTmpDate.setDate(vTmpDate.getDate() + 7);
748
-
749
- }
750
-
751
- else if(vFormat == 'month')
752
- {
753
-
754
- vNxtDate.setFullYear(vTmpDate.getFullYear(), vTmpDate.getMonth(), vMonthDaysArr[vTmpDate.getMonth()]);
755
- if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate )
756
- vWeekdayColor = "ccccff";
757
- else
758
- vWeekdayColor = "ffffff";
759
-
760
- if(vNxtDate <= vMaxDate) {
761
- vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center width:'+vColWidth+'px><div style="width: '+vColWidth+'px">' + vMonthArr[vTmpDate.getMonth()].substr(0,3) + '</div></td>';
762
- if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate )
763
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
764
- else
765
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid;" align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
766
- } else {
767
- vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center width:'+vColWidth+'px><div style="width: '+vColWidth+'px">' + vMonthArr[vTmpDate.getMonth()].substr(0,3) + '</div></td>';
768
- if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate )
769
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
770
- else
771
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
772
- }
773
-
774
- vTmpDate.setDate(vTmpDate.getDate() + 1);
775
-
776
- while(vTmpDate.getDate() > 1)
777
- {
778
- vTmpDate.setDate(vTmpDate.getDate() + 1);
779
- }
780
-
781
- }
782
-
783
- else if(vFormat == 'quarter')
784
- {
785
-
786
- vNxtDate.setDate(vNxtDate.getDate() + 122);
787
- if( vTmpDate.getMonth()==0 || vTmpDate.getMonth()==1 || vTmpDate.getMonth()==2 )
788
- vNxtDate.setFullYear(vTmpDate.getFullYear(), 2, 31);
789
- else if( vTmpDate.getMonth()==3 || vTmpDate.getMonth()==4 || vTmpDate.getMonth()==5 )
790
- vNxtDate.setFullYear(vTmpDate.getFullYear(), 5, 30);
791
- else if( vTmpDate.getMonth()==6 || vTmpDate.getMonth()==7 || vTmpDate.getMonth()==8 )
792
- vNxtDate.setFullYear(vTmpDate.getFullYear(), 8, 30);
793
- else if( vTmpDate.getMonth()==9 || vTmpDate.getMonth()==10 || vTmpDate.getMonth()==11 )
794
- vNxtDate.setFullYear(vTmpDate.getFullYear(), 11, 31);
795
-
796
- if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate )
797
- vWeekdayColor = "ccccff";
798
- else
799
- vWeekdayColor = "ffffff";
800
-
801
- if(vNxtDate <= vMaxDate) {
802
- vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center width:'+vColWidth+'px><div style="width: '+vColWidth+'px">Qtr. ' + vQuarterArr[vTmpDate.getMonth()] + '</div></td>';
803
- if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate )
804
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
805
- else
806
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px;HEIGHT: 20px; BORDER-LEFT: #efefef 1px solid;" align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
807
- } else {
808
- vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center width:'+vColWidth+'px><div style="width: '+vColWidth+'px">Qtr. ' + vQuarterArr[vTmpDate.getMonth()] + '</div></td>';
809
- if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate )
810
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
811
- else
812
- vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';
813
- }
814
-
815
- vTmpDate.setDate(vTmpDate.getDate() + 81);
816
-
817
- while(vTmpDate.getDate() > 1)
818
- {
819
- vTmpDate.setDate(vTmpDate.getDate() + 1);
820
- }
821
-
822
- }
823
- }
824
-
825
- vRightTable += vDateRowStr + '</TR>';
826
- vRightTable += '</TBODY></TABLE>';
827
-
828
- // Draw each row
829
-
830
- for(i = 0; i < vTaskList.length; i++)
831
-
832
- {
833
-
834
- vTmpDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate());
835
- vTaskStart = vTaskList[i].getStart();
836
- vTaskEnd = vTaskList[i].getEnd();
837
-
838
- vNumCols = 0;
839
- vID = vTaskList[i].getID();
840
-
841
- // vNumUnits = Math.ceil((vTaskList[i].getEnd() - vTaskList[i].getStart()) / (24 * 60 * 60 * 1000)) + 1;
842
- vNumUnits = (vTaskList[i].getEnd() - vTaskList[i].getStart()) / (24 * 60 * 60 * 1000) + 1;
843
- if (vFormat=='hour')
844
- {
845
- vNumUnits = (vTaskList[i].getEnd() - vTaskList[i].getStart()) / ( 60 * 1000) + 1;
846
- }
847
- else if (vFormat=='minute')
848
- {
849
- vNumUnits = (vTaskList[i].getEnd() - vTaskList[i].getStart()) / ( 60 * 1000) + 1;
850
- }
851
-
852
- if(vTaskList[i].getVisible() == 0)
853
- vRightTable += '<DIV id=childgrid_' + vID + ' style="position:relative; display:none;">';
854
- else
855
- vRightTable += '<DIV id=childgrid_' + vID + ' style="position:relative">';
856
-
857
- if( vTaskList[i].getMile()) {
858
-
859
- vRightTable += '<DIV><TABLE style="position:relative; top:0px; width: ' + vChartWidth + 'px;" cellSpacing=0 cellPadding=0 border=0>' +
860
- '<TR id=childrow_' + vID + ' class=yesdisplay style="HEIGHT: 20px" onMouseover=g.mouseOver(this,' + vID + ',"right","mile") onMouseout=g.mouseOut(this,' + vID + ',"right","mile")>' + vItemRowStr + '</TR></TABLE></DIV>';
861
-
862
- // Build date string for Title
863
- vDateRowStr = JSGantt.formatDateStr(vTaskStart,vDateDisplayFormat);
864
-
865
- vTaskLeft = (Date.parse(vTaskList[i].getStart()) - Date.parse(vMinDate)) / (24 * 60 * 60 * 1000);
866
- vTaskRight = 1
867
-
868
- vRightTable +=
869
- '<div id=bardiv_' + vID + ' style="position:absolute; top:0px; left:' + Math.ceil((vTaskLeft * (vDayWidth) + 1)) + 'px; height: 18px; width:160px; overflow:hidden;">' +
870
- ' <div id=taskbar_' + vID + ' title="' + vTaskList[i].getName() + ': ' + vDateRowStr + '" style="height: 16px; width:12px; overflow:hidden; cursor: pointer;" onclick=JSGantt.taskLink("' + vTaskList[i].getLink() + '",300,200);>';
871
-
872
- if(vTaskList[i].getCompVal() < 100)
873
- vRightTable += '&loz;</div>' ;
874
- else
875
- vRightTable += '&diams;</div>' ;
876
-
877
- if( g.getCaptionType() ) {
878
- vCaptionStr = '';
879
- switch( g.getCaptionType() ) {
880
- case 'Caption': vCaptionStr = vTaskList[i].getCaption(); break;
881
- case 'Resource': vCaptionStr = vTaskList[i].getResource(); break;
882
- case 'Duration': vCaptionStr = vTaskList[i].getDuration(vFormat); break;
883
- case 'Complete': vCaptionStr = vTaskList[i].getCompStr(); break;
884
- }
885
- //vRightTable += '<div style="FONT-SIZE:12px; position:absolute; left: 6px; top:1px;">' + vCaptionStr + '</div>';
886
- vRightTable += '<div style="FONT-SIZE:12px; position:absolute; top:2px; width:120px; left:12px">' + vCaptionStr + '</div>';
887
- }
888
-
889
- vRightTable += '</div>';
890
-
891
-
892
- } else {
893
-
894
- // Build date string for Title
895
- vDateRowStr = JSGantt.formatDateStr(vTaskStart,vDateDisplayFormat) + ' - ' + JSGantt.formatDateStr(vTaskEnd,vDateDisplayFormat)
896
-
897
- if (vFormat=='minute')
898
- {
899
- vTaskRight = (Date.parse(vTaskList[i].getEnd()) - Date.parse(vTaskList[i].getStart())) / ( 60 * 1000) + 1/vColUnit;
900
- vTaskLeft = Math.ceil((Date.parse(vTaskList[i].getStart()) - Date.parse(vMinDate)) / ( 60 * 1000));
901
- }
902
- else if (vFormat=='hour')
903
- {
904
- vTaskRight = (Date.parse(vTaskList[i].getEnd()) - Date.parse(vTaskList[i].getStart())) / ( 60 * 60 * 1000) + 1/vColUnit;
905
- vTaskLeft = (Date.parse(vTaskList[i].getStart()) - Date.parse(vMinDate)) / ( 60 * 60 * 1000);
906
- }
907
- else
908
- {
909
- vTaskRight = (Date.parse(vTaskList[i].getEnd()) - Date.parse(vTaskList[i].getStart())) / (24 * 60 * 60 * 1000) + 1/vColUnit;
910
- vTaskLeft = Math.ceil((Date.parse(vTaskList[i].getStart()) - Date.parse(vMinDate)) / (24 * 60 * 60 * 1000));
911
- if (vFormat='day')
912
- {
913
- var tTime=new Date();
914
- tTime.setTime(Date.parse(vTaskList[i].getStart()));
915
- if (tTime.getMinutes() > 29)
916
- vTaskLeft+=.5
917
- }
918
- }
919
-
920
- // Draw Group Bar which has outer div with inner group div and several small divs to left and right to create angled-end indicators
921
- if( vTaskList[i].getGroup()) {
922
- vRightTable += '<DIV><TABLE style="position:relative; top:0px; width: ' + vChartWidth + 'px;" cellSpacing=0 cellPadding=0 border=0>' +
923
- '<TR id=childrow_' + vID + ' class=yesdisplay style="HEIGHT: 20px" bgColor=#f3f3f3 onMouseover=g.mouseOver(this,' + vID + ',"right","group") onMouseout=g.mouseOut(this,' + vID + ',"right","group")>' + vItemRowStr + '</TR></TABLE></DIV>';
924
- vRightTable +=
925
- '<div id=bardiv_' + vID + ' style="position:absolute; top:5px; left:' + Math.ceil(vTaskLeft * (vDayWidth) + 1) + 'px; height: 7px; width:' + Math.ceil((vTaskRight) * (vDayWidth) - 1) + 'px">' +
926
- '<div id=taskbar_' + vID + ' title="' + vTaskList[i].getName() + ': ' + vDateRowStr + '" class=gtask style="background-color:#000000; height: 7px; width:' + Math.ceil((vTaskRight) * (vDayWidth) -1) + 'px; cursor: pointer;opacity:0.9;">' +
927
- '<div style="Z-INDEX: -4; float:left; background-color:#666666; height:3px; overflow: hidden; margin-top:1px; ' +
928
- 'margin-left:1px; margin-right:1px; filter: alpha(opacity=80); opacity:0.8; width:' + vTaskList[i].getCompStr() + '; ' +
929
- 'cursor: pointer;" onclick=JSGantt.taskLink("' + vTaskList[i].getLink() + '",300,200);>' +
930
- '</div>' +
931
- '</div>' +
932
- '<div style="Z-INDEX: -4; float:left; background-color:#000000; height:4px; overflow: hidden; width:1px;"></div>' +
933
- '<div style="Z-INDEX: -4; float:right; background-color:#000000; height:4px; overflow: hidden; width:1px;"></div>' +
934
- '<div style="Z-INDEX: -4; float:left; background-color:#000000; height:3px; overflow: hidden; width:1px;"></div>' +
935
- '<div style="Z-INDEX: -4; float:right; background-color:#000000; height:3px; overflow: hidden; width:1px;"></div>' +
936
- '<div style="Z-INDEX: -4; float:left; background-color:#000000; height:2px; overflow: hidden; width:1px;"></div>' +
937
- '<div style="Z-INDEX: -4; float:right; background-color:#000000; height:2px; overflow: hidden; width:1px;"></div>' +
938
- '<div style="Z-INDEX: -4; float:left; background-color:#000000; height:1px; overflow: hidden; width:1px;"></div>' +
939
- '<div style="Z-INDEX: -4; float:right; background-color:#000000; height:1px; overflow: hidden; width:1px;"></div>' ;
940
-
941
- if( g.getCaptionType() ) {
942
- vCaptionStr = '';
943
- switch( g.getCaptionType() ) {
944
- case 'Caption': vCaptionStr = vTaskList[i].getCaption(); break;
945
- case 'Resource': vCaptionStr = vTaskList[i].getResource(); break;
946
- case 'Duration': vCaptionStr = vTaskList[i].getDuration(vFormat); break;
947
- case 'Complete': vCaptionStr = vTaskList[i].getCompStr(); break;
948
- }
949
- //vRightTable += '<div style="FONT-SIZE:12px; position:absolute; left: 6px; top:1px;">' + vCaptionStr + '</div>';
950
- vRightTable += '<div style="FONT-SIZE:12px; position:absolute; top:-3px; width:120px; left:' + (Math.ceil((vTaskRight) * (vDayWidth) - 1) + 6) + 'px">' + vCaptionStr + '</div>';
951
- }
952
-
953
- vRightTable += '</div>' ;
954
-
955
- } else {
956
-
957
- vDivStr = '<DIV><TABLE style="position:relative; top:0px; width: ' + vChartWidth + 'px;" cellSpacing=0 cellPadding=0 border=0>' +
958
- '<TR id=childrow_' + vID + ' class=yesdisplay style="HEIGHT: 20px" bgColor=#ffffff onMouseover=g.mouseOver(this,' + vID + ',"right","row") onMouseout=g.mouseOut(this,' + vID + ',"right","row")>' + vItemRowStr + '</TR></TABLE></DIV>';
959
- vRightTable += vDivStr;
960
-
961
- // Draw Task Bar which has outer DIV with enclosed colored bar div, and opaque completion div
962
- vRightTable +=
963
- '<div id=bardiv_' + vID + ' style="position:absolute; top:4px; left:' + Math.ceil(vTaskLeft * (vDayWidth) + 1) + 'px; height:18px; width:' + Math.ceil((vTaskRight) * (vDayWidth) - 1) + 'px">' +
964
- '<div id=taskbar_' + vID + ' title="' + vTaskList[i].getName() + ': ' + vDateRowStr + '" class=gtask style="background-color:#' + vTaskList[i].getColor() +'; height: 13px; width:' + Math.ceil((vTaskRight) * (vDayWidth) - 1) + 'px; cursor: pointer;opacity:0.9;" ' +
965
- 'onclick=JSGantt.taskLink("' + vTaskList[i].getLink() + '",300,200); >' +
966
- '<div class=gcomplete style="Z-INDEX: -4; float:left; background-color:black; height:5px; overflow: auto; margin-top:4px; filter: alpha(opacity=40); opacity:0.4; width:' + vTaskList[i].getCompStr() + '; overflow:hidden">' +
967
- '</div>' +
968
- '</div>';
969
-
970
- if( g.getCaptionType() ) {
971
- vCaptionStr = '';
972
- switch( g.getCaptionType() ) {
973
- case 'Caption': vCaptionStr = vTaskList[i].getCaption(); break;
974
- case 'Resource': vCaptionStr = vTaskList[i].getResource(); break;
975
- case 'Duration': vCaptionStr = vTaskList[i].getDuration(vFormat); break;
976
- case 'Complete': vCaptionStr = vTaskList[i].getCompStr(); break;
977
- }
978
- //vRightTable += '<div style="FONT-SIZE:12px; position:absolute; left: 6px; top:-3px;">' + vCaptionStr + '</div>';
979
- vRightTable += '<div style="FONT-SIZE:12px; position:absolute; top:-3px; width:120px; left:' + (Math.ceil((vTaskRight) * (vDayWidth) - 1) + 6) + 'px">' + vCaptionStr + '</div>';
980
- }
981
- vRightTable += '</div>' ;
982
-
983
-
984
-
985
- }
986
- }
987
-
988
- vRightTable += '</DIV>';
989
-
990
- }
991
-
992
- vMainTable += vRightTable + '</DIV></TD></TR></TBODY></TABLE></BODY></HTML>';
993
-
994
- vDiv.innerHTML = vMainTable;
995
-
996
- }
997
-
998
- } //this.draw
999
-
1000
- this.mouseOver = function( pObj, pID, pPos, pType ) {
1001
- if( pPos == 'right' ) vID = 'child_' + pID;
1002
- else vID = 'childrow_' + pID;
1003
-
1004
- pObj.bgColor = "#ffffaa";
1005
- vRowObj = JSGantt.findObj(vID);
1006
- if (vRowObj) vRowObj.bgColor = "#ffffaa";
1007
- }
1008
-
1009
- this.mouseOut = function( pObj, pID, pPos, pType ) {
1010
- if( pPos == 'right' ) vID = 'child_' + pID;
1011
- else vID = 'childrow_' + pID;
1012
-
1013
- pObj.bgColor = "#ffffff";
1014
- vRowObj = JSGantt.findObj(vID);
1015
- if (vRowObj) {
1016
- if( pType == "group") {
1017
- pObj.bgColor = "#f3f3f3";
1018
- vRowObj.bgColor = "#f3f3f3";
1019
- } else {
1020
- pObj.bgColor = "#ffffff";
1021
- vRowObj.bgColor = "#ffffff";
1022
- }
1023
- }
1024
- }
1025
-
1026
- } //GanttChart
1027
-
1028
- // Recursively process task tree ... set min, max dates of parent tasks and identfy task level.
1029
- JSGantt.processRows = function(pList, pID, pRow, pLevel, pOpen)
1030
- {
1031
-
1032
- var vMinDate = new Date();
1033
- var vMaxDate = new Date();
1034
- var vMinSet = 0;
1035
- var vMaxSet = 0;
1036
- var vList = pList;
1037
- var vLevel = pLevel;
1038
- var i = 0;
1039
- var vNumKid = 0;
1040
- var vCompSum = 0;
1041
- var vVisible = pOpen;
1042
-
1043
- for(i = 0; i < pList.length; i++)
1044
- {
1045
- if(pList[i].getParent() == pID) {
1046
- vVisible = pOpen;
1047
- pList[i].setVisible(vVisible);
1048
- if(vVisible==1 && pList[i].getOpen() == 0)
1049
- vVisible = 0;
1050
-
1051
- pList[i].setLevel(vLevel);
1052
- vNumKid++;
1053
-
1054
- if(pList[i].getGroup() == 1) {
1055
- JSGantt.processRows(vList, pList[i].getID(), i, vLevel+1, vVisible);
1056
- }
1057
-
1058
- if( vMinSet==0 || pList[i].getStart() < vMinDate) {
1059
- vMinDate = pList[i].getStart();
1060
- vMinSet = 1;
1061
- }
1062
-
1063
- if( vMaxSet==0 || pList[i].getEnd() > vMaxDate) {
1064
- vMaxDate = pList[i].getEnd();
1065
- vMaxSet = 1;
1066
- }
1067
-
1068
- vCompSum += pList[i].getCompVal();
1069
-
1070
- }
1071
- }
1072
-
1073
- if(pRow >= 0) {
1074
- pList[pRow].setStart(vMinDate);
1075
- pList[pRow].setEnd(vMaxDate);
1076
- pList[pRow].setNumKid(vNumKid);
1077
- pList[pRow].setCompVal(Math.ceil(vCompSum/vNumKid));
1078
- }
1079
-
1080
- }
1081
-
1082
-
1083
- // Used to determine the minimum date of all tasks and set lower bound based on format
1084
- JSGantt.getMinDate = function getMinDate(pList, pFormat)
1085
- {
1086
-
1087
- var vDate = new Date();
1088
-
1089
- vDate.setFullYear(pList[0].getStart().getFullYear(), pList[0].getStart().getMonth(), pList[0].getStart().getDate());
1090
-
1091
- // Parse all Task End dates to find min
1092
- for(i = 0; i < pList.length; i++)
1093
- {
1094
- if(Date.parse(pList[i].getStart()) < Date.parse(vDate))
1095
- vDate.setFullYear(pList[i].getStart().getFullYear(), pList[i].getStart().getMonth(), pList[i].getStart().getDate());
1096
- }
1097
-
1098
- if ( pFormat== 'minute')
1099
- {
1100
- vDate.setHours(0);
1101
- vDate.setMinutes(0);
1102
- }
1103
- else if (pFormat == 'hour' )
1104
- {
1105
- vDate.setHours(0);
1106
- vDate.setMinutes(0);
1107
- }
1108
- // Adjust min date to specific format boundaries (first of week or first of month)
1109
- else if (pFormat=='day')
1110
- {
1111
- vDate.setDate(vDate.getDate() - 1);
1112
- while(vDate.getDay() % 7 > 0)
1113
- {
1114
- vDate.setDate(vDate.getDate() - 1);
1115
- }
1116
-
1117
- }
1118
-
1119
- else if (pFormat=='week')
1120
- {
1121
- vDate.setDate(vDate.getDate() - 7);
1122
- while(vDate.getDay() % 7 > 0)
1123
- {
1124
- vDate.setDate(vDate.getDate() - 1);
1125
- }
1126
-
1127
- }
1128
-
1129
- else if (pFormat=='month')
1130
- {
1131
- while(vDate.getDate() > 1)
1132
- {
1133
- vDate.setDate(vDate.getDate() - 1);
1134
- }
1135
- }
1136
-
1137
- else if (pFormat=='quarter')
1138
- {
1139
- if( vDate.getMonth()==0 || vDate.getMonth()==1 || vDate.getMonth()==2 )
1140
- vDate.setFullYear(vDate.getFullYear(), 0, 1);
1141
- else if( vDate.getMonth()==3 || vDate.getMonth()==4 || vDate.getMonth()==5 )
1142
- vDate.setFullYear(vDate.getFullYear(), 3, 1);
1143
- else if( vDate.getMonth()==6 || vDate.getMonth()==7 || vDate.getMonth()==8 )
1144
- vDate.setFullYear(vDate.getFullYear(), 6, 1);
1145
- else if( vDate.getMonth()==9 || vDate.getMonth()==10 || vDate.getMonth()==11 )
1146
- vDate.setFullYear(vDate.getFullYear(), 9, 1);
1147
-
1148
- }
1149
-
1150
- return(vDate);
1151
-
1152
- }
1153
-
1154
-
1155
-
1156
-
1157
-
1158
-
1159
-
1160
- // Used to determine the minimum date of all tasks and set lower bound based on format
1161
-
1162
- JSGantt.getMaxDate = function (pList, pFormat)
1163
- {
1164
- var vDate = new Date();
1165
-
1166
- vDate.setFullYear(pList[0].getEnd().getFullYear(), pList[0].getEnd().getMonth(), pList[0].getEnd().getDate());
1167
-
1168
-
1169
- // Parse all Task End dates to find max
1170
- for(i = 0; i < pList.length; i++)
1171
- {
1172
- if(Date.parse(pList[i].getEnd()) > Date.parse(vDate))
1173
- {
1174
- //vDate.setFullYear(pList[0].getEnd().getFullYear(), pList[0].getEnd().getMonth(), pList[0].getEnd().getDate());
1175
- vDate.setTime(Date.parse(pList[i].getEnd()));
1176
- }
1177
- }
1178
-
1179
- if (pFormat == 'minute')
1180
- {
1181
- vDate.setHours(vDate.getHours() + 1);
1182
- vDate.setMinutes(59);
1183
- }
1184
-
1185
- if (pFormat == 'hour')
1186
- {
1187
- vDate.setHours(vDate.getHours() + 2);
1188
- }
1189
-
1190
- // Adjust max date to specific format boundaries (end of week or end of month)
1191
- if (pFormat=='day')
1192
- {
1193
- vDate.setDate(vDate.getDate() + 1);
1194
-
1195
- while(vDate.getDay() % 6 > 0)
1196
- {
1197
- vDate.setDate(vDate.getDate() + 1);
1198
- }
1199
-
1200
- }
1201
-
1202
- if (pFormat=='week')
1203
- {
1204
- //For weeks, what is the last logical boundary?
1205
- vDate.setDate(vDate.getDate() + 11);
1206
-
1207
- while(vDate.getDay() % 6 > 0)
1208
- {
1209
- vDate.setDate(vDate.getDate() + 1);
1210
- }
1211
-
1212
- }
1213
-
1214
- // Set to last day of current Month
1215
- if (pFormat=='month')
1216
- {
1217
- while(vDate.getDay() > 1)
1218
- {
1219
- vDate.setDate(vDate.getDate() + 1);
1220
- }
1221
-
1222
- vDate.setDate(vDate.getDate() - 1);
1223
- }
1224
-
1225
- // Set to last day of current Quarter
1226
- if (pFormat=='quarter')
1227
- {
1228
- if( vDate.getMonth()==0 || vDate.getMonth()==1 || vDate.getMonth()==2 )
1229
- vDate.setFullYear(vDate.getFullYear(), 2, 31);
1230
- else if( vDate.getMonth()==3 || vDate.getMonth()==4 || vDate.getMonth()==5 )
1231
- vDate.setFullYear(vDate.getFullYear(), 5, 30);
1232
- else if( vDate.getMonth()==6 || vDate.getMonth()==7 || vDate.getMonth()==8 )
1233
- vDate.setFullYear(vDate.getFullYear(), 8, 30);
1234
- else if( vDate.getMonth()==9 || vDate.getMonth()==10 || vDate.getMonth()==11 )
1235
- vDate.setFullYear(vDate.getFullYear(), 11, 31);
1236
-
1237
- }
1238
-
1239
- return(vDate);
1240
-
1241
- }
1242
-
1243
-
1244
-
1245
-
1246
-
1247
-
1248
-
1249
- // This function finds the document id of the specified object
1250
-
1251
- JSGantt.findObj = function (theObj, theDoc)
1252
-
1253
- {
1254
-
1255
- var p, i, foundObj;
1256
-
1257
- if(!theDoc) theDoc = document;
1258
-
1259
- if( (p = theObj.indexOf("?")) > 0 && parent.frames.length){
1260
-
1261
- theDoc = parent.frames[theObj.substring(p+1)].document;
1262
-
1263
- theObj = theObj.substring(0,p);
1264
-
1265
- }
1266
-
1267
- if(!(foundObj = theDoc[theObj]) && theDoc.all)
1268
-
1269
- foundObj = theDoc.all[theObj];
1270
-
1271
-
1272
-
1273
- for (i=0; !foundObj && i < theDoc.forms.length; i++)
1274
-
1275
- foundObj = theDoc.forms[i][theObj];
1276
-
1277
-
1278
-
1279
- for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
1280
-
1281
- foundObj = JSGantt.findObj(theObj,theDoc.layers[i].document);
1282
-
1283
-
1284
-
1285
- if(!foundObj && document.getElementById)
1286
-
1287
- foundObj = document.getElementById(theObj);
1288
-
1289
-
1290
-
1291
- return foundObj;
1292
-
1293
- }
1294
-
1295
-
1296
-
1297
-
1298
-
1299
- JSGantt.changeFormat = function(pFormat,ganttObj) {
1300
-
1301
-
1302
-
1303
- if(ganttObj)
1304
-
1305
- {
1306
-
1307
- ganttObj.setFormat(pFormat);
1308
-
1309
- ganttObj.DrawDependencies();
1310
-
1311
- }
1312
-
1313
- else
1314
-
1315
- alert('Chart undefined');
1316
-
1317
-
1318
-
1319
- }
1320
-
1321
-
1322
-
1323
-
1324
-
1325
- // Function to open/close and hide/show children of specified task
1326
-
1327
- JSGantt.folder= function (pID,ganttObj) {
1328
-
1329
- var vList = ganttObj.getList();
1330
-
1331
- for(i = 0; i < vList.length; i++)
1332
- {
1333
- if(vList[i].getID() == pID) {
1334
-
1335
- if( vList[i].getOpen() == 1 ) {
1336
- vList[i].setOpen(0);
1337
- JSGantt.hide(pID,ganttObj);
1338
-
1339
- if (JSGantt.isIE())
1340
- JSGantt.findObj('group_'+pID).innerText = '+';
1341
- else
1342
- JSGantt.findObj('group_'+pID).textContent = '+';
1343
-
1344
- } else {
1345
-
1346
- vList[i].setOpen(1);
1347
-
1348
- JSGantt.show(pID, 1, ganttObj);
1349
-
1350
- if (JSGantt.isIE())
1351
- JSGantt.findObj('group_'+pID).innerText = '�';
1352
- else
1353
- JSGantt.findObj('group_'+pID).textContent = '�';
1354
-
1355
- }
1356
-
1357
- }
1358
- }
1359
- }
1360
-
1361
- JSGantt.hide= function (pID,ganttObj) {
1362
- var vList = ganttObj.getList();
1363
- var vID = 0;
1364
-
1365
- for(var i = 0; i < vList.length; i++)
1366
- {
1367
- if(vList[i].getParent() == pID) {
1368
- vID = vList[i].getID();
1369
- JSGantt.findObj('child_' + vID).style.display = "none";
1370
- JSGantt.findObj('childgrid_' + vID).style.display = "none";
1371
- vList[i].setVisible(0);
1372
- if(vList[i].getGroup() == 1)
1373
- JSGantt.hide(vID,ganttObj);
1374
- }
1375
-
1376
- }
1377
- }
1378
-
1379
- // Function to show children of specified task
1380
- JSGantt.show = function (pID, pTop, ganttObj) {
1381
- var vList = ganttObj.getList();
1382
- var vID = 0;
1383
-
1384
- for(var i = 0; i < vList.length; i++)
1385
- {
1386
- if(vList[i].getParent() == pID) {
1387
- vID = vList[i].getID();
1388
- if(pTop == 1) {
1389
- if (JSGantt.isIE()) { // IE;
1390
-
1391
- if( JSGantt.findObj('group_'+pID).innerText == '+') {
1392
- JSGantt.findObj('child_'+vID).style.display = "";
1393
- JSGantt.findObj('childgrid_'+vID).style.display = "";
1394
- vList[i].setVisible(1);
1395
- }
1396
-
1397
- } else {
1398
-
1399
- if( JSGantt.findObj('group_'+pID).textContent == '+') {
1400
- JSGantt.findObj('child_'+vID).style.display = "";
1401
- JSGantt.findObj('childgrid_'+vID).style.display = "";
1402
- vList[i].setVisible(1);
1403
- }
1404
-
1405
- }
1406
-
1407
- } else {
1408
-
1409
- if (JSGantt.isIE()) { // IE;
1410
- if( JSGantt.findObj('group_'+pID).innerText == '�') {
1411
- JSGantt.findObj('child_'+vID).style.display = "";
1412
- JSGantt.findObj('childgrid_'+vID).style.display = "";
1413
- vList[i].setVisible(1);
1414
- }
1415
-
1416
- } else {
1417
-
1418
- if( JSGantt.findObj('group_'+pID).textContent == '�') {
1419
- JSGantt.findObj('child_'+vID).style.display = "";
1420
- JSGantt.findObj('childgrid_'+vID).style.display = "";
1421
- vList[i].setVisible(1);
1422
- }
1423
- }
1424
- }
1425
-
1426
- if(vList[i].getGroup() == 1)
1427
- JSGantt.show(vID, 0,ganttObj);
1428
-
1429
- }
1430
- }
1431
- }
1432
-
1433
-
1434
-
1435
-
1436
-
1437
- // function to open window to display task link
1438
-
1439
- JSGantt.taskLink = function(pRef,pWidth,pHeight)
1440
-
1441
- {
1442
-
1443
- if(pWidth) vWidth =pWidth; else vWidth =400;
1444
- if(pHeight) vHeight=pHeight; else vHeight=400;
1445
-
1446
- var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
1447
-
1448
- }
1449
-
1450
- JSGantt.parseDateStr = function(pDateStr,pFormatStr) {
1451
- var vDate =new Date();
1452
- vDate.setTime( Date.parse(pDateStr));
1453
-
1454
- switch(pFormatStr)
1455
- {
1456
- case 'mm/dd/yyyy':
1457
- var vDateParts = pDateStr.split('/');
1458
- vDate.setFullYear(parseInt(vDateParts[2], 10), parseInt(vDateParts[0], 10) - 1, parseInt(vDateParts[1], 10));
1459
- break;
1460
- case 'dd/mm/yyyy':
1461
- var vDateParts = pDateStr.split('/');
1462
- vDate.setFullYear(parseInt(vDateParts[2], 10), parseInt(vDateParts[1], 10) - 1, parseInt(vDateParts[0], 10));
1463
- break;
1464
- case 'yyyy-mm-dd':
1465
- var vDateParts = pDateStr.split('-');
1466
- vDate.setFullYear(parseInt(vDateParts[0], 10), parseInt(vDateParts[1], 10) - 1, parseInt(vDateParts[1], 10));
1467
- break;
1468
- }
1469
-
1470
- return(vDate);
1471
-
1472
- }
1473
-
1474
- JSGantt.formatDateStr = function(pDate,pFormatStr) {
1475
- vYear4Str = pDate.getFullYear() + '';
1476
- vYear2Str = vYear4Str.substring(2,4);
1477
- vMonthStr = (pDate.getMonth()+1) + '';
1478
- vDayStr = pDate.getDate() + '';
1479
-
1480
- var vDateStr = "";
1481
-
1482
- switch(pFormatStr) {
1483
- case 'mm/dd/yyyy':
1484
- return( vMonthStr + '/' + vDayStr + '/' + vYear4Str );
1485
- case 'dd/mm/yyyy':
1486
- return( vDayStr + '/' + vMonthStr + '/' + vYear4Str );
1487
- case 'yyyy-mm-dd':
1488
- return( vYear4Str + '-' + vMonthStr + '-' + vDayStr );
1489
- case 'mm/dd/yy':
1490
- return( vMonthStr + '/' + vDayStr + '/' + vYear2Str );
1491
- case 'dd/mm/yy':
1492
- return( vDayStr + '/' + vMonthStr + '/' + vYear2Str );
1493
- case 'yy-mm-dd':
1494
- return( vYear2Str + '-' + vMonthStr + '-' + vDayStr );
1495
- case 'mm/dd':
1496
- return( vMonthStr + '/' + vDayStr );
1497
- case 'dd/mm':
1498
- return( vDayStr + '/' + vMonthStr );
1499
- }
1500
-
1501
- }
1502
-
1503
- JSGantt.parseXML = function(ThisFile,pGanttVar){
1504
- var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; // Is this Chrome
1505
-
1506
- try { //Internet Explorer
1507
- xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
1508
- }
1509
- catch(e) {
1510
- try { //Firefox, Mozilla, Opera, Chrome etc.
1511
- if (is_chrome==false) { xmlDoc=document.implementation.createDocument("","",null); }
1512
- }
1513
- catch(e) {
1514
- alert(e.message);
1515
- return;
1516
- }
1517
- }
1518
-
1519
- if (is_chrome==false) { // can't use xmlDoc.load in chrome at the moment
1520
- xmlDoc.async=false;
1521
- xmlDoc.load(ThisFile); // we can use loadxml
1522
- JSGantt.AddXMLTask(pGanttVar)
1523
- xmlDoc=null; // a little tidying
1524
- Task = null;
1525
- }
1526
- else {
1527
- JSGantt.ChromeLoadXML(ThisFile,pGanttVar);
1528
- ta=null; // a little tidying
1529
- }
1530
- }
1531
-
1532
- JSGantt.AddXMLTask = function(pGanttVar){
1533
-
1534
- Task=xmlDoc.getElementsByTagName("task");
1535
-
1536
- var n = xmlDoc.documentElement.childNodes.length; // the number of tasks. IE gets this right, but mozilla add extra ones (Whitespace)
1537
-
1538
- for(var i=0;i<n;i++) {
1539
-
1540
- // optional parameters may not have an entry (Whitespace from mozilla also returns an error )
1541
- // Task ID must NOT be zero other wise it will be skipped
1542
- try { pID = Task[i].getElementsByTagName("pID")[0].childNodes[0].nodeValue;
1543
- } catch (error) {pID =0;}
1544
- pID *= 1; // make sure that these are numbers rather than strings in order to make jsgantt.js behave as expected.
1545
-
1546
- if(pID!=0){
1547
- try { pName = Task[i].getElementsByTagName("pName")[0].childNodes[0].nodeValue;
1548
- } catch (error) {pName ="No Task Name";} // If there is no corresponding entry in the XML file the set a default.
1549
-
1550
- try { pColor = Task[i].getElementsByTagName("pColor")[0].childNodes[0].nodeValue;
1551
- } catch (error) {pColor ="0000ff";}
1552
-
1553
- try { pParent = Task[i].getElementsByTagName("pParent")[0].childNodes[0].nodeValue;
1554
- } catch (error) {pParent =0;}
1555
- pParent *= 1;
1556
-
1557
- try { pStart = Task[i].getElementsByTagName("pStart")[0].childNodes[0].nodeValue;
1558
- } catch (error) {pStart ="";}
1559
-
1560
- try { pEnd = Task[i].getElementsByTagName("pEnd")[0].childNodes[0].nodeValue;
1561
- } catch (error) { pEnd ="";}
1562
-
1563
- try { pLink = Task[i].getElementsByTagName("pLink")[0].childNodes[0].nodeValue;
1564
- } catch (error) { pLink ="";}
1565
-
1566
- try { pMile = Task[i].getElementsByTagName("pMile")[0].childNodes[0].nodeValue;
1567
- } catch (error) { pMile=0;}
1568
- pMile *= 1;
1569
-
1570
- try { pRes = Task[i].getElementsByTagName("pRes")[0].childNodes[0].nodeValue;
1571
- } catch (error) { pRes ="";}
1572
-
1573
- try { pComp = Task[i].getElementsByTagName("pComp")[0].childNodes[0].nodeValue;
1574
- } catch (error) {pComp =0;}
1575
- pComp *= 1;
1576
-
1577
- try { pGroup = Task[i].getElementsByTagName("pGroup")[0].childNodes[0].nodeValue;
1578
- } catch (error) {pGroup =0;}
1579
- pGroup *= 1;
1580
-
1581
- try { pOpen = Task[i].getElementsByTagName("pOpen")[0].childNodes[0].nodeValue;
1582
- } catch (error) { pOpen =1;}
1583
- pOpen *= 1;
1584
-
1585
- try { pDepend = Task[i].getElementsByTagName("pDepend")[0].childNodes[0].nodeValue;
1586
- } catch (error) { pDepend =0;}
1587
- //pDepend *= 1;
1588
- if (pDepend.length==0){pDepend=''} // need this to draw the dependency lines
1589
-
1590
- try { pCaption = Task[i].getElementsByTagName("pCaption")[0].childNodes[0].nodeValue;
1591
- } catch (error) { pCaption ="";}
1592
-
1593
-
1594
- // Finally add the task
1595
- pGanttVar.AddTaskItem(new JSGantt.TaskItem(pID , pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend,pCaption));
1596
- }
1597
- }
1598
- }
1599
-
1600
- JSGantt.ChromeLoadXML = function(ThisFile,pGanttVar){
1601
- // Thanks to vodobas at mindlence,com for the initial pointers here.
1602
- XMLLoader = new XMLHttpRequest();
1603
- XMLLoader.onreadystatechange= function(){
1604
- JSGantt.ChromeXMLParse(pGanttVar);
1605
- };
1606
- XMLLoader.open("GET", ThisFile, false);
1607
- XMLLoader.send(null);
1608
- }
1609
-
1610
- JSGantt.ChromeXMLParse = function (pGanttVar){
1611
- // Manually parse the file as it is loads quicker
1612
- if (XMLLoader.readyState == 4) {
1613
- var ta=XMLLoader.responseText.split(/<task>/gi);
1614
-
1615
- var n = ta.length; // the number of tasks.
1616
- for(var i=1;i<n;i++) {
1617
- Task = ta[i].replace(/<[/]p/g, '<p');
1618
- var te = Task.split(/<pid>/i)
1619
-
1620
- if(te.length> 2){var pID=te[1];} else {var pID = 0;}
1621
- pID *= 1;
1622
-
1623
- var te = Task.split(/<pName>/i)
1624
- if(te.length> 2){var pName=te[1];} else {var pName = "No Task Name";}
1625
-
1626
- var te = Task.split(/<pstart>/i)
1627
- if(te.length> 2){var pStart=te[1];} else {var pStart = "";}
1628
-
1629
- var te = Task.split(/<pEnd>/i)
1630
- if(te.length> 2){var pEnd=te[1];} else {var pEnd = "";}
1631
-
1632
- var te = Task.split(/<pColor>/i)
1633
- if(te.length> 2){var pColor=te[1];} else {var pColor = '0000ff';}
1634
-
1635
- var te = Task.split(/<pLink>/i)
1636
- if(te.length> 2){var pLink=te[1];} else {var pLink = "";}
1637
-
1638
- var te = Task.split(/<pMile>/i)
1639
- if(te.length> 2){var pMile=te[1];} else {var pMile = 0;}
1640
- pMile *= 1;
1641
-
1642
- var te = Task.split(/<pRes>/i)
1643
- if(te.length> 2){var pRes=te[1];} else {var pRes = "";}
1644
-
1645
- var te = Task.split(/<pComp>/i)
1646
- if(te.length> 2){var pComp=te[1];} else {var pComp = 0;}
1647
- pComp *= 1;
1648
-
1649
- var te = Task.split(/<pGroup>/i)
1650
- if(te.length> 2){var pGroup=te[1];} else {var pGroup = 0;}
1651
- pGroup *= 1;
1652
-
1653
- var te = Task.split(/<pParent>/i)
1654
- if(te.length> 2){var pParent=te[1];} else {var pParent = 0;}
1655
- pParent *= 1;
1656
-
1657
- var te = Task.split(/<pOpen>/i)
1658
- if(te.length> 2){var pOpen=te[1];} else {var pOpen = 1;}
1659
- pOpen *= 1;
1660
-
1661
- var te = Task.split(/<pDepend>/i)
1662
- if(te.length> 2){var pDepend=te[1];} else {var pDepend = "";}
1663
- //pDepend *= 1;
1664
- if (pDepend.length==0){pDepend=''} // need this to draw the dependency lines
1665
-
1666
- var te = Task.split(/<pCaption>/i)
1667
- if(te.length> 2){var pCaption=te[1];} else {var pCaption = "";}
1668
-
1669
- // Finally add the task
1670
- pGanttVar.AddTaskItem(new JSGantt.TaskItem(pID , pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend,pCaption ));
1671
- }
1672
- }
1673
- }
1674
-
1675
- JSGantt.benchMark = function(pItem){
1676
- var vEndTime=new Date().getTime();
1677
- alert(pItem + ': Elapsed time: '+((vEndTime-vBenchTime)/1000)+' seconds.');
1678
- vBenchTime=new Date().getTime();
1679
- }
1680
-
1681
-