Foundry support for ccm-cms-types-mparticle

git-svn-id: https://svn.libreccm.org/ccm/trunk@2970 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-11-14 16:03:17 +00:00
parent 627dfd8206
commit e5df8383f8
6 changed files with 258 additions and 0 deletions

View File

@ -24,6 +24,9 @@
<content-item content-type="com.arsdigita.cms.contenttypes.Event">
content-items/event-detail.xml
</content-item>
<content-item content-type="com.arsdigita.cms.contenttypes.MultiPartArticle">
content-items/mpa-detail.xml
</content-item>
<content-item content-type="com.arsdigita.cms.contenttypes.NewsItem">
content-items/news-detail.xml
</content-item>
@ -36,6 +39,9 @@
<content-item content-type="com.arsdigita.cms.contenttypes.Article">
content-items/article-list.xml
</content-item>
<content-item content-type="com.arsdigita.cms.contenttypes.MultiPartArticle">
content-items/mpa-list.xml
</content-item>
<default>content-items/list-default.xml</default>
</list>
</content-items>

View File

@ -32,6 +32,7 @@
<xsl:import href="content-items/article.xsl"/>
<xsl:import href="content-items/bookmark.xsl"/>
<xsl:import href="content-items/event.xsl"/>
<xsl:import href="content-items/mpa.xsl"/>
<xsl:import href="content-items/news.xsl"/>
<xsl:import href="content-items/assets/image-attachments.xsl"/>
<xsl:import href="content-items/assets/notes.xsl"/>

View File

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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"
exclude-result-prefixes="xsl xs bebop cms foundry nav ui"
version="2.0">
<xsl:template match="/content-item-layout//mpa-summary">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:choose>
<xsl:when test="$contentitem-tree/summary">
<xsl:value-of select="$contentitem-tree/summary"/>
</xsl:when>
<xsl:when test="$contentitem-tree/nav:attribute[@name = 'summary']">
<xsl:value-of select="$contentitem-tree/nav:attribute[@name = 'summary']"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="/content-item-layout//mpa-sections">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="/content-item-layout//mpa-sections//mpa-section">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:variable name="section-layout-tree" select="current()"/>
<xsl:variable name="current-page"
select="$contentitem-tree/cms:articleSectionPanel/@pageNumber"/>
<xsl:variable name="number-of-pages"
select="$contentitem-tree/cms:mpadata/numberOfPages"/>
<xsl:for-each select="$contentitem-tree/sections">
<xsl:sort select="./rank"/>
<xsl:variable name="current-rank" select="./rank"/>
<xsl:variable name="page-number"
select="count($contentitem-tree/sections[./pageBreak = 'true'
and ./rank &lt; $current-rank]) + 1"/>
<xsl:apply-templates select="$section-layout-tree/*">
<xsl:with-param name="mpa-section-title" tunnel="yes" select="./title"/>
<xsl:with-param name="href" tunnel="yes">
<xsl:choose>
<xsl:when test="./pageBreak = 'true'
or ($page-number &lt;= $number-of-pages)">
<xsl:choose>
<xsl:when test="$current-page = 'all'
or $page-number = $current-page">
<xsl:value-of select="concat('#section-', $current-rank)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('?page=',
$page-number,
'#section-',
$current-rank)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('#section-', $current-rank)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:for-each>
</xsl:template>
<xsl:template match="/content-item-layout//mpa-sections//mpa-section//mpa-section-title">
<xsl:param name="mpa-section-title" tunnel="yes"/>
<xsl:value-of select="$mpa-section-title"/>
</xsl:template>
<xsl:template match="/content-item-layout//mpa-current-sections">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="/content-item-layout//mpa-current-sections//mpa-current-section">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:variable name="current-section-layout-tree" select="current()"/>
<xsl:for-each select="$contentitem-tree/cms:articleSectionPanel/cms:item">
<xsl:sort select="./rank"/>
<xsl:apply-templates select="$current-section-layout-tree/*">
<xsl:with-param name="current-section-title" tunnel="yes" select="./title"/>
<xsl:with-param name="current-section-content" tunnel="yes" select="./text"/>
<xsl:with-param name="id" select="concat('section-', ./rank)"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:template>
<xsl:template match="/content-item-layout//mpa-current-sections//mpa-current-section//mpa-current-section-title">
<xsl:param name="current-section-title" tunnel="yes"/>
<xsl:value-of select="$current-section-title"/>
</xsl:template>
<xsl:template match="/content-item-layout//mpa-current-sections//mpa-current-section//mpa-current-section-content">
<xsl:param name="current-section-content" tunnel="yes"/>
<xsl:value-of select="$current-section-content"/>
</xsl:template>
<xsl:template match="/content-item-layout//mpa-prev-page-link">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:if test="$contentitem-tree/cms:articleSectionPanel/@pageNumber != 'all'
and $contentitem-tree/cms:articleSectionPanel/@pageNumber &gt; 1">
<xsl:apply-templates>
<xsl:with-param name="href"
tunnel="yes"
select="concat('?page=', $contentitem-tree/cms:articleSectionPanel/@pageNumber - 1)"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="/content-item-layout//mpa-next-page-link">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:if test="$contentitem-tree/cms:articleSectionPanel/@pageNumber != 'all'
and $contentitem-tree/cms:articleSectionPanel/@pageNumber &lt; $contentitem-tree/cms:mpadata/numberOfPages">
<xsl:apply-templates>
<xsl:with-param name="href"
tunnel="yes"
select="concat('?page=', $contentitem-tree/cms:articleSectionPanel/@pageNumber + 1)"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="/content-item-layout//mpa-all-sections-link">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:if test="$contentitem-tree/cms:articleSectionPanel/@pageNumber != 'all'
and $contentitem-tree/cms:mpadata/numberOfPages &gt; 1">
<xsl:apply-templates>
<xsl:with-param name="href"
tunnel="yes"
select="'?page=all'"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<content-item-layout>
<h2>
<content-item-title/>
</h2>
<div class="lead">
<mpa-summary/>
</div>
<mpa-sections>
<ul>
<mpa-section>
<li>
<a>
<mpa-section-title/>
</a>
</li>
</mpa-section>
</ul>
</mpa-sections>
<mpa-current-sections>
<mpa-current-section>
<h3>
<mpa-current-section-title/>
</h3>
<div class="main">
<mpa-current-section-content/>
</div>
</mpa-current-section>
</mpa-current-sections>
<div class="mpa-paginator">
<mpa-prev-page-link>
<a>
<show-text module="mpa">mpa/prev-page-link</show-text>
</a>
</mpa-prev-page-link>
<mpa-all-sections-link>
<a>
<show-text module="mpa">mpa/all-sections</show-text>
</a>
</mpa-all-sections-link>
<mpa-next-page-link>
<a>
<show-text module="mpa">mpa/next-page-link</show-text>
</a>
</mpa-next-page-link>
</div>
</content-item-layout>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<content-item-layout>
<h2>
<content-item-title/>
</h2>
<div class="lead">
<mpa-summary/>
</div>
</content-item-layout>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<foundry:static-texts xmlns:foundry="http://foundry.libreccm.org">
<text id="mpa/next-page-link">
<translation lang="de">Nächste Seite</translation>
<translation lang="en">Next page</translation>
</text>
<text id="mpa/prev-page-link">
<translation lang="de">Vorherige Seite</translation>
<translation lang="en">Previous page</translation>
</text>
<text id="mpa/all-sections">
<translation lang="de">Artikel auf einer Seite</translation>
<translation lang="en">Article on one page</translation>
</text>
</foundry:static-texts>