return $self->load_logout($self->apache->unparsed_uri);
}
}
- $ctx->{search_ou} = $self->_get_search_lib();
- $self->staff_saved_searches_set_expansion_state if $ctx->{is_staff};
+ # load copy location search groups and see if there is a "logc"
+ # paremeter set. If so, use it to set/override the "loc" parameter
+ # as well as the copy_location_group context var
$self->load_copy_location_groups;
+ $ctx->{search_ou} = $self->_get_search_lib();
+ $self->staff_saved_searches_set_expansion_state if $ctx->{is_staff};
+
return Apache2::Const::OK;
}
$self->ctx->{saved_searches_expanded} = $value;
}
+# If "locg" is set, we extract the org unit and copy location.
+# The org unit from 'locg' overrides the local CGI variable 'loc'.
+# Overridding it here will not override it globaly though (i.e. in
+# the template environment), unless the same CGI ref is used everywhere,
+# which is usually isn't. To be safe, always use ctx.search_ou
+# to determine the context org unit.
sub load_copy_location_groups {
my $self = shift;
my $grps = $self->editor->search_asset_copy_location_group({opac_visible => 't'});
my %buckets;
push(@{$buckets{$_->owner}}, $_) for @$grps;
$self->ctx->{copy_location_groups} = \%buckets;
+
+ if (my $clump = $self->cgi->param('locg')) {
+ my ($org, $grp) = split(/:/, $clump);
+ $self->ctx->{copy_location_group} = $grp if $grp;
+ $self->cgi->param('loc', $org);
+ }
}
# physical_loc (i.e. "original location") passed in as a URL
$query .= " site($site)";
}
+ if (my $grp = $ctx->{copy_location_group}) {
+ $query .= " location_groups($grp)";
+ }
+
if(!$site) {
($site) = ($query =~ /site\(([^\)]+)\)/);
$site ||= $ctx->{aou_tree}->()->shortname;
-[%- PROCESS "opac/parts/header.tt2";
+[%- PROCESS "opac/parts/header.tt2";
WRAPPER "opac/parts/base.tt2";
INCLUDE "opac/parts/topnav.tt2";
ctx.page_title = l("Advanced Search");
pane = CGI.param("pane") || "advanced";
- loc = CGI.param("loc");
+ loc = ctx.search_ou;
-%]
<div id="search-wrapper">
<div id="search-box">
[% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
</td>
</tr>
- [% IF ctx.get_org_setting(CGI.param('loc') OR ctx.aou_tree.id, 'sms.enable') == 1 %]
+ [% IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1 %]
<tr>
<td>[% l('Notify by Text by default when a hold is ready for pickup?') %]</td>
<td>
-[% loc = CGI.param("loc") %]
<form action="[% ctx.opac_root %]/results" method="GET">
<div class="header_middle">[% l("Expert Search") %]</div>
<input type="hidden" name="_special" value="1" />
<td valign='top'>
<strong>[% l("Search Library") %]</strong><br />
[% PROCESS "opac/parts/org_selector.tt2";
- PROCESS build_org_selector name='loc' value=ctx.search_ou %]
+ PROCESS build_org_selector show_loc_groups=1 %]
<div style="position:relative;top:7px;">
<input type='checkbox' name="modifier"
value="available"[% CGI.param('modifier').grep('available').size ? ' checked="checked"' : '' %]
# value=org_id show_loc_groups=1/0 can_have_vols_only=1/0
BLOCK build_org_selector;
- node_stack = [{org => org_unit || ctx.aou_tree}] %]
+ node_stack = [{org => org_unit || ctx.aou_tree}];
+ IF !name;
+ name = 'loc';
+ IF show_loc_groups; name = 'locg'; END;
+ END;
+ IF !value;
+ value = ctx.search_ou;
+ IF show_loc_groups;
+ value = CGI.param('locg');
+ END;
+ END;
+ %]
<select [% IF id %] id='[% id %]' [% END %] name='[% name %]'>
[%
END;
END;
+ node_value = ou_id;
+ IF loc_grp; node_value = node_value _ ':' _ loc_grp.id; END;
+
IF can_have_vols_only AND org_unit.ou_type.can_have_vols != 't';
disabled = 'disabled="disabled"';
- ELSIF ou_id == value; # TODO: test for copy_loc value
+ ELSIF node_value == value;
selected = 'selected="selected"';
END %]
- <option value='[% org_unit.id | uri %]' [% selected %] [% disabled %]>
+ <option value='[% node_value %]' [% selected %] [% disabled %]>
[%
# loc_grp's are displayed as children of the current org
depth = org_unit.ou_type.depth;
loc_grp ? loc_grp.name : org_unit.name | html ;
%]
</option>
-
[%
END;
%]
[% l('Phone Number:') %]<input type="text" name="phone_notify" [% setting = 'opac.default_phone';
IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
</blockquote>
- [% IF ctx.get_org_setting(CGI.param('loc') OR ctx.aou_tree.id, 'sms.enable') == 1 %]
+ [% IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1 %]
<input type="checkbox" name="sms_notify_checkbox"
[% IF ctx.default_sms_notify %]checked="checked"[% END %]/>
[% l('Yes, by Text Messaging') %]<br/>
[%-
UNLESS params;
- params = ['loc', 'query', 'qtype', 'sort'];
+ params = ['locg', 'loc', 'query', 'qtype', 'sort'];
END;
FOR param IN params;
IF CGI.param(param); %]
<li>
[% l('[quant,_1,copy,copies] at [_2].', ou_avail, ctx.get_aou(ou_id).name)
| html %]
- [%- IF ou_avail > 0 && ou_id != CGI.param('loc'); %]
+ [%- IF ou_avail > 0 && ou_id != ctx.search_ou; %]
<a href="[% mkurl('', {loc => ou_id}); %]"
title="[% l('Show copies at [_1]', ctx.get_aou(ou_id).name); %]">
[%- l('(Show)'); %]</a>
org_name | html
-%]
</td>
- <td header='copy_header_callnumber'>[% callnum | html %] [% IF ctx.get_org_setting(CGI.param('loc') OR ctx.aou_tree.id, 'sms.enable') == 1 %](<a href="[% mkurl(ctx.opac_root _ '/sms_cn', {copy_id => copy_info.id}) %]">Text</a>)[% END %]</td>
+ <td header='copy_header_callnumber'>[% callnum | html %] [% IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1 %](<a href="[% mkurl(ctx.opac_root _ '/sms_cn', {copy_id => copy_info.id}) %]">Text</a>)[% END %]</td>
[%- IF has_parts == 'true' %]
<td header='copy_header_part'>[% copy_info.part_label | html %]</td>
[%- END %]
[%
# Default to the root of the org unit tree in the absence of a specific library
- loc = ctx.aou_tree.id;
- IF CGI.param('loc');
- loc = CGI.param('loc');
- END;
+ loc = ctx.search_ou;
# Get the full name of the library
ou_name = ctx.get_aou(loc).name | uri;
[%
series_tags = ['440', '490', '800', '810', '811', '830', '694'];
- loc = CGI.param('loc');
+ loc = ctx.search_ou;
%]
[% BLOCK render_series;
];
BLOCK render_subject;
- loc = CGI.param('loc') | uri;
xpath = xpath || '//*[starts-with(@tag,"6")]';
FOR node IN ctx.marc_xml.findnodes(xpath);
all_terms = [];
x-webkit-speech />
</span>
[%- INCLUDE "opac/parts/qtype_selector.tt2";
- l(' in '); PROCESS build_org_selector name='loc' value=ctx.search_ou show_loc_groups=1;
+ l(' in '); PROCESS build_org_selector show_loc_groups=1;
%]
<span>
<input id='search-submit-go' type="submit" value="[% l('Search') %]" alt="[% l('Search') %]" class="opac-button"