From 5631bec8ea3a6e9df5dd1a9a611b3c3cdfd930cd Mon Sep 17 00:00:00 2001 From: senator Date: Wed, 16 Feb 2011 17:23:16 -0500 Subject: [PATCH] crummy paging in the record pages' copy listing --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm | 10 ++++++---- .../templates/default/opac/parts/record/summary.tt2 | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm index 71c7bd40c2..c3716d52b0 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -15,8 +15,8 @@ sub load_record { my $org = $self->cgi->param('loc') || $self->ctx->{aou_tree}->()->id; my $depth = $self->cgi->param('depth') || 0; - my $copy_limit = $self->cgi->param('copy_limit'); - my $copy_offset = $self->cgi->param('copy_offset'); + my $copy_limit = int($self->cgi->param('copy_limit') || 20); + my $copy_offset = int($self->cgi->param('copy_offset') || 0); my $rec_id = $self->ctx->{page_args}->[0] or return Apache2::Const::HTTP_BAD_REQUEST; @@ -30,6 +30,8 @@ sub load_record { $self->ctx->{marc_xml} = XML::LibXML->new->parse_string($self->ctx->{record}->marc); $self->ctx->{copies} = $copy_rec->gather(1); + $self->ctx->{copy_limit} = $copy_limit; + $self->ctx->{copy_offset} = $copy_offset; return Apache2::Const::OK; } @@ -39,8 +41,8 @@ sub mk_copy_query { my $rec_id = shift; my $org = shift; my $depth = shift; - my $copy_limit = shift || 20; - my $copy_offset = shift || 0; + my $copy_limit = shift; + my $copy_offset = shift; my $query = { select => { diff --git a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 index 05c73f3d93..b28cf666fb 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 @@ -174,6 +174,24 @@ END %] [% END %] + + [% IF ctx.copy_offset > 0; + new_offset = ctx.copy_offset - ctx.copy_limit; + IF new_offset < 0; new_offset = 0; END %] + + « [% + l('Previous [_1]', ctx.copy_offset - new_offset) + %] + + [% END %] + [% IF ctx.copies.size >= ctx.copy_limit %] + + [% + l('Next [_1]', ctx.copy_limit) + %] » + + [% END %] + -- 2.11.0