uoregon-libraries / uolib-primo-nui

University of Oregon Libraries implementation of the Primo New UI
0 stars 0 forks source link

Figure out better "Report a problem" link customization #68

Closed jechols closed 1 year ago

jechols commented 2 years ago

Right now we're preserving just a small portion of the URL (see JS customization custom/01ALLIANCE_UO-UO/js/20-report-problem-link.js). This seems to be a pretty typical pattern: see the "Augmenting the Link with Additional Information" section of the "add custom action" PCSG Primo VE guide, about halfway down the page.

Examples of URLs that our current setup doesn't handle:

There's an outdated (and not maintained) repo by PCSG (https://github.com/alliance-pcsg/primo-explore-report-problem) that may help us, but it'll take a bit to unravel and adapt it for our uses: it's likely not VE-ready; it's meant to be used as-is via some component installation I don't know much about; it's preserving the entire search string, which we don't want for privacy reasons; and it may be holding onto a URL that's too long in some cases for an HTTP GET request. I think it's also not handling both potential endpoints, but I am a bit confused on that score.

jechols commented 2 years ago

(Note that long-term we really want to just be able to get a permalink to our problem form, as it's going to be a lot more stable than anything we can hack together. At the moment we've not found or seen any way to do that.)

jechols commented 2 years ago

If we're good having the search in the form (which is a privacy concern IMO, but it's what a ton of libraries who have Primo are doing), there's this customization snippet from OSU:

/* Add Report Problem Banner to Full Display */
app.constant('reportProblemOptions', {
    message: "Having trouble accessing a resource?",
    button: "Report a Problem",
    base: "https://library.oregonstate.edu/submit-problem?"
});
angular.module('reportProblem', []).component('prmActionListAfter', {
    template: '\n    <div ng-if="show" class="bar filter-bar layout-align-center-center layout-row margin-top-medium" layout="row" layout-align="center center">\n        <span class="margin-right-small">{{ message }}</span>\n        <a ng-href="{{ link }}" target="_blank">\n            <button class="button-with-icon zero-margin md-button md-button-raised md-primoExplore-theme md-ink-ripple" type="button" aria-label="Report a Problem" style="color: #5c92bd;">\n                <prm-icon icon-type="svg" svg-icon-set="primo-ui" icon-definition="open-in-new"></prm-icon>\n                <span style="text-transform: none;">{{ button }}</span>\n                <div class="md-ripple-container"></div>\n            </button>\n        </a>\n    </div>\n    ',
    controller: ['$scope', '$location', '$httpParamSerializer', 'reportProblemOptions', function ($scope, $location, $httpParamSerializer, reportProblemOptions) {
        $scope.message = reportProblemOptions.message;
        $scope.button = reportProblemOptions.button;
        $scope.show = $location.path() === '/fulldisplay' || $location.path() === '/openurl';
        $scope.link = reportProblemOptions.base + $location.url();
    }]
});

Worth note:

jechols commented 2 years ago

From Tamara:

The short permalink is within the parent controller of the prm-permalink-after component, which won't help you because it loads only if the user opens the "Link to this Item" action. However, the record ID you're currently grabbing from the PNX control object as the variable docID is unique and can be used to search for the record without constructing a whole permalink.

If the record ID starts with "alma," that's an MMS ID for a record cataloged at the local or network zone level. You can pull up the same record in a search with.

If the record ID starts with something else, that's a record from the Central Discovery Index. You can just search for the whole thing to get the record

The record ID for an OpenURL page should be ignored, because those "records" are just displaying whatever the parameters feed it. In those cases a librarian would need the entire URL with all the parameters to replicate what the patron saw.

So it sounds like we can improve the "fulldisplay" endpoints just by looking at that record id better. For the openurl stuff it should be safe to send the full URL (other than cases where that URL is too long), so we should just do that.

MargaretA-UO commented 2 years ago

Super!

From: Jeremy Echols @.> Sent: Wednesday, November 23, 2022 2:59 PM To: uoregon-libraries/uolib-primo-nui @.> Cc: Subscribed @.***> Subject: Re: [uoregon-libraries/uolib-primo-nui] Figure out better "Report a problem" link customization (Issue #68)

From Tamara:

The short permalink is within the parent controller of the prm-permalink-after component, which won't help you because it loads only if the user opens the "Link to this Item" action. However, the record ID you're currently grabbing from the PNX control object as the variable docID is unique and can be used to search for the record without constructing a whole permalink.

If the record ID starts with "alma," that's an MMS ID for a record cataloged at the local or network zone level. You can pull up the same record in a search with.

If the record ID starts with something else, that's a record from the Central Discovery Index. You can just search for the whole thing to get the record

The record ID for an OpenURL page should be ignored, because those "records" are just displaying whatever the parameters feed it. In those cases a librarian would need the entire URL with all the parameters to replicate what the patron saw.

So it sounds like we can improve the "fulldisplay" endpoints just by looking at that record id better. For the openurl stuff it should be safe to send the full URL (other than cases where that URL is too long), so we should just do that.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/uoregon-libraries/uolib-primo-nui/issues/68*issuecomment-1325747267__;Iw!!C5qS4YX3!CIjWwJJt8DmLZqVaQLFbZOVJiwvl388tGHpNpR408TiVqlFXWJYoPieGbhDtz83RXIVyBeBxPJMpR-RXibLDnGJJTqVw$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ASE4BQDMTGVCZNYWGHOUUO3WJ2OTPANCNFSM6AAAAAASGWNYRI__;!!C5qS4YX3!CIjWwJJt8DmLZqVaQLFbZOVJiwvl388tGHpNpR408TiVqlFXWJYoPieGbhDtz83RXIVyBeBxPJMpR-RXibLDnNHavdwe$. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>