diff --git a/local/alpha/config/vufind/facets.ini b/local/alpha/config/vufind/facets.ini index 367a6b23c53a847eff37db8f4f14b940b3eea64f..7e63898ab0e46fdacd4ed8dd146b527b13d5e9ab 100644 --- a/local/alpha/config/vufind/facets.ini +++ b/local/alpha/config/vufind/facets.ini @@ -21,3 +21,6 @@ relative_path = ../../../config/vufind/facets.ini ;##################### DO NOT DELETE THIS HEADER #################### ;#################################################################### +; #18446 +[Results] +publishDateSort = "adv_search_year" diff --git a/local/config/vufind/config.ini b/local/config/vufind/config.ini index 7f6c0d7c9ea257ceb2af078fd01c379c19319482..b37242be590372b08e457aab190fc7b2afd2cba8 100644 --- a/local/config/vufind/config.ini +++ b/local/config/vufind/config.ini @@ -635,7 +635,18 @@ coverimagesCache = true ; Otherwise, you can use noCoverAvailableImage to specify a ; path relative to the base of your theme directory for a static image to display. -noCoverAvailableImage = images/noCoverEmpty.gif +noCoverAvailableImage = images/noCover2.gif + + +; This setting controls how cover image URLs are loaded. They could be loaded as +; part of main request, or asynchronously. Asynchronous loading is disabled by +; default; to enable it, just uncomment the line below. +;ajaxcovers = true + +; When ajaxcovers is set to true, this setting controls whether the AJAX Handler +; GetRecordCover renders a fallback template (record/coverReplacement.phtml) in case +; no cover image could be loaded. +;useCoverFallbacksOnFail = false ; You can select from Syndetics, SyndeticsPlus, Amazon Editorial, Amazon, Booksite ; and/or the Guardian diff --git a/local/config/vufind/facets.ini b/local/config/vufind/facets.ini index b08f4716eb00fd23baad7f957835a9e830ad973b..5b40659817517ee7b9d9716eca2ddb861f223375 100644 --- a/local/config/vufind/facets.ini +++ b/local/config/vufind/facets.ini @@ -23,7 +23,9 @@ author_facet = Author ; era_facet = Era ; geographic_facet = Region ; share year string w/advanced search page -publishDate = "adv_search_year" + +; #18446 +publishDateSort = "adv_search_year" ; Facets that will appear at the top of search results when the TopFacets ; recommendations module is used. See the [TopRecommendations] section of diff --git a/local/languages/de.ini b/local/languages/de.ini index 26dc2e026ab57a1103b7414ef48b3dc96f00fdce..168d3f107d480a49498d82ae5102ffda49e56eed 100644 --- a/local/languages/de.ini +++ b/local/languages/de.ini @@ -182,6 +182,7 @@ MusicalScore = Noten VideoTape = Videodatenträger ### +Abstract = "Zusammenfassung" AND = UND APA Citation = "APA Zitierstil" Access = Zugang @@ -2002,7 +2003,6 @@ Search type = "Suchtyp" License = "Lizenz" -<<<<<<< HEAD ; #17717 Skip to content = "Zum Inhalt" @@ -2033,4 +2033,30 @@ search_cached_record = "Nach "%%title_full%%" suchen." search_cached_record_by_isn = "Per %%type%% suchen" search_cached_record = "Nach "%%title_full%%" suchen." -BK = "BK-Notation" \ No newline at end of file +BK = "BK-Notation" + +; #17360 +DE-82 = "Universitätsbibliothek RWTH Aachen" +DE-Bn3 = "Berufsakademie Sachsen, Staatliche Studienakademie Bautzen" +DE-Brt1 = "Berufsakademie Sachsen, Staatliche Studienakademie Breitenbrunn" +DE-D161 = "Berufsakademie Sachsen, Staatliche Studienakademie Dresden" +DE-D275 = "Evangelische Hochschule Dresden" +DE-Gla1 = "Berufsakademie Sachsen, Staatliche Studienakademie Glauchau" +DE-L229 = "Berufsakademie Sachsen, Staatliche Studienakademie Leipzig" +DE-Pl11 = "Berufsakademie Sachsen, Staatliche Studienakademie Plauen" +DE-Rs1 = "Berufsakademie Sachsen, Staatliche Studienakademie Riesa" +DE-15-FID = "adlr.link (FID)" +DE-1989 = "arthistoricum.net" +DE-L245 = "Bibliothek Hör- und Sprachgeschädigtenwesen" +DE-L282 = "Umweltbibliothek Leipzig" +DE-L325 = "Simon-Dubnow-Institut für jüdische Geschichte und Kultur" +DE-L326 = "Bach-Archiv Leipzig" +DE-L327 = "Leibniz-Institut für Geschichte und Kultur Osteuropas (GWZO)" +DE-L334 = "Feministische Bibliothek MONAliesA" +FID-BBI-DE-23 = "Fachinformationsdienst Buch-, Bibliotheks- und Informationswissenschaft (FID)" +FID-MONTAN-DE-105 = "Montanportal (FID)" +FID-NORD-DE-8 = "Fachinformationsdienst Nordeuropa (FID)" +DE-Kn38 = "Hochschule für Musik und Tanz Köln" + +; #18446 +Range-from-to = "Bereich von/bis" diff --git a/local/languages/en.ini b/local/languages/en.ini index 68dd9fd687a4b5c23b87b256959a193395db9bd8..d6af5e6fc281bacd54a766b43ae3111107fd5259 100644 --- a/local/languages/en.ini +++ b/local/languages/en.ini @@ -329,6 +329,7 @@ VideoTape = Video Tape ; end of remaining format tanslations ;------ +Abstract = Abstract AND = AND APA Citation = "APA Citation" Access = Access @@ -2097,7 +2098,6 @@ Skip to search = "Skip to search" License = "License" -<<<<<<< HEAD ; #17717 ; only necessary in en.ini skip-to = "Skip to " @@ -2109,4 +2109,30 @@ record_from_cache = "This record is no longer present in the catalogue. Probably search_cached_record = "Search for "%%title_full%%."" BK = "BK Notation" -Meeting Author = "Meeting Author" \ No newline at end of file +Meeting Author = "Meeting Author" + +; #17360 +DE-82 = "University Library RWTH Aachen University" +DE-Bn3 = "Berufsakademie Sachsen, Staatliche Studienakademie Bautzen" +DE-Brt1 = "Berufsakademie Sachsen, Staatliche Studienakademie Breitenbrunn" +DE-D161 = "Berufsakademie Sachsen, Staatliche Studienakademie Dresden" +DE-D275 = "Evangelische Hochschule Dresden" +DE-Gla1 = "Berufsakademie Sachsen, Staatliche Studienakademie Glauchau" +DE-L229 = "Berufsakademie Sachsen, Staatliche Studienakademie Leipzig" +DE-Pl11 = "Berufsakademie Sachsen, Staatliche Studienakademie Plauen" +DE-Rs1 = "Berufsakademie Sachsen, Staatliche Studienakademie Riesa" +DE-15-FID = "adlr.link (FID)" +DE-1989 = "arthistoricum.net" +DE-L245 = "Bibliothek Hör- und Sprachgeschädigtenwesen" +DE-L282 = "Umweltbibliothek Leipzig" +DE-L325 = "Simon-Dubnow-Institut für jüdische Geschichte und Kultur" +DE-L326 = "Bach-Archiv Leipzig" +DE-L327 = "Leibniz-Institut für Geschichte und Kultur Osteuropas (GWZO)" +DE-L334 = "Feministische Bibliothek MONAliesA" +FID-BBI-DE-23 = "Fachinformationsdienst Buch-, Bibliotheks- und Informationswissenschaft (FID)" +FID-MONTAN-DE-105 = "Montanportal (FID)" +FID-NORD-DE-8 = "Fachinformationsdienst Nordeuropa (FID)" +DE-Kn38 = "Hochschule für Musik und Tanz Köln" + +; #18446 +Range-from-to = "Range from/to" diff --git a/module/finc/config/module.config.php b/module/finc/config/module.config.php index 401440dc5d3a359c44d3430868fd3fbff2128119..f2631035d077e3e888772a4c53bf14cebc96ab53 100644 --- a/module/finc/config/module.config.php +++ b/module/finc/config/module.config.php @@ -13,6 +13,8 @@ $config = [ 'finc\ILS\Logic\Holds' => 'VuFind\ILS\Logic\LogicFactory', 'finc\Rewrite\EblRewrite' => 'finc\Rewrite\EblRewriteFactory', 'finc\Listener\I18nDataDirListener' => 'Zend\ServiceManager\Factory\InvokableFactory', + 'finc\Cover\Loader' => 'VuFind\Cover\LoaderFactory', + 'finc\Cover\Router' => 'finc\Cover\RouterFactory', ], 'delegators' => [ 'VuFindSearch\Service' => [ @@ -23,6 +25,8 @@ $config = [ 'VuFind\Cache\Manager' => 'finc\Cache\Manager', 'VuFind\ILS\Connection' => 'finc\ILS\Connection', 'VuFind\ILS\Logic\Holds' => 'finc\ILS\Logic\Holds', + 'VuFind\Cover\Loader' => 'finc\Cover\Loader', + 'VuFind\Cover\Router' => 'finc\Cover\Router', ] ], 'controllers' => [ @@ -32,6 +36,7 @@ $config = [ 'finc\Controller\AmslResourceController' => 'finc\Controller\AmslResourceControllerFactory', 'finc\Controller\DocumentDeliveryServiceController' => 'finc\Controller\DocumentDeliveryServiceControllerFactory', 'finc\Controller\Admin\I18nController' => 'finc\Controller\Admin\I18nControllerFactory', + 'finc\Controller\RecordsController' => 'VuFind\Controller\AbstractBaseFactory', ], 'aliases' => [ 'AdminI18n' => 'finc\Controller\Admin\I18nController', @@ -40,6 +45,7 @@ $config = [ 'dds' => 'finc\Controller\DocumentDeliveryServiceController', 'VuFind\Controller\MyResearchController' => 'finc\Controller\MyResearchController', 'VuFind\Controller\RecordController' => 'finc\Controller\RecordController', + 'VuFind\Controller\RecordsController' => 'finc\Controller\RecordsController', ], ], 'controller_plugins' => [ @@ -61,7 +67,9 @@ $config = [ 'finc\AjaxHandler\GetItemStatuses' => 'VuFind\AjaxHandler\GetItemStatusesFactory', 'finc\AjaxHandler\GetResolverLinks' => - 'finc\AjaxHandler\GetResolverLinksFactory' + 'finc\AjaxHandler\GetResolverLinksFactory', + 'finc\AjaxHandler\GetRecordCover' => + 'finc\AjaxHandler\GetRecordCoverFactory' ], 'aliases' => [ 'getAdditionalAccountInfo' => @@ -71,7 +79,9 @@ $config = [ 'getItemStatuses' => 'finc\AjaxHandler\GetItemStatuses', 'getResolverLinks' => - 'finc\AjaxHandler\GetResolverLinks' + 'finc\AjaxHandler\GetResolverLinks', + 'getRecordCover' => + 'finc\AjaxHandler\GetRecordCover', ] ], 'ils_driver' => [ diff --git a/module/finc/src/finc/AjaxHandler/GetRecordCover.php b/module/finc/src/finc/AjaxHandler/GetRecordCover.php new file mode 100644 index 0000000000000000000000000000000000000000..8c6333421a14867637c08a4ce3308124bf026029 --- /dev/null +++ b/module/finc/src/finc/AjaxHandler/GetRecordCover.php @@ -0,0 +1,151 @@ +<?php +/** this is a backport of the VF 7 core version. with the necessary + * adaptations. + * Remove this on upgrade + */ +/** + * GetRecordCover AJAX handler. + * + * PHP version 7 + * + * Copyright (C) Villanova University 2018. + * + * 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 + * + * @deprecated remove on VF 7 upgrade + * @category VuFind + * @package AJAX + * @author Josef Moravec <moravec@mzk.cz> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +namespace finc\AjaxHandler; + +use VuFind\AjaxHandler\AbstractBase; +use VuFind\AjaxHandler\AjaxHandlerInterface; +use Zend\Mvc\Controller\Plugin\Params; +use Zend\View\Renderer\PhpRenderer; +use finc\Cover\Router as CoverRouter; +use VuFind\Exception\RecordMissing as RecordMissingException; +use VuFind\ILS\Driver\CacheTrait; +use VuFind\Record\Loader as RecordLoader; + +/** + * GetRecordCover AJAX handler. + * + * @category VuFind + * @package AJAX + * @author Josef Moravec <moravec@mzk.cz> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +class GetRecordCover extends AbstractBase implements AjaxHandlerInterface +{ + use CacheTrait; + + /** + * Record loader + * + * @var RecordLoader + */ + protected $recordLoader; + + /** + * Cover router + * + * @var CoverRouter + */ + protected $coverRouter; + + /** + * PHP renderer + * + * @var PhpRenderer + */ + protected $renderer; + + /** + * If true we will render a fallback html template in case no image could be + * loaded + * + * @var bool + */ + protected $useCoverFallbacksOnFail = false; + + /** + * GetRecordCover constructor. + * + * @param RecordLoader $recordLoader Record loader + * @param CoverRouter $coverRouter Cover router + * @param PhpRenderer $renderer PHP renderer (only required if + * $userCoverFallbacksOnFail is set to true) + * @param bool $useCoverFallbacksOnFail If true we will render a + * fallback html template in case no image could be loaded + */ + public function __construct(RecordLoader $recordLoader, + CoverRouter $coverRouter, + ?PhpRenderer $renderer = null, + $useCoverFallbacksOnFail = false + ) { + $this->recordLoader = $recordLoader; + $this->coverRouter = $coverRouter; + $this->renderer = $renderer; + $this->useCoverFallbacksOnFail = $useCoverFallbacksOnFail; + } + + /** + * Handle request + * + * @param Params $params Request parameters + * + * @return array + * @throws \Exception + */ + public function handleRequest(Params $params) + { + $recordId = $params->fromQuery('recordId'); + $recordSource = $params->fromQuery('source', DEFAULT_SEARCH_BACKEND); + $size = $params->fromQuery('size', 'small'); + try { + $record = $this->recordLoader->load($recordId, $recordSource); + } catch (RecordMissingException $exception) { + return $this->formatResponse( + 'Could not load record: ' . $exception->getMessage(), + self::STATUS_HTTP_BAD_REQUEST + ); + } + + if (!in_array($size, ['small', 'medium', 'large'])) { + return $this->formatResponse( + 'Not valid size: ' . $size, + self::STATUS_HTTP_BAD_REQUEST + ); + } + + $url = $this->coverRouter->getUrl( + $record, $size ?? 'small', true, $this->useCoverFallbacksOnFail + ); + + return ($url || !$this->renderer || !$this->useCoverFallbacksOnFail) + ? $this->formatResponse(compact('url', 'size')) + : $this->formatResponse( + [ + 'html' => $this->renderer->render( + 'record/coverReplacement', + ['driver' => $record] + ) + ] + ); + } +} diff --git a/module/finc/src/finc/AjaxHandler/GetRecordCoverFactory.php b/module/finc/src/finc/AjaxHandler/GetRecordCoverFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..45fad1b98b8ccd1f9cff3b964de84f58862067ae --- /dev/null +++ b/module/finc/src/finc/AjaxHandler/GetRecordCoverFactory.php @@ -0,0 +1,82 @@ +<?php +/** this is a backport of the VF 7 core version. with the necessary + * adaptations. + * Remove this on upgrade + */ +/** + * Factory for GetRecordCover AJAX handler. + * + * PHP version 7 + * + * Copyright (C) Villanova University 2018. + * + * 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 + * + * @deprecated remove on upgrade + * @category VuFind + * @package AJAX + * @author Josef Moravec <moravec@mzk.cz> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +namespace finc\AjaxHandler; + +use Interop\Container\ContainerInterface; +use Interop\Container\Exception\ContainerException; +use Zend\ServiceManager\Exception\ServiceNotCreatedException; +use Zend\ServiceManager\Exception\ServiceNotFoundException; +use Zend\ServiceManager\Factory\FactoryInterface; + +/** + * Factory for GetRecordCover AJAX handler. + * + * @category VuFind + * @package AJAX + * @author Josef Moravec <moravec@mzk.cz> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +class GetRecordCoverFactory implements FactoryInterface +{ + /** + * Create an object + * + * @param ContainerInterface $container Service manager + * @param string $requestedName Service being created + * @param null|array $options Extra options (optional) + * + * @return object + * + * @throws ServiceNotFoundException if unable to resolve the service. + * @throws ServiceNotCreatedException if an exception is raised when + * creating a service. + * @throws ContainerException if any other error occurs + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function __invoke(ContainerInterface $container, $requestedName, + array $options = null + ) { + $config + = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $useFallbacks = $config->Content->useCoverFallbacksOnFail ?? false; + return new $requestedName( + $container->get(\VuFind\Record\Loader::class), + $container->get(\VuFind\Cover\Router::class), + // We only need the view renderer if we're going to use fallbacks: + $useFallbacks ? $container->get('ViewRenderer') : null, + $useFallbacks + ); + } +} diff --git a/module/finc/src/finc/Controller/RecordsController.php b/module/finc/src/finc/Controller/RecordsController.php new file mode 100644 index 0000000000000000000000000000000000000000..09982d550965c0538df2c2ba6243ad64acba137a --- /dev/null +++ b/module/finc/src/finc/Controller/RecordsController.php @@ -0,0 +1,110 @@ +<?php +/** + * Records Controller + * + * PHP version 7 + * + * Copyright (C) Villanova University 2010. + * Copyright (C) Leipzig University Library 2020. + * + * 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> + * @author Dorian Merz <merz@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Site + */ +namespace finc\Controller; + +use VuFind\Controller\RecordsController as BaseController; + +/** + * Records Controller + * + * @category VuFind + * @package Controller + * @author Demian Katz <demian.katz@villanova.edu> + * @author Dorian Merz <merz@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Site + */ +class RecordsController extends BaseController +{ + /** + * @var bool true to suppress jumping to single record + */ + protected $suppressJump; + + /** + * Bypass the single record handling of the parent method when printing + * @return bool|mixed|\VuFind\Controller\ViewModel|\Zend\View\Model\ViewModel + */ + public function homeAction() + { + $this->suppressJump = false; + if ($this->params()->fromQuery('print')) { + $this->suppressJump = true; + return $this->resultsAction(); + } + return parent::homeAction(); + } + + /** + * {@inheritDoc} + * This is mostly a copy of the parent function with an additional check for + * Missing Records. + * @see \VuFind\Controller\AbstractSearch::processJumpTo() + * + * @param \VuFind\Search\Base\Results $results + * @return bool|\Zend\Http\Response|\Zend\View\Model\ViewModel + */ + public function processJumpTo($results) + { + if ($this->suppressJump) { + return false; + } + // Jump to only result, if configured + $default = null; + $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + ->get('config'); + if (isset($config->Record->jump_to_single_search_result) + && $config->Record->jump_to_single_search_result + && $results->getResultTotal() == 1 + ) { + $default = 1; + } + // Missing/invalid parameter? Ignore it: + $jumpto = $this->params()->fromQuery('jumpto', $default); + if (empty($jumpto) || !is_numeric($jumpto)) { + return false; + } + + // Parameter out of range? Ignore it: + $recordList = $results->getResults(); + if (!isset($recordList[$jumpto - 1])) { + return false; + } + + if ($recordList[$jumpto - 1] instanceof \VuFind\RecordDriver\Missing) { + return false; + } + // If we got this far, we have a valid parameter so we should redirect + // and report success: + $details = $this->getRecordRouter() + ->getTabRouteDetails($recordList[$jumpto - 1]); + return $this->redirect()->toRoute($details['route'], $details['params']); + } +} diff --git a/module/finc/src/finc/Cover/Loader.php b/module/finc/src/finc/Cover/Loader.php new file mode 100644 index 0000000000000000000000000000000000000000..b67ff8ee24e3f877679eafc1cbee4f2ac09bfb07 --- /dev/null +++ b/module/finc/src/finc/Cover/Loader.php @@ -0,0 +1,97 @@ +<?php +/** + * Book Cover Generator + * + * PHP version 7 + * + * Copyright (C) Villanova University 2007. + * + * 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 Cover_Generator + * @author Andrew S. Nagy <vufind-tech@lists.sourceforge.net> + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/configuration:external_content Wiki + */ +namespace finc\Cover; + +/** + * Book Cover Generator + * + * @deprecated backport of VuFind 7 core version, remove on upgrade + * @category VuFind + * @package Cover_Generator + * @author Andrew S. Nagy <vufind-tech@lists.sourceforge.net> + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/configuration:external_content Wiki + */ +class Loader extends \VuFind\Cover\Loader +{ + /** + * Flag denoting the last loaded image was a FailImage + * + * @var bool + */ + protected $hasLoadedUnavailable = false; + + /** + * {@inheritdoc} + * Adds @see self::$hasLoadedUnavailable flag + * + * @return void + */ + public function loadUnavailable() + { + $this->hasLoadedUnavailable = true; + return parent::loadUnavailable(); + } + + /** + * Returns true if the last loaded image was the FailImage + * + * @return bool + */ + public function hasLoadedUnavailable() + { + return $this->hasLoadedUnavailable; + } + + /** + * Return API handlers + * + * @return \Generator Array with keys: key - API key, apiName - api name from + * configuration, handler - handler object + */ + public function getHandlers() + { + if (!isset($this->config->Content->coverimages)) { + return []; + } + $providers = explode(',', $this->config->Content->coverimages); + foreach ($providers as $provider) { + $provider = explode(':', trim($provider)); + $apiName = strtolower(trim($provider[0])); + $key = isset($provider[1]) ? trim($provider[1]) : null; + yield [ + 'key' => $key, + 'apiName' => $apiName, + 'handler' => $this->apiManager->get($apiName), + ]; + } + } + +} diff --git a/module/finc/src/finc/Cover/Router.php b/module/finc/src/finc/Cover/Router.php new file mode 100644 index 0000000000000000000000000000000000000000..8a758f27c9f6adb72c488431ee3a4584026c9fb0 --- /dev/null +++ b/module/finc/src/finc/Cover/Router.php @@ -0,0 +1,115 @@ +<?php +/** + * Cover image router + * + * PHP version 7 + * + * Copyright (C) Villanova University 2016. + * + * 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 Cover_Generator + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/configuration:external_content Wiki + */ +namespace finc\Cover; + +use finc\Cover\Loader as CoverLoader; +use VuFind\RecordDriver\AbstractBase as RecordDriver; + +/** + * Cover image router + * + * @deprecated backport of VuFind 7 core version, remove on upgrade + * @category VuFind + * @package Cover_Generator + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/configuration:external_content Wiki + */ +class Router implements \Zend\Log\LoggerAwareInterface +{ + use \VuFind\Log\LoggerAwareTrait; + + /** + * Base URL for dynamic cover images. + * + * @var string + */ + protected $dynamicUrl; + + /** + * Cover loader + * + * @var CoverLoader + */ + protected $coverLoader; + + /** + * Constructor + * + * @param string $url Base URL for dynamic cover images. + * @param CoverLoader $coverLoader Cover loader + */ + public function __construct($url, CoverLoader $coverLoader) + { + $this->dynamicUrl = $url; + $this->coverLoader = $coverLoader; + } + + /** + * This is an adaptation of the VuFind Version to fit the current (VF5) state + * + * Generate a thumbnail URL (return false if unsupported). + * + * @param RecordDriver $driver Record driver + * @param string $size Size of thumbnail (small, medium or large -- + * small is default). + * + * @return string|bool + */ + public function getUrl(RecordDriver $driver, $size = 'small', + $resolveDynamic = true, $testLoadImage = false + ) + { + // Try to build thumbnail: + $thumb = $driver->tryMethod('getThumbnail', [$size]); + + // No thumbnail? Return false: + if (empty($thumb)) { + return false; + } + + // Array? It's parameters to send to the cover generator: + if (is_array($thumb)) { + if (!$resolveDynamic) { + return null; + } + $settings = is_array($thumb) ? array_merge($thumb, ['size' => $size]) + : ['size' => $size]; + if ($testLoadImage) { + $this->coverLoader->loadImage($settings); + if ($this->coverLoader->hasLoadedUnavailable()) { + return false; + } + } + return $this->dynamicUrl . '?' . http_build_query($thumb); + } + + // Default case -- return fixed string: + return $thumb; + } +} diff --git a/module/finc/src/finc/Cover/RouterFactory.php b/module/finc/src/finc/Cover/RouterFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..95b59b8df5c3664d1a705c14ecf77a84b10058c8 --- /dev/null +++ b/module/finc/src/finc/Cover/RouterFactory.php @@ -0,0 +1,76 @@ +<?php +/** + * Cover router factory. + * + * PHP version 7 + * + * Copyright (C) Villanova University 2018. + * + * 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 Cover_Generator + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +namespace finc\Cover; + +use Interop\Container\ContainerInterface; +use Zend\ServiceManager\Factory\FactoryInterface; + +/** + * Cover router factory. + * + * @category VuFind + * @package Cover_Generator + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +class RouterFactory implements FactoryInterface +{ + /** + * Create an object + * + * @param ContainerInterface $container Service manager + * @param string $requestedName Service being created + * @param null|array $options Extra options (optional) + * + * @return object + * + * @throws ServiceNotFoundException if unable to resolve the service. + * @throws ServiceNotCreatedException if an exception is raised when + * creating a service. + * @throws ContainerException if any other error occurs + */ + public function __invoke(ContainerInterface $container, $requestedName, + array $options = null + ) { + if (!empty($options)) { + throw new \Exception('Unexpected options sent to factory.'); + } + // Try to get the base URL from the controller plugin; fail over to + // the view helper if that doesn't work. + try { + $base = $container->get('ControllerPluginManager')->get('url') + ->fromRoute('cover-show'); + } catch (\Exception $e) { + $base = $container->get('ViewRenderer')->plugin('url') + ->__invoke('cover-show'); + } + $coverLoader = $container->get(\finc\Cover\Loader::class); + return new $requestedName($base, $coverLoader); + } +} diff --git a/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php b/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php index a88a11c759597a48ebffcb963b220fdbfbba0965..803e6d9aad71764e643146ef4d3a3406ac72ac4b 100644 --- a/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php +++ b/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php @@ -356,6 +356,32 @@ trait SolrMarcFincTrait return $retval; } + + /** + * Method reading MARC field 24 + * + * @return array + * @access public + */ + public function getOtherIdentifiers() + { + $fields = $this->getMarcRecord()->getFields('024'); + if (!$fields) { + return null; + } + foreach ($fields as $field) { + if ($subfield = $field->getSubfield('a')) { + $data = $subfield->getData(); + $type = 'unspecified'; + if ($field->getIndicator('1') == '7' && $sub2 = $field->getSubfield('2')) { + $type = $sub2->getData(); + } + $retval[$type][] = $data; + } + } + return $retval; + } + /** * Get an array of instrumentation notes taken from the local data * of the Petrucci music library subfield 590b diff --git a/module/finc/src/finc/View/Helper/Root/MultiDataFieldsTrait.php b/module/finc/src/finc/View/Helper/Root/MultiDataFieldsTrait.php index be5bd3f42ad61d9ce894e31b91c12c8514082404..b9536ccab15bf7871c05c89ade86a935039feb04 100644 --- a/module/finc/src/finc/View/Helper/Root/MultiDataFieldsTrait.php +++ b/module/finc/src/finc/View/Helper/Root/MultiDataFieldsTrait.php @@ -134,4 +134,25 @@ trait MultiDataFieldsTrait return $final; } + /** + * return render details for otherIdentifiers (MARC 024) data set + * @return callback + */ + public function otherIdentifiers($data, $options, $driver) + { + // Sort the data: + $final = []; + foreach ($data as $type => $values) { + $final[] = [ + 'label' => $type, + 'values' => $values, + 'options' => [ + 'pos' => $options['pos'], + 'renderType' => 'Simple', + ], + ]; + } + return $final; + } + } diff --git a/module/finc/src/finc/View/Helper/Root/Record.php b/module/finc/src/finc/View/Helper/Root/Record.php index 5a59179a709d672563e851cd8cc01eae53ce517b..7c1968e2b53841e34abaa6262774a7ca4cea5c9a 100644 --- a/module/finc/src/finc/View/Helper/Root/Record.php +++ b/module/finc/src/finc/View/Helper/Root/Record.php @@ -361,7 +361,7 @@ class Record extends \VuFind\View\Helper\Root\Record ); // add http if needed // @to-do make it https compatible - if (!preg_match('/^(http:\/\/)/', $link['url'])) { + if (!preg_match('/^(https?:\/\/)/', $link['url'])) { $link['url'] = 'http://' . $link['url']; } } @@ -504,10 +504,7 @@ class Record extends \VuFind\View\Helper\Root\Record $queryParams['lookfor0'][] = $title; $queryParams['type0'][] = 'Title'; } - $isn = $this->driver->tryMethod('getCleanISBN'); - if (empty($isn)) { - $isn = $this->driver->tryMethod('getCleanISSN'); - } + $isn = $this->driver->tryMethod('getCleanISSN'); if (!empty($isn)) { $queryParams['lookfor0'][] = $isn; $queryParams['type0'][] = 'ISN'; @@ -523,4 +520,63 @@ class Record extends \VuFind\View\Helper\Root\Record } return $queryParams; } + + /** + * Get the rendered cover plus some useful parameters. + * + * @deprecated used for VF7 ajaxcovers, remove on upgrade + * @param string $context Context of code being generated + * @param string $default The default size of the cover + * @param string $link The link for the anchor + * + * @return array + */ + public function getCoverDetails($context, $default, $link = false) + { + $details = compact('link', 'context') + [ + 'driver' => $this->driver, 'cover' => false, 'size' => false, + 'linkPreview' => $this->getPreviewCoverLinkSetting($context), + ]; + $preferredSize = $this->getCoverSize($context, $default); + if (empty($preferredSize)) { // covers disabled entirely + $details['html'] = ''; + } else { + // Find best option if more than one size is defined (e.g. small:medium) + foreach (explode(':', $preferredSize) as $size) { + if ($details['cover'] = $this->getThumbnail($size)) { + $details['size'] = $size; + break; + } + } + if ($details['size'] === false) { + // we need to set a size for the ajax covers to work correctly + list($details['size']) = explode(':', $preferredSize); + } + + $details['html'] = $this->contextHelper->renderInContext( + 'record/cover.phtml', $details + ); + } + return $details; + } + + /** + * Generate a thumbnail URL (return false if unsupported). + * + * @deprecated used for VF7 ajaxcovers, remove on upgrade + * @param string $size Size of thumbnail (small, medium or large -- small is + * default). + * + * @return string|bool + */ + public function getThumbnail($size = 'small') + { + // Find out whether or not AJAX covers are enabled; this will control + // whether dynamic URLs are resolved immediately or deferred until later + // (see third parameter of getUrl() below). + $ajaxcovers = $this->config->Content->ajaxcovers ?? false; + return $this->coverRouter + ? $this->coverRouter->getUrl($this->driver, $size, !$ajaxcovers) + : false; + } } diff --git a/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php b/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php index 74409d373d8889e426ff64edcd165b13a0f35021..8fbc0a3a27b8b5a4a7f8eae37a8aabeaf7c5e42b 100644 --- a/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php +++ b/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php @@ -202,7 +202,7 @@ class RecordDataFormatterFactory 'getDateSpan' ); $spec->setLine( - 'Summary', + 'Abstract', 'getSummary' ); $spec->setTemplateLine( @@ -281,7 +281,7 @@ class RecordDataFormatterFactory public function getDefaultCollectionRecordSpecs() { $spec = new RecordDataFormatter\SpecBuilder(); - $spec->setLine('Summary', 'getSummary'); + $spec->setLine('Abstract', 'getSummary'); $spec->setTemplateLine( 'Authors/Corporations', 'getDeduplicatedAuthors', @@ -456,7 +456,7 @@ class RecordDataFormatterFactory { $spec = new RecordDataFormatter\SpecBuilder(); $spec->setLine( - 'Summary', + 'Abstract', 'getSummary' ); $spec->setLine( diff --git a/themes/finc/js/covers.js b/themes/finc/js/covers.js new file mode 100644 index 0000000000000000000000000000000000000000..c251aefba80b034997452c4b1b7103e13847df78 --- /dev/null +++ b/themes/finc/js/covers.js @@ -0,0 +1,47 @@ +/* this is a backport from VF 7 core, remove on upgrade */ +/*global VuFind */ +function loadCoverByElement(data, element) { + var url = VuFind.path + '/AJAX/JSON?method=' + 'getRecordCover'; + var img = element.find('img'); + var spinner = element.children('div.spinner'); + var container = element.children('div.cover-container'); + var anchor = container.children('a.coverlink'); + function coverCallback(response) { + spinner.hide(); + container.show(); + if (typeof response.data.url !== 'undefined' && response.data.url !== false) { + img.attr("src", response.data.url); + container.children().not("img").hide(); + anchor.show(); + anchor.attr("href", response.data.url); + } else { + img.remove(); + if (typeof response.data.html !== 'undefined') { + container.html(response.data.html); + } else { + container.html(); + } + } + } + $.ajax({ + dataType: "json", + url: url, + method: "GET", + data: data, + element: element, + success: coverCallback + }); +} + +function loadCovers() { + $('.ajaxcover').each(function getDataAndLoadCovers() { + var img = $(this).find('img'); + var data = { + source: img.data('recordsource'), + recordId: img.data('recordid'), + size: img.data('coversize') + }; + loadCoverByElement(data, $(this)); + }); +} +$(document).ready(loadCovers); diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/core.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/core.phtml index dc3020e57e137e151cf6a2d0a5e77ff49b5b5cb2..d8bbee094b3bd606b4478de9d5196d638418a7c9 100644 --- a/themes/finc/templates/RecordDriver/DefaultRecord/core.phtml +++ b/themes/finc/templates/RecordDriver/DefaultRecord/core.phtml @@ -12,9 +12,7 @@ <div class="media-left <?= $this->escapeHtmlAttr($coverDetails['size']) ?> img-col"> <?php /* Display thumbnail if appropriate: */ ?> <?php if ($cover): ?> - <object type="image/jpeg" data="<?=$coverDetails['link']?>"> - <?= $this->record($this->driver)->getRecordIcon() ?> - </object> + <?=$cover?> <?php endif; ?> <?php /* Display qrcode if appropriate: */ ?> @@ -51,15 +49,7 @@ <h1 property="name"><?= $this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100))) ?></h1> - <?php $summary = $this->driver->getSummary(); - $summary = isset($summary[0]) ? $this->escapeHtml($summary[0]) : false; ?> - <?php if ($summary): ?> - <p><?= $this->truncate($summary, 300) ?></p> - - <?php if (strlen($summary) > 300): ?> - <p class="hidden-print"><a href='<?= $this->recordLink()->getTabUrl($this->driver, 'Description') ?>#tabnav'><?= $this->transEsc('Full description') ?></a></p> - <?php endif; ?> - <?php endif; ?> + <?php /* #18307 remove summary from core */ ?> <?php if ($this->userlist()->getMode() !== 'disabled'): ?> <?php /* Display the lists that this record is saved to */ ?> diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/data-publicationDetails.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/data-publicationDetails.phtml index 430b5d6189669ed4d87b7fcc17b4b232e5486780..dc57b5b2f4ed0814ac46145b1b6723de25897977 100644 --- a/themes/finc/templates/RecordDriver/DefaultRecord/data-publicationDetails.phtml +++ b/themes/finc/templates/RecordDriver/DefaultRecord/data-publicationDetails.phtml @@ -1,33 +1,33 @@ <!-- finc: RecordDriver - DefaultRecord - data-publicationDetails --> <?php if (!empty($data)): ?> <div itemscope itemtype="http://schema.org/publisher"> - <?php if (is_array($data)): ?> + <?php if(is_array($data)): ?> <?php foreach ($data as $field): ?> <span property="publisher" typeof="Organization"> - <?php $pubPlace = $field->getPlace(); + <?php $pubPlace = $field->getPlace(); if (!empty($pubPlace)): ?> <span property="location" typeof="Place"> - <span property="name"><?=$this->escapeHtml($pubPlace)?></span> - </span> + <span property="name"><?=$this->escapeHtml($pubPlace)?></span> + </span> <?php endif; ?> <?php $pubName = $field->getName(); - if (!empty($pubName)): ?> - <span property="name"><?=$this->escapeHtml($pubName)?></span> - <?php endif; ?> - </span> + if (!empty($pubName)): ?> + <span property="name"><?=$this->escapeHtml($pubName)?></span> + <?php endif; ?> + </span> <span property="datePublished"> - <?php /* do not show solr publish date #13993 - GG */ ?> - <?php /*$pubDateSort = $this->driver->tryMethod('getPublishDateSort');*/ ?> - <?php $pubDate = $field->getDate(); + <?php /* do not show solr publish date #13993 - GG */ ?> + <?php /*$pubDateSort = $this->driver->tryMethod('getPublishDateSort');*/ ?> + <?php $pubDate = $field->getDate(); if (!empty($pubDate)): ?> <?=$this->escapeHtml($pubDate)?> <?php /*else: ?> - <?=$this->escapeHtml($pubDateSort)*/ ?> + <?=$this->escapeHtml($pubDateSort)*/ ?> <?php endif; ?> - </span><br/> + </span><br/> <?php endforeach; ?> <?php else: ?> - <?=$this->escapeHtml($data)?> + <span property="publisher" typeof="Organization"><?=$data?></span> <?php endif; ?> </div> <?php endif ?> diff --git a/themes/finc/templates/RecordDriver/SolrAI/core.phtml b/themes/finc/templates/RecordDriver/SolrAI/core.phtml index 1ca3a8236e485a28a1825d13d4816a5efe5c631b..8b89cbb631e37671072928111c28eaddab996eeb 100644 --- a/themes/finc/templates/RecordDriver/SolrAI/core.phtml +++ b/themes/finc/templates/RecordDriver/SolrAI/core.phtml @@ -13,9 +13,7 @@ <div class="media-left <?= $this->escapeHtmlAttr($coverDetails['size']) ?> img-col"> <?php /* Display thumbnail if appropriate: */ ?> <?php if ($cover): ?> - <object type="image/jpeg" data="<?=$coverDetails['link']?>"> - <?= $this->record($this->driver)->getRecordIcon() ?> - </object> + <?=$cover?> <?php endif; ?> <?php /* Display qrcode if appropriate: */ ?> @@ -51,15 +49,7 @@ <h1 property="name"><?= $this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100))) ?></h1> - <?php $summary = $this->driver->getSummary(); - $summary = isset($summary[0]) ? $this->escapeHtml($summary[0]) : false; ?> - <?php if ($summary): ?> - <p><?= $this->truncate($summary, 300) ?></p> - - <?php if (strlen($summary) > 300): ?> - <p class="hidden-print"><a href='<?= $this->recordLink()->getTabUrl($this->driver, 'Description') ?>#tabnav'><?= $this->transEsc('Full description') ?></a></p> - <?php endif; ?> - <?php endif; ?> + <?php /* #18307 remove summary from core */ ?> <?php if ($this->userlist()->getMode() !== 'disabled'): ?> <?php /* Display the lists that this record is saved to */ ?> diff --git a/themes/finc/templates/RecordDriver/SolrMarc/core.phtml b/themes/finc/templates/RecordDriver/SolrMarc/core.phtml index 21d74fbc3a3f80b515b648ffa48ff6bb5930723a..674a194a3693b705d2bc7c1e7750de9f84e33f3b 100644 --- a/themes/finc/templates/RecordDriver/SolrMarc/core.phtml +++ b/themes/finc/templates/RecordDriver/SolrMarc/core.phtml @@ -13,9 +13,7 @@ <div class="media-left <?=$this->escapeHtmlAttr($coverDetails['size'])?> img-col"> <?php /* Display thumbnail if appropriate: */ ?> <?php if ($cover): ?> - <object type="image/jpeg" data="<?=$coverDetails['link']?>"> - <?= $this->record($this->driver)->getRecordIcon() ?> - </object> + <?=$cover?> <?php endif; ?> <?php /* Display qrcode if appropriate: */ ?> @@ -51,15 +49,7 @@ <h1 property="name"><?= $this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100))) ?></h1> - <?php $summary = $this->driver->getSummary(); - $summary = isset($summary[0]) ? $this->escapeHtml($summary[0]) : false; ?> - <?php if ($summary): ?> - <p><?= $this->truncate($summary, 300) ?></p> - - <?php if (strlen($summary) > 300): ?> - <p class="hidden-print"><a href='<?= $this->recordLink()->getTabUrl($this->driver, 'Description') ?>#tabnav'><?= $this->transEsc('Full description') ?></a></p> - <?php endif; ?> - <?php endif; ?> + <?php /* #18307 remove summary from core */ ?> <?php if ($this->userlist()->getMode() !== 'disabled'): ?> <?php /* Display the lists that this record is saved to */ ?> diff --git a/themes/finc/templates/RecordTab/description.phtml b/themes/finc/templates/RecordTab/description.phtml index cea530c697325b21aed6a748bb829977ff8419f4..98d59dfadd4b15dc09a30019bbd3990d0eaecdd4 100644 --- a/themes/finc/templates/RecordTab/description.phtml +++ b/themes/finc/templates/RecordTab/description.phtml @@ -13,7 +13,15 @@ $mainFields = $formatter->getData($driver, $formatter->getDefaults('description' <caption class="sr-only"><?=$this->transEsc('Description')?></caption> <?php if (!empty($mainFields)): ?> <?php foreach ($mainFields as $current): ?> - <tr><th><?=$this->transEsc($current['label'])?>:</th><td data-title="<?= $this->transEsc($current['label']) ?>:"><?=$current['value']?></td></tr> + <tr> + <?php if (!empty($current['label'])): ?> + <th><?=$this->transEsc($current['label'])?>:</th> + <td data-title="<?= $this->transEsc($current['label']) ?>:"> + <?php else: ?> + <td colspan="2"> + <?php endif; ?> + <?=$current['value']?></td> + </tr> <?php endforeach; ?> <?php else: ?> <tr><td><?=$this->transEsc('no_description')?></td></tr> diff --git a/themes/finc/templates/record/cover.phtml b/themes/finc/templates/record/cover.phtml index 25c3a4a83873fab0b842a65d405672b1ab8d1537..af93f5da6ee32dd07521c4c5006ff8eda9fa2dbc 100644 --- a/themes/finc/templates/record/cover.phtml +++ b/themes/finc/templates/record/cover.phtml @@ -2,11 +2,21 @@ <?php /* Display thumbnail if appropriate: */ ?> <?php /* If you want to load covers in lightbox use .recordcover; the class .nocover prevents nocover images from loading in lightbox or can be used to hide the images */ ?> +<?php $alt = $alt ?? $this->transEsc('Cover Image')?> <?php if ($cover): ?> - <?php if ($this->link): ?><a href="<?=$this->escapeHtmlAttr($this->link)?>" data-lightbox-image aria-hidden="true"><?php endif; ?> - <img alt="<?=$this->transEsc('Cover Image')?>" <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>class="recordcover" src="<?=$this->escapeHtmlAttr($cover); ?>" aria-hidden="true"/> + <?php if ($this->link): ?><a href="<?=$this->escapeHtmlAttr($this->link)?>" target="_blank" aria-hidden="true"><?php endif; ?> + <img alt="<?=$alt?>" <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>class="recordcover" src="<?=$this->escapeHtmlAttr($cover); ?>" aria-hidden="true"/> <?php if ($this->link): ?></a><?php endif; ?> -<?php else: ?> +<?php elseif ($cover === false): ?> <img src="<?=$this->url('cover-unavailable')?>" <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>class="nocover" alt="<?=$this->transEsc('No Cover Image')?>" aria-hidden="true" /> +<?php else: ?> + <div class="ajaxcover"> + <div class="spinner"><i class="fa fa-spinner fa-spin"></i> <?=$this->translate('Loading')?>...</div> + <div class="cover-container"> + <a class="coverlink"> + <img <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>data-recordsource="<?=$this->escapeHtmlAttr($driver->getSourceIdentifier())?>" data-recordid="<?=$this->escapeHtmlAttr($driver->getUniqueID())?>" data-coversize="<?=$this->escapeHtmlAttr($size)?>" class="recordcover ajax" alt="<?=$this->escapeHtmlAttr($alt); ?>" /> + </a> + </div> + </div> <?php endif; ?> <!-- finc: record - cover - END --> diff --git a/themes/finc/templates/record/coverReplacement.phtml b/themes/finc/templates/record/coverReplacement.phtml new file mode 100644 index 0000000000000000000000000000000000000000..d74b4f1f8f5847b60f8da4fbe046abfddfab6438 --- /dev/null +++ b/themes/finc/templates/record/coverReplacement.phtml @@ -0,0 +1 @@ +<?= $this->record($this->driver)->getRecordIcon() ?> \ No newline at end of file diff --git a/themes/finc/theme.config.php b/themes/finc/theme.config.php index 4b4e93f7ae4fc661cb1da8d5c0bb202a26c87dc3..06d4ee532cace75b842d66ea554d8d5427d80d17 100644 --- a/themes/finc/theme.config.php +++ b/themes/finc/theme.config.php @@ -4,6 +4,7 @@ return [ 'js' => [ 'check_item_statuses.js', 'lightbox_form_cache.js', + 'covers.js' ], 'helpers' => [ 'aliases' => [ @@ -13,6 +14,7 @@ return [ 'sideFacet' => 'finc\View\Helper\Root\SideFacet', 'resultfeed' => 'finc\View\Helper\Root\ResultFeed', 'recordLink' => 'finc\View\Helper\Root\RecordLink', + 'record' => 'finc\View\Helper\Root\Record', ], 'factories' => [ 'finc\View\Helper\Root\BranchInfo' => @@ -23,7 +25,7 @@ return [ 'finc\View\Helper\Root\Factory::getInterlibraryLoanLink', 'finc\View\Helper\Root\SideFacet' => 'finc\View\Helper\Root\Factory::getSideFacet', - 'VuFind\View\Helper\Root\Record' => + 'finc\View\Helper\Root\Record' => 'finc\View\Helper\Root\Factory::getRecord', 'finc\View\Helper\Root\RecordLink' => 'finc\View\Helper\Root\Factory::getRecordLink',