fix sorting by a column advancing a page, RT#25740
authorIvan Kohler <ivan@freeside.biz>
Fri, 15 Nov 2013 23:14:49 +0000 (15:14 -0800)
committerIvan Kohler <ivan@freeside.biz>
Fri, 15 Nov 2013 23:14:49 +0000 (15:14 -0800)
httemplate/elements/pager.html

index a53300f..d360e64 100644 (file)
@@ -1,13 +1,8 @@
-% 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;
 %
 %   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>
-%
 %   }
 %
+%   $cgi->param('offset', $orig_offset); #so future $self_url invocations don't advance a page
+%
 % }
+<%init>
+
+my %opt = @_;
+
+my $orig_offset = $opt{'offset'};
+
+</%init>
+