'CAP menu'

@staticmethod
def cap():

    if (current.request.get_vars['~.external'] == 'True'):
        return M(c='cap')(M('Alert    Hub', f='alert', vars={'~.external': True})(M('Map    View', c='default', f='index', args=['alert_hub_cop'])))
    else:
        s3_has_role = current.auth.s3_has_role
        cap_editors = (lambda i: (s3_has_role('ALERT_EDITOR') or s3_has_role('ALERT_APPROVER')))
        return M(c='cap')(M('Alerts', f='alert')(M('Create', m='create', check=cap_editors), M('Import    from    Feed    URL', m='import_feed', p='create', check=cap_editors), M('View    on    Map', c='default', f='index', args=['alert_map']), M('To    Review', c='cap', f='alert', m='review', check=s3_has_role('ALERT_APPROVER'))), M('View', check=cap_editors)(M('Approved    Alerts', c='cap', f='alert', vars={'~.approved_by__ne': None}), M('Incomplete    Alerts', c='cap', f='alert', m='review', vars={'status': 'incomplete'})), M('Templates', f='template')(M('Create', m='create', restrict=['ADMIN'])), M('Warning    Classifications', f='warning_priority', restrict=['ADMIN'])(M('Create', m='create'), M('Import    from    CSV', m='import', p='create')), M('Predefined    Alert    Area', f='area', vars={'~.is_template': True}, restrict=['ADMIN'])(M('Create', m='create'), M('Import    from    CSV', m='import', p='create')), M('Event    Types', c='event', f='event_type', restrict=['ADMIN'])(M('Create', m='create'), M('Import    from    CSV', m='import', p='create')))
