This post will deal with how to add a tab to the tool portal_imessages so that it allows to define its own actions. Let's start:
- Declare our tool as action provider:
from Products.CMFCore.ActionProviderBase import ActionProviderBase
...
...
class MessagesTool(SimpleItem, PropertyManager, ActionProviderBase): - Declare the “Actions” tab by creating adding a new item to the attribute manage_options.
manage_options = (
PropertyManager.manage_options
+ SimpleItem.manage_options
+ ActionProviderBase.manage_options
) - Create the profile specification of the action provider with the list of actions. Add these lines to the actions.xml file.
<action-provider name=”portal_imessages”>
<action title="action_send_msg"
action_id="action_send_msg" category="object"
condition_expr="python:not portal.portal_membership.isAnonymousUser()"
url_expr="string:${portal/portal_url}/send_message" visible="True">
<permission>Modify portal content</permission>
</action>
</action-provider> - Add the step actions to import_steps.xml.
<import-step id="actions" version="20040630-01"
handler="Products.CMFCore.exportimport.actions.importActionProviders"
title="Action Providers">
<dependency step="toolset"/>
Import actions tool's action providers and their actions.
</import-step>
Don't relax!! It's almost done... - Restart Zope's instance
- Go to portal_setup tool and import the profile CPS Messages
- Go to the tool portal_imessages and you should see the tab Actions.
No comments:
Post a Comment