Foundry support for ccm-cms-types-event

git-svn-id: https://svn.libreccm.org/ccm/trunk@2966 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-11-11 18:30:08 +00:00
parent 0ea8b1a666
commit 9d91cdda2a
11 changed files with 415 additions and 22 deletions

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<css-files>
<application name="admin">
<css-file internal="true">admin.css</css-file>
<css-file origin="internal">admin.css</css-file>
</application>
<application name="cms-admin">
<css-file internal="true">admin.css</css-file>
<css-file origin="internal">admin.css</css-file>
</application>
<application name="navigation">
<css-file>public.css</css-file>

View File

@ -20,6 +20,9 @@
<content-item content-type="com.arsdigita.cms.contenttypes.Bookmark">
content-items/bookmark-detail.xml
</content-item>
<content-item content-type="com.arsdigita.cms.contenttypes.Event">
content-items/event-detail.xml
</content-item>
<content-item content-type="com.arsdigita.cms.contenttypes.NewsItem">
content-items/news-detail.xml
</content-item>

View File

@ -649,7 +649,15 @@
<xsl:param name="date-elem" tunnel="yes"/>
<xsl:variable name="year" select="$date-elem/@year"/>
<xsl:variable name="month-value" select="$date-elem/@month"/>
<xsl:variable name="month"
select="if (string-length($date-elem/@month) &lt; 2)
then concat('0', $date-elem/@month)
else $date-elem/@month"/>
<xsl:variable name="day"
select="if (string-length($date-elem/@day) &lt; 2)
then concat('0', $date-elem/@day)
else $date-elem/@day"/>
<!--<xsl:variable name="month-value" select="$date-elem/@month"/>
<xsl:variable name="month">
<xsl:choose>
<xsl:when test="string-length($month-value) &lt; 2">
@ -659,8 +667,8 @@
<xsl:value-of select="$month-value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="day-value" select="$date-elem/@day"/>
</xsl:variable>-->
<!--<xsl:variable name="day-value" select="$date-elem/@day"/>
<xsl:variable name="day">
<xsl:choose>
<xsl:when test="string-length($day-value) &lt; 2">
@ -670,7 +678,7 @@
<xsl:value-of select="$day-value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
</xsl:variable>-->
<xsl:value-of select="concat($year, '-', $month, '-', $day)"/>
</xsl:template>
@ -678,7 +686,11 @@
<xsl:template match="date-format/year">
<xsl:param name="date-elem" tunnel="yes"/>
<xsl:variable name="year-value" select="$date-elem/@year"/>
<xsl:value-of select="if (foundry:boolean(./@short))
then substring($date-elem/@year, 3)
else $date-elem/@year"/>
<!--<xsl:variable name="year-value" select="$date-elem/@year"/>
<xsl:choose>
<xsl:when test="foundry:boolean(./@short)">
@ -687,13 +699,18 @@
<xsl:otherwise>
<xsl:value-of select="$year-value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:choose>-->
</xsl:template>
<xsl:template match="date-format/month">
<xsl:param name="date-elem" tunnel="yes"/>
<xsl:variable name="month-value" select="$date-elem/@month"/>
<xsl:value-of select="if (string-length($date-elem/@month) &lt; 2
and foundry:boolean(./@zero))
then concat('0', $date-elem/@month)
else $date-elem/@month"/>
<!--<xsl:variable name="month-value" select="$date-elem/@month"/>
<xsl:choose>
<xsl:when test="string-length($month-value) &lt; 2 and foundry:boolean(./@zero)">
@ -702,7 +719,7 @@
<xsl:otherwise>
<xsl:value-of select="$month-value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:choose>-->
</xsl:template>
<xsl:template match="date-format/month-name">
@ -714,7 +731,12 @@
<xsl:template match="date-format/day">
<xsl:param name="date-elem" tunnel="yes"/>
<xsl:variable name="day-value" select="$date-elem/@day"/>
<xsl:value-of select="if (string-length($date-elem/@day) &lt; 2
and foundry:boolean($date-elem/@day))
then concat('0', $date-elem/@day)
else $date-elem/@day"/>
<!--<xsl:variable name="day-value" select="$date-elem/@day"/>
<xsl:choose>
<xsl:when test="string-length($day-value) &lt; 2 and foundry:boolean(./@zero)">
@ -723,6 +745,83 @@
<xsl:otherwise>
<xsl:value-of select="$day-value"/>
</xsl:otherwise>
</xsl:choose>-->
</xsl:template>
<xsl:template name="foundry:format-time">
<xsl:param name="time-elem"/>
<xsl:param name="style-param"/>
<xsl:variable name="style"
select="if ($style-param[@lang = $language])
then $style-param[@lang = $language]
else $style-param[@default = 'true']"/>
<!--<xsl:variable name="style">
<xsl:choose>
<xsl:when test="$style-param[@lang = $language]">
<xsl:value-of select="$style-param[@lang = $language]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$style-param[@default = 'true']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>-->
<xsl:choose>
<xsl:when test="$style = '12h'">
<xsl:variable name="hour24-value" select="$time-elem/@hour"/>
<xsl:variable name="minute-value" select="$time-elem/@minute"/>
<xsl:variable name="hour-value">
<xsl:choose>
<xsl:when test="$hour24-value &gt; 11">
<xsl:value-of select="$hour24-value - 12"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$hour24-value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="hour">
<xsl:choose>
<xsl:when test="string-length($hour-value) &lt; 2">
<xsl:value-of select="concat('0', $hour-value)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$hour-value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="minute">
<xsl:choose>
<xsl:when test="string-length($minute-value) &lt; 2">
<xsl:value-of select="concat('0', $hour-value)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$minute-value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="suffix">
<xsl:choose>
<xsl:when test="hour-value &gt; 11">
<xsl:value-of select="foundry:get-static-text('', 'time/pm')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="foundry:get-static-text('', 'time/am')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat($hour, ':', $minute, ' ', $suffix)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$time-elem/@time"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

View File

@ -31,6 +31,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/news.xsl"/>
<xsl:import href="content-items/assets/image-attachments.xsl"/>
<xsl:import href="content-items/assets/notes.xsl"/>

View File

@ -0,0 +1,157 @@
<?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//start-date">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:choose>
<xsl:when test="$contentitem-tree/startDate">
<xsl:call-template name="foundry:format-date">
<xsl:with-param name="date-elem" select="$contentitem-tree/startDate"/>
<xsl:with-param name="date-format" select="./date-format"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$contentitem-tree/nav:attribute[@name = 'startDate']">
<xsl:call-template name="foundry:format-date">
<xsl:with-param name="date-elem"
select="$contentitem-tree/nav:attribute[@name = 'startDate']"/>
<xsl:with-param name="date-format" select="./date-format"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="/content-item-layout//end-date">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:choose>
<xsl:when test="$contentitem-tree/endDate">
<xsl:call-template name="foundry:format-date">
<xsl:with-param name="date-elem" select="$contentitem-tree/endDate"/>
<xsl:with-param name="date-format" select="./date-format"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$contentitem-tree/nav:attribute[@name = 'endDate']">
<xsl:call-template name="foundry:format-date">
<xsl:with-param name="date-elem"
select="$contentitem-tree/nav:attribute[@name = 'endDate']"/>
<xsl:with-param name="date-format" select="./date-format"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="/content-item-layout//start-time">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:choose>
<xsl:when test="$contentitem-tree/startTime">
<xsl:call-template name="foundry:format-time">
<xsl:with-param name="time-elem" select="$contentitem-tree/startTime"/>
<xsl:with-param name="style-param" select="./style"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$contentitem-tree/nav:attribute[@name = 'startTime']">
<xsl:call-template name="foundry:format-time">
<xsl:with-param name="time-elem"
select="$contentitem-tree/nav:attribute[@name = 'startTime']"/>
<xsl:with-param name="style-param" select="./style"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="/content-item-layout//end-time">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:choose>
<xsl:when test="$contentitem-tree/endTime">
<xsl:call-template name="foundry:format-time">
<xsl:with-param name="time-elem" select="$contentitem-tree/endTime"/>
<xsl:with-param name="style-param" select="./style"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$contentitem-tree/nav:attribute[@name = 'endTime']">
<xsl:call-template name="foundry:format-time">
<xsl:with-param name="time-elem"
select="$contentitem-tree/nav:attribute[@name = 'endTime']"/>
<xsl:with-param name="style-param" select="./style"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="location">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:choose>
<xsl:when test="$contentitem-tree/location">
<xsl:value-of disable-output-escaping="yes"
select="$contentitem-tree/location"/>
</xsl:when>
<xsl:when test="$contentitem-tree/nav:attribute[@name = 'location']">
<xsl:value-of disable-output-escaping="yes"
select="$contentitem-tree/nav:attribute[@name = 'location']"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="main-contributor">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:choose>
<xsl:when test="$contentitem-tree/mainContributor">
<xsl:value-of disable-output-escaping="yes"
select="$contentitem-tree/mainContributor"/>
</xsl:when>
<xsl:when test="$contentitem-tree/nav:attribute[@name = 'mainContributor']">
<xsl:value-of disable-output-escaping="yes"
select="$contentitem-tree/nav:attribute[@name = 'mainContributor']"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="event-type">
<xsl:param name="contentitem-tree" tunnel="yes"/>
<xsl:choose>
<xsl:when test="$contentitem-tree/eventType">
<xsl:value-of disable-output-escaping="yes" select="$contentitem-tree/eventType"/>
</xsl:when>
<xsl:when test="$contentitem-tree/nav:attribute[@name = 'eventType']">
<xsl:value-of disable-output-escaping="yes"
select="$contentitem-tree/nav:attribute[@name = 'eventType']"/>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -62,8 +62,7 @@
<xsl:choose>
<xsl:when test="$contentitem-tree/newsDate">
<xsl:call-template name="foundry:format-date">
<xsl:with-param name="date-elem"
select="$contentitem-tree/newsDate"/>
<xsl:with-param name="date-elem" select="$contentitem-tree/newsDate"/>
<xsl:with-param name="date-format" select="./date-format"/>
</xsl:call-template>
</xsl:when>

View File

@ -53,35 +53,57 @@
<foundry:doc section="user"
type="template-tag">
<foundry:doc-desc>
Outputs a static text which is retrieved from the
<code>static-texts/global.xml</code> file in the layout file. The key is the content
Outputs a static text which is retrieved from a file in the <code>texts</code>
directory. If the <code>module</code> attribute is not present, the
<code>texts/global.xml</code> file is used. Otherwise the file provided by the
module element ist used. The key is the content
of the element. If at least one of the attributes <code>id</code>, <code>class</code>
or <code>with-colorset</code> is present at the attribute, the text is wrapped in a
<code>span</code> element.
</foundry:doc-desc>
<foundry:doc-attributes>
<foundry:doc-attribute name="id">
An unique id for the text.
<p>An unique id for the text.</p>
</foundry:doc-attribute>
<foundry:doc-attribute name="class">
One or more classes to format the text per CSS.
<p>One or more classes to format the text per CSS.</p>
</foundry:doc-attribute>
<foundry:doc-attribute name="module">
<p>
The module (file) from the text is retrieved. The name of the file should be
provided without file extension.
</p>
</foundry:doc-attribute>
<foundry:doc-attribute name="with-colorset">
<p>
Add the classes for using the Colorset feature to the <code>span</code> element
the text is wrapped in.
</p>
</foundry:doc-attribute>
</foundry:doc-attributes>
</foundry:doc>
<xsl:template match="show-text">
<xsl:variable name="module" select="if (./@module) then ./@module else ''"/>
<!--<xsl:variable name="module">
<xsl:choose>
<xsl:when test="./@module">
<xsl:value-of select="./@module"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="''"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>-->
<xsl:choose>
<xsl:when test="@id != '' or @class != '' or with-colorset = 'true'">
<span>
<xsl:call-template name="foundry:set-id-and-class"/>
<xsl:value-of select="foundry:get-static-text('', .)"/>
<xsl:value-of select="foundry:get-static-text($module, .)"/>
</span>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="foundry:get-static-text('', .)"/>
<xsl:value-of select="foundry:get-static-text($module, .)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

View File

@ -69,7 +69,7 @@
<xsl:call-template name="foundry:load-css-file">
<xsl:with-param name="filename" select="."/>
<xsl:with-param name="media" select="./@media"/>
<!--<xsl:with-param name="internal" select="./@internal = 'true'"/>-->
<!--<xsl:with-param name="internal" select="foundry:boolean(./@internal)"/>-->
<xsl:with-param name="origin"
select="foundry:get-attribute-value(current(), 'origin', '')"/>
</xsl:call-template>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<content-item-layout>
<h2>
<content-item-title/>
</h2>
<div class="lead">
<lead-text/>
</div>
<dl>
<dt>
<show-text module="event">start-date</show-text>
</dt>
<dd>
<start-date>
<date-format default="true">
<iso-date/>
</date-format>
</start-date>
T
<start-time>
<style lang="en" style="12h"/>
<style default="true" style="24h"/>
</start-time>
</dd>
<dt>
<show-text module="event">end-date</show-text>
</dt>
<dd>
<end-date>
<date-format default="true">
<iso-date/>
</date-format>
</end-date>
T
<end-time>
<style lang="en" style="12h"/>
<style default="true" style="24h"/>
</end-time>
</dd>
<dt>
<show-text module="event">location</show-text>
</dt>
<dd>
<location/>
</dd>
<dt>
<show-text module="event">event-type</show-text>
</dt>
<dd>
<event-type/>
</dd>
<dt>
<show-text module="event">main-contributor</show-text>
</dt>
<dd>
<main-contributor/>
</dd>
</dl>
<div class="main">
<main-text/>
</div>
</content-item-layout>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<foundry:static-texts xmlns:foundry="http://foundry.libreccm.org">
<text id="start-date">
<translation lang="de">Beginn</translation>
<translation lang="en">Begin</translation>
</text>
<text id="end-date">
<translation lang="de">Ende</translation>
<translation lang="en">End</translation>
</text>
<text id="location">
<translation lang="de">Veranstaltungsort</translation>
<translation lang="en">Location</translation>
</text>
<text id="main-contributor">
<translation lang="de">Veranstalter</translation>
<translation lang="en">Hosted by</translation>
</text>
<text id="event-type">
<translation lang="de">Art der Veranstaltung</translation>
<translation lang="en">Type of event</translation>
</text>
</foundry:static-texts>

View File

@ -10,4 +10,14 @@
<translation lang="en">Skip navigation</translation>
</text>
<text id="time/am">
<translation lang="de">a.m.</translation>
<translation lang="en">a.m.</translation>
</text>
<text id="time/pm">
<translation lang="de">p.m.</translation>
<translation lang="en">p.m.</translation>
</text>
</foundry:static-texts>