Commit 6b492293 authored by Boris Kocherov's avatar Boris Kocherov

ERP5ish portal_actions and actions in portal_actions

add ActionProviderBase for share code between ActionsTool and DynamicType
remove monkey patch ActionsTool
adapt BusinesTemplates import/export for ERP5portal_actions
change bootstrap erp5: create ERP5portal_action instead of CMFportal_actions
transparently migrate
erp5_core and erp5_promise: convert CMFaction to ERP5Action
parent e2f7b3fb
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,36 +13,36 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>global</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/global</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>1.6</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>check_site_consistency</string> </value>
<value> <string>action_check_site_consistency</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.6</float> </value>
<key> <string>reference</string> </key>
<value> <string>check_site_consistency</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
portal_actions | check_site_consistency
\ No newline at end of file
portal_actions/action_check_site_consistency
portal_alarms/promise_certificate_autority_tool
portal_alarms/promise_conversion_server
portal_alarms/promise_install_bt5
......
......@@ -29,6 +29,7 @@
import fnmatch, gc, glob, imp, os, re, shutil, sys, time, tarfile
from collections import defaultdict
from Products.CMFCore.interfaces import IActionsTool
from Shared.DC.ZRDB import Aqueduct
from Shared.DC.ZRDB.Connection import Connection as RDBConnection
from Products.ERP5Type.DiffUtils import DiffFile
......@@ -3204,7 +3205,8 @@ class ActionTemplateItem(ObjectTemplateItem):
Gets action copy from action provider given the action id or reference
"""
# Several tools still use CMF actions
if interfaces.ITypeProvider.providedBy(obj.getParentValue()):
if interfaces.ITypeProvider.providedBy(obj.getParentValue()) \
or IActionsTool.providedBy(obj):
return self._getPortalTypeActionCopy(obj, value)
else:
return self._getPortalToolActionCopy(obj, context, value)
......@@ -3250,7 +3252,8 @@ class ActionTemplateItem(ObjectTemplateItem):
path, id = id.rsplit('/', 1)
container = p.unrestrictedTraverse(path)
if interfaces.ITypeProvider.providedBy(aq_parent(aq_inner(container))):
if interfaces.ITypeProvider.providedBy(aq_parent(aq_inner(container)))\
or IActionsTool.providedBy(container):
# XXX future BT should use 'reference' instead of 'id'
reference = getattr(obj, 'reference', None) or obj.id
portal_type_dict.setdefault(path, {})[reference] = obj
......@@ -3328,7 +3331,8 @@ class ActionTemplateItem(ObjectTemplateItem):
obj = p.unrestrictedTraverse(relative_url, None)
# Several tools still use CMF actions
if obj is not None:
is_new_action = interfaces.ITypeProvider.providedBy(obj.getParentValue())
is_new_action = interfaces.ITypeProvider.providedBy(obj.getParentValue()) or \
IActionsTool.providedBy(obj)
key = is_new_action and 'reference' or 'id'
else:
relative_url, key, value = self._splitPath(id)
......
......@@ -1668,6 +1668,7 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
if tool_id in ('portal_categories', ):
tool = tool.activate()
tool.migrateToPortalTypeClass(tool_id not in (
'portal_actions',
'portal_activities', 'portal_simulation', 'portal_templates',
'portal_trash'))
if tool_id in ('portal_trash',):
......@@ -1707,7 +1708,6 @@ class PortalGenerator:
"""Set up initial tools"""
addCMFCoreTool = p.manage_addProduct['CMFCore'].manage_addTool
addCMFCoreTool('CMF Actions Tool', None)
addCMFCoreTool('CMF Catalog', None)
addCMFCoreTool('CMF Member Data Tool', None)
addCMFCoreTool('CMF Skins Tool', None)
......@@ -1885,7 +1885,7 @@ class ERP5Generator(PortalGenerator):
"""
Set up initial tools.
"""
if not 'portal_actions' in p.objectIds():
if not 'portal_skins' in p.objectIds():
PortalGenerator.setupTools(self, p)
# It is better to remove portal_catalog
......@@ -1919,6 +1919,7 @@ class ERP5Generator(PortalGenerator):
addERP5Tool(p, 'portal_password', 'Password Tool')
addERP5Tool(p, 'portal_introspections', 'Introspection Tool')
addERP5Tool(p, 'portal_acknowledgements', 'Acknowledgement Tool')
addERP5Tool(p, 'portal_actions', 'Actions Tool')
# Add ERP5Type Tool
addERP5Tool(p, 'portal_caches', 'Cache Tool')
......@@ -2020,8 +2021,6 @@ class ERP5Generator(PortalGenerator):
removeActionsFromTool(p.portal_membership,
('addFavorite', 'mystuff', 'favorites', 'logged_in',
'manage_members'))
# actions tool
removeActionsFromTool(p.portal_actions, ('folderContents',))
# properties tool
removeActionsFromTool(p.portal_properties, ('configPortal',))
# remove unused action providers
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/BaseType_viewAction</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,36 +13,36 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>global</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/global</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>bt_tool</string> </value>
<value> <string>action_bt_tool</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>bt_tool</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,36 +13,36 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>global</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/global</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>category_tool</string> </value>
<value> <string>action_category_tool</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>category_tool</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,8 +13,20 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>global</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/global</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -27,24 +39,16 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>3.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>component_tool</string> </value>
<value> <string>action_component_tool</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>3.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>component_tool</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,36 +13,36 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>global</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/global</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>3.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>create_module</string> </value>
<value> <string>action_create_module</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>3.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>create_module</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,36 +13,36 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>99.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>history</string> </value>
<value> <string>action_history</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>99.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>history</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,36 +13,36 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_ui</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_ui</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>100.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>list_ui</string> </value>
<value> <string>action_list_ui</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>100.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>list_ui</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,8 +13,20 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>user</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/user</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -27,24 +39,16 @@
<value> <string>Click here to Login</string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>login</string> </value>
<value> <string>action_login</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>login</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,8 +13,20 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>user</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/user</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -27,24 +39,16 @@
<value> <string>Click here to logout</string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>logout</string> </value>
<value> <string>action_logout</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>logout</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,8 +13,20 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_action</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -27,24 +39,16 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>101.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>make_template</string> </value>
<value> <string>action_make_template</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>101.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>make_template</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,8 +13,20 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>workflow</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/workflow</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -27,24 +39,16 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>100.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>mass_workflow</string> </value>
<value> <string>action_mass_workflow</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>100.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>mass_workflow</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,36 +13,36 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>Manage properties</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>100.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>metadata</string> </value>
<value> <string>action_metadata</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Manage properties</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>100.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>metadata</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,8 +13,20 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -27,24 +39,16 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>100.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>module_view</string> </value>
<value> <string>action_module_view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>100.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>module_view</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,36 +13,36 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>global</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/global</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>6.5</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>portal_alarms_action</string> </value>
<value> <string>action_portal_alarms_action</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>6.5</float> </value>
<key> <string>reference</string> </key>
<value> <string>portal_alarms_action</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,8 +13,20 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>user</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/user</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -27,24 +39,16 @@
<value> <string>Change your user preferences</string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>preferences</string> </value>
<value> <string>action_preferences</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>preferences</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,36 +13,36 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>global</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/global</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>5.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>property_sheet_tool</string> </value>
<value> <string>action_property_sheet_tool</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>5.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>property_sheet_tool</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,36 +13,36 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_search</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_search</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>100.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>search</string> </value>
<value> <string>action_search</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>100.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>search</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,36 +13,36 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_sort</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_sort</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>100.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>sort_on</string> </value>
<value> <string>action_sort_on</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>100.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>sort_on</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,36 +13,36 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>global</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/global</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>4.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>types_tool</string> </value>
<value> <string>action_types_tool</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>4.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>types_tool</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<global name="Action Information" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,8 +13,20 @@
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>global</string> </value>
<key> <string>action_permission</string> </key>
<value>
<tuple>
<string>List undoable changes</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/global</string>
</tuple>
</value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -27,24 +39,16 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
<key> <string>float_index</string> </key>
<value> <float>10.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>undo</string> </value>
<value> <string>action_undo</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>List undoable changes</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>10.0</float> </value>
<key> <string>reference</string> </key>
<value> <string>undo</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/global</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>global</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>global</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/user</string>
<string>action_type/object_ui</string>
<string>action_type/object_sort</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>object_sort</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>object_sort</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/user</string>
<string>action_type/object_ui</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>object_ui</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>object_ui</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/user</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>user</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>user</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/user</string>
<string>action_type/object_ui</string>
<string>action_type/object_sort</string>
<string>action_type/workflow</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>workflow</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<allowed_content_type_list>
<portal_type id="Actions Tool">
<item>Action Information</item>
</portal_type>
<portal_type id="Activity Tool">
<item>Active Process</item>
</portal_type>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_property_domain_dict</string> </key>
<value>
<dictionary>
<item>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>acquire_local_roles</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>content_icon</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_meta_type</string> </key>
<value> <string>ERP5 Types Tool</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>The Types Tool centralises all portal type definitions.</string> </value>
</item>
<item>
<key> <string>factory</string> </key>
<value> <string>addFolder</string> </value>
</item>
<item>
<key> <string>filter_content_types</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Actions Tool</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>ActionsTool</string> </value>
</item>
<item>
<key> <string>type_interface</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_mixin</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Acquired Property | view
Action Information | view
Actions Tool | view
Active Process | view
Activity Tool | view
Activity Tool | watch_report
......@@ -135,22 +136,3 @@ Trash Folder | view
Trash Tool | view
Types Tool | view
ZODB Continuous Increasing Id Generator | view
portal_actions | bt_tool
portal_actions | category_tool
portal_actions | component_tool
portal_actions | create_module
portal_actions | history
portal_actions | list_ui
portal_actions | make_template
portal_actions | mass_workflow
portal_actions | metadata
portal_actions | module_view
portal_actions | portal_alarms_action
portal_actions | property_sheet_tool
portal_actions | search
portal_actions | sort_on
portal_actions | types_tool
portal_membership | login
portal_membership | logout
portal_membership | preferences
portal_undo | undo
\ No newline at end of file
portal_actions/action_bt_tool
portal_actions/action_category_tool
portal_actions/action_component_tool
portal_actions/action_create_module
portal_actions/action_history
portal_actions/action_list_ui
portal_actions/action_login
portal_actions/action_logout
portal_actions/action_make_template
portal_actions/action_mass_workflow
portal_actions/action_metadata
portal_actions/action_module_view
portal_actions/action_portal_alarms_action
portal_actions/action_preferences
portal_actions/action_property_sheet_tool
portal_actions/action_search
portal_actions/action_sort_on
portal_actions/action_types_tool
portal_actions/action_undo
portal_alarms/expired_password_alarm
portal_caches/erp5_content_long
portal_caches/erp5_content_long/default_ram_cache
......
Actions Tool | Action Information
Activity Tool | Active Process
Alarm Tool | Alarm
Applied Rule | Simulation Movement
......
Acknowledgement Tool
Acquired Property
Action Information
Actions Tool
Active Process
Activity Tool
Alarm
......
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
# 2006 Nexedi
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Utils import deprecated
from Products.ERP5Type import Permissions
class ActionProviderBase(object):
"""
Provide Translation Tabs and management methods for PropertyTranslationDomain
"""
security = ClassSecurityInfo()
security.declarePrivate('getCacheableActionList')
def getCacheableActionList(self):
"""Return a cacheable list of enabled actions"""
return [action.getCacheableAction()
for action in self.getActionInformationList()
if action.isVisible()]
def _getActionList(self):
action_list = self.getCacheableActionList()
# This sort is a duplicate of calculation with what is done
# on portal_actions.listFilteredActionsFor . But getDefaultViewFor
# needs the sort here. This needs to be reviewed, because it is possible
# to define in portal_actions some actions that will have higher
# priorities than actions defined on portal types
action_list.sort(key=lambda x:x['priority'])
return action_list
_getActionList = CachingMethod(_getActionList,
id='getActionList',
cache_factory='erp5_content_long',
cache_id_generator=lambda method_id, *args: method_id)
security.declarePrivate('getActionList')
def getActionList(self):
"""Return the list of enabled actions from cache, sorted by priority"""
return self._getActionList(self, scope=self.id)
security.declareProtected(Permissions.ModifyPortalContent,
'clearGetActionListCache')
def clearGetActionListCache(self):
"""Clear a cache of _getRawActionInformationList."""
self._getActionList.delete(scope=self.id)
security.declareProtected(Permissions.AccessContentsInformation,
'getActionInformationList')
def getActionInformationList(self):
"""Return all Action Information objects stored on this portal type"""
return self.objectValues(meta_type='ERP5 Action Information')
#
# XXX CMF compatibility
#
def _importOldAction(self, old_action):
"""Convert a CMF action to an ERP5 action
This is used to update an existing site or to import a BT.
"""
import erp5.portal_type
ActionInformation = getattr(erp5.portal_type, 'Action Information')
old_action = old_action.__getstate__()
action_type = old_action.pop('category', None)
action_id = "action_%s" % old_action['id']
action = ActionInformation(action_id)
for k, v in old_action.iteritems():
if k in ('action', 'condition', 'icon'):
if not v:
continue
v = v.__class__(v.text)
setattr(action, {'id': 'reference',
'priority': 'float_index',
'permissions': 'action_permission',
}.get(k, k), v)
action.uid = None
action = self[self._setObject(action.id, action, set_owner=0)]
#action = self[_eventLessSetObject(self)(action.id, action, set_owner=0)]
if action_type:
action._setCategoryMembership('action_type', action_type)
return action
def _exportOldAction(self, action):
"""Convert an ERP5 action to a CMF action
This is used to export a BT.
"""
from Products.CMFCore.ActionInformation import ActionInformation
old_action = ActionInformation(action.reference,
category=action.getActionType(),
priority=action.getFloatIndex(),
permissions=tuple(action.getActionPermissionList()))
for k, v in action.__dict__.iteritems():
if k in ('action', 'condition', 'icon'):
if not v:
continue
v = v.__class__(v.text)
elif k in ('id', 'float_index', 'action_permission', 'reference'):
continue
setattr(old_action, k, v)
return old_action
security.declareProtected(Permissions.AddPortalContent, 'addAction')
@deprecated
def addAction(self, id, name, action, condition, permission, category,
icon=None, visible=1, priority=1.0, REQUEST=None,
description=None):
"""
Not used
"""
if isinstance(permission, basestring):
permission = permission,
self.newContent("action_%s" % (id,),
portal_type='Action Information',
reference=id,
title=name,
action=action,
condition=condition,
permission_list=permission,
action_type=category,
icon=icon,
visible=visible,
float_index=priority,
description=description)
security.declareProtected(Permissions.ModifyPortalContent, 'deleteActions')
@deprecated
def deleteActions(self, selections=(), REQUEST=None):
action_list = self.listActions()
self.manage_delObjects([action_list[x].id for x in selections])
security.declarePrivate('listActions')
@deprecated
def listActions(self, info=None, object=None):
""" List all the actions defined by a provider."""
return sorted(self.getActionInformationList(),
key=lambda x: (x.getFloatIndex(), x.getId()))
InitializeClass(ActionProviderBase)
......@@ -20,6 +20,7 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
from Products.ERP5Type.ActionProviderBase import ActionProviderBase
import zope.interface
from Products.ERP5Type.Globals import InitializeClass
......@@ -35,7 +36,6 @@ from Products.ERP5Type.Base import getClassPropertyList
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Products.ERP5Type.Utils import deprecated, createExpressionContext
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.dynamic.accessor_holder import getPropertySheetValueList, \
getAccessorHolderList
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
......@@ -212,6 +212,7 @@ class LocalRoleAssignorMixIn(object):
InitializeClass(LocalRoleAssignorMixIn)
class ERP5TypeInformation(XMLObject,
ActionProviderBase,
FactoryTypeInformation,
LocalRoleAssignorMixIn,
TranslationProviderBase):
......@@ -647,44 +648,6 @@ class ERP5TypeInformation(XMLObject,
__traceback_info__ = self.getId(), target
return ob.restrictedTraverse(target)
security.declarePrivate('getCacheableActionList')
def getCacheableActionList(self):
"""Return a cacheable list of enabled actions"""
return [action.getCacheableAction()
for action in self.getActionInformationList()
if action.isVisible()]
def _getActionList(self):
action_list = self.getCacheableActionList()
# This sort is a duplicate of calculation with what is done
# on portal_actions.listFilteredActionsFor . But getDefaultViewFor
# needs the sort here. This needs to be reviewed, because it is possible
# to define in portal_actions some actions that will have higher
# priorities than actions defined on portal types
action_list.sort(key=lambda x:x['priority'])
return action_list
_getActionList = CachingMethod(_getActionList,
id='getActionList',
cache_factory='erp5_content_long',
cache_id_generator=lambda method_id, *args: method_id)
security.declarePrivate('getActionList')
def getActionList(self):
"""Return the list of enabled actions from cache, sorted by priority"""
return self._getActionList(self, scope=self.id)
security.declareProtected(Permissions.ModifyPortalContent,
'clearGetActionListCache')
def clearGetActionListCache(self):
"""Clear a cache of _getRawActionInformationList."""
self._getActionList.delete(scope=self.id)
security.declareProtected(Permissions.AccessContentsInformation,
'getActionInformationList')
def getActionInformationList(self):
"""Return all Action Information objects stored on this portal type"""
return self.objectValues(meta_type='ERP5 Action Information')
def getIcon(self):
try:
return self.getTypeIcon()
......@@ -741,85 +704,4 @@ class ERP5TypeInformation(XMLObject,
def getHiddenContentTypeList(self):
return self.getTypeHiddenContentTypeList(())
# Compatibitility code for actions
security.declareProtected(Permissions.AddPortalContent, 'addAction')
@deprecated
def addAction(self, id, name, action, condition, permission, category,
icon=None, visible=1, priority=1.0, REQUEST=None,
description=None):
if isinstance(permission, basestring):
permission = permission,
if isinstance(action, str) and action[:7] not in ('string:', 'python:'):
value = 'string:${object_url}/' + value
self.newContent(portal_type='Action Information',
reference=id,
title=name,
action=action,
condition=condition,
permission_list=permission,
action_type=category,
icon=icon,
visible=visible,
float_index=priority,
description=description)
security.declareProtected(Permissions.ModifyPortalContent, 'deleteActions')
@deprecated
def deleteActions(self, selections=(), REQUEST=None):
action_list = self.listActions()
self.manage_delObjects([action_list[x].id for x in selections])
security.declarePrivate('listActions')
@deprecated
def listActions(self, info=None, object=None):
""" List all the actions defined by a provider."""
return sorted(self.getActionInformationList(),
key=lambda x: (x.getFloatIndex(), x.getId()))
def _importOldAction(self, old_action):
"""Convert a CMF action to an ERP5 action
This is used to update an existing site or to import a BT.
"""
import erp5.portal_type
ActionInformation = getattr(erp5.portal_type, 'Action Information')
old_action = old_action.__getstate__()
action_type = old_action.pop('category', None)
action = ActionInformation(self.generateNewId())
for k, v in old_action.iteritems():
if k in ('action', 'condition', 'icon'):
if not v:
continue
v = v.__class__(v.text)
setattr(action, {'id': 'reference',
'priority': 'float_index',
'permissions': 'action_permission',
}.get(k, k), v)
action.uid = None
action = self[self._setObject(action.id, action, set_owner=0)]
if action_type:
action._setCategoryMembership('action_type', action_type)
return action
def _exportOldAction(self, action):
"""Convert an ERP5 action to a CMF action
This is used to export a BT.
"""
from Products.CMFCore.ActionInformation import ActionInformation
old_action = ActionInformation(action.reference,
category=action.getActionType(),
priority=action.getFloatIndex(),
permissions=tuple(action.getActionPermissionList()))
for k, v in action.__dict__.iteritems():
if k in ('action', 'condition', 'icon'):
if not v:
continue
v = v.__class__(v.text)
elif k in ('id', 'float_index', 'action_permission', 'reference'):
continue
setattr(old_action, k, v)
return old_action
InitializeClass( ERP5TypeInformation )
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
# Julien Muchembled <jm@nexedi.com>
# Boris Kocherov <bk@raskon.ru>
#
# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
import logging
logger = logging.getLogger(__name__)
from Products.CMFCore.interfaces import IActionProvider, IActionsTool
import zope.interface
from AccessControl import ClassSecurityInfo
from Products.CMFCore import ActionsTool as CMFCore_ActionsToolModule
from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type.ActionProviderBase import ActionProviderBase
from Products.ERP5Type import Permissions
from zLOG import LOG, WARNING
CMFCore_ActionsTool = CMFCore_ActionsToolModule.ActionsTool
def _eventLessSetObject(container):
_setObject = container._setObject
return lambda *args, **kw: _setObject(suppress_events=True, *args, **kw)
def checkAndCreateActionToolBaseCategory(parent):
if not parent.portal_categories.hasObject('action_type'):
# Required to generate ActionInformation.getActionType accessor.
import erp5
action_type = getattr(erp5.portal_type, 'Base Category')('action_type')
action_type.uid = None
_eventLessSetObject(parent.portal_categories)(action_type.id, action_type)
class ActionsTool(BaseTool, ActionProviderBase, CMFCore_ActionsTool):
"""Provides a configurable registry of portal content types
"""
id = "portal_actions"
meta_type = 'ERP5 Actions Tool'
portal_type = 'Actions Tool'
allowed_types = ()
zope.interface.implements(IActionsTool)
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
def migrateNonProviders(self):
portal_actions_path = '/'.join(self.getPhysicalPath())
portal = self.getPortalObject()
action_providers = list(self.action_providers)
for provider_name in self.listActionProviders():
provider = getattr(portal, provider_name)
if (getattr(provider, '_actions', ()) and
getattr(provider, 'listActionInfos', None) is None ):
logger.info('migrating actions from %r to %r',
portal_actions_path, '/'.join(provider.getPhysicalPath()))
for old_action in provider._actions:
self._importOldAction(old_action)
del provider._actions
if (getattr(provider, 'listActionInfos', None) is None and
getattr(provider, 'getActionListFor', None) is None and
not (IActionProvider.providedBy(provider))):
action_providers.remove(provider_name)
self.action_providers = tuple(action_providers)
security.declarePrivate('getActionListFor')
def getActionListFor(self, ob=None):
"""Return all actions applicable to the object"""
old_actions = self._actions or ()
if old_actions:
LOG('OldActionsTool', WARNING, "Converting portal_actions...")
checkAndCreateActionToolBaseCategory(self)
for action_info in old_actions:
self._importOldAction(action_info)
LOG('OldActionsTool', WARNING, "... portal_actions converted.")
self._actions = ()
if ob is not None:
return (action.getCacheableAction() for action in self.objectValues())
return ()
def listFilteredActionsFor(self, object=None):
""" List all actions available to the user.
This patch removes inclusion of actions from the object itself.
It was never used and now, it breaks objects inside Types Tool.
It also checks for a new ERP5-only actions API (getActionListFor), but
this API should be moved to listActionInfos() of each tool so as not to
create duplicate code paths that are sources of bugs.
Finally, this patch detects tools that are no longer action providers and
invokes the migration of their actions to portal_actions
"""
actions = []
portal = self.getPortalObject()
# Include actions from specific tools.
for provider_name in self.listActionProviders():
provider = getattr(portal, provider_name)
if hasattr(provider, 'getActionListFor'):
from Products.ERP5Type.Utils import createExpressionContext
ec = createExpressionContext(object)
actions.extend(action.cook(ec)
for action in provider.getActionListFor(object)
if action.test(ec))
elif IActionProvider.providedBy(provider):
actions.extend(provider.listActionInfos(object=object))
else:
# This should only be triggered once
# We're in 2.12 and we need to migrate objects that are no longer
# IActionProviders:
self.migrateNonProviders()
# Recompute from beginning
return self.listFilteredActionsFor(object=object)
actions.sort(key=lambda x: x.get('priority', 0))
# Reorganize the actions by category.
filtered_actions = {'user': [],
'folder': [],
'object': [],
'global': [],
'workflow': [],
}
for action in actions:
filtered_actions.setdefault(action['category'], []).append(action)
return filtered_actions
# Change the CMFCore's ActionsTool to automatically migrate to ERP5Actions's
# ActionsTool
CMFCore_ActionsToolModule.ActionsTool = ActionsTool
......@@ -18,6 +18,7 @@
import imp, sys, warnings
import inspect
from itertools import chain
from Products.ERP5Type.Tool.ActionsTool import checkAndCreateActionToolBaseCategory
import zope.interface
from Acquisition import aq_base
from AccessControl import ClassSecurityInfo
......@@ -367,12 +368,7 @@ class OldTypesTool(OFSFolder):
del parent.portal_types
_eventLessSetObject(parent)(TypesTool.id, types_tool, set_owner=0)
types_tool = types_tool.__of__(parent)
if not parent.portal_categories.hasObject('action_type'):
# Required to generate ActionInformation.getActionType accessor.
import erp5
action_type = getattr(erp5.portal_type, 'Base Category')('action_type')
action_type.uid = None
parent.portal_categories._setObject(action_type.id, action_type)
checkAndCreateActionToolBaseCategory(parent)
for type_info in self.objectValues():
self._migratePortalType(types_tool, type_info)
types_tool.activate()._finalizeMigration()
......
......@@ -43,7 +43,6 @@ from Products.ERP5Type.patches import States
from Products.ERP5Type.patches import FSZSQLMethod
from Products.ERP5Type.patches import ActionInformation
from Products.ERP5Type.patches import ActionProviderBase
from Products.ERP5Type.patches import ActionsTool
from Products.ERP5Type.patches import CookieCrumbler
from Products.ERP5Type.patches import PropertySheets
from Products.ERP5Type.patches import CMFCoreSkinnable
......
......@@ -89,7 +89,7 @@ def initialize( context ):
# Import Product Components
from Tool import (CacheTool, MemcachedTool, SessionTool,
TypesTool, WebServiceTool, PropertySheetTool,
ComponentTool)
ComponentTool, ActionsTool)
import Document
from Base import Base
import XMLObject
......@@ -107,7 +107,8 @@ def initialize( context ):
TypesTool.TypesTool,
WebServiceTool.WebServiceTool,
PropertySheetTool.PropertySheetTool,
ComponentTool.ComponentTool
ComponentTool.ComponentTool,
ActionsTool.ActionsTool,
)
# Do initialization step
initializeProduct(context, this_module, globals(),
......
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
# Copyright (c) 2009 Nexedi SARL and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import logging
logger = logging.getLogger(__name__)
from Products.ERP5Type.Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from Products.CMFCore.ActionsTool import ActionsTool
from Products.CMFCore.interfaces import IActionProvider
from Products.CMFCore.permissions import ManagePortal
security = ClassSecurityInfo()
def migrateNonProviders(portal_actions):
portal_actions_path = '/'.join(portal_actions.getPhysicalPath())
portal = portal_actions.getPortalObject()
action_providers = list(portal_actions.action_providers)
for provider_name in portal_actions.listActionProviders():
provider = getattr(portal, provider_name)
if ( getattr(provider, '_actions', ()) and
getattr(provider, 'listActionInfos', None) is None ):
logger.info('migrating actions from %r to %r',
portal_actions_path, '/'.join(provider.getPhysicalPath()))
portal_actions._actions += provider._actions
del provider._actions
if (getattr(provider, 'listActionInfos', None) is None and
getattr(provider, 'getActionListFor', None) is None and
not(IActionProvider.providedBy(provider))):
action_providers.remove(provider_name)
portal_actions.action_providers = tuple(action_providers)
ActionsTool_listFilteredActionsFor = ActionsTool.listFilteredActionsFor
def listFilteredActionsFor(self, object=None):
""" List all actions available to the user.
This patch removes inclusion of actions from the object itself.
It was never used and now, it breaks objects inside Types Tool.
It also checks for a new ERP5-only actions API (getActionListFor), but
this API should be moved to listActionInfos() of each tool so as not to
create duplicate code paths that are sources of bugs.
Finally, this patch detects tools that are no longer action providers and
invokes the migration of their actions to portal_actions
"""
actions = []
# Include actions from specific tools.
for provider_name in self.listActionProviders():
provider = getattr(self, provider_name)
if hasattr(provider, 'getActionListFor'):
from Products.ERP5Type.Utils import createExpressionContext
ec = createExpressionContext(object)
actions.extend(action.cook(ec)
for action in provider.getActionListFor(object)
if action.test(ec))
elif IActionProvider.providedBy(provider):
actions.extend( provider.listActionInfos(object=object) )
else:
# This should only be triggered once
# We're in 2.12 and we need to migrate objects that are no longer
# IActionProviders:
migrateNonProviders(self)
# Recompute from beginning
return self.listFilteredActionsFor(object=object)
actions.sort(key=lambda x:x.get('priority', 0))
# Reorganize the actions by category.
filtered_actions={'user':[],
'folder':[],
'object':[],
'global':[],
'workflow':[],
}
for action in actions:
filtered_actions.setdefault(action['category'], []).append(action)
return filtered_actions
ActionsTool.listFilteredActionsFor = listFilteredActionsFor
def reorderActions(self, REQUEST=None):
"""Reorder actions according to their priorities."""
new_actions = self._cloneActions()
new_actions.sort(key=lambda x: x.getPriority())
self._actions = tuple( new_actions )
if REQUEST is not None:
return self.manage_editActionsForm(REQUEST,
manage_tabs_message='Actions reordered.')
security.declareProtected(ManagePortal, 'reorderActions')
ActionsTool.reorderActions = reorderActions
ActionsTool.security = security
InitializeClass(ActionsTool)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment