From 470bf347f88c1a80ae641c40aaf99b337e74c51f Mon Sep 17 00:00:00 2001 From: berick Date: Wed, 20 Apr 2011 11:01:45 -0400 Subject: [PATCH] format selector gets formats from CCVM fields, starting with 'mattype', falling back to item_type --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 3 +++ .../templates/default/opac/parts/format_selector.tt2 | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm index 9577121159..524c9a6b45 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -51,6 +51,7 @@ sub _prepare_biblio_search { $query = ('#' . $_ . ' ' . $query) foreach ($cgi->param('modifier')); + # filters foreach (grep /^fi:/, $cgi->param) { /:(\w+)$/ or next; my $term = join(",", $cgi->param($_)); @@ -128,6 +129,8 @@ sub load_rresults { $query = "$query $facet" if $facet; # TODO + $logger->activity("EGWeb: [search] $query"); + my $results; try { diff --git a/Open-ILS/web/templates/default/opac/parts/format_selector.tt2 b/Open-ILS/web/templates/default/opac/parts/format_selector.tt2 index 2ca397b053..d52129b399 100644 --- a/Open-ILS/web/templates/default/opac/parts/format_selector.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/format_selector.tt2 @@ -1,12 +1,23 @@ -[%- name = name || "fi:format"; +[% + # Start w/ mattype, fall back to item_type + format_spec = ''; + formats = []; + FOR format_spec IN ['mattype', 'item_type']; + formats = ctx.search_ccvm('ctype', format_spec); + IF formats.size; BREAK; END; + END; + name = name || "fi:" _ format_spec; id = id || "format_selector"; - values = values || CGI.param(name) -%] + values = values || CGI.param(name) +-%] +