Ejemplo n.º 1
0
def is_active(link, req_path):
    current = Page.get_page(req_path)
    while(current != None):
        if (current == link):
            return "active"
        current = current.parent
    return "no-active"
Ejemplo n.º 2
0
def title(path, dynamic_title = ''):
    page = Page.get_page(path)
    if (page == None): return dynamic_title;
    
    title = page.title
    if (page.html_title != '' and page.html_title != None): title = page.html_title
    
    if (dynamic_title):
        return '%s - %s' % (title, dynamic_title)
    return title
Ejemplo n.º 3
0
def submenu(path):
    parent = Page.get_page(path)
    if (parent):
        while(parent.parent != None):
            parent = parent.parent
        pages = Page.objects.filter(parent = parent, order__isnull = False).order_by('order')
        for page in pages:
            if (not page.is_active()):
                pages = pages.exclude(pk = page.id)
        return {'pages': pages, 'path': path}
    else:
        return
Ejemplo n.º 4
0
def subsubmenu(context, path, form = None):
    if not form and context.has_key('form'):
        form = context['form']
    parent = Page.get_page(path)
    if (parent and parent.parent):
        while(parent.parent.parent != None):
            parent = parent.parent
        pages = Page.objects.filter(parent = parent, order__isnull = False).order_by('order')
        for page in pages:
            if (not page.is_active()):
                pages = pages.exclude(pk = page.id)
        return {'pages': pages, 'path': path, 'form': form, 'STATIC_URL': context['STATIC_URL']}
    else:
        return {'form': form, 'STATIC_URL': context['STATIC_URL']}
Ejemplo n.º 5
0
def meta(path, meta = []):
    page = Page.get_page(path)
    if (page == None): return {'meta_tags': None}
    meta_tags = list(page.meta_data.all())
    meta_tags += meta
    return {'meta_tags': meta_tags}