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