Minikalendar über den chaosupdates

git-svn-id: svn://svn.c3d2.de/c3d2-web/trunk@549 31f61c52-7bfb-0310-b897-fc00f8a278f0
This commit is contained in:
astro 2006-11-10 01:16:50 +00:00
parent 581b4f7dbf
commit d5fcce2a75
6 changed files with 120 additions and 14 deletions

View File

@ -36,6 +36,8 @@ XML_CATALOG:=dtd/catalog.xml
NAVIGATION=content/navigation.xml
# Chaosupdates:
WWW_CCC_DE_UPDATES=chaosupdates.rdf
# Calendar summary::
CALENDAR_SUMMARY=calendar-summary.xml
### Ziele ###
# Dateinamen der zu erzeugenden html-Dateien:
@ -54,7 +56,7 @@ SEARCH_TMPL:=build/cgi-bin/search.html
# Quellen
NEWSITEMS:=$(wildcard content/news/*.xml)
CLEAN=$(CONTENT) $(NEWSFILES) $(WWW_CCC_DE_UPDATES) $(DS_PAGES)
CLEAN=$(CONTENT) $(NEWSFILES) $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY) $(DS_PAGES)
NOVALID_IGNORE:=false
@ -77,7 +79,7 @@ export: www
### Regeln für den XSLT-Prozess ###
build/news.html: $(WWW_CCC_DE_UPDATES)
build/news.html: $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY)
build/news-rss.xml : STYLE=xsl/rss.xsl
build/news-rss.xml : NOVALID_IGNORE:=true
build/news-rss.xml : VFLAGS_OUT=--noout --schema xsd/rss20.xsd
@ -97,23 +99,23 @@ $(NEWSFILES): news.xml $(NAVIGATION) $(STYLE)
$(call xml_process)
# Calendar
calendar-summary.xml : STYLE=xsl/calendar-summary.xsl
calendar-summary.xml : NOVALID_IGNORE:=true
calendar-summary.xml : VFLAGS_IN=--noout
calendar-summary.xml: content/events.xml news.xml
$(CALENDAR_SUMMARY) : STYLE=xsl/calendar-summary.xsl
$(CALENDAR_SUMMARY) : NOVALID_IGNORE:=true
$(CALENDAR_SUMMARY) : VFLAGS_IN=--noout
$(CALENDAR_SUMMARY): content/events.xml news.xml
$(call xml_process)
build/calendar.html : VFLAGS_IN=--noout
build/calendar.html: calendar-summary.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES)
build/calendar.html: $(CALENDAR_SUMMARY) $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES)
$(call xml_process)
# Pages:
build/%.html: content/pages/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES) news.xml
build/%.html: content/pages/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY) news.xml
$(call xml_process)
# News:
build/news/%.html : BASEURL="../"
build/news/%.html: content/news/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES)
build/news/%.html: content/news/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY)
$(call xml_process)
# Suche:

View File

@ -188,7 +188,7 @@ pre {
#news {
text-align: left;
float: right;
margin-right: 2em;
margin-right: 1em;
margin-left: -5%;
width: 19%;
background: url(../images/pesthoernchen.png) top center no-repeat;
@ -225,6 +225,44 @@ pre {
text-decoration: underline;
}
/* -- Upcoming -- */
#upcoming {
text-align: left;
float: right;
margin-right: 1em;
margin-left: -5%;
width: 19%;
padding: 2em;
font-size: small;
}
#upcoming h2 {
font-size: 1.2em;
border-top: #ebc63c 1px solid;
padding-top: 5%;
}
#upcoming ul {
list-style-type: none;
font-size: small;
margin-left: -1em;
max-width: 10em !important;
}
#upcoming ul li {
line-height: 1.5em;
}
#upcoming a {
color: #666;
text-decoration: none;
font-style: italic;
}
#upcoming a:hover {
text-decoration: underline;
}
/* -- footer -- */
#footer {
margin: 0 2em 2em 2em;

View File

@ -5,6 +5,8 @@
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>
@ -75,11 +77,23 @@
<xsl:for-each select="event">
<xsl:sort select="start"/>
<xsl:variable name="start" select="concat(format-number(date:year(start),'00'),format-number(date:month-in-year(start),'00'),format-number(date:day-in-month(start),'00'))"/>
<xsl:variable name="end" select="concat(format-number(date:year(end),'00'),format-number(date:month-in-year(end),'00'),format-number(date:day-in-month(end),'00'))"/>
<xsl:variable name="date" select="concat(format-number(date:year($date),'00'),format-number(date:month-in-year($date),'00'),format-number(date:day-in-month($date),'00'))"/>
<xsl:variable name="start">
<xsl:call-template name="strip-time-from-date">
<xsl:with-param name="date" select="start"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="end">
<xsl:call-template name="strip-time-from-date">
<xsl:with-param name="date" select="end"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="$date">
<xsl:call-template name="strip-time-from-date">
<xsl:with-param name="date" select="$date"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="($start &lt;= $date) and ($date &lt;= $end)">
<xsl:if test="(date:seconds($start) &lt;= date:seconds($date)) and (date:seconds($date) &lt;= date:seconds($end))">
<li>
<a href="{link}">
<xsl:value-of select="title"/>

View File

@ -158,6 +158,31 @@
</div> <!-- id="news" -->
</xsl:template>
<xsl:template name="calendar-events">
<xsl:if test="document('../calendar-summary.xml')/page/calendar-summary/event[date:seconds(end) &gt;= date:seconds(date:date())]">
<div id="upcoming">
<h2>
<a href="calendar.html">Kalender</a>
</h2>
<ul>
<xsl:for-each select="document('../calendar-summary.xml')/page/calendar-summary/event[date:seconds(end) &gt;= date:seconds(date:date())]">
<xsl:sort select="date:seconds(start)" data-type="number" order="ascending" />
<li>
<xsl:call-template name="datespan-to-human">
<xsl:with-param name="start" select="start"/>
<xsl:with-param name="end" select="end"/>
</xsl:call-template>:
<a href="{link}">
<xsl:value-of select="title"/>
</a>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</xsl:template>
<!-- Support für <event/> bzw. Microformats -->
<xsl:include href="date.xsl" />
<xsl:template match="item/event/start">

View File

@ -360,6 +360,22 @@
</xsl:template>
<xsl:template name="datespan-to-human">
<xsl:param name="start"/>
<xsl:param name="end"/>
<xsl:variable name="s" select="concat(date:day-in-month($start),'.',date:month-in-year($start),'.',date:year($start))"/>
<xsl:variable name="e" select="concat(date:day-in-month($end),'.',date:month-in-year($end),'.',date:year($end))"/>
<xsl:choose>
<!-- One day only, no span: s.s.ssss -->
<xsl:when test="$s = $e"><xsl:value-of select="$s"/></xsl:when>
<!-- Same year, same month: s.-e.e.eeee. -->
<xsl:when test="(date:month-in-year($start) = date:month-in-year($end)) and (date:year($start) = date:year($end))"><xsl:value-of select="concat(date:day-in-month($start),'.-',$e)"/></xsl:when>
<!-- TODO: Same year, buth different months: s.s.-e.e.eeee -->
<!-- Across years: s.s.ssss-e.e.eeee -->
<xsl:otherwise><xsl:value-of select="concat($s,'-',$e)"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="date-to-hevent">
<xsl:param name="date"/>
@ -402,4 +418,13 @@
format-number(date:second-in-minute($date), '00'), ' GMT')"/>
</xsl:template>
<xsl:template name="strip-time-from-date">
<xsl:param name="date"/>
<xsl:choose>
<xsl:when test="contains($date,'T')"><xsl:value-of select="substring-before($date,'T')"/></xsl:when>
<xsl:otherwise test="contains($date,'T')"><xsl:value-of select="$date"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -153,6 +153,8 @@
<xsl:text> ### News ### </xsl:text>
</xsl:comment>
<xsl:call-template name="calendar-events" />
<xsl:call-template name="chaosupdates" />
</xsl:otherwise>