3 # If caller passes a list of possible attribute types,
4 # search all until we find some values
6 IF !attr.size; attr = [attr]; END;
9 FOR attr_class IN attr;
10 all_values = ctx.search_ccvm('ctype', attr_class, 'opac_visible', 't');
11 IF all_values.size > 0; LAST; END;
13 name = name || "fi:" _ attr_class;
14 id = id || attr_class _ "_selector";
15 values = values || CGI.param(name);
18 <select id='[% id %]' name='[% name %]'[%
19 multiple ? ' multiple="multiple"' : '';
20 size ? (' size="' _ size _ '"') : ''; %]>
22 <option value=''>[% none_label ? none_label : l('-- Any --') %]</option>
24 # turn the list of objects into a list of hashes to
25 # leverage TT's array.sort('<hashkey>') behavior
29 IF o.is_simple == 't';
30 simple_sorter.push({code => o.code, value => (o.search_label ? o.search_label : o.value)});
32 sorter.push({code => o.code, value => (o.search_label ? o.search_label : o.value)});
35 FOR o IN simple_sorter.sort('value') %]
36 <option value='[% o.code | html | replace("'","'") %]'[% values.grep('^' _ o.code _ '$').size ? ' selected="selected"' : '' %]>[% o.value | html %]</option>
38 IF simple_sorter.size && sorter.size %]
39 <option disabled='true'>-----</option>
41 FOR o IN sorter.sort('value') %]
42 <option value='[% o.code | html | replace("'","'") %]'[% values.grep('^' _ o.code _ '$').size ? ' selected="selected"' : '' %]>[% o.value | html %]</option>