112 |
return "<a href=\"".$q->url(-relative=>1)."?from_t=${f}&to_t=${t}\">$ch</a>"; |
return "<a href=\"".$q->url(-relative=>1)."?from_t=${f}&to_t=${t}\">$ch</a>"; |
113 |
} |
} |
114 |
|
|
115 |
print "<table>"; |
print "<table cellspacing=0 cellpadding=0>"; |
116 |
print "<tr bgcolor=#e0e0e0><td>Specification</td><td align=left>"; |
print "<tr bgcolor=#e0e0e0><td>Specification</td><td align=left>"; |
117 |
print mknav(($from_t-$int_t),$to_t,'<small><<</small>'),$from; |
print mknav(($from_t-$int_t),$to_t,'<small><<</small>'),$from; |
118 |
print mknav(($from_t+$int_t),$to_t,'<small>>></small>') if ($from_t+$int_t < $to_t); |
print mknav(($from_t+$int_t),$to_t,'<small>>></small>') if ($from_t+$int_t < $to_t); |
121 |
print $to,mknav($from_t,($to_t+$int_t),'<small>>></small>'),"</td></tr>\n"; |
print $to,mknav($from_t,($to_t+$int_t),'<small>>></small>'),"</td></tr>\n"; |
122 |
|
|
123 |
# draw hour grid |
# draw hour grid |
124 |
print "<tr><td align=right><small>hour grid</small></td><td colspan=2>"; |
sub hour_grid { |
125 |
my @c = ("255,255,128","255,192,128"); |
print "<tr><td align=right><small>hour grid</small></td><td colspan=2>"; |
126 |
my $hr=strftime("%H",localtime ($from_t)); |
my @c = ("255,255,128","255,192,128"); |
127 |
print color_bar(3600 - $from_t % 3600,$c[0],$hr++ % 24); |
my $hr=strftime("%H",localtime ($from_t)); |
128 |
for (my $i=1; $i<int(($to_t-$from_t)/3600); $i++) { |
print color_bar(3600 - $from_t % 3600,$c[0],sprintf("%02d",$hr++ % 24)); |
129 |
print color_bar(3600,$c[1],sprintf("%02d",$hr++ % 24)); |
for (my $i=1; $i<int(($to_t-$from_t)/3600); $i++) { |
130 |
push @c, shift @c; |
print color_bar(3600,$c[1],sprintf("%02d",$hr++ % 24)); |
131 |
|
push @c, shift @c; |
132 |
|
} |
133 |
|
print color_bar($from_t % 3600,$c[1],sprintf("%02d",$hr % 24)); |
134 |
|
print "</td></tr>\n"; |
135 |
} |
} |
|
print color_bar($from_t % 3600,$c[1],$hr % 24); |
|
|
print "</td></tr>\n"; |
|
136 |
|
|
137 |
my $fix_d = 0; # used to fix graph len |
hour_grid(); |
138 |
|
|
139 |
|
my $fix_d = 0; # used to fix graph len (in pixels) |
140 |
|
my $fix_s = 0; # used to collect round errors of size |
141 |
|
|
142 |
sub bar { |
sub bar { |
143 |
my $l = shift @_; |
my $l = shift @_; |
165 |
my $col = shift @_ || '240,240,240'; # default color (filler) |
my $col = shift @_ || '240,240,240'; # default color (filler) |
166 |
my $alt = shift @_ || undef; |
my $alt = shift @_ || undef; |
167 |
|
|
168 |
my $size = int($l / ($len_t / $width)); |
my $size = $l / ($len_t / $width); |
169 |
if ($size < $min_l) { |
$fix_s += $size - int($size); |
170 |
|
$size=int($size); |
171 |
|
if ($fix_s > 1) { |
172 |
|
$fix_s -= 1; |
173 |
|
$size++; |
174 |
|
} |
175 |
|
|
176 |
|
if ($alt && $size < $min_l) { |
177 |
$fix_d += ($min_l - $size); |
$fix_d += ($min_l - $size); |
178 |
print STDERR "fix_d: $fix_d\n" if ($debug); |
print STDERR "fix_d: $fix_d\n" if ($debug); |
179 |
$size = $min_l; |
$size = $min_l; |
288 |
undef $sth; |
undef $sth; |
289 |
$dbh->disconnect; |
$dbh->disconnect; |
290 |
|
|
291 |
print "</td></tr>\n</table>"; |
print "</td></tr>\n"; |
292 |
|
hour_grid(); |
293 |
|
print "</table>"; |
294 |
|
|
295 |
|
|
296 |
# label and usage |
# label and usage |