1 # vim: set et sw=4 sts=4 encoding=utf-8 foldmethod=marker :
3 from turbogears import url
4 from turbogears.identity import SecureResource
5 from turbogears import identity
8 def __init__(self, base):
10 self.items = [i for i in dir(base)
11 if isinstance(getattr(base, i), SecureResource)]
13 self.items = ['dashboard'] + self.items
16 if hasattr(c, 'hide_to_admin') and 'admin' in identity.current.permissions: return False
17 return c.require.eval_with_object(identity.current)
20 option = u"""<option value="%s">%s</option>" """
24 <select OnChange="window.location=this.options[this.selectedIndex].value;">
29 s = option % ('', '-----')
31 if i == 'dashboard' or self._check(getattr(self.base, i)):
32 s += option % (url('/' + i), i.capitalize().replace('_', ' '))