summaryrefslogtreecommitdiff
path: root/httemplate/elements/pager.html
blob: db9ff83bf9fcddbf2f2fba10aaf76630d848526c (plain)
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
32
33
34
35
36
37
38
39
40
41
42
<%

  my %opt = @_;

  my $pager = '';
  if ( $opt{'total'} != $opt{'num_rows'} && $opt{'maxrecords'} ) {
    unless ( $opt{'offset'} == 0 ) {
      $cgi->param('offset', $opt{'offset'} - $opt{'maxrecords'});
%>

      <A HREF="<%= $cgi->self_url %>"><B><FONT SIZE="+1">Previous</FONT></B></A>

<%
    }
    my $page = 0;
    for ( my $poff = 0; $poff < $opt{'total'}; $poff += $opt{'maxrecords'} ) {
      $page++;
      if ( $opt{'offset'} == $poff ) {
%>

        <FONT SIZE="+2"><%= $page %></FONT>

<%
      } else {
        $cgi->param('offset', $poff);
%>

        <A HREF="<%= $cgi->self_url %>">$page</A>

<%
      }
    }
    unless ( $opt{'offset'} + $opt{'maxrecords'} > $opt{'total'} ) {
      $cgi->param('offset', $opt{'offset'} + $opt{'maxrecords'});
%>

      <A HREF="<%= $cgi->self_url %>"><B><FONT SIZE="+1">Next</FONT></B></A>

<%
    }
  }
%>