tidying some stuff up, added elections page

This commit is contained in:
Jacob Parker 2012-02-23 00:21:50 -05:00
parent c49e0d942a
commit fd2fefc649
6 changed files with 58 additions and 2 deletions

47
bin/exec_positions.py Executable file
View File

@ -0,0 +1,47 @@
#!/usr/bin/python
import ldap, time, operator
#
# globals
#
cscUri = "http://csclub.uwaterloo.ca/xsltproc"
cscTerms = ["Winter", "Spring", "Fall"]
cscShortTerms = ['w', 's', 'f']
cscLdapUri = "ldap://ldap1.csclub.uwaterloo.ca ldap://ldap2.csclub.uwaterloo.ca"
cscLdap = None
cscPeopleBase = 'ou=People,dc=csclub,dc=uwaterloo,dc=ca'
def cscLdapConnect():
global cscLdap
cscLdap = ldap.initialize(cscLdapUri)
cscLdap.simple_bind_s("", "")
cscLdapConnect()
def showExec(pretty, short):
print "<p><b>" + pretty + "</b><br>"
members = cscLdap.search_s(cscPeopleBase, ldap.SCOPE_SUBTREE,
'(&(objectClass=member)(position=%s))' % short)
if len(members) > 0:
(_, user) = members[0]
print user['cn'][0]
else:
print 'Seat Empty'
print "</p>"
print "<h1>The Executive</h1>"
showExec("President", "president")
showExec("Vice-President", "vice-president")
showExec("Treasurer", "treasurer")
showExec("Secretary", "secretary")
showExec("Systems Administrator", "sysadmin")
print "<h1>Other Positions</h1>"
showExec("Chief Returning Officer", "cro")
showExec("Office Manager", "offsck")
showExec("Librarian", "librarian")
print "<h1>Elections</h1>"
print "<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 homepage and the <a href=\"http://csclub.uwaterloo.ca/newsgroup/thread.php?group=uw.csc\">uw.csc</a> newsgroup.<br>"
print "</p><p>For details on the election rules, see the <a href=\"../Constitution\">constitution</a>."
print "</p>"

View File

@ -28,6 +28,11 @@ print "<h1>Profile for " + user['cn'][0] + "</h1>"
print "<p>" print "<p>"
print "<ul>" print "<ul>"
if "position" in user:
print "<li>Executive Position: "
for x in user['position']:
print x # edge case - could hold multiple positions!
print "</li>"
print "<li>Terms: " print "<li>Terms: "
for t in sorted(user['term']): for t in sorted(user['term']):
print t + " " print t + " "

View File

@ -24,6 +24,7 @@ term2 = cscTerms[int(time.localtime().tm_mon - 1) / 4]
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))
members.sort(key=lambda (_, y): y['cn'][0]) members.sort(key=lambda (_, y): y['cn'][0])
print "<h1>Members This Term</h1>"
print "<p>The members for " + term2 + " " + str(year) + " are listed here. We currently have " + str(len(members)) + " members.<br>" print "<p>The members for " + term2 + " " + str(year) + " are listed here. We currently have " + str(len(members)) + " members.<br>"
print "Use of this list for solicitation of any form is prohibited. If you wish to get in touch with the membership as a whole please contact <a href=\"mailto:exec@csclub.uwaterloo.ca\">the Executive</a>.</p>" print "Use of this list for solicitation of any form is prohibited. If you wish to get in touch with the membership as a whole please contact <a href=\"mailto:exec@csclub.uwaterloo.ca\">the Executive</a>.</p>"
print "<center>" print "<center>"

View File

@ -14,4 +14,5 @@ void init_handlers() {
handlers["changelog"] = "changelog.sh"; handlers["changelog"] = "changelog.sh";
handlers["About/Members/"] = "members.py"; handlers["About/Members/"] = "members.py";
handlers["About/Members/?*"] = "member_info.py"; handlers["About/Members/?*"] = "member_info.py";
handlers["About/Executive/"] = "exec_positions.py";
} }

View File

@ -71,7 +71,9 @@ void do_header() {
html("<a href=\"http://git.csclub.uwaterloo.ca/\">git</a>"); html("<a href=\"http://git.csclub.uwaterloo.ca/\">git</a>");
html("<a href=\"http://mirror.csclub.uwaterloo.ca/\">mirror</a>"); html("<a href=\"http://mirror.csclub.uwaterloo.ca/\">mirror</a>");
html("<a href=\"http://csclub.uwaterloo.ca/stats\">stats</a>"); html("<a href=\"http://csclub.uwaterloo.ca/stats\">stats</a>");
html("<a href=\"http://mail.csclub.uwaterloo.ca/\">mail</a>"); html("<a href=\"http://mail.csclub.uwaterloo.ca/\">webmail</a>");
html("<a href=\"http://csclub.uwaterloo.ca/newsgroup/\">newsgroups</a>");
html("<a href=\"http://csclub.uwaterloo.ca/mailman/\">mailing lists</a>");
html_pop("</div>"); html_pop("</div>");
html_push("<div class=\"right\">"); html_push("<div class=\"right\">");

View File

@ -1,4 +1,4 @@
<h2>1. </h2> <h2>1. Name</h2>
The name of this organization shall be the "Computer Science Club The name of this organization shall be the "Computer Science Club
of the University of Waterloo". of the University of Waterloo".