]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates-bootstrap/opac/parts/searchbar.tt2
LP1778972 A slew of updates
[Evergreen.git] / Open-ILS / src / templates-bootstrap / opac / parts / searchbar.tt2
1 <h3 class="sr-only">[% l('Catalog Search') %]</h3>
2 [% PROCESS "opac/parts/org_selector.tt2";
3
4 # We need to ignore some filters in our count
5
6 fignore = ['location_groups','site','core_limit','limit','badge_orgs','badges','estimation_strategy','depth'];
7 fcount = 0;
8 FOR f IN ctx.query_struct.filters;
9     IF fignore.grep('^' _ f.name _ '$').size;
10         NEXT;
11     END;
12     fcount = fcount + 1;
13 END;
14
15     # don't display a box for the search_format filter,
16     # as that's got its own widget
17     ignore_filters = ['search_format'];
18
19     trimmed_filters = [];
20     FOR filter IN ctx.query_struct.filters;
21         fname = filter.name;
22         IF ignore_filters.grep('^' _ fname _ '$').size;
23             NEXT;
24         END;
25         trimmed_filters.push(filter);
26     END;
27
28     ctx.query_struct.filters = trimmed_filters;
29
30  %]
31
32 <div id="search-wrapper">
33     [% UNLESS took_care_of_form -%]
34     <form action="[% ctx.opac_root %]/results" method="get">
35     [%- END %]
36     [% IF ctx.page == 'rresult' && ctx.metarecord && search.metarecord_default %]
37     <input type="hidden" name="modifier" value="metabib"/>
38     [% END %]
39     [% IF (ctx.page == 'place_hold' || ctx.page == 'myopac' || ctx.page == 'home' || ctx.page == 'record') && search.metarecord_default %]
40     <input type="hidden" name="modifier" value="metabib"/>
41     [% END %]
42     <div class="m-5">
43     <div class="row">
44      <!--Keyword-->
45         <div class="col-xs-12 col-sm-12 col-lg-6 col-xl-3">
46         <span class='search_box_wrapper'>
47             [%- # autosuggest breaks accessibility, as the aria-label
48                 # attribute is removed when the Dijit is created. :(  %]
49             <label id="search_box_label" for="search_box" class="w-100">[% l('Search: ') %]
50             <input class="form-control form-control-lg" type="text" id="search_box" name="query" aria-label="[%
51                     l('Enter search query:');
52                 %]" value="[% is_advanced ? ctx.naive_query_scrub(ctx.user_query) : CGI.param('query') | html %]"
53                 [%- IF use_autosuggest.enabled == "t" %]
54                 dojoType="openils.widget.AutoSuggest" type_selector="'qtype'"
55                 submitter="this.textbox.form.submit();"
56                 [%-     IF use_autosuggest.value.search('opac_visible') %]
57                 store_args='{"org_unit_getter": function() { return [% ctx.search_ou %]; }}'
58                 [%-     END # opac_visible -%]
59                 [%- ELSE -%]
60                     [% IF basic_search != "f" AND is_home_page%] autofocus [% END %]
61                 [%- END # autosuggest enabled %] />
62             </label>
63         </span>
64         </div>
65         
66         <!--Type-->
67         <div class="col-xs-12 col-sm-12 col-lg-6 col-xl-2">
68         <label id="search_qtype_label" for="qtype" class="w-100">
69         [%- 
70             l('Type: ');
71             INCLUDE "opac/parts/qtype_selector.tt2" id="qtype";
72         -%]
73         </label>
74         </div>
75         
76          <!--Format-->
77         <div class="col-xs-12 col-sm-12 col-lg-6 col-xl-2">
78         <label id="search_itype_label" for="search_itype_selector" class="w-100">
79         [%-
80             l('Format: ');
81             IF search.basic_config.type == 'attr';
82                 INCLUDE "opac/parts/coded_value_selector.tt2"
83                     attr=search.basic_config.group none_ok=1 
84                     id='search_itype_selector'
85                     none_label=search.basic_config.none_label;
86             ELSIF search.basic_config.type == 'filter';
87                 INCLUDE "opac/parts/filter_group_selector.tt2"
88                     filter_group=search.basic_config.group none_ok=1 
89                     id='search_itype_selector'
90                     none_label=search.basic_config.none_label;
91             END;
92         -%]
93         </label>
94         </div>
95         
96          <!--Library-->
97         <div class="col-xs-12 col-sm-12 col-lg-6 col-xl-2">
98         <label id="search_locg_label" for="search_org_selector" class="w-100">
99         [%- 
100             l('Library: ');
101             select_lib_label = l("Select search library");
102             INCLUDE build_org_selector arialabel=select_lib_label 
103               id='search_org_selector' show_loc_groups=1
104         -%]
105         </label>
106         </div>
107          <div class="col-xs-12 col-sm-12 col-lg-12 col-xl-3">
108             <div class="vertMid text-center">
109             <input id="detail" type="hidden" name="detail_record_view" value="[% show_detail_view %]"/>
110             <button id='search-submit-go' type="submit" class="btn btn-opac m-2"
111                 onclick='setTimeout(function(){$("search-submit-spinner").className=""; $("search-submit-go").className="hidden";[% IF ctx.depth_sel_button AND NOT took_care_of_form %] $("search-submit-go-depth").className="hidden";[% END %]}, 2000)'><i class="fas fa-search"></i> [% l('Search') %]</button>
112             [%- IF ctx.depth_sel_button AND NOT took_care_of_form %]
113             <button id='search-submit-go-depth' type="submit" value="[% ctx.depth_sel_depth %]" name="depth" class="[% #ctx.depth_sel_button_class %] btn btn-opac m-2"
114                 onclick='setTimeout(function(){$("search-submit-spinner").className=""; $("search-submit-go").className="hidden"; $("search-submit-go-depth").className="hidden";}, 2000)' title="[% ctx.depth_sel_tooltip | html %]"><i class="fas fa-globe"></i> [% ctx.depth_sel_button_label | html %]</button>
115             [%- END %]
116             <img id='search-submit-spinner' src='[% ctx.media_prefix %]/opac/images/progressbar_green.gif[% ctx.cache_key %]' style='height:16px;width:16px;' class='hidden' alt='[% l("Search In Progress") %]'/>
117             </div>
118           
119             </div>
120       </div>
121      
122            
123           
124       
125      
126     </div>
127     
128   
129             
130     [% IF ctx.bookbag %]
131     <div id="search-only-bookbag-container" class="text-center">
132         <input type="checkbox" id="search-only-bookbag" name="bookbag"
133             value="[% ctx.bookbag.id | html %]" checked="checked" />
134         <label for="search-only-bookbag">
135             [% l('Search only within the chosen list') %]
136         </label>
137     </div>
138     [% END %]
139     [% IF is_advanced || is_special %]
140     <div>
141         <input type="hidden" name="_adv" value="1" />
142         [% IF ctx.processed_search_query OR (NOT is_advanced AND NOT is_special) %]
143         <input name='page' type='hidden' value="0" />
144         [% END %]
145         [% IF is_advanced;
146             FOR p IN CGI.params.keys;
147                 NEXT UNLESS p.match('^fi:');
148                 NEXT IF p.match('^fi:search_format');
149                 FOR pv IN CGI.params.$p;
150                     %]<input type="hidden" name="[% p | html %]" value="[% pv | html %]" />[%
151                 END;
152             END;
153         END %]
154         [% IF is_special %]
155             <input type="hidden" name="_special" value="1" /> [%
156             number_of_expert_rows = CGI.param('tag').list.size;
157             index = 0;
158             WHILE index < number_of_expert_rows %]
159                 <input type="hidden" name="tag" value="[% CGI.param('tag').list.$index | html %]" />
160                 <input type="hidden" name="subfield" value="[% CGI.param('subfield').list.$index | html %]" />
161                 <input type="hidden" name="term" value="[% CGI.param('term').list.$index | html %]" />
162                 [% index = index + 1; %]
163             [% END %]
164         [% END %]
165     </div>
166     [%- END %]
167     [% UNLESS took_care_of_form %]
168         [% IF ctx.default_sort %]
169             <input type="hidden" name="sort" value="[% ctx.default_sort %]"/>
170         [% END %]
171         </form>
172     [% END %]
173     [% IF fcount > 0 %]
174       <div class="refine_search result_block_visible">
175         <span id="filter_hits">[ <a href="#" onclick="getAdvLimits();return false;">[% l('[quant,_1,filter,filters] applied', fcount) %]</a> ]</span>
176       </div>
177     [% END %]
178     [% IF ctx.query_struct.filters.size > 0 %]
179         [% stuff = INCLUDE 'opac/parts/result/adv_filter.tt2' %]
180         [% IF stuff %]
181         <h3 class="sr-only">[% l('Search Results filters') %]</h3>
182         <div id="adv_filter_results_block" class="adv_filter_results_hide">
183         <span class="adv_filter_results_block_label">[% l('Filtered by:') %]</span>
184             [% stuff %]
185         </div>
186         [% END %]
187     [% END %]
188    
189
190     <script>
191     function getAdvLimits() {
192         var AdvLimitsClass = document.getElementById('adv_filter_results_block').classList;
193         if (AdvLimitsClass.contains("adv_filter_results_hide")) {
194            AdvLimitsClass.remove("adv_filter_results_hide");
195         } else {
196            AdvLimitsClass.add("adv_filter_results_hide");
197         }
198         if (AdvLimitsClass.contains("adv_filter_results_show")) {
199            AdvLimitsClass.remove("adv_filter_results_show");
200         } else {
201            AdvLimitsClass.add("adv_filter_results_show");
202         }
203      }
204      </script>
205     <!-- Canonicalized query:
206
207     [% ctx.canonicalized_query | html %]
208
209     -->
210     <!--
211     <div id="breadcrumb">
212         <a href="[% ctx.opac_root %]/home">[% l('Catalog Home') %]</a> &gt;
213     </div>
214     -->
215 </div>