--- db2gantt.cgi 2002/11/18 08:09:58 1.24 +++ db2gantt.cgi 2002/12/02 14:35:17 1.25 @@ -36,14 +36,26 @@ #--- no user servicable parts below this line -# time range - -$int_t = m_round($int_t); +my $dbh = DBI->connect("DBI:Pg:dbname=gantt","","") || die $DBI::errstr; +my $q=new CGI; my ($from_t,$to_t) = (time()-$int_t,time()); -$to_t = param('to_t') if (param('to_t')); $from_t = param('from_t') if (param('from_t')); +$to_t = param('to_t') if (param('to_t')); + +if (param('f-1')) { + $from_t = $from_t - param('int_f-1') || $int_t; +} elsif (param('f+1')) { + $from_t = $from_t + param('int_f+1') || $int_t; +} elsif (param('t-1')) { + $to_t = $from_t - param('int_t-1') || $int_t; +} elsif (param('t+1')) { + $to_t = $from_t + $int_t; +} + +# time range +$int_t = m_round($int_t); # round to nearest minute sub m_round { @@ -98,33 +110,43 @@ '; } -print ""; +print " +
+ + +"; # all vars ending in *_t have utime in them. # my $len_t = $to_t - $from_t; -die "interval must be positive and bigger than 1 sec !" if ($len_t < 1); - -my $dbh = DBI->connect("DBI:Pg:dbname=gantt","","") || die $DBI::errstr; -my $q=new CGI; +die "interval must be positive and bigger than 1 sec !" if (abs($len_t) < 1); sub mknav { my $f = shift @_; # from_t my $t = shift @_; # to_t + my $d = shift @_; # delta my $ch = shift @_; # char - return "url(-relative=>1)."?from_t=${f}&to_t=${t}\">$ch"; + return " + + + "; + #return "url(-relative=>1)."?from_t=${f}&to_t=${t}\">$ch"; } print ""; print "\n"; +print mknav($from_t,$to_t,'t-1','<<') if ($to_t+$int_t > $from_t); +print $to,mknav($from_t,$to_t,'t+1','>>'),"\n"; # draw hour grid sub hour_grid { @@ -418,5 +440,5 @@ # it will first evaluate bar sub (thus increasing number by one) and # then display number (wrongly). } -print "
Specification"; -print mknav(($from_t-$int_t),$to_t,'<<'),$from; -print mknav(($from_t+$int_t),$to_t,'>>') if ($from_t+$int_t < $to_t); +print mknav($from_t,$to_t,'f-1','<<'),$from; +print mknav($from_t,$to_t,'f+1','>>') if ($from_t+$int_t < $to_t); print ""; -print mknav($from_t,($to_t-$int_t),'<<') if ($to_t-$int_t > $from_t); -print $to,mknav($from_t,($to_t+$int_t),'>>'),"
\n

Reload url(-relative=>1),"\">current or see help.

"; +print "
\n

Reload url(-relative=>1),"\">current or see help.

";