Back to index

plone3  3.1.7
Public Member Functions
plone.app.kss.commands.plonecommands.PloneCommands Class Reference
Inheritance diagram for plone.app.kss.commands.plonecommands.PloneCommands:
Inheritance graph
[legend]
Collaboration diagram for plone.app.kss.commands.plonecommands.PloneCommands:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def issuePortalMessage
def refreshPortlet
def refreshContentMenu

Detailed Description

Definition at line 17 of file plonecommands.py.


Member Function Documentation

def plone.app.kss.commands.plonecommands.PloneCommands.issuePortalMessage (   self,
  message,
  msgtype = 'info' 
)

Definition at line 20 of file plonecommands.py.

00020 
00021     def issuePortalMessage(self, message, msgtype='info'):
00022         if message is None:
00023             message = ''
00024 
00025         if isinstance(message, Message):
00026             msgtype = message.type
00027             # The translation domain of the message is not known.  We
00028             # can only assume that it is 'plone'.
00029             message = translate(message.message, domain='plone',
00030                                 context=self.request)
00031         elif isinstance(message, i18nmessage):
00032             # Here the message has a domain itself, which is good.
00033             message = translate(message, context=self.request)
00034 
00035         # The 'dt' of the definition list we generate should contain
00036         # something like Info, Warning or Error.  Those messages are
00037         # available in the plone domain.
00038         msgtype_name = translate(msgtype.capitalize(), domain='plone',
00039                                  context=self.request)
00040 
00041         # XXX The macro has to take in account that there might be more than
00042         # one status message.
00043         ksscore = self.getCommandSet('core')
00044         selector = ksscore.getHtmlIdSelector('kssPortalMessage')
00045 
00046         # We hide the standard Plone Portal Message
00047         standard_portal_message_selector = ksscore.getCssSelector('.portalMessage')
00048         ksscore.setStyle(standard_portal_message_selector, 'display','none')
00049 
00050         # Now there is always a portal message but it has to be
00051         # rendered visible or invisible, accordingly
00052         html = '<dt>%s</dt><dd>%s</dd>' % (msgtype_name, message)
00053         ksscore.replaceInnerHTML(selector, html)
00054         ksscore.setAttribute(selector, 'class', "portalMessage %s" % msgtype)
00055         ksscore.setStyle(selector, 'display', message and 'block' or 'none')

Here is the call graph for this function:

Definition at line 89 of file plonecommands.py.

00089 
00090     def refreshContentMenu(self):
00091         ksscore = self.getCommandSet('core')
00092         selector = ksscore.getHtmlIdSelector('contentActionMenus')
00093         self.getCommandSet('zope').refreshProvider(selector, 'plone.contentmenu')

Here is the call graph for this function:

Definition at line 56 of file plonecommands.py.

00056 
00057     def refreshPortlet(self, portlethash, **kw):
00058         # put parameters on the request, by saving the original context
00059         self.request.form, orig_form = kw, self.request.form
00060         
00061         # Prepare the portlet and render the data
00062         info = unhashPortletInfo(portlethash) 
00063         manager = getUtility(IPortletManager, info['manager'])
00064         
00065         assignment = assignment_from_key(context = self.context, 
00066                                          manager_name = info['manager'], 
00067                                          category = info['category'],
00068                                          key = info['key'],
00069                                          name = info['name'])
00070         renderer = getMultiAdapter(
00071                 (self.context, self.request, self.view, manager, assignment.data),
00072                 IPortletRenderer
00073             )
00074         renderer = renderer.__of__(self.context)
00075         
00076         renderer.update()
00077         if IDeferredPortletRenderer.providedBy(renderer):
00078             # if this is a deferred load, prepare now the data
00079             renderer.deferred_update()
00080         result = renderer.render()
00081         
00082         # Revert the original request
00083         self.request.form = orig_form
00084         
00085         # Command the replacement
00086         wrapper_id = 'portletwrapper-%s' % portlethash
00087         ksscore = self.getCommandSet('core')
00088         ksscore.replaceInnerHTML(ksscore.getHtmlIdSelector(wrapper_id), result)

Here is the call graph for this function:


The documentation for this class was generated from the following file: