From 2c99e49aa500eb6a91574968ab30e5768820bbce Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Sat, 28 Apr 2012 14:12:53 -0400 Subject: [PATCH] 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 Signed-off-by: Ben Shum --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 11 +++-------- Open-ILS/src/templates/opac/parts/record/body.tt2 | 5 +++-- 2 files changed, 6 insertions(+), 10 deletions(-) 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 48231d3010..b10f312baa 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 577f7f919f..b7efd51790 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); -- 2.43.2