From: Bill Erickson Date: Sat, 28 May 2011 14:01:43 +0000 (-0400) Subject: Format selector improvements X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4ef38401fce1b935151efb387859298f0d548a5f;p=evergreen%2Fequinox.git Format selector improvements Consistent with format icon fall-thru, try mattype first to locate the list of formats for search selection. If no mattype configuration is found, fall through to item_type. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/web/templates/default/opac/parts/advanced/search.tt2 b/Open-ILS/web/templates/default/opac/parts/advanced/search.tt2 index 9f1c94958e..788b57168f 100644 --- a/Open-ILS/web/templates/default/opac/parts/advanced/search.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/advanced/search.tt2 @@ -32,7 +32,7 @@ [% l("Item Type") %]
[% INCLUDE "default/opac/parts/coded_value_selector.tt2" - attr="mattype" multiple="multiple" size="4" + attr=["mattype", "item_type"] multiple="multiple" size="4" id="adv_global_item_type_basic" %] diff --git a/Open-ILS/web/templates/default/opac/parts/coded_value_selector.tt2 b/Open-ILS/web/templates/default/opac/parts/coded_value_selector.tt2 index cfcd9a054e..92a96eea22 100644 --- a/Open-ILS/web/templates/default/opac/parts/coded_value_selector.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/coded_value_selector.tt2 @@ -1,15 +1,28 @@ -[%- name = name || "fi:" _ attr; - id = id || attr _ "_selector"; - values = values || CGI.param(name); -%] + +[%- + # If caller passes a list of possible attribute types, + # search all until we find some values + + IF !attr.size; attr = [attr]; END; + all_values = []; + attr_class = ''; + FOR attr_class IN attr; + all_values = ctx.search_ccvm('ctype', attr_class); + IF all_values.size > 0; LAST; END; + END; + name = name || "fi:" _ attr_class; + id = id || attr_class _ "_selector"; + values = values || CGI.param(name); +-%] + + diff --git a/Open-ILS/web/templates/default/opac/parts/searchbar.tt2 b/Open-ILS/web/templates/default/opac/parts/searchbar.tt2 index a38259f543..433ce68a27 100644 --- a/Open-ILS/web/templates/default/opac/parts/searchbar.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/searchbar.tt2 @@ -48,7 +48,7 @@ [% UNLESS is_advanced %] - [% INCLUDE "default/opac/parts/coded_value_selector.tt2" attr="mattype" none_ok=1 %] + [% INCLUDE "default/opac/parts/coded_value_selector.tt2" attr=["mattype", "item_type"] none_ok=1 %]