diff --git a/devops/codecheck/rules/scss-lint.yml b/devops/codecheck/rules/scss-lint.yml new file mode 100644 index 0000000000000000000000000000000000000000..7c7af720314667660f552cb794cf4e500c0970c5 --- /dev/null +++ b/devops/codecheck/rules/scss-lint.yml @@ -0,0 +1,258 @@ +# Default configuration for finc VuFind projects. + +scss_files: "**/*.scss" +plugin_directories: ['.scss-linters'] + +# List of gem names to load custom linters from (make sure they are already +# installed) +plugin_gems: [] + +# Default severity of all linters. +severity: warning + +linters: + BangFormat: + enabled: true + space_before_bang: true + space_after_bang: false + + BemDepth: + enabled: false + max_elements: 1 + + BorderZero: + enabled: true + convention: zero # or `none` + + ChainedClasses: + enabled: false + + ColorKeyword: + enabled: true + + ColorVariable: + enabled: true + + Comment: + enabled: true + style: silent + + DebugStatement: + enabled: true + + DeclarationOrder: + enabled: true + + DisableLinterReason: + enabled: false + + DuplicateProperty: + enabled: true + + ElsePlacement: + enabled: true + style: same_line # or 'new_line' + + EmptyLineBetweenBlocks: + enabled: true + ignore_single_line_blocks: true + + EmptyRule: + enabled: true + + ExtendDirective: + enabled: false + + FinalNewline: + enabled: true + present: true + + HexLength: + enabled: true + style: short # or 'long' + + HexNotation: + enabled: true + style: lowercase # or 'uppercase' + + HexValidation: + enabled: true + + IdSelector: + enabled: false + + ImportantRule: + enabled: true + + ImportPath: + enabled: true + leading_underscore: false + filename_extension: false + + Indentation: + enabled: true + allow_non_nested_indentation: false + character: space # or 'tab' + width: 2 + + LeadingZero: + enabled: true + style: exclude_zero # or 'include_zero' + + MergeableSelector: + enabled: true + force_nesting: true + + NameFormat: + enabled: false + allow_leading_underscore: true + convention: hyphenated_lowercase # or 'camel_case', or 'snake_case', or a regex pattern + + NestingDepth: + enabled: false + max_depth: 5 + ignore_parent_selectors: false + + PlaceholderInExtend: + enabled: true + + PrivateNamingConvention: + enabled: false + prefix: _ + + PropertyCount: + enabled: false + include_nested: false + max_properties: 10 + + PropertySortOrder: + enabled: true + ignore_unspecified: false + min_properties: 2 + separate_groups: false + + PropertySpelling: + enabled: true + extra_properties: [] + disabled_properties: [] + + PropertyUnits: + enabled: true + global: [ + 'ch', 'em', 'ex', 'rem', # Font-relative lengths + 'cm', 'in', 'mm', 'pc', 'pt', 'px', 'q', # Absolute lengths + 'vh', 'vw', 'vmin', 'vmax', # Viewport-percentage lengths + 'deg', 'grad', 'rad', 'turn', # Angle + 'ms', 's', # Duration + 'Hz', 'kHz', # Frequency + 'dpi', 'dpcm', 'dppx', # Resolution + '%'] # Other + properties: {} + + PseudoElement: + enabled: true + + QualifyingElement: + enabled: true + allow_element_with_attribute: false + allow_element_with_class: true + allow_element_with_id: true + + SelectorDepth: + enabled: false + max_depth: 4 + + SelectorFormat: + enabled: false + convention: hyphenated_lowercase # or 'strict_BEM', or 'hyphenated_BEM', or 'snake_case', or 'camel_case', or a regex pattern + + Shorthand: + enabled: true + allowed_shorthands: [1, 2, 3, 4] + + SingleLinePerProperty: + enabled: true + allow_single_line_rule_sets: true + + SingleLinePerSelector: + enabled: true + + SpaceAfterComma: + enabled: true + style: one_space # or 'no_space', or 'at_least_one_space' + + SpaceAfterComment: + enabled: false + style: one_space # or 'no_space', or 'at_least_one_space' + allow_empty_comments: true + + SpaceAfterPropertyColon: + enabled: true + style: one_space # or 'no_space', or 'at_least_one_space', or 'aligned' + + SpaceAfterPropertyName: + enabled: true + + SpaceAfterVariableColon: + enabled: false + style: one_space # or 'no_space', 'at_least_one_space' or 'one_space_or_newline' + + SpaceAfterVariableName: + enabled: true + + SpaceAroundOperator: + enabled: true + style: one_space # or 'at_least_one_space', or 'no_space' + + SpaceBeforeBrace: + enabled: true + style: space # or 'new_line' + allow_single_line_padding: false + + SpaceBetweenParens: + enabled: true + spaces: 0 + + StringQuotes: + enabled: true + style: single_quotes # or double_quotes + + TrailingSemicolon: + enabled: true + + TrailingWhitespace: + enabled: true + + TrailingZero: + enabled: false + + TransitionAll: + enabled: false + + UnnecessaryMantissa: + enabled: true + + UnnecessaryParentReference: + enabled: true + + UrlFormat: + enabled: true + + UrlQuotes: + enabled: true + + VariableForProperty: + enabled: false + properties: [] + + VendorPrefix: + enabled: false + identifier_list: base + additional_identifiers: [] + excluded_identifiers: [] + + ZeroUnit: + enabled: true + + Compass::*: + enabled: false \ No newline at end of file diff --git a/local/config/vufind/facets.ini b/local/config/vufind/facets.ini index bd6a48cea17b71d7dcb6bd7a75c3171580ee8b64..7b4bd79f901f9cf49f1aa23cfb5f04df41ce3cba 100644 --- a/local/config/vufind/facets.ini +++ b/local/config/vufind/facets.ini @@ -141,6 +141,7 @@ dateRange[] = publishDateSort facet_limit = 30 ; Override facet_limit on a per-field basis using this array: ;facet_limit_by_field[format] = 50 +facet_limit_by_field[publishDateSort] = -1 ; By default, the side facets will only show 6 facets and then the "show more" ; button. This can get configured with the showMore settings. @@ -310,12 +311,6 @@ hide_facets = "genre_facet,era_facet,geographic_facet" [SortedByIndex] ;index[] = format -[Results_Settings] -; By default, how many values should we show for each facet? (-1 for no limit) -;facet_limit = 30 -; Override facet_limit on a per-field basis using this array: -facet_limit_by_field[publishDateSort] = -1 - ; Special terms (key), which can't / shouldn't be translated but marked as other language (value) for BARF reasons [LanguageTags] en[] = "American Museum of Natural History" diff --git a/module/finc/config/module.config.php b/module/finc/config/module.config.php index 428a1287c507b81be2d2f68e1f3f2a89e605bb96..3f206c21d65272cb09a6290778af66698f39152f 100644 --- a/module/finc/config/module.config.php +++ b/module/finc/config/module.config.php @@ -205,12 +205,10 @@ $config = [ ], 'resolver_driver' => [ 'factories' => [ - 'finc\Resolver\Driver\Ezb' => 'finc\Resolver\Driver\FincResolverDriverFactory', - 'finc\Resolver\Driver\Redi' => 'finc\Resolver\Driver\FincResolverDriverFactory' + 'finc\Resolver\Driver\Ezb' => 'finc\Resolver\Driver\FincResolverDriverFactory' ], 'aliases' => [ - 'ezb' => 'finc\Resolver\Driver\Ezb', - 'redi' => 'finc\Resolver\Driver\Redi' + 'ezb' => 'finc\Resolver\Driver\Ezb' ] ], 'hierarchy_treedataformatter' => [ diff --git a/module/finc/src/finc/ILS/Driver/PAIA.php b/module/finc/src/finc/ILS/Driver/PAIA.php index 39aca6e9c61dd4d78d83216be122c2f8efefc04d..15c6aecc6ff4d3c59ebae586b80e9379d7056ffb 100644 --- a/module/finc/src/finc/ILS/Driver/PAIA.php +++ b/module/finc/src/finc/ILS/Driver/PAIA.php @@ -962,8 +962,11 @@ class PAIA extends \VuFind\ILS\Driver\PAIA // queue (0..1) number of waiting requests for the document or item $result['position'] = ($doc['queue'] ?? null); - // only true if status == 4 - $result['available'] = false; + // status: provided (the document is ready to be used by the patron) + $result['available'] = $doc['status'] == 4 ? true : false; + + // status: reserved (1) and ordered (2) + $result['in_transit'] = $doc['status'] == 1 || $doc['status'] == 2; // about (0..1) textual description of the document $result['title'] = ($doc['about'] ?? null); @@ -1006,9 +1009,6 @@ class PAIA extends \VuFind\ILS\Driver\PAIA ? $this->convertDatetime($doc['endtime']) : ''); } - // status: provided (the document is ready to be used by the patron) - $result['available'] = $doc['status'] == 4 ? true : false; - // Optional VuFind fields /* $result['reqnum'] = null; @@ -1067,8 +1067,11 @@ class PAIA extends \VuFind\ILS\Driver\PAIA // queue (0..1) number of waiting requests for the document or item $result['position'] = ($doc['queue'] ?? null); - // only true if status == 4 - $result['available'] = false; + // status: provided (the document is ready to be used by the patron) + $result['available'] = $doc['status'] == 4 ? true : false; + + // status: reserved (1) and ordered (2) + $result['in_transit'] = $doc['status'] == 1 || $doc['status'] == 2; // about (0..1) textual description of the document $result['title'] = ($doc['about'] ?? null); @@ -1161,6 +1164,15 @@ class PAIA extends \VuFind\ILS\Driver\PAIA $result['duedate'] = (isset($doc['duedate']) ? $this->convertDate($doc['duedate']) : ''); + // From Vufind documentation: + // "dueStatus - A special status – may be 'due' (for items due very + // soon) or 'overdue' (for overdue items). If this is false, empty + // string, or unset, VuFind will assume that items have no special status. + // (optional)." + $result['dueStatus'] = isset($doc['endtime']) && (new \DateTime() > new \DateTime($doc['endtime'])) + ? 'overdue' + : ''; + // cancancel (0..1) whether an ordered or provided document can be // canceled diff --git a/module/finc/src/finc/Resolver/Driver/Redi.php b/module/finc/src/finc/Resolver/Driver/Redi.php deleted file mode 100644 index a75ad7db9a9cbee116ce9a24df82ff677241abed..0000000000000000000000000000000000000000 --- a/module/finc/src/finc/Resolver/Driver/Redi.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php -/** - * ReDi Link Resolver Driver - * - * PHP version 5 - * - * Copyright (C) Leipzig University Library 2015 - * - * @category VuFind - * @package Resolver_Drivers - * @author Robert Lange <lange@ub.uni-leipzig.de> - * @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:link_resolver_drivers Wiki - */ -namespace finc\Resolver\Driver; - -use VuFind\Resolver\Driver\Redi as RediBase; -use Zend\Dom\DOMXPath; - -/** - * Redi Link Resolver Driver - * - * @category VuFind - * @package Resolver_Drivers - * @author Robert Lange <lange@ub.uni-leipzig.de> - * @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:link_resolver_drivers Wiki - */ -class Redi extends RediBase -{ - - /** - * Constructor - * - * @param string $config redi configuration - * @param \Zend\Http\Client $httpClient HTTP client - */ - public function __construct($config, \Zend\Http\Client $httpClient) - { - $this->baseUrl = $config->url; - $this->httpClient = $httpClient; - } - - /** - * Fetch Links - * - * Fetches a set of links corresponding to an OpenURL - * - * @param string $openURL openURL (url-encoded) - * - * @return string raw XML returned by resolver - */ - public function fetchLinks($openURL) - { - $url = $this->getResolverUrl($openURL); - $feed = $this->httpClient->setUri($url)->send()->getBody(); - return $feed; - } - - /** - * Parse the Redi XML response and return array with DOI information. - * - * @param DOMDocument $xml Loaded xml document - * - * @deprecated with VuFind 9 - cf. https://github.com/vufind-org/vufind/pull/2419 - * @return array Get back a array with title, URL and service_type - */ - protected function parseDOI($xml) - { - $retval = []; - - $xpath = new DOMXPath($xml); - - $doiTerm = $xpath - ->query("//dt[@class='doi_t']"); - $doiDefinition = $xpath - ->query("//dd[@class='doi_d']"); - - if ($doiTerm->length == $doiDefinition->length) { - for ($i = 0; $i < $doiTerm->length; $i++) { - $href = $xpath - ->query(".//@href", $doiDefinition->item($i)) - ->item(0)->textContent; - $retval[] = [ - 'title' => $doiTerm->item($i)->textContent - . $doiDefinition->item($i)->textContent, - 'href' => $href, - 'access' => 'unknown', - 'coverage' => null, - 'service_type' => 'getDOI', - ]; - } - } - - return $retval; - } -} diff --git a/module/finc/tests/unit-tests/src/fincTest/Resolver/Driver/EzbTest.php b/module/finc/tests/unit-tests/src/fincTest/Resolver/Driver/EzbTest.php deleted file mode 100644 index 9841f6a87386e6af50723c016e0f1b1186185313..0000000000000000000000000000000000000000 --- a/module/finc/tests/unit-tests/src/fincTest/Resolver/Driver/EzbTest.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php -/** - * Finc Resolver Ezb Test Class - * - * PHP version 5 - * - * Copyright (C) Leipzig University Library 2017. - * - * 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. - * - * @category Finc - * @package Tests - * @author Robert Lange <lange@ub.uni-leipzig.de> - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link https://vufind.org/wiki/development:testing:unit_tests Wiki - */ -namespace FincTest\Resolver\Driver\Root; - -use Zend\Http\Client\Adapter\Test as TestAdapter; -use finc\Resolver\Driver\Ezb; - -/** - * Finc Resolver Redi Test Class - * - * @category Finc - * @package Tests - * @author Robert Lange <lange@ub.uni-leipzig.de> - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link https://vufind.org/wiki/development:testing:unit_tests Wiki - */ -class EzbTest extends \VuFindTest\Resolver\Driver\EzbTest -{ - protected $adapter; - protected $client; - - protected function initEmpty() - { - $this->adapter = new TestAdapter(); - $this->client = new \Zend\Http\Client(); - $this->client->setAdapter($this->adapter); - } - - protected function getInstance($baseUrl = false) - { - $this->initEmpty(); - return $ezb = new Ezb( - $baseUrl !== false ? (object) ['url' => $baseUrl] : (object) $this->openUrlConfig['OpenURL'], - $this->client - ); - } - - public function testGetResolverUrl() - { - $openUrl = "x=1&y=2"; - $this->assertEquals( - "{$this->openUrlConfig['OpenURL']['url']}?$openUrl", - $this->getInstance()->getResolverUrl($openUrl) - ); - } - - public function testGetResolverUrlWithQuestionMarkInBaseUrl() - { - $baseUrl = "{$this->openUrlConfig['OpenURL']['url']}?site=xyz"; - $openUrl = "x=1&y=2"; - $this->assertEquals("$baseUrl&$openUrl", $this->getInstance($baseUrl)->getResolverUrl($openUrl)); - } - - public function testGetResolverUrlNoParams() - { - $this->assertEquals($this->openUrlConfig['OpenURL']['url'], $this->getInstance()->getResolverUrl("")); - } - - public function testEmptyBaseUrlException() - { - $this->expectException(\Zend\Config\Exception\InvalidArgumentException::class); - $this->getInstance("")->getResolverUrl("xyz"); - } - - public function testRemoveLeadingConnectorFromOpenUrl() - { - $baseUrl = "http://services.dnb.de/fize-service/gvr/full.xml"; - $openUrl = "&x=1&y=2"; - $this->assertEquals( - "http://services.dnb.de/fize-service/gvr/full.xml?x=1&y=2", - $this->getInstance($baseUrl)->getResolverUrl($openUrl) - ); - - $openUrl = "?x=1&y=2"; - $this->assertEquals( - "http://services.dnb.de/fize-service/gvr/full.xml?x=1&y=2", - $this->getInstance($baseUrl)->getResolverUrl($openUrl) - ); - } -} diff --git a/module/finc/tests/unit-tests/src/fincTest/Resolver/Driver/RediTest.php b/module/finc/tests/unit-tests/src/fincTest/Resolver/Driver/RediTest.php deleted file mode 100644 index 0d375d90e760927d32d70d158b49908de154b2c9..0000000000000000000000000000000000000000 --- a/module/finc/tests/unit-tests/src/fincTest/Resolver/Driver/RediTest.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -/** - * Finc Resolver Redi Test Class - * - * PHP version 5 - * - * Copyright (C) Leipzig University Library 2017. - * - * 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. - * - * @category Finc - * @package Tests - * @author Robert Lange <lange@ub.uni-leipzig.de> - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link https://vufind.org/wiki/development:testing:unit_tests Wiki - */ -namespace FincTest\Resolver\Driver\Root; - -use Zend\Http\Client\Adapter\Test as TestAdapter; -use finc\Resolver\Driver\Redi; - -/** - * Finc Resolver Redi Test Class - * - * @category Finc - * @package Tests - * @author Robert Lange <lange@ub.uni-leipzig.de> - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link https://vufind.org/wiki/development:testing:unit_tests Wiki - */ -class RediTest extends \VuFindTest\Resolver\Driver\RediTest -{ - protected $adapter; - protected $client; - - protected function initEmpty() - { - $this->adapter = new TestAdapter(); - $this->client = new \Zend\Http\Client(); - $this->client->setAdapter($this->adapter); - } - - protected function getInstance($baseUrl = false) - { - $this->initEmpty(); - return $redi = new Redi( - $baseUrl !== false ? $baseUrl : $this->openUrlConfig['OpenURL']['url'], - $this->client - ); - } - - public function testGetResolverUrl() - { - $openUrl = "x=1&y=2"; - $this->assertEquals( - "{$this->openUrlConfig['OpenURL']['url']}?$openUrl", - $this->getInstance()->getResolverUrl($openUrl) - ); - } - - public function testGetResolverUrlWithQuestionMarkInBaseUrl() - { - $baseUrl = "{$this->openUrlConfig['OpenURL']['url']}?site=xyz"; - $openUrl = "x=1&y=2"; - $this->assertEquals("$baseUrl&$openUrl", $this->getInstance($baseUrl)->getResolverUrl($openUrl)); - } - - public function testGetResolverUrlNoParams() - { - $this->assertEquals($this->openUrlConfig['OpenURL']['url'], $this->getInstance()->getResolverUrl("")); - } - - public function testGetResolverUrlWHZ() - { - $openUrl = "rl_site=whz&issn=1941-9511"; - $this->assertEquals( - "http://www.redi-bw.de/links/whz?rl_site=whz&rl_site=whz&issn=1941-9511", - $this->getInstance("http://www.redi-bw.de/links/whz?rl_site=whz")->getResolverUrl($openUrl) - ); - } - - public function testEmptyBaseUrlException() - { - $this->expectException(\Zend\Config\Exception\InvalidArgumentException::class); - $this->getInstance("")->getResolverUrl(""); - } -} diff --git a/themes/finc/js/account_ajax.js b/themes/finc/js/account_ajax.js deleted file mode 100644 index 6f6d3687376ecba195ad5dbef8c6f68c97f55bda..0000000000000000000000000000000000000000 --- a/themes/finc/js/account_ajax.js +++ /dev/null @@ -1,285 +0,0 @@ -/*global userIsLoggedIn, VuFind */ -VuFind.register('account', function Account() { - // Retrieved statuses - var LOADING = -1 * Math.PI; // waiting for request - var MISSING = -2 * Math.PI; // no data available - var INACTIVE = -3 * Math.PI; // status element missing - var _statuses = {}; - - // Account Icons - var ICON_LEVELS = { - "NONE": 0, - "GOOD": 1, - "WARNING": 2, - "DANGER": 3 - }; - var _accountIcons = {}; - _accountIcons[ICON_LEVELS.NONE] = "fa fa-user-circle"; - _accountIcons[ICON_LEVELS.GOOD] = "fa fa-bell text-success"; - _accountIcons[ICON_LEVELS.WARNING] = "fa fa-bell text-warning"; - _accountIcons[ICON_LEVELS.DANGER] = "fa fa-exclamation-triangle text-danger"; - - var _submodules = []; - - var _sessionDataPrefix = "vf-account-status-"; - var _save = function _save(module) { - sessionStorage.setItem( - _sessionDataPrefix + module, - JSON.stringify(_statuses[module]) - ); - }; - - // Clearing save forces AJAX update next page load - var clearCache = function clearCache(name) { - if (typeof name === "undefined") { - for (var sub in _submodules) { - if (Object.prototype.hasOwnProperty.call(_submodules, sub)) { - clearCache(sub); - } - } - } else { - sessionStorage.removeItem(_sessionDataPrefix + name); - } - }; - - var _getStatus = function _getStatus(module) { - return (typeof _statuses[module] === "undefined") ? LOADING : _statuses[module]; - }; - - var _render = function _render() { - var accountStatus = ICON_LEVELS.NONE; - for (var sub in _submodules) { - if (Object.prototype.hasOwnProperty.call(_submodules, sub)) { - var $element = $(_submodules[sub].selector); - if (!$element) { - _statuses[sub] = INACTIVE; - continue; - } - var status = _getStatus(sub); - if (status === MISSING) { - $element.addClass('hidden'); - } else { - $element.removeClass('hidden'); - if (status === LOADING) { - $element.html('<i class="fa fa-spin fa-spinner"></i>'); - } else { - var moduleStatus = _submodules[sub].render($element, _statuses[sub], ICON_LEVELS); - if (moduleStatus > accountStatus) { - accountStatus = moduleStatus; - } - } - } - } - } - $("#account-icon").attr("class", _accountIcons[accountStatus]); - if (accountStatus > ICON_LEVELS.NONE) { - $("#account-icon") - .attr("data-toggle", "tooltip") - .attr("data-placement", "bottom") - .attr("title", VuFind.translate("account_has_alerts")) - .tooltip(); - } else { - $("#account-icon").tooltip("destroy"); - } - }; - var _ajaxLookup = function _ajaxLookup(module) { - $.ajax({ - url: VuFind.path + '/AJAX/JSON?method=' + _submodules[module].ajaxMethod, - dataType: 'json', - data: _submodules[module].data || [] /* finc specific */ - }) - .done(function ajaxLookupDone(response) { - _statuses[module] = response.data; - }) - .fail(function ajaxLookupFail() { - _statuses[module] = MISSING; - }) - .always(function ajaxLookupAlways() { - _save(module); - _render(); - }); - }; - - var _load = function _load(module) { - var $element = $(_submodules[module].selector); - if (!$element) { - _statuses[module] = INACTIVE; - } else { - var json = sessionStorage.getItem(_sessionDataPrefix + module); - var session = typeof json === "undefined" ? null : JSON.parse(json); - if ( - session === null || - session === LOADING || - session === MISSING - ) { - _statuses[module] = LOADING; - _ajaxLookup(module); - } else { - _statuses[module] = session; - } - _render(); - } - }; - - var init = function init() { - // Update information when certain actions are performed - $("#renewals").submit(function clearCheckedOut() { - clearCache("checkedOut"); - }); - $('#cancelHold, [name="placeHold"]').submit(function clearHolds() { - clearCache("holds"); - }); - $('#ILLRequestForm, #cancelILLRequest').submit(function clearHolds() { - clearCache("illRequests"); - }); - $('[name="placeStorageRetrievalRequest"], #cancelStorageRetrievalRequest').submit(function clearStorageRetrievals() { - clearCache("storageRetrievalRequests"); - }); - $("#library_card").change(function clearChangeLibraryCard() { - clearCache(/* all */); - }); - }; - - var register = function register(name, module) { - if (typeof _submodules[name] === "undefined") { - _submodules[name] = typeof module == 'function' ? module() : module; - } - var $el = $(_submodules[name].selector); - if ($el.length > 0) { - $el.removeClass("hidden"); - _statuses[name] = LOADING; - _load(name); - } else { - _statuses[name] = INACTIVE; - } - }; - - return { - init: init, - clearCache: clearCache, - // if user is logged out, clear cache instead of register - register: userIsLoggedIn ? register : clearCache - }; -}); - -$(document).ready(function registerAccountAjax() { - - VuFind.account.register("fines", { - selector: ".fines-status", - ajaxMethod: "getUserFines", - render: function render($element, status, ICON_LEVELS) { - if (status.value === 0) { - $element.addClass("hidden"); - return ICON_LEVELS.NONE; - } - $element.html('<span class="badge overdue">' + status.display + '</span>'); - return ICON_LEVELS.DANGER; - } - }); - - VuFind.account.register("checkedOut", { - selector: ".checkedout-status", - ajaxMethod: "getUserTransactions", - render: function render($element, status, ICON_LEVELS) { - var html = ''; - var level = ICON_LEVELS.NONE; - if (status.ok > 0) { - html += '<span class="badge ok" data-toggle="tooltip" title="' + VuFind.translate('Checked Out Items') + '">' + status.ok + '</span>'; - } - if (status.warn > 0) { - html += '<span class="badge warn" data-toggle="tooltip" title="' + VuFind.translate('renew_item_due_tooltip') + '">' + status.warn + '</span>'; - level = ICON_LEVELS.WARNING; - } - if (status.overdue > 0) { - html += '<span class="badge overdue" data-toggle="tooltip" title="' + VuFind.translate('renew_item_overdue_tooltip') + '">' + status.overdue + '</span>'; - level = ICON_LEVELS.DANGER; - } - $element.html(html); - $('[data-toggle="tooltip"]', $element).tooltip(); - return level; - } - }); - - VuFind.account.register("holds", { - selector: ".holds-status", - ajaxMethod: "getUserHolds", - render: function render($element, status, ICON_LEVELS) { - var level = ICON_LEVELS.NONE; - if (status.available > 0) { - $element.html('<i class="fa fa-bell text-success" data-toggle="tooltip" title="' + VuFind.translate('hold_available') + '"></i>'); - level = ICON_LEVELS.GOOD; - } else if (status.in_transit > 0) { - $element.html('<i class="fa fa-clock-o text-warning" data-toggle="tooltip" title="' + VuFind.translate('request_in_transit') + '"></i>'); - } else { - $element.addClass("holds-status hidden"); - } - $('[data-toggle="tooltip"]', $element).tooltip(); - return level; - } - }); - - VuFind.account.register("illRequests", { - selector: ".illrequests-status", - ajaxMethod: "getUserILLRequests", - render: function render($element, status, ICON_LEVELS) { - var level = ICON_LEVELS.NONE; - if (status.available > 0) { - $element.html('<i class="fa fa-bell text-success" data-toggle="tooltip" title="' + VuFind.translate('ill_request_available') + '"></i>'); - level = ICON_LEVELS.GOOD; - } else if (status.in_transit > 0) { - $element.html('<i class="fa fa-clock-o text-warning" data-toggle="tooltip" title="' + VuFind.translate('request_in_transit') + '"></i>'); - } else { - $element.addClass("holds-status hidden"); - } - $('[data-toggle="tooltip"]', $element).tooltip(); - return level; - } - }); - - VuFind.account.register("storageRetrievalRequests", { - selector: ".storageretrievalrequests-status", - ajaxMethod: "getUserStorageRetrievalRequests", - render: function render($element, status, ICON_LEVELS) { - var level = ICON_LEVELS.NONE; - if (status.available > 0) { - $element.html('<i class="fa fa-bell text-success" data-toggle="tooltip" title="' + VuFind.translate('storage_retrieval_request_available') + '"></i>'); - level = ICON_LEVELS.GOOD; - } else if (status.in_transit > 0) { - $element.html('<i class="fa fa-clock-o text-warning" data-toggle="tooltip" title="' + VuFind.translate('request_in_transit') + '"></i>'); - } else { - $element.addClass("holds-status hidden"); - } - $('[data-toggle="tooltip"]', $element).tooltip(); - return level; - } - }); - - /* finc specific */ - $(document).ready(function () { - var menuItems = $('.itemCount'); - if(menuItems.length === 0) { - return; - } - var countables = new Array; - menuItems.each(function() { - countables.push($(this).attr('id')); - }); - - $.ajax({ - dataType: 'json', - method: 'GET', - url: VuFind.path + '/AJAX/JSON?method=getAdditionalAccountInfo', - data: {'views':countables} - }) - .done(function(response) { - if (response.data.countFines != undefined && response.data.countFines != 0) { - $('#getFinesTotal').text(response.data.countFines); - $('.fines').addClass('red-alert'); - } - $.each(response.data.countViewItems, function (id, itemCount) { - $('#'+id).text('('+itemCount+')'); - }); - }); - }); - /* finc specific - END */ -}); diff --git a/themes/finc/templates/ajax/resolverLink.phtml b/themes/finc/templates/ajax/resolverLink.phtml index f84a2cd4eee2ffbabb071094472cec49f3b5072b..7c9b03763609794a698148ef980bf373666cd400 100644 --- a/themes/finc/templates/ajax/resolverLink.phtml +++ b/themes/finc/templates/ajax/resolverLink.phtml @@ -1,14 +1,35 @@ +<!-- finc - templates - ajax - resolverLink --> <?php if (!empty($link['href'])): ?> - <a href="<?=$this->escapeHtmlAttr($link['href'])?>" title="<?=$this->transEsc($link['service_type'] ?? '')?>"<?=!empty($link['access']) ? ' class="access-' . $link['access'] . '"':''?>> - <?=$this->escapeHtml($link['title'] ?? '')?> - </a> + <?php /* finc-specific change #7986 - CK - traffic light */ ?> + <div class="show-availability"> + <span class="sr-only"> + <?=$this->translate('Availability')?>: <?=$this->transEsc('resolver_link_access_' . $link['access'])?> + </span> + <div aria-hidden="true"<?php if (!empty($link['access'])): ?> data-toggle="tooltip" title="<?=$this->transEsc('resolver_link_access_' . $link['access'])?>" class="traffic-light access-<?=$link['access']?>"<?php endif;?>> + <span class="first"></span> + <span class="second"></span> + <span class="last"></span> + </div> + </div> + <?php /* finc-specific change #7986 - END */ ?> + <?= $this->externalLink( + $this->escapeHtmlAttr($link['href']), + $link['title'] ?? '', + [ + 'title' => $link['service_type'] ?? '', + 'class' => !empty($link['access']) ? 'access-' . $link['access'] : '' + ] + ) ?> + <?php /* finc-specific change #5334 - CK */ ?> + <small> + <?= isset($link['coverage']) ? $this->escapeHtml($link['coverage']) : '' ?> + <?= isset($link['coverageHref']) + ? $this->externalLink($link['coverageHref'], $this->translate('Readme')) + : '' ?> + </small> + <?php /* finc-specific change #5334 - END */ ?> <?php else: ?> - <?=$this->escapeHtml($link['title'] ?? '')?> -<?php endif; ?> -<?php if (!empty($link['coverage'])): ?> - <span class="openurl-coverage"> - <?=$this->escapeHtml($link['coverage'])?> - </span> + <?=isset($link['title'])?$this->escapeHtml($link['title']):''?> <?=isset($link['coverage'])?$this->transEsc($link['coverage']):''?> <?php endif; ?> <?php if (!empty($link['notes'])): ?> <span class="openurl-notes"> @@ -20,3 +41,4 @@ <?=$this->escapeHtml($link['authentication'])?> </span> <?php endif; ?> +<!-- finc - templates - ajax - resolverLink - END --> \ No newline at end of file diff --git a/themes/finc/templates/collection/view.phtml b/themes/finc/templates/collection/view.phtml index 176b98227bbdcf1fe711c5a941c6afcf552f0613..7c0dca05e567a8721057ea1daa3fd7d3c39a4e8a 100644 --- a/themes/finc/templates/collection/view.phtml +++ b/themes/finc/templates/collection/view.phtml @@ -29,11 +29,7 @@ <?=$this->render('record/prev-next.phtml'); ?> <?php endif; ?> -<?php /* DON'T pull the toolbar in here but below, finc-specific, CK */ -/* <?=$this->record($this->driver)->getToolbar()?> -*/ -?> <div class="record"> <?php /* finc - don't use '<?=count($sidebarList) < 1 ? ' solo' : '' ?>' or toolbar won't fit; BS count sidebars but our toolbar isn't counted */ ?> @@ -89,17 +85,6 @@ <?=$this->driver->supportsCoinsOpenURL()?'<span class="Z3988" title="' . $this->escapeHtmlAttr($this->driver->getCoinsOpenURL()) . '"></span>':''?> </div> - - <?php /* pull the toolbar here, finc-specific, CK */ ?> - <?php if (isset($activeTabObj) && is_callable([$activeTabObj, 'getSideRecommendations'])): ?> - <div class="<?= $this->layoutClass('sidebar') ?>" id="myresearch-sidebar"> - - <?= $this->record($this->driver)->getToolbar() ?> - <?php foreach ($activeTabObj->getSideRecommendations() as $current): ?> - <?= $this->recommend($current) ?> - <?php endforeach; ?> - </div> - <?php endif; ?> </div> <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, '$(document).ready(recordDocReady);', 'SET'); ?> <!-- finc: collection - view - END --> diff --git a/themes/finc/templates/myresearch/menu.phtml b/themes/finc/templates/myresearch/menu.phtml deleted file mode 100644 index e98fc9528ea9185bc197a1982ae46cd2e9c943f5..0000000000000000000000000000000000000000 --- a/themes/finc/templates/myresearch/menu.phtml +++ /dev/null @@ -1,159 +0,0 @@ -<!-- finc: myresearch - menu --> -<?php - $user = $this->auth()->isLoggedIn(); - $patron = $user ? $this->auth()->getILSPatron() : false; - $capabilityParams = $patron ? ['patron' => $patron] : []; - $ilsOnline = ('ils-none' !== $this->ils()->getOfflineMode()); -?> -<?php /* finc change btn-link to btn-default */ ?> -<button class="close-offcanvas btn btn-default" data-toggle="offcanvas"><?=$this->transEsc('navigate_back') ?></button> -<?php /* finc: change h3 to h2 */ ?> -<h2><?=$this->transEsc('Your Account')?></h2> -<?php /* finc needs to add .facet-group class and classes on sub items for borders - CK */ - /* also adds aria-current for correct menu action */ ?> -<?php /* finc needs to add .facet-group class and classes on sub items for borders - CK */ ?> -<?php /* finc: myreasearch menu as list #19734 */ ?> -<?php /* finc: specify current page menu entry in following elements #19941 */ ?> -<ul class="myresearch-menu account-menu facet-group"> - <?php if ($this->userlist()->getMode() !== 'disabled'): ?> - <li class="facet"> - <a href="<?=$this->url('myresearch-favorites')?>"<?=$this->active == 'favorites' ? ' class="active" aria-current="page"' : ''?>> - <i class="fa fa-fw fa-star" aria-hidden="true"></i> <?=$this->transEsc('Favorites')?> - </a> - </li> - <?php endif; ?> - <?php if ($ilsOnline && $this->ils()->checkCapability('getMyTransactions', $capabilityParams)): ?> - <li class="facet"> - <a href="<?=$this->url('myresearch-checkedout')?>" class="flex checkedout<?=$this->active == 'checkedout' ? ' active' : ''?>" - <?=$this->active == 'checkedout' ? ' aria-current="page"' : ''?> - > - <span class="flex-col"><i class="fa fa-fw fa-book" aria-hidden="true"></i> <?=$this->transEsc('Checked Out Items')?></span> - <span class="checkedout-status status hidden"><i class="fa fa-spin fa-spinner" aria-hidden="true"></i></span> - <?php /* nxt line finc specific - CK */ ?> - <span id="getMyTransactions" class="itemCount pull-right no-padding"></span> - </a> - </li> - <?php endif; ?> - <?php if ($ilsOnline && $this->ils()->checkFunction('getMyTransactionHistory', $capabilityParams)): ?> - <li class="facet"> - <a href="<?=$this->url('myresearch-historicloans')?>"<?=$this->active == 'historicloans' ? ' class="active" aria-current="page"' : ''?>> - <i class="fa fa-fw fa-history" aria-hidden="true"></i> <?=$this->transEsc('Loan History')?> - </a> - </li> - <?php endif; ?> - <?php if ($ilsOnline && $this->ils()->checkCapability('getMyHolds', $capabilityParams)): ?> - <li class="facet"> - <a href="<?=$this->url('myresearch-holds')?>" class="flex<?=$this->active == 'holds' ? ' active' : ''?>" - <?=$this->active == 'holds' ? ' aria-current="page"' : ''?> - > - <span class="flex-col"><i class="fa fa-fw fa-flag" aria-hidden="true"></i> <?=$this->transEsc('Holds and Recalls')?></span> - <span class="holds-status status hidden"><i class="fa fa-spin fa-spinner" aria-hidden="true"></i></span> - <?php /* nxt line finc specific - CK */ ?> - <span id="getMyHolds" class="itemCount pull-right no-padding"></span> - </a> - </li> - <?php endif; ?> - <?php if ($ilsOnline && $this->ils()->checkFunction('StorageRetrievalRequests', $capabilityParams)): ?> - <li class="facet"> - <a href="<?=$this->url('myresearch-storageretrievalrequests')?>" class="flex<?=$this->active == 'storageRetrievalRequests' ? ' active' : ''?>" - <?=$this->active == 'storageRetrievalRequests' ? ' aria-current="page"' : ''?> - > - <span class="flex-col"><i class="fa fa-fw fa-archive" aria-hidden="true"></i> <?=$this->transEsc('Storage Retrieval Requests')?></span> - <span class="storageretrievalrequests-status status hidden"><i class="fa fa-spin fa-spinner" aria-hidden="true"></i></span> - <?php /* nxt line finc specific - CK */ ?> - <span id="getMyStorageRetrievalRequests" class="itemCount pull-right no-padding"></span> - </a> - </li> - <?php endif; ?> - <?php if ($ilsOnline && $this->ils()->checkFunction('ILLRequests', $capabilityParams)): ?> - <li class="facet"> - <a href="<?=$this->url('myresearch-illrequests')?>" class="flex<?=$this->active == 'ILLRequests' ? ' active' : ''?>" - <?=$this->active == 'ILLRequests' ? ' aria-current="page"' : ''?> - > - <span class="flex-col"><i class="fa fa-fw fa-exchange" aria-hidden="true"></i> <?=$this->transEsc('Interlibrary Loan Requests')?></span> - <span class="illrequests-status status hidden"><i class="fa fa-spin fa-spinner" aria-hidden="true"></i></span> - <?php /* nxt line finc specific - CK */ ?> - <span id="getMyILLRequests" class="itemCount pull-right no-padding"></span> - </a> - </li> - <?php endif; ?> - <?php if ($ilsOnline && $this->ils()->checkCapability('getMyFines', $capabilityParams)): ?> - <li class="facet"> - <a href="<?=$this->url('myresearch-fines')?>" class="flex<?=$this->active == 'fines' ? ' active' : ''?>" - <?=$this->active == 'fines' ? ' aria-current="page"' : ''?> - > - <span class="flex-col"><i class="fa fa-fw fa-usd" aria-hidden="true"></i> <?=$this->transEsc('Fines')?></span> - <span class="fines-status status hidden"><i class="fa fa-spin fa-spinner" aria-hidden="true"></i></span> - </a> - </li> - <?php endif; ?> - <li class="facet"> - <a href="<?=$this->url('myresearch-profile')?>"<?=$this->active == 'profile' ? ' class="active" aria-current="page"' : ''?>> - <i class="fa fa-fw fa-user" aria-hidden="true"></i> <?=$this->transEsc('Profile')?> - </a> - </li> - <?php if ($ilsOnline && $user && $user->libraryCardsEnabled()): ?> - <li class="facet"> - <a href="<?=$this->url('librarycards-home')?>"<?=$this->active == 'librarycards' ? ' class="active" aria-current="page"' : ''?>> - <i class="fa fa-fw fa-barcode" aria-hidden="true"></i> <?=$this->transEsc('Library Cards')?> - </a> - </li> - <?php endif; ?> - <?php if ($this->overdrive()->showMyContentLink()):?> - <li class="facet"> - <a href="<?=$this->url('overdrive-mycontent')?>"<?=$this->active == 'dgcontent' ? ' class="active"' : ''?>> - <i class="fa fa-fw fa-download" aria-hidden="true"></i> <?=$this->transEsc('Overdrive Content')?> - </a> - </li> - <?php endif; ?> - <?php if ($this->accountCapabilities()->getSavedSearchSetting() === 'enabled'): ?> - <li class="facet"> - <a href="<?=$this->url('search-history')?>?require_login"<?=$this->active == 'history' ? ' class="active" aria-current="page"' : ''?>> - <i class="fa fa-fw fa-search" aria-hidden="true"></i> <?=$this->transEsc('history_saved_searches')?> - </a> - </li> - <?php endif; ?> - <?php if ($user): ?> - <li class="facet"> - <a href="<?=$this->url('myresearch-logout')?>"> - <i class="fa fa-fw fa-sign-out" aria-hidden="true"></i> <?=$this->transEsc("Log Out")?> - </a> - </li> - <?php endif; ?> -</ul> - -<?php if ($user && $this->userlist()->getMode() !== 'disabled'): ?> - <?php /* finc adds '.lists-heading' for styling purposes */ ?> - <h3 class="lists-heading"><?=$this->transEsc('Your Lists')?></h3> - <?php /* finc: change menu into list */ ?> - <ul class="myresearch-menu facet-group"> - <li class="facet"> - <?php /* finc adds aria-current */ ?> - <a href="<?=$this->url('myresearch-favorites')?>"<?=$this->active == 'favorites' ? ' class="active"' : ''?> - <?=$this->active == 'favorites' ? ' aria-current="page"' : ''?> - > - <i class="fa fa-fw fa-star" aria-hidden="true"></i> <?=$this->transEsc('Your Favorites')?> - </a> - </li> - <?php $lists = $user->getLists() ?> - <?php foreach ($lists as $list): ?> - <?php /* finc: keep icon inside + keep braces in badge!; CK*/ ?> - <li class="facet"> - <a href="<?=$this->url('userList', ['id' => $list['id']])?>"<?=$this->active == 'list' . $list['id'] ? ' class="active"' : ''?> - <?=$this->active == 'list' . $list['id'] ? ' aria-current="page"' : ''?> - > - <i class="fa fa-fw fa-star-o" aria-hidden="true"></i> <?=$this->escapeHtml($list['title'])?> - <span class="badge">(<?=$list->cnt?>)</span> - </a> - </li> - <?php endforeach; ?> - <li class="facet"> - <a href="<?=$this->url('editList', ['id' => 'NEW'])?>"<?=$this->active == 'editlist/NEW' ? ' class="active"' : ''?> - <?=$this->active == 'editlist/NEW' ? ' aria-current="page"' : ''?> - > - <i class="fa fa-fw fa-plus" aria-hidden="true"></i> <?=$this->transEsc('Create a List')?> - </a> - </li> - </ul> -<?php endif ?> -<!-- finc: myresearch - menu - END -->