MobileBlur

menu.py at [b28babbbb4]
Login

menu.py at [b28babbbb4]

File applications/admin/models/menu.py artifact 3ef86ec614 part of check-in b28babbbb4


# ###########################################################
# ## generate menu
# ###########################################################

_a = request.application
_c = request.controller
_f = request.function
response.title = '%s %s' % (_f, '/'.join(request.args))
response.subtitle = 'admin'
response.menu = [(T('Site'), _f == 'site', URL(_a,'default','site'))]

if request.args:
    _t = request.args[0]
    response.menu.append((T('Edit'), _c == 'default' and _f == 'design',
                         URL(_a,'default','design',args=_t)))
    response.menu.append((T('About'), _c == 'default' and _f == 'about',
                         URL(_a,'default','about',args=_t)))
    response.menu.append((T('Errors'), _c == 'default' and _f == 'errors',
                         URL(_a,'default','errors',args=_t)))
    response.menu.append((T('Versioning'),
                          _c == 'mercurial' and _f == 'commit',
                          URL(_a,'mercurial','commit',args=_t)))

if not session.authorized:
    response.menu = [(T('Login'), True, '')]
else:
    response.menu.append((T('Logout'), False,
                          URL(_a,'default',f='logout')))

if os.path.exists('applications/examples'):
    response.menu.append((T('Help'), False, URL('examples','default','index')))
else:
    response.menu.append((T('Help'), False, 'http://web2py.com/examples'))