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

Evergreen Git git at git.evergreen-ils.org
Wed May 9 10:03: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  5eaca7025ae869baf1ce6df026fb212eb13872c6 (commit)
       via  2c99e49aa500eb6a91574968ab30e5768820bbce (commit)
      from  fe4262c7fbbc01f167b04a5916800a62b823c6cd (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 5eaca7025ae869baf1ce6df026fb212eb13872c6
Author: Bill Erickson <berick at esilibrary.com>
Date:   Fri May 4 12:07:35 2012 -0400

    TPAC: repair staff client End link for showing last record
    
    In the embedded TPAC, when staff clicks the End link in the record
    detail page to jump to the last record in the search results, it now
    makes an intermediate jump through search code, which locates the last
    record in the set (via CGI param find_last) then redirects to the record
    detail page for the last record.  With this approach, we don't have to
    pre-fetch the entire set of record IDs just to render the paging links.
    Tip o' the hat to Mike R. for the design suggestion.
    
    https://bugs.launchpad.net/evergreen/+bug/984070
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
index b10f312..53365e0 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
@@ -265,6 +265,9 @@ sub load_rresults {
     my $ctx = $self->ctx;
     my $e = $self->editor;
 
+    # find the last record in the set, then redirect
+    my $find_last = $cgi->param('find_last');
+
     $self->timelog("Loading results");
     # load bookbag metadata, if requested.
     if (my $bbag_err = $self->load_rresults_bookbag) {
@@ -316,7 +319,7 @@ sub load_rresults {
 
     $self->get_staff_search_settings;
 
-    if ($ctx->{staff_saved_search_size}) {
+    if (!$find_last and $ctx->{staff_saved_search_size}) {
         my ($key, $list) = $self->staff_save_search($query);
         if ($key) {
             $self->apache->headers_out->add(
@@ -390,6 +393,15 @@ sub load_rresults {
     $ctx->{hit_count} = $results->{count};
     $ctx->{parsed_query} = $results->{parsed_query};
 
+    if ($find_last) {
+        # redirect to the record detail page for the last record in the results
+        my $rec_id = pop @$rec_ids;
+        $cgi->delete('find_last');
+        my $url = $cgi->url(-full => 1, -path => 1, -query => 1);
+        $url =~ s|/results|/record/$rec_id|;
+        return $self->generic_redirect($url);
+    }
+
     return Apache2::Const::OK if @$rec_ids == 0 or $internal;
 
     $self->load_rresults_bookbag_item_notes($rec_ids) if $ctx->{bookbag};
diff --git a/Open-ILS/src/templates/opac/parts/js.tt2 b/Open-ILS/src/templates/opac/parts/js.tt2
index 517b230..df50a03 100644
--- a/Open-ILS/src/templates/opac/parts/js.tt2
+++ b/Open-ILS/src/templates/opac/parts/js.tt2
@@ -12,7 +12,7 @@
                 "[% ctx.prev_rec_url || '' %]",
                 "[% ctx.next_rec_url || '' %]",
                 "[% mkurl(ctx.first_search_record, {page => 0}) %]",
-                "[% mkurl(ctx.last_search_record, {page => POSIX.floor(ctx.hit_count / ctx.page_size)}) %]",
+                "[% mkurl(ctx.opac_root _ '/results', {find_last => 1, page => POSIX.floor(ctx.hit_count / ctx.page_size)}) %]",
                 "[% mkurl(ctx.opac_root _ '/results', {}, ['expand','cnoffset']) %]"
             );
         </script>

commit 2c99e49aa500eb6a91574968ab30e5768820bbce
Author: Bill Erickson <berick at esilibrary.com>
Date:   Sat Apr 28 14:12:53 2012 -0400

    TPAC: more intelligent detail paging #1
    
    Only fetch a small page of records at a time when generating the paging
    links in the detail page.
    
    Part 2 will be to repair the 'Last' record button in the staff client,
    which will not work with this change.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
index 48231d3..b10f312 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
@@ -10,11 +10,6 @@ use Data::Dumper;
 $Data::Dumper::Indent = 0;
 my $U = 'OpenILS::Application::AppUtils';
 
-# when fetching "all" search results for staff client 
-# start/end paging, fetch this many IDs at most
-my $all_recs_limit = 10000;
-
-
 sub _prepare_biblio_search_basics {
     my ($cgi) = @_;
 
@@ -311,9 +306,9 @@ sub load_rresults {
     $ctx->{page_size} = $limit;
     $ctx->{search_page} = $page;
 
-    # fetch the first hit from the next page
+    # fetch this page plus the first hit from the next page
     if ($internal) {
-        $limit = $all_recs_limit;
+        $limit = $offset + $limit + 1;
         $offset = 0;
     }
 
@@ -580,7 +575,7 @@ sub marc_expert_search {
     return Apache2::Const::OK if @$query == 0;
 
     if ($args{internal}) {
-        $limit = $all_recs_limit;
+        $limit = $offset + $limit + 1;
         $offset = 0;
     }
 
diff --git a/Open-ILS/src/templates/opac/parts/record/body.tt2 b/Open-ILS/src/templates/opac/parts/record/body.tt2
index 577f7f9..b7efd51 100644
--- a/Open-ILS/src/templates/opac/parts/record/body.tt2
+++ b/Open-ILS/src/templates/opac/parts/record/body.tt2
@@ -18,7 +18,8 @@
             [%
                 IF ctx.prev_search_record;
                     prev_args = {};
-                    IF ctx.search_result_index % (ctx.page_size + 1) == 0; # first record in the page
+                    IF ctx.search_page > 0 AND 
+                            ctx.search_result_index % ((ctx.page_size * ctx.search_page)) == 0; # first record in the page
                         prev_args.page = ctx.search_page - 1;
                     END;
                     ctx.prev_rec_url = mkurl(ctx.prev_search_record, prev_args, stop_parms);
@@ -30,7 +31,7 @@
             [% 
                 IF ctx.next_search_record;
                     next_args = {};
-                    IF ctx.page_size == ctx.search_result_index + 1;
+                    IF (ctx.page_size * (ctx.search_page + 1)) == ctx.search_result_index + 1;
                         next_args.page = ctx.search_page + 1;
                     END;
                     ctx.next_rec_url = mkurl(ctx.next_search_record, next_args, stop_parms);

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

Summary of changes:
 .../perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm |   25 ++++++++++++-------
 Open-ILS/src/templates/opac/parts/js.tt2           |    2 +-
 Open-ILS/src/templates/opac/parts/record/body.tt2  |    5 ++-
 3 files changed, 20 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list