From def24badbf3c3074a621efa054bb8b334cd866d7 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Thu, 28 Jul 2011 11:10:47 -0400 Subject: [PATCH] You can now have multiple rows in your MARC Expert Search Signed-off-by: Lebbeous Fogle-Weekley --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 4 ++++ Open-ILS/web/js/ui/default/opac/simple.js | 21 +++++++++++++++++++-- .../default/opac/parts/advanced/expert.tt2 | 11 ++++++++--- .../default/opac/parts/advanced/global_row.tt2 | 2 +- .../templates/default/opac/parts/result/lowhits.tt2 | 2 +- 5 files changed, 33 insertions(+), 7 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 2a9e5cdfed..f9594b3164 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -6,6 +6,8 @@ use OpenILS::Utils::CStoreEditor qw/:funcs/; use OpenILS::Utils::Fieldmapper; use OpenILS::Application::AppUtils; use OpenSRF::Utils::JSON; +use Data::Dumper; +$Data::Dumper::Indent = 0; my $U = 'OpenILS::Application::AppUtils'; @@ -274,12 +276,14 @@ sub marc_expert_search { my $query = []; for (my $i = 0; $i < scalar @tags; $i++) { + next if ($tags[$i] eq "" || $subfields[$i] eq "" || $terms[$i] eq ""); push @$query, { "term" => $terms[$i], "restrict" => [{"tag" => $tags[$i], "subfield" => $subfields[$i]}] }; } + $logger->info("query for expert search: " . Dumper($query)); # loc, limit and offset my $page = $self->cgi->param("page") || 0; my $limit = $self->_get_search_limit; diff --git a/Open-ILS/web/js/ui/default/opac/simple.js b/Open-ILS/web/js/ui/default/opac/simple.js index d80b108572..eaa11e2499 100644 --- a/Open-ILS/web/js/ui/default/opac/simple.js +++ b/Open-ILS/web/js/ui/default/opac/simple.js @@ -14,7 +14,7 @@ function addClass(node, cls) { function unHideMe(node) { removeClass(node, "hide_me"); } function hideMe(node) { addClass(node, "hide_me"); } -var _search_row_template; +var _search_row_template, _expert_row_template; function addSearchRow() { if (!_search_row_template) { t = $("adv_global_row").cloneNode(true); @@ -27,6 +27,23 @@ function addSearchRow() { $("adv_global_addrow") ); } +function addExpertRow() { + if (!_expert_row_template) { + t = $("adv_expert_row").cloneNode(true); + t.id = null; + _expert_row_template = t; + } + + $("adv_expert_rows_here").appendChild( + _expert_row_template.cloneNode(true) + ); +} +function killRowIfAtLeast(min, link) { + var row = link.parentNode.parentNode; + if (row.parentNode.getElementsByTagName("tr").length > min) + row.parentNode.removeChild(row); + return false; +} function print_node(node_id) { var iframe = document.createElement("iframe"); var source_node = document.getElementById(node_id); @@ -38,7 +55,7 @@ function print_node(node_id) { * hurt FF/Chrome. */ iwin.document.open(); iwin.document.write( /* XXX make better/customizable? */ - "Recipt" + "Receipt" ); iwin.document.close(); diff --git a/Open-ILS/web/templates/default/opac/parts/advanced/expert.tt2 b/Open-ILS/web/templates/default/opac/parts/advanced/expert.tt2 index 640b4f228e..935da519b9 100644 --- a/Open-ILS/web/templates/default/opac/parts/advanced/expert.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/advanced/expert.tt2 @@ -2,19 +2,24 @@
[% l("Expert Search") %]
- - + + + - + diff --git a/Open-ILS/web/templates/default/opac/parts/advanced/global_row.tt2 b/Open-ILS/web/templates/default/opac/parts/advanced/global_row.tt2 index ae8081e069..926504e0dd 100644 --- a/Open-ILS/web/templates/default/opac/parts/advanced/global_row.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/advanced/global_row.tt2 @@ -26,7 +26,7 @@ + onclick='return killRowIfAtLeast(2, this);'> [% i = i + 1; diff --git a/Open-ILS/web/templates/default/opac/parts/result/lowhits.tt2 b/Open-ILS/web/templates/default/opac/parts/result/lowhits.tt2 index c66b114945..7526f1df27 100644 --- a/Open-ILS/web/templates/default/opac/parts/result/lowhits.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/result/lowhits.tt2 @@ -2,7 +2,7 @@

[% l('Sorry, no entries were found for') %] - [% IF is_advanced; l('your search'); ELSE %] + [% IF is_advanced OR is_special; l('your search'); ELSE %] [% CGI.param('query') | html %] [% END %]
-- 2.11.0