diff --git a/about/donations.xml b/about/donations.xml index d76d6d4..cb5aacc 100644 --- a/about/donations.xml +++ b/about/donations.xml @@ -45,7 +45,7 @@ Math & Computer 3036/3037 University of Waterloo 200 University Avenue West -Waterloo, ON N3L 3G1 +Waterloo, ON N2L 3G1 Canada

diff --git a/about/index.xml b/about/index.xml index d22c101..8df6128 100644 --- a/about/index.xml +++ b/about/index.xml @@ -19,7 +19,7 @@ Math & Computer 3036/3037 University of Waterloo 200 University Avenue West -Waterloo, ON N3L 3G1 +Waterloo, ON N2L 3G1 Canada

Our office phone number is (519) 888-4567 x33870.

diff --git a/common.mk.in b/common.mk.in index 53ee214..ec3d455 100644 --- a/common.mk.in +++ b/common.mk.in @@ -33,7 +33,7 @@ $(OUTDIR)%.atom: %.xml xsl/atom.xsl $(XSLTPROC) $< $(ROOT)/xsl/atom.xsl $@ $(XSLTARGS) $(OUTDIR)%.ics: %.xml - perl scripts/xml2ics.pl $< > $@ + $(XSLTPROC) $< $(ROOT)/xsl/ics.xsl $@ $(XSLTARGS) $(OUTDIR)%.html: %.html cp -f $< $@ diff --git a/events.xml b/events.xml index e70093d..abfe1ed 100644 --- a/events.xml +++ b/events.xml @@ -5,6 +5,18 @@ + + Tyler Lessard +

+Tyler Lessard from RIM will present a brief history of BlackBerry +technology and will discuss how the evolution of BlackBerry as an +end-to-end hardware, software and services platform has been +instrumental to its success and growth in the market. Find out how the +BlackBerry service components integrate with wireless carrier networks +and get a sneak peek at where the wireless data market is going. +

+
+ Raymond Laflamme

diff --git a/office/index.xml b/office/index.xml index 7c53e55..8ad53d5 100644 --- a/office/index.xml +++ b/office/index.xml @@ -19,11 +19,8 @@

One of our most popular services at the office is providing anybody - with CD/DVD copies of Free Software and Open Source operating system - distributions (including, but by no means limited to, Debian GNU/Linux, - Mandrake Linux, Red Hat Linux, FreeBSD and NetBSD for various - architectures. The cost is $0.50 per disc at the time of this writing, or - free if you provide your own discs. + with free CD/DVD copies of Free Software and Open Source operating + system distributions.

Another favourite is our $0.50 pop for members. We have a fridge in diff --git a/scripts/xml2ics.pl b/scripts/xml2ics.pl deleted file mode 100755 index 7274a8c..0000000 --- a/scripts/xml2ics.pl +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/perl - -use XML::DOM; -use strict; - -# get the first element under a node of the given tag -# @param node: node under which to look for elements -# @param tag: the tage to look for -# @return: first element under node with the given tag -sub subvalue($$) -{ - my ($class, $tag) = @_; - return value($class->getElementsByTagName($tag)->item(0)); -} - -# get the node value of the first child of a given node -# @param node: whose child to use -# @return: node value of given node's first child -sub value($) -{ - my ($class) = @_; - if (undef == $class) { return undef; } - - my $child = $class->getFirstChild(); - - if (undef == $child) { - return undef; - } - - return $child->getNodeValue(); -} - -print <new(); -my $doc = $parser->parsefile($ARGV[0]); -my @events = $doc->getElementsByTagName("eventitem"); - -foreach my $event (@events) { - my $date = $event->getAttribute("date"); - my $time = $event->getAttribute("time"); - my $talk_title = $event->getAttribute("title"); - $talk_title =~ s/[:;,]//g; - - my $room = $event->getAttribute("room"); - - my $short = subvalue($event, "short"); - $short =~ s/[:;,]//g; - my $abstract = $event->getElementsByTagName("abstract")->item(0)->toString(); - - my $ical_date = `date -d"$date" +%Y%m%d`; - chomp $ical_date; - - my ($ical_start, $ical_end); - - if ($time =~ /(.*)-(.*)/) { - $ical_start = ical_time($1); - $ical_end = ical_time($2); - } else { - $ical_start = ical_time($time); - $ical_end = ical_time("$time + 1 hour"); - } - - $abstract =~ s///; - $abstract =~ s/<\/abstract>//; - $abstract =~ s/\n/ /sg; - - my $ical_abstract = "\"$abstract\""; - -sub ical_time { - my ($ds) = @_; - my $d = `date -d"$ds" +\%H\%M\%S`; - chomp $d; - return $d; -} - -print <$talk_title -- $short -DESCRIPTION:$ical_abstract -END:VEVENT -END_OF_EVENT -} - -print "END:VCALENDAR\n"; - - - - - - - diff --git a/scripts/xsltproc.py b/scripts/xsltproc.py index 1289892..7b82bfb 100755 --- a/scripts/xsltproc.py +++ b/scripts/xsltproc.py @@ -1,5 +1,5 @@ #!/usr/bin/python -import os, sys, urllib, libxml2, libxslt, ldap, time +import os, sys, urllib, libxml2, libxslt, ldap, time, datetime, re, pytz # # globals @@ -24,6 +24,12 @@ cscPositions = { } cscYesNo = { True : 'yes', False : 'no' } +def xslArgToString(arg): + if type(arg) == type([]): + return libxml2.xmlNode(arg[0]).getContent() + else: + return arg + # # cscLdapConnect # @@ -35,29 +41,27 @@ def cscLdapConnect(): # # csc:encode-for-uri # -def cscEncodeForUri(ctx, arg): - if type(arg) == type([]): - arg = libxml2.xmlNode(arg[0]).getContent() - return urllib.quote(arg) +def cscEncodeForUri(ctx, uri): + uri = xslArgToString(uri) + return urllib.quote(uri) # # csc:term # -def cscTerm(ctx, arg): - if type(arg) == type([]): - arg = libxml2.xmlNode(arg[0]).getContent() +def cscTerm(ctx, date): + date = xslArgToString(date) try: - [year, month, day] = arg.split("-") + [year, month, day] = date.split("-") term = (int(month) - 1) / 4 return cscTerms[term] + " " + year except: - print "Invalid term '%s'" % arg + print "Invalid date '%s'" % date raise # # csc:member-list # -def cscMemberList(ctx, arg): +def cscMemberList(ctx, _): try: if cscLdap == None: cscLdapConnect() @@ -83,7 +87,7 @@ def cscMemberList(ctx, arg): # # csc:position-list # -def cscPositionList(ctx, arg): +def cscPositionList(ctx, _): try: if cscLdap == None: cscLdapConnect() @@ -119,12 +123,48 @@ def cscPositionList(ctx, arg): print e raise +# +# csc:ical-datetime +# +def cscIcalDatetime(ctx, date, time, addmin = "0"): + date = xslArgToString(date) + time = xslArgToString(time) + addmin = int(xslArgToString(addmin)) + r = re.search("(\d*)-(\d*)-(\d*)", date) + year, month, day = 0, 0, 0 + if r != None: + year, month, day = (int(i) for i in r.groups()) + r = re.search("(\d*):(\d*)\s*([apAP])", time) + hour, minute = (0, 0) + if r != None: + hour, minute = (int(i) for i in r.groups()[:2]) + hour %= 12 #hour % 12 + if r.group(3) in 'pP': + hour += 12 + dt = datetime.datetime(year, month, day, hour, minute) + dt = pytz.timezone('Canada/Eastern').localize(dt) + dt += datetime.timedelta(0, 0, 0, 0, addmin) + return dt.astimezone(pytz.utc).strftime("%Y%m%dT%H%M%SZ") + +# +# csc:ical-escape +# +def cscIcalEscape(ctx, str): + str = xslArgToString(str) + str = str.replace("\n", " ") + #str = str.replace(":", "") + #str = str.replace(";", "") + #str = str.replace(",", "") + str = re.sub("\s+", " ", str) + str = re.sub("^\s+", "", str) + str = re.sub("\s+$", "", str) + return str + # # csc:email # -def cscEmail(ctx, arg): - if type(arg) == type([]): - str = libxml2.xmlNode(arg[0]).getContent() +def cscEmail(ctx, email): + email = xslArgToString(email) return "_EMAIL_TODO_" # @@ -156,6 +196,8 @@ try: libxslt.registerExtModuleFunction("term", cscUri, cscTerm) libxslt.registerExtModuleFunction("member-list", cscUri, cscMemberList) libxslt.registerExtModuleFunction("position-list", cscUri, cscPositionList) + libxslt.registerExtModuleFunction("ical-datetime", cscUri, cscIcalDatetime) + libxslt.registerExtModuleFunction("ical-escape", cscUri, cscIcalEscape) libxslt.registerExtModuleFunction("email", cscUri, cscEmail) # parse xml/xslt and apply style-sheet @@ -166,4 +208,5 @@ try: ret = style.saveResultToFilename(outFile, res, 0) except Exception, e: + print e sys.exit(1) diff --git a/xsl/ics.xsl b/xsl/ics.xsl new file mode 100644 index 0000000..fe2470b --- /dev/null +++ b/xsl/ics.xsl @@ -0,0 +1,39 @@ + + + + +BEGIN:VCALENDAR +VERSION:2.0 +X-WR-CALNAME:University of Waterloo Computer Science Club +PRODID:-//Apple Computer, Inc//iCal 2.0//EN +X-WR-RELCALID:3359A191-B19E-4B53-BADC-DFC084FC51C9 +CALSCALE:GREGORIAN +METHOD:PUBLISH + +END:VCALENDAR + + + + + + + + + +BEGIN:VEVENT +LOCATION:University of Waterloo - +DTSTAMP:20060912T200708Z +UID:@csclub.uwaterloo.ca +SEQUENCE:11 +DTSTART: +DTEND: +SUMMARY: -- +DESCRIPTION: +END:VEVENT + + +