diff options
author | ivan <ivan> | 2002-12-16 10:47:38 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-12-16 10:47:38 +0000 |
commit | 7b636e0d0a90e05e37ebe778bde29709f3323813 (patch) | |
tree | ce056634f5382ec0d9af98b509046692f8d6be6c /httemplate/graph | |
parent | edbcab06936c79a4f8d4edc0d0222139fa8c312c (diff) |
working date range selector that defaults to the past year!
Diffstat (limited to 'httemplate/graph')
-rwxr-xr-x | httemplate/graph/money_time-graph.cgi | 12 | ||||
-rw-r--r-- | httemplate/graph/money_time.cgi | 26 |
2 files changed, 29 insertions, 9 deletions
diff --git a/httemplate/graph/money_time-graph.cgi b/httemplate/graph/money_time-graph.cgi index ca8f6e86b..944019a7a 100755 --- a/httemplate/graph/money_time-graph.cgi +++ b/httemplate/graph/money_time-graph.cgi @@ -1,12 +1,16 @@ <% +#my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +my ($curmon,$curyear) = (localtime(time))[4,5]; + #find first month -my $syear = 2001; -my $smonth = 8; +my $syear = $cgi->param('syear') || 1899+$curyear; +my $smonth = $cgi->param('smonth') || $curmon+1; #find last month -my $eyear = 2002; -my $emonth = 12; +my $eyear = $cgi->param('eyear') || 1900+$curyear; +my $emonth = $cgi->param('emonth') || $curmon+1; +if ( $emonth++>12 ) { $emonth-=12; $eyear++; } my @labels; my %data; diff --git a/httemplate/graph/money_time.cgi b/httemplate/graph/money_time.cgi index d6c35434b..e24157ccb 100644 --- a/httemplate/graph/money_time.cgi +++ b/httemplate/graph/money_time.cgi @@ -1,9 +1,25 @@ +<!-- mason kludge %> +<% + +#my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +my ($curmon,$curyear) = (localtime(time))[4,5]; + +#find first month +my $syear = $cgi->param('syear') || 1899+$curyear; +my $smonth = $cgi->param('smonth') || $curmon+1; + +#find last month +my $eyear = $cgi->param('eyear') || 1900+$curyear; +my $emonth = $cgi->param('emonth') || $curmon+1; + +%> + <HTML> <HEAD> <TITLE>Graphing monetary values over time</TITLE> </HEAD> <BODY BGCOLOR="#e8e8e8"> -<IMG SRC="money_time-graph.cgi" WIDTH="768" HEIGHT="480"> +<IMG SRC="money_time-graph.cgi?<%= $cgi->query_string %>" WIDTH="768" HEIGHT="480"> <BR> <FORM METHOD="POST"> <INPUT TYPE="checkbox" NAME="ar"> @@ -18,22 +34,22 @@ From <SELECT NAME="smonth"> <% my @m = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); foreach my $m ( 1..12 ) { %> -<OPTION VALUE="<%= $m %>"><%= $m[$m-1] %> +<OPTION VALUE="<%= $m %>"<%= $m == $smonth ? ' SELECTED' : '' %>><%= $m[$m-1] %> <% } %> </SELECT> <SELECT NAME="syear"> <% foreach my $y ( 1999 .. 2010 ) { %> -<OPTION VALUE="<%= $y %>"><%= $y %> +<OPTION VALUE="<%= $y %>"<%= $y == $syear ? ' SELECTED' : '' %>><%= $y %> <% } %> </SELECT> to <SELECT NAME="emonth"> <% foreach my $m ( 1..12 ) { %> -<OPTION VALUE="<%= $m %>"><%= $m[$m-1] %> +<OPTION VALUE="<%= $m %>"<%= $m == $emonth ? ' SELECTED' : '' %>><%= $m[$m-1] %> <% } %> </SELECT> <SELECT NAME="eyear"> <% foreach my $y ( 1999 .. 2010 ) { %> -<OPTION VALUE="<%= $y %>"><%= $y %> +<OPTION VALUE="<%= $y %>"<%= $y == $eyear ? ' SELECTED' : '' %>><%= $y %> <% } %> </SELECT> |