}
sub _get_bookbag_sort_params {
- my ($self) = @_;
+ my ($self, $param_name) = @_;
# The interface that feeds this cgi parameter will provide a single
# argument for a QP sort filter, and potentially a modifier after a period.
# In practice this means the "sort" parameter will be something like
# "titlesort" or "authorsort.descending".
- my $sorter = $self->cgi->param("sort") || "";
+ my $sorter = $self->cgi->param($param_name) || "";
my $modifier;
if ($sorter) {
$sorter =~ s/^(.*?)\.(.*)/$1/;
);
}
+sub _prepare_anonlist_sorting_query {
+ my ($self, $list, $sorter, $modifier) = @_;
+
+ return sprintf(
+ "record_list(%s)%s%s",
+ join(",", @$list),
+ ($sorter ? " sort($sorter)" : ""),
+ ($modifier ? "#$modifier" : "")
+ );
+}
+
+
sub load_myopac_prefs_settings {
my $self = shift;
my $e = $self->editor;
my $ctx = $self->ctx;
- my ($sorter, $modifier) = $self->_get_bookbag_sort_params;
+ my ($sorter, $modifier) = $self->_get_bookbag_sort_params("sort");
$e->xact_begin; # replication...
my $rv = $self->load_mylist;
return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
}
- # Here is the loop that uses search to find the bib records in each
- # bookbag. XXX This should be parallelized. Should this be done
- # with OpenSRF::MultiSession, or is it enough to use OpenSRF::AppSession
- # and call ->request() without calling ->gather() on any of those objects
- # until all the requests have been issued?
+ # If the user wants a specific bookbag's items, load them.
+ # XXX add bookbag item paging support
+
+ if ($self->cgi->param("id")) {
+ my ($bookbag) =
+ grep { $_->id eq $self->cgi->param("id") } @{$ctx->{bookbags}};
+
+ if (!$bookbag) {
+ $e->rollback;
+ return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
+ }
- foreach my $bookbag (@{$ctx->{bookbags}}) {
my $query = $self->_prepare_bookbag_container_query(
$bookbag->id, $sorter, $modifier
);
}
} elsif ($action eq 'save_notes') {
$success = $self->update_bookbag_item_notes;
+ $url .= "&id=" . uri_escape($cgi->param("id")) if $cgi->param("id");
}
return $self->generic_redirect($url) if $success;
my $id = int($self->cgi->param("list"));
- my ($sorter, $modifier) = $self->_get_bookbag_sort_params;
+ my ($sorter, $modifier) = $self->_get_bookbag_sort_params("sort");
my $item_search =
$self->_prepare_bookbag_container_query($id, $sorter, $modifier);
<!-- new list creation -->
<form action="[% ctx.opac_root %]/myopac/list/update" method="POST" id="create_form">
- <h2>[% l('Create new list') %]</h2><a name="createnewlist"></a>
+ <h1>[% l('Create new list') %]</h1><a name="createnewlist"></a>
<table cellpadding="0" border="0" id="list_create_table">
<tr>
<td>
</table>
</form>
- <h2>[% l("Your existing lists") %]</h2>
- <p>
- <form method="GET">
- <label for="opac.result.sort">[% l("Sort list items by: ") %]</label>
- [% INCLUDE "opac/parts/filtersort.tt2"
- value=CGI.param('sort') %]
- <input type="submit" value="[% l('Sort') %]" />
- </form>
- </p>
-
+ <h1>[% l("Your existing lists") %]</h1>
[% INCLUDE "opac/parts/anon_list.tt2" %]
[% IF ctx.bookbags.size %]
<div id='acct_lists_prime'>
[% FOR bbag IN ctx.bookbags %]
- <div id='acct_list_template'>
- <div style="width:100%">
- <form action="[% ctx.opac_root %]/myopac/list/update" method="POST">
- <div class="bookbag-share">
- <input type="hidden" name="list" value="[% bbag.id %]" />
- [% IF bbag.pub != 't' %]
- <input type="hidden" name="action" value="show" />
- <input type="submit" value="[% l('Share') %]" />
- [% ELSE %]
- <input type="hidden" name="action" value="hide" />
- <input type="submit" value="[% l('Hide') %]" />
- [% END %]
- </div>
- </form>
- <form action="[% ctx.opac_root %]/myopac/list/update" method="POST">
- <div class="bookbag-controls">
- <input type="hidden" name="list" value="[% bbag.id %]" />
- <input type="hidden" name="action" value="delete" />
- <input type="submit" value="[% l('Delete List') %]" />
- </div>
- </form>
- <form action="[% ctx.opac_root %]/myopac/list/print" method="POST">
- <div class="bookbag-controls">
- <input type="hidden" name="list" value="[% bbag.id %]" />
- <input type="hidden" name="sort" value="[% CGI.param('sort') | html %]" />
- <input type="submit" value="[% l('Download CSV') %]" />
- </div>
- </form>
- <div class="bookbag-controls">
- <big><strong>
- [% IF bbag.pub == 't' %]
- [% url = 'http://' _ ctx.hostname _ '/opac/extras/feed/bookbag/html-full/' _ bbag.id %]
- <a target='_blank' href='[% url %]'>[% bbag.name | html %]</a>
+ <div class="bookbag-controls-holder">
+ <div class="bookbag-controls most">
+ [% baseurl = ctx.opac_root _ '/myopac/lists';
+ IF bbag.id != CGI.param("id");
+ url = mkurl(baseurl, {id => bbag.id}, ['edit_notes']);
+ ltitle = l("Show items in list");
+ ELSE;
+ url = mkurl(baseurl, {}, ['id', 'edit_notes']);
+ ltitle = l("Hide items in list");
+ END %]
+ <a class="big-strong" title="[% ltitle %]" href="[% url %]">[% bbag.name | html %]</a>
+ [% IF bbag.description %]<br /><em>[% bbag.description | html %]</em>[% END %]
+ </div>
+ <form action="[% ctx.opac_root %]/myopac/list/update" method="POST">
+ <div class="bookbag-share">
+ <input type="hidden" name="list" value="[% bbag.id %]" />
+ [% IF bbag.pub != 't' %]
+ <input type="hidden" name="action" value="show" />
+ <input class="fixed" type="submit" value="[% l('Share') %]" />
[% ELSE %]
- [% bbag.name | html %]
+ <input type="hidden" name="action" value="hide" />
+ <input class="fixed" type="submit" value="[% l('Hide') %]" />
[% END %]
- </strong></big>
- [% IF bbag.description %]<br /><em>[% bbag.description | html %]</em>[% END %]
</div>
+ </form>
+ <form action="[% ctx.opac_root %]/myopac/list/update" method="POST">
+ <div class="bookbag-controls">
+ <input type="hidden" name="list" value="[% bbag.id %]" />
+ <input type="hidden" name="action" value="delete" />
+ <input type="submit" value="[% l('Delete List') %]" />
+ </div>
+ </form>
+ <form action="[% ctx.opac_root %]/myopac/list/print" method="POST">
<div class="bookbag-controls">
- [% IF bbag.pub == 't'; %]
- <a target='_blank' href='/opac/extras/feed/bookbag/rss2-full/[% bbag.id %]'><img
- alt="[% l('RSS Feed') %]" border="0"
- src="[% ctx.media_prefix %]/images/small-rss.png"/></a>
- [% END %]
+ <input type="hidden" name="list" value="[% bbag.id %]" />
+ <input type="hidden" name="sort" value="[% CGI.param('sort') | html %]" />
+ <input type="submit" value="[% l('Download CSV') %]" />
</div>
- <div class="clear-both pad-bottom-five"></div>
+ </form>
+ <div class="bookbag-controls">
+ [% IF bbag.pub == 't'; %]
+ <a target='_blank' href='/opac/extras/feed/bookbag/rss2-full/[% bbag.id %]'><img
+ alt="[% l('RSS Feed') %]" border="0"
+ src="[% ctx.media_prefix %]/images/small-rss.png"/></a>
+ [% END %]
</div>
- <form action="[% ctx.opac_root %]/myopac/list/update" method="POST">
- <input type="hidden" name="list" value="[% bbag.id %]" />
- <input type="hidden" name="sort" value="[% CGI.param('sort') | uri %]" />
- <table cellpadding='0' cellspacing='0' border='0'>
- <thead id="acct_list_header">
- <tr>
- <td width="1%" style="padding-left: 10px;">
- <input type="checkbox" onclick="
- var inputs=document.getElementsByTagName('input');
- for (i = 0; i < inputs.length; i++) {
- if (inputs[i].name == 'selected_item' && !inputs[i].disabled && inputs[i].getAttribute('bbag') == [% bbag.id %])
- inputs[i].checked = this.checked;}"/>
+ <div class="clear-both pad-bottom-five"></div>
+ </div>
+ [% IF CGI.param("id") == bbag.id %]
+ <div class="bookbag-specific">
+ <form method="GET">
+ <label for="opac.result.sort">[% l("Sort list items by: ") %]</label>
+ [% INCLUDE "opac/parts/filtersort.tt2"
+ value=CGI.param('sort') %]
+ <input type="hidden" name="id"
+ value="[% CGI.param('id') | html %]" />
+ <input type="submit" value="[% l('Sort') %]" />
+ </form>
+ </div>
+ <form action="[% ctx.opac_root %]/myopac/list/update" method="POST">
+ <input type="hidden" name="list" value="[% bbag.id %]" />
+ <input type="hidden" name="sort" value="[% CGI.param('sort') | uri %]" />
+ <table class="bookbag-specific" cellpadding='0' cellspacing='0' border='0'>
+ <thead id="acct_list_header">
+ <tr>
+ <td width="1%" style="padding-left: 10px;">
+ <input type="checkbox" onclick="
+ var inputs=document.getElementsByTagName('input');
+ for (i = 0; i < inputs.length; i++) {
+ if (inputs[i].name == 'selected_item' && !inputs[i].disabled && inputs[i].getAttribute('bbag') == [% bbag.id %])
+ inputs[i].checked = this.checked;}"/>
- </td>
- <td width="32%" style="padding-left: 5px;">
- <a href="[% ctx.opac_root %]/myopac/lists?sort=titlesort">[% l('Title') %]</a>
- </td>
- <td width="33%">
- <a href="[% ctx.opac_root %]/myopac/lists?sort=authorsort">[% l('Author(s)') %]</a>
- </td>
- <td width="32%">
- [% l('Notes') %]
- [% IF CGI.param("edit_notes") != bbag.id %]
- | <a href="[% ctx.opac_root %]/myopac/lists?[% IF CGI.param('sort'); 'sort='; (CGI.param('sort')) | uri; '&'; END %]edit_notes=[% bbag.id %]">[% l('Edit') %]</a>
- [% END %]
- </td>
- <td width="1%" class="nowrap">
- <select class="selector_actions_for_list" name="action">
- <option>[% l('-- Actions for this list --') %]</option>
- <option value="place_hold">[% l('Place Hold') %]</option>
- <option value="del_item">[% l('Remove Items') %]</option>
- </select>
- <input type="submit" value="[% l('Go') %]" />
- </td>
- </tr>
- </thead>
- <tbody>
- [% UNLESS bbag.items.size %]
- <tr><td colspan="4" class="opac-auto-171 opac-auto-097">
- [% l("This list contains no items.") %]
- </td></tr>
- [% END %]
- [% FOR item IN bbag.items;
- rec_id = item.target_biblio_record_entry.id;
- attrs = {marc_xml => ctx.bookbags_marc_xml.$rec_id};
- PROCESS get_marc_attrs args=attrs %]
- <tr class="bookbag-item-row">
- <td class="item_list_padding" style="padding-left: 10px;">
- <input type="checkbox" name="selected_item" value="[% item.id %]" bbag='[% bbag.id %]'/>
- </td>
- <td class="item_list_padding" style="padding-left: 5px;">
- <a href="[% mkurl(ctx.opac_root _ '/record/' _ rec_id) %]">[% attrs.title | html %]</a>
- </td>
- <td class="item_list_padding">
- <a href="[%-
- authorquery = attrs.author | replace('[,\.:;]', '');
- mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page'])
- -%]">[% attrs.author | html %]</a>
- [% IF CGI.param("edit_notes") == bbag.id %]
- <td class="opac-auto-097b">
- [% FOR note IN item.notes %]
- <input type="text" name="note-[% note.id %]" value="[% note.note | html %]" />
- [% END %]
- <input type="text" name="item-[% item.id %]" />
- </td>
- [% ELSE %]
- <td class="opac-auto-097b">
- [% FOR note IN item.notes %]
- <div>[% note.note | html %]</div>
- [% END %]
- </td>
+ </td>
+ <td width="32%" style="padding-left: 5px;">
+ <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>'titlesort'}) %]">[% l('Title') %]</a>
+ </td>
+ <td width="33%">
+ <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>'authorsort'}) %]">[% l('Author(s)') %]</a>
+ </td>
+ <td width="32%">
+ [% l('Notes') %]
+ [% IF CGI.param("edit_notes") != bbag.id %]
+ | <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {edit_notes=> bbag.id}) %]">[% l('Edit') %]</a>
[% END %]
- </tr>
- [% END %]
+ </td>
+ <td width="1%" class="nowrap">
+ <select name="action">
+ <option disabled="disabled">[% l('-- Actions for these items --') %]</option>
+ <option value="place_hold">[% l('Place hold') %]</option>
+ <option value="del_item">[% l('Remove from list') %]</option>
+ </select>
+ <input type="submit" value="[% l('Go') %]" />
+ </td>
+ </tr>
+ </thead>
+ <tbody>
+ [% UNLESS bbag.items.size %]
+ <tr><td colspan="4" class="opac-auto-171 opac-auto-097">
+ [% l("This list contains no items.") %]
+ </td></tr>
+ [% END %]
+ [% FOR item IN bbag.items;
+ rec_id = item.target_biblio_record_entry.id;
+ attrs = {marc_xml => ctx.bookbags_marc_xml.$rec_id};
+ PROCESS get_marc_attrs args=attrs %]
+ <tr class="bookbag-item-row">
+ <td class="item_list_padding" style="padding-left: 10px;">
+ <input type="checkbox" name="selected_item" value="[% item.id %]" bbag='[% bbag.id %]'/>
+ </td>
+ <td class="item_list_padding" style="padding-left: 5px;">
+ <a href="[% mkurl(ctx.opac_root _ '/record/' _ rec_id, {}, ['edit_notes', 'id']) %]">[% attrs.title | html %]</a>
+ </td>
+ <td class="item_list_padding">
+ <a href="[%-
+ authorquery = attrs.author | replace('[,\.:;]', '');
+ mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page', 'id', 'edit_notes'])
+ -%]">[% attrs.author | html %]</a>
[% IF CGI.param("edit_notes") == bbag.id %]
- <tr>
- <td colspan="3"><!-- All space left of notes column --></td>
- <td>
- <input type="submit" name="save_notes" value="[% l('Save Notes') %]" />
- </td>
- </tr>
+ <td class="opac-auto-097b">
+ [% FOR note IN item.notes %]
+ <input type="text" name="note-[% note.id %]" value="[% note.note | html %]" />
+ [% END %]
+ <input type="text" name="item-[% item.id %]" />
+ </td>
+ [% ELSE %]
+ <td class="opac-auto-097b">
+ [% FOR note IN item.notes %]
+ <div>[% note.note | html %]</div>
+ [% END %]
+ </td>
[% END %]
- </tbody>
- </table>
- </form>
- <hr /><br />
- </div>
+ </tr>
+ [% END %]
+ [% IF CGI.param("edit_notes") == bbag.id %]
+ <tr>
+ <td colspan="3"><!-- All space left of notes column --></td>
+ <td class="save-notes">
+ <input type="hidden" name="id" value="[% CGI.param('id') | html %]" />
+ <input type="submit" name="save_notes" value="[% l('Save Notes') %]" />
+ </td>
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
+ </form>
+ [% END %]
[% END %]
</div>
[% END %]
[% IF ctx.mylist.size %]
+ <div class="bookbag-specific">
+ <form method="GET">
+ <label for="anonsort">[% l("Sort list items by: ") %]</label>
+ [% INCLUDE "opac/parts/filtersort.tt2"
+ id="anonsort" name="anonsort" value=CGI.param("anonsort") %]
+ <input type="hidden" name="id"
+ value="[% CGI.param('id') | html %]" />
+ <!-- just preserve this --><input type="hidden" name="sort"
+ value="[% CGI.param('sort') | html %]" />
+ <input type="submit" value="[% l('Sort') %]" />
+ </form>
+ </div>
+
<form action="[% ctx.opac_root %]/mylist/move" method="POST">
<div>
- <div style="width:100%">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td id='anon_list_name'>
- [% l('Temporary List') %]
- </td>
- <td>
- <!-- <a href="#"><img
- alt="[% l('Anonymous List Help') %]"
- src="[% ctx.media_prefix %]/images/question-mark.png" /></a>-->
- </td>
- </tr>
- </table>
- <div class="float-right"></div>
- <div class="clear-both pad-bottom-five"></div>
- </div>
+ <p class="big-strong">[% l('Temporary List') %]</p>
<table cellpadding='0' cellspacing='0' border='0'>
<thead id="acct_list_header_anon">
<tr>
for (i = 0; i < inputs.length; i++) {
if (inputs[i].name == 'record' && !inputs[i].disabled) inputs[i].checked = this.checked;}"/>
</td>
- <td width="49%" style="padding-left:5px;">[% l('Title') %]</td>
- <td width="49%" style="padding-left:5px;">[% l('Author(s)') %]</td>
+ <td width="49%" class="opac-auto-108"><a href="[% mkurl('', {anonsort=>'titlesort'}) %]">[% l('Title') %]</a></td>
+ <td width="49%" class="opac-auto-108"><a href="[% mkurl('', {anonsort=>'authorsort'}) %]">[% l('Author(s)') %]</a% l('Author(s)') %]</td>
<td width="1%" class="nowrap">
- <select class="selector_actions_for_list" name="action">
- <option>[% l('-- Actions for this list --') %]</option>
- <option value="place_hold">[% l('Place Hold') %]</option>
- <option value="delete">[% l('Remove Items') %]</option>
+ <select name="action">
+ <option>[% l('-- Actions for these items --') %]</option>
+ <option value="place_hold">[% l('Place hold') %]</option>
+ <option value="delete">[% l('Remove from list') %]</option>
[% IF ctx.user AND ctx.bookbags.size %]
<optgroup label="Move selected items to">
[% FOR bbag IN ctx.bookbags %]]
<td class="item_list_padding" style="padding-left: 10px;">
<input type="checkbox" name="record" value="[% item %]" />
</td>
- <td class="item_list_padding" style="padding-left: 5px;">[% attrs.title | html %]</td>
- <td class="item_list_padding" style="padding-left: 5px;">[% attrs.author | html %]</td>
+ <td class="item_list_padding" style="padding-left: 5px;"><a href="[% mkurl(ctx.opac_root _ '/record/' _ item, {}, ['edit_notes', 'id']) %]">[% attrs.title | html %]</a></td>
+ <td class="item_list_padding" style="padding-left: 5px;"><a href="[%-
+ authorquery = attrs.author | replace('[,\.:;]', '');
+ mkurl(
+ ctx.opac_root _ '/results',
+ {qtype => 'author', query => authorquery},
+ ['page', 'id', 'edit_notes']
+ )
+ -%]">[% attrs.author | html %]</a></td>
</tr>
[% END %]
</tbody>