diff --git a/local/config/vufind/config.ini b/local/config/vufind/config.ini index 1fac69a4f0fc852f51fc26ce03bcf4e657e0330a..c4f84f2d911ca450e130da97c843e02fba6688f0 100644 --- a/local/config/vufind/config.ini +++ b/local/config/vufind/config.ini @@ -1565,17 +1565,6 @@ nbn[pattern] = "^urn:nbn:" nbn[search] = "urn:nbn:" nbn[replace] = "http://nbn-resolving.de/urn:nbn:" -; This section defines urls to match with record entries of external ILS. -; - The url pattern is defined as value with %s replacement placeholder. -; - The variable name indicates which identifier should be taken as replacement. -; Currently possibles values are _id_ for unique solr id (finc.id) and _ppn_ as -; record id of data other provider. -; - The variable key indicates the institution for those replacement should be take -; place. -[ExternalAccess] -; ppn[DE-D13] = "http://webopac.skd.museum/libero/WebopacOpenURL.cls?ACTION=DISPLAY&RID=%s" -; id[DE-14] = "http://katalogbeta.slub-dresden.de/id/%s/" - ; ***************** ; * EOF finc ; ***************** diff --git a/module/finc/src/finc/View/Helper/Root/Record.php b/module/finc/src/finc/View/Helper/Root/Record.php index 63545be5c92d7a5ea7cad1748e9a83bc48de1760..340f8980884318fa5765bd0b95292d4f85259f3e 100644 --- a/module/finc/src/finc/View/Helper/Root/Record.php +++ b/module/finc/src/finc/View/Helper/Root/Record.php @@ -183,74 +183,6 @@ class Record extends \VuFind\View\Helper\Root\Record $this->config->Content->showStyleBasedIcons : false; } - /** - * Get external access links to other ILS defined by config setting. - * - * @return array Associative array. - * @throws Exception Value of source ids has to be numeric. - * @deprecated Deprecated due to View Helper ExternalCatalogueLink->getLinks() - * @see https://projekte.ub.uni-leipzig.de/issues/10543 - */ - public function getExternalAccessLinks() - { - $i = -1; // iterator of extUrls - $extUrls = []; - - // if configuration empty return unprocessed - if (!isset($this->config->ExternalAccess) - || count($this->config->ExternalAccess) == 0 - ) { - return []; - } - // if institutions empty return unprocessed - $institutions = $this->driver->tryMethod('getInstitutions'); - if (!isset($institutions) || count($institutions) == 0) { - return []; - } - foreach ($this->config->ExternalAccess as $recordType => $accessUrl) { - $replaceId = null; - // get identifier of record id type - switch ($recordType) { - case "id": - $replaceId = $this->driver->getUniqueID(); - break; - case "ppn": - $replaceId = $this->driver->tryMethod('getRID'); - break; - default: - $replaceId = null; - } - foreach ($accessUrl as $institution => $urlPattern) { - // source_id filter - if (is_array($urlPattern)) { - foreach ($urlPattern as $source_id => $pattern) { - $urlPattern = $pattern; - $sids = explode(',', $source_id); - if (!array_product(array_map('is_numeric', $sids))) { - throw new Exception( - 'Value of source ids has to be numeric.' - ); - } - $sourceID = $this->driver->tryMethod('getSourceID'); - $replaceId = (isset($sourceID) - && true === in_array($sourceID, $sids)) - ? $replaceId : null; - break; - } - } - - // institution filter - if (true === in_array($institution, $institutions) - && !empty($replaceId) - ) { - $extUrls[++$i]['desc'] = $institution; - $extUrls[$i]['url'] = sprintf($urlPattern, $replaceId); - } - } - } - return $extUrls; - } - /** * Render the link of the specified type. * diff --git a/module/finc/tests/fixtures/externallink/testexternallink1.json b/module/finc/tests/fixtures/externallink/testexternallink1.json index a003aa3234013507e659fe5dd78f4acec55064df..d54c4d9d20cb2076bf46475c9af1f6bc1aab536d 100644 --- a/module/finc/tests/fixtures/externallink/testexternallink1.json +++ b/module/finc/tests/fixtures/externallink/testexternallink1.json @@ -1,5 +1,5 @@ { - "ppn": { + "record_id": { "DE-540": [{ "pattern": "http://194.94.197.6/libero/WebopacOpenURL.cls?ACTION=DISPLAY&LANG=DE&RID=%s" }], diff --git a/module/finc/tests/unit-tests/src/fincTest/View/Helper/Root/ExternalCatalogueLinkTest.php b/module/finc/tests/unit-tests/src/fincTest/View/Helper/Root/ExternalCatalogueLinkTest.php index 5a2559ae84f3c67558be3a6617ed01f400535d02..1d9030923767a914ddd9554a458e9b21deb7f484 100644 --- a/module/finc/tests/unit-tests/src/fincTest/View/Helper/Root/ExternalCatalogueLinkTest.php +++ b/module/finc/tests/unit-tests/src/fincTest/View/Helper/Root/ExternalCatalogueLinkTest.php @@ -57,9 +57,13 @@ class ExternalCatalogueLinkTest extends \VuFindTest\Unit\ViewHelperTestCase = $this->getExternalCatalogueLink( [], $this->getFixture('testexternallink1.json', 'externallink') - )->__invoke($this->getMockDriver()); + )->__invoke($this->getMockDriver( + 'VuFind\RecordDriver\SolrDefault', + '0008964455', + '265768233', + '22', + ['DE-14', 'DE-D13'])); - $links = $externalCatalogue->getLinks(); $expectedArray = [ [ "desc" => "DE-D13", @@ -70,7 +74,8 @@ class ExternalCatalogueLinkTest extends \VuFindTest\Unit\ViewHelperTestCase "url" => "http://katalogbeta.slub-dresden.de/id/0008964455/" ] ]; - $this->assertEquals(json_encode($expectedArray), json_encode($links)); + $this->assertEquals(json_encode($expectedArray), json_encode($externalCatalogue->getLinks())); + $externalCatalogue = $this->getExternalCatalogueLink( [], @@ -84,14 +89,13 @@ class ExternalCatalogueLinkTest extends \VuFindTest\Unit\ViewHelperTestCase ['DE-D13', 'DE-540'] ) ); - $links = $externalCatalogue->getLinks(); $expectedArray = [ [ "desc" => "DE-540", "url" => "http://194.94.197.6/libero/WebopacOpenURL.cls?ACTION=DISPLAY&LANG=DE&RID=265768233" ] ]; - $this->assertEquals(json_encode($expectedArray), json_encode($links)); + $this->assertEquals(json_encode($expectedArray), json_encode($externalCatalogue->getLinks())); // @codingStandardsIgnoreEnd } @@ -108,10 +112,10 @@ class ExternalCatalogueLinkTest extends \VuFindTest\Unit\ViewHelperTestCase */ protected function getMockDriver( $class = 'VuFind\RecordDriver\SolrDefault', - $id = '0008964455', - $record_id = '265768233', - $source_id = "0", - $institutions = ["DE-14", "DE-D13"] + $id, + $record_id, + $source_id, + $institutions ) { $driver = $this->getMockBuilder($class) ->setMethods(['getUniqueID', 'getSourceID', 'tryMethod']) @@ -124,14 +128,15 @@ class ExternalCatalogueLinkTest extends \VuFindTest\Unit\ViewHelperTestCase ->method('tryMethod') ->withConsecutive( [$this->equalTo('getInstitutions')], - [$this->equalTo('getRID')], - [$this->equalTo('getPpn')], - [$this->equalTo('getSourceID')] + [$this->equalTo('getField'), $this->equalTo(['record_id'])], + [$this->equalTo('getSourceID')], + [$this->equalTo('getField'), $this->equalTo(['id'])] ) ->willReturnOnConsecutiveCalls( $this->returnValue($institutions), $this->returnValue($record_id), - $this->returnValue($source_id) + $this->returnValue($source_id), + $this->returnValue($id) ); return $driver; } diff --git a/themes/finc/js/covers.js b/themes/finc/js/covers.js index f54f93b677c941e87ad4fc3a0406e43f54d20aba..3eb309ef70b9765951f99e163e3185e1084aca2d 100644 --- a/themes/finc/js/covers.js +++ b/themes/finc/js/covers.js @@ -50,7 +50,8 @@ function loadCoverByElement(data, element) { method: 'GET', data: data, element: element, - success: coverCallback + success: coverCallback, + error: spinner.hide() }); } diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/core.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/core.phtml index e7b39706ee3f3f2fdd8e46c481d40ecc9c8a5d25..2836a86ebbc501adcc00269c6bb04edd71b2765a 100644 --- a/themes/finc/templates/RecordDriver/DefaultRecord/core.phtml +++ b/themes/finc/templates/RecordDriver/DefaultRecord/core.phtml @@ -46,7 +46,7 @@ */ ?> <?php /* finc: add schema tags for title #13850 - VE */ ?> - <h1 property="name" lang=""><?= $this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100))) ?></h1> + <h1 property="name" lang=""><?=$this->record($this->driver)->getTitleHtml()?></h1> <?php /* #18307 remove summary from core */ ?> diff --git a/themes/finc/templates/RecordDriver/SolrAI/core.phtml b/themes/finc/templates/RecordDriver/SolrAI/core.phtml index 504fe19d7dc63a99975874b717c6c1db529101af..e6f20eacbfafa42e4e86a6979fed34b52fe56dcb 100644 --- a/themes/finc/templates/RecordDriver/SolrAI/core.phtml +++ b/themes/finc/templates/RecordDriver/SolrAI/core.phtml @@ -46,7 +46,7 @@ */ ?> <?php /* finc: add schema tags for title #13850 - VE */ ?> - <h1 property="name" lang=""><?= $this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100))) ?></h1> + <h1 property="name" lang=""><?=$this->record($this->driver)->getTitleHtml()?></h1> <?php /* #18307 remove summary from core */ ?> diff --git a/themes/finc/templates/RecordDriver/SolrLido/core.phtml b/themes/finc/templates/RecordDriver/SolrLido/core.phtml index 5436e6000a8e689cb50c49edddc31049421d87b6..9a8cdb17928ba940f656a029fbdddbe1faf5c779 100644 --- a/themes/finc/templates/RecordDriver/SolrLido/core.phtml +++ b/themes/finc/templates/RecordDriver/SolrLido/core.phtml @@ -63,7 +63,7 @@ <?php /* finc: We want to get rid of trailing special chars in the title and limit its length to 100 chars; in finc: keep schema name tag here!! #13861 CK */ ?> - <h1 property="name" lang=""><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h1> + <h1 property="name" lang=""><?=$this->record($this->driver)->getTitleHtml()?></h1> <?php $summary = $this->driver->getSummary(); $summary = isset($summary[0]) ? $this->escapeHtml($summary[0]) : false; ?> diff --git a/themes/finc/templates/RecordDriver/SolrMarc/core.phtml b/themes/finc/templates/RecordDriver/SolrMarc/core.phtml index 89f4018e26abf6c4bccd8961fed1c7a92762290e..37fd560fc0623732c1132bc1770acf6d5f7118d9 100644 --- a/themes/finc/templates/RecordDriver/SolrMarc/core.phtml +++ b/themes/finc/templates/RecordDriver/SolrMarc/core.phtml @@ -46,7 +46,7 @@ */ ?> <?php /* finc: add schema tags for title #13850 - VE */ ?> - <h1 property="name" lang=""><?= $this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100))) ?></h1> + <h1 property="name" lang=""><?=$this->record($this->driver)->getTitleHtml()?></h1> <?php /* #18307 remove summary from core */ ?>