Back to index

plone3  3.1.7
interfaces.py
Go to the documentation of this file.
00001 from zope.interface import Interface
00002 from zope.interface import directlyProvides
00003 
00004 from zope.app.publisher.interfaces.browser import IBrowserMenu
00005 from zope.app.publisher.interfaces.browser import IBrowserSubMenuItem
00006 from zope.app.publisher.interfaces.browser import IMenuItemType
00007 
00008 from zope.contentprovider.interfaces import IContentProvider
00009 
00010 
00011 class IContentMenuView(IContentProvider):
00012     """The view that powers the content menu (the green bar at the top of
00013     the editable border).
00014 
00015     This will construct a menu by finding an adapter to IContentMenu.
00016     """
00017 
00018     def available():
00019         """Determine whether the menu should be displayed at all.
00020         """
00021 
00022     def menu():
00023         """Create a list of dicts that can be used to render a menu.
00024 
00025         The keys in this dict are: title, description, action (a URL),
00026         selected (a boolean), icon (a URI), extra (a random payload), and
00027         submenu
00028         """
00029 
00030 # The content menu itself - menu items are registered as adapters to this
00031 # interface (this is signalled by marking the interface itself with the
00032 # IInterface IMenuItemType)
00033 
00034 class IContentMenuItem(Interface):
00035     """Special menu item type for Plone's content menu."""
00036 
00037 directlyProvides(IContentMenuItem, IMenuItemType)
00038 
00039 # The sub-menus - because they require additional logic, each of these will be
00040 # implemented with a separate class. We provide markers here to distinguish
00041 # them, although IBrowserMenu is the primary interface through which they are
00042 # looked up. We also provide markers for the special menu items - see
00043 # configure.zcml for more details.
00044 
00045 # We use the 'extra' field in the menu items for various bits of information
00046 # the view needs to render the menu. 'extra' will be a dict, with the following
00047 # keys, all optional:
00048 #
00049 #   id           :   The id of the menu item, e.g. the id of the type to add or
00050 #                        the workflow transition
00051 #   state        :   The current state of the item
00052 #   stateTitle   :   The title of the state - to be displayed after the main
00053 #                        item title
00054 #   class        :   A CSS class to apply
00055 #   separator    :   True if the item should be preceded by a separator
00056 #   hideChildren :   True if the item's children should not be rendered
00057 
00058 class IActionsSubMenuItem(IBrowserSubMenuItem):
00059     """The menu item linking to the actions menu.
00060     """
00061 
00062 class IActionsMenu(IBrowserMenu):
00063     """The actions menu.
00064 
00065     This gets its menu items from portal_actions.
00066     """
00067 
00068 class IDisplaySubMenuItem(IBrowserSubMenuItem):
00069     """The menu item linking to the display menu.
00070     """
00071 
00072     def disabled(self):
00073         """Find out if the menu is visible but disabled."""
00074 
00075 class IDisplayMenu(IBrowserMenu):
00076     """The display menu.
00077 
00078     This gets its menu items from an IBrowserDefault (see CMFDynamicViewFTI).
00079     """
00080 
00081 class IFactoriesSubMenuItem(IBrowserSubMenuItem):
00082     """The menu item linking to the factories menu.
00083     """
00084 
00085 class IFactoriesMenu(IBrowserMenu):
00086     """The factories menu.
00087 
00088     This gets its menu items from portal_types' list of addable types in
00089     the context.
00090     """
00091 
00092 class IWorkflowSubMenuItem(IBrowserSubMenuItem):
00093     """The menu item linking to the workflow menu.
00094     """
00095 
00096 class IWorkflowMenu(IBrowserMenu):
00097     """The workflow menu.
00098 
00099     This gets its menu items from the list of possible transitions in
00100     portal_workflow.
00101     """
00102 
00103 class IDisplayViewsMenu(IBrowserMenu):
00104     """A menu listing Zope3 views registered as content views
00105 
00106     Currently used only to register user-visible titles.
00107     """
00108 
00109     def getMenuItemByAction(object, request, action):
00110         """Return the first IBrowserMenuItem for the given action"""