Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Sep 2003 23:41:52 +0200
From:      "Simon L. Nielsen" <simon@FreeBSD.org>
To:        freebsd-www@FreeBSD.org
Cc:        edwin@freebsd.org
Subject:   Re: FreeBSD Event Calendar
Message-ID:  <20030928214150.GB885@FreeBSD.org>
In-Reply-To: <20030919160347.GA1801@FreeBSD.org>
References:  <20030919133843.GA6683@k7.mavetju> <20030919135307.GD57727@submonkey.net> <20030919143954.GH386@FreeBSD.org> <20030919145201.GC31340@unixpages.org> <20030919160347.GA1801@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--pZs/OQEoSSbxGlYw
Content-Type: multipart/mixed; boundary="JWEK1jqKZ6MHAcjA"
Content-Disposition: inline


--JWEK1jqKZ6MHAcjA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2003.09.19 18:03:48 +0200, Simon L. Nielsen wrote:
> On 2003.09.19 16:52:01 +0200, Christian Brueffer wrote:
> > I think there will be definetly enough events to fill this.
> >=20
> > This section would probably fit as a section under the 'Support' menu
> > item on the front page, of course on a separate page.
>=20
> That was an idea I hadn't thought about.  I will try to "hack" something
> together, and post here for comments.

Sorry for the delay, but I got my first draft of this done now.  It
divides events in upcoming events and past events.  I also added support
for additionel links for an event to link to photographs, Wiki and so
on.  More advanced calendar style output can perhaps be added later -
the XML file should make it possible to do it, since the start/end date
is simple to parse.

I have attached a more or less dummy XML file with some events, and the
xsl style that converts them to an HTML file.

HTML output, DTD, and Makefile can be found at
http://people.freebsd.org/~simon/work/events/ .

There are some parts that needs more work, e.g. the xsl could probably
be done better, the infolink tag should be renamed, and probably many
more things :-).

Comments, ideas, etc. very welcome.

--=20
Simon L. Nielsen
FreeBSD Documentation Team

--JWEK1jqKZ6MHAcjA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="events.xml"

<?xml version="1.0"?>
<!DOCTYPE events SYSTEM "events.dtd">
<!-- Please sort this file by startdate of the event -->

<events>
  <cvs:keywords xmlns:cvs="http://www.FreeBSD.org/XML/CVS" version="1.0">
    <cvs:keyword name="freebsd">
      $FreeBSD$
    </cvs:keyword>
  </cvs:keywords>

  <event id="usenix-2004">
    <name>2004 USENIX Annual Technical Conference</name>
    <url>http://www.usenix.org/events/usenix04/</url>;
    <startdate>
      <year>2004</year>
      <month>6</month>
      <day>27</day>
    </startdate>
    <enddate>
      <year>2004</year>
      <month>7</month>
      <day>2</day>
    </enddate>
    <location>
      <country>USA</country>
      <city>Boston</city>
      <state>Massachusetts</state>
    </location>
  </event>

  <event id="asia-bsdcon-2004">
    <name>Asia BSDCon 2004</name>
    <url>http://www.asiabsdcon.org/</url>;
    <startdate>
      <year>2004</year>
      <month>3</month>
      <day>12</day>
    </startdate>
    <enddate>
      <year>2004</year>
      <month>3</month>
      <day>15</day>
    </enddate>
    <date>March 12-15 2004</date>
    <location>
      <country>Taiwan</country>
      <city>Taipei</city>
    </location>
    <description>This is the first BSDCon held in Asia, and sponsored by <a
      href="http://www.usenix.org/">USENIX Association</a>. Two days
      of tutorials will precede two days of technical sessions and a
      vendor exhibit.</description>
  </event>

  <event id="linuxforum-2004">
    <name>LinuxForum 2004</name>
    <url>http://www.linuxforum.dk/</url>;
    <startdate>
      <year>2004</year>
      <month>3</month>
      <day>5</day>
    </startdate>
    <enddate>
      <year>2004</year>
      <month>3</month>
      <day>5</day>
    </enddate>
    <date>5-6. March 2004</date>
    <location>
      <country>Denmark</country>
      <city>Copenhagen</city>
    </location>
    <description>Anual Danish OpenSource conference.  The Danish BSD usergroup
      <a href="http://www.bsd-dk.dk">BSD-DK</a>; will be pressent to
      show FreeBSD.</description>
  </event>

  <event id="ccc-20">
    <name>20. Chaos Communication Congress</name>
    <url>http://www.ccc.de/congress/2003/</url>;
    <startdate>
      <year>2003</year>
      <month>12</month>
      <day>27</day>
    </startdate>
    <enddate>
      <year>2003</year>
      <month>12</month>
      <day>29</day>
    </enddate>
    <location>
      <country>Germany</country>
      <city>Berlin</city>
    </location>
    <description>FooBAR</description>
  </event>

  <event id="bsdcon-03">
    <name>BSDCon '03</name>
    <url>http://www.usenix.org/events/bsdcon03/</url>;
    <startdate>
      <year>2003</year>
      <month>9</month>
      <day>8</day>
    </startdate>
    <enddate>
      <year>2003</year>
      <month>9</month>
      <day>12</day>
    </enddate>
    <date>8.-12. September 2003</date>
    <location>
      <country>USA</country>
      <city>San Mateo</city>
      <state>California</state>
    </location>
    <description>For the fourth time, the main BSD Event, BSDCon is
      happening - where you can mean the people behind the
      projects. Two days of tutorials will precede two and a half days
      of technical sessions. An opportunity for people of all
      experience levels to learn from BSD experts, professionals with
      real world experience, and industry leaders.</description>
    <infolink type="notes">
      <title>FreeBSD Developer Summit notes</title>
      <url type="freebsd-website">/events/2003/bsdcon-devsummit.html</url>
    </infolink>
    <infolink type="other">
      <title>Unofficial BSDCon US 2003 Wiki</title>
      <url>http://bsdcon.kwiki.org/</url>;
    </infolink>
    <infolink type="photos">
      <title>BSDCon 2003 Photos by Matt Dillon</title>
      <url>http://apollo.backplane.com/BSDCON2003/</url>;
    </infolink>
  </event>

  <event id="linuxtag2003">
    <name>Linuxtag 2003</name>
    <url>http://www.linuxtag.org</url>;
    <startdate>
      <year>2003</year>
      <month>7</month>
      <day>10</day>
    </startdate>
    <enddate>
      <year>2003</year>
      <month>7</month>
      <day>13</day>
    </enddate>
    <date>10.-13. July 2003</date>
    <location>
      <country>Germany</country>
      <city>Karlsruhe</city>
    </location>
    <description>On Linuxtag, Europe's biggest Linuxexhibition and Conference,
      there will be some BSD Support. People from FreeBSD, NetBSD and
      OpenBSD, but also OpenDarwin people will staff the booth There
      will also be speeches. Felix Kronlage does an introducing speech
      about OpenDarwin, and Josef El-Rayes tells about FreeBSD and the
      FreeBSD Project.</description>
  </event>

  <!-- Sample to show that sorting works :) -->
  <event id="linuxforum-2003">
    <name>LinuxForum 2003</name>
    <url>http://www.linuxforum.dk/</url>;
    <startdate>
      <year>2000</year>
      <month>3</month>
      <day>5</day>
    </startdate>
    <enddate>
      <year>2003</year>
      <month>3</month>
      <day>5</day>
    </enddate>
    <location>
      <country>Denmark</country>
      <city>Copenhagen</city>
    </location>
    <description>Anual Danish OpenSource conference.  The Danish BSD usergroup
      <a href="http://www.bsd-dk.dk">BSD-DK</a>; will be pressent show
      (among others) FreeBSD.  <b>Dummy entry</b>.</description>
  </event>

  <event id="linuxforum-2002">
    <name>LinuxForum 2002</name>
    <url>http://www.linuxforum.dk/</url>;
    <startdate>
      <year>2002</year>
      <month>11</month>
      <day>1</day>
    </startdate>
    <enddate>
      <year>2003</year>
      <month>1</month>
      <day>1</day>
    </enddate>
    <date>5-6. March 2002</date>
    <location>
      <country>Denmark</country>
      <city>Copenhagen</city>
    </location>
    <description>Anual Danish OpenSource conference.  The Danish BSD usergroup
      <a href="http://www.bsd-dk.dk">BSD-DK</a>; will be pressent to
      show FreeBSD.  <b>Dummy entry</b>.</description>
  </event>
</events>

--JWEK1jqKZ6MHAcjA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="events.xsl"

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!-- $FreeBSD$ -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  xmlns:cvs="http://www.FreeBSD.org/XML/CVS"
  exclude-result-prefixes="cvs">

  <xsl:import href="../includes.xsl"/>

  <xsl:variable name="curdate" select="document('curdate.xml')//curdate" />

<!--   <xsl:variable name="base" select="'..'"/> -->
  <xsl:variable name="base" select="'http://www.FreeBSD.org'"/>; <!-- For tests -->
  <xsl:variable name="title" select="'FreeBSD Events'"/>
  <xsl:variable name="date">
    <xsl:value-of select="//cvs:keyword[@name='freebsd']"/>
  </xsl:variable>

  <xsl:output type="html" encoding="iso-8859-1"/>

  <!-- Convert a month number to the coresponding long english name -->
  <xsl:template name="gen-long-en-month">
    <xsl:param name="nummonth" />
    <xsl:variable name="month" select="number($nummonth)"/>
    <xsl:choose>
      <xsl:when test="$month=1">January</xsl:when>
      <xsl:when test="$month=2">February</xsl:when>
      <xsl:when test="$month=3">March</xsl:when>
      <xsl:when test="$month=4">April</xsl:when>
      <xsl:when test="$month=5">May</xsl:when>
      <xsl:when test="$month=6">June</xsl:when>
      <xsl:when test="$month=7">July</xsl:when>
      <xsl:when test="$month=8">August</xsl:when>
      <xsl:when test="$month=9">September</xsl:when>
      <xsl:when test="$month=10">October</xsl:when>
      <xsl:when test="$month=11">November</xsl:when>
      <xsl:when test="$month=12">December</xsl:when>
      <xsl:otherwise>INVALID MONTH</xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- Generate a date interval, in what I think is US format -->
  <!-- This template is currently unused -->
  <!-- Sample: November 1, 2002 - January 1, 2003 -->
  <xsl:template name="gen-date-interval-us">
    <xsl:param name="startdate" />
    <xsl:param name="enddate" />

    <xsl:call-template name="gen-long-en-month">
      <xsl:with-param name="nummonth" select="startdate/month" />
    </xsl:call-template>
    <xsl:text> </xsl:text>
    <xsl:value-of select="startdate/day"/>

    <xsl:if test="number(startdate/month)!=number(enddate/month) or
                  number(startdate/day)!=number(enddate/day) or
                  number(startdate/year)!=number(enddate/year)">
      <xsl:if test="number(startdate/year)!=number(enddate/year)">
        <xsl:text>, </xsl:text>
        <xsl:value-of select="startdate/year"/>
      </xsl:if>
      <xsl:text> - </xsl:text>
      <xsl:if test="number(startdate/month)!=number(enddate/month) or
                    number(startdate/year)!=number(enddate/year)">
        <xsl:call-template name="gen-long-en-month">
          <xsl:with-param name="nummonth" select="enddate/month"/>
        </xsl:call-template>
        <xsl:text> </xsl:text>
      </xsl:if>

      <xsl:if test="number(startdate/day)!=number(enddate/day) or
                    number(startdate/month)!=number(enddate/month) or
                    number(startdate/year)!=number(enddate/year)">
        <xsl:value-of select="enddate/day"/>
      </xsl:if>
    </xsl:if>
    <xsl:text>, </xsl:text>
    <xsl:value-of select="enddate/year"/>
  </xsl:template>

  <!-- Generate a date interval -->
  <!-- 27 November, 2002 - 29 December, 2003 -->
  <xsl:template name="gen-date-interval">
    <xsl:param name="startdate" />
    <xsl:param name="enddate" />

    <xsl:value-of select="startdate/day"/>

    <xsl:if test="number(startdate/month)!=number(enddate/month) or
                  number(startdate/day)!=number(enddate/day) or
                  number(startdate/year)!=number(enddate/year)">

      <xsl:if test="number(startdate/month)!=number(enddate/month) or
                    number(startdate/year)!=number(enddate/year)">
        <xsl:text> </xsl:text>
        <xsl:call-template name="gen-long-en-month">
          <xsl:with-param name="nummonth" select="startdate/month"/>
        </xsl:call-template>
      </xsl:if>

      <xsl:if test="number(startdate/year)!=number(enddate/year)">
        <xsl:text>, </xsl:text>
        <xsl:value-of select="startdate/year"/>
      </xsl:if>
      <xsl:text> - </xsl:text>

      <xsl:if test="number(startdate/day)!=number(enddate/day) or
                    number(startdate/month)!=number(enddate/month) or
                    number(startdate/year)!=number(enddate/year)">
        <xsl:value-of select="enddate/day"/>
      </xsl:if>
    </xsl:if>

    <xsl:text> </xsl:text>
    <xsl:call-template name="gen-long-en-month">
      <xsl:with-param name="nummonth" select="enddate/month" />
    </xsl:call-template>

    <xsl:text>, </xsl:text>
    <xsl:value-of select="enddate/year"/>
  </xsl:template>

  <!-- Generate a unique anchor for this event -->
  <xsl:template name="generate-event-anchor">
    <xsl:text>event:</xsl:text>
    <xsl:value-of select="@id"/>
  </xsl:template>

  <!-- Everything that follows are templates for the rest of the content -->

  <xsl:key name="event-by-month" match="event" use="concat(startdate/year, startdate/month)" />

  <xsl:template match="events">
    <html>
      <xsl:copy-of select="$header1"/>

      <body xsl:use-attribute-sets="att.body">

	<xsl:copy-of select="$header2"/>

	<p>If you know of any FreeBSD related events - or events that
          are of interest for FreeBSD users which is not listed here,
          please send details to <a
          href="mailto:www@freebsd.org">www@FreeBSD.org</a>, so they
          can be included.</p>

        <!-- This can be very useful if the past/upcomming events are split wrong -->
        <xsl:comment>
  	  <xsl:text>Generation date:</xsl:text>
          <xsl:value-of select="concat($curdate/year, format-number($curdate/month, '00'),
            format-number($curdate/day, '00'))"/>
        </xsl:comment>

        <h2 id="upcomming">
          <xsl:text>Upcoming events:</xsl:text>
	</h2>

        <xsl:for-each select="event[generate-id() = generate-id(key('event-by-month',
            concat(startdate/year, startdate/month))[1])
          and ((enddate/year &gt; $curdate/year) or
            (enddate/year = $curdate/year and enddate/month &gt; $curdate/month) or
            (enddate/year = $curdate/year and enddate/month = $curdate/month and
             enddate/day &gt; $curdate/day))]">

          <xsl:sort select="startdate/year" order="ascending" />
          <xsl:sort select="startdate/month" order="ascending" />

          <h3>
            <xsl:attribute name="id">
              <xsl:text>month:</xsl:text>
              <xsl:value-of select="concat(startdate/year,
                format-number(startdate/month, '00'))"/>
            </xsl:attribute>
            <xsl:call-template name="gen-long-en-month">
              <xsl:with-param name="nummonth" select="startdate/month" />
            </xsl:call-template>
            <xsl:text> </xsl:text>
            <xsl:value-of select="startdate/year"/></h3>

            <ul>
	      <xsl:for-each select="key('event-by-month', concat(startdate/year, startdate/month))">
                <xsl:sort select="startdate/day" order="descending" />
                <xsl:apply-templates select="."/>
              </xsl:for-each>
            </ul>

	</xsl:for-each>

        <h2 id="past">
          <xsl:text>Past events:</xsl:text>
	</h2>

        <xsl:for-each select="event[generate-id() =
          generate-id(key('event-by-month', concat(startdate/year, startdate/month))[1])
           and ((number(enddate/year) &lt; number($curdate/year)) or
          (number(enddate/year) = number($curdate/year) and
           number(enddate/month) &lt; number($curdate/month)) or
          (number(enddate/year) = number($curdate/year) and
           number(enddate/month) = number($curdate/month) and
           number(enddate/day) &lt;= number($curdate/day)))]">
         <xsl:sort select="startdate/year" order="descending" />
         <xsl:sort select="startdate/month" order="descending" />

          <h3>
            <xsl:attribute name="id">
              <xsl:text>month:</xsl:text>
              <xsl:value-of select="concat(startdate/year,
                format-number(startdate/month, '00'))"/>
            </xsl:attribute>
            <xsl:call-template name="gen-long-en-month">
              <xsl:with-param name="nummonth" select="startdate/month" />
            </xsl:call-template>
            <xsl:text> </xsl:text>
            <xsl:value-of select="startdate/year"/></h3>

            <ul>
	      <xsl:for-each select="key('event-by-month', concat(startdate/year, startdate/month))">
                <xsl:sort select="startdate/day" order="ascending" />
                <xsl:apply-templates select="."/>
              </xsl:for-each>
            </ul>

	</xsl:for-each>

	<xsl:copy-of select="$footer"/>
      </body>
    </html>
  </xsl:template>

  <!-- infolink -->
  <xsl:template match="infolink">
    <a>
      <xsl:attribute name="href">
        <xsl:choose>
          <xsl:when test="url/@type='freebsd-website'">
            <xsl:value-of select="$base"/><xsl:value-of select="url"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="url"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:attribute>
      <xsl:value-of select="title"/>
    </a>
    <xsl:if test="not(position()=last())">
      <xsl:text>&#160;</xsl:text>
    </xsl:if>
  </xsl:template>

  <!-- event -->
  <xsl:template match="event">
    <xsl:variable name="url"><xsl:value-of select="url"/></xsl:variable>
    <li>
      <a>
	<xsl:attribute name="id">
	  <xsl:call-template name="generate-event-anchor"/>
	</xsl:attribute>
      </a>

      <p><a href="{$url}"><b><xsl:value-of select="name"/></b></a>
        <xsl:if test="location/country!=''">
          <xsl:text>, </xsl:text>
          <xsl:value-of select="location/country"/>
        </xsl:if>
        <xsl:if test="location/city!=''">
          <xsl:text>, </xsl:text>
          <xsl:value-of select="location/city"/>
        </xsl:if>
        <xsl:if test="location/state!=''">
          <xsl:text> </xsl:text>
          <xsl:value-of select="location/state"/>
        </xsl:if>
        <br/>
        <em>
          <xsl:call-template name="gen-date-interval">
            <xsl:with-param name="startdate" select="startdate" />
            <xsl:with-param name="enddate" select="enddate" />
          </xsl:call-template>
        </em><br/>
	<xsl:copy-of select="description/child::node()"/>
      </p>
      <xsl:if test="infolink">
        <p>Links: <xsl:apply-templates select="infolink"/></p>
      </xsl:if>
    </li>
  </xsl:template>
</xsl:stylesheet>

--JWEK1jqKZ6MHAcjA--

--pZs/OQEoSSbxGlYw
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQE/d1Weh9pcDSc1mlERAk4PAJ9GXUtB/yaYsEIhNG2q/QFBO3DqdwCfe8Vg
z832hAyXgHcIT2GMvAcgahE=
=Q7lc
-----END PGP SIGNATURE-----

--pZs/OQEoSSbxGlYw--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030928214150.GB885>