Commit d61d906b authored by Arnaud Fontaine's avatar Arnaud Fontaine

erp5_core: Allow to jump from a Portal Type to its currently set Property Sheets.

parent 84f100ea
<?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_jump</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jump</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</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>jump_property_sheets</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>Property Sheets</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_jumpToPropertySheetList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python:portal.Base_checkPermission(\'portal_property_sheets\', \'View\')</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_jump</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jump</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</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>jump_property_sheets</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>Property Sheets</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_jumpToPropertySheetList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python:portal.Base_checkPermission(\'portal_property_sheets\', \'View\')</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_jump</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jump</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</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>jump_property_sheets</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>Property Sheets</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_jumpToPropertySheetList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python:portal.Base_checkPermission(\'portal_property_sheets\', \'View\')</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
translateString = portal.Base_translateString\n
\n
property_sheet_value_list = context.getRecursivePropertySheetValueList()\n
if not len(property_sheet_value_list):\n
return context.Base_redirect(\n
\'view\',\n
keep_items={\'portal_status_message\':\n
translateString(\'No ${portal_type} related.\',\n
mapping={\'portal_type\': \'Property Sheet\'})})\n
\n
elif len(property_sheet_value_list) == 1:\n
property_sheet = property_sheet_value_list[0]\n
return property_sheet.Base_redirect(\n
\'view\',\n
keep_items={\'portal_status_message\':\n
translateString(\'${this_portal_type} related to ${that_portal_type}: ${that_title}.\',\n
mapping={\'this_portal_type\': \'Property Sheet\',\n
\'that_portal_type\': context.getPortalType(),\n
\'that_title\': context.getTitleOrId()})})\n
\n
property_sheet_uid_list = [property_sheet.getUid()\n
for property_sheet in property_sheet_value_list]\n
\n
return portal.portal_property_sheets.Base_redirect(\n
\'view\',\n
keep_items={\'reset\': 1,\n
\'ignore_hide_rows\': 1,\n
\'uid\': property_sheet_uid_list})\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>BaseType_jumpToPropertySheetList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2015-06-08 arnaud.fontaine
* Allow to jump from a Portal Type to its currently set Property Sheets.
2015-06-08 arnaud.fontaine 2015-06-08 arnaud.fontaine
* Sort Property Sheets by ID by default. * Sort Property Sheets by ID by default.
......
...@@ -23,6 +23,7 @@ Attribute Unicity Constraint | view ...@@ -23,6 +23,7 @@ Attribute Unicity Constraint | view
Base Category | view Base Category | view
Base Domain | view Base Domain | view
Base Type | action_view Base Type | action_view
Base Type | jump_property_sheets
Base Type | role_view Base Type | role_view
Base Type | translation_view Base Type | translation_view
Base Type | update_local_roles Base Type | update_local_roles
...@@ -79,10 +80,12 @@ Id Tool | view ...@@ -79,10 +80,12 @@ Id Tool | view
Memcached Plugin | view Memcached Plugin | view
Memcached Tool | view Memcached Tool | view
Predicate | view Predicate | view
Preference Tool Type | jump_property_sheets
Preference Tool Type | view Preference Tool Type | view
Preference Tool | advanced Preference Tool | advanced
Preference Tool | view Preference Tool | view
Preference Type | action_view Preference Type | action_view
Preference Type | jump_property_sheets
Preference Type | role_view Preference Type | role_view
Preference Type | translation_view Preference Type | translation_view
Preference Type | update_local_roles Preference Type | update_local_roles
......
...@@ -467,6 +467,34 @@ class ERP5TypeInformation(XMLObject, ...@@ -467,6 +467,34 @@ class ERP5TypeInformation(XMLObject,
self.getPortalType(), self.getPortalType(),
type_property_sheet_value_list) type_property_sheet_value_list)
security.declareProtected(Permissions.AccessContentsInformation,
'getRecursivePropertySheetValueList')
def getRecursivePropertySheetValueList(self):
"""
Get all the Property Sheets for this Portal Type, not only the one set on
'type_property_sheet' property but also the ones defined on
'property_sheets' property on each parent classes.
"""
import erp5.portal_type
portal_type_class = getattr(erp5.portal_type, self.getId())
portal_type_class.loadClass()
# XXX-arnau: There should be no need of checking this property (IOW
# checking the MRO should be enough), but this is not enough for Portal
# Types Accessor Holder (erp5.accessor_holder.portal_type), used by
# Preferences for example (defining getAccessorHolderList() which
# returns a single Accessor Holder from several Property
# Sheets). Probably this behavior should be changed to have one Accessor
# Holder per Property Sheet ?
property_sheet_name_set = set(self.getTypePropertySheetList())
for klass in portal_type_class.mro():
if klass.__module__ == 'erp5.accessor_holder.property_sheet':
property_sheet_name_set.add(klass.__name__)
return getPropertySheetValueList(self.getPortalObject(),
property_sheet_name_set)
# XXX these methods, _baseGetTypeClass, getTypeMixinList, and # XXX these methods, _baseGetTypeClass, getTypeMixinList, and
# getTypeInterfaceList, are required for a bootstrap issue that # getTypeInterfaceList, are required for a bootstrap issue that
# the portal type class Base Type is required for _aq_dynamic on # the portal type class Base Type is required for _aq_dynamic on
......
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