LP#1663374: Allow metarecord searching by default
[Evergreen.git] / Open-ILS / src / templates / 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  %]
16 <div id="search-wrapper">
17     [% UNLESS took_care_of_form -%]
18     <form action="[% ctx.opac_root %]/results" method="get">
19     [%- END %]
20     [% IF ctx.page == 'rresult' && ctx.metarecord && search.metarecord_default %]
21     <input type="hidden" name="modifier" value="metabib"/>
22     [% END %]
23     [% IF (ctx.page == 'place_hold' || ctx.page == 'myopac' || ctx.page == 'home' || ctx.page == 'record') && search.metarecord_default %]
24     <input type="hidden" name="modifier" value="metabib"/>
25     [% END %]
26     <div id="search-box">
27         <span class="search_catalog_lbl mobile_hide">[% l('Search the Catalog') %]</span>
28         <span class="adv_search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/advanced', {},  expert_search_parms.merge(browse_search_parms, facet_search_parms)) %]"
29             id="home_adv_search_link">[% l('Advanced Search') %]</a></span>
30         <span class="browse_the_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/browse', {}, expert_search_parms.merge(general_search_parms, facet_search_parms, ['fi:has_browse_entry'])) %]">[% l('Browse the Catalog') %]</a></span>
31     </div>
32     <div class="searchbar">
33         <span class='search_box_wrapper'>
34             [%- # autosuggest breaks accessibility, as the aria-label
35                 # attribute is removed when the Dijit is created. :(  %]
36             <label id="search_box_label" for="search_box">[% l('Search: ') %]
37             <input type="text" id="search_box" name="query" aria-label="[%
38                     l('Enter search query:');
39                 %]" value="[% is_advanced ? ctx.naive_query_scrub(ctx.user_query) : CGI.param('query') | html %]"
40                 [%- IF use_autosuggest.enabled == "t" %]
41                 dojoType="openils.widget.AutoSuggest" type_selector="'qtype'"
42                 submitter="this.textbox.form.submit();"
43                 [%-     IF use_autosuggest.value.search('opac_visible') %]
44                 store_args='{"org_unit_getter": function() { return [% ctx.search_ou %]; }}'
45                 [%-     END # opac_visible -%]
46                 [%- ELSE -%]
47                     [% IF basic_search != "f" %] autofocus [% END %] x-webkit-speech
48                 [%- END # autosuggest enabled %] />
49             </label>
50         </span>
51         <label id="search_qtype_label" for="qtype">
52         [%- 
53             l('Type: ');
54             INCLUDE "opac/parts/qtype_selector.tt2" id="qtype";
55         -%]
56         </label>
57         <label id="search_itype_label" for="search_itype_selector">
58         [%-
59             l('Format: ');
60             IF search.basic_config.type == 'attr';
61                 INCLUDE "opac/parts/coded_value_selector.tt2"
62                     attr=search.basic_config.group none_ok=1 
63                     id='search_itype_selector'
64                     none_label=search.basic_config.none_label;
65             ELSIF search.basic_config.type == 'filter';
66                 INCLUDE "opac/parts/filter_group_selector.tt2"
67                     filter_group=search.basic_config.group none_ok=1 
68                     id='search_itype_selector'
69                     none_label=search.basic_config.none_label;
70             END;
71         -%]
72         </label>
73         <label id="search_locg_label" for="search_org_selector">
74         [%- 
75             l('Library: ');
76             select_lib_label = l("Select search library");
77             INCLUDE build_org_selector arialabel=select_lib_label 
78               id='search_org_selector' show_loc_groups=1
79         -%]
80         </label>
81     <span>
82         <input id="detail" type="hidden" name="detail_record_view" value="[% show_detail_view %]"/>
83         <input id='search-submit-go' type="submit" value="[% l('Search') %]" class="opac-button"
84             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)'/>
85         [%- IF ctx.depth_sel_button AND NOT took_care_of_form %]
86         <button id='search-submit-go-depth' type="submit" value="[% ctx.depth_sel_depth %]" name="depth" class="[% ctx.depth_sel_button_class %]"
87             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>
88         [%- END %]
89         <img id='search-submit-spinner' src='/opac/images/progressbar_green.gif' style='height:16px;width:16px;' class='hidden' alt='[% l("Search In Progress") %]'/>
90     </span>
91     </div>
92     [% IF ctx.bookbag %]
93     <div id="search-only-bookbag-container">
94         <input type="checkbox" id="search-only-bookbag" name="bookbag"
95             value="[% ctx.bookbag.id | html %]" checked="checked" />
96         <label for="search-only-bookbag">
97             [% l('Search only within the chosen list') %]
98         </label>
99     </div>
100     [% END %]
101     [% IF is_advanced || is_special %]
102     <div>
103         <input type="hidden" name="_adv" value="1" />
104         [% IF ctx.processed_search_query OR (NOT is_advanced AND NOT is_special) %]
105         <input name='page' type='hidden' value="0" />
106         [% END %]
107         [% IF is_advanced;
108             FOR p IN CGI.params.keys;
109                 NEXT UNLESS p.match('^fi:');
110                 FOR pv IN CGI.params.$p;
111                     %]<input type="hidden" name="[% p %]" value="[% pv %]" />[%
112                 END;
113             END;
114         END %]
115         [% IF is_special %]
116             <input type="hidden" name="_special" value="1" /> [%
117             number_of_expert_rows = CGI.param('tag').list.size;
118             index = 0;
119             WHILE index < number_of_expert_rows %]
120                 <input type="hidden" name="tag" value="[% CGI.param('tag').list.$index %]" />
121                 <input type="hidden" name="subfield" value="[% CGI.param('subfield').list.$index %]" />
122                 <input type="hidden" name="term" value="[% CGI.param('term').list.$index %]" />
123                 [% index = index + 1; %]
124             [% END %]
125         [% END %]
126     </div>
127     [%- END %]
128     [% UNLESS took_care_of_form %]
129         [% IF ctx.default_sort %]
130             <input type="hidden" name="sort" value="[% ctx.default_sort %]"/>
131         [% END %]
132         </form>
133     [% END %]
134     [% IF (is_advanced AND NOT is_special) AND CGI.param('qtype') %]
135     <div class="refine_search result_block_visible">
136         [% IF fcount > 0 %]
137         <span id="filter_hits">[ <a href="#" onclick="getFacety();">[% l('[quant,_1,filter,filters] applied', fcount) %]</a> ]</span>
138         [% END %]
139         [ <a href="[% mkurl(ctx.opac_root _ '/advanced') %]">[%
140             l('Refine My Original Search')
141         %]</a> ]
142     </div>
143     [% END %]
144     <!-- Canonicalized query:
145
146     [% ctx.canonicalized_query | html %]
147
148     -->
149     <!--
150     <div id="breadcrumb">
151         <a href="[% ctx.opac_root %]/home">[% l('Catalog Home') %]</a> &gt;
152     </div>
153     -->
154     <div class="clear-both"></div>
155 </div>