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>
[%
operation = ctx.mylist.grep(rec.id).size ? "delete" : "add";
label = (operation == "add") ? l("Add to my list") : l("Remove from my list");
+ href = mkurl(ctx.opac_root _ '/mylist/' _ operation,
+ {record => rec.id, anchor => 'record_' _ rec.id}, 1);
%]
- <a href="[% mkurl(ctx.opac_root _ '/mylist/' _ operation, {record => rec.id}, 1) %]" class="no-dec">
+ <a href="[% href %]" class="no-dec">
<img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
[% label %]
</a>