From d1c8fdbc706e3fa72bf2ef58be46d3d95471f877 Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Thu, 29 Jun 2006 07:52:51 +0000 Subject: [PATCH] Fix the way field tooltip is gathered from Property Sheets. Closes #377. Fix help URL generation. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8211 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_core/Base_getFieldDescription.xml | 10 +++--- .../erp5_core/Base_getHelpUrl.xml | 35 +++++++++---------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getFieldDescription.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getFieldDescription.xml index d587915223..30e4614838 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getFieldDescription.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getFieldDescription.xml @@ -71,11 +71,11 @@ <value> <string>desc = field.get_value(\'description\')\n \n if desc in (\'\', None):\n - if field.getId().startswith(\'my_\'):\n + id = field.getId().split(\'_\', 1)\n + if id[0] == \'my\':\n properties = context.propertyMap()\n - id = \'%s_\' % field.getId() # To avoid matching a subword\n for property in properties:\n - if \'_%s_\' % property[\'id\'] in id: # To avoid matching "my_"\n + if id[1] == property[\'id\']:\n return property.get(\'description\', \'\')\n \n return desc\n @@ -129,12 +129,12 @@ return desc\n <string>_getattr_</string> <string>desc</string> <string>None</string> + <string>id</string> + <string>_getitem_</string> <string>context</string> <string>properties</string> - <string>id</string> <string>_getiter_</string> <string>property</string> - <string>_getitem_</string> </tuple> </value> </item> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getHelpUrl.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getHelpUrl.xml index 462aa2791c..d80f1b6c4f 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getHelpUrl.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getHelpUrl.xml @@ -68,14 +68,14 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>if context.REQUEST.has_key(\'workflow_action\'): # We are on a workflow transition\n - help = \'%s#%s\' % (getattr(getattr(context, form_id), \'form_action\'),context.REQUEST[\'workflow_action\'])\n -elif action is not None:\n - help = \'%s#%s\' % (context.getPortalType(), action)\n -elif form_id is not None:\n - help = \'%s_%s\' % (context.getPortalType(), form_id)\n -else:\n - help = context.getPortalType()\n + <value> <string>help = context.getPortalType()\n +if workflow_action is not None: # First, the workflow transition case.\n + help = \'%s_%s\' % (help, workflow_action)\n +elif current_action is not None: # Then, we are able to get the action.\n + help = \'%s_%s\' % (help, current_action[\'id\'])\n +elif dialog_id is not None: # Otherwise, get the form we are in.\n + help = \'%s_%s\' % (help, dialog_id)\n +# Otherwise again, just use the portal type as page name.\n return \'%s/%s\' % (context.portal_preferences.getPreferredHtmlStyleDocumentationBaseUrl(), help)\n </string> </value> </item> @@ -97,7 +97,7 @@ return \'%s/%s\' % (context.portal_preferences.getPreferredHtmlStyleDocumentatio </item> <item> <key> <string>_params</string> </key> - <value> <string>form_id = None, action = None</string> </value> + <value> <string>current_action, dialog_id, workflow_action</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -117,20 +117,20 @@ return \'%s/%s\' % (context.portal_preferences.getPreferredHtmlStyleDocumentatio <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>2</int> </value> + <value> <int>3</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> - <string>form_id</string> - <string>action</string> + <string>current_action</string> + <string>dialog_id</string> + <string>workflow_action</string> <string>_getattr_</string> -<string>context</string> - <string>getattr</string> - <string>_getitem_</string> + <string>context</string> <string>help</string> <string>None</string> + <string>_getitem_</string> </tuple> </value> </item> @@ -142,10 +142,7 @@ return \'%s/%s\' % (context.portal_preferences.getPreferredHtmlStyleDocumentatio <item> <key> <string>func_defaults</string> </key> <value> - <tuple> - <none/> - <none/> - </tuple> + <none/> </value> </item> <item> -- 2.30.9