Fixed event bugs and removed dead xsl code.
authorDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Sun, 12 Aug 2007 19:13:43 +0000 (15:13 -0400)
committerDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Sun, 12 Aug 2007 19:13:43 +0000 (15:13 -0400)
Makefile
TODO [new file with mode: 0644]
about/index.xml
ajax.js [deleted file]
default.mk.in
events.xml
footer.xml [deleted file]
xsl/common.xsl
xsl/events.xsl
xsl/menu.xsl
xsl/news.xsl

index a13fc4c..a1cef0c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-INPUTS = index.xml footer.xml
+INPUTS = index.xml
 SUBDIRS = about events docs office news users clubs media
 
 first: noroot events.ics books.xml members.xml menu.xml all
diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..3b0bf72
--- /dev/null
+++ b/TODO
@@ -0,0 +1 @@
+Convert cellspacing and cellpadding to CSS equivalents.
index 213631c..19de9c1 100644 (file)
@@ -47,8 +47,7 @@ N2L 3G1
   </p>
  </section>
 
- <section
-   title="What... is the air-speed velocity of an unladen swallow?">
+ <section title="What... is the air-speed velocity of an unladen swallow?">
   <p>
    What
    do you mean? An African or European swallow?<i>(idea
diff --git a/ajax.js b/ajax.js
deleted file mode 100644 (file)
index c89e1ff..0000000
--- a/ajax.js
+++ /dev/null
@@ -1,166 +0,0 @@
-// X-Mode AJAX Core "Yume" 2.0
-// Compatible with X-Mode 3 "Yotsuba" and any other external apps.
-// Originally developed by Dave Crane, Eric Pascarello and Darren James
-// Developed by Juti Noppornpitak
-
-var net = new Object();
-net.READY_STATE_UNINITIALIZED = 0;
-net.READY_STATE_LOADING = 1;
-net.READY_STATE_LOADED = 2;
-net.READY_STATE_INTERACTIVE = 3;
-net.READY_STATE_COMPLETE = 4;
-net.CONNECTION_TERMINATION = "<blink>Terminating the connection...</blink>";
-net.core = function(url, console, onload, loading, onerror,
-       method, data, contentType) {
-       this.url = url;
-       this.currurl = url;
-       this.req = null;
-       this.console = console;
-       this.data = (data) ? data : null;
-       this.contentType = (contentType) ? contentType : null;
-       this.method = (method) ? method : "GET";
-       this.onload = (onload) ? onload : this.defaultLoad;
-       this.loading = (loading) ? loading : this.defaultLoading;
-       this.onerror = (onerror) ? onerror : this.defaultError;
-       // Require the user to manually start the connection.
-       // this.connect(url);
-}
-net.core.prototype = {
-       defaultConnect:function() {
-               this.connect(this.url);
-       },
-
-       connect:function(url, method, data, contentType) {
-               // Create the requester
-               if(window.XMLHttpRequest) { // for Mozilla/Safari
-                       this.req = new XMLHttpRequest();
-               } else if(window.ActiveXObject) { // for MSIE
-                       this.req = new ActiveXObject("Microsoft.XMLHTTP");
-               }
-               
-               if(!contentType && method == "POST") {
-                       contentType="application/x-www-form-urlencoded";
-               }
-
-               this.currurl = url;
-               
-               if(this.req) {
-                       try {
-                               var loader = this;
-                               this.req.onreadystatechange = function() {
-                                       loader.process.call(loader);
-                               }
-                               if(!method) { method = "GET"; }
-                               if(!data) { data = null; }
-                               this.req.open(method, this.currurl, true);
-                               if(contentType) {
-                                       this.req.setRequestHeader("Content-Type", contentType);
-                               }
-                               this.req.send(data);
-                       } catch(err) {
-                               this.onerror.call(this);
-                       }
-               }
-       },
-       
-       process:function() {
-               var req = this.req;
-               var status = req.readyState;
-
-               if(status == net.READY_STATE_COMPLETE) {
-                       var httpstatus = req.status;
-                       if(httpstatus == 200 || httpstatus == 0) {
-                               this.onload.call(this);
-                       } else {
-                               this.onerror.call(this);
-                       }
-               } else {
-                       // handling loading/connecting
-                       this.loading.call(this);
-               }
-       },
-
-       defaultLoad:function() {
-               xcie__setElement(this.console, 
-                       this.req.responseText);
-       },
-       
-       defaultError:function() {
-               alert("Error while connecting to: " + this.currurl);
-       },
-
-       defaultLoading:function() {
-               xcie__setElement(this.console, "Loading");
-       }
-}
-
-function xcie__element(id) {
-       return document.getElementById(id);
-}
-
-function xcie__getElement(id) {
-       if(!xcie__element(id)) return;
-       return xcie__element(id).innerHTML;
-}
-
-function xcie__getElementValue(id) {
-       if(!xcie__element(id)) return;
-       return xcie__element(id).value;
-}
-
-function xcie__setElementValue(id, value) {
-       if(!xcie__element(id)) return;
-       xcie__element(id).value = value;
-}
-
-function xcie__setElement(id, value) {
-       if(!xcie__element(id)) return;
-       xcie__element(id).innerHTML = value;
-}
-
-function xcie__setWindowTitle(value) {
-       document.title = value;
-}
-
-function xcie__setClass(id, nc) {
-       xcie__element(id).className = nc;
-}
-
-function xcie__img(src, align, other) {
-       return "<img border=\"0\" src=\"" + src + "\" align=\""
-               + ((align)?align:"absmiddle")
-               + "\" " + ((other)?other:"") + "/>";
-}
-
-function xcie__a(label, value, ajax, other, command) {
-       return "<a " + (!ajax?"href=\"" + value + "\"":"onclick=\""
-               + ((command == null)?
-                       "connect('" + net.PREFIX_LINK + value + "');"
-                       :command)
-               + "\"")
-               + ((other)?" " + other:"") + "\">"
-               + label + "</a>";
-}
-
-function xcie__in(type, name, value, other, cmd) {
-       return "<input name=\"" + name + "\" id=\"" + name + "\""
-               + " type=\"" + type + "\" value=\"" + ((value)?value:"")
-               + "\"" + " onclick=\"" + cmd + "\""
-               + ((other)?" " + other:"") + "/>";
-}
-
-function addslashes(str) {
-       // SRC: Stephen Chapman of About.com
-       str=str.replace(/\\/g,'\\\\');
-       str=str.replace(/\'/g,'\\\'');
-       str=str.replace(/\"/g,'\\"');
-       return str;
-}
-
-function stripslashes(str) {
-       // SRC: Stephen Chapman of About.com
-       str=str.replace(/\\'/g,'\'');
-       str=str.replace(/\\"/g,'"');
-       str=str.replace(/\\\\/g,'\\');
-       return str;
-}
index e9bfb25..5fe76a5 100644 (file)
@@ -13,5 +13,4 @@ clean:
 
 %.html: %.xml $(ROOT)/csc.dtd $(ROOT)/cscweb.xsl $(ROOT)/xsl/*.xsl $(ROOT)/events.xml $(ROOT)/news.xml $(ROOT)/menu.xml $(ROOT)/default.mk directory.xml
        java -classpath $(CLASSPATH) net.sf.saxon.Transform -o $@ $< $(ROOT)/cscweb.xsl $(XSLTARGS)
-       # mad mad hacks
        sed -i 's| xmlns=""||' $@
index b8bc2a1..41682d8 100644 (file)
@@ -150,7 +150,7 @@ data.
 
   <eventitem date="2007-04-11" time="3:30 PM"
         room="Hagey Hall" title="The Free Software Movement and the GNU/Linux Operating System">
-        <short>A talk by Richard M. Stallman (RMS) <b>[CANCELLED]!</b></short>
+        <short>A talk by Richard M. Stallman (RMS) <b>[CANCELLED]</b></short>
         <abstract>
         <p>
 <!--   Richard Stallman will speak about the goals and philosophy of the Free Software Movement, and the status and history the GNU operating 
@@ -224,7 +224,7 @@ along with a brief discussion of some of the technology behind it.
   <eventitem date="2007-04-04" time="4:00 PM"
    room="MC 1056" title="Data Analysis with Kernels: [an introduction]">
    <short>A talk by Michael Biggs. This talk is RESCHEDULED due to unexpected
-   circumstance.</short>
+   circumstances</short>
    <abstract>
    <p>
 I am going to take an intuitive, CS-style approach to a discussion about the
diff --git a/footer.xml b/footer.xml
deleted file mode 100644 (file)
index 842a4ce..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version='1.0'?>
-
-<!DOCTYPE cscpage SYSTEM "csc.dtd">
-
-<cscpage>
-
- footer
- <footer /> 
-</cscpage>
index fdb677c..7d2d1b7 100644 (file)
       <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
     </head>
     <body><div>
-      <a name="pagetop" id="pagetop" />
+      <a id="pagetop" />
       <xsl:apply-templates select="biglogo" />
-      <xsl:apply-templates select="header">
-        <xsl:with-param name="title" select="@title" />
-      </xsl:apply-templates>
+      <xsl:apply-templates select="header" />
       <xsl:apply-templates select="section|menu" />
       <xsl:apply-templates select="footer" />
     </div></body>
 </xsl:template>
 
 <xsl:template match="section">
-  <xsl:if test="@id != ''">
-    <a id="{@id}" />
-  </xsl:if>
   <h2><xsl:value-of select="@title" /></h2>
   <xsl:apply-templates />
 </xsl:template>
 
-<xsl:template match="biglogo" name="biglogo">
+<xsl:template match="biglogo">
   <div class="biglogo">
     <div class="uwlogo">
       <a href="http://www.uwaterloo.ca/"><img src="{$pre}logos/uw_logo.gif"
index 73be7a6..7416ecd 100644 (file)
@@ -6,7 +6,7 @@
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
 
-<xsl:template match="events" name="events">
+<xsl:template name="events">
   <tr>
     <th colspan="2" class="news">Upcoming Events</th>
   </tr>
   </tr>
 </xsl:template>
 
+<xsl:template match="events-this-term">
+  <xsl:call-template name="events-by-term">
+    <xsl:with-param name="date" select="$g_date" />
+  </xsl:call-template>
+</xsl:template>
+
 <xsl:template name="events-by-term">
-  <p>The events for <xsl:value-of select="csc:term($g_date)" /> are listed here.
+  <xsl:param name="date" />
+  <p>The events for <xsl:value-of select="csc:term($date)" /> are listed here.
     You can also <a href="{$pre}events.ics">download an ICS</a> of them.</p>
   <xsl:for-each select="document(concat($g_root, '/events.xml'))/eventdefs/eventitem">
     <xsl:sort select="translate(@date, '-', '')" 
         order="ascending" data-type="number" />
-    <xsl:if test="csc:term(@date) = csc:term($g_date)">
+    <xsl:if test="csc:term(@date) = csc:term($date)">
       <h3><a href="{translate(concat($pre, 'events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}"><xsl:value-of select="@title" /></a></h3>
       <p>
         <strong>
@@ -91,8 +98,6 @@
   <xsl:apply-templates select="document(concat($g_root, '/events.xml'))/eventdefs" />
 </xsl:template>
 
-<xsl:key name="eventterm" match="/eventdefs/eventitem" use="csc:term(@date)" />
-
 <xsl:template match="old-events">
   <xsl:for-each select="document(concat($g_root, '/events.xml'))/eventdefs/eventitem">
     <xsl:sort select="translate(@date, '-', '')" 
           </head>
           <body><div>
             <xsl:call-template name="header" />
-            <xsl:call-template name="events-by-term" />
+            <xsl:call-template name="events-by-term">
+                <xsl:with-param name="date" select="@date" />
+            </xsl:call-template>
             <xsl:call-template name="footer" />
           </div></body>
         </html>
index 07a7a1e..6602144 100644 (file)
@@ -7,7 +7,7 @@
     xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
 
 <xsl:template match="menuitem">
-  <xsl:variable name="pre2">
+  <xsl:variable name="preabs">
     <xsl:choose>
       <xsl:when test="@absolute = 'true'" />
       <xsl:otherwise>
@@ -16,7 +16,7 @@
     </xsl:choose>
   </xsl:variable>
   <div class="menuitem">
-    <a href="{$pre2}{@href}"><img src="{$pre}buttons/{@icon}.png" width="40" 
+    <a href="{$preabs}{@href}"><img src="{$pre}buttons/{@icon}.png" width="40" 
       height="40" alt="{@title}" /><br /><xsl:value-of select="@title" /></a>
   </div>
 </xsl:template>
index b02d2eb..e3c9001 100644 (file)
@@ -57,8 +57,6 @@
   </xsl:for-each>
 </xsl:template>
 
-<xsl:key name="newsterm" match="/newsdefs/newsitem" use="csc:term(@date)" />
-
 <xsl:template match="old-news">
   <xsl:for-each select="document(concat($g_root, '/news.xml'))/newsdefs/newsitem">
     <xsl:sort select="translate(@date, '-', '')"