~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/apps/groups/__init__.py

  • Committer: wagrant
  • Date: 2008-08-10 11:25:42 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1008
groups: Pretty up a bit. Remove buttons that did nothing and won't for
        months. Also actually list the members of one's own groups.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
    Show the group management panel for a particular subject.
86
86
    Prints to req.
87
87
    """
 
88
    # Get the groups this user is in, for this offering
 
89
    groups = db.get_groups_by_user(req.user.login, offeringid=offeringid)
 
90
    if len(groups) == 0:
 
91
        return
 
92
 
88
93
    req.write("<div id=\"subject%d\"class=\"subject\">"%offeringid)
89
94
    req.write("<h1>%s</h1>\n" % cgi.escape(subj_name))
90
 
    # Get the groups this user is in, for this offering
91
 
    groups = db.get_groups_by_user(req.user.login, offeringid=offeringid)
92
95
    for groupid, groupnm, group_nick, is_member in groups:
93
96
        if group_nick is None:
94
97
            group_nick = "";
95
98
        req.write("<h2>%s (%s)</h2>\n" %
96
99
            (cgi.escape(group_nick), cgi.escape(groupnm)))
97
100
        if is_member:
98
 
            req.write('<p>You are in this group.\n'
99
 
                '  <input type="button" onclick="manage(&quot;%s&quot;)" '
100
 
                'value="Manage" /></p>\n' % (cgi.escape(groupnm)))
 
101
            req.write('<p>You are a member of this group.</p>\n')
101
102
        else:
102
103
            req.write('<p>You have been invited to this group.</p>\n')
103
104
            req.write('<p>'
109
110
                'value="Decline" />\n'
110
111
                '</p>\n' % {"groupnm": cgi.escape(groupnm)})
111
112
        req.write("<h3>Members</h3>\n")
112
 
        req.write("<table>\n")
113
 
        # TODO: Fill in members table
114
 
        req.write("</table>\n")
 
113
        req.write("<ul>\n")
 
114
        for user in db.get_projectgroup_members(groupid):
 
115
            req.write("<li>%s (%s)</li>" %
 
116
                      (cgi.escape(user['fullname']),
 
117
                       cgi.escape(user['login'])))
 
118
        req.write("</ul>\n")
115
119
 
116
 
    if True:        # XXX Only if offering allows students to create groups
117
 
        req.write('<input type="button" onclick="create(%d)" '
118
 
            'value="Create Group" />\n' % offeringid)
119
120
    req.write("</div>")