[Erp5-report] r22643 - in /erp5/trunk/bt5/erp5_web: SkinTemplateItem/portal_skins/erp5_web_...
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Jul 24 17:51:22 CEST 2008
Author: ivan
Date: Thu Jul 24 17:51:19 2008
New Revision: 22643
URL: http://svn.erp5.org?rev=22643&view=rev
Log:
Make it possible to be used as a gadget renderer in both synchronous and asynchronous mode.
Improve code styling.
Modified:
erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Base_getAdminToolboxEditShortcutList.xml
erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/admin_toolbox.xml
erp5/trunk/bt5/erp5_web/bt/revision
Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Base_getAdminToolboxEditShortcutList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Base_getAdminToolboxEditShortcutList.xml?rev=22643&r1=22642&r2=22643&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Base_getAdminToolboxEditShortcutList.xml (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Base_getAdminToolboxEditShortcutList.xml Thu Jul 24 17:51:19 2008
@@ -95,56 +95,77 @@
absolute_url = context.absolute_url()\n
editable_absolute_url = getattr(context, \'editable_absolute_url\', absolute_url)\n
\n
+# action title based on security\n
+def getActionTitleForContext(context, portal_type):\n
+ if context.portal_membership.checkPermission(\'Modify portal content\', context):\n
+ edit_title = translateString("Edit ${portal_type}", \n
+ mapping=dict(portal_type=portal_type))\n
+ else:\n
+ edit_title = translateString("Access ${portal_type} details",\n
+ mapping=dict(portal_type=portal_type))\n
+ return edit_title\n
\n
# Append a button to edit the current document\n
if not request.form.get(\'editable_mode\', 0):\n
# The title is called Edit only if the document can be edited\n
- if context.portal_membership.checkPermission(\'Modify portal content\', context):\n
- edit_title = translateString("Edit ${portal_type}", mapping=dict(portal_type=portal_type))\n
+\n
+ if portal_type == \'Web Section\' and context.getDefaultDocumentValue() is not None:\n
+ # try to show link to default page\n
+ default_document = context.getDefaultDocumentValue()\n
+ # change portal_type, this will be taken into account when determining parent action (below)\n
+ portal_type = default_document.getPortalType() \n
+ edit_title = getActionTitleForContext(context, portal_type)\n
+ result.append(dict(\n
+ url = "%s/view?editable_mode:int=1&%s" \n
+ %(default_document.absolute_url(), http_parameters),\n
+ icon = default_document.getIcon() or \'file_icon.gif\',\n
+ title = edit_title,\n
+ label = "%s Icon" % portal_type,))\n
else:\n
- edit_title = translateString("Access ${portal_type} details", mapping=dict(portal_type=portal_type))\n
+ edit_title = getActionTitleForContext(context, portal_type)\n
+ result.append(dict(\n
+ url = "%s/view?editable_mode:int=1&%s" \n
+ %(editable_absolute_url, http_parameters),\n
+ icon = context.getIcon() or \'file_icon.gif\',\n
+ title = edit_title,\n
+ label = "%s Icon" % portal_type,))\n
+\n
+else: \n
result.append(dict(\n
- url = "%s/view?editable_mode:int=1&%s" % (editable_absolute_url, http_parameters),\n
- icon = context.getIcon() or \'file_icon.gif\',\n
- title = edit_title,\n
- label = "%s Icon" % portal_type,\n
-))\n
-else: result.append(dict(\n
- url = "%s/view?editable_mode:int=0&%s" % (absolute_url, http_parameters),\n
- icon = context.getIcon() or \'file_icon.gif\',\n
- title = translateString("View ${portal_type}", mapping=dict(portal_type=portal_type)),\n
- label = "%s Icon" % portal_type,\n
-))\n
+ url = "%s/view?editable_mode:int=0&%s" % (absolute_url, http_parameters),\n
+ icon = context.getIcon() or \'file_icon.gif\',\n
+ title = translateString("View ${portal_type}", \n
+ mapping=dict(portal_type=portal_type)),\n
+ label = "%s Icon" % portal_type,))\n
\n
# Append a button to edit the parent section\n
-if portal_type not in (\'Web Section\', \'Web Site\'): result.append(dict(\n
- url = "%s/view?editable_mode=1" % current_web_section.absolute_url(),\n
- icon = current_web_section.getIcon(),\n
- title = translateString("Edit parent ${portal_type}", mapping=dict(portal_type=current_web_section_pt)),\n
- label = "%s Icon" % current_web_section_pt,\n
-))\n
+if portal_type not in (\'Web Section\', \'Web Site\'): \n
+ result.append(dict(\n
+ url = "%s/view?editable_mode=1" % current_web_section.absolute_url(),\n
+ icon = current_web_section.getIcon(),\n
+ title = translateString("Edit parent ${portal_type}",\n
+ mapping=dict(portal_type=current_web_section_pt)),\n
+ label = "%s Icon" % current_web_section_pt,))\n
\n
# Append all icon buttons\n
for action in button_action_list:\n
if action[\'id\'] == \'webdav\':\n
result.append(dict(\n
- url = action[\'url\'].replace(absolute_url, editable_absolute_url),\n
- icon = action[\'icon\'],\n
+ url = action[\'url\'].replace(absolute_url, editable_absolute_url),\n
+ icon = action[\'icon\'],\n
title = translateString(action[\'title\']),\n
- label = "WebDAV Icon",\n
- ))\n
+ label = "WebDAV Icon",))\n
\n
# Append an exchange button\n
if len(exchange_action_list):\n
action = exchange_action_list[0]\n
- url = action[\'url\'].replace(absolute_url, editable_absolute_url)\n
+ url = action[\'url\'].replace(absolute_url, editable_absolute_url)\n
url = \'%s?dialog_category=object_exchange&cancel_url=%s/view\' % (url, absolute_url)\n
result.append(dict(\n
- url = url,\n
+ url = url,\n
icon = \'%s/images/imp-exp.png\' % portal_url,\n
title = translateString(\'Import / Export\'),\n
- label = "Import / Export Icon",\n
- ))\n
+ label = "Import / Export Icon",))\n
\n
return result\n
@@ -159,6 +180,12 @@
</item>
<item>
<key> <string>_filepath</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_owner</string> </key>
<value>
<none/>
</value>
@@ -207,8 +234,11 @@
<string>absolute_url</string>
<string>getattr</string>
<string>editable_absolute_url</string>
+ <string>getActionTitleForContext</string>
+ <string>None</string>
+ <string>default_document</string>
+ <string>edit_title</string>
<string>dict</string>
- <string>edit_title</string>
<string>_getiter_</string>
<string>action</string>
<string>_getitem_</string>
Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/admin_toolbox.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/admin_toolbox.xml?rev=22643&r1=22642&r2=22643&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/admin_toolbox.xml (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/admin_toolbox.xml Thu Jul 24 17:51:19 2008
@@ -42,6 +42,12 @@
</value>
</item>
<item>
+ <key> <string>_owner</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
@@ -54,16 +60,17 @@
TODO: Is this case should be handle by automaticcaly by erp5_xhtml_style ?\n
-->\n
\n
-\n
<tal:block\n
tal:define="is_web_mode python: True;\n
portal_type python: here.getPortalType();\n
actions request/actions | python:\n
- here.Base_filterDuplicateActions(here.portal_actions.listFilteredActionsFor(here));\n
+ here.Base_filterDuplicateActions(\n
+ here.portal_actions.listFilteredActionsFor(here));\n
dummy python:request.set(\'actions\', actions);">\n
\n
<!-- XXX is this really useful - called how many times ?? - tried to removed but failed -->\n
<!-- <tal:block metal:use-macro="here/global_definitions/macros/header_definitions"/> -->\n
+\n
\n
<!-- Edit button menu -->\n
<div name="adminSection" class="adminSection">\n
Modified: erp5/trunk/bt5/erp5_web/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/bt/revision?rev=22643&r1=22642&r2=22643&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/bt/revision (original)
+++ erp5/trunk/bt5/erp5_web/bt/revision Thu Jul 24 17:51:19 2008
@@ -1,1 +1,1 @@
-690
+681
More information about the Erp5-report
mailing list