~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-12-02 04:02:19 UTC
  • mto: This revision was merged to the branch mainline in revision 1353.
  • Revision ID: grantw@unimelb.edu.au-20091202040219-z2qumlxdkmestikd
Use a different set of routes for public mode, too.

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
 
            ancestry = self.get_context_ancestry(req)
 
109
            ctx['ancestry'] = self.get_context_ancestry(req)
110
110
        except NoPath:
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
 
 
 
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
135
123
        self.populate_headings(req, ctx)
136
124
        tmpl = loader.load(os.path.join(os.path.dirname(__file__), 
137
125
                                                        'ivle-headings.html'))
163
151
                continue
164
152
 
165
153
            for tab in plugin.tabs:
166
 
                # tab is a tuple: name, title, desc, icon, path, weight, admin
167
 
                # (Admin is optional, defaults to false)
 
154
                # tab is a tuple: name, title, desc, icon, path
168
155
                new_app = {}
169
156
                new_app['this_app'] = hasattr(self, 'tab') \
170
157
                                      and tab[0] == self.tab
178
165
                        ctx['favicon'] = icon_url
179
166
                else:
180
167
                    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
187
168
                new_app['path'] = req.make_path(tab[4])
188
169
                new_app['desc'] = tab[2]
189
170
                new_app['name'] = tab[1]