~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: 2010-02-24 01:21:07 UTC
  • Revision ID: grantw@unimelb.edu.au-20100224012107-e02qr9ce1ftg05y5
Remove unused UserRESTView and associated infrastructure.

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
        ctx['title_img'] = media_url(req, CorePlugin,
107
107
                                     "images/chrome/root-breadcrumb.png")
108
108
        try:
109
 
            ctx['ancestry'] = self.get_context_ancestry(req)
 
109
            ancestry = self.get_context_ancestry(req)
110
110
        except NoPath:
111
 
            ctx['ancestry'] = []
112
 
 
113
 
        # If the view has specified text for a breadcrumb, add one.
114
 
        if self.breadcrumb_text:
115
 
            ctx['extra_breadcrumbs'] = [ViewBreadcrumb(req, self)]
116
 
        else:
117
 
            ctx['extra_breadcrumbs'] = []
118
 
 
119
 
        # Allow the view to add its own fake breadcrumbs.
120
 
        ctx['extra_breadcrumbs'] += self.extra_breadcrumbs
121
 
 
122
 
        ctx['crumb'] = Breadcrumber(req).crumb
 
111
            ancestry = []
 
112
 
 
113
        crumber = Breadcrumber(req)
 
114
 
 
115
        ctx['breadcrumbs'] = []
 
116
        if not req.publicmode:
 
117
            for ancestor in ancestry:
 
118
                crumb = crumber.crumb(ancestor)
 
119
                if crumb is None:
 
120
                    continue
 
121
 
 
122
                if hasattr(crumb, 'extra_breadcrumbs_before'):
 
123
                    ctx['breadcrumbs'].extend(crumb.extra_breadcrumbs_before)
 
124
                ctx['breadcrumbs'].append(crumb)
 
125
                if hasattr(crumb, 'extra_breadcrumbs_after'):
 
126
                    ctx['breadcrumbs'].extend(crumb.extra_breadcrumbs_after)
 
127
 
 
128
            # If the view has specified text for a breadcrumb, add one.
 
129
            if self.breadcrumb_text:
 
130
                ctx['breadcrumbs'].append(ViewBreadcrumb(req, self))
 
131
 
 
132
            # Allow the view to add its own fake breadcrumbs.
 
133
            ctx['breadcrumbs'].extend(self.extra_breadcrumbs)
 
134
 
123
135
        self.populate_headings(req, ctx)
124
136
        tmpl = loader.load(os.path.join(os.path.dirname(__file__), 
125
137
                                                        'ivle-headings.html'))
151
163
                continue
152
164
 
153
165
            for tab in plugin.tabs:
154
 
                # tab is a tuple: name, title, desc, icon, path
 
166
                # tab is a tuple: name, title, desc, icon, path, weight, admin
 
167
                # (Admin is optional, defaults to false)
155
168
                new_app = {}
156
169
                new_app['this_app'] = hasattr(self, 'tab') \
157
170
                                      and tab[0] == self.tab
165
178
                        ctx['favicon'] = icon_url
166
179
                else:
167
180
                    new_app['has_icon'] = False
 
181
                # The following check is here, so it is AFTER setting the
 
182
                # icon, but BEFORE actually installing the tab in the menu
 
183
                if len(tab) > 6 and tab[6]:
 
184
                    # Admin-only tab
 
185
                    if not (req.user and req.user.admin):
 
186
                        break
168
187
                new_app['path'] = req.make_path(tab[4])
169
188
                new_app['desc'] = tab[2]
170
189
                new_app['name'] = tab[1]
226
245
    def populate(self, req, ctx):
227
246
        ctx['req'] = req
228
247
        ctx['exception'] = self.context
 
248
        req.headers_out['X-IVLE-Error'] = self.context.message
229
249
 
230
250
class XHTMLUnauthorizedView(XHTMLErrorView):
231
251
    template = 'xhtmlunauthorized.html'