Commit 8ed0408b authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

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
parent fccb8164
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n 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 # XXX + fonts\n
# images/ajax-loader.gif\n # images/ajax-loader.gif\n
CACHE:\n CACHE:\n
...@@ -299,7 +299,7 @@ NETWORK:\n ...@@ -299,7 +299,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.61166.25675.50432</string> </value> <value> <string>946.10007.14873.25907</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -317,7 +317,7 @@ NETWORK:\n ...@@ -317,7 +317,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1443009061.03</float> <float>1444319235.36</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -111,12 +111,10 @@ ...@@ -111,12 +111,10 @@
function saveContent(gadget, submit_event) {\n function saveContent(gadget, submit_event) {\n
var i,\n var i,\n
doc = gadget.options.doc,\n doc = gadget.options.doc,\n
today = new Date();\n now = new Date();\n
doc.parent_relative_url = "web_page_module";\n doc.parent_relative_url = "web_page_module";\n
doc.portal_type = "Web Page";\n doc.portal_type = "Web Page";\n
doc.modification_date = today.getDate()\n doc.modification_date = now.toISOString();\n
+ \'/\' + (today.getMonth() + 1)\n
+ \'/\' + today.getFullYear();\n
for (i = 0; i < submit_event.target.length; i += 1) {\n for (i = 0; i < submit_event.target.length; i += 1) {\n
// XXX Should check input type instead\n // XXX Should check input type instead\n
if (submit_event.target[i].name) {\n if (submit_event.target[i].name) {\n
...@@ -413,7 +411,7 @@ ...@@ -413,7 +411,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.62635.52426.43195</string> </value> <value> <string>946.18929.62498.39526</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -431,7 +429,7 @@ ...@@ -431,7 +429,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1443095776.25</float> <float>1444320970.58</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -108,44 +108,47 @@ ...@@ -108,44 +108,47 @@
"use strict";\n "use strict";\n
\n \n
function setERP5Configuration(gadget) {\n function setERP5Configuration(gadget) {\n
var today = new Date(),\n var old_date = new Date(),\n
configuration = {\n configuration = {};\n
type: "replicate",\n // We are looking for documents modified in the past 3 month\n
// XXX This drop the signature lists...\n old_date = new Date(old_date.getFullYear(), old_date.getMonth() - 3);\n
query: {\n configuration = {\n
query: \'portal_type:"Web Page" \'\n type: "replicate",\n
// XX Synchonizing the whole module is too much, here is a way to start quietly\n // XXX This drop the signature lists...\n
// Supsended until modification_date is handled for synchronization\n query: {\n
+ \' AND modification_date:>="\'\n query: \'portal_type:"Web Page" \'\n
+ \'01/\' + (today.getMonth() - 2) + \'/\' + today.getFullYear() + \'" \',\n // XX Synchonizing the whole module is too much, here is a way to start quietly\n
limit: [0, 1234567890]\n // Supsended until modification_date is handled for synchronization\n
},\n + \' AND modification_date:>="\'\n
use_remote_post: true,\n + old_date.toISOString() + \'" \',\n
conflict_handling: 2,\n limit: [0, 1234567890]\n
check_local_modification: true,\n },\n
check_local_creation: true,\n use_remote_post: true,\n
check_local_deletion: false,\n conflict_handling: 1,\n
check_remote_modification: true,\n check_local_modification: true,\n
check_remote_creation: true,\n check_local_creation: true,\n
check_remote_deletion: true,\n check_local_deletion: false,\n
local_sub_storage: {\n check_remote_modification: true,\n
type: "query",\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 sub_storage: {\n
type: "uuid",\n type: "indexeddb",\n
sub_storage: {\n database: "officejs-erp5"\n
type: "indexeddb",\n
database: "officejs"\n
}\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
};\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 return gadget.setSetting(\'jio_storage_description\', configuration)\n
.push(function () {\n .push(function () {\n
return gadget.setSetting(\'jio_storage_name\', "ERP5");\n return gadget.setSetting(\'jio_storage_name\', "ERP5");\n
...@@ -162,7 +165,7 @@ ...@@ -162,7 +165,7 @@
type: "uuid",\n type: "uuid",\n
sub_storage: {\n sub_storage: {\n
type: "indexeddb",\n type: "indexeddb",\n
database: "officejs"\n database: "officejs-local"\n
}\n }\n
}\n }\n
};\n };\n
...@@ -379,7 +382,7 @@ ...@@ -379,7 +382,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.62750.27719.2184</string> </value> <value> <string>946.20489.39650.26470</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -397,7 +400,7 @@ ...@@ -397,7 +400,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1443192309.89</float> <float>1444412978.56</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
type: "uuid",\n type: "uuid",\n
sub_storage: {\n sub_storage: {\n
type: "indexeddb",\n type: "indexeddb",\n
database: "officejs"\n database: "officejs-dav"\n
}\n }\n
}\n }\n
},\n },\n
...@@ -355,7 +355,7 @@ ...@@ -355,7 +355,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.61335.62217.48981</string> </value> <value> <string>945.61336.46618.42325</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -373,7 +373,7 @@ ...@@ -373,7 +373,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1443017802.67</float> <float>1444319088.33</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
<ul data-role="listview" class="ui-listview">\n <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=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=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 <li class="ui-last-child"><a href="#page=logout" data-i18n="Logout">Logout</a></li>\n
</ul>\n </ul>\n
</div>\n </div>\n
...@@ -292,7 +292,7 @@ ...@@ -292,7 +292,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.58601.10119.52531</string> </value> <value> <string>945.61348.56996.63675</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -310,7 +310,7 @@ ...@@ -310,7 +310,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1443018532.17</float> <float>1444319473.8</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
<string>my_language</string> <string>my_language</string>
<string>my_version</string> <string>my_version</string>
<string>my_portal_type</string> <string>my_portal_type</string>
<string>my_modification_date</string> <string>your_modification_date</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_modification_date</string> </value> <value> <string>your_modification_date</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -279,7 +279,7 @@ ...@@ -279,7 +279,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <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> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment