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

925 by mattgiuca
Added "groups" app. No code within the app just yet.
1
# IVLE
2
# Copyright (C) 2007-2008 The University of Melbourne
3
#
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
1099.1.56 by William Grant
ivle.webapp.groups: Remove most of the view code; the template now accesses
18
# Author: Matt Giuca, Will Grant
19
20
'''
21
Allows students and tutors to manage project groups.
22
'''
23
24
# TODO Does not distinguish between current and past subjects.
926 by mattgiuca
db: Added get_enrolment and get_groups_by_user methods to retrieve details
25
1080.1.43 by William Grant
www/apps/groups: Clean up imports.
26
from ivle import caps
27
from ivle.database import Subject
1093 by chadnickbok
Adding the changes from my genshi branch into trunk.
28
1099.1.72 by Nick Chadwick
Dispatch now generates an index for each plugin type, allowing plugins to
29
from ivle.webapp.base.plugins import ViewPlugin
1099.1.34 by William Grant
Split up ivle.webapp.base.views into ivle.webapp.base.{rest,xhtml}, as it was
30
from ivle.webapp.base.xhtml import XHTMLView
1099.1.17 by Nick Chadwick
Moved groups over to the new class-based xhtml templating way of being
31
32
class GroupsView(XHTMLView):
33
    """
34
    The groups view
35
    """
1099.1.35 by William Grant
ivle.webapp.base.xhtml#XHTMLView: Rename app_template to template (the things
36
    template = 'template.html'
37
    appname = 'groups' # XXX
1099.1.18 by William Grant
ivle.webapp.base.views#XHTMLView: Set the content type to text/html.
38
1099.1.17 by Nick Chadwick
Moved groups over to the new class-based xhtml templating way of being
39
    def populate(self, req, ctx):
1099.1.69 by William Grant
Move ivle.webapp.groups' media to the new framework.
40
        self.plugin_styles[Plugin] = ['groups.css']
41
        self.plugin_scripts[Plugin] = ['groups.js']
1099.1.18 by William Grant
ivle.webapp.base.views#XHTMLView: Set the content type to text/html.
42
1099.1.17 by Nick Chadwick
Moved groups over to the new class-based xhtml templating way of being
43
        # Show a group panel per enrolment
1099.1.56 by William Grant
ivle.webapp.groups: Remove most of the view code; the template now accesses
44
        ctx['get_user_groups'] = req.user.get_groups
45
        ctx['enrolments'] = req.user.active_enrolments
46
        ctx['manage_subjects'] = req.store.find(Subject) if \
47
              req.user.hasCap(caps.CAP_MANAGEGROUPS) else []
1099.1.18 by William Grant
ivle.webapp.base.views#XHTMLView: Set the content type to text/html.
48
49
1099.1.72 by Nick Chadwick
Dispatch now generates an index for each plugin type, allowing plugins to
50
class Plugin(ViewPlugin):
1099.1.17 by Nick Chadwick
Moved groups over to the new class-based xhtml templating way of being
51
    """
1099.1.56 by William Grant
ivle.webapp.groups: Remove most of the view code; the template now accesses
52
    The Plugin class for the group admin plugin.
1099.1.17 by Nick Chadwick
Moved groups over to the new class-based xhtml templating way of being
53
    """
54
    urls = [
55
        ('groups/', GroupsView),
1001 by dcoles
Groups: Added the view half of the group admin panel. This lets people with the
56
    ]
1099.1.69 by William Grant
Move ivle.webapp.groups' media to the new framework.
57
58
    media = 'media'