]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
firewalllog.dat: Add First and Last links, for fast navigation in log lines
authorAlf Høgemark <alf@i100.no>
Sat, 8 Feb 2014 07:12:53 +0000 (08:12 +0100)
committerAlf Høgemark <alf@i100.no>
Wed, 12 Feb 2014 20:30:58 +0000 (21:30 +0100)
Add two links for navigating in log pages, one for going to the
first page and one for goint to the last page.

Introduce variable which points to the first log line to
display on the last possible page.

The commit contains hardcoded text for Last and First, and I
am also uncertain how spaces between links should be handled.
So this should be improved based on feedback.

html/cgi-bin/logs.cgi/firewalllog.dat

index 73e62eab07a37ec869e9b8711c7f6ca591af83eb..2711eba3b36eb7907c0fc0108f8f84b54149a2fb 100644 (file)
@@ -285,7 +285,8 @@ END
 &Header::openbox('100%', 'left', $Lang::tr{'log'});
 print "<p><b>$Lang::tr{'firewall hits'} $date: $lines</b></p>";
 
-$start = $lines - ${Header::viewsize} if ($start >= $lines - ${Header::viewsize});
+my $lastPageIndex = $lines - ${Header::viewsize};
+$start = $lastPageIndex if ($start >= $lastPageIndex);
 $start = 0 if ($start < 0);
 
 my $prev;
@@ -297,7 +298,7 @@ my $prev;
     }
                                     
 my $next;
-    if ($start == $lines - ${Header::viewsize}) {
+    if ($start == $lastPageIndex) {
         $next = -1;
     } else {
         $next = $start + ${Header::viewsize};
@@ -402,16 +403,18 @@ END
 
 print "<td align='center' width='50%'>";
 if ($prev != -1) {
+        print "<a href='/cgi-bin/logs.cgi/firewalllog.dat?0,$cgiparams{'MONTH'},$cgiparams{'DAY'}'>First</a> "; 
         print "<a href='/cgi-bin/logs.cgi/firewalllog.dat?$prev,$cgiparams{'MONTH'},$cgiparams{'DAY'}'>$Lang::tr{'older'}</a>"; }
 else {
-        print "$Lang::tr{'older'}"; }
+        print "First $Lang::tr{'older'}"; }
 print "</td>\n";
 
 print "<td align='center' width='50%'>";
 if ($next >= 0) {
-        print "<a href='/cgi-bin/logs.cgi/firewalllog.dat?$next,$cgiparams{'MONTH'},$cgiparams{'DAY'}'>$Lang::tr{'newer'}</a>"; }
+        print "<a href='/cgi-bin/logs.cgi/firewalllog.dat?$next,$cgiparams{'MONTH'},$cgiparams{'DAY'}'>$Lang::tr{'newer'}</a> ";
+        print "<a href='/cgi-bin/logs.cgi/firewalllog.dat?$lastPageIndex,$cgiparams{'MONTH'},$cgiparams{'DAY'}'>Last</a>"; }      
 else {
-        print "$Lang::tr{'newer'}"; }
+        print "$Lang::tr{'newer'} Last"; }
 print "</td>\n";
 
 print <<END