From 8ed0408b69e96889db28e1bb2c2ea69f73a12180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Le=20Ninivin?= <cedric.leninivin@tiolive.com> Date: Fri, 9 Oct 2015 18:03:57 +0000 Subject: [PATCH] erp5_officejs: Update synchronization and disociate databases - Dates Are now using ISOString providing efficient sorting as string - modification_date property is not saved on object - Modified conflict_handling parameter to overwrite the remote document with local content (no loss of data) - the three different storage use different local databases --- .../gadget_officejs_appcache.xml | 6 +- .../gadget_officejs_jio_web_page_view_js.xml | 10 +-- ...dget_officejs_page_jio_configurator_js.xml | 79 ++++++++++--------- ..._officejs_page_jio_dav_configurator_js.xml | 6 +- ...ejs_text_editor_application_panel_html.xml | 6 +- .../erp5_officejs_theme/WebPage_viewAsJio.xml | 2 +- ...on_date.xml => your_modification_date.xml} | 4 +- 7 files changed, 57 insertions(+), 56 deletions(-) rename bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio/{my_modification_date.xml => your_modification_date.xml} (98%) diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_appcache.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_appcache.xml index ac7451b4d1..52e99790cc 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_appcache.xml +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_appcache.xml @@ -102,7 +102,7 @@ <value> <string encoding="cdata"><![CDATA[ CACHE MANIFEST\n -# generated on Fri, 06 Feb 2015 15:31:33 +0000\n +# generated on Fri, 08 Oct 2015 15:31:33 +0000\n # XXX + fonts\n # images/ajax-loader.gif\n CACHE:\n @@ -299,7 +299,7 @@ NETWORK:\n </item> <item> <key> <string>serial</string> </key> - <value> <string>945.61166.25675.50432</string> </value> + <value> <string>946.10007.14873.25907</string> </value> </item> <item> <key> <string>state</string> </key> @@ -317,7 +317,7 @@ NETWORK:\n </tuple> <state> <tuple> - <float>1443009061.03</float> + <float>1444319235.36</float> <string>UTC</string> </tuple> </state> diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_js.xml index 645849891a..462ca1069d 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_js.xml +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_js.xml @@ -111,12 +111,10 @@ function saveContent(gadget, submit_event) {\n var i,\n doc = gadget.options.doc,\n - today = new Date();\n + now = new Date();\n doc.parent_relative_url = "web_page_module";\n doc.portal_type = "Web Page";\n - doc.modification_date = today.getDate()\n - + \'/\' + (today.getMonth() + 1)\n - + \'/\' + today.getFullYear();\n + doc.modification_date = now.toISOString();\n for (i = 0; i < submit_event.target.length; i += 1) {\n // XXX Should check input type instead\n if (submit_event.target[i].name) {\n @@ -413,7 +411,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>945.62635.52426.43195</string> </value> + <value> <string>946.18929.62498.39526</string> </value> </item> <item> <key> <string>state</string> </key> @@ -431,7 +429,7 @@ </tuple> <state> <tuple> - <float>1443095776.25</float> + <float>1444320970.58</float> <string>UTC</string> </tuple> </state> diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_configurator_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_configurator_js.xml index 83cdfcecf4..a63a809529 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_configurator_js.xml +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_configurator_js.xml @@ -108,44 +108,47 @@ "use strict";\n \n function setERP5Configuration(gadget) {\n - var today = new Date(),\n - configuration = {\n - type: "replicate",\n - // XXX This drop the signature lists...\n - query: {\n - query: \'portal_type:"Web Page" \'\n - // XX Synchonizing the whole module is too much, here is a way to start quietly\n - // Supsended until modification_date is handled for synchronization\n - + \' AND modification_date:>="\'\n - + \'01/\' + (today.getMonth() - 2) + \'/\' + today.getFullYear() + \'" \',\n - limit: [0, 1234567890]\n - },\n - use_remote_post: true,\n - conflict_handling: 2,\n - check_local_modification: true,\n - check_local_creation: true,\n - check_local_deletion: false,\n - check_remote_modification: true,\n - check_remote_creation: true,\n - check_remote_deletion: true,\n - local_sub_storage: {\n - type: "query",\n + var old_date = new Date(),\n + configuration = {};\n + // We are looking for documents modified in the past 3 month\n + old_date = new Date(old_date.getFullYear(), old_date.getMonth() - 3);\n + configuration = {\n + type: "replicate",\n + // XXX This drop the signature lists...\n + query: {\n + query: \'portal_type:"Web Page" \'\n + // XX Synchonizing the whole module is too much, here is a way to start quietly\n + // Supsended until modification_date is handled for synchronization\n + + \' AND modification_date:>="\'\n + + old_date.toISOString() + \'" \',\n + limit: [0, 1234567890]\n + },\n + use_remote_post: true,\n + conflict_handling: 1,\n + check_local_modification: true,\n + check_local_creation: true,\n + check_local_deletion: false,\n + check_remote_modification: true,\n + check_remote_creation: true,\n + check_remote_deletion: true,\n + local_sub_storage: {\n + type: "query",\n + sub_storage: {\n + type: "uuid",\n sub_storage: {\n - type: "uuid",\n - sub_storage: {\n - type: "indexeddb",\n - database: "officejs"\n - }\n + type: "indexeddb",\n + database: "officejs-erp5"\n }\n - },\n - remote_sub_storage: {\n - type: "erp5",\n - url: (new URI("hateoas"))\n - .absoluteTo(location.href)\n - .toString(),\n - default_view_reference: "jio_view"\n }\n - };\n + },\n + remote_sub_storage: {\n + type: "erp5",\n + url: (new URI("hateoas"))\n + .absoluteTo(location.href)\n + .toString(),\n + default_view_reference: "jio_view"\n + }\n + };\n return gadget.setSetting(\'jio_storage_description\', configuration)\n .push(function () {\n return gadget.setSetting(\'jio_storage_name\', "ERP5");\n @@ -162,7 +165,7 @@ type: "uuid",\n sub_storage: {\n type: "indexeddb",\n - database: "officejs"\n + database: "officejs-local"\n }\n }\n };\n @@ -379,7 +382,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>945.62750.27719.2184</string> </value> + <value> <string>946.20489.39650.26470</string> </value> </item> <item> <key> <string>state</string> </key> @@ -397,7 +400,7 @@ </tuple> <state> <tuple> - <float>1443192309.89</float> + <float>1444412978.56</float> <string>UTC</string> </tuple> </state> diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_dav_configurator_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_dav_configurator_js.xml index 49c5ac4983..5b4114a5c9 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_dav_configurator_js.xml +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_dav_configurator_js.xml @@ -132,7 +132,7 @@ type: "uuid",\n sub_storage: {\n type: "indexeddb",\n - database: "officejs"\n + database: "officejs-dav"\n }\n }\n },\n @@ -355,7 +355,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>945.61335.62217.48981</string> </value> + <value> <string>945.61336.46618.42325</string> </value> </item> <item> <key> <string>state</string> </key> @@ -373,7 +373,7 @@ </tuple> <state> <tuple> - <float>1443017802.67</float> + <float>1444319088.33</float> <string>UTC</string> </tuple> </state> diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_text_editor_application_panel_html.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_text_editor_application_panel_html.xml index f2488246b8..535a8d0e1b 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_text_editor_application_panel_html.xml +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_text_editor_application_panel_html.xml @@ -142,7 +142,7 @@ <ul data-role="listview" class="ui-listview">\n <li><a href="#page=text_editor_list" data-i18n="Text Documents">Text Documents</a></li>\n <li><a href="#page=jio_configurator" data-i18n="Storage Configuration">Storage Configuration</a></li>\n - <li><a href="#page=sync" data-i18n="Sync">Sync</a></li>\n + <li><a href="#page=sync" data-i18n="Syncronization">Syncronization</a></li>\n <li class="ui-last-child"><a href="#page=logout" data-i18n="Logout">Logout</a></li>\n </ul>\n </div>\n @@ -292,7 +292,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>945.58601.10119.52531</string> </value> + <value> <string>945.61348.56996.63675</string> </value> </item> <item> <key> <string>state</string> </key> @@ -310,7 +310,7 @@ </tuple> <state> <tuple> - <float>1443018532.17</float> + <float>1444319473.8</float> <string>UTC</string> </tuple> </state> diff --git a/bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio.xml b/bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio.xml index 862650ed2b..fbd7db7a3c 100644 --- a/bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio.xml +++ b/bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio.xml @@ -80,7 +80,7 @@ <string>my_language</string> <string>my_version</string> <string>my_portal_type</string> - <string>my_modification_date</string> + <string>your_modification_date</string> </list> </value> </item> diff --git a/bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio/my_modification_date.xml b/bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio/your_modification_date.xml similarity index 98% rename from bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio/my_modification_date.xml rename to bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio/your_modification_date.xml index 4fd6579cf2..b66f341fff 100644 --- a/bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio/my_modification_date.xml +++ b/bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio/your_modification_date.xml @@ -8,7 +8,7 @@ <dictionary> <item> <key> <string>id</string> </key> - <value> <string>my_modification_date</string> </value> + <value> <string>your_modification_date</string> </value> </item> <item> <key> <string>message_values</string> </key> @@ -279,7 +279,7 @@ <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python: here.getModificationDate().strftime(\'%d/%m/%Y\')</string> </value> + <value> <string>python: here.getModificationDate().HTML4()</string> </value> </item> </dictionary> </pickle> -- 2.30.9