From 68ff667d7f2a3c3190452f9e0eb8ea4d2a1f3dde Mon Sep 17 00:00:00 2001 From: Dorian Merz <merz@ub.uni-leipzig.de> Date: Thu, 16 May 2019 15:35:09 +0200 Subject: [PATCH] refs #15160 [fid_bbi] Whitelisting of mega_collection facet --- fid_bbi/config/vufind/facets.ini | 31 ++++++++++++++++++- .../fid_bbi/Controller/SearchController.php | 19 ++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/fid_bbi/config/vufind/facets.ini b/fid_bbi/config/vufind/facets.ini index 5a27c4cb68f..de5e3cbe32d 100644 --- a/fid_bbi/config/vufind/facets.ini +++ b/fid_bbi/config/vufind/facets.ini @@ -77,4 +77,33 @@ local_heading_facet_dezi4[] = "z"; local_heading_facet_dezi4[] = "g"; finc_class_facet[] = "not assigned" language[] = "not assigned" -facet_avail[] = "Non-free" \ No newline at end of file +facet_avail[] = "Non-free" + +[AllowFacetValue] +mega_collection[] = "Social Theory" +mega_collection[] = "Springer Lecture Notes" +mega_collection[] = "Torrossa / Monografie" +mega_collection[] = "de Gruyter Online-Zeitschriften [Archiv]" +mega_collection[] = "de Gruyter Online-Zeitschriften / Linguistics, Literature and Humanities" +mega_collection[] = "Early English Books Online" +mega_collection[] = "Eighteenth Century Collections Online / ECCO" +mega_collection[] = "Gallica (BNF)" +mega_collection[] = "Qucosa" +mega_collection[] = "Hathi Trust" +;mega_collection[] = "OLC SSG Informations-, Buch- und Bibliothekswesen" +mega_collection[] = "Morgan & Claypool eBooks (CIS 5, 2013-2014)" +mega_collection[] = "MedienwRezensionen" +;mega_collection[] = "Torrossa / Periodici" +;mega_collection[] = "Emerald Fulltext Archive Database -2014" +;mega_collection[] = "Early Modern Pamphlets Online" +;mega_collection[] = "BASE" +;mega_collection[] = "TIB AV-Portal" +;mega_collection[] = "Olms Online" + +; The following five mega_collections are all part of sid:159 +; but there is no mega_collection entry in SOLR for those +;mega_collection[] = "Abendländische mittelalterliche Handschriften" +;mega_collection[] = "Abendländische neuzeitliche Handschriften" +;mega_collection[] = "Fragmente" +;mega_collection[] = "Griechische Handschriften" +;mega_collection[] = "Hebräische Handschriften" diff --git a/module/fid_bbi/src/fid_bbi/Controller/SearchController.php b/module/fid_bbi/src/fid_bbi/Controller/SearchController.php index 522996bd261..7d0a2010f94 100644 --- a/module/fid_bbi/src/fid_bbi/Controller/SearchController.php +++ b/module/fid_bbi/src/fid_bbi/Controller/SearchController.php @@ -48,12 +48,25 @@ class SearchController extends BaseSearchController */ public function sourcesAction() { - $facet = $this->params()->fromQuery('facet'); - if (empty($facet)) { - $homepageFacet = key($this->getConfig('facets')->HomePage->toArray()); + $homepageFacet = key($this->getConfig('facets')->HomePage->toArray()); + if (empty($this->params()->fromQuery('facet'))) { return $this->redirect()->toRoute('search-sources',[],['query'=>['facet'=>$homepageFacet]]); } $view = $this->facetListAction(); + $facetList = $view->data; + + $whitelist = $this->getConfig('facets')->get('AllowFacetValue')->get($homepageFacet); + if (!empty($whitelist)) { + $whitelist = $whitelist->toArray(); + $facetList + = array_filter( + $facetList, + function ($facet_info) use ($whitelist) { + return in_array($facet_info['value'], $whitelist); + } + ); + } + $view->setVariable('data', $facetList); $view->setTemplate('search/sources.phtml'); return $view; } -- GitLab