Commit 7b0f2083 authored by Jérome Perrin's avatar Jérome Perrin

Improvements to editors (CKEditor and PDF viewer)

- Display the editor in ERP5 language, not browser language
 - Use PDF viewer for Drawing preview
 - Supports password protected PDFs
 - Others small changes

See merge request nexedi/erp5!1639
parents 54683e0c c54c4bc0
......@@ -194,6 +194,7 @@ class TestOfficeJSSDKConfigurator(SecurityTestCase):
'erp5_core_proxy_field_legacy',
'erp5_crm',
'erp5_dms',
'erp5_dms_ui_test',
'erp5_font',
'erp5_forge',
'erp5_full_text_mroonga_catalog',
......@@ -236,6 +237,7 @@ class TestOfficeJSSDKConfigurator(SecurityTestCase):
'erp5_travel_expense',
'erp5_ui_test',
'erp5_ui_test_core',
'erp5_ui_test_data',
'erp5_upgrader',
'erp5_upgrader_officejs_sdk',
'erp5_web',
......
<?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>testCRMCreateNewEventEditorLanguage</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>
<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 tal:content="template/title_or_id"></title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3" tal:content="template/title_or_id"></td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/init" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/create_translation_data" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/prepare_data" />
<!-- try with a language supported (fr) in CKEditor, then a language not supported (wo) -->
<tal:block
tal:define="language_and_translations python:[('fr', {'Font': 'Police', 'Actions': 'Actions'}), ('wo', {'Font': 'Font', 'Actions': 'caozhuo'})]"
tal:repeat="language_and_translation language_and_translations">
<tr>
<td>store</td>
<td>${base_url}/web_site_module/renderjs_runner/<tal:block tal:replace="python: language_and_translation[0]"/>/#</td>
<td>renderjs_url</td>
</tr>
<tal:block tal:define="translation_dict python: language_and_translation[1]">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/view_create_new_event_dialog" />
</tal:block>
<tal:block tal:define="dialog_content_configuration python: {'field_your_title': '',
'field_your_portal_type': 'Mail Message',
'field_your_resource': '',
'field_your_notification_message': '',
'field_your_event_workflow_action': 'send',
'field_your_source': '',
'field_your_destination': '',
'field_your_text_content': '<p><br></p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_new_event_dialog_content" />
</tal:block>
<tal:block tal:define="dialog_content_configuration python: {'field_your_title': 'erp5_crm_ui_test_create_event_title',
'field_your_portal_type': 'Letter',
'field_your_resource': '',
'field_your_start_date': '2010-01-01T00:00:00',
'field_your_notification_message': '',
'field_your_event_workflow_action': 'send',
'field_your_source': 'erp5_crm_ui_test_agent_title',
'field_your_destination': 'erp5_crm_ui_test_customer_title',
'field_your_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/fill_create_new_event_dialog_content" />
</tal:block>
<tr>
<td>selectFrame</td>
<td>//iframe</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>css=.cke_combo__font > .cke_combo_label</td>
<td tal:content="python: language_and_translation[1]['Font']"></td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
<!-- Header has a save button -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Created and associated a new Letter to the ticket.'}">
<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" />
<tal:block tal:define="response_configuration python: {'field_my_title': 'erp5_crm_ui_test_create_event_title',
'field_my_portal_type': 'Letter',
'field_my_resource': '',
'field_my_start_date': '2010-01-01T00:00:00',
'simulation_state': 'Sent',
'field_my_source_title': 'erp5_crm_ui_test_agent_title',
'field_my_destination_title': 'erp5_crm_ui_test_customer_title',
'field_my_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_response_content" />
</tal:block>
<tr>
<td>selectFrame</td>
<td>//iframe</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>css=.cke_combo__font > .cke_combo_label</td>
<td tal:content="python: language_and_translation[1]['Font']"></td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -207,7 +207,7 @@
</tal:block>
<tal:block metal:define-macro="view_create_new_event_dialog">
<tal:block metal:define-macro="view_create_new_event_dialog" tal:define="translation_dict translation_dict | python: {}">
<tr>
<td colspan="3"><b>Display the create new event dialog</b></td>
</tr>
......@@ -223,7 +223,7 @@
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view_editable.html']</td>
<td></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Actions'}">
<tal:block tal:define="click_configuration python: {'text': translation_dict.get('Actions', 'Actions')}">
<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" />
......@@ -234,11 +234,11 @@
</tr>
<tr>
<td>assertTextPresent</td>
<td>Create New Event</td>
<td tal:content="python: translation_dict.get('Create New Event', 'Create New Event')">Create New Event</td>
<td></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Create New Event'}">
<tal:block tal:define="click_configuration python: {'text': translation_dict.get('Create New Event', 'Create New Event')}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
......@@ -250,7 +250,7 @@
</tr>
<tr>
<td>assertTextPresent</td>
<td>Create New Event</td>
<td tal:content="python: translation_dict.get('Create New Event', 'Create New Event')">Create New Event</td>
<td></td>
</tr>
<tr>
......
<?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>testCRMCreateNewEventEditorLanguage</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>
<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 tal:content="template/title_or_id"></title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3" tal:content="template/title_or_id"></td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMUiTest/macros/init" />
<tr>
<td>open</td>
<td tal:content="string: ${here/portal_url}/Base_createUITestLanguages"></td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>New Languages Added</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMUiTest/macros/prepare_data" />
<!-- try with a language supported (fr) in CKEditor, then a language not supported (wo) -->
<tal:block
tal:define="language_and_translations python:[('French', 'Police'), ('Wolof', 'Font')]"
tal:repeat="language_and_translation language_and_translations">
<tr>
<td>open</td>
<td>${base_url}</td>
<td></td>
</tr>
<tr>
<td>selectAndWait</td>
<td>select_language</td>
<td tal:content="python: language_and_translation[0]"></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMUiTest/macros/view_create_new_event_dialog" />
<tal:block tal:define="dialog_content_configuration python: {'field_your_title': '',
'field_your_portal_type': 'Mail Message',
'field_your_resource': '',
'field_your_notification_message': '',
'field_your_event_workflow_action': 'send',
'field_your_source': '',
'field_your_destination': '',
'field_your_text_content': '<p><br></p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMUiTest/macros/check_create_new_event_dialog_content" />
</tal:block>
<tal:block tal:define="dialog_content_configuration python: {'field_your_title': 'Test event',
'field_your_portal_type': 'Letter',
'field_your_resource': '',
'field_your_start_date': '2010-01-01T00:00:00',
'field_your_notification_message': '',
'field_your_event_workflow_action': 'send',
'field_your_source': 'erp5_crm_ui_test_agent_title',
'field_your_destination': 'erp5_crm_ui_test_customer_title',
'field_your_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMUiTest/macros/fill_create_new_event_dialog_content" />
</tal:block>
<tr>
<td>selectFrame</td>
<td>//iframe</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>css=.cke_combo__font > .cke_combo_label</td>
<td tal:content="python: language_and_translation[1]"></td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>dialog_submit_button</td>
<td></td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td>Created and associated a new Letter to the ticket.</td>
<td></td>
</tr>
<tal:block tal:define="response_configuration python: {'field_my_title': 'Test event',
'field_my_portal_type': 'Letter',
'field_my_resource': '',
'field_my_start_date': '2010-01-01T00:00:00',
'simulation_state': 'Sent',
'field_my_source_title': 'erp5_crm_ui_test_agent_title',
'field_my_destination_title': 'erp5_crm_ui_test_customer_title',
'field_my_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMUiTest/macros/check_response_content" />
</tal:block>
<tr>
<td>selectFrame</td>
<td>//iframe</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>css=.cke_combo__font > .cke_combo_label</td>
<td tal:content="python: language_and_translation[1]"></td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -71,7 +71,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/OOoDocument_viewAsWeb</string> </value>
<value> <string>string:${object_url}/OOoDocument_viewPDFPreview</string> </value>
</item>
</dictionary>
</pickle>
......
<?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></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 full_height</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom full_height</string> </key>
<value>
<list>
<string>my_data</string>
</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/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>OOoDocument_viewPDFPreview</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>OOoDocument_viewPDFPreview</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>Preview</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>
<?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>data_url</string>
<string>default</string>
<string>renderjs_extra</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_data</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>data_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>