]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates-bootstrap/opac/parts/searchbar.tt2
LP#1778972: (follow-up) use OILSWebTemplatePath to enable/disable the bootstrap OPAC
[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="container py-3">
43     <div class="row">
44      <!--Keyword-->
45         <div class="col-xs-12 col-sm-12 col-md-6 col-lg-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 %] x-webkit-speech
61                 [%- END # autosuggest enabled %] />
62             </label>
63         </span>
64         </div>
65         
66         <!--Type-->
67         <div class="col-xs-12 col-sm-12 col-md-6 col-lg-3">
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-md-6 col-lg-3">
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-md-6 col-lg-3">
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>
108       <div class="row">
109       <span class="mx-auto mt-3">
110         <input id="detail" type="hidden" name="detail_record_view" value="[% show_detail_view %]"/>
111         <input id='search-submit-go' type="submit" value="[% l('Search') %]" class="btn btn-opac"
112             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)'/>
113         [%- IF ctx.depth_sel_button AND NOT took_care_of_form %]
114         <button id='search-submit-go-depth' type="submit" value="[% ctx.depth_sel_depth %]" name="depth" class="[% #ctx.depth_sel_button_class %] btn btn-opac"
115             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 %]">[% ctx.depth_sel_button_label | html %]</button>
116         [%- END %]
117         <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") %]'/>
118         
119           
120             </div>
121            
122           
123       </span>
124      
125     </div>
126     
127   
128             
129     [% IF ctx.bookbag %]
130     <div id="search-only-bookbag-container" class="text-center">
131         <input type="checkbox" id="search-only-bookbag" name="bookbag"
132             value="[% ctx.bookbag.id | html %]" checked="checked" />
133         <label for="search-only-bookbag">
134             [% l('Search only within the chosen list') %]
135         </label>
136     </div>
137     [% END %]
138     [% IF is_advanced || is_special %]
139     <div>
140         <input type="hidden" name="_adv" value="1" />
141         [% IF ctx.processed_search_query OR (NOT is_advanced AND NOT is_special) %]
142         <input name='page' type='hidden' value="0" />
143         [% END %]
144         [% IF is_advanced;
145             FOR p IN CGI.params.keys;
146                 NEXT UNLESS p.match('^fi:');
147                 NEXT IF p.match('^fi:search_format');
148                 FOR pv IN CGI.params.$p;
149                     %]<input type="hidden" name="[% p | html %]" value="[% pv | html %]" />[%
150                 END;
151             END;
152         END %]
153         [% IF is_special %]
154             <input type="hidden" name="_special" value="1" /> [%
155             number_of_expert_rows = CGI.param('tag').list.size;
156             index = 0;
157             WHILE index < number_of_expert_rows %]
158                 <input type="hidden" name="tag" value="[% CGI.param('tag').list.$index | html %]" />
159                 <input type="hidden" name="subfield" value="[% CGI.param('subfield').list.$index | html %]" />
160                 <input type="hidden" name="term" value="[% CGI.param('term').list.$index | html %]" />
161                 [% index = index + 1; %]
162             [% END %]
163         [% END %]
164     </div>
165     [%- END %]
166     [% UNLESS took_care_of_form %]
167         [% IF ctx.default_sort %]
168             <input type="hidden" name="sort" value="[% ctx.default_sort %]"/>
169         [% END %]
170         </form>
171     [% END %]
172     [% IF fcount > 0 %]
173       <div class="refine_search result_block_visible">
174         <span id="filter_hits">[ <a href="#" onclick="getAdvLimits();return false;">[% l('[quant,_1,filter,filters] applied', fcount) %]</a> ]</span>
175       </div>
176     [% END %]
177     [% IF ctx.query_struct.filters.size > 0 %]
178         [% stuff = INCLUDE 'opac/parts/result/adv_filter.tt2' %]
179         [% IF stuff %]
180         <h3 class="sr-only">[% l('Search Results filters') %]</h3>
181         <div id="adv_filter_results_block" class="adv_filter_results_hide">
182         <span class="adv_filter_results_block_label">[% l('Filtered by:') %]</span>
183             [% stuff %]
184         </div>
185         [% END %]
186     [% END %]
187    
188
189     <script>
190     function getAdvLimits() {
191         var AdvLimitsClass = document.getElementById('adv_filter_results_block').classList;
192         if (AdvLimitsClass.contains("adv_filter_results_hide")) {
193            AdvLimitsClass.remove("adv_filter_results_hide");
194         } else {
195            AdvLimitsClass.add("adv_filter_results_hide");
196         }
197         if (AdvLimitsClass.contains("adv_filter_results_show")) {
198            AdvLimitsClass.remove("adv_filter_results_show");
199         } else {
200            AdvLimitsClass.add("adv_filter_results_show");
201         }
202      }
203      </script>
204     <!-- Canonicalized query:
205
206     [% ctx.canonicalized_query | html %]
207
208     -->
209     <!--
210     <div id="breadcrumb">
211         <a href="[% ctx.opac_root %]/home">[% l('Catalog Home') %]</a> &gt;
212     </div>
213     -->
214     <div class="clear-both"></div>
215 </div>