[open-ils-commits] [GIT] Evergreen ILS branch master updated. a8338b6194cd5bded07210316ff9376a7865f5e0

Evergreen Git git at git.evergreen-ils.org
Tue Jul 10 17:28:01 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  a8338b6194cd5bded07210316ff9376a7865f5e0 (commit)
      from  81774d99db4de4dd5b118f898f23f919a5d395f2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a8338b6194cd5bded07210316ff9376a7865f5e0
Author: Bob Wicksall <bwicksall at pls-net.org>
Date:   Fri Jun 29 14:33:22 2012 -0400

    TPac: Add paging to My Lists
    
    - Added paging to My Lists based on the code from the Checkout History tab.
    - Fixed a bug where adding more than 10 items to the Temporary list failed
    - After adding paging renaming a list on page 2+ would fail.  Fixed.
    - Redirect after saving a list now leaves you on the same page
    - Paging was bleeding between My Lists, Holds History and Circ History.
      Fixed.
    
    List contents were also limited to the first 10.  I have upped the limit to
    1000 rather than having nested paging.  This should be revisited.
    
    CSV download of lists is still limited to the first 10.  Not sure where to
    fix this.
    
    Signed-off-by: Bob Wicksall <bwicksall at pls-net.org>
    Signed-off-by: Ben Shum <bshum at biblio.org>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
index 2346542..5038851 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
@@ -1620,6 +1620,11 @@ sub load_myopac_bookbags {
     my $self = shift;
     my $e = $self->editor;
     my $ctx = $self->ctx;
+    my $limit = $self->cgi->param('limit') || 10;
+    my $offset = $self->cgi->param('offset') || 0;
+
+    $ctx->{bookbags_limit} = $limit;
+    $ctx->{bookbags_offset} = $offset;
 
     my ($sorter, $modifier) = $self->_get_bookbag_sort_params("sort");
     $e->xact_begin; # replication...
@@ -1634,8 +1639,8 @@ sub load_myopac_bookbags {
         [
             {owner => $e->requestor->id, btype => 'bookbag'}, {
                 order_by => {cbreb => 'name'},
-                limit => $self->cgi->param('limit') || 10,
-                offset => $self->cgi->param('offset') || 0
+                limit => $limit,
+                offset => $offset
             }
         ],
         {substream => 1}
@@ -1653,48 +1658,50 @@ sub load_myopac_bookbags {
         my ($bookbag) =
             grep { $_->id eq $self->cgi->param("bbid") } @{$ctx->{bookbags}};
 
-        if (!$bookbag) {
-            $e->rollback;
-            return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
-        }
-
-        if ( ($self->cgi->param("action") || '') eq "editmeta") {
-            if (!$self->_update_bookbag_metadata($bookbag))  {
-                $e->rollback;
-                return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
-            } else {
-                $e->commit;
-                my $url = $self->ctx->{opac_root} . '/myopac/lists?bbid=' .
-                    $bookbag->id;
+        if ($bookbag) {
+            if ( ($self->cgi->param("action") || '') eq "editmeta") {
+                if (!$self->_update_bookbag_metadata($bookbag))  {
+                    $e->rollback;
+                    return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
+                } else {
+                    $e->commit;
+                    my $url = $self->ctx->{opac_root} . '/myopac/lists?bbid=' .
+                        $bookbag->id;
 
-                foreach my $param (('loc', 'qtype', 'query', 'sort')) {
-                    if ($self->cgi->param($param)) {
-                        $url .= ";$param=" . uri_escape($self->cgi->param($param));
+                    foreach my $param (('loc', 'qtype', 'query', 'sort', 'offset', 'limit')) {
+                        if ($self->cgi->param($param)) {
+                            $url .= ";$param=" . uri_escape($self->cgi->param($param));
+                        }
                     }
-                }
 
-                return $self->generic_redirect($url);
+                    return $self->generic_redirect($url);
+                }
             }
-        }
 
-        my $query = $self->_prepare_bookbag_container_query(
-            $bookbag->id, $sorter, $modifier
-        );
+            my $query = $self->_prepare_bookbag_container_query(
+                $bookbag->id, $sorter, $modifier
+            );
 
-        # XXX we need to limit the number of records per bbag; use third arg
-        # of bib_container_items_via_search() i think.
-        my $items = $U->bib_container_items_via_search($bookbag->id, $query)
-            or return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
+            # XXX Limiting to 1000 for now.  This way you should be able to see entire
+            # list contents.  Need to add paging here instead.
+            my $args = {
+                "limit" => 1000,
+                "offset" => 0
+            };
 
-        my (undef, @recs) = $self->get_records_and_facets(
-            [ map {$_->target_biblio_record_entry->id} @$items ],
-            undef, 
-            {flesh => '{mra}'}
-        );
+            my $items = $U->bib_container_items_via_search($bookbag->id, $query, $args)
+                or return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
+
+            my (undef, @recs) = $self->get_records_and_facets(
+                [ map {$_->target_biblio_record_entry->id} @$items ],
+                undef, 
+                {flesh => '{mra}'}
+            );
 
-        $ctx->{bookbags_marc_xml}{$_->{id}} = $_->{marc_xml} for @recs;
+            $ctx->{bookbags_marc_xml}{$_->{id}} = $_->{marc_xml} for @recs;
 
-        $bookbag->items($items);
+            $bookbag->items($items);
+        }
     }
 
     $e->rollback;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm
index 6cc6796..ba7a6ce 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm
@@ -38,7 +38,11 @@ sub fetch_mylist {
     if (@$list) {
         my ($sorter, $modifier) = $self->_get_bookbag_sort_params("anonsort");
         my $query = $self->_prepare_anonlist_sorting_query($list, $sorter, $modifier);
-        $list = $U->bib_record_list_via_search($query) or
+        my $args = {
+            "limit" => 1000,
+            "offset" => 0
+        };
+        $list = $U->bib_record_list_via_search($query, $args) or
             return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
     }
 
diff --git a/Open-ILS/src/templates/opac/myopac/lists.tt2 b/Open-ILS/src/templates/opac/myopac/lists.tt2
index efefd4d..88972c6 100644
--- a/Open-ILS/src/templates/opac/myopac/lists.tt2
+++ b/Open-ILS/src/templates/opac/myopac/lists.tt2
@@ -1,7 +1,10 @@
 [%  PROCESS "opac/parts/header.tt2";
     PROCESS "opac/parts/misc_util.tt2";
     WRAPPER "opac/parts/myopac/base.tt2";
-    myopac_page = "lists"  %]
+    myopac_page = "lists"  
+    limit = ctx.bookbags_limit;
+    offset = ctx.bookbags_offset;
+%]
 <div id='myopac_bookbag_div' style="padding:5px;">
 
     <!-- new list creation -->
@@ -52,6 +55,18 @@
     <h1>[% l("Your existing lists") %]</h1>
     [% INCLUDE "opac/parts/anon_list.tt2" %]
     [% IF ctx.bookbags.size %]
+    <div class="header_middle">
+        <span class="float-left">[% l('Saved Lists') %]</span>
+        <span class='float-left' style='padding-left: 10px;'>
+            <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {limit => limit, offset => (offset - limit)}) %]'
+                [% IF offset == 0 %] class='invisible' [% END %]><span class="nav_arrow_fix">&#9668;</span>[% l('Previous') %]</a>
+            [%# TODO: get total to prevent paging off then end of the list.. %]
+            <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {limit => limit, offset => (offset + limit)}) %]'
+               [% IF ctx.bookbags.size < limit %] class='invisible' [% END %] >[% l('Next') %]<span class="nav_arrow_fix">&#9658;</span></a>
+        </span>
+    </div>
+    <div class="clear-both"></div>
+
     <div id='acct_lists_prime'>
         [% FOR bbag IN ctx.bookbags %]
         <div class="bookbag-controls-holder">
@@ -133,6 +148,8 @@
                 <form method="POST">
                     <input type="hidden" name="bbid" value="[% bbag.id %]" />
                     <input type="hidden" name="action" value="editmeta" />
+                    <input type="hidden" name="limit" value="[% limit %]" />
+                    <input type="hidden" name="offset" value="[% offset %]" />
                     [%- INCLUDE "opac/parts/preserve_params.tt2"; %]
                     <table id="bbag-name-desc-form">
                         <tr>
diff --git a/Open-ILS/src/templates/opac/parts/myopac/base.tt2 b/Open-ILS/src/templates/opac/parts/myopac/base.tt2
index 763e65b..c433c6a 100644
--- a/Open-ILS/src/templates/opac/parts/myopac/base.tt2
+++ b/Open-ILS/src/templates/opac/parts/myopac/base.tt2
@@ -23,7 +23,7 @@
                     ELSE;
                         cls_which = "acct-tab-off";
                     END -%]
-                <a href="[% mkurl(ctx.opac_root _ '/myopac/' _ page.url, {}, ['bbid']) %]"
+                <a href="[% mkurl(ctx.opac_root _ '/myopac/' _ page.url, {}, ['bbid', 'offset', 'limit']) %]"
                     class="[% cls_which %]">[% page.name; %]</a>
                 [% END %]
             </div>

-----------------------------------------------------------------------

Summary of changes:
 .../lib/OpenILS/WWW/EGCatLoader/Account.pm         |   77 +++++++++++---------
 .../lib/OpenILS/WWW/EGCatLoader/Container.pm       |    6 ++-
 Open-ILS/src/templates/opac/myopac/lists.tt2       |   19 +++++-
 Open-ILS/src/templates/opac/parts/myopac/base.tt2  |    2 +-
 4 files changed, 66 insertions(+), 38 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list