got ourselves a pretty little portal page

This commit is contained in:
Astro 2013-10-30 00:13:58 +01:00
parent 82537c361a
commit 4f5df99c8d
6 changed files with 163 additions and 19 deletions

View File

@ -82,10 +82,11 @@ DS_FEEDS:= \
NEWSITEMS:=$(wildcard content/news/*.xml)
CLEAN=$(CONTENT) $(NEWSFILES) $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY) $(DS_PAGES) $(DS_FEEDS)
NOINPUTVALID:=false
NOVALID:=false
define xml_process
$(VALIDATOR) $(VFLAGS_IN) $<
$(NOINPUTVALID) || $(VALIDATOR) $(VFLAGS_IN) $<
$(PROCESSOR) $(PFLAGS) -o $@ $(STYLE) $<
$(NOVALID) || $(VALIDATOR) $(VFLAGS_OUT) $@ || \
{ touch -m -t 197001010000 Makefile $@ ; exit 1 ; }
@ -219,16 +220,26 @@ portal:
mkdir $@
portal/fetch.sh : STYLE=xsl/portal2fetch.xsl
portal/fetch.sh : NOINPUTVALID:=true
portal/fetch.sh : NOVALID:=true
portal/fetch.sh: content/portal-config.xml $(STYLE)
$(PROCESSOR) $(PFLAGS) -o $@ $(STYLE) $<
$(call xml_process)
chmod a+x $@
portal/items.xml : STYLE=xsl/portal2items.xsl
portal/items.xml : NOINPUTVALID:=true
portal/items.xml : NOVALID:=true
portal/items.xml: content/portal-config.xml $(STYLE) portal/fetch.sh news.xml
( cd portal && ./fetch.sh )
$(PROCESSOR) $(PFLAGS) -o $@ $(STYLE) $<
$(call xml_process)
portal/items-sorted.xml : STYLE=xsl/portal-sort.xsl
portal/items-sorted.xml: portal/items.xml $(STYLE)
$(call xml_process)
build/portal.html : NOINPUTVALID:=true
build/portal.html: portal/items-sorted.xml $(STYLE)
$(call xml_process)
# Pages:
build/%.html: content/pages/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY) $(DATESTAMP) news.xml

View File

@ -2,5 +2,5 @@
<gallery id="media-lachmoewe">https://media.c3d2.de/u/lachmoewe/atom/</gallery>
<gallery id="media-bigalex">https://media.c3d2.de/u/bigalex/atom/</gallery>
<gallery id="media-joerg">https://media.c3d2.de/u/joerg/atom/</gallery>
<wiki id="wiki">https://wiki.c3d2.de/w/index.php?title=Spezial:Letzte_%C3%84nderungen&amp;feed=atom&amp;days=60&amp;limit=30</wiki>
<wiki id="wiki">https://wiki.c3d2.de/w/index.php?title=Spezial:Letzte_%C3%84nderungen&amp;feed=atom&amp;days=300&amp;limit=60</wiki>
</config>

View File

@ -432,6 +432,78 @@ abbr.dtstart, abbr.dtend {
height: 128px;
}
/* -- Portal -- */
#portal {
text-align: center;
white-space-collapsing: discard;
}
#portal article {
display: inline-block;
text-align: left;
}
#portal article > a {
display: block;
position: relative;
width: 14.5em;
height: 14.5em;
overflow: hidden;
border-bottom: none;
margin: 0;
}
#portal article > a:hover {
margin: 0;
}
#portal h3, #portal .footer {
position: absolute;
left: 0;
right: 0;
height: 1.3em;
margin: 0;
padding: 0;
font-size: medium;
line-height: 1.3em;
overflow: hidden;
text-overflow: ellipsis;
font-weight: 100;
background-color: black;
color: white;
opacity: 0.7;
z-index: 2;
}
/* <header/> */
#portal h3 {
top: -1.3em;
transition: top 0.3s ease-out;
letter-spacing: 0;
}
#portal a:hover h3 {
top: 0;
transition: top 0.1s ease-in;
}
/* <footer/> */
#portal .footer {
bottom: -1.3em;
transition: bottom 0.3s ease-out;
letter-spacing: 0;
}
#portal a:hover .footer {
bottom: 0;
transition: bottom 0.1s ease-in;
}
/* <content-text/> */
#portal h4 {
position: absolute;
left: 0;
top: 1em;
line-height: 0.9em;
font-size: x-large;
font-weight: bold;
letter-spacing: 0;
color: #333;
text-shadow: -1px 0 1.5px white, 0 1px 1.5px white, 1px 0 1.5px white, 0 -1px 1.5px white;
}
/* -- Calendar -- */
table.calendar {
table-layout: fixed;

15
xsl/portal-sort.xsl Normal file
View File

@ -0,0 +1,15 @@
<?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">
<xsl:template match="/page/portal">
<page>
<portal>
<xsl:for-each select="item">
<xsl:sort select="date:seconds(@date)" data-type="number" order="descending" />
<xsl:copy-of select="."/>
</xsl:for-each>
</portal>
</page>
</xsl:template>
</xsl:stylesheet>

View File

@ -4,6 +4,12 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<xsl:template match="/">
<page>
<xsl:apply-templates/>
</page>
</xsl:template>
<xsl:template match="/config">
<portal>
<xsl:apply-templates select="*[@id]"/>
@ -28,20 +34,18 @@
</xsl:template>
<xsl:template match="atom:entry" mode="gallery">
<item>
<item date="{atom:updated}">
<header><xsl:value-of select="atom:title"/></header>
<footer><xsl:value-of select="atom:content[@type='html']" disable-output-escaping="yes"/></footer>
<date><xsl:value-of select="atom:updated"/></date>
<content-image><xsl:value-of select="atom:link[@rel='enclosure'][1]/@href"/></content-image>
<link><xsl:value-of select="atom:link[@rel='alternate'][1]/@href"/></link>
</item>
</xsl:template>
<xsl:template match="atom:entry" mode="wiki">
<item>
<item date="{atom:updated}">
<header>C3D2 Wiki</header>
<footer>by <xsl:value-of select="atom:author/atom:name"/></footer>
<date><xsl:value-of select="atom:updated"/></date>
<content-text>[[<xsl:value-of select="atom:title"/>]]</content-text>
<link><xsl:value-of select="atom:link[@rel='alternate'][1]/@href"/></link>
</item>
@ -50,10 +54,9 @@
<xsl:template match="item" mode="news">
<xsl:param name="link"/>
<item>
<item date="{@date}">
<header>News</header>
<footer>by <xsl:value-of select="@author"/></footer>
<date><xsl:value-of select="@date"/></date>
<content-text><xsl:value-of select="@title"/></content-text>
<xsl:apply-templates select="image[1]" mode="news"/>
<link><xsl:value-of select="$link"/></link>

View File

@ -38,7 +38,7 @@
</xsl:variable>
<xsl:call-template name="body">
<xsl:with-param name="title" select="$title" />
<xsl:with-param name="title" select="normalize-space($title)" />
</xsl:call-template>
</xsl:template>
@ -61,8 +61,11 @@
<xsl:element name="head">
<xsl:call-template name="header" />
<title>
<xsl:text>&lt;&lt;&lt;/&gt;&gt; Chaos Computer Club Dresden | c3d2 - </xsl:text>
<xsl:text>&lt;&lt;&lt;/&gt;&gt; Chaos Computer Club Dresden | c3d2</xsl:text>
<xsl:if test="$title != ''">
<xsl:text> - </xsl:text>
<xsl:value-of select="$title" />
</xsl:if>
</title>
</xsl:element>
@ -110,6 +113,7 @@
<xsl:attribute name="class">vevent</xsl:attribute>
</xsl:if>
<xsl:if test="$title != ''">
<h2>
<xsl:if test="name(.) = 'item'">
<xsl:attribute name="class">news</xsl:attribute>
@ -117,6 +121,7 @@
<xsl:value-of select="$title" />
</h2>
</xsl:if>
<!-- Für Seiten, die nur ein Newsitem beinhalten,
Newsmetadaten anzeigen
@ -308,4 +313,42 @@
</xsl:for-each>
</xsl:template>
<xsl:template match="/page/portal">
<section id="portal">
<xsl:apply-templates select="item[position() &lt;= 60]"/>
</section>
</xsl:template>
<xsl:template match="/page/portal/item">
<article>
<a href="{link}">
<xsl:if test="content-image">
<xsl:attribute name="style">
background: url('<xsl:value-of select="content-image"/>') 50% 50% no-repeat;
</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="header"/>
<xsl:apply-templates select="footer"/>
<xsl:apply-templates select="content-text"/>
</a>
</article>
</xsl:template>
<xsl:template match="portal/item/header">
<h3><xsl:value-of select="string(.)"/></h3>
</xsl:template>
<xsl:template match="portal/item/footer">
<p class="footer"><xsl:value-of select="string(.)"/></p>
</xsl:template>
<xsl:template match="portal/item/content-text">
<h4><xsl:value-of select="string(.)"/></h4>
</xsl:template>
<xsl:template match="portal/item/content-image">
<img src="{{.}}"/>
</xsl:template>
</xsl:stylesheet>