Closed jechols closed 1 year 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.)
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:
reportProblemOptions
structure is unnecessary and could be just in-lined for readability and ease of use since we aren't giving people like UI designers access to the HTML/Angular templating.$httpParamSerializer
but don't use it. Probably just drop this parameter for easier readability / maintenance.$location
must be the full URL, based on what the code is doing. We could sanitize, truncate, or just leave it as is.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.
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: @.**@.>>
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:
/discovery/fulldisplay
vs/discovery/openurl
). Beyond that there could be other problems.docid
is just plain wrong. I have no idea where this comes from.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.