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

1294.2.89 by William Grant
Add an Offering breadcrumb.
1
# IVLE - Informatics Virtual Learning Environment
2
# Copyright (C) 2007-2009 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
1472 by William Grant
Add a 'Users' breadcrumb.
18
19
class UsersBreadcrumb(object):
20
    @property
21
    def url(self):
22
        return '/users'
23
24
    @property
25
    def text(self):
26
        return 'Users'
27
28
1294.2.96 by William Grant
Add a UserBreadcrumb.
29
class UserBreadcrumb(object):
30
    def __init__(self, req, context):
31
        self.req = req
32
        self.context = context
33
34
    @property
35
    def url(self):
1294.2.118 by William Grant
Merge from object-publishing.
36
        return self.req.publisher.generate(self.context)
1294.2.96 by William Grant
Add a UserBreadcrumb.
37
38
    @property
39
    def text(self):
40
        return self.context.nick
41
1472 by William Grant
Add a 'Users' breadcrumb.
42
    @property
43
    def extra_breadcrumbs_before(self):
44
        return [UsersBreadcrumb()]
45
46
1294.2.94 by William Grant
Add a SubjectBreadcrumb.
47
class SubjectBreadcrumb(object):
48
    def __init__(self, req, context):
49
        self.req = req
50
        self.context = context
51
52
    @property
53
    def text(self):
54
        return self.context.name
55
1472 by William Grant
Add a 'Users' breadcrumb.
56
1294.2.89 by William Grant
Add an Offering breadcrumb.
57
class OfferingBreadcrumb(object):
58
    def __init__(self, req, context):
59
        self.req = req
60
        self.context = context
61
62
    @property
63
    def url(self):
1294.2.118 by William Grant
Merge from object-publishing.
64
        return self.req.publisher.generate(self.context)
1294.2.89 by William Grant
Add an Offering breadcrumb.
65
66
    @property
67
    def text(self):
68
        return '%s semester %s' % (self.context.semester.year,
69
                                   self.context.semester.semester)
70
1472 by William Grant
Add a 'Users' breadcrumb.
71
1294.2.98 by William Grant
Add a ProjectBreadcrumb.
72
class ProjectBreadcrumb(object):
73
    def __init__(self, req, context):
74
        self.req = req
75
        self.context = context
76
77
    @property
78
    def url(self):
1294.2.118 by William Grant
Merge from object-publishing.
79
        return self.req.publisher.generate(self.context)
1294.2.98 by William Grant
Add a ProjectBreadcrumb.
80
81
    @property
82
    def text(self):
83
        return self.context.name
84