]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/templates/default/opac/parts/coded_value_selector.tt2
92a96eea2218073b41dd6f7b217038f9cb6cdffb
[working/Evergreen.git] / Open-ILS / web / templates / default / opac / parts / coded_value_selector.tt2
1
2 [%- 
3     # If caller passes a list of possible attribute types, 
4     # search all until we find some values
5
6     IF !attr.size; attr = [attr]; END;
7     all_values = [];
8     attr_class = '';
9     FOR attr_class IN attr;
10         all_values = ctx.search_ccvm('ctype', attr_class);
11         IF all_values.size > 0; LAST; END;
12     END;
13     name = name || "fi:" _ attr_class;
14     id = id || attr_class _ "_selector";
15     values = values || CGI.param(name); 
16 -%]
17
18 <select id='[% id %]' name='[% name %]'[%
19     multiple ? ' multiple="multiple"' : '';
20     size ? (' size="' _ size _ '"') : ''; %]>
21 [% IF none_ok %]
22     <option value=''>[% l('-- Any --') %]</option>
23 [% END %]
24 [% FOR o IN all_values %]
25     <option value='[% o.code %]'[% values.grep('^' _ o.code _ '$').size ? ' selected="selected"' : '' %]>[% o.value %]</option>
26 [%  END -%]
27 </select>
28