From ec6e65c27441e45e5e1fa8d1a6e0a2ff435cf55d Mon Sep 17 00:00:00 2001 From: senator Date: Tue, 15 Mar 2011 17:53:58 -0400 Subject: [PATCH] smarter search term propagation, should avoid ARRAY(0xdeadbeef) type ... ... stuff in search boxes --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 6 +++--- Open-ILS/web/templates/default/opac/parts/header.tt2 | 2 ++ Open-ILS/web/templates/default/opac/parts/searchbar.tt2 | 8 +++++--- Open-ILS/web/templates/default/opac/results.tt2 | 3 +-- 4 files changed, 11 insertions(+), 8 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 84c68a7148..7a4d49177f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -77,11 +77,11 @@ sub _prepare_biblio_search { } } - my $site = $cgi->param('loc') || $ctx->{aou_tree}->()->id; - if (defined($cgi->param('loc')) or not $query =~ /site\(\d+\)/) { + my $site = $cgi->param('loc'); + if (defined($site) and ($site ne $ctx->{aou_tree}->()->id) and not $query =~ /site\(\d+\)/) { $query .= " site($site)"; } - if (defined($cgi->param('depth')) or not $query =~ /depth\(\d+\)/) { + if (defined($cgi->param('depth')) and not $query =~ /depth\(\d+\)/) { my $depth = defined $cgi->param('depth') ? $cgi->param('depth') : $ctx->{find_aou}->($site)->ou_type->depth; $query .= " depth($depth)"; diff --git a/Open-ILS/web/templates/default/opac/parts/header.tt2 b/Open-ILS/web/templates/default/opac/parts/header.tt2 index fa775b207d..aa34ab5d3a 100644 --- a/Open-ILS/web/templates/default/opac/parts/header.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/header.tt2 @@ -19,6 +19,8 @@ propagator = '?' _ query_string; + is_advanced = CGI.param("_adv").size; + formats = [ # XXX KCLS-specific {'code' => 'a', 'name' => 'Book', 'image' => 'media_book.jpg'}, {'code' => 'i', 'name' => 'Book on cassette', 'image' => 'media_bookoncasset.jpg'}, diff --git a/Open-ILS/web/templates/default/opac/parts/searchbar.tt2 b/Open-ILS/web/templates/default/opac/parts/searchbar.tt2 index 84ab264723..158a93f753 100644 --- a/Open-ILS/web/templates/default/opac/parts/searchbar.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/searchbar.tt2 @@ -20,8 +20,9 @@ [% INCLUDE "default/opac/parts/qtype_selector.tt2" %] - [% END %] + [% IF ctx.processed_search_query OR NOT is_advanced %] +
+ [% END %] [% UNLESS is_advanced %] @@ -59,10 +61,10 @@ [% END %] [% UNLESS took_care_of_form %][% END %] - [% IF is_advanced %] + [% IF is_advanced AND CGI.param('qtype') %]
[ [% - l('Click to Refine Your Search') + l('Click to Refine Your Original Search') %] ]
[% END %] diff --git a/Open-ILS/web/templates/default/opac/results.tt2 b/Open-ILS/web/templates/default/opac/results.tt2 index 19735e2e60..3b06cae3c2 100644 --- a/Open-ILS/web/templates/default/opac/results.tt2 +++ b/Open-ILS/web/templates/default/opac/results.tt2 @@ -4,7 +4,6 @@ WRAPPER "default/opac/parts/base.tt2"; INCLUDE "default/opac/parts/topnav.tt2"; ctx.page_title = l("Search Results"); - is_advanced = CGI.param("_adv").size; page = CGI.param('page') || 0; page_count = POSIX.ceil(ctx.hit_count / ctx.page_size); @@ -39,7 +38,7 @@ [% END %]
- [% UNLESS CGI.param('_adv') %] + [% UNLESS is_advanced %]
Sort by
[% INCLUDE "default/opac/parts/filtersort.tt2" value=CGI.param('sort') %]
-- 2.43.2