Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIR 1410 show metadata when document is blocked #1087

Open
wants to merge 3 commits into
base: 2023.06.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -766,6 +766,7 @@ MIR.Layout.Abstract.Type.Classification=

MIR.NotFullAccessInfo.Genres=
MIR.Viewer.DisableDerivateType=thumbnail
MIR.Blocked.Detailpage=false
##############################################################################
# Canonical link for any metadata frontpage #
##############################################################################
Expand Down
29 changes: 5 additions & 24 deletions mir-module/src/main/resources/xsl/e-mail-events.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<xsl:variable name="newline" select="'&#xA;'" />
<xsl:variable name="categories" select="document('classification:metadata:1:children:mir_institutes')/mycoreclass/categories" />
<xsl:variable name="institutemember" select="$categories/category[mcrxsl:isCurrentUserInRole(concat('mir_institutes:',@ID))]" />

<xsl:include href="import/helperTemplates.xsl" />
<xsl:template match="/">
<xsl:message>
type:
Expand Down Expand Up @@ -121,7 +121,9 @@
<xsl:if test="position()!=1">
<xsl:value-of select="', '" />
</xsl:if>
<xsl:apply-templates select="." mode="printName" />
<xsl:call-template name="printAuthorName">
<xsl:with-param name="node" select="mods:name" />
</xsl:call-template>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="concat('Autor(en) : ',$authors,$newline)" />
Expand Down Expand Up @@ -231,26 +233,5 @@
<xsl:value-of select="concat(' (',@valueURI,')')" />
</xsl:template>

<!-- Names -->
<xsl:template match="mods:name" mode="printName">
<xsl:choose>
<xsl:when test="mods:namePart">
<xsl:choose>
<xsl:when test="mods:namePart[@type='given'] and mods:namePart[@type='family']">
<xsl:value-of select="concat(mods:namePart[@type='family'], ', ',mods:namePart[@type='given'])" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="mods:namePart" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="mods:displayForm">
<xsl:value-of select="mods:displayForm" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>
</xsl:stylesheet>
28 changes: 28 additions & 0 deletions mir-module/src/main/resources/xsl/import/helperTemplates.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:mods="http://www.loc.gov/mods/v3"
exclude-result-prefixes="mods">
<!-- Names -->
<xsl:template name="printAuthorName">
<xsl:param name="node" />
<xsl:choose>
<xsl:when test="$node/mods:namePart">
<xsl:choose>
<xsl:when test="$node/mods:namePart[@type='given'] and $node/mods:namePart[@type='family']">
<xsl:value-of select="concat($node/mods:namePart[@type='family'], ', ', $node/mods:namePart[@type='given'])" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$node/mods:namePart" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$node/mods:displayForm">
<xsl:value-of select="$node/mods:displayForm" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$node" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>
116 changes: 100 additions & 16 deletions mir-module/src/main/resources/xsl/metadata/mods-metadata.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@
xmlns:encoder="xalan://java.net.URLEncoder"
xmlns:i18n="xalan://org.mycore.services.i18n.MCRTranslation"
exclude-result-prefixes=" i18n mods mcrmods mcrxsl xlink encoder">

<xsl:import href="xslImport:modsmeta" />
<xsl:include href="layout/mir-layout-utils.xsl" />
<xsl:include href="import/helperTemplates.xsl" />
<xsl:include href="mods-utils.xsl" />
<xsl:include href="mir-mods-utils.xsl" />
<xsl:key use="@id" name="rights" match="/mycoreobject/rights/right" />
<xsl:param name="MCR.DOI.Resolver.MasterURL" select="''"/>
<xsl:param name="MCR.URN.Resolver.MasterURL" select="''"/>
<xsl:param name="MIR.Blocked.Detailpage" select="'false'"/>
<xsl:variable name="mods-type">
<xsl:apply-templates mode="mods-type" select="." />
</xsl:variable>
Expand Down Expand Up @@ -74,22 +79,33 @@
</site>
</xsl:template>

<xsl:template name="printMirMessage">
<xsl:param name="title" />
<xsl:param name="msg" />
<div id="mir-message">
<div class="jumbotron">
<h1>
<xsl:value-of select="$title" />
</h1>
<xsl:if test="$msg">
<p>
<xsl:copy-of select="$msg" />
</p>
</xsl:if>
</div>
</div>
</xsl:template>
<xsl:template name="printMirMessage">
<xsl:param name="title" />
<xsl:param name="msg" />
<div id="mir-message">
<div class="jumbotron">
<h1>
<xsl:value-of select="$title" />
</h1>
<xsl:if test="$msg">
<p>
<xsl:copy-of select="$msg" />
</p>
</xsl:if>
<xsl:if test="$MIR.Blocked.Detailpage = 'true'">
<xsl:call-template name="renderMetadata">
<xsl:with-param name="mods"
select="mycoreobject/metadata/def.modsContainer/modsContainer/mods:mods"/>
<xsl:with-param name="doiResolver" select="$MCR.DOI.Resolver.MasterURL" />
<xsl:with-param name="urnResolver" select="$MCR.URN.Resolver.MasterURL" />
</xsl:call-template>
<xsl:call-template name="printAuthorName">
<xsl:with-param name="node" select="mods:name" />
</xsl:call-template>
</xsl:if>
</div>
</div>
</xsl:template>

<xsl:template name="debug-rights">
<xsl:variable name="lbr" select="'&#x0a;'" />
Expand Down Expand Up @@ -182,4 +198,72 @@
</a>
</xsl:template>

<xsl:template name="renderMetadata">
<xsl:param name="mods" select="mycoreobject/metadata/def.modsContainer/modsContainer/mods:mods"/>
<xsl:param name="doiResolver" select="$MCR.DOI.Resolver.MasterURL"/>
<xsl:param name="urnResolver" select="$MCR.URN.Resolver.MasterURL"/>

<div class="mb-3">
<h2 class="text-primary">
<xsl:value-of select="$mods/mods:titleInfo/mods:title"/>
</h2>
<xsl:choose>
<xsl:when test="$mods/mods:name[mods:role/mods:roleTerm/text()='aut']">
<xsl:for-each select="$mods/mods:name[mods:role/mods:roleTerm/text()='aut']">
<xsl:if test="position()!=1">
<xsl:value-of select="'; '"/>
</xsl:if>
<xsl:apply-templates select="." mode="mirNameLink"/>
<xsl:if test="mods:etal">
<em>et.al.</em>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:when test="$mods/mods:name[mods:role/mods:roleTerm/text()='edt']">
<xsl:for-each select="$mods/mods:name[mods:role/mods:roleTerm/text()='edt']">
<xsl:if test="position()!=1">
<xsl:value-of select="'; '"/>
</xsl:if>
<xsl:apply-templates select="." mode="mirNameLink"/>
<xsl:text> </xsl:text>
<xsl:value-of select="i18n:translate('mir.abstract.editor')"/>
<xsl:if test="mods:etal">
<em>et.al.</em>
</xsl:if>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</div>

<dl class="mb-3 mir_metadata">
<xsl:if test="$mods/mods:originInfo/mods:dateIssued">
<dt style="width:auto">
<xsl:value-of select="concat(i18n:translate('component.mods.metaData.dictionary.dateIssued'),':')"/>
</dt>
<dd>
<xsl:value-of select="$mods/mods:originInfo/mods:dateIssued"/>
</dd>
</xsl:if>
<xsl:if test="$mods/mods:identifier[@type='doi']">
<dt style="width:auto">
<xsl:value-of select="i18n:translate('mir.identifier.doi')"/>
</dt>
<dd>
<a href="{concat($doiResolver, '/', $mods/mods:identifier[@type='doi'])}">
<xsl:value-of select="$mods/mods:identifier[@type='doi']"/>
</a>
</dd>
</xsl:if>
<xsl:if test="$mods/mods:identifier[@type='urn']">
<dt style="width:auto">
<xsl:value-of select="i18n:translate('mir.identifier.urn')"/>
</dt>
<dd>
<a href="{concat($urnResolver, '/', $mods/mods:identifier[@type='urn'])}">
<xsl:value-of select="$mods/mods:identifier[@type='urn']"/>
</a>
</dd>
</xsl:if>
</dl>
</xsl:template>
</xsl:stylesheet>
40 changes: 14 additions & 26 deletions mir-module/src/main/resources/xsl/mods2csv.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<xsl:stylesheet version="1.0" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xalan="http://xml.apache.org/xalan" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:i18n="xalan://org.mycore.services.i18n.MCRTranslation" exclude-result-prefixes="xalan i18n">
<xsl:param name="CurrentLang" />

<xsl:include href="import/helperTemplates.xsl" />
<xsl:output
encoding="UTF-8"
media-type="text/csv"
Expand Down Expand Up @@ -43,7 +43,9 @@
<xsl:if test="position()!=1">
<xsl:value-of select="'; '" />
</xsl:if>
<xsl:apply-templates select="." mode="printName" />
<xsl:call-template name="printAuthorName">
<xsl:with-param name="node" select="mods:name" />
</xsl:call-template>
</xsl:for-each>
<xsl:text>&quot;;</xsl:text>

Expand All @@ -53,7 +55,9 @@
<xsl:if test="position()!=1">
<xsl:value-of select="'; '" />
</xsl:if>
<xsl:apply-templates select="." mode="printName" />
<xsl:call-template name="printAuthorName">
<xsl:with-param name="node" select="mods:name" />
</xsl:call-template>
</xsl:for-each>
<xsl:text>&quot;;</xsl:text>

Expand All @@ -63,7 +67,9 @@
<xsl:if test="position()!=1">
<xsl:value-of select="'; '" />
</xsl:if>
<xsl:apply-templates select="." mode="printName" />
<xsl:call-template name="printAuthorName">
<xsl:with-param name="node" select="mods:name" />
</xsl:call-template>
</xsl:for-each>
<xsl:text>&quot;;</xsl:text>

Expand All @@ -78,7 +84,9 @@
<xsl:if test="position()!=1">
<xsl:value-of select="'; '" />
</xsl:if>
<xsl:apply-templates select="." mode="printName" />
<xsl:call-template name="printAuthorName">
<xsl:with-param name="node" select="mods:name" />
</xsl:call-template>
</xsl:for-each>
<xsl:text>&quot;;</xsl:text>

Expand Down Expand Up @@ -231,27 +239,7 @@
</xsl:choose>
</xsl:template>

<!-- copied from modsmetadata.xsl -->
<xsl:template match="mods:name" mode="printName">
<xsl:choose>
<xsl:when test="mods:namePart">
<xsl:choose>
<xsl:when test="mods:namePart[@type='given'] and mods:namePart[@type='family']">
<xsl:value-of select="concat(mods:namePart[@type='family'], ', ',mods:namePart[@type='given'])" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="mods:namePart" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="mods:displayForm">
<xsl:value-of select="mods:displayForm" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:template>


<xsl:template match="mods:extent" mode="printExtent">
<xsl:choose>
Expand Down
Loading