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
context must be a ProjectSet.
99
def __init__(self, req, context):
101
self.context = context
105
return self.req.publisher.generate(self.context.offering, None,
113
class ProjectBreadcrumb(object):
114
def __init__(self, req, context):
116
self.context = context
120
return self.req.publisher.generate(self.context)
124
return self.context.name
127
def extra_breadcrumbs_before(self):
128
return [ProjectsBreadcrumb(self.req, self.context.project_set)]
131
class EnrolmentsBreadcrumb(object):
132
"""Static 'Enrolments' breadcrumb to precede EnrolmentBreadcrumb."""
133
def __init__(self, req, context):
135
self.context = context
139
return self.req.publisher.generate(self.context, None, '+enrolments')
146
class EnrolmentBreadcrumb(object):
147
def __init__(self, req, context):
149
self.context = context
153
return self.context.user.fullname
156
def extra_breadcrumbs_before(self):
157
return [EnrolmentsBreadcrumb(self.req, self.context.offering)]