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 @@
<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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
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