Exemplo n.º 1
0
def directRouter(
    _context,
    name,
    class_,
    namespace=None,
    for_=Interface,
    layer=IDefaultBrowserLayer,
    timeout="180000",
    permission="zenoss.Common",
):

    # Register the view at which the class will be available
    page(_context, name, permission, for_, layer, class_=class_)

    # Make a viewlet class with the appropriate javascript source
    definition = DirectProviderDefinition(class_, name, timeout, namespace)

    source = definition.render()
    viewletclass = JavaScriptSourceViewlet(source)
    viewletDirective(
        _context, name, "zope2.Public", for_, layer, manager=IExtDirectJavaScriptManager, class_=viewletclass
    )

    jsonapi_source = definition.render_jsonapi()
    jsonapi_viewletclass = JavaScriptSourceViewlet(jsonapi_source)
    viewletDirective(
        _context, name, "zope2.Public", for_, layer, manager=IJsonApiJavaScriptManager, class_=jsonapi_viewletclass
    )

    # Create a mapping of all of the Zope routers for introspection
    allDirectRouters[class_] = dict(name=name, namespace=namespace, permission=permission)
Exemplo n.º 2
0
def directRouter(_context,
                 name,
                 class_,
                 namespace=None,
                 for_=Interface,
                 layer=IDefaultBrowserLayer,
                 timeout="180000",
                 permission='zenoss.Common'):

    # Register the view at which the class will be available
    page(_context, name, permission, for_, layer, class_=class_)

    # Make a viewlet class with the appropriate javascript source
    definition = DirectProviderDefinition(class_, name, timeout, namespace)

    source = definition.render()
    viewletclass = JavaScriptSourceViewlet(source)
    viewletDirective(_context,
                     name,
                     'zope2.Public',
                     for_,
                     layer,
                     manager=IExtDirectJavaScriptManager,
                     class_=viewletclass)

    jsonapi_source = definition.render_jsonapi()
    jsonapi_viewletclass = JavaScriptSourceViewlet(jsonapi_source)
    viewletDirective(_context,
                     name,
                     'zope2.Public',
                     for_,
                     layer,
                     manager=IJsonApiJavaScriptManager,
                     class_=jsonapi_viewletclass)
Exemplo n.º 3
0
def directRouter(_context, name, class_, namespace, timeout=None,
                 for_=Interface, layer=IDefaultBrowserLayer):

    # Register the view at which the class will be available
    page(_context, name, 'zope.Public', for_, layer, class_=class_)

    # Make a viewlet class with the appropriate javascript source
    source = DirectProviderDefinition(class_, name, namespace,
                                      timeout).render()
    viewletclass = JavaScriptSourceViewlet(source)

    viewletDirective(_context, name, 'zope.Public', for_, layer,
                     manager=IExtDirectJavaScriptManager, class_=viewletclass)
Exemplo n.º 4
0
    def setUpZCML(self, viewlet_name, viewlet_class, domain_interface,
                  permission):

        if self.context.echo:
            self.context.logger.debug(
                "%s: registered %s for %s, layer %s, permission %s" %
                (self.context.domain_model.__name__, viewlet_name,
                 domain_interface.__name__, "Default", permission))

        viewletDirective(self.context.zcml,
                         viewlet_name,
                         permission,
                         manager=self.viewlet_manager,
                         for_=domain_interface,
                         class_=viewlet_class)
Exemplo n.º 5
0
def directRouter(_context, name, class_, namespace=None, for_=Interface,
                 layer=IDefaultBrowserLayer, timeout="180000", 
                 permission='zenoss.Common'):

    # Register the view at which the class will be available
    page(_context, name, permission, for_, layer, class_=class_)

    # Make a viewlet class with the appropriate javascript source
    definition = DirectProviderDefinition(class_, name, timeout, namespace)

    source = definition.render()
    viewletclass = JavaScriptSourceViewlet(source)
    viewletDirective(_context, name, 'zope2.Public', for_, layer, manager=IExtDirectJavaScriptManager, class_=viewletclass)

    jsonapi_source = definition.render_jsonapi()
    jsonapi_viewletclass = JavaScriptSourceViewlet(jsonapi_source)
    viewletDirective(_context, name, 'zope2.Public', for_, layer, manager=IJsonApiJavaScriptManager, class_=jsonapi_viewletclass)
Exemplo n.º 6
0
    def setUpZCML( self, viewlet_name, viewlet_class, domain_interface, permission  ):
        
        if self.context.echo:
            self.context.logger.debug("%s: registered %s for %s, layer %s, permission %s"%( 
                    self.context.domain_model.__name__,
                    viewlet_name,
                    domain_interface.__name__,
                    "Default", 
                    permission ) )

        viewletDirective(
             self.context.zcml, 
             viewlet_name, 
             permission,
             manager=self.viewlet_manager,
             for_=domain_interface, 
             class_=viewlet_class
             )
Exemplo n.º 7
0
def zrtresourceViewlet(_context, name, file,
                       layer=IDefaultBrowserLayer,
                       permission='zope.Public', for_=Interface,
                       view=IBrowserView, manager=IViewletManager,
                       class_=None, template=None, attribute='render',
                       allowed_interface=None, allowed_attributes=None,
                       **kwargs):

    viewletDirective(_context, name, permission, for_=for_,
                     layer=layer, view=view, manager=manager,
                     class_=class_, template=template,
                     attribute=attribute,
                     allowed_interface=allowed_interface,
                     allowed_attributes=allowed_attributes,
                     resource=name, **kwargs)

    zrtresource(_context, name, file, layer=layer,
                permission=permission)