Ejemplo n.º 1
0
def navtree(request):
    """adds the variable 'navtree' to the context:
        [ { 'name': 'about', 'title': 'All about the site',
            'url': '/about/', 'children': [] },
          { 'name': 'news', 'title': 'Latest News',
            'url': '/news/', 'children':
            [ { 'name': 'August', 'title': 'August Archive',
                'url': '/news/aug/', 'children': [] }, ]]
    """
    navbar = get_navtree(request.user, MAX_DEPTH)
    if MARK_SELECTED: _mark_selected(request.path, navbar['byurl'])
    return {'navtree':  navbar['tree']}
Ejemplo n.º 2
0
def navtree(request):
    """adds the variable 'navtree' to the context:
        [ { 'name': 'about', 'title': 'All about the site',
            'url': '/about/', 'children': [] },
          { 'name': 'news', 'title': 'Latest News',
            'url': '/news/', 'children':
            [ { 'name': 'August', 'title': 'August Archive',
                'url': '/news/aug/', 'children': [] }, ]]
    """
    navbar = get_navtree(request.user, MAX_DEPTH)
    if MARK_SELECTED: _mark_selected(request.path, navbar['byurl'])
    return {'navtree': navbar['tree']}
Ejemplo n.º 3
0
def navbars(request):
    """adds the variable 'navbars' to the context"
    """
    nav = get_navtree(request.user, MAX_DEPTH)
    navbar = nav['tree']
    _mark_selected(request.path, nav['byurl'])
    navbars = [navbar]
    found = True
    while navbar and found:
        found = False
        for ent in navbar:
            if ent['selected']:
                navbar = ent['children']
                if navbar: navbars.append(navbar)
                found = True
                break
    if SHOW_DEPTH > len(navbars):
        navbars += [[]] * (SHOW_DEPTH - len(navbars))
    return {'navbars': navbars}
Ejemplo n.º 4
0
def navbars(request):
    """adds the variable 'navbars' to the context"
    """
    nav    = get_navtree(request.user, MAX_DEPTH)
    navbar = nav['tree']
    _mark_selected(request.path, nav['byurl'])
    navbars = [ navbar ]
    found = True
    while navbar and found:
        found = False
        for ent in navbar:
            if ent['selected']:
                navbar = ent['children']
                if navbar: navbars.append(navbar)
                found = True
                break;
    if SHOW_DEPTH > len(navbars):
        navbars += [[]]*(SHOW_DEPTH - len(navbars))
    return { 'navbars': navbars }