]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/result/adv_filter.tt2
367c816f364417a4ff4fca03f8918fd1e37ed222
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / result / adv_filter.tt2
1 [%-
2
3 pubdate_filters = ['date1', 'before', 'after', 'between'];
4
5 FOR filter IN ctx.query_struct.filters;
6     fname = filter.name;
7     fvalues = filter.args;
8     crad = ctx.get_crad(fname);
9
10     # will be some special ones, like locations
11     IF crad AND NOT pubdate_filters.grep('^' _ filter.name _ '$').size;
12         remove_filter = 'fi:' _ fname;
13 -%]
14          <div class="adv_filter_results_group_wrapper">
15            <div class="adv_filter_results_group">
16             <h4 class="title">[% IF filter.negate; l('Not'); END %] [% (crad.description || crad.label) | html %]</h4>
17             [% temp = [];
18                FOR fval IN fvalues;
19                 thing = ctx.search_ccvm('ctype',fname,'code',fval).0;
20                 display_value = thing.search_label || thing.value;
21                 IF display_value.defined;
22                  temp.push(display_value);
23                 END;
24                END;
25                FOR display_value IN temp.sort;
26             %]
27                  <span class="adv_search_result_filter">
28                     [% display_value | html %]
29                       [% UNLESS loop.last; 
30                          l('OR');
31                       END %]
32                  </span>
33
34             [% END; # FOR %]
35               <a class="button remove_filter"
36               title="[% l('Remove [_1] filter', (crad.description || crad.label)) %]"
37               aria-label=[% l('Remove [_1] filter', (crad.description || crad.label)) %]"
38               href="[% mkurl('', {}, [remove_filter]) %]" rel="nofollow" vocab="">&times; </a>
39              </div>
40            </div>
41     [%- END; # IF crad -%]
42
43 [%-  IF filter.name == 'locations'; locs = ctx.search_acpl('id',filter.args) -%]
44     <div class="adv_filter_results_group_wrapper">
45       <div class="adv_filter_results_group">
46             <h4 class="title">[% IF filter.negate; l('Not'); END %] [% l('Locations') %]</h4>
47             [% temp = [];
48                FOR loc IN locs;
49                 temp.push(loc.name);
50                END;
51                FOR display_name IN temp.sort; %]
52                   <span class="adv_search_result_filter">
53                     [% display_name | html%]
54                   </span>
55             [% END; # FOR %]
56             <a class="button remove_filter"
57               title="[% l('Remove location filter') %]"
58               href="[% mkurl('', {}, ['fi:locations']) %]" rel="nofollow" vocab=""> &times;</a>
59       </div>
60     </div> 
61 [%- END; # IF locations -%]
62
63 [%- IF pubdate_filters.grep('^' _ filter.name _ '$').size;
64     date1 = CGI.param('date1');
65     date2 = CGI.param('date2');
66 -%]
67     <div class="adv_filter_results_group_wrapper">
68       <div class="adv_filter_results_group">
69             <h4 class="title">[% IF filter.negate; l('Not'); END %] [% l('Publication Year') %]</h4>
70               <span class="adv_search_result_filter">
71               [% IF    filter.name == 'date1'      %][% l('[_1]', date1) %]
72               [% ELSIF filter.name == 'before'  %][% l('Before [_1]', date1) %]
73               [% ELSIF filter.name == 'after'   %][% l('After [_1]', date1) %]
74               [% ELSIF filter.name == 'between' %][% l('Between [_1] and [_2]', date1, date2) %]
75               [% END %]
76               </span>
77               <a class="button remove_filter"
78               title="[% l('Remove publication date filter') %]"
79               href="[% mkurl('', {}, ['pubdate', 'date1', 'date2']) %]" rel="nofollow" vocab="">&times; </a>
80       </div>
81     </div>
82
83 [%- END; # IF pubdate_filters -%]
84 [%- END; # FOR -%]