repaired circ history paging
authorberick <berick@esilibrary.com>
Thu, 7 Apr 2011 20:27:22 +0000 (16:27 -0400)
committerberick <berick@esilibrary.com>
Thu, 7 Apr 2011 20:27:22 +0000 (16:27 -0400)
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
Open-ILS/web/templates/default/opac/myopac/circ_history.tt2

index 9dee8b9..3bd5cc4 100644 (file)
@@ -506,9 +506,12 @@ sub load_myopac_circ_history {
     my $self = shift;
     my $e = $self->editor;
     my $ctx = $self->ctx;
-    my $limit = $self->cgi->param('limit');
+    my $limit = $self->cgi->param('limit') || 15;
     my $offset = $self->cgi->param('offset') || 0;
 
+    $ctx->{circ_history_limit} = $limit;
+    $ctx->{circ_history_offset} = $offset;
+
     my $circs = $e->json_query({
         from => ['action.usr_visible_circs', $e->requestor->id],
         #limit => $limit || 25,
@@ -526,7 +529,7 @@ sub load_myopac_circ_history {
     @ids = @ids[$offset..($offset + $limit - 1)] if $limit;
     @ids = grep { defined $_ } @ids;
 
-    $ctx->{circs} = $self->fetch_user_circs(1, \@ids, $limit, $offset);
+    $ctx->{circs} = $self->fetch_user_circs(1, \@ids);
     #$ctx->{circs} = $self->fetch_user_circs(1, [map { $_->{id} } @$circs], $limit, $offset);
 
     return Apache2::Const::OK;
index 28d4b2a..ed4b8ee 100644 (file)
@@ -1,9 +1,9 @@
 [%  PROCESS "default/opac/parts/header.tt2";
     PROCESS "default/opac/parts/marc_misc.tt2";
     WRAPPER "default/opac/parts/myopac/base.tt2";
-    myopac_page = "circs";
-    limit = CGI.param('limit') || 25;
-    offset = CGI.param('offset') || 0;
+    myopac_page = "circs"
+    limit = ctx.circ_history_limit;
+    offset = ctx.circ_history_offset;
 %]
 
 <div style="padding:0px;">
     <div class="header_middle">
         <span class="float-left">[% l('Previously Checked Out Items') %]</span>
         <span class='float-left' style='padding-left: 10px;'>
-            [% IF offset > 0 %]
-            <a href='circ_history?limit=[% limit %]&offset=[% offset - 1 %]'>[% l('Previous') %]</a>
-            [% END %]
-            [% IF ctx.circs.size == limit %]
+            <a href='circ_history?limit=[% limit %]&offset=[% offset - limit %]'
+                [% IF offset == 0 %] class='invisible' [% END %]>[% l('Previous') %]</a>
             [%# TODO: get total to prevent paging off then end of the list.. %]
-            <a href='circ_history?limit=[% limit %]&offset=[% offset + 1 %]'>[% l('Next') %]</a>
-            [% END %]
+            <a href='circ_history?limit=[% limit %]&offset=[% offset + limit %]'
+               [% IF ctx.circs.size < limit %] class='invisible' [% END %] >[% l('Next') %]</a>
         </span>
         <span class="float-right">
             <a class="hide_me" href="#">[% l('Export List') %]</a>