Back to index

plone3  3.1.7
view.py
Go to the documentation of this file.
00001 from zope.interface import Interface
00002 from zope.interface import implements
00003 
00004 from zope.component import getUtility
00005 from zope.component import adapts
00006 
00007 from zope.app.publisher.interfaces.browser import IBrowserMenu
00008 
00009 from interfaces import IContentMenuView
00010 
00011 from Acquisition import Explicit
00012 from Products.CMFPlone import utils
00013 from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile
00014 
00015 
00016 class ContentMenuProvider(Explicit):
00017     """Content menu provider for the "view" tab: displays the menu
00018     """
00019 
00020     implements(IContentMenuView)
00021 
00022     def __init__(self, context, request, view):
00023         self.__parent__ = view
00024         self.view = view
00025         self.context = context
00026         self.request = request
00027 
00028     # From IContentProvider
00029 
00030     def update(self):
00031         pass
00032 
00033     render = ZopeTwoPageTemplateFile('contentmenu.pt')
00034 
00035     # From IContentMenuView
00036 
00037     def available(self):
00038         return True
00039 
00040     def menu(self):
00041         menu = getUtility(IBrowserMenu, name='plone_contentmenu')
00042         items = menu.getMenuItems(self.context, self.request)
00043         items.reverse()
00044         return items