$self->extract_copy_location_group_info;
$ctx->{search_ou} = $self->_get_search_lib();
- $ctx->{search_scope} = $self->cgi->param('search_scope');
+ if (!$ctx->{search_scope}) { # didn't get it from locg above in extract_...
+ $ctx->{search_scope} = $self->cgi->param('search_scope');
+ if ($ctx->{search_scope} =~ /^lasso\(([^)]+)\)/) {
+ $ctx->{search_lasso} = $1; # make it visible to basic search
+ }
+ }
$self->staff_saved_searches_set_expansion_state if $ctx->{is_staff};
$self->load_eg_cache_hash;
$self->load_copy_location_groups;
# lasso, and location_groups filters.
$query .= ' ' . $cgi->param('search_scope') if defined $cgi->param('search_scope');
+ # The search_lasso context param comes from the locg dropdown, like the copy location.
+ $query .= ' lasso(' . $ctx->{search_lasso} .')' if $ctx->{search_lasso};
+
# sort is treated specially, even though it's actually a filter
if (defined($cgi->param('sort'))) {
$query =~ s/sort\([^\)]*\)//g; # override existing sort(). no stacking.
}
# Extracts the copy location org unit and group from the
-# "logc" param, which takes the form org_id:grp_id.
+# "logc" param, which takes the form org_id:grp, where
+# grp can either be a location group id or can match the
+# pattern "lasso(lasso_name_or_id)".
sub extract_copy_location_group_info {
my $self = shift;
my $ctx = $self->ctx;
if (my $clump = $self->cgi->param('locg')) {
my ($org, $grp) = split(/:/, $clump);
+ if ($grp =~ /^lasso\(([^)]+)\)/) {
+ $ctx->{search_lasso} = $1;
+ $ctx->{search_scope} = $grp;
+ } elsif ($grp) {
+ $ctx->{copy_location_group} = $grp;
+ $ctx->{search_scope} = "location_groups($grp)";
+ }
$ctx->{copy_location_group_org} =
$self->_resolve_org_id_or_shortname($org);
- $ctx->{copy_location_group} = $grp if $grp;
}
}
PROCESS "opac/parts/org_selector.tt2";
select_scope_label = l("Select search scope");
INCLUDE build_scope_selector arialabel=select_scope_label value=ctx.search_scope
- id=adv_chunk.id name='search_scope' show_loc_groups=1;
+ id=adv_chunk.id name='search_scope' show_loc_groups=1 show_lassos=1;
CASE "lib_selector";
PROCESS "opac/parts/org_selector.tt2";
- INCLUDE build_org_selector show_loc_groups=0 id=adv_chunk.id %]
+ INCLUDE build_org_selector show_loc_groups=1 show_lassos=0 id=adv_chunk.id %]
<div class="adv_search_available">
<input type='checkbox' name="modifier"
value="available"[% CGI.param('modifier').grep('available').size ? ' checked="checked"' : '' %]
# Org Unit Selector Widget :
# INCLUDE build_org_selector id='selector-id' name='selector-name'
# value=org_id show_loc_groups=1/0 can_have_vols_only=1/0
-# can_have_users_only=1/0 valid_org_list=[1,2,3]
+# can_have_users_only=1/0 valid_org_list=[1,2,3] show_lassos=1/0
#
# NOTE: DO NOT USE PROCESS
# Use of PROCESS results in internal variables, such as value or org_unit, to "leak" out
# disable the ou-hide scoping altogether.
hiding_disabled = ctx.org_hiding_disabled(value);
+ # Some setup for Library Groups
+ lasso_selected = 0;
+ base_value = value.split(':').0;
+
-%]
<select [% IF id %] id='[% id %]' [% END -%]
title='[% arialabel || l("Select Library") %]'
name='[% name %]'>
- [%-
+
+ [% IF show_lassos AND ctx.lassos.size > 0;
+ %] <optgroup label="[% l('Library Groups') %]"> [%
+ FOR lasso IN ctx.lassos;
+ opt_value = base_value _ ':lasso(' _ lasso.id _ ')';
+ selected = '';
+ IF !lasso_selected AND ctx.search_lasso == lasso.id;
+ lasso_selected = 1;
+ selected = 'selected="selected"';
+ END %]
+ <option value='[% opt_value %]' [% selected %]>
+ [% lasso.name | html %]
+ </option>
+ [% END %]
+ </optgroup>
+ <optgroup label="[% l('Libraries') %]">
+ [% END;
+
WHILE node_stack.size > 0;
node = node_stack.pop();
org_unit = node.org;
IF can_have_vols_only AND org_unit.ou_type.can_have_vols != 't';
disabled = 'disabled="disabled"';
- ELSIF node_value == value;
+ ELSIF !lasso_selected AND node_value == value;
selected = 'selected="selected"';
END;
IF can_have_users_only AND org_unit.ou_type.can_have_users != 't';
disabled = 'disabled="disabled"';
- ELSIF node_value == value;
+ ELSIF !lasso_selected AND node_value == value;
selected = 'selected="selected"';
END;
[% ' ' FOR [0..pad_depth]; display_name | html %]
</option>
+ [%- END -%]
+
+ [%- IF show_lassos AND ctx.lassos.size > 0 -%]
+ </optgroup>
[%- END %]
</select>
[%- END;
hiding_depth = ctx.get_org_setting(ou_id, 'opac.org_unit_hiding.depth') -%]
<select [% IF id %] id='[% id %]' [% END -%]
- title='[% arialabel || l("Select Library") %]'
+ title='[% arialabel || l("Select scoping restrictions") %]'
name='[% name %]'>
<option value=''>[% l('No Restrictions') | html %]</option>
[% END %]
</optgroup>
- [% IF ctx.lassos.size > 0;
+ [% IF show_lassos AND ctx.lassos.size > 0;
%] <optgroup label="[% l('Library Groups') %]"> [%
FOR lasso IN ctx.lassos;
opt_value = 'lasso(' _ lasso.id _ ')';
l('Library: ');
select_lib_label = l("Select search library");
INCLUDE build_org_selector arialabel=select_lib_label
- id='search_org_selector' show_loc_groups=0
+ id='search_org_selector' show_loc_groups=1 show_lassos=1
-%]
</label>
<label id="search_scope_label" for="search_scope_selector">
- [%-
+ [%#-
l('Where: ');
select_scope_label = l("Select search scope");
INCLUDE build_scope_selector arialabel=select_scope_label value=ctx.search_scope