Bugzilla – Attachment 181974 Details for
Bug 38425
Add links to full texts based on identifiers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38425: Add external links based on PIDs in 024
Bug-38425-Add-external-links-based-on-PIDs-in-024.patch (text/plain), 11.90 KB, created by
Alexander Wagner
on 2025-05-06 13:55:19 UTC
(
hide
)
Description:
Bug 38425: Add external links based on PIDs in 024
Filename:
MIME Type:
Creator:
Alexander Wagner
Created:
2025-05-06 13:55:19 UTC
Size:
11.90 KB
patch
obsolete
>From 11de582168509b5bcae9c908af8a42b73fff653f Mon Sep 17 00:00:00 2001 >From: Alexander Wagner <alexander.wagner@desy.de> >Date: Tue, 12 Nov 2024 17:24:55 +0100 >Subject: [PATCH] Bug 38425: Add external links based on PIDs in 024 > >Render some (common) identifiers field 024 as links to external >resources by evaluating `$2` and using the appropriate resolver URL. >Currently implemented values for `$2`: arXiv, doi, inspire, openlibrary, >pmc, pmid. The patch includes adds the class `resource_list` to the >intranet scss to be able to use the identical XSLT code as for the OPAC. > >Test plan: > >1. Open intranet interface and edit any record >2. Add several 024 fields with the following subfield layout: > - $2 doi $a 10.2147/CIA.S157877 > - $2 pmid $a 29942120 > - $2 pmc $a PMC6005330 > - $2 arxiv: $a arxiv:2411.05889 > - $2 inspire $a 2835154 > - $2 openlibrary $a OL27448W > (May be all or any combination. The values of $a would not matter, > the above just gives valid links to the external system in question.) >3. Check intranet detail display of the record: nothing appears >4. Check OPAC detail display of the record: nothing appears >5. Apply the patch >3. Check intranet detail display of the record. It now gives a new line: > External Resource(s): <here links to whatever was added in step 2) > The ids are clickable and lead to the external system >4. Check OPAC detail display of the record: > External Resource(s): <here links to whatever was added in step 2) > The ids are clickable and lead to the external system > >Sponsored-by: Deutsches Elektronen-Synchrotron DESY, Library >--- > .../prog/css/src/staff-global.scss | 21 +++++ > .../en/xslt/MARC21slim2intranetDetail.xsl | 81 +++++++++++++++++++ > .../en/xslt/MARC21slim2OPACDetail.xsl | 81 +++++++++++++++++++ > 3 files changed, 183 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >index 40deeaf44d..9379f6e9cc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >@@ -2506,6 +2506,27 @@ td.bundle { > } > } > >+.resource_list { >+ display: inline; >+ margin: 0 auto; >+ padding-left: 0; >+ >+ li { >+ display: inline-block; >+ >+ &::after { >+ content: "|"; >+ padding: 0 .2em; >+ } >+ >+ &:last-child { >+ &::after { >+ content: ""; >+ } >+ } >+ } >+} >+ > .child_fund_amount { > font-style: italic; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >index cc231f4160..3864e4ec16 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >@@ -920,6 +920,87 @@ > </span> > </xsl:if> > >+ <!-- Add links based on persistent identifiers Bug 38425 --> >+ <xsl:if test="marc:datafield[@tag=024]"> >+ <span class="results_summary pid_links"> >+ <span class="label">External resource(s): </span> >+ <ul class="resource_list"> >+ <xsl:for-each select="marc:datafield[@tag=024]/marc:subfield[@code='2']"> >+ <xsl:choose> >+ <xsl:when test=". = 'doi'"> >+ <li> >+ <span class="label">doi:</span> >+ <xsl:for-each select="../marc:subfield[@code='a']"> >+ <a> >+ <xsl:attribute name="href">https://doi.org/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >+ <xsl:value-of select="current()" /> >+ </a> >+ </xsl:for-each> >+ </li> >+ </xsl:when> >+ <xsl:when test=". = 'pmid'"> >+ <li> >+ <span class="label">PMID: </span> >+ <xsl:for-each select="../marc:subfield[@code='a']"> >+ <a> >+ <xsl:attribute name="href">https://pubmed.ncbi.nlm.nih.gov/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >+ <xsl:value-of select="current()" /> >+ </a> >+ </xsl:for-each> >+ </li> >+ </xsl:when> >+ <xsl:when test=". = 'pmc'"> >+ <li> >+ <span class="label">PMCID: </span> >+ <xsl:for-each select="../marc:subfield[@code='a']"> >+ <a> >+ <xsl:attribute name="href">https://pmc.ncbi.nlm.nih.gov/articles/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >+ <xsl:value-of select="current()" /> >+ </a> >+ </xsl:for-each> >+ </li> >+ </xsl:when> >+ <xsl:when test=". = 'arxiv'"> >+ <li> >+ <!-- arXiv-ids are `arxiv:1234.5678` is redundant >+ <span class="label">arXiv:</span> >+ --> >+ <xsl:for-each select="../marc:subfield[@code='a']"> >+ <a> >+ <xsl:attribute name="href">https://arxiv.org/abs/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >+ <xsl:value-of select="current()" /> >+ </a> >+ </xsl:for-each> >+ </li> >+ </xsl:when> >+ <xsl:when test=". = 'inspire'"> >+ <li> >+ <span class="label">inspire: </span> >+ <xsl:for-each select="../marc:subfield[@code='a']"> >+ <a> >+ <xsl:attribute name="href">https://inspirehep.net/literature/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >+ <xsl:value-of select="current()" /> >+ </a> >+ </xsl:for-each> >+ </li> >+ </xsl:when> >+ <xsl:when test=". = 'openlibrary'"> >+ <li> >+ <span class="label">OpenLibrary: </span> >+ <xsl:for-each select="../marc:subfield[@code='a']"> >+ <a> >+ <xsl:attribute name="href">https://openlibrary.org/works/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >+ <xsl:value-of select="current()" /> >+ </a> >+ </xsl:for-each> >+ </li> >+ </xsl:when> >+ </xsl:choose> >+ </xsl:for-each> >+ </ul> >+ </span> >+ </xsl:if> >+ > <xsl:if test="marc:datafield[@tag=856]"> > <xsl:if test="marc:datafield[@tag=856]/marc:subfield[@code='u']"> > <span class="results_summary online_resources"><span class="label">Online resources: </span> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >index de21d62386..1d30065164 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >@@ -1036,6 +1036,87 @@ > </xsl:if> > > >+ <!-- Add links based on persistent identifiers Bug 38425 --> >+ <xsl:if test="marc:datafield[@tag=024]"> >+ <span class="results_summary pid_links"> >+ <span class="label">External resource(s): </span> >+ <ul class="resource_list"> >+ <xsl:for-each select="marc:datafield[@tag=024]/marc:subfield[@code='2']"> >+ <xsl:choose> >+ <xsl:when test=". = 'doi'"> >+ <li> >+ <span class="label">doi:</span> >+ <xsl:for-each select="../marc:subfield[@code='a']"> >+ <a> >+ <xsl:attribute name="href">https://doi.org/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >+ <xsl:value-of select="current()" /> >+ </a> >+ </xsl:for-each> >+ </li> >+ </xsl:when> >+ <xsl:when test=". = 'pmid'"> >+ <li> >+ <span class="label">PMID: </span> >+ <xsl:for-each select="../marc:subfield[@code='a']"> >+ <a> >+ <xsl:attribute name="href">https://pubmed.ncbi.nlm.nih.gov/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >+ <xsl:value-of select="current()" /> >+ </a> >+ </xsl:for-each> >+ </li> >+ </xsl:when> >+ <xsl:when test=". = 'pmc'"> >+ <li> >+ <span class="label">PMCID: </span> >+ <xsl:for-each select="../marc:subfield[@code='a']"> >+ <a> >+ <xsl:attribute name="href">https://pmc.ncbi.nlm.nih.gov/articles/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >+ <xsl:value-of select="current()" /> >+ </a> >+ </xsl:for-each> >+ </li> >+ </xsl:when> >+ <xsl:when test=". = 'arxiv'"> >+ <li> >+ <!-- arXiv-ids are `arxiv:1234.5678` is redundant >+ <span class="label">arXiv:</span> >+ --> >+ <xsl:for-each select="../marc:subfield[@code='a']"> >+ <a> >+ <xsl:attribute name="href">https://arxiv.org/abs/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >+ <xsl:value-of select="current()" /> >+ </a> >+ </xsl:for-each> >+ </li> >+ </xsl:when> >+ <xsl:when test=". = 'inspire'"> >+ <li> >+ <span class="label">inspire: </span> >+ <xsl:for-each select="../marc:subfield[@code='a']"> >+ <a> >+ <xsl:attribute name="href">https://inspirehep.net/literature/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >+ <xsl:value-of select="current()" /> >+ </a> >+ </xsl:for-each> >+ </li> >+ </xsl:when> >+ <xsl:when test=". = 'openlibrary'"> >+ <li> >+ <span class="label">OpenLibrary: </span> >+ <xsl:for-each select="../marc:subfield[@code='a']"> >+ <a> >+ <xsl:attribute name="href">https://openlibrary.org/works/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >+ <xsl:value-of select="current()" /> >+ </a> >+ </xsl:for-each> >+ </li> >+ </xsl:when> >+ </xsl:choose> >+ </xsl:for-each> >+ </ul> >+ </span> >+ </xsl:if> >+ > <!-- Image processing code added here, takes precedence over text links including y3z text --> > <xsl:if test="marc:datafield[@tag=856]"> > <xsl:if test="marc:datafield[@tag=856]/marc:subfield[@code='u']"> >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38425
:
174425
|
181900
| 181974 |
181975