diff --git a/module/VuFind/src/VuFind/Resolver/Driver/Redi.php b/module/VuFind/src/VuFind/Resolver/Driver/Redi.php index f240f5cbe41ef848dcba44e55a6f06f45e5a5fe4..d8ade3ad3bb661cf90c6f465160fc28cbef597f2 100644 --- a/module/VuFind/src/VuFind/Resolver/Driver/Redi.php +++ b/module/VuFind/src/VuFind/Resolver/Driver/Redi.php @@ -142,7 +142,9 @@ class Redi extends AbstractBase 'title' => $doiTerm->item($i)->textContent . $doiDefinition->item($i)->textContent, 'href' => $href, - 'service_type' => 'getFullTxt', + 'access' => 'unknown', + 'coverage' => null, + 'service_type' => 'getDOI', ]; } } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/RediTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/RediTest.php index eb2e8505644eaee7b43c4885966ff7104de0fe8b..7a65693ad6ed3a58679d3b49ee154c875fbeb6bd 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/RediTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/RediTest.php @@ -81,7 +81,9 @@ class RediTest extends \VuFindTest\Unit\TestCase 0 => [ 'title' => "DOI:10.1007/s11606-014-2915-9", 'href' => "http://www-fr.redi-bw.de/links/?rl_site=ubl&rl_action=link&rl_link_target=citation&rl_link_name=doi&rl_citation=9443914d0e261c0c1f6a3fd8151213c1d4cec05f5d3053097da6fa5597bbb9d7", - 'service_type' => "getFullTxt", + 'access' => 'unknown', + 'coverage' => null, + 'service_type' => "getDOI", ], 1 => [ 'title' => "Zum Volltext (via SpringerLink)", diff --git a/module/finc/src/finc/Resolver/Driver/Redi.php b/module/finc/src/finc/Resolver/Driver/Redi.php index c95c4a029c8fb49edbae40e87692739d5817feaf..a75ad7db9a9cbee116ce9a24df82ff677241abed 100644 --- a/module/finc/src/finc/Resolver/Driver/Redi.php +++ b/module/finc/src/finc/Resolver/Driver/Redi.php @@ -16,6 +16,7 @@ namespace finc\Resolver\Driver; use VuFind\Resolver\Driver\Redi as RediBase; +use Zend\Dom\DOMXPath; /** * Redi Link Resolver Driver @@ -57,4 +58,42 @@ class Redi extends RediBase $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/themes/finc/js/account_ajax.js b/themes/finc/js/account_ajax.js index c789c5f358637ca928699eb3935dbdda4858a37a..7fb72e08c8b53dd401182a1bd40525a7b403825e 100644 --- a/themes/finc/js/account_ajax.js +++ b/themes/finc/js/account_ajax.js @@ -251,30 +251,31 @@ $(document).ready(function registerAccountAjax() { }); /* finc specific */ - $('.itemCount').each(function() { - let selector = $(this).attr('id'); - if(!selector) + $(document).ready(function () { + var menuItems = $('.itemCount'); + if(menuItems.length === 0) { return; + } + var countables = new Array; + menuItems.each(function() { + countables.push($(this).attr('id')); + }); - VuFind.account.register("itemCount", { - selector: "#" + selector, - ajaxMethod: "getAdditionalAccountInfo", - data: {'views':[selector]}, - render: function render($element, status, ICON_LEVELS) { - var level = ICON_LEVELS.NONE; - var html = ''; - $.each(status, function (i, result) { - $.each(result, function (id, itemCount) { - if ($element.attr("id") === id && itemCount > 0) { - level = ICON_LEVELS.GOOD; - html += '<span class="badge ok">' + itemCount + '</span>'; - } - }); + $.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+')'); }); - $element.html(html); - return level; - } - }); + }); }); /* finc specific - END */ }); diff --git a/themes/finc/templates/ContentBlock/FacetList.phtml b/themes/finc/templates/ContentBlock/FacetList.phtml index b6a8d836a526fc00815ae8c0f1a59fafc641af06..886e12940c21c41f8308e42e8ef6f7d1f9a0ea37 100644 --- a/themes/finc/templates/ContentBlock/FacetList.phtml +++ b/themes/finc/templates/ContentBlock/FacetList.phtml @@ -1,4 +1,4 @@ -<!-- finc: ContentBlock -- FacetList --> +<!-- finc: ContentBlock - FacetList --> <?php // Load search actions and settings (if any): $options = $this->searchOptions($searchClassId); @@ -95,4 +95,4 @@ JS; <?php endforeach; ?> </div> <?php endif; ?> -<!-- finc: ContentBlock -- FacetList - END --> \ No newline at end of file +<!-- finc: ContentBlock - FacetList - END --> \ No newline at end of file