@category aus qemud-0.1.0 news raus
präparationen für events.xml für Events zu der wir keine extra News wollen calendar.html-Logik git-svn-id: svn://svn.c3d2.de/c3d2-web/trunk@540 31f61c52-7bfb-0310-b897-fc00f8a278f0ds2013
parent
e07a541408
commit
04ef134d88
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<calendar>
|
||||
<event title="Chaosdienstag">
|
||||
<start>2006-10-17T19:00:00</start>
|
||||
<location>Dresden</location>
|
||||
</event>
|
||||
<event title="Chaosdienstag">
|
||||
<start>2006-10-24T19:00:00</start>
|
||||
<location>Dresden</location>
|
||||
</event>
|
||||
</calendar>
|
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:date="http://exslt.org/dates-and-times"
|
||||
exclude-result-prefixes="xsl date">
|
||||
|
||||
<xsl:output method="xml"
|
||||
version="1.0"
|
||||
encoding="utf-8"
|
||||
doctype-system="http://www.c3d2.de/dtd/c3d2web.dtd"
|
||||
indent="yes"/>
|
||||
|
||||
<xsl:template match="/calendar">
|
||||
<page>
|
||||
<calendar-summary>
|
||||
<!-- Events aus events.xml ziehen -->
|
||||
<xsl:apply-templates select="event"/>
|
||||
|
||||
<!-- Events aus den News ziehen -->
|
||||
<xsl:for-each select="document('../news.xml')/page/news/newsfile">
|
||||
<xsl:message>newsfile: <xsl:value-of select="."/></xsl:message>
|
||||
<xsl:apply-templates select="document(concat('../', .))/item/event"/>
|
||||
</xsl:for-each>
|
||||
</calendar-summary>
|
||||
</page>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="event">
|
||||
<event>
|
||||
<title>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@title"><xsl:value-of select="@title"/></xsl:when>
|
||||
<xsl:when test="../@title"><xsl:value-of select="../@title"/></xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message terminate="yes">Event with no title!</xsl:message>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</title>
|
||||
<date><xsl:value-of select="start"/></date>
|
||||
<location><xsl:value-of select="start"/></location>
|
||||
<!-- TODO: Link -->
|
||||
</event>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:date="http://exslt.org/dates-and-times"
|
||||
exclude-result-prefixes="xsl date">
|
||||
|
||||
<xsl:template match="/page/calendar-summary">
|
||||
<table border="0" class="calendar">
|
||||
<tr>
|
||||
<th>Montag</th>
|
||||
<th>Dienstag</th>
|
||||
<th>Mittwoch</th>
|
||||
<th>Donnerstag</th>
|
||||
<th>Freitag</th>
|
||||
<th>Samstag</th>
|
||||
<th>Sonntag</th>
|
||||
</tr>
|
||||
|
||||
<xsl:call-template name="output-week">
|
||||
<xsl:with-param name="date">
|
||||
<xsl:call-template name="get-past-monday">
|
||||
<xsl:with-param name="date" select="concat(date:year(date:date()), '-', date:month-in-year(date:date()), '-01')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="stopmonth" select="date:month-in-year(date:add(date:date(), 'P2M'))"/>
|
||||
</xsl:call-template>
|
||||
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="output-week">
|
||||
<xsl:param name="date"/>
|
||||
<xsl:param name="stopmonth"/>
|
||||
<tr>
|
||||
<xsl:call-template name="output-day">
|
||||
<xsl:with-param name="date" select="$date"/>
|
||||
</xsl:call-template>
|
||||
</tr>
|
||||
|
||||
<xsl:variable name="nextweek" select="date:add($date, 'P7D')"/>
|
||||
<xsl:message>nextweek: <xsl:value-of select="$nextweek"/></xsl:message>
|
||||
<xsl:if test="date:month-in-year($nextweek) != $stopmonth">
|
||||
<xsl:call-template name="output-week">
|
||||
<xsl:with-param name="date" select="$nextweek"/>
|
||||
<xsl:with-param name="stopmonth" select="$stopmonth"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
td/@class ist wie folgend aufgebaut:
|
||||
* Beginnt immer mit 'cal'
|
||||
* Dann 'week' für Wochentage, 'sun' für Sonntage
|
||||
* '1' für aktuellen Monat, '2' für folgenden Monat, '3' für sonstige Monate
|
||||
-->
|
||||
<xsl:template name="output-day">
|
||||
<xsl:param name="date"/>
|
||||
<td>
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>cal</xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="date:day-in-week($date) = 1">sun</xsl:when>
|
||||
<xsl:otherwise>week</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:choose>
|
||||
<xsl:when test="date:month-in-year($date) = date:month-in-year(date:date())">1</xsl:when>
|
||||
<xsl:when test="date:month-in-year($date) = date:month-in-year(date:add(date:date(), 'P1M'))">2</xsl:when>
|
||||
<xsl:otherwise>3</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="date:day-in-month($date)"/>
|
||||
</td>
|
||||
<xsl:if test="date:day-in-week($date) != 1"> <!-- Sunday? Break and return to output-week... -->
|
||||
<xsl:call-template name="output-day">
|
||||
<xsl:with-param name="date" select="date:add($date, 'P1D')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="calendar-title">
|
||||
<xsl:variable name="d1" select="date:date()"/>
|
||||
<xsl:variable name="d2" select="date:add(date:date(), 'P1M')"/>
|
||||
|
||||
<xsl:text>Kalender: </xsl:text>
|
||||
|
||||
<xsl:call-template name="get-monthstring">
|
||||
<xsl:with-param name="date" select="$d1"/>
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:if test="date:year($d1) != date:year($d2)">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="date:year($d1)"/>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:text> & </xsl:text>
|
||||
|
||||
<xsl:call-template name="get-monthstring">
|
||||
<xsl:with-param name="date" select="$d2"/>
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<xsl:value-of select="date:year($d2)"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="get-past-monday">
|
||||
<xsl:param name="date"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="date:day-in-week($date) = 2">
|
||||
<xsl:value-of select="$date"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="get-past-monday">
|
||||
<xsl:with-param name="date" select="date:add($date, '-P1D')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
Loading…
Reference in New Issue