Created active clubs page.
This commit is contained in:
parent
a2a4a38723
commit
0c0073e84d
|
@ -1,4 +1,4 @@
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
RewriteBase /~j3parker/
|
RewriteBase /~satalha/www/
|
||||||
RewriteRule ^pub/(.*) - [L]
|
RewriteRule ^pub/(.*) - [L]
|
||||||
RewriteRule ^(.*) bin/web [L]
|
RewriteRule ^(.*) bin/web [L]
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
#!/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
|
||||||
|
|
||||||
|
cscClubBase = 'ou=People, dc=csclub, dc=uwaterloo, dc=ca'
|
||||||
|
cscGroupBase = 'ou=Group, dc=csclub, dc=uwaterloo, dc=ca'
|
||||||
|
cscPeopleBase = 'ou=People,dc=csclub,dc=uwaterloo,dc=ca'
|
||||||
|
|
||||||
|
|
||||||
|
def cscLdapConnect():
|
||||||
|
global cscLdap
|
||||||
|
cscLdap = ldap.initialize(cscLdapUri)
|
||||||
|
cscLdap.simple_bind_s("", "")
|
||||||
|
|
||||||
|
cscLdapConnect()
|
||||||
|
|
||||||
|
curDate = time.strftime('%d-%m-%Y')
|
||||||
|
year = time.localtime().tm_year
|
||||||
|
term = cscShortTerms[int(time.localtime().tm_mon - 1) / 4]
|
||||||
|
term2 = cscTerms[int(time.localtime().tm_mon - 1) / 4]
|
||||||
|
|
||||||
|
|
||||||
|
clubs = cscLdap.search_s(cscClubBase, ldap.SCOPE_SUBTREE, '(&(objectClass=club))')
|
||||||
|
groups = cscLdap.search_s(cscGroupBase, ldap.SCOPE_SUBTREE, '(&(objectClass=group))')
|
||||||
|
members = cscLdap.search_s(cscPeopleBase, ldap.SCOPE_SUBTREE,'(&(objectClass=member)(|(term=%s%d)(nonMemberTerm=%s%d)))' % (term, year, term, year))
|
||||||
|
|
||||||
|
|
||||||
|
clubs.sort(key=lambda (_, y): y['cn'][0])
|
||||||
|
print "<h1>Clubs This Term</h1>"
|
||||||
|
print "<center>"
|
||||||
|
print "<table>"
|
||||||
|
print " <tr><th>Name</th></tr>"
|
||||||
|
|
||||||
|
|
||||||
|
def doshit(club):
|
||||||
|
for (_, group) in groups:
|
||||||
|
if group['cn'][0] == club['uid'][0] and group.has_key('uniqueMember'):
|
||||||
|
for clubrep in group['uniqueMember']:
|
||||||
|
clubrepname = clubrep.split(",")[0][4:]
|
||||||
|
for (_, member) in members:
|
||||||
|
if member['uid'][0] == clubrepname:
|
||||||
|
print " <tr>"
|
||||||
|
print " <td><a href=\"http://csclub.uwaterloo.ca/~" + club['uid'][0] + "\">" + club['cn'][0] + "</a></td>"
|
||||||
|
print " </tr>"
|
||||||
|
return
|
||||||
|
|
||||||
|
for (_, club) in clubs:
|
||||||
|
doshit(club)
|
||||||
|
|
||||||
|
print "</table>"
|
||||||
|
print "</center>"
|
|
@ -1,6 +1,6 @@
|
||||||
import std.regex;
|
import std.regex;
|
||||||
|
|
||||||
const string url_root = "/~j3parker/";
|
const string url_root = "/~satalha/www/";
|
||||||
const string site_title = "CSC";
|
const string site_title = "CSC";
|
||||||
const string site_subtitle = "UWaterloo Computer Science Club";
|
const string site_subtitle = "UWaterloo Computer Science Club";
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ void init_handlers() {
|
||||||
handler!("^About/Members/$").add("members.py");
|
handler!("^About/Members/$").add("members.py");
|
||||||
handler!("^About/Members/(.+)$").add("member_info.py");
|
handler!("^About/Members/(.+)$").add("member_info.py");
|
||||||
handler!("^About/Executive$").add("exec_positions.py");
|
handler!("^About/Executive$").add("exec_positions.py");
|
||||||
|
handler!("^About/Clubs/$").add("clubs.py");
|
||||||
}
|
}
|
||||||
|
|
||||||
template handler(string pattern) {
|
template handler(string pattern) {
|
||||||
|
|
Loading…
Reference in New Issue