]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/advanced/global_row.tt2
LP1735768: adding labels to inputs in the public catalog
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / advanced / global_row.tt2
1 [%
2     contains_options = [
3         {value => 'contains', label => l('Contains')},
4         {value => 'nocontains', label => l('Does not contain')},
5         {value => 'phrase', label => l('Contains phrase')},
6         {value => 'exact', label => l('Matches exactly')},
7         {value => 'starts', label => l('Starts with')}
8     ];
9     contains = CGI.param('contains');
10     queries = CGI.param('query');
11     bools = CGI.param('bool');
12     qtypes = CGI.param('qtype');
13     rowcount = 3;
14
15     # scalar.merge treats the scalar as a 1-item array
16     WHILE queries.size < rowcount; queries = queries.merge(['']); END;
17     WHILE bools.size < rowcount; bools = bools.merge(['and']); END;
18     WHILE qtypes.size < rowcount; qtypes = qtypes.merge(search.default_qtypes.${qtypes.size} ? [search.default_qtypes.${qtypes.size}] : ['keyword']); END;
19
20     FOR qtype IN qtypes;
21         c = contains.shift;
22         b = bools.shift;
23         q = queries.shift; %]
24
25 <!-- tag the second row so the bool column won't be hidden -->
26 <tr[% IF loop.index == 1 %] id="adv_global_row"[% END %]>
27     <td class="td-left">
28
29         <!-- bool selector.  hide for first row.  safe to ignore first bool value in form submission -->
30         <select title="[% l('Boolean search operator') %]" 
31           name='bool' style='width: auto' [% IF loop.first %] class='invisible' [% END %]>
32             <option value='and' [% b == 'and' ? 'selected="selected"' : '' %]>[% l('And') %]</option>
33             <option value='or' [% b == 'or' ? 'selected="selected"' : '' %]>[% l('Or') %]</option>
34         </select>
35
36         <!-- keyword, subject, etc. selector -->
37         <span class="qtype_selector_margin">
38             [% INCLUDE "opac/parts/qtype_selector.tt2"
39                 query_type=qtype %]
40         </span>
41
42         <select title="[% l('Search phrase match strictness') %]"
43           name='contains' style='margin-right: 7px;'>
44             [% FOR o IN contains_options; -%]
45             <option value="[% o.value %]" [% c == o.value ? ' selected="selected"' : '' %]>[% o.label %]</option>
46             [% END %]
47         </select>
48         <input title="[% l('Search term') %]" aria-label="[% l('Search term') %]"
49           type='text' size='18' name='query' value="[% q | html %]" x-webkit-speech [% IF loop.index == 0 %] autofocus [% END %] />
50         <a href="javascript:;" class="row-remover"
51             title="[% l('Remove row') %]" alt="[% l('Remove row') %]"
52             onclick='return killRowIfAtLeast(2, this);'>
53                 <img src="[% ctx.media_prefix %]/images/expert_row_close_btn.png[% ctx.cache_key %]"
54                     alt="[% l('Remove row') %]"/>
55             </a>
56     </td>
57 </tr>
58 [% END %]