Fetch positions (including exec) from ldap
* Position fetching is implemented by csc:positions * Exec page is now called Positions (positions.html) * exec.html -> positions.html symlink exists
This commit is contained in:
parent
dec967e63c
commit
910001d750
|
@ -1,6 +1,11 @@
|
||||||
FILES = index.html exec.html members.html constitution.html donations.html \
|
FILES = index.html exec.html members.html constitution.html donations.html \
|
||||||
constitution-change-20020920.html constitution-change-20040205.html
|
positions.html constitution-change-20020920.html \
|
||||||
|
constitution-change-20040205.html
|
||||||
RELDIR = about/
|
RELDIR = about/
|
||||||
include ../common.mk
|
include ../common.mk
|
||||||
|
|
||||||
$(OUTDIR)members.html: force
|
$(OUTDIR)members.html: force
|
||||||
|
$(OUTDIR)positions.html: force
|
||||||
|
|
||||||
|
$(OUTDIR)exec.html:
|
||||||
|
ln -s positions.html $@
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<directory title="About">
|
<directory title="About">
|
||||||
<diritem title="Constitution" href="constitution.html" />
|
<diritem title="Constitution" href="constitution.html" />
|
||||||
<diritem title="The Executive" href="exec.html" />
|
<diritem title="Positions" href="positions.html" />
|
||||||
<diritem title="Membership List" href="members.html" />
|
<diritem title="Membership List" href="members.html" />
|
||||||
<diritem title="Donations" href="donations.html" />
|
<diritem title="Donations" href="donations.html" />
|
||||||
</directory>
|
</directory>
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
<?xml version='1.0'?>
|
|
||||||
|
|
||||||
<!DOCTYPE cscpage SYSTEM "../csc.dtd">
|
|
||||||
|
|
||||||
<cscpage title="The CSC Executive">
|
|
||||||
<header />
|
|
||||||
<section title="The Executive">
|
|
||||||
<execlist>
|
|
||||||
<exec position="President"
|
|
||||||
name="Holden Karau"
|
|
||||||
sex="male"
|
|
||||||
userid="president" />
|
|
||||||
|
|
||||||
<exec position="Vice President"
|
|
||||||
name="Alex McCausland"
|
|
||||||
sex="male"
|
|
||||||
userid="vice-president" />
|
|
||||||
|
|
||||||
<exec position="Treasurer"
|
|
||||||
name="Dominik Chlobowski"
|
|
||||||
sex="male"
|
|
||||||
userid="treasurer" />
|
|
||||||
|
|
||||||
<exec position="Secretary"
|
|
||||||
name="Sean Cumming"
|
|
||||||
sex="male"
|
|
||||||
userid="secretary" />
|
|
||||||
|
|
||||||
<exec position="System Administrator"
|
|
||||||
type="appointed"
|
|
||||||
name="David Tenty"
|
|
||||||
sex="male"
|
|
||||||
userid="sysadmin" />
|
|
||||||
|
|
||||||
<exec position="Librarian"
|
|
||||||
type="appointed"
|
|
||||||
name="Various people"
|
|
||||||
sex="male"
|
|
||||||
userid="librarian" />
|
|
||||||
|
|
||||||
<exec position="Imapd (Individual Making Arrangements for Pop Delivery)"
|
|
||||||
type="appointed"
|
|
||||||
name="Nobody"
|
|
||||||
sex="male"
|
|
||||||
userid="imapd" />
|
|
||||||
|
|
||||||
<!-- Co-op position -->
|
|
||||||
<exec position="Web Master"
|
|
||||||
type="appointed"
|
|
||||||
name="David Bartley and Juti Noppornpitak"
|
|
||||||
sex="male"
|
|
||||||
userid="www" />
|
|
||||||
</execlist>
|
|
||||||
</section>
|
|
||||||
<section title="Elections">
|
|
||||||
<p>
|
|
||||||
Each term the CSC holds elections to determine the executive
|
|
||||||
council. To find out when and where the next elections will be
|
|
||||||
held, check the <a href="../index.html">homepage</a> and the <a
|
|
||||||
href="http://csclub.uwaterloo.ca/newsgroup/thread.php?group=uw.csc">uw.csc newsgroup</a>. For details on the
|
|
||||||
election rules, see the <a
|
|
||||||
href="constitution.html">constitution</a>.
|
|
||||||
</p>
|
|
||||||
</section>
|
|
||||||
<footer/>
|
|
||||||
</cscpage>
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version='1.0'?>
|
||||||
|
|
||||||
|
<!DOCTYPE cscpage SYSTEM "../csc.dtd">
|
||||||
|
|
||||||
|
<cscpage title="The CSC Executive">
|
||||||
|
<header />
|
||||||
|
<section title="The Executive">
|
||||||
|
<positions exec="yes" />
|
||||||
|
</section>
|
||||||
|
<section title="Other Positions">
|
||||||
|
<positions exec="no" />
|
||||||
|
</section>
|
||||||
|
<section title="Elections">
|
||||||
|
<p>
|
||||||
|
Each term the CSC holds elections to determine the executive council. To
|
||||||
|
find out when and where the next elections will be held, check the
|
||||||
|
<a href="../index.html">homepage</a> and the
|
||||||
|
<a href="http://csclub.uwaterloo.ca/newsgroup/thread.php?group=uw.csc">
|
||||||
|
uw.csc</a> newsgroup. For details on the election rules, see the
|
||||||
|
<a href="constitution.html">constitution</a>.
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
<footer />
|
||||||
|
</cscpage>
|
19
default.css
19
default.css
|
@ -1,7 +1,7 @@
|
||||||
body {
|
body {
|
||||||
background: white;
|
background: white;
|
||||||
color: black;
|
color: black;
|
||||||
font-family: serif;
|
font-family: 'Lucida Grande', Sans, Sans-serif;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
width: 760px;
|
width: 760px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
@ -20,7 +20,6 @@ h1 {
|
||||||
}
|
}
|
||||||
h2 {
|
h2 {
|
||||||
font-size: large;
|
font-size: large;
|
||||||
font-family: 'Lucida Grande', Sans, Sans-serif;
|
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
border-left: 10px solid #ff9900;
|
border-left: 10px solid #ff9900;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
|
@ -55,7 +54,6 @@ td.button {
|
||||||
}
|
}
|
||||||
td.newsdate {
|
td.newsdate {
|
||||||
background: #eeeeff;
|
background: #eeeeff;
|
||||||
font-family: sans-serif;
|
|
||||||
font-size: x-small;
|
font-size: x-small;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -66,13 +64,11 @@ td.newsitem {
|
||||||
}
|
}
|
||||||
td.newsauthor {
|
td.newsauthor {
|
||||||
background: #eeeeff;
|
background: #eeeeff;
|
||||||
font-family: sans-serif;
|
|
||||||
font-size: x-small;
|
font-size: x-small;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
td.eventdate {
|
td.eventdate {
|
||||||
background: #eeffee;
|
background: #eeffee;
|
||||||
font-family: sans-serif;
|
|
||||||
font-size: x-small;
|
font-size: x-small;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -83,14 +79,12 @@ td.eventitem {
|
||||||
}
|
}
|
||||||
td.eventroom {
|
td.eventroom {
|
||||||
background: #eeffee;
|
background: #eeffee;
|
||||||
font-family: sans-serif;
|
|
||||||
font-size: x-small;
|
font-size: x-small;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
th.news {
|
th.news {
|
||||||
background: #222255;
|
background: #222255;
|
||||||
color: white;
|
color: white;
|
||||||
font-family: sans-serif;
|
|
||||||
font-size: x-small;
|
font-size: x-small;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
@ -109,15 +103,15 @@ img {
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.position {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
div.footerlogo {
|
div.footerlogo {
|
||||||
float: right;
|
float: right;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
|
||||||
font-family: 'Lucida Grande', Sans, Sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.webcam {
|
div.webcam {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +162,6 @@ div.menuitem a {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-family: 'Lucida Grande', Sans, Sans-serif;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.menuitem a:hover {
|
div.menuitem a:hover {
|
||||||
|
@ -198,7 +191,6 @@ div.webtitle div {
|
||||||
}
|
}
|
||||||
|
|
||||||
a.diritem, a.diritem:link, a.diritem:visited, a.diritem:active {
|
a.diritem, a.diritem:link, a.diritem:visited, a.diritem:active {
|
||||||
font-family: 'Lucida Grande', Sans, Sans-serif;
|
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
border-left: 4px solid #ccc;
|
border-left: 4px solid #ccc;
|
||||||
padding: 0 15px 0 5px;
|
padding: 0 15px 0 5px;
|
||||||
|
@ -214,7 +206,6 @@ a.homedir {
|
||||||
}
|
}
|
||||||
|
|
||||||
a.pagetop, a.pagetop:link, a.pagetop:visited, a.pagetop:hover {
|
a.pagetop, a.pagetop:link, a.pagetop:visited, a.pagetop:hover {
|
||||||
font-family: 'Lucida Grande',sans, sans-serif;
|
|
||||||
display: block;
|
display: block;
|
||||||
padding: 5px 10px 5px 10px;
|
padding: 5px 10px 5px 10px;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
|
|
|
@ -3,4 +3,4 @@ RELDIR = media/
|
||||||
include ../common.mk
|
include ../common.mk
|
||||||
|
|
||||||
$(OUTDIR)flash:
|
$(OUTDIR)flash:
|
||||||
ln -s ../flash $(OUTDIR)flash
|
ln -s ../flash $@
|
||||||
|
|
|
@ -10,6 +10,18 @@ cscShortTerms = ['w', 's', 'f']
|
||||||
cscLdapUri = "ldap://ldap1.csclub.uwaterloo.ca ldap://ldap2.csclub.uwaterloo.ca"
|
cscLdapUri = "ldap://ldap1.csclub.uwaterloo.ca ldap://ldap2.csclub.uwaterloo.ca"
|
||||||
cscLdap = None
|
cscLdap = None
|
||||||
cscPeopleBase = 'ou=People,dc=csclub,dc=uwaterloo,dc=ca'
|
cscPeopleBase = 'ou=People,dc=csclub,dc=uwaterloo,dc=ca'
|
||||||
|
cscPositions = {
|
||||||
|
# position # name # exec # elected # order
|
||||||
|
'president' : ( 'President', True, True, 1, ),
|
||||||
|
'vice-president' : ( 'Vice-president', True, True, 2, ),
|
||||||
|
'treasurer' : ( 'Treasurer', True, True, 3, ),
|
||||||
|
'secretary' : ( 'Secretary', True, True, 4, ),
|
||||||
|
'sysadmin' : ( 'System Administrator', True, False, 5, ),
|
||||||
|
'librarian' : ( 'Librarian', False, False, 6, ),
|
||||||
|
'imapd' : ( 'Imapd', False, False, 7, ),
|
||||||
|
'webmaster' : ( 'Web Master', False, False, 8, ),
|
||||||
|
}
|
||||||
|
cscYesNo = { True : 'yes', False : 'no' }
|
||||||
|
|
||||||
#
|
#
|
||||||
# cscLdapConnect
|
# cscLdapConnect
|
||||||
|
@ -39,6 +51,7 @@ def cscTerm(ctx, arg):
|
||||||
return cscTerms[term] + " " + year
|
return cscTerms[term] + " " + year
|
||||||
except:
|
except:
|
||||||
print "Invalid term '%s'" % arg
|
print "Invalid term '%s'" % arg
|
||||||
|
raise
|
||||||
|
|
||||||
#
|
#
|
||||||
# csc:member-list
|
# csc:member-list
|
||||||
|
@ -53,7 +66,7 @@ def cscMemberList(ctx, arg):
|
||||||
members = cscLdap.search_s(cscPeopleBase, ldap.SCOPE_SUBTREE,
|
members = cscLdap.search_s(cscPeopleBase, ldap.SCOPE_SUBTREE,
|
||||||
'(&(objectClass=member)(term=%s%d))' % (term, year))
|
'(&(objectClass=member)(term=%s%d))' % (term, year))
|
||||||
doc = libxml2.newDoc("1.0")
|
doc = libxml2.newDoc("1.0")
|
||||||
root = doc.newChild(None, "memberlist", None)
|
root = doc.newChild(None, "root", None)
|
||||||
for (_, member) in members:
|
for (_, member) in members:
|
||||||
node = root.newChild(None, "member", None)
|
node = root.newChild(None, "member", None)
|
||||||
node.setProp("userid", member['uid'][0])
|
node.setProp("userid", member['uid'][0])
|
||||||
|
@ -66,6 +79,45 @@ def cscMemberList(ctx, arg):
|
||||||
print e
|
print e
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
#
|
||||||
|
# csc:position-list
|
||||||
|
#
|
||||||
|
def cscPositionList(ctx, arg):
|
||||||
|
try:
|
||||||
|
if cscLdap == None:
|
||||||
|
cscLdapConnect()
|
||||||
|
members = cscLdap.search_s(cscPeopleBase, ldap.SCOPE_SUBTREE,
|
||||||
|
'(&(objectClass=member)(position=*))')
|
||||||
|
doc = libxml2.newDoc("1.0")
|
||||||
|
root = doc.newChild(None, "root", None)
|
||||||
|
positions = {}
|
||||||
|
for (_, member) in members:
|
||||||
|
for position in member['position']:
|
||||||
|
if not position in positions:
|
||||||
|
positions[position] = []
|
||||||
|
positions[position].append(member)
|
||||||
|
for position in cscPositions.keys():
|
||||||
|
if not position in positions:
|
||||||
|
positions[position] = []
|
||||||
|
for (position, members) in positions.iteritems():
|
||||||
|
node = root.newChild(None, "position", None)
|
||||||
|
node.setProp("position", position)
|
||||||
|
if not position in cscPositions:
|
||||||
|
raise Exception("Position '%s' not known" % position)
|
||||||
|
position = cscPositions[position]
|
||||||
|
node.setProp("name", position[0])
|
||||||
|
node.setProp("exec", cscYesNo[position[1]])
|
||||||
|
node.setProp("elected", cscYesNo[position[2]])
|
||||||
|
node.setProp("order", str(position[3]))
|
||||||
|
for member in members:
|
||||||
|
child = node.newChild(None, "holder", None)
|
||||||
|
child.setProp("userid", member['uid'][0])
|
||||||
|
child.setProp("name", member['cn'][0])
|
||||||
|
return [root]
|
||||||
|
except Exception, e:
|
||||||
|
print e
|
||||||
|
raise
|
||||||
|
|
||||||
#
|
#
|
||||||
# csc:email
|
# csc:email
|
||||||
#
|
#
|
||||||
|
@ -102,6 +154,7 @@ try:
|
||||||
libxslt.registerExtModuleFunction("encode-for-uri", cscUri, cscEncodeForUri)
|
libxslt.registerExtModuleFunction("encode-for-uri", cscUri, cscEncodeForUri)
|
||||||
libxslt.registerExtModuleFunction("term", cscUri, cscTerm)
|
libxslt.registerExtModuleFunction("term", cscUri, cscTerm)
|
||||||
libxslt.registerExtModuleFunction("member-list", cscUri, cscMemberList)
|
libxslt.registerExtModuleFunction("member-list", cscUri, cscMemberList)
|
||||||
|
libxslt.registerExtModuleFunction("position-list", cscUri, cscPositionList)
|
||||||
libxslt.registerExtModuleFunction("email", cscUri, cscEmail)
|
libxslt.registerExtModuleFunction("email", cscUri, cscEmail)
|
||||||
|
|
||||||
# parse xml/xslt and apply style-sheet
|
# parse xml/xslt and apply style-sheet
|
||||||
|
|
37
xsl/exec.xsl
37
xsl/exec.xsl
|
@ -1,37 +0,0 @@
|
||||||
<?xml version='1.0'?>
|
|
||||||
|
|
||||||
<xsl:stylesheet version="1.0"
|
|
||||||
xmlns="http://www.w3.org/1999/xhtml"
|
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
||||||
xmlns:csc="http://csclub.uwaterloo.ca/xsltproc">
|
|
||||||
|
|
||||||
<xsl:template match="execlist">
|
|
||||||
<h3>Elected positions</h3>
|
|
||||||
<ul>
|
|
||||||
<xsl:apply-templates select="exec[@type='elected']" />
|
|
||||||
</ul>
|
|
||||||
<h3>Appointed positions</h3>
|
|
||||||
<ul>
|
|
||||||
<xsl:apply-templates select="exec[@type='appointed']" />
|
|
||||||
</ul>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="exec">
|
|
||||||
<li>
|
|
||||||
<xsl:value-of select="@name" /> is this term's <b>
|
|
||||||
<xsl:value-of select="@position" /></b>. You can <a
|
|
||||||
href="mailto:{@userid}@csclub.uwaterloo.ca">e-mail the
|
|
||||||
<xsl:value-of select="@position" /></a>
|
|
||||||
<xsl:if test="not(@href='')">
|
|
||||||
or <a href="{@href}">visit
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="@sex='male'"> his </xsl:when>
|
|
||||||
<xsl:when test="@sex='female'"> her </xsl:when>
|
|
||||||
<xsl:otherwise> his or her </xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
homepage</a>
|
|
||||||
</xsl:if>.
|
|
||||||
</li>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
</xsl:stylesheet>
|
|
|
@ -38,7 +38,7 @@
|
||||||
<xsl:include href="common.xsl" />
|
<xsl:include href="common.xsl" />
|
||||||
<xsl:include href="directory.xsl" />
|
<xsl:include href="directory.xsl" />
|
||||||
<xsl:include href="menu.xsl" />
|
<xsl:include href="menu.xsl" />
|
||||||
<xsl:include href="exec.xsl" />
|
<xsl:include href="positions.xsl" />
|
||||||
<xsl:include href="members.xsl" />
|
<xsl:include href="members.xsl" />
|
||||||
<xsl:include href="events.xsl" />
|
<xsl:include href="events.xsl" />
|
||||||
<xsl:include href="news.xsl" />
|
<xsl:include href="news.xsl" />
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version='1.0'?>
|
||||||
|
|
||||||
|
<xsl:stylesheet version="1.0"
|
||||||
|
xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:csc="http://csclub.uwaterloo.ca/xsltproc">
|
||||||
|
|
||||||
|
<xsl:template match="positions">
|
||||||
|
<xsl:variable name="exec" select="@exec" />
|
||||||
|
<xsl:for-each select="csc:position-list('')/position[@exec=$exec]">
|
||||||
|
<xsl:sort select="@order" order="ascending" />
|
||||||
|
<p>
|
||||||
|
<div class="position">
|
||||||
|
<a href="mailto:{@position}@csclub.uwaterloo.ca"><xsl:value-of select="@name" /></a>
|
||||||
|
</div>
|
||||||
|
<xsl:if test="not(holder)">Vacant</xsl:if>
|
||||||
|
<xsl:for-each select="holder">
|
||||||
|
<xsl:value-of select="@name" /><br />
|
||||||
|
</xsl:for-each>
|
||||||
|
</p>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
Loading…
Reference in New Issue