use constant COOKIE_SES => 'ses';
use constant COOKIE_PHYSICAL_LOC => 'eg_physical_loc';
+use constant COOKIE_SSS_EXPAND => 'eg_sss_expand';
use constant COOKIE_ANON_CACHE => 'anoncache';
use constant ANON_CACHE_MYLIST => 'mylist';
}
}
+ $self->staff_saved_searches_set_expansion_state if $ctx->{is_staff};
+
return Apache2::Const::OK;
}
+sub staff_saved_searches_set_expansion_state {
+ my $self = shift;
+
+ my $param = $self->cgi->param('sss_expand');
+ my $value;
+
+ if (defined $param) {
+ $value = ($param ? 1 : 0);
+ $self->apache->headers_out->add(
+ "Set-Cookie" => $self->cgi->cookie(
+ -name => COOKIE_SSS_EXPAND,
+ -path => $self->ctx->{base_path},
+ -secure => 1, # not strictly necessary, but this feature is staff-only, so may as well
+ -value => $value,
+ -expires => undef
+ )
+ );
+ } else {
+ $value = $self->cgi->cookie(COOKIE_SSS_EXPAND);
+ }
+
+ $self->ctx->{saved_searches_expanded} = $value;
+}
+
# physical_loc (i.e. "original location") passed in as a URL
# param will replace any existing physical_loc stored as a cookie.
sub get_physical_loc {
[% IF ctx.saved_searches.size %]
- <div class="saved-searches-header big-strong">[% l("Your recent searches:") %]</div>
- [% FOR s IN ctx.saved_searches %]
- <ul>
- <li><a href="[% ctx.opac_root %]/results?query=[% s | uri %]&_adv=1">[% s | html %]</a></li>
- </ul>
+
+ <div class="saved-searches-header">
+ <div class="text">
+ [% l("Recent searches") %]
+ </div>
+ <div class="button">
+ [% IF ctx.saved_searches_expanded %]
+ <a href="[% mkurl('', {'sss_expand' => 0}) %]" title="[% l('Collapse') %]"><img src="[% ctx.media_prefix %]/images/adv_search_minus_btn.png" alt="[% l('Collapse') %]" /></a>
+ [% ELSE %]
+ <a href="[% mkurl('', {'sss_expand' => 1}) %]" title="[% l('Expand') %]"><img src="[% ctx.media_prefix %]/images/adv_search_plus_btn.png" alt="[% l('Expand') %]" /></a>
+ [% END %]
+ </div>
+ <div class="clear"> </div>
+ </div>
+ <div class="clear"> </div>
+ <div class="saved-searches">
+ [% IF ctx.saved_searches_expanded %]
+ [% FOR s IN ctx.saved_searches %]
+ <ul>
+ <li><a href="[% ctx.opac_root %]/results?query=[% s | uri %]&_adv=1">[% s | html %]</a></li>
+ </ul>
+ [% END %]
[% END %]
+ </div>
[% END %]
margin-bottom: 2ex;
}
.save-notes { padding-bottom: 1.5ex; }
+.saved-searches-header { width: 100%; font-weight: bold; font-size: 120%; }
+.saved-searches-header .button { float: right; width: 28px; }
+.saved-searches-header .text { float: left; padding-right: 1em; margin: 0.5ex 0;}
+.saved-searches-header {font-weight: bold; font-size: 120%; }
+.saved-searches { border-bottom: 1px solid #666; }
+#staff-saved-search { /* wraps .saved-searches-header and .saved-searches on the record page */
+ border-right: 1px solid #333;
+}