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