my $e = $self->editor;
my $ctx = $self->ctx;
+ my $sorter = $self->cgi->param("sort");
+ my $modifier = ($sorter =~ /\.(.+$)/) ? $1 : undef;
+
$e->xact_begin; # replication...
my $rv = $self->load_mylist;
foreach my $bookbag (@{$ctx->{bookbags}}) {
my $query = sprintf(
- "container(bre,bookbag,%d,%s)", $bookbag->id, $e->authtoken
+ "container(bre,bookbag,%d,%s)%s%s",
+ $bookbag->id, $e->authtoken,
+ ($sorter ? " sort($sorter)" : ""),
+ ($modifier ? "#$modifier" : "")
);
my $results = $U->simplereq(
"open-ils.search", "open-ils.search.biblio.multiclass.query",
# now we have record ids, but we need the cbrebi objects too
my $record_id_list = [ map { pop @$_ } @{$results->{ids}} ];
+ # We're done with this bookbag if it has no items
+ unless (@$record_id_list) {
+ $bookbag->items([]);
+ next;
+ }
+
my $items = $e->search_container_biblio_record_entry_bucket_item([
{
"target_biblio_record_entry" => $record_id_list,
</table>
</form>
+ <h2>[% l("Your existing lists") %]</h2>
+ <p>
+ <form method="GET">
+ <label for="opac.result.sort">[% l("Sort list items by: ") %]</label>
+ [% INCLUDE "default/opac/parts/filtersort.tt2"
+ value=CGI.param('sort') %]
+ <input type="submit" value="[% l('Sort') %]" />
+ </form>
+ </p>
+
[% INCLUDE "default/opac/parts/anon_list.tt2" %]
[% IF ctx.bookbags.size %]
<div id='acct_lists_prime'>
inputs[i].checked = this.checked;}"/>
</td>
- <td width="49%" style="padding-left: 5px;">[% l('Title') %]</td>
- <td width="49%">[% l('Author(s)') %]</td>
+ <td width="49%" style="padding-left: 5px;">
+ <a href="[% ctx.opac_root %]/myopac/lists?sort=titlesort">[% l('Title') %]</a>
+ </td>
+ <td width="49%">
+ <a href="[% ctx.opac_root %]/myopac/lists?sort=authorsort">[% l('Author(s)') %]</a>
+ </td>
<td width="1%" class="nowrap">
<select class="opac-auto-179" name="action">
<option>[% l('-- Actions for this list --') %]</option>
</tbody>
</table>
</form>
- <br /><br />
+ <hr /><br />
</div>
[% END %]
</div>
<tr>
<td align='center' width='100%'>
[% INCLUDE "default/opac/parts/filtersort.tt2"
- value=CGI.param('sort') %]
+ value=CGI.param('sort') class='results_header_sel' %]
</td>
</tr>
</table>
-<select class="results_header_sel" id='opac.result.sort' name="sort">
+<select [% class ? ('class="' _ class _ '"') : '' %] id="opac.result.sort" name="[% name || 'sort' %]">
<option value=''>[% l("Sort by Relevance") %]</option>
<optgroup label='[% l("Sort by Title") %]'>
<option value='titlesort'[% value == 'titlesort' ? ' selected="selected"' : '' %]>[% l("Title: A to Z") %]</option>
- <option value='titlesort.desc'[% value == 'titlesort.desc' ? ' selected="selected"' : '' %]>[% l("Title: Z to A") %]</option>
+ <option value='titlesort.descending'[% value == 'titlesort.descending' ? ' selected="selected"' : '' %]>[% l("Title: Z to A") %]</option>
</optgroup>
<optgroup label='[% l("Sort by Author") %]'>
<option value='authorsort'[% value == 'authorsort' ? ' selected="selected"' : '' %]>[% l("Author: A to Z") %]</option>
- <option value='authorsort.desc'[% value == 'authorsort.desc' ? ' selected="selected"' : '' %]>[% l("Author: Z to A") %]</option>
+ <option value='authorsort.descending'[% value == 'authorsort.descending' ? ' selected="selected"' : '' %]>[% l("Author: Z to A") %]</option>
</optgroup>
<optgroup label='[% l("Sort by Publication Date") %]'>
- <option value='pubdate.desc'[% value == 'pubdate.desc' ? ' selected="selected"' : '' %]>[% l("Date: Newest to Oldest") %]</option>
+ <option value='pubdate.descending'[% value == 'pubdate.descending' ? ' selected="selected"' : '' %]>[% l("Date: Newest to Oldest") %]</option>
<option value='pubdate'[% value == 'pubdate' ? ' selected="selected"' : '' %]>[% l("Date: Oldest to Newest") %]</option>
</optgroup>
</select>