コード例 #1
0
    def _configureLayouts(self, node):
        """ Configure the layouts
        """
        wtool = toolWrapper(self.context)

        # Make sure the layouts folder exists.
        if not shasattr(self.context, LAYOUTS):
            from Products.CompositePack.viewlet import container
            container.addLayoutContainer(
                self.context,
                id=LAYOUTS,
                title='A Container for registered Layouts')
        # Register the layouts
        for layout in _filterNodes(node.childNodes):
            layout_id = layout.getAttribute('name')
            layout_title = layout.getAttribute('title')
            layout_skin_method = layout.getAttribute('skin_method')
            wtool.registerLayout(layout_id.encode(), layout_title.encode(),
                                 layout_skin_method.encode())
            self._logger.info('Layout: "%s" registered' %
                              layout_title.encode())
            if layout.hasAttribute('default'):
                wtool.setDefaultLayout(layout_id)
                self._logger.info('Layout: "%s" set as tool default layout' %
                                  layout_title.encode())
コード例 #2
0
def manage_addCompositeTool(dispatcher, REQUEST=None):
    """Adds a composite tool to a folder.
    """
    from Products.CompositePack.viewlet import container

    ob = CompositeTool()
    dispatcher._setObject(ob.getId(), ob)
    ob = dispatcher._getOb(ob.getId())
    container.addViewletContainer(ob, id=VIEWLETS, title="A Container for registered Viewlets")
    container.addLayoutContainer(ob, id=LAYOUTS, title="A Container for registered Layouts")
    if REQUEST is not None:
        return dispatcher.manage_main(dispatcher, REQUEST)
コード例 #3
0
def manage_addCompositeTool(dispatcher, REQUEST=None):
    """Adds a composite tool to a folder.
    """
    from Products.CompositePack.viewlet import container
    ob = CompositeTool()
    dispatcher._setObject(ob.getId(), ob)
    ob = dispatcher._getOb(ob.getId())
    container.addViewletContainer(ob,
                                  id=VIEWLETS,
                                  title='A Container for registered Viewlets')
    container.addLayoutContainer(ob,
                                 id=LAYOUTS,
                                 title='A Container for registered Layouts')
    if REQUEST is not None:
        return dispatcher.manage_main(dispatcher, REQUEST)
コード例 #4
0
    def _configureLayouts(self, node):
        """ Configure the layouts
        """
        wtool = toolWrapper(self.context)

        # Make sure the layouts folder exists.
        if not shasattr(self.context, LAYOUTS):
            from Products.CompositePack.viewlet import container
            container.addLayoutContainer(self.context, id=LAYOUTS,
                                  title='A Container for registered Layouts')
        # Register the layouts
        for layout in _filterNodes(node.childNodes):
            layout_id = layout.getAttribute('name')
            layout_title = layout.getAttribute('title')
            layout_skin_method = layout.getAttribute('skin_method')
            wtool.registerLayout(layout_id.encode(), layout_title.encode(), layout_skin_method.encode())
            self._logger.info('Layout: "%s" registered' % layout_title.encode())
            if layout.hasAttribute('default'):
                wtool.setDefaultLayout(layout_id)
                self._logger.info('Layout: "%s" set as tool default layout' % layout_title.encode())