Coder Social home page Coder Social logo

umnlibraries / primo-explore-hathitrust-availability Goto Github PK

View Code? Open in Web Editor NEW
22.0 8.0 6.0 507 KB

Primo new UI directive that adds HathiTrust availability for public domain content

License: MIT License

CSS 0.79% JavaScript 95.72% Shell 3.48%
hathitrust primo

primo-explore-hathitrust-availability's Introduction

primo-explore-hathitrust-availability

Features

When search results are displayed, a record's OCLC numbers are passed to the HathiTrust Bib API. If at least one item with free full-text access is found, a link to the HathiTrust record is appended to the availability section.

Screenshot

screenshot

Install

  1. Make sure you've installed and configured primo-explore-devenv.
  2. Navigate to your template/central package root directory. For example:
    cd primo-explore/custom/MY_VIEW_ID
    
  3. If you do not already have a package.json file in this directory, create one:
    npm init -y
    
  4. Install this package:
    npm install primo-explore-hathitrust-availability --save-dev
    

Usage

Once this package is installed, create a file 'custom.module.js' and add hathiTrustAvailability as a dependency for your custom module definition, and then add the hathi-trust-availability directive to the prmSearchResultAvailabilityLineAfter component. For example:

var app = angular.module('viewCustom', ['hathiTrustAvailability']);

app.component('prmSearchResultAvailabilityLineAfter', {
    template: '<hathi-trust-availability></hathi-trust-availability>'
  });

Note: If you're using the --browserify build option, you will need to first import the module with:

import 'primo-explore-hathitrust-availability';

The idea here is to allow multiple custom components to be added to the prmSearchResultAvailabilityLineAfter rather than attempting to redefine it.

Customizing the Availability Message

The default availability message is "Full Text Available at HathiTrust". You can override this by setting the msg attribute:

<hathi-trust-availability hide-online="true" msg="WOW, HathiTrust! Lucky you!"
></hathi-trust-availability>

Selectively Suppressing Full-text Links

By default, the component will display full-text links for any resource. If you want it avoid looking for full-text availability on records for which you already have an online copy, you can add a hide-online=tue attribute to the component:

<hathi-trust-availability hide-online="true"></hathi-trust-availability>

As of version 2.6 you can optionally suppress full-test links for journals:

<hathi-trust-availability hide-if-journal="true"></hathi-trust-availability>

Ignoring Copyright Status (version 2.4+)

If you want to display full-text links to any HathiTrust record, regardless of copyright status, use the ignore-copyright attribute:

<hathi-trust-availability ignore-copyright="true"></hathi-trust-availability>

If you're a partner institution and you want the availability links to use HathiTrust's automatic login, add your SAML IdP's entity ID:

<hathi-trust-availability 
    ignore-copyright="true" 
    entity-id="https://shibboleth.umich.edu/idp/shibboleth"
></hathi-trust-availability>

Notes

  • If you have custom ccs give it a name other than 'custom1.css' so it is not overwritten.
  • See instructions in primo-explore-devenv on running locally
  • To deploy: run gulp create-package to create a primo compatible package and upload your view in the interface.

Development

Running tests

  1. Clone the repo
  2. Run npm install
  3. Run npm test

primo-explore-hathitrust-availability's People

Contributors

dependabot[bot] avatar gpeterso avatar megwill4268 avatar wopsononock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

primo-explore-hathitrust-availability's Issues

Unable to import package

Hello, I'm having trouble getting this package to run properly in my local dev environment.

I've tried two approaches:

  1. I added this to custom.module.js
import 'primo-explore-hathitrust-availability';

var app = angular.module('viewCustom', ['angularLoad', 'hathiTrustAvailability']);

app.component('prmSearchResultAvailabilityLineAfter', {
    template: '<hathi-trust-availability ignore-copyright="true"></hathi-trust-availability>'
  });

and ran my local development with gulp run --view <my_view_name> --ve. I get this error in the browser console:

Uncaught ReferenceError: require is not defined
  1. I also tried editing custom.js directly and passed the --browserify flag for the run command.
import 'primo-explore-hathitrust-availability';

var app = angular.module('viewCustom', ['angularLoad', 'hathiTrustAvailability']);

app.component('prmSearchResultAvailabilityLineAfter', {
  template: '<hathi-trust-availability ignore-copyright="true"></hathi-trust-availability>'
});

gulp run --browserify --view <my_view_name> --ve

I get this error in the console:

Uncaught SyntaxError: Cannot use import statement outside a module

Am I doing something incorrectly?

Thank you!

Displaying on non-owned titles in network zone

First off: Great little tool. Works wonderfully.

We're part of a consortium and have an Institution Zone and Network Zone across a bunch of other institutions.

When we search in the IZ, HT links show as expected.

When we search in the NZ, HT links show on anything they find a match with, whether or not we own it or have access to it.

Is it feasible/possible to hide those (non-)connections?

Add Primo Studio Support?

The Primo Studio version of this plugin is based on a very outdated fork of this repo. It does not work with Primo VE at all, and as far as I can tell, it has been abandoned. Oddly, the plugin metadata points to this repository and not the forked repo.

It should be possible to modify this plugin to work both with and without Primo Studio by checking the $injector service for an instance of primoExploreHathiTrustAvailabilityStudioConfig and then overriding the component bindings as needed.

This has been lingering as a low-priority item on my to-do list for a while because I don't use Primo Studio and haven't had a compelling reason to start. If you'd like to see the Primo Studio support for this plugin, please let me know by adding a +1 or comment to this issue. Or better yet, if you're a Primo Studio plugin wiz, feel free to submit a pull request ๐Ÿ™‚ .

Non-OCLC numbers generating HathiTrust links

We had an issue where the updateHathiTrustAvailability function generated a link from a non-OCLC 035 field.

We solved the issue by fixing the record (it contained data that none of us recognized), but you might want to filter the updateHathiTrustAvailability function to only search on pnx.addata.oclcid with a (ocolc) prefix.

Adjusting your add-on to be compatible with Angular 1.8

We plan to upgrade from Angular 1.6.10 to Angular 1.8 in the Primo/Primo VE November 2022 release.
This upgrade may impact your Angular customizations in Primo and Primo VE, specifically your Primo-Studio add-on.
Please make sure to adjust the customizations accordingly prior to the upgrade to ensure a smooth migration to Angular 1.8.
With the November release we will introduce in Primo Studio only add-ons that are adjustable to the Angular 1.8.

You can read more on this planned upgrade on
https://knowledge.exlibrisgroup.com/Primo/Product_Materials/Announcements/Preparing_for_the_Upgrade_to_Angular_1.8_in_Primo%2F%2FPrimo_VE
Adjust your customization code using the Transformer Tool
Check this YouTube for guidelines
Recent webinars: EMEA/APAC and Americas/EMEA

Please make sure to upload your adjustable add-on prior to November release
Primo Product Team

Followed instructions, but this didn't work

Local dev environment works, but when I install the hathi package in the recommended location and try to view it, it overwrites my view's custom.js. I tried installing in the dev environment root and calling from there, but that doesn't work either. Installing through Primo Studio does the same thing. What files does the package need to work and where should they be located relative to existing view code?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.