Foundry: It is now possible the specifiy which unit is used to show the file size of a file attachment. Supported units are:

kB, MB, KiB, MiB and byte.


git-svn-id: https://svn.libreccm.org/ccm/trunk@3123 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2015-02-06 18:28:48 +00:00
parent 0363eb49d2
commit ea9939daed
1 changed files with 20 additions and 2 deletions

View File

@ -104,9 +104,27 @@
</xsl:template> </xsl:template>
<xsl:template match="file-attachment//file-size"> <xsl:template match="file-attachment//file-size">
<xsl:param name="file-size" tunnel="yes"/> <xsl:param name="file-size" as="xs:integer" tunnel="yes"/>
<xsl:choose>
<xsl:when test="./@unit = 'MB'">
<xsl:value-of select="concat($file-size div 1000000, ' MB')"/>
</xsl:when>
<xsl:when test="./@unit = 'kB'">
<xsl:value-of select="concat($file-size div 1000, ' kB')"/>
</xsl:when>
<xsl:when test="./@unit = 'KiB'">
<xsl:value-of select="concat($file-size div 1024, ' KiB')"/>
</xsl:when>
<xsl:when test="./@unit = 'MiB'">
<xsl:value-of select="concat($file-size div 1048576, ' MiB')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat ($file-size, ' bytes')"/>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$file-size"/>
</xsl:template> </xsl:template>
<xsl:template match="file-attchment//file-description"> <xsl:template match="file-attchment//file-description">