MobileBlur

Artifact Content
Login

Artifact 3ef86ec61425806a19674f4a173fa05f265cd931:


# ###########################################################
# ## 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'))