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

index 3bd5cc4..da895fa 100644 (file)
@@ -540,8 +540,11 @@ sub load_myopac_hold_history {
     my $self = shift;
     my $e = $self->editor;
     my $ctx = $self->ctx;
-    my $limit = $self->cgi->param('limit');
-    my $offset = $self->cgi->param('offset');
+    my $limit = $self->cgi->param('limit') || 15;
+    my $offset = $self->cgi->param('offset') || 0;
+    $ctx->{hold_history_limit} = $limit;
+    $ctx->{hold_history_offset} = $offset;
+
 
     my $holds = $e->json_query({
         from => ['action.usr_visible_holds', $e->requestor->id],
index 62429fe..7375443 100644 (file)
@@ -2,8 +2,8 @@
     PROCESS "default/opac/parts/marc_misc.tt2";
     WRAPPER "default/opac/parts/myopac/base.tt2";
     myopac_page = "holds"  
-    limit = CGI.param('limit') || 25;
-    offset = CGI.param('offset') || 0;
+    limit = ctx.hold_history_limit;
+    offset = ctx.hold_history_offset;
 %]
 
 <div id='myopac_holds_div'>
     </div>
 
     <div class="header_middle">
-        <span id="acct_holds_header" style="float:left;">
-            [% l("Previously Held Items") %]
+        <span style="float:left;">[% l("Previously Held Items") %]</span>
+        <span class='float-left' style='padding-left: 10px;'>
+            <a href='hold_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='hold_history?limit=[% limit %]&offset=[% offset + limit %]'
+               [% IF ctx.holds.size < limit %] class='invisible' [% END %] >[% l('Next') %]</a>
         </span>
         <span style="float:right;">
             <a class="hide_me" href="#">Export List</a>