remove portal_type criteria according a widget attribute (True by default)

This commit is contained in:
Eric BREHAULT 2013-03-05 11:30:28 +01:00
parent 753afbcf93
commit 92ebb82fa6
2 changed files with 11 additions and 0 deletions

View File

@ -52,6 +52,9 @@ class QueryBuilder(object):
else:
query['path'] = {'query': currentPath, 'navtree': 1}
# Only list the applicable types
query['portal_type'] = utils.typesToList(context)
# Apply the desired sort
sortAttribute = navtree_properties.getProperty('sortAttribute', None)
if sortAttribute is not None:

View File

@ -79,6 +79,10 @@ class Fetch(BrowserView):
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}
@ -134,6 +138,10 @@ class ContentTreeBase(Explicit):
# are selectable or that are folders.
show_all_nodes = False
# By default, show all content types, even those not allowed in
# the navigation
show_all_content_types = True
def getTermByBrain(self, brain):
return self.bound_source.getTermByBrain(brain)