]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/searchbar.tt2
LP#1487527: Add config.tt2 options and a basic search button
[working/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" rel="nofollow" vocab="">[% 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'])) %]" rel="nofollow" vocab="">[% 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.processed_search_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     [%- IF (show_more_details.default == 'true' OR show_more_details.default == 'hide') AND !CGI.param('detail_record_view') %]
64         <input id="detail" type="hidden" name="detail_record_view" value="1"/>
65     [%- END %]
66         <input id='search-submit-go' type="submit" value="[% l('Search') %]" class="opac-button"
67             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)'/>
68         [%- IF ctx.depth_sel_button AND NOT took_care_of_form %]
69         <button id='search-submit-go-depth' type="submit" value="[% ctx.depth_sel_depth %]" name="depth" class="[% ctx.depth_sel_button_class %]"
70             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>
71         [%- END %]
72         <img id='search-submit-spinner' src='/opac/images/progressbar_green.gif' style='height:16px;width:16px;' class='hidden' alt='[% l("Search In Progress") %]'/>
73     </span>
74     </div>
75     [% IF ctx.bookbag %]
76     <div id="search-only-bookbag-container">
77         <input type="checkbox" id="search-only-bookbag" name="bookbag"
78             value="[% ctx.bookbag.id | html %]" checked="checked" />
79         <label for="search-only-bookbag">
80             [% l('Search only within the chosen list') %]
81         </label>
82     </div>
83     [% END %]
84     [% IF is_advanced || is_special %]
85     <div>
86         <input type="hidden" name="_adv" value="1" />
87         [% IF ctx.processed_search_query OR (NOT is_advanced AND NOT is_special) %]
88         <input name='page' type='hidden' value="0" />
89         [% END %]
90         [% IF is_special %]
91             <input type="hidden" name="_special" value="1" /> [%
92             number_of_expert_rows = CGI.param('tag').list.size;
93             index = 0;
94             WHILE index < number_of_expert_rows %]
95                 <input type="hidden" name="tag" value="[% CGI.param('tag').list.$index %]" />
96                 <input type="hidden" name="subfield" value="[% CGI.param('subfield').list.$index %]" />
97                 <input type="hidden" name="term" value="[% CGI.param('term').list.$index %]" />
98                 [% index = index + 1; %]
99             [% END %]
100         [% END %]
101     </div>
102     [%- END %]
103     [% UNLESS took_care_of_form %]</form>[% END %]
104     [% IF (is_advanced AND NOT is_special) AND CGI.param('qtype') %]
105     <div class="opac-auto-102">
106         [ <a href="[% mkurl(ctx.opac_root _ '/advanced') %]" rel="nofollow" vocab="">[%
107             l('Refine My Original Search')
108         %]</a> ]
109     </div>
110     [% END %]
111     <!--
112     <div id="breadcrumb">
113         <a href="[% ctx.opac_root %]/home">[% l('Catalog Home') %]</a> &gt;
114     </div>
115     -->
116     <div class="clear-both"></div>
117 </div>