Fixed event bugs and removed dead xsl code.

This commit is contained in:
David Bartley 2007-08-12 15:13:43 -04:00
parent c25a91c61f
commit 5bfe828e3a
11 changed files with 23 additions and 199 deletions

View File

@ -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

1
TODO Normal file
View File

@ -0,0 +1 @@
Convert cellspacing and cellpadding to CSS equivalents.

View 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

166
ajax.js
View File

@ -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;
}

View 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=""||' $@

View 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

View File

@ -1,9 +0,0 @@
<?xml version='1.0'?>
<!DOCTYPE cscpage SYSTEM "csc.dtd">
<cscpage>
footer
<footer />
</cscpage>

View File

@ -13,11 +13,9 @@
<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>
@ -25,14 +23,11 @@
</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"

View 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>
@ -38,13 +38,20 @@
</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, '-', '')"
@ -112,7 +117,9 @@
</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>

View 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>

View 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, '-', '')"