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

« back to all changes in this revision

Viewing changes to ivle/webapp/base/xhtml.py

  • Committer: William Grant
  • Date: 2009-07-05 10:15:07 UTC
  • mto: (1294.4.2 ui-the-third)
  • mto: This revision was merged to the branch mainline in revision 1353.
  • Revision ID: grantw@unimelb.edu.au-20090705101507-b1136topin21e1cr
Add a UserBreadcrumb.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    plugin_styles = {}
45
45
    scripts_init = []
46
46
 
47
 
    extra_breadcrumbs = []
48
 
 
49
47
    allow_overlays = True
50
48
    overlay_blacklist = []
51
49
 
52
 
    def get_context_ancestry(self, req):
53
 
        return req.router.get_ancestors(self.context)
54
 
 
55
50
    def filter(self, stream, ctx):
56
51
        return stream
57
52
 
101
96
        ctx['title_img'] = media_url(req, CorePlugin,
102
97
                                     "images/chrome/root-breadcrumb.png")
103
98
        try:
104
 
            ctx['ancestry'] = self.get_context_ancestry(req)
 
99
            ctx['ancestry'] = req.router.get_ancestors(self.context)
105
100
        except NoPath:
106
101
            ctx['ancestry'] = []
107
 
 
108
 
        # Allow the view to add its own fake breadcrumbs.
109
 
        ctx['extra_breadcrumbs'] = self.extra_breadcrumbs
110
 
 
111
102
        ctx['crumb'] = Breadcrumber(req).crumb
112
103
        self.populate_headings(req, ctx)
113
104
        tmpl = loader.load(os.path.join(os.path.dirname(__file__), 
205
196
class XHTMLErrorView(XHTMLView):
206
197
    template = 'xhtmlerror.html'
207
198
 
208
 
    def __init__(self, req, context, lastobj):
209
 
        super(XHTMLErrorView, self).__init__(req, context)
210
 
        self.lastobj = lastobj
211
 
 
212
 
    def get_context_ancestry(self, req):
213
 
        return req.router.get_ancestors(self.lastobj)
214
 
 
215
199
    def populate(self, req, ctx):
216
200
        ctx['req'] = req
217
201
        ctx['exception'] = self.context
219
203
class XHTMLUnauthorizedView(XHTMLErrorView):
220
204
    template = 'xhtmlunauthorized.html'
221
205
 
222
 
    def __init__(self, req, exception, lastobj):
223
 
        super(XHTMLUnauthorizedView, self).__init__(req, exception, lastobj)
 
206
    def __init__(self, req, exception):
 
207
        super(XHTMLUnauthorizedView, self).__init__(req, exception)
224
208
 
225
209
        if req.user is None:
226
210
            # Not logged in. Redirect to login page.