Skip to content

Commit 7934da5

Browse files
committed
MIR-1343 Added template print-user-info to mir-admindata-box.xsl
1 parent 482d817 commit 7934da5

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

mir-module/src/main/resources/xsl/metadata/mir-admindata-box.xsl

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
xmlns:mcrxsl="xalan://org.mycore.common.xml.MCRXMLFunctions"
66
exclude-result-prefixes="i18n mods xlink mcrxsl">
77
<xsl:import href="xslImport:modsmeta:metadata/mir-admindata-box.xsl"/>
8+
<xsl:param name="WebApplicationBaseURL"/>
89

910
<xsl:template match="/">
1011
<xsl:variable name="ID" select="/mycoreobject/@ID"/>
@@ -30,9 +31,10 @@
3031
<xsl:with-param select="mycoreobject/service/servdates/servdate[@type='createdate']" name="nodes"/>
3132
<xsl:with-param select="i18n:translate('metaData.createdAt')" name="label"/>
3233
</xsl:call-template>
33-
<xsl:call-template name="printMetaDate">
34-
<xsl:with-param select="mycoreobject/service/servflags/servflag[@type='createdby']" name="nodes"/>
35-
<xsl:with-param select="i18n:translate('mir.metaData.detailBox.by')" name="label"/>
34+
35+
<xsl:call-template name="print-user-info">
36+
<xsl:with-param name="user" select="document(concat('notnull:user:', mycoreobject/service/servflags/servflag[@type='createdby']))"/>
37+
<xsl:with-param name="label" select="i18n:translate('mir.metaData.detailBox.by')"/>
3638
</xsl:call-template>
3739
<xsl:for-each select="mycoreobject/metadata/def.modsContainer/modsContainer/mods:mods/mods:note">
3840
<xsl:variable name="noteType">
@@ -65,9 +67,9 @@
6567
<xsl:with-param select="mycoreobject/service/servdates/servdate[@type='modifydate']" name="nodes"/>
6668
<xsl:with-param select="i18n:translate('metaData.lastChanged')" name="label"/>
6769
</xsl:call-template>
68-
<xsl:call-template name="printMetaDate">
69-
<xsl:with-param select="mycoreobject/service/servflags/servflag[@type='modifiedby']" name="nodes"/>
70-
<xsl:with-param select="i18n:translate('mir.metaData.detailBox.by')" name="label"/>
70+
<xsl:call-template name="print-user-info">
71+
<xsl:with-param name="user" select="document(concat('notnull:user:', mycoreobject/service/servflags/servflag[@type='modifiedby']))"/>
72+
<xsl:with-param name="label" select="i18n:translate('mir.metaData.detailBox.by')"/>
7173
</xsl:call-template>
7274
<!--*** MyCoRe-ID and intern ID *************************** -->
7375
<tr>
@@ -126,4 +128,44 @@
126128
<xsl:apply-imports/>
127129
</xsl:template>
128130

131+
<xsl:template name="print-user-info">
132+
<xsl:param name="user"/>
133+
<xsl:param name="label"/>
134+
135+
<xsl:variable name="display-name">
136+
<xsl:choose>
137+
<xsl:when test="$user/user/realName">
138+
<xsl:value-of select="$user/user/realName"/>
139+
</xsl:when>
140+
<xsl:otherwise>
141+
<xsl:value-of select="$user/user/@name"/>
142+
</xsl:otherwise>
143+
</xsl:choose>
144+
</xsl:variable>
145+
146+
<tr>
147+
<td class="metaname">
148+
<xsl:value-of select="concat($label, ':')"/>
149+
</td>
150+
151+
<td class="metavalue">
152+
<xsl:if test="$user/user/realName">
153+
<xsl:attribute name="title">
154+
<xsl:value-of select="concat($user/user/@name, '@', $user/user/@realm)"/>
155+
</xsl:attribute>
156+
</xsl:if>
157+
158+
<xsl:choose>
159+
<xsl:when test="mcrxsl:isCurrentUserInRole('admin')">
160+
<a href="{$WebApplicationBaseURL}servlets/MCRUserServlet?action=show&amp;id={$user/user/@name}">
161+
<xsl:value-of select="$display-name"/>
162+
</a>
163+
</xsl:when>
164+
<xsl:otherwise>
165+
<xsl:value-of select="$display-name"/>
166+
</xsl:otherwise>
167+
</xsl:choose>
168+
</td>
169+
</tr>
170+
</xsl:template>
129171
</xsl:stylesheet>

mir-module/src/main/resources/xsl/metadata/static/mir-admindata-box-static.xsl

Whitespace-only changes.

0 commit comments

Comments
 (0)