Foundry support for file attachments.

git-svn-id: https://svn.libreccm.org/ccm/trunk@3094 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2015-01-19 14:56:18 +00:00
parent 5a863b41ef
commit d2b3f7260b
4 changed files with 131 additions and 1 deletions

View File

@ -34,4 +34,16 @@
</ul> </ul>
</related-links> </related-links>
<file-attachments>
<ul class="file-attachments">
<file-attachment>
<li class="file-attachment">
<a>
<file-name/> (<file-size/> bytes)
</a>
</li>
</file-attachment>
</ul>
</file-attachments>
</content-item-layout> </content-item-layout>

View File

@ -37,6 +37,7 @@
<xsl:import href="content-items/mpa.xsl"/> <xsl:import href="content-items/mpa.xsl"/>
<xsl:import href="content-items/news.xsl"/> <xsl:import href="content-items/news.xsl"/>
<xsl:import href="content-items/siteproxy.xsl"/> <xsl:import href="content-items/siteproxy.xsl"/>
<xsl:import href="content-items/assets/file-attachments.xsl"/>
<xsl:import href="content-items/assets/image-attachments.xsl"/> <xsl:import href="content-items/assets/image-attachments.xsl"/>
<xsl:import href="content-items/assets/notes.xsl"/> <xsl:import href="content-items/assets/notes.xsl"/>
<xsl:import href="content-items/assets/related-links.xsl"/> <xsl:import href="content-items/assets/related-links.xsl"/>

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE stylesheet [<!ENTITY nbsp '&#160;'>
<!ENTITY shy '&#173;'>]>
<!--
Copyright 2014 Jens Pelzetter for the LibreCCM Foundation
This file is part of the Foundry Theme Engine for LibreCCM
Foundry is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Foundry is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foundry If not, see <http://www.gnu.org/licenses/>.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
xmlns:cms="http://www.arsdigita.com/cms/1.0"
xmlns:foundry="http://foundry.libreccm.org"
xmlns:nav="http://ccm.redhat.com/navigation"
xmlns:ui="http://www.arsdigita.com/ui/1.0"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xsl bebop cms foundry nav ui"
version="2.0">
<xsl:template match="file-attachments">
<xsl:if test="$data-tree/cms:contentPanel/cms:item/fileAttachments
or $data-tree/nav:greetingItem/cms:item/fileAttachments">
<!--<pre>
file-attachments
</pre>-->
<xsl:apply-templates/>
</xsl:if>
</xsl:template>
<xsl:template match="file-attachments//file-attachment">
<xsl:variable name="files-layout-tree" select="current()"/>
<!--<pre>
file-attachment
</pre>-->
<xsl:variable name="contentitem-tree">
<xsl:choose>
<xsl:when test="$data-tree/nav:greetingItem">
<xsl:copy-of select="$data-tree/nav:greetingItem/cms:item/*"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$data-tree/cms:contentPanel/cms:item/*"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="$contentitem-tree/fileAttachments">
<xsl:sort select="fileOrder"/>
<!--<pre>
<xsl:value-of select="concat('current elem = ', name(current()))"/>
<xsl:value-of select="concat('file-id = ', ./id)"/>
<xsl:value-of select="concat('file-name = ', ./name)"/>
<xsl:value-of select="concat('file-size = ', ./file-size)"/>
</pre>-->
<xsl:apply-templates select="$files-layout-tree/*">
<xsl:with-param name="file-id"
tunnel="yes"
select="./id"/>
<xsl:with-param name="file-name"
tunnel="yes"
select="./name"/>
<xsl:with-param name="mime-type"
tunnel="yes"
select="./mimeType/mimeType"/>
<xsl:with-param name="file-size"
tunnel="yes"
select="./length"/>
<xsl:with-param name="description"
tunnel="yes"
select="./description"/>
<xsl:with-param name="href"
tunnel="yes"
select="concat($context-prefix,
'/ccm/cms-service/stream/asset/', ./name, '?asset_id=', ./id)"/>
<xsl:with-param name="class"
tunnel="yes"
select="concat('mime-type-', replace(./mimeType/mimeType, '/', '-'))"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:template>
<xsl:template match="file-attachment//file-name">
<xsl:param name="file-name" tunnel="yes"/>
<xsl:value-of select="$file-name"/>
</xsl:template>
<xsl:template match="file-attachment//file-size">
<xsl:param name="file-size" tunnel="yes"/>
<xsl:value-of select="$file-size"/>
</xsl:template>
<xsl:template match="file-attchment//file-description">
<xsl:param name="description" tunnel="yes"/>
<xsl:value-of select="$description"/>
</xsl:template>
</xsl:stylesheet>

View File

@ -52,7 +52,6 @@
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:variable name="from" as="xs:integer"> <xsl:variable name="from" as="xs:integer">
<xsl:choose> <xsl:choose>
<xsl:when test="./@from"> <xsl:when test="./@from">