X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fpager.html;fp=httemplate%2Felements%2Fpager.html;h=db9ff83bf9fcddbf2f2fba10aaf76630d848526c;hp=0000000000000000000000000000000000000000;hb=e283ab567e6890727e4d8e35c1d8097398678753;hpb=ef7bb336cc67f127fb1d77532ad3da1369c0ae36 diff --git a/httemplate/elements/pager.html b/httemplate/elements/pager.html new file mode 100644 index 000000000..db9ff83bf --- /dev/null +++ b/httemplate/elements/pager.html @@ -0,0 +1,42 @@ +<% + + my %opt = @_; + + my $pager = ''; + if ( $opt{'total'} != $opt{'num_rows'} && $opt{'maxrecords'} ) { + unless ( $opt{'offset'} == 0 ) { + $cgi->param('offset', $opt{'offset'} - $opt{'maxrecords'}); +%> + + Previous + +<% + } + my $page = 0; + for ( my $poff = 0; $poff < $opt{'total'}; $poff += $opt{'maxrecords'} ) { + $page++; + if ( $opt{'offset'} == $poff ) { +%> + + <%= $page %> + +<% + } else { + $cgi->param('offset', $poff); +%> + + $page + +<% + } + } + unless ( $opt{'offset'} + $opt{'maxrecords'} > $opt{'total'} ) { + $cgi->param('offset', $opt{'offset'} + $opt{'maxrecords'}); +%> + + Next + +<% + } + } +%>