1
# IVLE - Informatics Virtual Learning Environment
2
# Copyright (C) 2007-2009 The University of Melbourne
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.
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.
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
19
class UsersBreadcrumb(object):
29
class UserBreadcrumb(object):
30
def __init__(self, req, context):
32
self.context = context
36
return self.req.publisher.generate(self.context)
40
perms = self.context.get_permissions(self.req.user, self.req.config)
41
# Show nickname iff current user has permission to view this user
42
# (Else, show just the login name)
44
return self.context.nick
46
return self.context.login
49
def extra_breadcrumbs_before(self):
50
return [UsersBreadcrumb()]
53
class SubjectsBreadcrumb(object):
62
class SubjectBreadcrumb(object):
63
def __init__(self, req, context):
65
self.context = context
69
return self.req.publisher.generate(self.context)
73
return self.context.name
76
def extra_breadcrumbs_before(self):
77
return [SubjectsBreadcrumb()]
80
class OfferingBreadcrumb(object):
81
def __init__(self, req, context):
83
self.context = context
87
return self.req.publisher.generate(self.context)
91
return '%s semester %s' % (self.context.semester.year,
92
self.context.semester.semester)
95
class ProjectsBreadcrumb(object):
96
"""Static 'Projects' breadcrumb to precede ProjectBreadcrumb."""
97
def __init__(self, req, context):
99
self.context = context
103
return self.req.publisher.generate(self.context, None, '+projects')
110
class ProjectBreadcrumb(object):
111
def __init__(self, req, context):
113
self.context = context
117
return self.req.publisher.generate(self.context)
121
return self.context.name
124
def extra_breadcrumbs_before(self):
125
return [ProjectsBreadcrumb(self.req, self.context.project_set.offering)]
128
class EnrolmentsBreadcrumb(object):
129
"""Static 'Enrolments' breadcrumb to precede EnrolmentBreadcrumb."""
130
def __init__(self, req, context):
132
self.context = context
136
return self.req.publisher.generate(self.context, None, '+enrolments')
143
class EnrolmentBreadcrumb(object):
144
def __init__(self, req, context):
146
self.context = context
150
return self.context.user.fullname
153
def extra_breadcrumbs_before(self):
154
return [EnrolmentsBreadcrumb(self.req, self.context.offering)]