return $self->load_cnbrowse if $path =~ m|opac/cnbrowse|;
return $self->load_mylist_add if $path =~ m|opac/mylist/add|;
+ return $self->load_mylist_delete if $path =~ m|opac/mylist/delete|;
return $self->load_mylist_move if $path =~ m|opac/mylist/move|;
return $self->load_mylist if $path =~ m|opac/mylist|;
return $self->load_cache_clear if $path =~ m|opac/cache/clear|;
return $self->mylist_action_redirect($cache_key);
}
-# Removes a record ID from My List, or moves to an actual bookbag
+sub load_mylist_delete {
+ my $self = shift;
+ my $rec_id = $self->cgi->param('record');
+
+ my ($cache_key, $list) = $self->fetch_mylist;
+ $list = [ grep { $_ ne $rec_id } @$list ];
+
+ $cache_key = $U->simplereq(
+ 'open-ils.actor',
+ 'open-ils.actor.anon_cache.set_value',
+ $cache_key, ANON_CACHE_MYLIST, $list);
+
+ return $self->mylist_action_redirect($cache_key);
+}
+
sub load_mylist_move {
my $self = shift;
my @rec_ids = $self->cgi->param('record');
my $self = shift;
my $cache_key = shift;
+ my $url;
+ if( my $anchor = $self->cgi->param('anchor') ) {
+ # on the results page, we want to redirect
+ # back to record that was affected
+ $url = $self->ctx->{referer};
+ $url =~ s/#.*|$/#$anchor/g;
+ }
+
return $self->generic_redirect(
- undef,
+ $url,
$self->cgi->cookie(
-name => COOKIE_ANON_CACHE,
-path => '/',
name='result_table_title_cell'
valign="top">
<div class="bold">
- <a title="[% attrs.title | uri %]" name='item_title'
+ <a name='record_[% rec.id %]' title="[% attrs.title | uri %]" name='item_title'
href="[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"
class='search_link'>[% attrs.title | html %]</a>
</div>
label = (operation == "add") ? l("Add to") : l("Remove from"); %]
<form action="[% ctx.opac_root %]/mylist/[% operation %]" method="POST">
<input type="hidden" name="record" value="[% rec.id %]" />
+ <input type="hidden" name="anchor" value="record_[% rec.id %]" />
<div style="position:absolute;">
<div style="position:relative;top:5px; left: 25px;">
<input type="submit" title="[% '[_1] my list' | l(label) %]"