forked from Aspen-Discovery/aspen-discovery
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Access Online uses LibKey link
Setting up for testing: Ensure that the ILS of your choice contains records which Aspen will recognise as eContent. If using Koha as Aspen's ILS: You will need to create a new item type that matches the item types Aspen currently recognises as eContent. I would recommend using 'online' (for the full list: KohaProcessorJava.php) You will also likely need to add a new record that has a DOI - I recommend selecting an open Access research paper. The DOI must be included in field 856 u. Once Aspen has indexed the newly added record, testing can start. Note: this assume that the LibKey settings has been set up. If not, see the test plan in commit 'feat: Administer LibKey Settings' Test plan: - search Aspen for the item you have added - click on the search result's title or 'More Info' button - Scroll to the 'Links' section, and open it. - Notice the doi link - Notice the LibKey link - Notice the 'Access Online' button - Click the LibKey link - if LibKey was able to return a direct link to the text, this should take you to a PDF of the document via LibKey, which should open in a new tab. - Click the 'Access Online' button. The redirect behaviour here should be exactly the same as what occurred when clicking the LibKey link. - On the search results page (/Union/Search), open 'Show Edition(s)' on the record. Click the 'Access Online' link - again, notice that the redirect behaviour is the same.
- Loading branch information
1 parent
293b207
commit 3956f87
Showing
2 changed files
with
78 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
class LibKeyDriver { | ||
|
||
public function getLibKeyLink($doi) { | ||
require_once ROOT_DIR . '/sys/LibKey/LibKeySetting.php'; | ||
$activeLibrary = Library::getActiveLibrary(); | ||
$settings = new LibKeySetting(); | ||
$settings->whereAdd("id=$activeLibrary->libKeySettingId"); | ||
if ($settings->find(true)) { | ||
$settings->fetch(); | ||
} | ||
$curlWrapper = new CurlWrapper; | ||
$response = $curlWrapper->curlGetPage("https://public-api.thirdiron.com/public/v1/libraries/" . $settings->libraryId . "/articles/doi/" . $doi . "?access_token=" . $settings->apiKey); | ||
if (empty($response)) { | ||
return null; | ||
} | ||
return json_decode($response, true)["data"]["bestIntegratorLink"]["bestLink"]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters