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->load_temp_warn_post if $path =~ m|opac/temp_warn/post|;
+ return $self->load_temp_warn if $path =~ m|opac/temp_warn|;
# ----------------------------------------------------------------
# Everything below here requires SSL
'open-ils.actor.anon_cache.set_value',
$cache_key, (ref $self)->ANON_CACHE_MYLIST, $list);
+ # Check if we need to warn patron about adding to a "temporary"
+ # list:
+ if ($self->check_for_temp_list_warning) {
+ return $self->mylist_warning_redirect($cache_key);
+ }
+
return $self->mylist_action_redirect($cache_key);
}
);
}
+# called after an anon-cache / my list addition when we are configured
+# to show a warning to the user.
+
+sub mylist_warning_redirect {
+ my $self = shift;
+ my $cache_key = shift;
+
+ my $base_url = sprintf(
+ "%s://%s%s/temp_warn",
+ $self->cgi->https ? 'https' : 'http',
+ $self->apache->hostname,
+ $self->ctx->{opac_root}
+ );
+
+ my $redirect = $self->ctx->{referer};
+ if (my $anchor = $self->cgi->param('anchor')) {
+ $redirect =~ s/#.*|$/#$anchor/;
+ }
+
+ $base_url .= '?redirect_to=' . uri_escape($redirect);
+
+ return $self->generic_redirect(
+ $base_url,
+ $self->cgi->cookie(
+ -name => (ref $self)->COOKIE_ANON_CACHE,
+ -path => '/',
+ -value => ($cache_key) ? $cache_key : '',
+ -expires => ($cache_key) ? undef : '-1h'
+ )
+ );
+}
+
sub load_mylist {
my ($self) = shift;
(undef, $self->ctx->{mylist}, $self->ctx->{mylist_marc_xml}) =
return Apache2::Const::OK;
}
+sub load_temp_warn_post {
+ my $self = shift;
+ my $url = $self->cgi->param('redirect_to');
+ return $self->generic_redirect(
+ $url,
+ $self->cgi->cookie(
+ -name => 'no_temp_list_warn',
+ -path => '/',
+ -value => ($self->cgi->param('no_temp_list_warn')) ? '1' : '',
+ -expires => ($self->cgi->param('no_temp_list_warn')) ? undef : '-1h'
+ )
+ );
+}
+
+sub load_temp_warn {
+ my $self = shift;
+ $self->ctx->{'redirect_to'} = $self->cgi->param('redirect_to');
+ return Apache2::Const::OK;
+}
+
1;
--- /dev/null
+[% PROCESS "opac/parts/header.tt2";
+ PROCESS "opac/parts/misc_util.tt2";
+ WRAPPER "opac/parts/base.tt2";
+ INCLUDE "opac/parts/topnav.tt2";
+ ctx.page_title = l("Temporary List Warning") %]
+ <div id="search-wrapper">
+ [% INCLUDE "opac/parts/searchbar.tt2" %]
+ </div>
+ <div id="content-wrapper">
+ <div id="main-content">
+ <p class="big-strong">[% l('You are adding to a temporary list.') %]
+ [% IF ctx.user ;
+ l('This information will disappear when you logout, unless you save it to a permanent list.');
+ ELSE;
+ l('This information will disappear when you end your session, unless you login and save it to a permanent list.');
+ END
+ %]</p>
+ <form method="POST" action="[% mkurl(ctx.opac_root _ '/temp_warn/post', {}, 1) %]">
+ <input type="hidden" name="redirect_to" value="[% ctx.redirect_to %]" />
+ <input type="checkbox" name="no_temp_list_warn" value="on" />
+ <label for="no_temp_list_warn">[% l('Do not show this warning again.') %]</label>
+ <br />
+ <input type="submit" class="fixed" value="[% l('OK') %]" />
+ </form>
+ <div class="common-full-pad"></div>
+ </div>
+ </div>
+[% END %]