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

« back to all changes in this revision

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

  • Committer: Matt Giuca
  • Date: 2010-02-11 04:36:24 UTC
  • Revision ID: matt.giuca@gmail.com-20100211043624-ofjcxwju8e8bkncl
user.py: All user pages are now in the tab "users", so they show the user icon
    rather than no icon. This affects normal users as well as admins.
xhtml.py: Check the "admin-only" status of a tab after setting the page icon,
    so that normal users get the nice icon even if they aren't supposed to see
    the tab in the menu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
            for tab in plugin.tabs:
165
165
                # tab is a tuple: name, title, desc, icon, path, weight, admin
166
166
                # (Admin is optional, defaults to false)
167
 
                if len(tab) > 6 and tab[6]:
168
 
                    # Admin-only tab
169
 
                    if not (req.user and req.user.admin):
170
 
                        break
171
167
                new_app = {}
172
168
                new_app['this_app'] = hasattr(self, 'tab') \
173
169
                                      and tab[0] == self.tab
181
177
                        ctx['favicon'] = icon_url
182
178
                else:
183
179
                    new_app['has_icon'] = False
 
180
                # The following check is here, so it is AFTER setting the
 
181
                # icon, but BEFORE actually installing the tab in the menu
 
182
                if len(tab) > 6 and tab[6]:
 
183
                    # Admin-only tab
 
184
                    if not (req.user and req.user.admin):
 
185
                        break
184
186
                new_app['path'] = req.make_path(tab[4])
185
187
                new_app['desc'] = tab[2]
186
188
                new_app['name'] = tab[1]