Ejemplo n.º 1
0
    def execute(self, factory, config, name, title, description,
                order=None, menuitem=None, context=None,
                layer=None, permission=None):

        menuDirective(config, id=name, class_=factory,
                      title=title, description=description)

        if menuitem is None:
            return False

        menu_id, icon, filter, enforced_order, extra = menuitem

        if enforced_order is None:
            enforced_order = order[0] or 0

        try:
            menu = config.resolve('zope.app.menus.' + menu_id)
        except ConfigurationError:
            raise GrokError("The %r menu could not be found.  Please use "
                            "megrok.menu.Menu to register a menu first."
                            % menu_id, factory)

        subMenuItemDirective(
            config, menu=menu, for_=context, submenu=name,
            title=title, description=description, icon=icon,
            filter=filter, permission=permission, layer=layer,
            order=enforced_order, action='', extra=extra)
        return True
Ejemplo n.º 2
0
 def execute(self, factory, config, name, title, description, **kw):
     menuDirective(config, id=name, class_=factory,
                   title=title, description=description)
     return True