Skip to content

Commit

Permalink
MIR-1409 Added separate stylesheets for badges and xslInclude:solrRes…
Browse files Browse the repository at this point in the history
…ponseBadges to response-mir.xsl
  • Loading branch information
Possommi committed Nov 25, 2024
1 parent 03ca091 commit 551413c
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 69 deletions.
1 change: 1 addition & 0 deletions mir-module/src/main/resources/config/mir/mycore.properties
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ MCR.URIResolver.xslIncludes.mods=%MCR.URIResolver.xslIncludes.mods%,mods2mods-cl
MCR.URIResolver.xslIncludes.mycoreobjectXML=%MCR.URIResolver.xslIncludes.mycoreobjectXML%,embargofilter.xsl
MCR.URIResolver.xslIncludes.RDF-mods-journal=%MCR.URIResolver.xslIncludes.RDF-mods-journal%,RDF-mods-journal-mir.xsl
MCR.URIResolver.xslIncludes.solrResponse=%MCR.URIResolver.xslIncludes.solrResponse%,response-mir.xsl
MCR.URIResolver.xslIncludes.solrResponseBadges=response-mir-hit-oa.xsl,response-mir-hit-type.xsl,response-mir-hit-licence.xsl,response-mir-hit-date.xsl,response-mir-hit-state.xsl
MCR.URIResolver.xslIncludes.xeditorTemplates=%MCR.URIResolver.xslIncludes.xeditorTemplates%,xeditor-mir-templates.xsl
MIR.AVPlayer.Stylesheet=metadata/mir-video.js.xsl
MCR.URIResolver.xslImports.modsmeta=metadata/mods-metadata-base.xsl,metadata/mir-browse.xsl,metadata/mir-breadcrumbs.xsl,metadata/mir-metadata-box.xsl,metadata/mir-admindata-box.xsl,metadata/mir-abstract.xsl,metadata/mir-collapse-files.xsl,metadata/mir-file-upload.xsl,metadata/mir-edit.xsl,metadata/mir-share.xsl,%MIR.AVPlayer.Stylesheet%,metadata/mir-viewer.xsl,metadata/mir-citation.xsl,metadata/mir-thumbnail.xsl,metadata/mir-export.xsl,metadata/mir-history.xsl,metadata/mir-epusta.xsl,metadata/mir-workflow.xsl
Expand Down
25 changes: 25 additions & 0 deletions mir-module/src/main/resources/xsl/response-mir-hit-date.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsl">

<xsl:template name="hit-date">
<xsl:if test="str[@name='mods.dateIssued'] or str[@name='mods.dateIssued.host']">
<div class="hit_date">
<xsl:variable name="date">
<xsl:choose>
<xsl:when test="str[@name='mods.dateIssued']">
<xsl:value-of select="str[@name='mods.dateIssued']"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="str[@name='mods.dateIssued.host']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<span class="badge badge-primary">
<xsl:value-of select="$date"/>
</span>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
31 changes: 31 additions & 0 deletions mir-module/src/main/resources/xsl/response-mir-hit-licence.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i18n="xalan://org.mycore.services.i18n.MCRTranslation"
xmlns:mcrxsl="xalan://org.mycore.common.xml.MCRXMLFunctions"
exclude-result-prefixes="i18n mcrxsl xsl">

<xsl:template name="hit-licence">
<xsl:if test="arr[@name='category.top']/str[contains(text(), 'mir_licenses:')]">
<div class="hit_license">
<span class="badge badge-primary">
<xsl:variable name="accessCondition">
<xsl:value-of
select="substring-after(arr[@name='category.top']/str[contains(text(), 'mir_licenses:')][last()],':')"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($accessCondition, 'rights_reserved')">
<xsl:value-of select="i18n:translate('component.mods.metaData.dictionary.rightsReserved')"/>
</xsl:when>
<xsl:when test="contains($accessCondition, 'oa_nlz')">
<xsl:value-of select="i18n:translate('component.mods.metaData.dictionary.oa_nlz.short')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="mcrxsl:getDisplayName('mir_licenses',$accessCondition)"/>
</xsl:otherwise>
</xsl:choose>
</span>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
24 changes: 24 additions & 0 deletions mir-module/src/main/resources/xsl/response-mir-hit-state.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i18n="xalan://org.mycore.services.i18n.MCRTranslation"
xmlns:mcrxsl="xalan://org.mycore.common.xml.MCRXMLFunctions"
exclude-result-prefixes="i18n mcrxsl xsl">

<xsl:template name="hit-state">
<xsl:if test="not (mcrxsl:isCurrentUserGuestUser())">
<div class="hit_state">
<xsl:variable name="status-i18n">
<!-- template in mir-utils.xsl -->
<xsl:call-template name="get-doc-state-label">
<xsl:with-param name="state-categ-id" select="str[@name='state']"/>
</xsl:call-template>
</xsl:variable>
<span class="badge mir-{str[@name='state']}"
title="{i18n:translate('component.mods.metaData.dictionary.status')}">
<xsl:value-of select="$status-i18n"/>
</span>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
28 changes: 28 additions & 0 deletions mir-module/src/main/resources/xsl/response-mir-hit-type.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:mcrxsl="xalan://org.mycore.common.xml.MCRXMLFunctions"
exclude-result-prefixes="mcrxsl xsl">

<xsl:template name="hit-type">
<xsl:choose>
<xsl:when test="arr[@name='mods.genre']">
<xsl:for-each select="arr[@name='mods.genre']/str">
<div class="hit_type">
<span class="badge badge-info">
<xsl:value-of select="mcrxsl:getDisplayName('mir_genres',.)"/>
</span>
</div>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<div class="hit_type">
<span class="badge badge-info">
<xsl:value-of select="mcrxsl:getDisplayName('mir_genres','article')"/>
</span>
</div>
</xsl:otherwise>
</xsl:choose>

</xsl:template>
</xsl:stylesheet>
79 changes: 10 additions & 69 deletions mir-module/src/main/resources/xsl/response-mir.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<xsl:include href="resource:xsl/csl-export-gui.xsl" />
<xsl:include href="resource:xsl/response-facets.xsl"/>
<xsl:include href="resource:xsl/response-mir-hit-oa.xsl" />
<xsl:include href="xslInclude:solrResponseBadges"/>
<xsl:include href="resource:xsl/response-mir-utils.xsl" />

<xsl:param name="UserAgent" />
Expand Down Expand Up @@ -543,74 +543,15 @@
<div class="hit_tnd_container">
<div class="hit_tnd_content">
<xsl:call-template name="hit-oa"/>
<xsl:choose>
<xsl:when test="arr[@name='mods.genre']">
<xsl:for-each select="arr[@name='mods.genre']/str">
<div class="hit_type">
<span class="badge badge-info">
<xsl:value-of select="mcrxsl:getDisplayName('mir_genres',.)" ></xsl:value-of>
</span>
</div>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<div class="hit_type">
<span class="badge badge-info">
<xsl:value-of select="mcrxsl:getDisplayName('mir_genres','article')" />
</span>
</div>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="arr[@name='category.top']/str[contains(text(), 'mir_licenses:')]">
<div class="hit_license">
<span class="badge badge-primary">
<xsl:variable name="accessCondition">
<xsl:value-of select="substring-after(arr[@name='category.top']/str[contains(text(), 'mir_licenses:')][last()],':')" />
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($accessCondition, 'rights_reserved')">
<xsl:value-of select="i18n:translate('component.mods.metaData.dictionary.rightsReserved')" />
</xsl:when>
<xsl:when test="contains($accessCondition, 'oa_nlz')">
<xsl:value-of select="i18n:translate('component.mods.metaData.dictionary.oa_nlz.short')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="mcrxsl:getDisplayName('mir_licenses',$accessCondition)" />
</xsl:otherwise>
</xsl:choose>
</span>
</div>
</xsl:if>
<xsl:if test="str[@name='mods.dateIssued'] or str[@name='mods.dateIssued.host']">
<div class="hit_date">
<xsl:variable name="date">
<xsl:choose>
<xsl:when test="str[@name='mods.dateIssued']">
<xsl:value-of select="str[@name='mods.dateIssued']" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="str[@name='mods.dateIssued.host']" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<span class="badge badge-primary">
<xsl:value-of select="$date" />
</span>
</div>
</xsl:if>
<xsl:if test="not (mcrxsl:isCurrentUserGuestUser())">
<div class="hit_state">
<xsl:variable name="status-i18n">
<!-- template in mir-utils.xsl -->
<xsl:call-template name="get-doc-state-label">
<xsl:with-param name="state-categ-id" select="str[@name='state']"/>
</xsl:call-template>
</xsl:variable>
<span class="badge mir-{str[@name='state']}" title="{i18n:translate('component.mods.metaData.dictionary.status')}">
<xsl:value-of select="$status-i18n" />
</span>
</div>
</xsl:if>

<xsl:call-template name="hit-type"/>

<xsl:call-template name="hit-licence"/>

<xsl:call-template name="hit-date"/>

<xsl:call-template name="hit-state"/>

<xsl:if test="string-length($MCR.ORCID.OAuth.ClientSecret) &gt; 0">
<div class="orcid-status" data-id="{$identifier}" />
</xsl:if>
Expand Down

0 comments on commit 551413c

Please sign in to comment.