From 097ed94163e16611112181d0c1c05f95b2004020 Mon Sep 17 00:00:00 2001 From: Fabien Morin <fabien@nexedi.com> Date: Wed, 3 Feb 2010 10:32:18 +0000 Subject: [PATCH] Improve GadgetTool_viewPrettyGadgetDialog form : * GadgetTool_viewPrettyGadgetDialog is used to add a gadget in the current Knowledge Pad. It previously used an sub EditorField to display the gadget image. Instead of this, replace it by a ImageField, which will be use to standardize the rendering and size of all screenshots. * Add a new columns which shows the gadget description. * Replace the custom listmethod GadgetTool_getGadgetList by the standard portal_catalog call. * Use the portal type parameter to filter only Gadget. * Use the default parameters's parameter to pass the value of gadget_type_uid. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32218 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../GadgetTool_getGadgetList.xml | 139 ------------------ .../GadgetTool_viewPrettyGadgetDialog.xml | 2 +- .../listbox.xml | 116 ++++++++++++++- ..._description.xml => listbox_thumbnail.xml} | 119 ++++++++------- bt5/erp5_knowledge_pad/bt/revision | 2 +- 5 files changed, 172 insertions(+), 206 deletions(-) delete mode 100644 bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_getGadgetList.xml rename bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog/{listbox_description.xml => listbox_thumbnail.xml} (82%) diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_getGadgetList.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_getGadgetList.xml deleted file mode 100644 index cbc6492a43..0000000000 --- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_getGadgetList.xml +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <tuple> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - <tuple/> - </tuple> - </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>""" \n - Filter found gadgets in respect to the current mode.\n -"""\n -portal = context.getPortalObject()\n -mode = kw.get(\'mode\', None)\n -if mode is not None:\n - gadget_type_category = portal.restrictedTraverse(\'portal_categories/gadget_type/%s\' %mode,\n - None)\n - if gadget_type_category is not None:\n - kw[\'gadget_type_uid\'] = gadget_type_category.getUid()\n -return portal.portal_gadgets.searchFolder(**kw)\n -</string> </value> - </item> - <item> - <key> <string>_code</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>**kw</string> </value> - </item> - <item> - <key> <string>errors</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>func_code</string> </key> - <value> - <object> - <klass> - <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>co_argcount</string> </key> - <value> <int>0</int> </value> - </item> - <item> - <key> <string>co_varnames</string> </key> - <value> - <tuple> - <string>kw</string> - <string>_getattr_</string> - <string>context</string> - <string>portal</string> - <string>None</string> - <string>mode</string> - <string>gadget_type_category</string> - <string>_write_</string> - <string>_apply_</string> - </tuple> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>func_defaults</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>GadgetTool_getGadgetList</string> </value> - </item> - <item> - <key> <string>warnings</string> </key> - <value> - <tuple/> - </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog.xml index 83a7524d96..92add0d44d 100644 --- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog.xml +++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog.xml @@ -93,7 +93,7 @@ <key> <string>hidden</string> </key> <value> <list> - <string>listbox_description</string> + <string>listbox_thumbnail</string> </list> </value> </item> diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog/listbox.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog/listbox.xml index 87961a74b2..47debc1731 100644 --- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog/listbox.xml +++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog/listbox.xml @@ -16,12 +16,15 @@ <string>columns</string> <string>count_method</string> <string>css_class</string> + <string>default_params</string> <string>editable_columns</string> <string>hide_rows_on_no_search_criterion</string> <string>list_method</string> <string>portal_types</string> <string>search_columns</string> <string>selection_name</string> + <string>sort</string> + <string>sort_columns</string> <string>title</string> <string>url_columns</string> </list> @@ -65,6 +68,28 @@ <key> <string>tales</string> </key> <value> <dictionary> + <item> + <key> <string>columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>count_method</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default_params</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>editable_columns</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>field_id</string> </key> <value> <string></string> </value> @@ -73,10 +98,46 @@ <key> <string>form_id</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>hide_rows_on_no_search_criterion</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>list_method</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>portal_types</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>search_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>selection_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>sort</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>sort_columns</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>target</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>url_columns</string> </key> + <value> <string></string> </value> + </item> </dictionary> </value> </item> @@ -96,6 +157,10 @@ <string>description</string> <string>Description</string> </tuple> + <tuple> + <string>thumbnail</string> + <string>Thumbnail</string> + </tuple> </list> </value> </item> @@ -107,13 +172,19 @@ <key> <string>css_class</string> </key> <value> <string>full_width</string> </value> </item> + <item> + <key> <string>default_params</string> </key> + <value> + <list/> + </value> + </item> <item> <key> <string>editable_columns</string> </key> <value> <list> <tuple> - <string>description</string> - <string>Description</string> + <string>thumbnail</string> + <string>Thumbnail</string> </tuple> </list> </value> @@ -133,7 +204,7 @@ <item> <key> <string>list_method</string> </key> <value> - <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> </value> </item> <item> @@ -155,6 +226,10 @@ <string>translated_title</string> <string>Title</string> </tuple> + <tuple> + <string>description</string> + <string>Description</string> + </tuple> </list> </value> </item> @@ -162,6 +237,23 @@ <key> <string>selection_name</string> </key> <value> <string>gadget_tool_view_pretty_gadget_dialog</string> </value> </item> + <item> + <key> <string>sort</string> </key> + <value> + <list> + <tuple> + <string>title</string> + <string>Title</string> + </tuple> + </list> + </value> + </item> + <item> + <key> <string>sort_columns</string> </key> + <value> + <list/> + </value> + </item> <item> <key> <string>target</string> </key> <value> <string>Click to edit the target</string> </value> @@ -192,6 +284,22 @@ </pickle> </record> <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python:[[\'gadget_type_uid\', context.getPortalObject().restrictedTraverse(\'portal_categories/gadget_type/%s\' %request.get(\'mode\', None) , None) is not None and context.getPortalObject().restrictedTraverse(\'portal_categories/gadget_type/%s\' %request.get(\'mode\',None), None).getUid() or \'\'],]</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> <pickle> <tuple> <global name="Method" module="Products.Formulator.MethodField"/> @@ -202,7 +310,7 @@ <dictionary> <item> <key> <string>method_name</string> </key> - <value> <string>GadgetTool_getGadgetList</string> </value> + <value> <string>portal_catalog</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog/listbox_description.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog/listbox_thumbnail.xml similarity index 82% rename from bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog/listbox_description.xml rename to bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog/listbox_thumbnail.xml index 7c7bb7c416..0879296c55 100644 --- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog/listbox_description.xml +++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/GadgetTool_viewPrettyGadgetDialog/listbox_thumbnail.xml @@ -3,7 +3,7 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <global name="EditorField" module="Products.ERP5Form.EditorField"/> + <global name="ImageField" module="Products.ERP5Form.ImageField"/> <tuple/> </tuple> </pickle> @@ -11,7 +11,7 @@ <dictionary> <item> <key> <string>id</string> </key> - <value> <string>listbox_description</string> </value> + <value> <string>listbox_thumbnail</string> </value> </item> <item> <key> <string>message_values</string> </key> @@ -21,21 +21,13 @@ <key> <string>external_validator_failed</string> </key> <value> <string>The input failed the external validator.</string> </value> </item> - <item> - <key> <string>line_too_long</string> </key> - <value> <string>A line was too long.</string> </value> - </item> <item> <key> <string>required_not_found</string> </key> <value> <string>Input is required but no input given.</string> </value> </item> <item> <key> <string>too_long</string> </key> - <value> <string>You entered too many characters.</string> </value> - </item> - <item> - <key> <string>too_many_lines</string> </key> - <value> <string>You entered too many lines.</string> </value> + <value> <string>Too much input was given.</string> </value> </item> </dictionary> </value> @@ -60,6 +52,14 @@ <key> <string>description</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>editable</string> </key> <value> <string></string> </value> @@ -77,23 +77,23 @@ <value> <string></string> </value> </item> <item> - <key> <string>height</string> </key> + <key> <string>hidden</string> </key> <value> <string></string> </value> </item> <item> - <key> <string>hidden</string> </key> + <key> <string>image_display</string> </key> <value> <string></string> </value> </item> <item> - <key> <string>max_length</string> </key> + <key> <string>image_format</string> </key> <value> <string></string> </value> </item> <item> - <key> <string>max_linelength</string> </key> + <key> <string>image_resolution</string> </key> <value> <string></string> </value> </item> <item> - <key> <string>max_lines</string> </key> + <key> <string>max_length</string> </key> <value> <string></string> </value> </item> <item> @@ -101,11 +101,11 @@ <value> <string></string> </value> </item> <item> - <key> <string>text_editor</string> </key> + <key> <string>title</string> </key> <value> <string></string> </value> </item> <item> - <key> <string>title</string> </key> + <key> <string>truncate</string> </key> <value> <string></string> </value> </item> <item> @@ -116,10 +116,6 @@ <key> <string>whitespace_preserve</string> </key> <value> <string></string> </value> </item> - <item> - <key> <string>width</string> </key> - <value> <string></string> </value> - </item> </dictionary> </value> </item> @@ -145,6 +141,14 @@ <key> <string>description</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>editable</string> </key> <value> <string></string> </value> @@ -162,23 +166,23 @@ <value> <string></string> </value> </item> <item> - <key> <string>height</string> </key> + <key> <string>hidden</string> </key> <value> <string></string> </value> </item> <item> - <key> <string>hidden</string> </key> + <key> <string>image_display</string> </key> <value> <string></string> </value> </item> <item> - <key> <string>max_length</string> </key> + <key> <string>image_format</string> </key> <value> <string></string> </value> </item> <item> - <key> <string>max_linelength</string> </key> + <key> <string>image_resolution</string> </key> <value> <string></string> </value> </item> <item> - <key> <string>max_lines</string> </key> + <key> <string>max_length</string> </key> <value> <string></string> </value> </item> <item> @@ -186,11 +190,11 @@ <value> <string></string> </value> </item> <item> - <key> <string>text_editor</string> </key> + <key> <string>title</string> </key> <value> <string></string> </value> </item> <item> - <key> <string>title</string> </key> + <key> <string>truncate</string> </key> <value> <string></string> </value> </item> <item> @@ -201,10 +205,6 @@ <key> <string>whitespace_preserve</string> </key> <value> <string></string> </value> </item> - <item> - <key> <string>width</string> </key> - <value> <string></string> </value> - </item> </dictionary> </value> </item> @@ -218,7 +218,7 @@ </item> <item> <key> <string>css_class</string> </key> - <value> <string>hidden</string> </value> + <value> <string></string> </value> </item> <item> <key> <string>default</string> </key> @@ -228,6 +228,14 @@ <key> <string>description</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <int>20</int> </value> + </item> <item> <key> <string>editable</string> </key> <value> <int>0</int> </value> @@ -244,24 +252,24 @@ <key> <string>extra</string> </key> <value> <string></string> </value> </item> - <item> - <key> <string>height</string> </key> - <value> <int>5</int> </value> - </item> <item> <key> <string>hidden</string> </key> <value> <int>0</int> </value> </item> <item> - <key> <string>max_length</string> </key> - <value> <string></string> </value> + <key> <string>image_display</string> </key> + <value> <string>xsmall</string> </value> </item> <item> - <key> <string>max_linelength</string> </key> - <value> <string></string> </value> + <key> <string>image_format</string> </key> + <value> <string>png</string> </value> </item> <item> - <key> <string>max_lines</string> </key> + <key> <string>image_resolution</string> </key> + <value> <int>75</int> </value> + </item> + <item> + <key> <string>max_length</string> </key> <value> <string></string> </value> </item> <item> @@ -269,16 +277,12 @@ <value> <int>0</int> </value> </item> <item> - <key> <string>text_editor</string> </key> - <value> <string>text_area</string> </value> + <key> <string>title</string> </key> + <value> <string>Thumbnail</string> </value> </item> <item> - <key> <string>title</string> </key> - <value> <string encoding="cdata"><![CDATA[ - - - -]]></string> </value> + <key> <string>truncate</string> </key> + <value> <int>0</int> </value> </item> <item> <key> <string>unicode</string> </key> @@ -288,10 +292,6 @@ <key> <string>whitespace_preserve</string> </key> <value> <int>0</int> </value> </item> - <item> - <key> <string>width</string> </key> - <value> <int>40</int> </value> - </item> </dictionary> </value> </item> @@ -301,18 +301,15 @@ <record id="2" aka="AAAAAAAAAAI="> <pickle> <tuple> - <tuple> - <string>Products.Formulator.TALESField</string> - <string>TALESMethod</string> - </tuple> - <none/> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> </tuple> </pickle> <pickle> <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python: here.Gadget_viewPrettyHTMLDescriptionRenderer(cell=cell)</string> </value> + <value> <string>python:hasattr(cell, \'getObject\') and getattr(cell.getObject(), \'image_id\', None) is not None and \'%s/%s\' % (cell.getObject().absolute_url(), getattr(cell.getObject(), \'image_id\', None)) or \'\'</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_knowledge_pad/bt/revision b/bt5/erp5_knowledge_pad/bt/revision index 3b7560b755..95bae2dc25 100644 --- a/bt5/erp5_knowledge_pad/bt/revision +++ b/bt5/erp5_knowledge_pad/bt/revision @@ -1 +1 @@ -445 \ No newline at end of file +446 \ No newline at end of file -- 2.30.9