def __call__(self, context):
     return self.path_source(
         closest_content(context),
         selectable_filter=self.selectable_filter,
         navigation_tree_query=self.navigation_tree_query,
         default=self.default,
         defaultFactory=self.defaultFactory)
 def __call__(self, context):
     return self.path_source(
         closest_content(context),
         selectable_filter=self.selectable_filter,
         navigation_tree_query=self.navigation_tree_query,
         default=self.default,
         defaultFactory=self.defaultFactory)
    def render_tree(self):
        content = closest_content(self.context)
        source = self.bound_source

        strategy = getMultiAdapter((content, self), INavtreeStrategy)
        data = buildFolderTree(content, obj=content, query=source.navigation_tree_query, strategy=strategy)

        return self.recurse_template(children=data.get("children", []), level=1)
    def __call__(self):
        # We want to check that the user was indeed allowed to access the
        # form for this widget. We can only this now, since security isn't
        # applied yet during traversal.
        self.validate_access()

        widget = self.context
        context = widget.context

        # Update the widget before accessing the source.
        # The source was only bound without security applied
        # during traversal before.
        widget.update()
        source = widget.bound_source

        # Convert token from request to the path to the object
        token = self.request.form.get('href', None)
        if token is not None:
            token = urllib.unquote(token)
        directory = self.context.bound_source.tokenToPath(token)
        level = self.request.form.get('rel', 0)

        navtree_query = source.navigation_tree_query.copy()

        if widget.show_all_content_types and 'portal_type' in navtree_query:
            del navtree_query['portal_type']

        if directory is not None:
            navtree_query['path'] = {'depth': 1, 'query': directory}

        if 'is_default_page' not in navtree_query:
            navtree_query['is_default_page'] = False

        content = closest_content(context)

        strategy = getMultiAdapter((content, widget), INavtreeStrategy)
        catalog = getToolByName(content, 'portal_catalog')

        children = []
        for brain in catalog(navtree_query):
            newNode = {
                'item': brain,
                'depth': -1,  # not needed here
                'currentItem': False,
                'currentParent': False,
                'children': []
            }
            if strategy.nodeFilter(newNode):
                newNode = strategy.decoratorFactory(newNode)
                children.append(newNode)

        self.request.response.setHeader('X-Theme-Disabled', 'True')

        return self.fragment_template(children=children, level=int(level))
Beispiel #5
0
    def render_tree(self):
        content = closest_content(self.context)
        source = self.bound_source

        strategy = getMultiAdapter((content, self), INavtreeStrategy)
        data = buildFolderTree(content,
                               obj=content,
                               query=source.navigation_tree_query,
                               strategy=strategy)

        return self.recurse_template(children=data.get('children', []),
                                     level=1)
Beispiel #6
0
    def __call__(self):
        # We want to check that the user was indeed allowed to access the
        # form for this widget. We can only this now, since security isn't
        # applied yet during traversal.
        self.validate_access()

        widget = self.context
        context = widget.context

        # Update the widget before accessing the source.
        # The source was only bound without security applied
        # during traversal before.
        widget.update()
        source = widget.bound_source

        # Convert token from request to the path to the object
        token = self.request.form.get('href', None)
        if token is not None:
            token = urllib.unquote(token)
        directory = self.context.bound_source.tokenToPath(token)
        level = self.request.form.get('rel', 0)

        navtree_query = source.navigation_tree_query.copy()

        if widget.show_all_content_types and 'portal_type' in navtree_query:
            del navtree_query['portal_type']

        if directory is not None:
            navtree_query['path'] = {'depth': 1, 'query': directory}

        if 'is_default_page' not in navtree_query:
            navtree_query['is_default_page'] = False

        content = closest_content(context)

        strategy = getMultiAdapter((content, widget), INavtreeStrategy)
        catalog = getToolByName(content, 'portal_catalog')

        children = []
        for brain in catalog(navtree_query):
            newNode = {'item': brain,
                       'depth': -1,  # not needed here
                       'currentItem': False,
                       'currentParent': False,
                       'children': []}
            if strategy.nodeFilter(newNode):
                newNode = strategy.decoratorFactory(newNode)
                children.append(newNode)

        self.request.response.setHeader('X-Theme-Disabled', 'True')

        return self.fragment_template(children=children, level=int(level))
Beispiel #7
0
    def __call__(self, context):
        source = self.path_source(
            closest_content(context),
            selectable_filter=self.selectable_filter,
        )
        del source.navigation_tree_query['portal_type']

        object_provides = [
            'plone.dexterity.interfaces.IDexterityContainer',
            'Products.ATContentTypes.interfaces.folder.IATFolder'
        ] + self._object_provides

        source.navigation_tree_query['object_provides'] = object_provides
        return source
Beispiel #8
0
    def __call__(self, context):
        source = self.path_source(
            closest_content(context),
            selectable_filter=self.selectable_filter,
        )
        del source.navigation_tree_query['portal_type']

        object_provides = [
            'plone.dexterity.interfaces.IDexterityContainer',
            'Products.ATContentTypes.interfaces.folder.IATFolder'
        ] + self._object_provides

        source.navigation_tree_query['object_provides'] = object_provides
        return source
    def __call__(self):
        # We want to check that the user was indeed allowed to access the
        # form for this widget. We can only this now, since security isn't
        # applied yet during traversal.
        self.validate_access()

        widget = self.context
        context = widget.context

        # Update the widget before accessing the source.
        # The source was only bound without security applied
        # during traversal before.
        widget.update()
        source = widget.bound_source

        # Convert token from request to the path to the object
        token = self.request.form.get("href", None)
        directory = self.context.bound_source.tokenToPath(token)
        level = self.request.form.get("rel", 0)

        navtree_query = source.navigation_tree_query.copy()
        if directory is not None:
            navtree_query["path"] = {"depth": 1, "query": directory}

        if "is_default_page" not in navtree_query:
            navtree_query["is_default_page"] = False

        content = closest_content(context)

        strategy = getMultiAdapter((content, widget), INavtreeStrategy)
        catalog = getToolByName(content, "portal_catalog")

        children = []
        for brain in catalog(navtree_query):
            newNode = {
                "item": brain,
                "depth": -1,  # not needed here
                "currentItem": False,
                "currentParent": False,
                "children": [],
            }
            if strategy.nodeFilter(newNode):
                newNode = strategy.decoratorFactory(newNode)
                children.append(newNode)

        self.request.response.setHeader("X-Theme-Disabled", "True")

        return self.fragment_template(children=children, level=int(level))
    def __call__(self):

        # We want to check that the user was indeed allowed to access the
        # form for this widget. We can only this now, since security isn't
        # applied yet during traversal.
        self.validate_access()

        widget = self.context
        context = widget.context

        # Update the widget before accessing the source.
        # The source was only bound without security applied
        # during traversal before.
        widget.update()
        source = widget.bound_source

        # Convert token from request to the path to the object
        token = self.request.form.get('href', None)
        directory = self.context.bound_source.tokenToPath(token)

        navtree_query = source.navigation_tree_query.copy()
        navtree_query['path'] = {'query': directory}

        if 'is_default_page' not in navtree_query:
            navtree_query['is_default_page'] = False
        if navtree_query['is_default_page'] in [(True,False), (False, True)]:
            del navtree_query['is_default_page']

        content = context
        if not IAcquirer.providedBy(content):
            content = closest_content(context)

        catalog = getToolByName(content, 'portal_catalog')
        results = catalog(navtree_query)

        if len(results) > 0:
            obj = results[0].getObject()

            preview = queryMultiAdapter(
                (obj, self.context), IContentTreeWidgetPreview)

            if preview is None:
                return _(u"No preview available.")

            return preview()
    def _children(self, query):
        widget = self.context
        context = widget.context
        content = closest_content(context)
        strategy = getMultiAdapter((content, widget), INavtreeStrategy)
        catalog = getToolByName(content, 'portal_catalog')
        navigate_to = startup_path(widget.field, content)

        children = []
        for brain in catalog(query):
            newNode = {'item': brain,
                       'depth': -1,  # not needed here
                       'currentItem': False,
                       'currentParent': False,
                       'children': []}
            if navigate_to.startswith(brain.getPath()):
                query['path']['query']=brain.getPath()
                newNode['children'] = self._children(query)
            if strategy and strategy.nodeFilter(newNode):
                newNode = strategy.decoratorFactory(newNode)
                children.append(newNode)
            
        return children
    def __call__(self):

        # We want to check that the user was indeed allowed to access the
        # form for this widget. We can only this now, since security isn't
        # applied yet during traversal.
        self.validate_access()

        widget = self.context
        context = widget.context

        # Update the widget before accessing the source.
        # The source was only bound without security applied
        # during traversal before.
        widget.update()
        source = widget.bound_source

        # Convert token from request to the path to the object
        token = self.request.form.get("href", None)
        directory = self.context.bound_source.tokenToPath(token)
        level = self.request.form.get("rel", 0)

        navtree_query = source.navigation_tree_query.copy()
        navtree_query["path"] = {"query": directory}

        if "is_default_page" not in navtree_query:
            navtree_query["is_default_page"] = False

        content = context
        if not IAcquirer.providedBy(content):
            content = closest_content(context)

        strategy = getMultiAdapter((content, widget), INavtreeStrategy)
        catalog = getToolByName(content, "portal_catalog")
        results = catalog(navtree_query)

        if len(results) > 0:
            return self.template(node=results[0].getObject())
 def closest_content(self):
     return closest_content(self.context)