From 6c76c4f7405323c7a0d413b8a27ec4bad6188c8d Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 22 Feb 2017 16:02:33 -0500
Subject: [PATCH] Fix broken FacetList support for authorities, authors and
 reserves.

---
 module/VuFind/config/module.config.php            |  6 +++---
 .../src/VuFind/Controller/AuthorController.php    | 15 +++++++++++++++
 .../src/VuFind/Controller/SearchController.php    | 11 +++++++++++
 .../VuFind/src/VuFind/Search/SolrAuth/Options.php | 11 +++++++++++
 .../src/VuFind/Search/SolrAuthor/Options.php      | 11 +++++++++++
 .../src/VuFind/Search/SolrReserves/Options.php    | 11 +++++++++++
 .../templates/search/reservessearch.phtml         |  2 ++
 7 files changed, 64 insertions(+), 3 deletions(-)

diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php
index fed1d0db8d1..fab76be3017 100644
--- a/module/VuFind/config/module.config.php
+++ b/module/VuFind/config/module.config.php
@@ -746,8 +746,8 @@ $dynamicRoutes = [
 
 // Define static routes -- Controller/Action strings
 $staticRoutes = [
-    'Alphabrowse/Home', 'Author/Home', 'Author/Search',
-    'Authority/Home', 'Authority/Record', 'Authority/Search',
+    'Alphabrowse/Home', 'Author/FacetList', 'Author/Home', 'Author/Search',
+    'Authority/FacetList', 'Authority/Home', 'Authority/Record', 'Authority/Search',
     'Browse/Author', 'Browse/Dewey', 'Browse/Era', 'Browse/Genre', 'Browse/Home',
     'Browse/LCC', 'Browse/Region', 'Browse/Tag', 'Browse/Topic', 'Cart/doExport',
     'Cart/Email', 'Cart/Export', 'Cart/Home', 'Cart/MyResearchBulk',
@@ -778,7 +778,7 @@ $staticRoutes = [
     'OAI/Server', 'Pazpar2/Home', 'Pazpar2/Search', 'Records/Home',
     'Search/Advanced', 'Search/Email', 'Search/FacetList', 'Search/History',
     'Search/Home', 'Search/NewItem', 'Search/OpenSearch', 'Search/Reserves',
-    'Search/Results', 'Search/Suggest',
+    'Search/ReservesFacetList', 'Search/Results', 'Search/Suggest',
     'Summon/Advanced', 'Summon/FacetList', 'Summon/Home', 'Summon/Search',
     'Tag/Home',
     'Upgrade/Home', 'Upgrade/FixAnonymousTags', 'Upgrade/FixDuplicateTags',
diff --git a/module/VuFind/src/VuFind/Controller/AuthorController.php b/module/VuFind/src/VuFind/Controller/AuthorController.php
index 4ce8724b816..96746db8f62 100644
--- a/module/VuFind/src/VuFind/Controller/AuthorController.php
+++ b/module/VuFind/src/VuFind/Controller/AuthorController.php
@@ -38,6 +38,21 @@ namespace VuFind\Controller;
  */
 class AuthorController extends AbstractSearch
 {
+    /**
+     * Returns a list of all items associated with one facet for the lightbox
+     *
+     * Parameters:
+     * facet        The facet to retrieve
+     * searchParams Facet search params from $results->getUrlQuery()->getParams()
+     *
+     * @return mixed
+     */
+    public function facetListAction()
+    {
+        $this->searchClassId = 'SolrAuthor';
+        return parent::facetListAction();
+    }
+
     /**
      * Sets the configuration for displaying author results
      *
diff --git a/module/VuFind/src/VuFind/Controller/SearchController.php b/module/VuFind/src/VuFind/Controller/SearchController.php
index e68c1fa05c2..e32847da14f 100644
--- a/module/VuFind/src/VuFind/Controller/SearchController.php
+++ b/module/VuFind/src/VuFind/Controller/SearchController.php
@@ -411,6 +411,17 @@ class SearchController extends AbstractSearch
         );
     }
 
+    /**
+     * Show facet list for Solr-driven reserves.
+     *
+     * @return mixed
+     */
+    public function reservesfacetlistAction()
+    {
+        $this->searchClassId = 'SolrReserves';
+        return $this->facetListAction();
+    }
+
     /**
      * Show search form for Solr-driven reserves.
      *
diff --git a/module/VuFind/src/VuFind/Search/SolrAuth/Options.php b/module/VuFind/src/VuFind/Search/SolrAuth/Options.php
index 409977a38bb..4db4a16228c 100644
--- a/module/VuFind/src/VuFind/Search/SolrAuth/Options.php
+++ b/module/VuFind/src/VuFind/Search/SolrAuth/Options.php
@@ -50,6 +50,17 @@ class Options extends \VuFind\Search\Solr\Options
         $this->spellcheck = false;
     }
 
+    /**
+     * Return the route name for the facet list action. Returns false to cover
+     * unimplemented support.
+     *
+     * @return string|bool
+     */
+    public function getFacetListAction()
+    {
+        return 'authority-facetlist';
+    }
+
     /**
      * Return the route name for the search results action.
      *
diff --git a/module/VuFind/src/VuFind/Search/SolrAuthor/Options.php b/module/VuFind/src/VuFind/Search/SolrAuthor/Options.php
index 2293788759d..240c8faa19f 100644
--- a/module/VuFind/src/VuFind/Search/SolrAuthor/Options.php
+++ b/module/VuFind/src/VuFind/Search/SolrAuthor/Options.php
@@ -51,6 +51,17 @@ class Options extends \VuFind\Search\Solr\Options
         $this->spellcheck = false;
     }
 
+    /**
+     * Return the route name for the facet list action. Returns false to cover
+     * unimplemented support.
+     *
+     * @return string|bool
+     */
+    public function getFacetListAction()
+    {
+        return 'author-facetlist';
+    }
+
     /**
      * Return the route name for the search results action.
      *
diff --git a/module/VuFind/src/VuFind/Search/SolrReserves/Options.php b/module/VuFind/src/VuFind/Search/SolrReserves/Options.php
index 4884bf8c1c5..47231216d96 100644
--- a/module/VuFind/src/VuFind/Search/SolrReserves/Options.php
+++ b/module/VuFind/src/VuFind/Search/SolrReserves/Options.php
@@ -52,6 +52,17 @@ class Options extends \VuFind\Search\Solr\Options
         parent::__construct($configLoader);
     }
 
+    /**
+     * Return the route name for the facet list action. Returns false to cover
+     * unimplemented support.
+     *
+     * @return string|bool
+     */
+    public function getFacetListAction()
+    {
+        return 'search-reservesfacetlist';
+    }
+
     /**
      * Return the route name for the search results action.
      *
diff --git a/themes/bootstrap3/templates/search/reservessearch.phtml b/themes/bootstrap3/templates/search/reservessearch.phtml
index 8128b1536f6..5157b1bf30b 100644
--- a/themes/bootstrap3/templates/search/reservessearch.phtml
+++ b/themes/bootstrap3/templates/search/reservessearch.phtml
@@ -7,6 +7,8 @@
 
     // Convenience variables:
     $reservesLookfor = $this->params->getDisplayQuery();
+
+    $this->searchClassId = 'SolrReserves';
 ?>
 
 <div class="row">
-- 
GitLab