The Foundry tag for FileStorageItem download link now looks for nav:attributes providing the file id etc to allow direct download from the list view of an item. To use this the attributes have been added to the list view XML by lines like the following:

((com.arsdigita.navigation.ui.object.SimpleObjectList) itemList).getRenderer().addAttribute( "file.name");
((com.arsdigita.navigation.ui.object.SimpleObjectList) itemList).getRenderer().addAttribute( "file.id");
((com.arsdigita.navigation.ui.object.SimpleObjectList) itemList).getRenderer().addAttribute( "file.length");

Adjust the name of the object list as needed.



git-svn-id: https://svn.libreccm.org/ccm/trunk@4397 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2016-10-21 15:49:03 +00:00
parent baf6350ece
commit 31945a9dab
1 changed files with 26 additions and 4 deletions

View File

@ -97,6 +97,28 @@
then 'stream' then 'stream'
else 'download'"/> else 'download'"/>
<xsl:variable name="file-id">
<xsl:choose>
<xsl:when test="$contentitem-tree/file/id">
<xsl:value-of select="$contentitem-tree/file/id" />
</xsl:when>
<xsl:when test="$contentitem-tree/nav:attribute[@name='file.id']">
<xsl:value-of select="$contentitem-tree/nav:attribute[@name='file.id']" />
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="file-name">
<xsl:choose>
<xsl:when test="$contentitem-tree/file/name">
<xsl:value-of select="$contentitem-tree/file/name" />
</xsl:when>
<xsl:when test="$contentitem-tree/nav:attribute[@name='file.name']">
<xsl:value-of select="$contentitem-tree/nav:attribute[@name='file.name']" />
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:apply-templates> <xsl:apply-templates>
<xsl:with-param name="href" tunnel="yes"> <xsl:with-param name="href" tunnel="yes">
<xsl:choose> <xsl:choose>
@ -105,20 +127,20 @@
'/cms-service/', '/cms-service/',
$mode, $mode,
'/asset/', '/asset/',
$contentitem-tree/file/name, $file-name,
'?asset_id=', '?asset_id=',
$contentitem-tree/file/id)"/> $file-id)"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="concat($dispatcher-prefix, <xsl:value-of select="concat($dispatcher-prefix,
'/cms-service/', '/cms-service/',
$mode, $mode,
'/asset/?asset_id=', '/asset/?asset_id=',
$contentitem-tree/file/id)"/> $file-id)"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:with-param> </xsl:with-param>
</xsl:apply-templates> </xsl:apply-templates>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>