Revision: 8024 http://sourceforge.net/p/ipcop/svn/8024 Author: owes Date: 2016-01-02 15:54:36 +0000 (Sat, 02 Jan 2016) Log Message: ----------- Add input field for year so jumping backward works properly. Add button to go back to today.
Modified Paths: -------------- ipcop/trunk/html/cgi-bin/logsystem.cgi Modified: ipcop/trunk/html/cgi-bin/logsystem.cgi =================================================================== --- ipcop/trunk/html/cgi-bin/logsystem.cgi 2016-01-01 15:33:23 UTC (rev 8023) +++ ipcop/trunk/html/cgi-bin/logsystem.cgi 2016-01-02 15:54:36 UTC (rev 8024) @@ -16,7 +16,7 @@ # along with IPCop. If not, see <http://www.gnu.org/licenses/>. # # (c) The SmoothWall Team -# Copyright (c) 2001-2015 The IPCop Team +# Copyright (c) 2001-2016 The IPCop Team # # $Id$ # @@ -46,10 +46,11 @@ my $dow = $now[6]; my $doy = $now[7]; my $tdoy = $now[7]; -my $year = $now[5] + 1900; +my $thisyear = $now[5] + 1900; -$cgiparams{'DAY'} = $now[3]; -$cgiparams{'MONTH'} = $now[4]; +$cgiparams{'DAY'} = $now[3]; # day. 0 (=all), 1, ... , 31 +$cgiparams{'MONTH'} = $now[4]; # month. 0 (=January), 1 (=February), ... , 11 (=December) +$cgiparams{'YEAR'} = $now[5]+1900; # year. $cgiparams{'ACTION'} = ''; $cgiparams{'SECTION'} = 'ipcop'; @@ -102,40 +103,47 @@ if ($ENV{'QUERY_STRING'} && $cgiparams{'ACTION'} ne $Lang::tr{'update'}) { @temp_then = split(',', $ENV{'QUERY_STRING'}); $start = $temp_then[0]; - $cgiparams{'MONTH'} = $temp_then[1]; - $cgiparams{'DAY'} = $temp_then[2]; - $cgiparams{'SECTION'} = $temp_then[3]; + $cgiparams{'YEAR'} = $temp_then[1]; + $cgiparams{'MONTH'} = $temp_then[2]; + $cgiparams{'DAY'} = $temp_then[3]; + $cgiparams{'SECTION'} = $temp_then[4]; } if (!($cgiparams{'MONTH'} =~ /^(0|1|2|3|4|5|6|7|8|9|10|11)$/) || !($cgiparams{'DAY'} =~ /^(0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)$/)) { + $cgiparams{'YEAR'} = $now[5]+1900; + $cgiparams{'MONTH'} = $now[4]; $cgiparams{'DAY'} = $now[3]; - $cgiparams{'MONTH'} = $now[4]; } elsif ($cgiparams{'ACTION'} eq '>>') { - @temp_then = &General::calculatedate($year, $cgiparams{'MONTH'}, $cgiparams{'DAY'}, 1); - $year = $temp_then[5]+1900; + @temp_then = &General::calculatedate($cgiparams{'YEAR'}, $cgiparams{'MONTH'}, $cgiparams{'DAY'}, 1); + $cgiparams{'YEAR'} = $temp_then[5]+1900; $cgiparams{'MONTH'} = $temp_then[4]; $cgiparams{'DAY'} = $temp_then[3]; } +elsif ($cgiparams{'ACTION'} eq $Lang::tr{'day today'}) { + $cgiparams{'YEAR'} = $now[5]+1900; + $cgiparams{'MONTH'} = $now[4]; + $cgiparams{'DAY'} = $now[3]; +} elsif ($cgiparams{'ACTION'} eq '<<') { - @temp_then = &General::calculatedate($year, $cgiparams{'MONTH'}, $cgiparams{'DAY'}, -1); - $year = $temp_then[5]+1900; + @temp_then = &General::calculatedate($cgiparams{'YEAR'}, $cgiparams{'MONTH'}, $cgiparams{'DAY'}, -1); + $cgiparams{'YEAR'} = $temp_then[5]+1900; $cgiparams{'MONTH'} = $temp_then[4]; $cgiparams{'DAY'} = $temp_then[3]; } else { - @temp_then = &General::validatedate(0, $cgiparams{'MONTH'}, $cgiparams{'DAY'}); - $year = $temp_then[5]+1900; + @temp_then = &General::validatedate($cgiparams{'YEAR'}, $cgiparams{'MONTH'}, $cgiparams{'DAY'}); + $cgiparams{'YEAR'} = $temp_then[5]+1900; $cgiparams{'MONTH'} = $temp_then[4]; $cgiparams{'DAY'} = $temp_then[3]; } # Date to display my $date; -$date = sprintf("%d-%02d-%02d", $year, $cgiparams{'MONTH'}+1, $cgiparams{'DAY'}); +$date = sprintf("%d-%02d-%02d", $cgiparams{'YEAR'}, $cgiparams{'MONTH'}+1, $cgiparams{'DAY'}); my $monthstr = $General::shortMonths[ $cgiparams{'MONTH'} ]; my $daystr = $cgiparams{'DAY'} == 0 ? '..' : $cgiparams{'DAY'} <= 9 ? " $cgiparams{'DAY'}" : "$cgiparams{'DAY'}"; @@ -159,7 +167,7 @@ $loop = 0; } else { - $filestr = sprintf("/var/log/messages-%d%02d%02d", $year, $cgiparams{'MONTH'}+1, $day_extension); + $filestr = sprintf("/var/log/messages-%d%02d%02d", $cgiparams{'YEAR'}, $cgiparams{'MONTH'}+1, $day_extension); $filestr = "${filestr}.gz" if -f "${filestr}.gz"; } @@ -249,22 +257,21 @@ <form method='post' action='$ENV{'SCRIPT_NAME'}'> <table width='100%'> <tr> - <td width='25%' class='base' nowrap='nowrap'>$Lang::tr{'section'}: - <select name='SECTION' onchange='this.form.submit()'> + <td width='50%' class='base' nowrap='nowrap'>$Lang::tr{'year'}: + <select name='YEAR'> END ; -foreach $section (sort {$trsections{$a} cmp $trsections{$b}} keys %sections) { +for (my $year = $thisyear-2; $year <= $thisyear; $year++) { print "\t<option "; - if ($section eq $cgiparams{'SECTION'}) { + if ($year == $cgiparams{'YEAR'}) { print "selected='selected' "; } - print "value='$section'>$trsections{$section}</option>\n"; + print "value='$year'>$year</option>\n"; } print <<END - </select> - </td> - <td width='35%' class='base' nowrap='nowrap'> $Lang::tr{'month'}: - <select name='MONTH'> + </select> + $Lang::tr{'month'}: + <select name='MONTH'> END ; for (my $month = 0; $month < 12; $month++) { @@ -275,9 +282,9 @@ print "value='$month'>$Lang::tr{$General::longMonths[$month]}</option>\n"; } print <<END - </select> - $Lang::tr{'day'}: - <select name='DAY'> + </select> + $Lang::tr{'day'}: + <select name='DAY'> END ; print "<option value='0'>$Lang::tr{'all'}</option>\n"; @@ -289,19 +296,39 @@ print "value='$day'>$day</option>\n"; } print <<END - </select> - </td> - <td width='35%' align='center'> - <input type='submit' name='ACTION' title='$Lang::tr{'day before'}' value='<<' /> - <input type='submit' name='ACTION' title='$Lang::tr{'day after'}' value='>>' /> - <input type='submit' name='ACTION' value='$Lang::tr{'update'}' /> - <input type='submit' name='ACTION' value='$Lang::tr{'export'}' /> - </td> + </select> + </td> + <td width='45%' align='center'> + <input type='submit' name='ACTION' title='$Lang::tr{'day before'}' value='<<' /> + <input type='submit' name='ACTION' value='$Lang::tr{'day today'}' /> + <input type='submit' name='ACTION' title='$Lang::tr{'day after'}' value='>>' /> + <input type='submit' name='ACTION' value='$Lang::tr{'update'}' /> + <input type='submit' name='ACTION' value='$Lang::tr{'export'}' /> + </td> <td class='onlinehelp'> <a href='${General::adminmanualurl}/logs-system.html' target='_blank'><img src='/images/web-support.png' alt='$Lang::tr{'online help en'}' title='$Lang::tr{'online help en'}' /></a> </td> </tr> </table> +<hr /> +<table> +<tr> + <td class='base' nowrap='nowrap'>$Lang::tr{'section'}: + <select name='SECTION' onchange='this.form.submit()'> +END + ; +foreach $section (sort {$trsections{$a} cmp $trsections{$b}} keys %sections) { + print "\t<option "; + if ($section eq $cgiparams{'SECTION'}) { + print "selected='selected' "; + } + print "value='$section'>$trsections{$section}</option>\n"; +} +print <<END + </select> + </td> +</tr> +</table> </form> END ; @@ -394,7 +421,7 @@ ; if ($prev != -1) { - print "<a href='/cgi-bin/logsystem.cgi?$prev,$cgiparams{'MONTH'},$cgiparams{'DAY'},$cgiparams{'SECTION'}'>$Lang::tr{'older'}</a>"; + print "<a href='/cgi-bin/logsystem.cgi?$prev,$cgiparams{'YEAR'},$cgiparams{'MONTH'},$cgiparams{'DAY'},$cgiparams{'SECTION'}'>$Lang::tr{'older'}</a>"; } else { print "$Lang::tr{'older'}"; @@ -403,7 +430,7 @@ print "<td align='center' width='50%'>"; if ($next >= 0) { - print "<a href='/cgi-bin/logsystem.cgi?$next,$cgiparams{'MONTH'},$cgiparams{'DAY'},$cgiparams{'SECTION'}'>$Lang::tr{'newer'}</a>"; + print "<a href='/cgi-bin/logsystem.cgi?$next,$cgiparams{'YEAR'},$cgiparams{'MONTH'},$cgiparams{'DAY'},$cgiparams{'SECTION'}'>$Lang::tr{'newer'}</a>"; } else { print "$Lang::tr{'newer'}"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ _______________________________________________ Ipcop-svn mailing list Ipcop-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipcop-svn