From 6ef5d6cbc0a49912b5a1985831908a5f715fca41 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Thu, 28 May 2020 15:53:06 +0000 Subject: [PATCH] erp5_web_renderjs_ui/hal_json_style: implement ParallelList field Display a ParallelList field as a list of sub fields calculated with the hash script. Keep previous HAL properties to keep compatibility for client without the JS implementation. --- .../ERP5Document_getHateoas.py | 37 ++ .../Foo/view_parallel_list_field.xml | 80 +++++ .../Foo_viewParallelListField.xml | 159 +++++++++ .../category_list.xml | 287 +++++++++++++++ .../my_category_list.xml | 138 ++++++++ .../Foo_viewParallelListField/my_title.xml | 265 ++++++++++++++ bt5/erp5_ui_test/bt/template_action_path_list | 1 + .../rjs_gadget_erp5_label_field_js.js | 5 +- .../rjs_gadget_erp5_label_field_js.xml | 4 +- ...js_gadget_erp5_parallellistfield_html.html | 20 ++ ...rjs_gadget_erp5_parallellistfield_html.xml | 334 ++++++++++++++++++ .../rjs_gadget_erp5_parallellistfield_js.js | 123 +++++++ .../rjs_gadget_erp5_parallellistfield_js.xml | 330 +++++++++++++++++ .../WebSection_getPrecacheManifest.py | 2 + .../testERP5Interface.zpt | 2 +- .../renderjs_ui_parallel_list_field_zuite.xml | 26 ++ .../testMultipleValidatorKeyEmptyField.xml | 58 +++ .../testMultipleValidatorKeyEmptyField.zpt | 259 ++++++++++++++ .../testNoValidatorKeyEmptyField.xml | 58 +++ .../testNoValidatorKeyEmptyField.zpt | 164 +++++++++ .../testSingleValidatorKeyEmptyField.xml | 58 +++ .../testSingleValidatorKeyEmptyField.zpt | 164 +++++++++ ...erp5.testFunctionalRJSParallelListField.py | 48 +++ ...rp5.testFunctionalRJSParallelListField.xml | 127 +++++++ .../bt/template_path_list | 2 + .../bt/template_test_id_list | 3 +- 26 files changed, 2748 insertions(+), 6 deletions(-) create mode 100644 bt5/erp5_ui_test/ActionTemplateItem/portal_types/Foo/view_parallel_list_field.xml create mode 100644 bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField.xml create mode 100644 bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField/category_list.xml create mode 100644 bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField/my_category_list.xml create mode 100644 bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField/my_title.xml create mode 100644 bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_html.html create mode 100644 bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_html.xml create mode 100644 bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_js.js create mode 100644 bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_js.xml create mode 100644 bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite.xml create mode 100644 bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testMultipleValidatorKeyEmptyField.xml create mode 100644 bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testMultipleValidatorKeyEmptyField.zpt create mode 100644 bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testNoValidatorKeyEmptyField.xml create mode 100644 bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testNoValidatorKeyEmptyField.zpt create mode 100644 bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testSingleValidatorKeyEmptyField.xml create mode 100644 bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testSingleValidatorKeyEmptyField.zpt create mode 100644 bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSParallelListField.py create mode 100644 bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSParallelListField.xml diff --git a/bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py b/bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py index 6cf6800e51..0059a333df 100644 --- a/bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py +++ b/bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py @@ -471,6 +471,43 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None, k "sub_select_key": traversed_document.Field_getSubFieldKeyDict(field, 'default:list', key=result["key"]), "sub_input_key": "default_" + traversed_document.Field_getSubFieldKeyDict(field, 'default:list:int', key=result["key"]) }) + + if meta_type == "ParallelListField": + # Keep all other keys (like items) even if huge + # This allows to support client without the parallelistfield JS implementation + hash_script_id = field.get_value('hash_script_id') + if hash_script_id: + # Copy the dict, as some hashscript cache the result, + # which should not in this case be modified + result.update({"subfield_list": [x.copy() for x in getattr(field, hash_script_id)( + [x for x in result['items'] if (x[1] and x[0])], + # Drop empty values + result['default'], + default_sub_field_property_dict={ + 'key': 'default', + 'field_type': 'MultiListField', + 'item_list': [], + 'value': [], + 'is_right_display': 0, + 'title': result['title'], + 'required': result['required'], + 'editable': result['editable'] + }, + is_right_display=0 + )]}) + for subdict in result['subfield_list']: + if subdict['title'] == ' ': + subdict['title'] = '' + subdict['items'] = subdict['item_list'] + del subdict['item_list'] + subdict['key'] = field.generate_subfield_key( + subdict['key'], key=result['key']) + + else: + result['subfield_list'] = [result.copy()] + result['subfield_list'][0]['field_type'] = 'MultiListField' + result['title'] = '' + return result if meta_type in ("StringField", "FloatField", "EmailField", "TextAreaField", diff --git a/bt5/erp5_ui_test/ActionTemplateItem/portal_types/Foo/view_parallel_list_field.xml b/bt5/erp5_ui_test/ActionTemplateItem/portal_types/Foo/view_parallel_list_field.xml new file mode 100644 index 0000000000..1a550641e7 --- /dev/null +++ b/bt5/erp5_ui_test/ActionTemplateItem/portal_types/Foo/view_parallel_list_field.xml @@ -0,0 +1,80 @@ +<?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> <string>A form with only a parallel list\n + field</string> </value> + </item> + <item> + <key> <string>icon</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>view_parallel_list_field</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>6.0</float> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Parallel List Field</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}/Foo_viewParallelListField</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField.xml b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField.xml new file mode 100644 index 0000000000..bbbbe5be15 --- /dev/null +++ b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField.xml @@ -0,0 +1,159 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ERP5 Form" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <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/> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_objects</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>action</string> </key> + <value> <string>Base_edit</string> </value> + </item> + <item> + <key> <string>action_title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Display a parallel list field for selenium tests</string> </value> + </item> + <item> + <key> <string>edit_order</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>encoding</string> </key> + <value> <string>UTF-8</string> </value> + </item> + <item> + <key> <string>enctype</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>group_list</string> </key> + <value> + <list> + <string>left</string> + <string>right</string> + <string>center</string> + <string>bottom</string> + <string>hidden</string> + </list> + </value> + </item> + <item> + <key> <string>groups</string> </key> + <value> + <dictionary> + <item> + <key> <string>bottom</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>center</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>left</string> </key> + <value> + <list> + <string>my_title</string> + <string>my_category_list</string> + </list> + </value> + </item> + <item> + <key> <string>right</string> </key> + <value> + <list> + <string>category_list</string> + </list> + </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Foo_viewParallelListField</string> </value> + </item> + <item> + <key> <string>method</string> </key> + <value> <string>POST</string> </value> + </item> + <item> + <key> <string>name</string> </key> + <value> <string>Foo_viewParallelListField</string> </value> + </item> + <item> + <key> <string>pt</string> </key> + <value> <string>form_view</string> </value> + </item> + <item> + <key> <string>row_length</string> </key> + <value> <int>4</int> </value> + </item> + <item> + <key> <string>stored_encoding</string> </key> + <value> <string>UTF-8</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Foo_viewParallelListField</string> </value> + </item> + <item> + <key> <string>unicode_mode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>update_action</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>update_action_title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField/category_list.xml b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField/category_list.xml new file mode 100644 index 0000000000..75ffd3151d --- /dev/null +++ b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField/category_list.xml @@ -0,0 +1,287 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="StringField" module="Products.Formulator.StandardFields"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>category_list</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</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>Too much input was given.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <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> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>input_type</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <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> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>input_type</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <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> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>input_type</string> </key> + <value> <string>text</string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Categories</string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: \' \'.join(here.getCategoryList())</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField/my_category_list.xml b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField/my_category_list.xml new file mode 100644 index 0000000000..5b55ca791d --- /dev/null +++ b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField/my_category_list.xml @@ -0,0 +1,138 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list> + <string>hash_script_id</string> + <string>items</string> + <string>title</string> + </list> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_category_list</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hash_script_id</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>items</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_parallel_list_field</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Base_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>hash_script_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>items</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Variation</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: here.getTitle() if here.getTitle(\'\').startswith(\'Base_\') else \'\'</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: [item for sub_list in [here.portal_categories[base_category].getCategoryChildCompactLogicalPathItemList(base=1) for base_category in [\'foo_category\', \'foo_big_category\']] for item in sub_list]</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField/my_title.xml b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField/my_title.xml new file mode 100644 index 0000000000..5ec0f5efc6 --- /dev/null +++ b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewParallelListField/my_title.xml @@ -0,0 +1,265 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="RadioField" module="Products.Formulator.StandardFields"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>my_title</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</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>unknown_selection</string> </key> + <value> <string>You selected an item that was not in the list.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra_item</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>first_item</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>items</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>orientation</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra_item</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>first_item</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>items</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>orientation</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra_item</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>first_item</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>items</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>orientation</string> </key> + <value> <string>vertical</string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Hash Mode</string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: [(\'empty\', here.getId()), (\'Base_hashCategoryList\', \'Base_hashCategoryList\'), (\'Base_getMultiListFieldPropertyDictList\', \'Base_getMultiListFieldPropertyDictList\')]</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_ui_test/bt/template_action_path_list b/bt5/erp5_ui_test/bt/template_action_path_list index 397594e3d1..5c20929a79 100644 --- a/bt5/erp5_ui_test/bt/template_action_path_list +++ b/bt5/erp5_ui_test/bt/template_action_path_list @@ -45,6 +45,7 @@ Foo | view_listbox Foo | view_multiple_listbox Foo | view_onlyjio Foo | view_onlyxhtml +Foo | view_parallel_list_field Foo | view_planning Foo | view_print_dialog Foo | view_printout_form diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.js b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.js index dc02a8aa79..182b02f8f3 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.js +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.js @@ -20,9 +20,10 @@ var field_url = 'gadget_erp5_field_readonly.html'; if (field_type === 'ListField') { field_url = 'gadget_erp5_field_list.html'; - } else if ((field_type === 'ParallelListField') || - (field_type === 'MultiListField')) { + } else if (field_type === 'MultiListField') { field_url = 'gadget_erp5_field_multilist.html'; + } else if (field_type === 'ParallelListField') { + field_url = 'gadget_erp5_field_parallellist.html'; } else if (field_type === 'CheckBoxField') { field_url = 'gadget_erp5_field_checkbox.html'; } else if (field_type === 'MultiCheckBoxField') { diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.xml index fe264cf2a4..56863c50f0 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.xml +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.xml @@ -234,7 +234,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>977.38881.34981.23125</string> </value> + <value> <string>984.13775.40486.16469</string> </value> </item> <item> <key> <string>state</string> </key> @@ -252,7 +252,7 @@ </tuple> <state> <tuple> - <float>1590484760.02</float> + <float>1590753601.02</float> <string>UTC</string> </tuple> </state> diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_html.html b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_html.html new file mode 100644 index 0000000000..d0a3b917ea --- /dev/null +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_html.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> + <head> + <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> + <meta name="viewport" content="width=device-width" /> + <title>ParallelListfield</title> + <link rel="http://www.renderjs.org/rel/interface" href="interface_erp5_field.html"> + <link rel="http://www.renderjs.org/rel/interface" href="interface_erp5_form_content_provider.html"> + + <!-- renderjs --> + <script src="rsvp.js" type="text/javascript"></script> + <script src="renderjs.js" type="text/javascript"></script> + <script src="gadget_global.js" type="text/javascript"></script> + <!-- custom script --> + <script src="gadget_erp5_field_parallellist.js" type="text/javascript"></script> + + </head> + <body> + </body> +</html> \ No newline at end of file diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_html.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_html.xml new file mode 100644 index 0000000000..413e25c84c --- /dev/null +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_html.xml @@ -0,0 +1,334 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Web Page" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_Access_contents_information_Permission</string> </key> + <value> + <tuple> + <string>Anonymous</string> + <string>Assignee</string> + <string>Assignor</string> + <string>Associate</string> + <string>Auditor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Add_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Change_local_roles_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Modify_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_View_Permission</string> </key> + <value> + <tuple> + <string>Anonymous</string> + <string>Assignee</string> + <string>Assignor</string> + <string>Associate</string> + <string>Auditor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>content_md5</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>content_type</string> </key> + <value> <string>text/html</string> </value> + </item> + <item> + <key> <string>default_reference</string> </key> + <value> <string>gadget_erp5_field_parallellist.html</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>rjs_gadget_erp5_parallellistfield_html</string> </value> + </item> + <item> + <key> <string>language</string> </key> + <value> <string>en</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Web Page</string> </value> + </item> + <item> + <key> <string>short_title</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Gadget ERP5 ParallelListfield</string> </value> + </item> + <item> + <key> <string>version</string> </key> + <value> <string>001</string> </value> + </item> + <item> + <key> <string>workflow_history</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary> + <item> + <key> <string>document_publication_workflow</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>edit_workflow</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>processing_status_workflow</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent> + </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_log</string> </key> + <value> + <list> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> <string>publish_alive</string> </value> + </item> + <item> + <key> <string>actor</string> </key> + <value> <string>zope</string> </value> + </item> + <item> + <key> <string>comment</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>error_message</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>time</string> </key> + <value> + <object> + <klass> + <global name="DateTime" module="DateTime.DateTime"/> + </klass> + <tuple> + <none/> + </tuple> + <state> + <tuple> + <float>1590753584.89</float> + <string>UTC</string> + </tuple> + </state> + </object> + </value> + </item> + <item> + <key> <string>validation_state</string> </key> + <value> <string>published_alive</string> </value> + </item> + </dictionary> + </list> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_log</string> </key> + <value> + <list> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> <string>edit</string> </value> + </item> + <item> + <key> <string>actor</string> </key> + <value> <string>zope</string> </value> + </item> + <item> + <key> <string>comment</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>error_message</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>serial</string> </key> + <value> <string>984.13777.5595.21947</string> </value> + </item> + <item> + <key> <string>state</string> </key> + <value> <string>current</string> </value> + </item> + <item> + <key> <string>time</string> </key> + <value> + <object> + <klass> + <global name="DateTime" module="DateTime.DateTime"/> + </klass> + <tuple> + <none/> + </tuple> + <state> + <tuple> + <float>1590753670.08</float> + <string>UTC</string> + </tuple> + </state> + </object> + </value> + </item> + </dictionary> + </list> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="5" aka="AAAAAAAAAAU="> + <pickle> + <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_log</string> </key> + <value> + <list> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> <string>detect_converted_file</string> </value> + </item> + <item> + <key> <string>actor</string> </key> + <value> <string>zope</string> </value> + </item> + <item> + <key> <string>comment</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>error_message</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_processing_state</string> </key> + <value> <string>converted</string> </value> + </item> + <item> + <key> <string>serial</string> </key> + <value> <string>0.0.0.0</string> </value> + </item> + <item> + <key> <string>time</string> </key> + <value> + <object> + <klass> + <global name="DateTime" module="DateTime.DateTime"/> + </klass> + <tuple> + <none/> + </tuple> + <state> + <tuple> + <float>1590753458.56</float> + <string>UTC</string> + </tuple> + </state> + </object> + </value> + </item> + </dictionary> + </list> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_js.js b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_js.js new file mode 100644 index 0000000000..309299a970 --- /dev/null +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_js.js @@ -0,0 +1,123 @@ +/*global window, rJS, document, RSVP, ensureArray */ +/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80 */ +(function (window, rJS, document, RSVP, ensureArray) { + 'use strict'; + + var SCOPE_PREFIX = 'PARALLEL_SUB_FIELD_'; + + function endsWith(str, suffix) { + // http://simonwillison.net/2006/Jan/20/escape/ + suffix = suffix.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); + return (new RegExp(suffix + '$', 'i')).test(str); + } + + rJS(window) + .setState({ + previous_field_length: 0, + field_list: [] + }) + .declareMethod('render', function (options) { + var field_json = options.field_json || {}, + state_dict = { + field_list: field_json.subfield_list, + previous_field_length: this.state.field_list.length, + // Force calling subfield render + // as user may have modified the input value + render_timestamp: new Date().getTime() + }; + return this.changeState(state_dict) + .push(function (error) { + return error; + }); + }) + + .onStateChange(function () { + var gadget = this, + promise_list = [], + element = gadget.element, + i, + div; + + // First update/create needed gadgets + for (i = 0; i < gadget.state.field_list.length; i += 1) { + if (i < gadget.state.previous_field_length) { + // Only need to get the existing gadget + promise_list.push(gadget.getDeclaredGadget(SCOPE_PREFIX + i)); + } else { + div = document.createElement('div'); + gadget.element.appendChild(div); + promise_list.push(gadget.declareGadget('gadget_erp5_label_field.html', + {element: div, scope: SCOPE_PREFIX + i})); + } + } + + // And remove all subgadgets not requested anymore + for (i = gadget.state.previous_field_length - 1; + i >= gadget.state.field_list.length; i -= 1) { + promise_list.push(gadget.dropGadget(SCOPE_PREFIX + i)); + element.removeChild(element.lastChild); + } + return new RSVP.Queue(RSVP.all(promise_list)) + .push(function (gadget_list) { + var sub_state; + promise_list = []; + for (i = 0; i < gadget.state.field_list.length; i += 1) { + sub_state = gadget.state.field_list[i]; + + promise_list.push(gadget_list[i].render({ + field_json: sub_state, + field_type: sub_state.field_type + })); + } + return RSVP.all(promise_list); + }); + }) + + .declareMethod('getContent', function () { + var gadget = this, + i, + promise_list = []; + + for (i = 0; i < gadget.state.field_list.length; i += 1) { + promise_list.push(gadget.getDeclaredGadget(SCOPE_PREFIX + i)); + } + + return new RSVP.Queue(RSVP.all(promise_list)) + .push(function (gadget_list) { + promise_list = []; + for (i = 0; i < gadget_list.length; i += 1) { + promise_list.push(gadget_list[i].getContent()); + } + return RSVP.all(promise_list); + }) + .push(function (content_list) { + var result = {}, + key, + j, + concat_list; + for (i = 0; i < content_list.length; i += 1) { + for (key in content_list[i]) { + if (content_list[i].hasOwnProperty(key)) { + if (result.hasOwnProperty(key) && endsWith(key, ':list')) { + result[key] = ensureArray(result[key]); + concat_list = ensureArray(content_list[i][key]); + for (j = 0; j < concat_list.length; j += 1) { + result[key].push(concat_list[j]); + } + // XXX + } else { + result[key] = content_list[i][key]; + } + } + } + } + return result; + }); + + }, {mutex: 'changestate'}) + + .declareMethod('checkValidity', function () { + return true; + }); + +}(window, rJS, document, RSVP, ensureArray)); \ No newline at end of file diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_js.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_js.xml new file mode 100644 index 0000000000..cf3c27bada --- /dev/null +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_parallellistfield_js.xml @@ -0,0 +1,330 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Web Script" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_Access_contents_information_Permission</string> </key> + <value> + <tuple> + <string>Anonymous</string> + <string>Assignee</string> + <string>Assignor</string> + <string>Associate</string> + <string>Auditor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Add_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Change_local_roles_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Modify_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_View_Permission</string> </key> + <value> + <tuple> + <string>Anonymous</string> + <string>Assignee</string> + <string>Assignor</string> + <string>Associate</string> + <string>Auditor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>content_md5</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>default_reference</string> </key> + <value> <string>gadget_erp5_field_parallellist.js</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>rjs_gadget_erp5_parallellistfield_js</string> </value> + </item> + <item> + <key> <string>language</string> </key> + <value> <string>en</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Web Script</string> </value> + </item> + <item> + <key> <string>short_title</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Gadget ERP5 ParallelListField JS</string> </value> + </item> + <item> + <key> <string>version</string> </key> + <value> <string>001</string> </value> + </item> + <item> + <key> <string>workflow_history</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary> + <item> + <key> <string>document_publication_workflow</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>edit_workflow</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>processing_status_workflow</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent> + </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_log</string> </key> + <value> + <list> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> <string>publish_alive</string> </value> + </item> + <item> + <key> <string>actor</string> </key> + <value> <string>zope</string> </value> + </item> + <item> + <key> <string>comment</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>error_message</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>time</string> </key> + <value> + <object> + <klass> + <global name="DateTime" module="DateTime.DateTime"/> + </klass> + <tuple> + <none/> + </tuple> + <state> + <tuple> + <float>1590753592.48</float> + <string>UTC</string> + </tuple> + </state> + </object> + </value> + </item> + <item> + <key> <string>validation_state</string> </key> + <value> <string>published_alive</string> </value> + </item> + </dictionary> + </list> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_log</string> </key> + <value> + <list> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> <string>edit</string> </value> + </item> + <item> + <key> <string>actor</string> </key> + <value> <string>zope</string> </value> + </item> + <item> + <key> <string>comment</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>error_message</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>serial</string> </key> + <value> <string>984.21007.60264.8891</string> </value> + </item> + <item> + <key> <string>state</string> </key> + <value> <string>current</string> </value> + </item> + <item> + <key> <string>time</string> </key> + <value> + <object> + <klass> + <global name="DateTime" module="DateTime.DateTime"/> + </klass> + <tuple> + <none/> + </tuple> + <state> + <tuple> + <float>1591187553.92</float> + <string>UTC</string> + </tuple> + </state> + </object> + </value> + </item> + </dictionary> + </list> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="5" aka="AAAAAAAAAAU="> + <pickle> + <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_log</string> </key> + <value> + <list> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> <string>detect_converted_file</string> </value> + </item> + <item> + <key> <string>actor</string> </key> + <value> <string>zope</string> </value> + </item> + <item> + <key> <string>comment</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>error_message</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_processing_state</string> </key> + <value> <string>converted</string> </value> + </item> + <item> + <key> <string>serial</string> </key> + <value> <string>0.0.0.0</string> </value> + </item> + <item> + <key> <string>time</string> </key> + <value> + <object> + <klass> + <global name="DateTime" module="DateTime.DateTime"/> + </klass> + <tuple> + <none/> + </tuple> + <state> + <tuple> + <float>1590753502.96</float> + <string>UTC</string> + </tuple> + </state> + </object> + </value> + </item> + </dictionary> + </list> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/WebSection_getPrecacheManifest.py b/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/WebSection_getPrecacheManifest.py index 9bf00dfe86..41318ffb13 100644 --- a/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/WebSection_getPrecacheManifest.py +++ b/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/WebSection_getPrecacheManifest.py @@ -60,6 +60,8 @@ url_list = [ 'gadget_erp5_field_multicheckbox.js', 'gadget_erp5_field_multilist.html', 'gadget_erp5_field_multilist.js', + 'gadget_erp5_field_parallellist.html', + 'gadget_erp5_field_parallellist.js', 'gadget_erp5_field_multirelationstring.html', 'gadget_erp5_field_multirelationstring.js', 'gadget_erp5_field_radio.html', diff --git a/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_interface_validator_zuite/testERP5Interface.zpt b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_interface_validator_zuite/testERP5Interface.zpt index b90a287fa6..4e1eae5373 100644 --- a/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_interface_validator_zuite/testERP5Interface.zpt +++ b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_interface_validator_zuite/testERP5Interface.zpt @@ -13,7 +13,7 @@ <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block tal:define="check_configuration python: {'precache_reference': '../renderjs_runner/WebSection_getPrecacheManifest', - 'gadget_count': 66}"> + 'gadget_count': 68}"> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUiInterface/macros/run_app_interface_check" /> </tal:block> diff --git a/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite.xml b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite.xml new file mode 100644 index 0000000000..1613586c08 --- /dev/null +++ b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite.xml @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Zuite" module="Products.Zelenium.zuite"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_objects</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>renderjs_ui_parallel_list_field_zuite</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testMultipleValidatorKeyEmptyField.xml b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testMultipleValidatorKeyEmptyField.xml new file mode 100644 index 0000000000..aba90c213a --- /dev/null +++ b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testMultipleValidatorKeyEmptyField.xml @@ -0,0 +1,58 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/> + </pickle> + <pickle> + <dictionary> + <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_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>content_type</string> </key> + <value> <string>text/html</string> </value> + </item> + <item> + <key> <string>expand</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>testMultipleValidatorKeyEmptyField</string> </value> + </item> + <item> + <key> <string>output_encoding</string> </key> + <value> <string>utf-8</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <unicode></unicode> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testMultipleValidatorKeyEmptyField.zpt b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testMultipleValidatorKeyEmptyField.zpt new file mode 100644 index 0000000000..f2f764b436 --- /dev/null +++ b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testMultipleValidatorKeyEmptyField.zpt @@ -0,0 +1,259 @@ +<html xmlns:tal="http://xml.zope.org/namespaces/tal" + xmlns:metal="http://xml.zope.org/namespaces/metal"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>Test RenderJS UI</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">Test RenderJS UI</td></tr> +</thead><tbody> +<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> + +<!-- Initialize --> +<tr> + <td>open</td> + <td>${base_url}/web_site_module/renderjs_runner/#/foo_module</td> + <td></td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" /> + +<tal:block tal:define="click_configuration python: {'text': 'Add'}"> + <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" /> +</tal:block> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> + +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" /> +<tal:block tal:define="notification_configuration python: {'class': 'success', + 'text': 'Object created.'}"> + <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" /> +</tal:block> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> + +<!-- Go to test form --> +<tal:block tal:define="click_configuration python: {'text': 'Parallel List Field'}"> + <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_panel_link" /> +</tal:block> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> + +<!-- Select single validator key --> +<tr> + <td>click</td> + <td>//label[contains(text(), 'Base_getMultiListFieldPropertyDictList')]</td> + <td></td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> + +<tr> + <td colspan="3"><b>Empty value by default</b></td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div//select</td> + <td>label=</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]</td> + <td></td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div//select</td> + <td>label=</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[2]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//p[@id="field_category_list"]</td> + <td></td> +</tr> + +<tr> + <td colspan="3"><b>Set first value</b></td> +</tr> +<tr> + <td>select</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div//select</td> + <td>label=c1</td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> +<tr> + <td>assertText</td> + <td>//p[@id="field_category_list"]</td> + <td>foo_big_category/c1</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> + <td>label=c1</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]//select</td> + <td>label=</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[3]</td> + <td></td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div//select</td> + <td>label=</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[2]</td> + <td></td> +</tr> + +<tr> + <td colspan="3"><b>Set second value</b></td> +</tr> +<tr> + <td>select</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div//select</td> + <td>label=a</td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> +<tr> + <td>assertText</td> + <td>//p[@id="field_category_list"]</td> + <td>foo_big_category/c1 foo_category/a</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> + <td>label=c1</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]//select</td> + <td>label=</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[3]</td> + <td></td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[1]//select</td> + <td>label=a</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[2]//select</td> + <td>label=</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[3]</td> + <td></td> +</tr> + +<tr> + <td colspan="3"><b>Set third value</b></td> +</tr> +<tr> + <td>select</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]//select</td> + <td>label=c22</td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> +<tr> + <td>assertText</td> + <td>//p[@id="field_category_list"]</td> + <td>foo_big_category/c1 foo_big_category/c22 foo_category/a</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> + <td>label=c1</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]//select</td> + <td>label=c22</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[3]//select</td> + <td>label=</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[4]</td> + <td></td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[1]//select</td> + <td>label=a</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[2]//select</td> + <td>label=</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[3]</td> + <td></td> +</tr> + +<tr> + <td colspan="3"><b>Remove first value</b></td> +</tr> +<tr> + <td>select</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> + <td>label=</td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> +<tr> + <td>assertText</td> + <td>//p[@id="field_category_list"]</td> + <td>foo_big_category/c22 foo_category/a</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> + <td>label=c22</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]//select</td> + <td>label=</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[3]</td> + <td></td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[1]//select</td> + <td>label=a</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[2]//select</td> + <td>label=</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[3]</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> \ No newline at end of file diff --git a/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testNoValidatorKeyEmptyField.xml b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testNoValidatorKeyEmptyField.xml new file mode 100644 index 0000000000..efda95a0ab --- /dev/null +++ b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testNoValidatorKeyEmptyField.xml @@ -0,0 +1,58 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/> + </pickle> + <pickle> + <dictionary> + <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_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>content_type</string> </key> + <value> <string>text/html</string> </value> + </item> + <item> + <key> <string>expand</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>testNoValidatorKeyEmptyField</string> </value> + </item> + <item> + <key> <string>output_encoding</string> </key> + <value> <string>utf-8</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <unicode></unicode> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testNoValidatorKeyEmptyField.zpt b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testNoValidatorKeyEmptyField.zpt new file mode 100644 index 0000000000..d73ae295a5 --- /dev/null +++ b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testNoValidatorKeyEmptyField.zpt @@ -0,0 +1,164 @@ +<html xmlns:tal="http://xml.zope.org/namespaces/tal" + xmlns:metal="http://xml.zope.org/namespaces/metal"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>Test RenderJS UI</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">Test RenderJS UI</td></tr> +</thead><tbody> +<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> + +<!-- Initialize --> +<tr> + <td>open</td> + <td>${base_url}/web_site_module/renderjs_runner/#/foo_module</td> + <td></td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" /> + +<tal:block tal:define="click_configuration python: {'text': 'Add'}"> + <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" /> +</tal:block> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> + +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" /> +<tal:block tal:define="notification_configuration python: {'class': 'success', + 'text': 'Object created.'}"> + <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" /> +</tal:block> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> + +<!-- Go to test form --> +<tal:block tal:define="click_configuration python: {'text': 'Parallel List Field'}"> + <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_panel_link" /> +</tal:block> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> + +<!-- Select single validator key --> +<tr> + <td>click</td> + <td>//label[contains(text(), 'empty')]</td> + <td></td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> + +<tr> + <td colspan="3"><b>Empty value by default</b></td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> + <td>label=</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]//select</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//p[@id="field_category_list"]</td> + <td></td> +</tr> + +<tr> + <td colspan="3"><b>Set first value</b></td> +</tr> +<tr> + <td>select</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> + <td>label=c1</td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> +<tr> + <td>assertText</td> + <td>//p[@id="field_category_list"]</td> + <td>foo_big_category/c1</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> + <td>label=c1</td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]//select</td> + <td></td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[3]//select</td> + <td></td> +</tr> + +<tr> + <td colspan="3"><b>Set second value</b></td> +</tr> +<tr> + <td>select</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]//select</td> + <td>label=a</td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> +<tr> + <td>assertText</td> + <td>//p[@id="field_category_list"]</td> + <td>foo_big_category/c1 foo_category/a</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> + <td>label=c1</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]//select</td> + <td>label=a</td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[3]//select</td> + <td></td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[4]//select</td> + <td></td> +</tr> + +<tr> + <td colspan="3"><b>Remove first value</b></td> +</tr> +<tr> + <td>select</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> + <td>label=</td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> +<tr> + <td>assertText</td> + <td>//p[@id="field_category_list"]</td> + <td>foo_category/a</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> + <td>label=a</td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]//select</td> + <td></td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[3]//select</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> \ No newline at end of file diff --git a/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testSingleValidatorKeyEmptyField.xml b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testSingleValidatorKeyEmptyField.xml new file mode 100644 index 0000000000..d8cae9e658 --- /dev/null +++ b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testSingleValidatorKeyEmptyField.xml @@ -0,0 +1,58 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/> + </pickle> + <pickle> + <dictionary> + <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_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>content_type</string> </key> + <value> <string>text/html</string> </value> + </item> + <item> + <key> <string>expand</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>testSingleValidatorKeyEmptyField</string> </value> + </item> + <item> + <key> <string>output_encoding</string> </key> + <value> <string>utf-8</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <unicode></unicode> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testSingleValidatorKeyEmptyField.zpt b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testSingleValidatorKeyEmptyField.zpt new file mode 100644 index 0000000000..1f3737d3bc --- /dev/null +++ b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_parallel_list_field_zuite/testSingleValidatorKeyEmptyField.zpt @@ -0,0 +1,164 @@ +<html xmlns:tal="http://xml.zope.org/namespaces/tal" + xmlns:metal="http://xml.zope.org/namespaces/metal"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>Test RenderJS UI</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">Test RenderJS UI</td></tr> +</thead><tbody> +<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> + +<!-- Initialize --> +<tr> + <td>open</td> + <td>${base_url}/web_site_module/renderjs_runner/#/foo_module</td> + <td></td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" /> + +<tal:block tal:define="click_configuration python: {'text': 'Add'}"> + <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" /> +</tal:block> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> + +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" /> +<tal:block tal:define="notification_configuration python: {'class': 'success', + 'text': 'Object created.'}"> + <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" /> +</tal:block> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> + +<!-- Go to test form --> +<tal:block tal:define="click_configuration python: {'text': 'Parallel List Field'}"> + <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_panel_link" /> +</tal:block> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> + +<!-- Select single validator key --> +<tr> + <td>click</td> + <td>//label[contains(text(), 'Base_hashCategoryList')]</td> + <td></td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> + +<tr> + <td colspan="3"><b>Empty value by default</b></td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//select</td> + <td>label=</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//p[@id="field_category_list"]</td> + <td></td> +</tr> + +<tr> + <td colspan="3"><b>Set first value</b></td> +</tr> +<tr> + <td>select</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//select</td> + <td>label=c1</td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> +<tr> + <td>assertText</td> + <td>//p[@id="field_category_list"]</td> + <td>foo_big_category/c1</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//select</td> + <td>label=c1</td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//select</td> + <td></td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_2']</td> + <td></td> +</tr> + +<tr> + <td colspan="3"><b>Set second value</b></td> +</tr> +<tr> + <td>select</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//select</td> + <td>label=a</td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> +<tr> + <td>assertText</td> + <td>//p[@id="field_category_list"]</td> + <td>foo_big_category/c1 foo_category/a</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//select</td> + <td>label=c1</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//select</td> + <td>label=a</td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_2']//select</td> + <td></td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_3']//select</td> + <td></td> +</tr> + +<tr> + <td colspan="3"><b>Remove first value</b></td> +</tr> +<tr> + <td>select</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//select</td> + <td>label=</td> +</tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> +<tr> + <td>assertText</td> + <td>//p[@id="field_category_list"]</td> + <td>foo_category/a</td> +</tr> +<tr> + <td>assertSelected</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//select</td> + <td>label=a</td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//select</td> + <td></td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_2']</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> \ No newline at end of file diff --git a/bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSParallelListField.py b/bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSParallelListField.py new file mode 100644 index 0000000000..2a9a45bf71 --- /dev/null +++ b/bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSParallelListField.py @@ -0,0 +1,48 @@ +############################################################################## +# +# Copyright (c) 2011 Nexedi SARL and Contributors. All Rights Reserved. +# Kazuhiko <kazuhiko@nexedi.com> +# Rafael Monnerat <rafael@nexedi.com> +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## +import unittest + +from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctionalTestCase + +class TestRenderJSUIParallelListField(ERP5TypeFunctionalTestCase): + foreground = 0 + run_only = "renderjs_ui_parallel_list_field_zuite" + + def getBusinessTemplateList(self): + return ( + 'erp5_web_renderjs_ui', + 'erp5_web_renderjs_ui_test', + 'erp5_ui_test_core', + 'erp5_test_result', + ) + +def test_suite(): + suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(TestRenderJSUIParallelListField)) + return suite \ No newline at end of file diff --git a/bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSParallelListField.xml b/bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSParallelListField.xml new file mode 100644 index 0000000000..8b9e55d101 --- /dev/null +++ b/bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSParallelListField.xml @@ -0,0 +1,127 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Test Component" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_recorded_property_dict</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>default_reference</string> </key> + <value> <string>testFunctionalRJSParallelListField</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>test.erp5.testFunctionalRJSParallelListField</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Test Component</string> </value> + </item> + <item> + <key> <string>sid</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>text_content_error_message</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>text_content_warning_message</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>version</string> </key> + <value> <string>erp5</string> </value> + </item> + <item> + <key> <string>workflow_history</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary> + <item> + <key> <string>component_validation_workflow</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_log</string> </key> + <value> + <list> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> <string>validate</string> </value> + </item> + <item> + <key> <string>validation_state</string> </key> + <value> <string>validated</string> </value> + </item> + </dictionary> + </list> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_renderjs_ui_test/bt/template_path_list b/bt5/erp5_web_renderjs_ui_test/bt/template_path_list index 2a632d6a79..0b24203b38 100644 --- a/bt5/erp5_web_renderjs_ui_test/bt/template_path_list +++ b/bt5/erp5_web_renderjs_ui_test/bt/template_path_list @@ -36,6 +36,8 @@ portal_tests/renderjs_ui_page_templates_zuite portal_tests/renderjs_ui_page_templates_zuite/** portal_tests/renderjs_ui_page_zuite portal_tests/renderjs_ui_page_zuite/** +portal_tests/renderjs_ui_parallel_list_field_zuite +portal_tests/renderjs_ui_parallel_list_field_zuite/** portal_tests/renderjs_ui_radio_field_zuite portal_tests/renderjs_ui_radio_field_zuite/** portal_tests/renderjs_ui_recover_password_zuite diff --git a/bt5/erp5_web_renderjs_ui_test/bt/template_test_id_list b/bt5/erp5_web_renderjs_ui_test/bt/template_test_id_list index efb5657ba0..8e19786e8a 100644 --- a/bt5/erp5_web_renderjs_ui_test/bt/template_test_id_list +++ b/bt5/erp5_web_renderjs_ui_test/bt/template_test_id_list @@ -25,4 +25,5 @@ test.erp5.testFunctionalRJSInterfaceValidator test.erp5.testFunctionalRJSDms test.erp5.testRJSPortalType test.erp5.testRJSUpgrader -test.erp5.testFunctionalRJSServiceWorker \ No newline at end of file +test.erp5.testFunctionalRJSServiceWorker +test.erp5.testFunctionalRJSParallelListField \ No newline at end of file -- 2.30.9