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...
[
{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}
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;
[% 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 -->
<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">◄</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">►</span></a>
+ </span>
+ </div>
+ <div class="clear-both"></div>
+
<div id='acct_lists_prime'>
[% FOR bbag IN ctx.bookbags %]
<div class="bookbag-controls-holder">
<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>