Beispiel #1
0
    def build_footer_namespace(self, context):
        data = self.footer_data
        ns = get_menu_namespace(context,
            data['depth'], data['show_first_child'],
            flat=data['flat'], src=data['src'])

        here = context.resource
        # Manipulate directly the table handler
        footer = context.site_root.get_resource('%s/menu' % data['src'])
        handler = footer.handler
        records = list(handler.get_records_in_order())
        get_value = handler.get_record_value
        prefix = here.get_pathto(footer)
        # HOOK the namespace
        for index, item in enumerate(ns.get('items', [])):
            record = records[index]
            title = get_value(record, 'title')
            path = get_value(record, 'path')
            html_content = get_value(record, 'html_content')
            item['html'] = None
            if not path and not title and html_content:
                html = set_prefix(html_content, '%s/' % prefix)
                item['html'] = html
        ns['separator'] = data.get('separator', '|')

        # admin bar
        ns['admin_bar'] = get_admin_bar(footer.parent) # menu folder

        return ns
Beispiel #2
0
    def build_footer_namespace(self, context):
        data = self.footer_data
        ns = get_menu_namespace(context, data["depth"], data["show_first_child"], flat=data["flat"], src=data["src"])

        here = context.resource
        # Manipulate directly the table handler
        footer = context.site_root.get_resource("%s/menu" % data["src"])
        handler = footer.handler
        records = list(handler.get_records_in_order())
        get_value = handler.get_record_value
        prefix = here.get_pathto(footer)
        # HOOK the namespace
        for index, item in enumerate(ns.get("items", [])):
            record = records[index]
            title = get_value(record, "title")
            path = get_value(record, "path")
            html_content = get_value(record, "html_content")
            item["html"] = None
            if not path and not title and html_content:
                html = set_prefix(html_content, "%s/" % prefix)
                item["html"] = html
        ns["separator"] = data.get("separator", "|")

        # admin bar
        ns["admin_bar"] = get_admin_bar(footer.parent)  # menu folder

        return ns
Beispiel #3
0
 def get_namespace(self, resource, context):
     depth = 1
     show_first_child = False
     flat = None
     src = '%s/menu' % resource.get_abspath()
     menu = get_menu_namespace(context, depth, show_first_child, flat=flat,
                               src=src)
     if len(menu['items']) == 0 and not self.is_admin(resource, context):
         self.set_view_is_empty(True)
     return {'title': resource.get_title(),
             'menu': menu}
Beispiel #4
0
 def build_nav_namespace(self, context):
     data = self.nav_data
     menu = context.site_root.get_resource(data['src'])
     ns = get_menu_namespace(context,
         data['depth'], data['show_first_child'],
         flat=data['flat'], menu=menu)
     if is_navigation_mode(context) is True:
         return ns
     # Add [+] item in menu (To edit)
     ac = menu.get_access_control()
     if ac.is_allowed_to_edit(context.user, menu):
         ns['items'].append(
             {'active': False,
              'class': None,
              'description': None,
              'id': 'menu_edit_menu', # FIXME
              'in_path': False,
              'items': [],
              'path': context.get_link(menu),
              'real_path': menu.get_abspath(),
              'target': '_top',
              'title': u'+'})
     return ns
Beispiel #5
0
 def build_nav_namespace(self, context):
     data = self.nav_data
     menu = context.site_root.get_resource(data["src"])
     ns = get_menu_namespace(context, data["depth"], data["show_first_child"], flat=data["flat"], menu=menu)
     if is_navigation_mode(context) is True:
         return ns
     # Add [+] item in menu (To edit)
     ac = menu.get_access_control()
     if ac.is_allowed_to_edit(context.user, menu):
         ns["items"].append(
             {
                 "active": False,
                 "class": None,
                 "description": None,
                 "id": "menu_edit_menu",  # FIXME
                 "in_path": False,
                 "items": [],
                 "path": context.get_link(menu),
                 "real_path": menu.get_abspath(),
                 "target": "_top",
                 "title": u"+",
             }
         )
     return ns