diff --git a/composer.json b/composer.json index 6537b2f1db902c6204f0eece24b1c82975269c75..6622eb45b79d2abd9a89b7ed1a34782f73b3b674 100644 --- a/composer.json +++ b/composer.json @@ -85,6 +85,7 @@ "finc/vufindhttp-psrcompat": "^0.0.2", "finc/symfony-serializer-zend-bridge": "^0.0.1", "phpdocumentor/reflection-docblock": "^4.3", + "finc/worldcat-search-module": "^0.0.4", "zendframework/zend-i18n-resources": "^2.6" }, "require-dev": { @@ -108,8 +109,11 @@ "vendor/bin/phpcs --standard=tests/finc/phpcs.xml" ], "post-install-cmd": [ + "@copy-themes-force" ], "post-update-cmd": [ - ] + "@copy-themes-force" + ], + "copy-themes-force": "php devops/composer/themes.php --force" } } diff --git a/composer.lock b/composer.lock index 95515ffaf377f51012f53e18d7cab3706d46e5c7..fda805e869f1c31b93af1dd7fda1c1ac75854a0c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "83611cf5ee4d75cda9820e29478ca128", + "content-hash": "08059b11c01f09fa80d32dd20422c9e1", "packages": [ { "name": "ahand/mobileesp", @@ -610,6 +610,56 @@ "description": "PSR compatibility layer for vufind-org/vufindhttp", "time": "2019-06-13T10:58:08+00:00" }, + { + "name": "finc/worldcat-search-module", + "version": "v0.0.4", + "source": { + "type": "git", + "url": "https://git.sc.uni-leipzig.de/ubl/finc/fid/worldcat-search-module.git", + "reference": "6a5d4f706406f079cbf6ea2a96f248a62b938c26" + }, + "require": { + "finc/vufindhttp-psrcompat": "^0.0", + "guzzlehttp/psr7": "^1.4", + "netresearch/jsonmapper": "^1.4", + "php": ">=7.1", + "psr/http-client": "^1.0" + }, + "require-dev": { + "http-interop/http-factory-guzzle": "^1.0", + "php-http/guzzle6-adapter": "^2.0", + "php-http/mock-client": "^1.2" + }, + "type": "library", + "extra": { + "vufind": { + "themes": { + "res/theme": "worldcat" + } + } + }, + "autoload": { + "psr-4": { + "finc\\WorldCat\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0" + ], + "authors": [ + { + "name": "Gregor Gawol", + "email": "gawol@ub.uni-leipzig.de" + }, + { + "name": "Sebastian Kehr", + "email": "kehr@ub.uni-leipzig.de" + } + ], + "description": "Worldcat Search Module", + "time": "2019-09-02T16:28:35+00:00" + }, { "name": "finc/zend-psr18bridge", "version": "v0.0.1", @@ -701,6 +751,77 @@ "homepage": "https://github.com/ghislainf/zf2-whoops", "time": "2016-06-06T08:41:08+00:00" }, + { + "name": "guzzlehttp/psr7", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2019-07-01T23:21:34+00:00" + }, { "name": "jasig/phpcas", "version": "1.3.6", @@ -960,6 +1081,52 @@ ], "time": "2019-05-05T10:12:03+00:00" }, + { + "name": "netresearch/jsonmapper", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/cweiske/jsonmapper.git", + "reference": "0d4d1b48d682a93b6bfedf60b88c7750e9cb0b06" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/0d4d1b48d682a93b6bfedf60b88c7750e9cb0b06", + "reference": "0d4d1b48d682a93b6bfedf60b88c7750e9cb0b06", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4", + "squizlabs/php_codesniffer": "~1.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "JsonMapper": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "OSL-3.0" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "cweiske@cweiske.de", + "homepage": "http://github.com/cweiske/jsonmapper/", + "role": "Developer" + } + ], + "description": "Map nested JSON structures onto PHP classes", + "time": "2019-08-15T19:41:25+00:00" + }, { "name": "ocramius/package-versions", "version": "1.4.0", @@ -2269,6 +2436,46 @@ ], "time": "2017-10-23T01:57:42+00:00" }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2019-03-08T08:55:37+00:00" + }, { "name": "sabre/vobject", "version": "3.5.3", diff --git a/config/application.config.php b/config/application.config.php index 9dd678154726901dcb60709385f2d9745b71c542..b14ecf830db4e4d6bcc81210ba22ae7b0a115faf 100644 --- a/config/application.config.php +++ b/config/application.config.php @@ -32,6 +32,7 @@ array_push($modules, ...[ 'finc', 'fid', 'fid_bbi', + 'finc\WorldCat', ]); /** End of temporarily necessary adjustments. */ diff --git a/fid_bbi/alpha/config/vufind/worldcat.ini b/fid_bbi/alpha/config/vufind/worldcat.ini new file mode 100644 index 0000000000000000000000000000000000000000..0a660ae6ec6d057ca58f78b7f65971ea1955b0fd --- /dev/null +++ b/fid_bbi/alpha/config/vufind/worldcat.ini @@ -0,0 +1,2 @@ +[Parent_Config] +relative_path = ../../../config/vufind/worldcat.ini \ No newline at end of file diff --git a/fid_bbi/config/vufind/worldcat.ini b/fid_bbi/config/vufind/worldcat.ini new file mode 100644 index 0000000000000000000000000000000000000000..0c202d24cd8c27607592e1e79cb3b12834b03789 --- /dev/null +++ b/fid_bbi/config/vufind/worldcat.ini @@ -0,0 +1,3 @@ +[General] +wskey = "ApiKey" +serverip=141.39.229.51 \ No newline at end of file diff --git a/fid_bbi/languages/de.ini b/fid_bbi/languages/de.ini index ed3a8ea2302b305d2e14515bab869a9be35b6730..70401fcfa7bb8761dfc3f38d53a0174ed116555c 100644 --- a/fid_bbi/languages/de.ini +++ b/fid_bbi/languages/de.ini @@ -32,6 +32,10 @@ Authors/Corporations = "verantwortlich" Login = "Mein BBI" Your Account = "Mein BBI" Holdings = "Verfügbarkeit" +view_worldcat = "Verfügbarkeit" +worldcat_availability = "Lokale Bestände (über WorldCat)" +online_availability = "Online Links" + Add to favorites = "Favorit" Format = "Medientyp" diff --git a/fid_bbi/languages/en.ini b/fid_bbi/languages/en.ini index 4b30e70234db7852990d6d15ca6b3b6846c8fc63..f8630380afb5feaf95480d8f27b5fc35a3ebd444 100644 --- a/fid_bbi/languages/en.ini +++ b/fid_bbi/languages/en.ini @@ -47,6 +47,9 @@ Your Account = "My BBI" BK = "BK Notation" DDC = "DDC Notation" Holdings = "Availability" +view_worldcat = "Availability" +worldcat_availability = "Local Holdings (via WorldCat)" +online_availability = "Online Links" ; 15215 label_home_library = "home library" diff --git a/module/fid_bbi/config/module.config.php b/module/fid_bbi/config/module.config.php index 50d8be03c83ffa960361fd8dc994109d1c1c56be..7568e10a4356647ac51965306a017d51503069a8 100644 --- a/module/fid_bbi/config/module.config.php +++ b/module/fid_bbi/config/module.config.php @@ -60,7 +60,8 @@ $config = [ 'staffviewai' => 'finc\RecordTab\StaffViewAI', 'acquisitionpda' => 'finc\RecordTab\AcquisitionPDA', 'topics' => 'finc\RecordTab\Topics', - 'descriptionlido' => 'finc\RecordTab\DescriptionLido' + 'descriptionlido' => 'finc\RecordTab\DescriptionLido', + 'worldcat' => 'fid_bbi\RecordTab\Worldcat', ], ], ], @@ -68,7 +69,7 @@ $config = [ 'finc\RecordDriver\SolrDefault' => [ 'tabs' => [ 'Description' => 'Description', - 'Holdings' => 'HoldingsILS', + 'Worldcat' => 'Worldcat', 'TOC' => 'TOC', 'UserComments' => 'UserComments', 'Reviews' => 'Reviews', @@ -79,12 +80,12 @@ $config = [ 'Similar' => null, 'Details' => 'StaffViewArray', ], - 'defaultTab' => 'Description', + 'defaultTab' => 'Worldcat', ], 'finc\RecordDriver\SolrMarcFinc' => [ 'tabs' => [ 'Description' => 'Description', - 'Holdings' => 'HoldingsILS', + 'Worldcat' => 'Worldcat', 'TOC' => 'TOC', 'UserComments' => 'UserComments', 'Reviews' => 'Reviews', @@ -95,7 +96,7 @@ $config = [ 'Similar' => null, 'Details' => 'StaffViewMARC', ], - 'defaultTab' => 'Description', + 'defaultTab' => 'Worldcat', ], 'finc\RecordDriver\SolrAI' => [ 'tabs' => [ @@ -111,7 +112,7 @@ $config = [ 'Similar' => null, 'Details' => 'StaffViewAI', ], - 'defaultTab' => 'Description', + 'defaultTab' => 'Holdings', ], ], 'recorddriver_collection_tabs' => [ diff --git a/module/fid_bbi/src/fid_bbi/RecordTab/Worldcat.php b/module/fid_bbi/src/fid_bbi/RecordTab/Worldcat.php new file mode 100644 index 0000000000000000000000000000000000000000..162e4e6e8dadc9ae69358150f78a873efe5c53da --- /dev/null +++ b/module/fid_bbi/src/fid_bbi/RecordTab/Worldcat.php @@ -0,0 +1,52 @@ +<?php +/** + * Staff view tab for AI records + * + * 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 RecordTabs + * @author Demian Katz <demian.katz@villanova.edu> + * @author André Lahmann <lahmann@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:plugins:record_tabs Wiki + */ +namespace fid_bbi\RecordTab; + +/** + * Staff view tab for AI records + * + * @category VuFind + * @package RecordTabs + * @author Demian Katz <demian.katz@villanova.edu> + * @author Gregor Gawol <gawol@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:plugins:record_tabs Wiki + */ +class Worldcat extends \fid\RecordTab\Worldcat +{ + /** + * Is this tab active? + * + * @return bool + */ + public function isActive() + { + return !empty($this->driver->tryMethod('getURLs')) || parent::isActive(); + } +} diff --git a/themes/fid_bbi/scss/compiled.scss b/themes/fid_bbi/scss/compiled.scss index d65218c943ab777fc18c3736bdc2c28f510d8062..a4487577f2b0f921a224e9221303aa5a266a9b4d 100644 --- a/themes/fid_bbi/scss/compiled.scss +++ b/themes/fid_bbi/scss/compiled.scss @@ -535,4 +535,11 @@ footer { ////// margin top .margin-t-third { margin-top: ($grid-gutter-width / 6); +} + +.worldcat-headline { + // copies values from .caption class + color: $gray; + padding-top: 8px; + padding-bottom: 8px; } \ No newline at end of file diff --git a/themes/fid_bbi/templates/RecordTab/holdingsils.phtml b/themes/fid_bbi/templates/RecordTab/holdingsils.phtml index 01fcc09d71fa93bd712ad742c079b07fac4bb9f7..a03eefe1f2bf850803dfea842cf5d5c085fc885c 100644 --- a/themes/fid_bbi/templates/RecordTab/holdingsils.phtml +++ b/themes/fid_bbi/templates/RecordTab/holdingsils.phtml @@ -14,21 +14,20 @@ // Set page title. $this->headTitle($this->translate('Holdings') . ': ' . $this->driver->getBreadcrumb()); ?> - <table class="table table-striped"> <?php /* finc: add 'Online Access' in holdings-tab #13770 - VE */ ?> <?php if (!empty($urls)): ?> - <caption><?php if (in_array('Free',$this->driver->tryMethod('getFacetAvail'))):?> - <?=$this->translate('Open Access')?> - <?php else: ?> - <?php if (!empty(array_filter($urls, + <?php if (in_array('Free',$this->driver->tryMethod('getFacetAvail'))):?> + <caption><?=$this->translate('Open Access')?></caption> + <?php elseif (!empty(array_filter($urls, function ($elem) { return !isset($elem['desc']) || strpos($elem['desc'],'Volltext') !== false; } ))):?> - <?=$this->translate('charges_may_apply')?> - <?php endif;?> - <?php endif;?></caption> + <caption><?=$this->translate('charges_may_apply')?></caption> + <?php else: ?> + <caption><?=$this->translate('online_availability')?></caption> + <?php endif;?> <tr> <th><?=$this->transEsc("Link")?>:</th> <td> diff --git a/themes/fid_bbi/templates/RecordTab/worldcat.phtml b/themes/fid_bbi/templates/RecordTab/worldcat.phtml new file mode 100644 index 0000000000000000000000000000000000000000..c1ac7ba7e2eaeedbdb1e1835a1045a3f2700fb16 --- /dev/null +++ b/themes/fid_bbi/templates/RecordTab/worldcat.phtml @@ -0,0 +1,24 @@ +<!-- fid: recordtab - worldcat --> +<? $script = <<<JS + $(document).ready(function() { + var recordId = $('.hiddenId').val(); + var recordSource = $('.hiddenSource').val(); + // console.log({id: recordId, source: recordSource}); + $.ajax({ + dataType: 'json', + url: VuFind.path + '/AJAX/JSON?method=getWorldCat', + method: 'GET', + data: {id: recordId, source: recordSource} + }).done(function(response) { + $('.worldcat-data').html(response.data.html); + $('.worldcat-headline').show(); + }); + }); +JS; +?> +<!-- renders holdingstab contents here until we know exactly how it shall be designed --> +<?=$this->context($this)->renderInContext('RecordTab/holdingsils.phtml',[])?> +<?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $script, 'SET');?> +<div class="worldcat-headline" style="display: none"><?=$this->translate('worldcat_availability')?></div> +<div class="worldcat-data"></div> +<!-- fid: recordtab - worldcat - END --> diff --git a/themes/fid_bbi/theme.config.php b/themes/fid_bbi/theme.config.php index 5c5b31ecd3759715d8efe9dc8913168701caf568..8ebebf3eca56626aab22214da265d927e4d2e5e1 100644 --- a/themes/fid_bbi/theme.config.php +++ b/themes/fid_bbi/theme.config.php @@ -2,6 +2,9 @@ return [ 'extends' => 'fid', //'favicon' => 'favicon.ico', + 'mixins' => [ + 'worldcat', + ], 'helpers' => array( 'factories' => array( 'VuFind\View\Helper\Root\Record' =>