diff --git a/module/finc/src/finc/Hierarchy/TreeDataSource/Factory.php b/module/finc/src/finc/Hierarchy/TreeDataSource/Factory.php deleted file mode 100644 index 8ff9aabaf7d9d6081bae5583870adc2bb3df3725..0000000000000000000000000000000000000000 --- a/module/finc/src/finc/Hierarchy/TreeDataSource/Factory.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * Hierarchy Data Source Factory Class - * - * 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 HierarchyTree_DataSource - * @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:plugins:hierarchy_components Wiki - */ -namespace finc\Hierarchy\TreeDataSource; -use Zend\ServiceManager\ServiceManager; - -/** - * Hierarchy Data Source Factory Class - * - * This is identical to the VuFind equivalent ensuring the correct namespace - * to load \de_15\Hierarchy\TreeDataSource\Solr - * - * @category VuFind - * @package HierarchyTree_DataSource - * @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/wiki/development:plugins:hierarchy_components Wiki - * - * @codeCoverageIgnore - */ -class Factory -{ - /** - * Factory for Solr driver. - * - * @param ServiceManager $sm Service manager. - * - * @return Solr - */ - public static function getSolr(ServiceManager $sm) - { - $cacheDir = $sm->getServiceLocator()->get('VuFind\CacheManager') - ->getCacheDir(false); - $hierarchyFilters = $sm->getServiceLocator()->get('VuFind\Config') - ->get('HierarchyDefault'); - $filters = isset($hierarchyFilters->HierarchyTree->filterQueries) - ? $hierarchyFilters->HierarchyTree->filterQueries->toArray() - : []; - $solr = $sm->getServiceLocator()->get('VuFind\Search\BackendManager') - ->get('Solr')->getConnector(); - $formatterManager = $sm->getServiceLocator() - ->get('VuFind\HierarchyTreeDataFormatterPluginManager'); - return new Solr( - $solr, $formatterManager, rtrim($cacheDir, '/') . '/hierarchy', - $filters - ); - } -} diff --git a/module/finc/src/finc/Hierarchy/TreeRenderer/Factory.php b/module/finc/src/finc/Hierarchy/TreeRenderer/Factory.php deleted file mode 100644 index 2e4bf6aa4bf5dfee65a740b60c8fb3d3205134d6..0000000000000000000000000000000000000000 --- a/module/finc/src/finc/Hierarchy/TreeRenderer/Factory.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/** - * Hierarchy Renderer Factory Class - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * @category VuFind - * @package HierarchyTree_Renderer - * @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:plugins:hierarchy_components Wiki - */ -namespace finc\Hierarchy\TreeRenderer; -use Zend\ServiceManager\ServiceManager; - -/** - * Hierarchy Renderer Factory Class - * - * This is a factory class to build objects for rendering hierarchies. - * - * @category VuFind - * @package HierarchyTree_DataSource - * @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:plugins:hierarchy_components Wiki - * - * @codeCoverageIgnore - */ -class Factory -{ - /** - * Factory for JSTree renderer. - * - * @param ServiceManager $sm Service manager. - * - * @return JSTree - */ - public static function getJSTree(ServiceManager $sm) - { - return new JSTree( - $sm->getServiceLocator()->get('ControllerPluginManager')->get('Url') - ); - } -} diff --git a/module/finc/src/finc/RecordDriver/Factory.php b/module/finc/src/finc/RecordDriver/Factory.php index 4af7bec20166c2a5d58e50b4178e7c132e372625..5386839a71b6ba93df91443d2f8f8b051677784a 100644 --- a/module/finc/src/finc/RecordDriver/Factory.php +++ b/module/finc/src/finc/RecordDriver/Factory.php @@ -214,7 +214,7 @@ class Factory * * @param ContainerInterface $container Service manager. * - * @return SolrLido + * @return SolrLidoNdl */ public static function getSolrLidoNdl(ContainerInterface $container) { @@ -257,13 +257,4 @@ class Factory $container->get('VuFind\Config')->get('searches') ); } - - public static function getSolrDico(ServiceManager $sm) - { - return new SolrDico( - $sm->getServiceLocator()->get('VuFind\Config')->get('config'), - null,//$sm->getServiceLocator()->get('VuFind\Config')->get('SolrDico'), - $sm->getServiceLocator()->get('VuFind\Config')->get('searches') - ); - } } diff --git a/module/finc/src/finc/Service/MungerInjectionFactory.php b/module/finc/src/finc/Service/MungerInjectionFactory.php deleted file mode 100644 index bf55f90c82e986c7180de51dbd3977b4de95cc44..0000000000000000000000000000000000000000 --- a/module/finc/src/finc/Service/MungerInjectionFactory.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php - -namespace finc\Service; - -use VuFindSearch\Query\Query, - VuFindSearch\Query\QueryGroup; -use Zend\Config\Config; -use Zend\ServiceManager\DelegatorFactoryInterface, - Zend\ServiceManager\ServiceLocatorInterface; -use Zend\EventManager\EventInterface; -use VuFindSearch\Service as SearchService; - -/** - * Class MungerInjectionFactory - * A Delegator Factory that registers several listeners at events triggered by the VuFind\Search service. - * @package finc\Service - */ -class MungerInjectionFactory implements DelegatorFactoryInterface { - - /** - * @var SearchService - */ - protected $instance; - - /** - * @var array names of search handlers for which colons should be escaped - */ - protected $searches_to_escape; - - /** - * @var array shard configuration to register in all queries - */ - protected $shards_to_register; - - /** - * Creates a delegator of VuFind/Search to register several listeners. - * @param ServiceLocatorInterface $serviceLocator - * @param string $name - * @param string $requestedName - * @param callable $callback - * @return mixed - */ - public function createDelegatorWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName, $callback) - { - $instance = call_user_func($callback); - $searchConfig = $serviceLocator->get('VuFind\Config')->get('searches'); - $e = $instance->getEventManager()->getSharedManager(); - $handlers = $searchConfig->General->escaped_colon_searches; - if (!empty($handlers)) { - $this->searches_to_escape = $handlers->toArray(); - $e->attach('VuFind\Search', 'pre', - function (EventInterface $event) { - $params = $event->getParams(); - if (isset($params['query'])) { - $params['query'] = $this->escapeColons($params['query']); - } - } - ); - } - if (!empty($searchConfig->IndexShards)) { - $shards = $searchConfig->IndexShards->toArray(); - if ($excludedShards = $searchConfig->ShardPreferences->on_user_search_only) { - $shards = array_diff_key($shards, array_flip(explode(',', $excludedShards))); - } - if (!empty($shards)) { - $this->shards_to_register = $shards; - $e->attach('VuFind\Search', 'pre', [$this, 'registerShards']); - } - } - return $instance; - } - - /** - * Escapes colons in Queries or recursively in QueryGroups. - * This prevents queries from being interpreted as advanced queries in Lucene syntax. - * cf. \VuFindSearch\Backend\Solr\LuceneSyntaxHelper::containsAdvancedLuceneSyntax - * @param Query|QueryGroup $queryOrGroup - * @return mixed - */ - private function escapeColons($queryOrGroup) { - - if ($queryOrGroup instanceof QueryGroup) { - $handler = $queryOrGroup->getReducedHandler(); - if (is_null($handler) || in_array($handler,$this->searches_to_escape)) { - foreach ($queryOrGroup->getQueries() as $query) { - $this->escapeColons($query); - } - } - } elseif (in_array($queryOrGroup->getHandler(),$this->searches_to_escape)) { - $queryOrGroup->setString( - // mask whitespaces that follow a colon - // that avoids the removal of that very colon via - // \VuFindSearch\Backend\Solr\LuceneSyntaxHelper::normalizeColons - preg_replace('/(?<=\:)\s/', '\ ', $queryOrGroup->getString()) - ); - } - return $queryOrGroup; - } - - /** - * Event Listener on Search/Pre that registers all configured shards for every search request - * @param EventInterface $event - */ - public function registerShards(EventInterface $event) { - - $params = $event->getParam('params'); - if (empty($params->get('shards'))) { - $params->set('shards',implode(',',$this->shards_to_register)); - } - } -} \ No newline at end of file diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/data-link.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/data-link.phtml new file mode 100644 index 0000000000000000000000000000000000000000..b3773632048735674672c02218e68ed616e35ddf --- /dev/null +++ b/themes/finc/templates/RecordDriver/DefaultRecord/data-link.phtml @@ -0,0 +1,7 @@ +<!-- finc: RecordDriver - DefaultRecord - data-link --> +<?php if (is_array($data)): ?> + <a href="<?=$data['url']?>"><?=$data['text']?></a> +<?php else: ?> + <a href="<?=$data?>"><?=$data?></a> +<?php endif; ?> +<!-- finc: RecordDriver - DefaultRecord - data-link - END -->