10 |
|
|
11 |
my $debug = 0; |
my $debug = 0; |
12 |
|
|
13 |
|
# comment out following field if you don't want links to omni reports |
14 |
|
# or haven't installed repgen.pl |
15 |
|
my $repgen_url="/omni/"; # URL to pages with rptgen.pl |
16 |
|
|
17 |
my $width = 600; # width of bar |
my $width = 600; # width of bar |
18 |
my $height = 15; # height of bar |
my $height = 15; # height of bar |
19 |
my $use_js = 1; # use JavaScript pop-up |
my $use_js = 1; # use JavaScript pop-up |
40 |
|
|
41 |
#--- no user servicable parts below this line |
#--- no user servicable parts below this line |
42 |
|
|
|
my $dbh = DBI->connect("DBI:Pg:dbname=gantt","","") || die $DBI::errstr; |
|
43 |
my $q=new CGI; |
my $q=new CGI; |
44 |
|
|
45 |
my ($from_t,$to_t) = (time()-$int_t,time()); |
my ($from_t,$to_t) = (time()-$int_t,time()); |
93 |
exit; |
exit; |
94 |
} |
} |
95 |
|
|
96 |
|
# open DBI connection |
97 |
|
my $dbh = DBI->connect("DBI:Pg:dbname=gantt","","") || die $DBI::errstr; |
98 |
|
|
99 |
print "Content-type: text/html |
print "Content-type: text/html |
100 |
Cache-Control: max-age=60, must-revalidate |
Cache-Control: max-age=60, must-revalidate |
101 |
|
|
236 |
|
|
237 |
print STDERR "bar[$col] len:$l s scale:",($len_t/$width)," size:$size px<br> alt:$alt\n" if ($debug); |
print STDERR "bar[$col] len:$l s scale:",($len_t/$width)," size:$size px<br> alt:$alt\n" if ($debug); |
238 |
|
|
239 |
my $html = "<img src=\"".$q->url(-relative=>1)."/$col\" width=\"$size\" height=\"$h\""; |
my $html; |
240 |
|
|
241 |
|
my ($html_end, $img_end) = ("",""); |
242 |
|
if ($repgen_url && $alt =~ m#(\d\d\d\d)/(\d\d)/(\d\d)-(\d+)#) { |
243 |
|
$html .= "<a href=\"$repgen_url/$1-$2-$3-$4.html\">"; |
244 |
|
$html_end .= "</a>"; |
245 |
|
$img_end .= " border=0"; |
246 |
|
} |
247 |
|
|
248 |
|
$html .= "<img src=\"".$q->url(-relative=>1)."/$col\" width=\"$size\" height=\"$h\""; |
249 |
|
|
250 |
if ($use_js && $alt) { |
if ($use_js && $alt) { |
251 |
$html .= " onmouseover=\"T('$alt')\" onmouseout=\"T()\""; |
$html .= " onmouseover=\"T('$alt')\" onmouseout=\"T()\""; |
252 |
} elsif ($alt) { |
} elsif ($alt) { |
253 |
$html .= " alt=\"$alt\""; |
$html .= " alt=\"$alt\""; |
254 |
} |
} |
255 |
$html .= ">"; |
$html .= "$img_end>$html_end"; |
256 |
|
|
257 |
return($html); |
return($html); |
258 |
} |
} |
266 |
"; |
"; |
267 |
|
|
268 |
my $sth = $dbh->prepare($sql) || die "sql: $sql ".$dbh->errstr; |
my $sth = $dbh->prepare($sql) || die "sql: $sql ".$dbh->errstr; |
269 |
|
print STDERR "sql: $sql\n" if ($debug); |
270 |
|
|
271 |
my %spec; # specification hash |
my %spec; # specification hash |
272 |
|
|
302 |
$last_var = $v; |
$last_var = $v; |
303 |
} |
} |
304 |
} |
} |
305 |
|
# fix division by zero |
306 |
|
$max_use++ if ($max_use == 0); |
307 |
my $h = $last_var / $max_use * $height; |
my $h = $last_var / $max_use * $height; |
308 |
my $c = 255 - int (255 * $last_var / $max_use); |
my $c = 255 - int (255 * $last_var / $max_use); |
309 |
print color_bar($len,"$c,$c,$c","$last_var concurrent jobs",1,$h+1) if ($len); |
print color_bar($len,"$c,$c,$c","$last_var concurrent jobs",1,$h+1) if ($len); |
353 |
# init vars for next line |
# init vars for next line |
354 |
($fix_s,$fix_d) = (0,0); # init fix vars for bar |
($fix_s,$fix_d) = (0,0); # init fix vars for bar |
355 |
|
|
356 |
html_spec if ($curr_spec ne ""); |
if ($curr_spec ne "") { |
357 |
|
$curr_spec =~ s/ +/ /g; |
358 |
|
html_spec; |
359 |
|
} |
360 |
|
|
361 |
$curr_t = $from_t; # init timeline |
$curr_t = $from_t; # init timeline |
362 |
$curr_spec = $row->{specification}; |
$curr_spec = $row->{specification}; |
449 |
|
|
450 |
|
|
451 |
# label and usage |
# label and usage |
|
$len_t = 50; # disable bar scaling |
|
452 |
|
|
453 |
print "<hr>\nColors for statuses and usage (#):\n"; |
print "<hr>\nColors for statuses and usage (#):\n"; |
454 |
print "<table border=0><tr bgcolor=#e0e0e0><th>status</th><th>#</th><th>color</th></tr>\n"; |
print "<table border=0><tr bgcolor=#e0e0e0><th>status</th><th>#</th><th>color</th></tr>\n"; |
455 |
|
my $max = 0; |
456 |
|
foreach my $status (keys %count) { |
457 |
|
$max = $count{$status} if ($count{$status} > $max); |
458 |
|
} |
459 |
|
$len_t = $max ; # disable bar scaling |
460 |
|
|
461 |
foreach my $status (keys %count) { |
foreach my $status (keys %count) { |
462 |
#foreach my $status (keys %cols) { |
#foreach my $status (keys %cols) { |
463 |
print "<tr bgcolor=#e0e0e0><td><small>$status</small></td><td><small>",$count{$status}*1,"</small></td><td>",bar($count{$status},$status),"</td></tr>\n" if ($status ne ""); |
print "<tr bgcolor=#e0e0e0><td><small>$status</small></td><td><small>",$count{$status}*1,"</small></td><td>",bar($count{$status},$status),"</td></tr>\n" if ($status ne ""); |
467 |
# then display number (wrongly). |
# then display number (wrongly). |
468 |
} |
} |
469 |
print "</table></form>\n<p>Reload <a href=\"",$q->url(-relative=>1),"\">current</a> or see <a href=\"db2gantt_help.html\">help</a>.</p></body></html>"; |
print "</table></form>\n<p>Reload <a href=\"",$q->url(-relative=>1),"\">current</a> or see <a href=\"db2gantt_help.html\">help</a>.</p></body></html>"; |
|
|
|