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 |
||
1129
by William Grant
Move the group admin view to per-offering. |
24 |
from ivle.database import Subject, Offering, Semester |
1093
by chadnickbok
Adding the changes from my genshi branch into trunk. |
25 |
|
1099.1.99
by William Grant
Require that plugins providing media subclass MediaPlugin. |
26 |
from ivle.webapp.base.plugins import ViewPlugin, MediaPlugin |
1099.1.34
by William Grant
Split up ivle.webapp.base.views into ivle.webapp.base.{rest,xhtml}, as it was |
27 |
from ivle.webapp.base.xhtml import XHTMLView |
1135
by William Grant
Subject URLs now contain the short name (eg. info1) rather than the code |
28 |
from ivle.webapp.errors import NotFound |
1099.1.17
by Nick Chadwick
Moved groups over to the new class-based xhtml templating way of being |
29 |
|
30 |
class GroupsView(XHTMLView): |
|
31 |
"""
|
|
32 |
The groups view
|
|
33 |
"""
|
|
1099.1.35
by William Grant
ivle.webapp.base.xhtml#XHTMLView: Rename app_template to template (the things |
34 |
template = 'template.html' |
1146
by William Grant
Move Groups into the 'subjects' tab (giving it a favicon) and put the |
35 |
tab = 'subjects' |
1133
by William Grant
SubjectsView is now only accessible by people associated with subjects. |
36 |
permission = 'edit' |
1099.1.18
by William Grant
ivle.webapp.base.views#XHTMLView: Set the content type to text/html. |
37 |
|
1129
by William Grant
Move the group admin view to per-offering. |
38 |
def __init__(self, req, subject, year, semester): |
39 |
"""Find the given offering by subject, year and semester."""
|
|
40 |
self.context = req.store.find(Offering, |
|
41 |
Offering.subject_id == Subject.id, |
|
1135
by William Grant
Subject URLs now contain the short name (eg. info1) rather than the code |
42 |
Subject.short_name == subject, |
1129
by William Grant
Move the group admin view to per-offering. |
43 |
Offering.semester_id == Semester.id, |
44 |
Semester.year == year, |
|
45 |
Semester.semester == semester).one() |
|
1133
by William Grant
SubjectsView is now only accessible by people associated with subjects. |
46 |
|
1129
by William Grant
Move the group admin view to per-offering. |
47 |
if not self.context: |
48 |
raise NotFound() |
|
49 |
||
1099.1.17
by Nick Chadwick
Moved groups over to the new class-based xhtml templating way of being |
50 |
def populate(self, req, ctx): |
1099.1.69
by William Grant
Move ivle.webapp.groups' media to the new framework. |
51 |
self.plugin_styles[Plugin] = ['groups.css'] |
52 |
self.plugin_scripts[Plugin] = ['groups.js'] |
|
1099.1.18
by William Grant
ivle.webapp.base.views#XHTMLView: Set the content type to text/html. |
53 |
|
1129
by William Grant
Move the group admin view to per-offering. |
54 |
ctx['offering'] = self.context |
1099.1.18
by William Grant
ivle.webapp.base.views#XHTMLView: Set the content type to text/html. |
55 |
|
1099.1.99
by William Grant
Require that plugins providing media subclass MediaPlugin. |
56 |
class Plugin(ViewPlugin, MediaPlugin): |
1099.1.17
by Nick Chadwick
Moved groups over to the new class-based xhtml templating way of being |
57 |
"""
|
1099.1.56
by William Grant
ivle.webapp.groups: Remove most of the view code; the template now accesses |
58 |
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 |
59 |
"""
|
60 |
urls = [ |
|
1129
by William Grant
Move the group admin view to per-offering. |
61 |
('/subjects/:subject/:year/:semester/+groups/', GroupsView), |
1001
by dcoles
Groups: Added the view half of the group admin panel. This lets people with the |
62 |
]
|
1099.1.69
by William Grant
Move ivle.webapp.groups' media to the new framework. |
63 |
|
64 |
media = 'media' |
|
1099.1.100
by Nick Chadwick
Created a new help system. |
65 |
help = {'Groups': 'help.html'} |