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