kpac : global filter config option
authorBill Erickson <berick@esilibrary.com>
Wed, 23 May 2012 15:44:28 +0000 (11:44 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 30 Jul 2012 19:05:03 +0000 (15:05 -0400)
Allows for configuration of an always-on global search filter.  All
searches, regardless of origin, in the kpac will be appended by this
filter when configured.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/examples/kpac.xml.example
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm

index d2f9c67..fde9883 100644 (file)
@@ -1,4 +1,13 @@
 <kpac version="1.0" xmlns="http://evergreen-ils.org/spec/OPAC/kpac/v1">
+
+    <!-- 
+    If configured, all searches, including topic searches configured
+    below, will be appended with this filter.  The purpose is to restrict 
+    all searches within the kpac to a specific collection.
+
+    <global_filter>audience(a,b,c,d,j)</global_filter>
+    -->
+
     <pages>
         <!-- top-level layout pages -->
         <page id="1" columns="5" name="Home" img="/images/home.jpg">
index 36f3436..5d40319 100644 (file)
@@ -64,6 +64,8 @@ sub _prepare_biblio_search {
 
     my $query = _prepare_biblio_search_basics($cgi) || '';
 
+    $query .= ' ' . $ctx->{global_search_filter} if $ctx->{global_search_filter};
+
     foreach ($cgi->param('modifier')) {
         # The unless bit is to avoid stacking modifiers.
         $query = ('#' . $_ . ' ' . $query) unless $query =~ qr/\#\Q$_/;
index 85269d3..2f0e49e 100644 (file)
@@ -242,6 +242,7 @@ sub load_kpac_config {
     $ctx->{kpac_config} = $kpac_config;
     $ctx->{kpac_root} = $ctx->{base_path} . "/kpac"; 
     $ctx->{home_page} = 'http://' . $self->apache->hostname . $ctx->{kpac_root} . "/home";
+    $ctx->{global_search_filter} = $kpac_config->{global_filter};
 }