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;
$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;
}
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 => {
END %]</td>
</tr>
[% END %]
+ <tr>
+ [% IF ctx.copy_offset > 0;
+ new_offset = ctx.copy_offset - ctx.copy_limit;
+ IF new_offset < 0; new_offset = 0; END %]
+ <td>
+ <a href="[% ctx.opac_root %]/record/[% record.id %]?copy_offset=[% new_offset %]©_limit=[% ctx.copy_limit %]">« [%
+ l('Previous [_1]', ctx.copy_offset - new_offset)
+ %]</a>
+ </td>
+ [% END %]
+ [% IF ctx.copies.size >= ctx.copy_limit %]
+ <td>
+ <a href="[% ctx.opac_root %]/record/[% record.id %]?copy_offset=[% ctx.copy_offset + ctx.copy_limit %]©_limit=[% ctx.copy_limit %]">[%
+ l('Next [_1]', ctx.copy_limit)
+ %] »</a>
+ </td>
+ [% END %]
+ </tr>
</tbody>
</table>