def __init__(self, context, portlet): NavtreeStrategy.__init__(self, context, portlet) portal_properties = getToolByName(context, 'portal_properties') navtree_properties = getattr(portal_properties, 'navtree_properties') currentFolderOnly = portlet.currentFolderOnly or \ navtree_properties.getProperty('currentFolderOnlyInNavtree', False) topLevel = calculateTopLevel(context, portlet) self.rootPath = getRootPath(context, currentFolderOnly, topLevel, portlet.root)
def __init__(self, context, portlet): NavtreeStrategy.__init__(self, context, portlet) portal_properties = getToolByName(context, 'portal_properties') navtree_properties = getattr(portal_properties, 'navtree_properties') currentFolderOnly = portlet.currentFolderOnly or \ navtree_properties.getProperty('currentFolderOnlyInNavtree', False) topLevel = calculateTopLevel(context, portlet, context.REQUEST) self.rootPath = getRootPath(context, currentFolderOnly, topLevel, portlet.root)
def getNavTree(self, _marker=None): if _marker is None: _marker = [] context = aq_inner(self.context) # Full nav query, not just the tree for 'this' item nav_root = self.getNavRoot() queryBuilder = SitemapQueryBuilder(nav_root) query = queryBuilder() # Add explicit path to query, since the sitemap query uses the root of # the site if nav_root: query['path'] = { 'query': "/".join(nav_root.getPhysicalPath()), 'depth': self.data.get('bottomLevel', 3) } data = dict(self.data) data['root_uid'] = data['root'] strategy = NavtreeStrategy(context, object_factory(**data)) return buildFolderTree(context, obj=context, query=query, strategy=strategy)
def decoratorFactory(self, node): newnode = baseStrategy.decoratorFactory(self,node) if newnode['currentParent'] and not self.context.restrictedTraverse('@@plone').isStructuralFolder() and hasattr(newnode['item'],'UID'): newnodeuid = newnode['item'].UID if hasattr(self.context,'getParentNode'): parent = self.context.getParentNode() if parent <> None and hasattr(parent,'UID') and parent.UID() == newnodeuid: newnode['currentItem'] = True if newnode['currentItem']: if newnode['item'] and hasattr(newnode['item'],'portal_type') and newnode['item'].portal_type == 'MemberSpace': newnode['link_remote'] = newnode['getRemoteUrl'] = self.context.portal_url() + "/author/" + newnode['item'].id return newnode