Back to index

plone3  3.1.7
sitemap.py
Go to the documentation of this file.
00001 from Acquisition import aq_inner
00002 from zope.component import getMultiAdapter
00003 from zope.interface import implements
00004 
00005 from Products.CMFCore.utils import getToolByName
00006 from Products.Five import BrowserView
00007 
00008 from Products.CMFPlone.browser.interfaces import ISitemapView
00009 
00010 
00011 class SitemapView(BrowserView):
00012     implements(ISitemapView)
00013 
00014     def createSiteMap(self):
00015         context = aq_inner(self.context)
00016         view = getMultiAdapter((context, self.request),
00017                                name='sitemap_builder_view')
00018         data = view.siteMap()
00019         properties = getToolByName(context, 'portal_properties')
00020         navtree_properties = getattr(properties, 'navtree_properties')
00021         bottomLevel = navtree_properties.getProperty('bottomLevel', 0)
00022         # XXX: The recursion should probably be done in python code
00023         return context.portlet_navtree_macro(children=data.get('children',[]),
00024                                              level=1, bottomLevel=bottomLevel)