From bfdbc64684adbc57a75e006132a632492323c66d Mon Sep 17 00:00:00 2001 From: Robert Lange <robert.lange@uni-leipzig.de> Date: Thu, 1 Oct 2020 14:25:01 +0200 Subject: [PATCH] refs #17407 [fid_bbi] replace bbi specific sources list by amsl values * replace link in footer * delete bbi search controller * remove definition of search controller and sources route in module.config.php --- module/fid_bbi/config/module.config.php | 6 +- .../fid_bbi/Controller/SearchController.php | 111 ------------------ themes/fid_bbi/templates/footer.phtml | 3 +- themes/fid_bbi/templates/search/sources.phtml | 15 --- 4 files changed, 2 insertions(+), 133 deletions(-) delete mode 100644 module/fid_bbi/src/fid_bbi/Controller/SearchController.php delete mode 100644 themes/fid_bbi/templates/search/sources.phtml diff --git a/module/fid_bbi/config/module.config.php b/module/fid_bbi/config/module.config.php index 691199cf202..9f9768d83e7 100644 --- a/module/fid_bbi/config/module.config.php +++ b/module/fid_bbi/config/module.config.php @@ -38,7 +38,6 @@ $config = [ 'controllers' => [ 'factories' => [ 'fid_bbi\Controller\FeedbackController' => 'VuFind\Controller\AbstractBaseFactory', - 'fid_bbi\Controller\SearchController' => 'VuFind\Controller\AbstractBaseFactory', 'fid_bbi\Controller\MyResearchController' => 'VuFind\Controller\AbstractBaseFactory', 'fid_bbi\Controller\RecordController' => 'VuFind\Controller\AbstractBaseWithConfigFactory', 'fid_bbi\Controller\BrowseController' => 'VuFind\Controller\AbstractBaseWithConfigFactory', @@ -46,8 +45,6 @@ $config = [ 'aliases' => [ 'feedback' => 'fid_bbi\Controller\FeedbackController', 'Feedback' => 'fid_bbi\Controller\FeedbackController', - 'Search' => 'fid_bbi\Controller\SearchController', - 'search' => 'fid_bbi\Controller\SearchController', 'Record' => 'fid_bbi\Controller\RecordController', 'record' => 'fid_bbi\Controller\RecordController', 'VuFind\Controller\MyResearchController' => 'fid_bbi\Controller\MyResearchController', @@ -192,8 +189,7 @@ $staticRoutes = [ 'MyResearch/Usertags', 'dds/Home', 'dds/Email', - 'Record/EblLink', - 'Search/Sources' + 'Record/EblLink' ]; $routeGenerator = new \VuFind\Route\RouteGenerator($nonTabRecordActions); diff --git a/module/fid_bbi/src/fid_bbi/Controller/SearchController.php b/module/fid_bbi/src/fid_bbi/Controller/SearchController.php deleted file mode 100644 index 8368696979a..00000000000 --- a/module/fid_bbi/src/fid_bbi/Controller/SearchController.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php -/** - * Default Controller - * - * PHP version 5 - * - * Copyright (C) Villanova University 2010. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category VuFind - * @package Controller - * @author Demian Katz <demian.katz@villanova.edu> - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link https://vufind.org Main Site - */ -namespace fid_bbi\Controller; - -use VuFind\Controller\SearchController as BaseSearchController; - -/** - * Redirects the user to the appropriate default VuFind action. - * - * @category VuFind - * @package Controller - * @author Demian Katz <demian.katz@villanova.edu> - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link https://vufind.org Main Site - */ -class SearchController extends BaseSearchController -{ - /** - * Home action - * - * @return mixed - */ - public function sourcesAction() - { - $homepageFacets = $this->getConfig('facets')->HomePage->toArray(); - - $facetCache = $this->serviceLocator - ->get('VuFind\Search\FacetCache\PluginManager') - ->get($this->searchClassId); - - $facets = $facetCache->getList('Advanced'); - $results = $facetCache->getResults(); - - $renderer = $this->getViewRenderer(); - - $facetList = []; - foreach ($homepageFacets as $facet => $label) - { - $facetList = array_merge( - $facetList, - $renderer->sortFacetList( - $results, - $facet, - $this->filterFacets( - $facets[$facet]['list'], - $facet - ), - 'search-results' - ) - ); - } - - uasort($facetList,function ($a,$b) use ($renderer) - { - return strnatcmp( - ucfirst($renderer->translate('Facet::' . $a)), - ucfirst($renderer->translate('Facet::' . $b)) - ); - }); - - $view = $this->createViewModel( - [ - 'data' => $facetList, - 'results' => $results - ] - ); - $view->setTemplate('search/sources.phtml'); - return $view; - } - - protected function filterFacets($facetList,$facet) - { - $whitelist = $this->getConfig('facets')->get('AllowFacetValue')->get($facet); - if (!empty($whitelist)) { - $whitelist = $whitelist->toArray(); - $facetList - = array_filter( - $facetList, - function ($facet_info) use ($whitelist) { - return in_array($facet_info['value'], $whitelist); - } - ); - } - return $facetList; - } -} diff --git a/themes/fid_bbi/templates/footer.phtml b/themes/fid_bbi/templates/footer.phtml index f3aa5f6148b..0ff0f2c663c 100644 --- a/themes/fid_bbi/templates/footer.phtml +++ b/themes/fid_bbi/templates/footer.phtml @@ -7,9 +7,8 @@ <p><strong><?=$this->transEsc('Search Options')?></strong></p> <ul> <li><a href="<?=$this->url('search-advanced')?>"><?=$this->transEsc('Advanced Search')?></a></li> - <li><a href="<?=$this->url('search-sources')?>"><?=$this->transEsc('Data Collection')?></a></li> + <li><a href="<?=$this->url('resources')?>"><?=$this->translate('Data Collection')?></a></li> <li><a data-toggle="collapse" data-target="#searchbox-snippet"><?=$this->transEsc('embed_searchbox_button')?></a></li> - <li><a href="<?=$this->url('resources')?>"><?=$this->translate('Amsl_Resources')?></a></li> </ul> </div> <div class="footer-column"> diff --git a/themes/fid_bbi/templates/search/sources.phtml b/themes/fid_bbi/templates/search/sources.phtml deleted file mode 100644 index 6b6b556e99d..00000000000 --- a/themes/fid_bbi/templates/search/sources.phtml +++ /dev/null @@ -1,15 +0,0 @@ -<div class="searchHomeContent"> - <div class="search-home-facets"> - - <div class="home-facet?>"> - <h2><?=$this->transEsc('browse_sources')?></h2> - <div class="home-facet-container"> - <ul class="home-facet-list"> - <?php foreach ($data as $url => $value): ?> - <li><a href="<?=$url?>"><?=$this->transEsc('Facet::'.$value)?></a></li> - <?php endforeach; ?> - </ul> - </div> - </div> - </div> -</div> -- GitLab