Personal tools
You are here: Home Forums Plone (and Zope) Tweaks: Notifications with Ploneboard

Tweaks: Notifications with Ploneboard

4.0
Up to Plone (and Zope)

Tweaks: Notifications with Ploneboard

Posted by Gareth Bult at July 01. 2008

This would go in a Plone howto if we had one, however for now this is probably the best place for it. Ploneboard is great, however there is no email notification built in and as a result knowing when things get updated is a little hit and miss. Yes, you can use the RSS feeds,  but not everyone uses RSS ...

The desired effect can be achieved by adding "CMFNotifications", however this is a little open-ended and the documentation does leave a little to be desired.

So, here's what you do;

  • Add CMF Notifications to your instance and restart
  • Visit the CMF Notification option within the Plone control panel
    (this will drop you into the ZMI)
  • For Item creation, Item modification, Workflow transition and discussion item;
    • in the "Users" box, enter "* :: python []"
      - which means that under all conditions, return an empty list of users names, to which the system will append a list which is the list of people who have subscribed to the item. As another example, you might use "* :: python ['Administrator']" to cc in the system administrator on all changes.
      Do NOT use the "* :: *" as listed in the documentation or you will email everyone registered on the site every time something changes. [sorry guys!  ;) ]
    • in the "Rules" box use one of the following;
      [ hopefully it's obvious which one goes in which box ]
      • * :: string:creation_mail_notification
      • * :: string:modification_mail_notification
      • * :: string:workflow_mail_notification

This will handle "most" of what you want for CMF notifications, for example subscribing to folders and documents, needless to say however it's not going to be quite that easy. Next you need to paste the following into the "patches.py" file in the CMFNotifications Products folder:

--- snip ---

def addReply(self, title, text, creator=None, files=None):
        obj = self._orig_cmfnotification_addReply(title, text, creator=None, files=None)
        LOG.info('Called PloneBoard addReply')
        ntool = getToolByName(self, ID, None)
        if ntool is not None:
                ntool.onItemCreation(obj)
        return obj

from Products.Ploneboard.content.PloneboardComment import PloneboardComment

PloneboardComment._orig_cmfnotification_addReply = PloneboardComment.addReply
PloneboardComment.addReply = addReply

LOG.info('Monkey-patched PloneBoard addReply')

def addConversation(self, title, text=None, creator=None, files=None):
        obj = self._orig_cmfnotification_addConversation(title, text, creator, files)
        LOG.info('Called PloneBoard addConversation')
        ntool = getToolByName(self, ID, None)
        if ntool is not None:
                ntool.onItemCreation(obj)
        return obj

from Products.Ploneboard.content.PloneboardForum import PloneboardForum

PloneboardForum._orig_cmfnotification_addConversation = PloneboardForum.addConversation
PloneboardForum.addConversation = addConversation
LOG.info('Monkey-patched PloneBoard addConversation')

--- snip ---

This is apparently called a "monkey patch".

When you restart Zope again , this will be applied and you will be notified when comments are added to conversations or when conversations are added, but warned however that you will not see anything via email if someone edits a comment.

Powered by Ploneboard
Emergency Data Recovery
Need an emergency data recovery? Give it to the experts.
Inkjet Cartridges
High quality inkjet cartridges from Prink. Free UK delivery on compatible inkjet cartridges. We stock over 50,000 cartridges
inks
See our comprehensive range of inks. See our amazing prices. See for yourself. Great value, great range and great customer service.
Computer support >
Cost effective and superior IT support can be found. No need to fret!
Dedicated Server>
When you consider a server, speed is very important.
Broadband Providers Uk
Check this out if you are looking for broadband providers in the UK.
Reverse Phone Lookup
Type in any phone number to instantly find out owner's name, address and more.
Laptop
Visit CheckCost UK to compare, review and buy latest computers, laptops, scanners, printers, hard drives, LCD monitors and many more.
Software
Visit Ecost Software to find your favourite brands like Adobe, Apple, Microsoft, Autodesk, Codegear, Corel, Symantec and more.
IT SERVICES
Award winning IT Services from London provider Wavex offering support, advice, and training