Back to index

plone3  3.1.7
interfaces.py
Go to the documentation of this file.
00001 from zope.interface import Interface
00002 
00003 # Note: We have two basic command sets here - 'zope', for basic Zope 
00004 # operations like refreshing viewlets and content providers, and 'plone'
00005 # for core Plone functionality relating to status messages, portlets
00006 # and the content menu.
00007 # 
00008 # Please be careful before dumping more things into these interfaces. It
00009 # may be more appropriate to register a new command set for specific
00010 # commands.
00011 
00012 class IZopeCommands(Interface):
00013     """Commands for basic Zope-like operations.
00014     
00015     Registered as command set 'zope'
00016     """
00017     
00018     def refreshProvider(selector, name):
00019         """Refresh any IContentProvider named 'name' located in the page
00020         at 'selector'.
00021         
00022         This can be used to refresh an entire viewlet manager.
00023         """
00024     
00025     def refreshViewlet(selector, manager, name):
00026         """Refresh any IViewlet named 'name' inside the 
00027         IViewletManager 'manager', located in the page at
00028         'selector'.
00029         
00030         The 'manager' can be the name of a manager, in which case it's
00031         looked up, or an actual IViewletManager instance.
00032         """
00033         
00034 class IPloneCommands(Interface):
00035     """Commands for basic Plone operations.
00036     
00037     Registered as command set 'plone'
00038     """
00039     
00040     def issuePortalMessage(message, msgtype='info'):
00041         """Issue a particular portal message. Type can be 'info', 'warn'
00042         or 'error'.
00043         """
00044 
00045     def refreshPortlet(portlethash, **kw):
00046         """Refresh a new-style portlet. The portlet hash is encoded in the
00047         standard view template as a KSS parameter. It can also be calculated
00048         using the functions in plone.portlets.utils. 
00049         
00050         Any keyword arguments are added as if they were form request
00051         parameters for the portlet to parse.
00052         """
00053 
00054     def refreshContentMenu():
00055         """Refresh the content menu
00056         """
00057 
00058 class IPloneLegacyCommands(Interface):
00059     """Commands for legacy Plone operations.
00060     JS code done without KSS patterns
00061 
00062     registered as command set 'plone-legacy'
00063     """
00064     
00065     def createTableOfContents():
00066         """Parse the document body and add the TOC
00067         """
00068 
00069 # Deprecated commands -- will be removed in Plone 4.0
00070 # Do not use these.
00071 
00072 class IIssuePortalMessageCommand(Interface):
00073     """Commands to issue portal status messages.
00074     
00075     Registered as command set 'portalmessage'
00076     """
00077     
00078     def issuePortalMessage(message, msgtype='info'):
00079         """Issue a particular portal message. Type can be any string, but
00080         'info', 'warning' and 'error' have default styles associated with them.
00081         """
00082 
00083 class IRefreshPortletCommand(Interface):
00084     """Commands to refresh portlets
00085     
00086     Registered as command set 'refreshportlet'
00087     """
00088     
00089     def refreshPortlet(portlethash, **kw):
00090         """Refresh a new-style portlet. The portlet hash is encoded in the
00091         standard view template as a KSS parameter. It can also be calculated
00092         using the functions in plone.portlets.utils. 
00093         
00094         Any keyword arguments are added as if they were form request
00095         parameters for the portlet to parse.
00096         """
00097 
00098 class IKSSRefreshViewlet(Interface):
00099     """Commands to refresh viewlets
00100     
00101     Registered as command set 'refreshviewlet'
00102     """
00103     
00104     def refreshViewlet(id, manager, name):
00105         """Refresh the viewlet at the given node id, found in the given
00106         IViewletManager, with the given name.
00107         
00108         To find a viewlet manager, you'll need to use getMultiAdapter()
00109         on a context, request and view, providing IViewletManager with a
00110         partcular name.
00111         """
00112 
00113 class IRefreshProviderCommand(Interface):
00114     """Refresh a content provider (i.e. something given with a provider:
00115     expression).
00116     
00117     Registered as command set 'refreshprovider'
00118     """
00119     
00120     def refreshProvider(name, selector):
00121         """Refresh any IContentProvider named <name> located in the page
00122         at <selector> (css selector)
00123         """
00124 
00125 class IReplaceContentMenuCommand(Interface):
00126     """Refresh the content menu (the green bar).
00127     
00128     Registered as command set 'replacecontentmenu'
00129     """
00130     
00131     def replaceMenu():
00132         """Refresh content menu
00133         """
00134 
00135 class IKSSRefreshContentMenu(Interface):
00136     '''Utility command for refreshing a content menu
00137     '''
00138 
00139 class IKSSPlonePortletCommands(Interface):
00140     '''These are utility commands for doing stuff with portlets'''
00141 
00142     def reload_classic_portlet(css_selector, column,
00143                                template, portlet_macro='portlet'):
00144         '''Reload an old-school portlet'''