Commit 48257d7f authored by Vincent Bechu's avatar Vincent Bechu

[erp5_officejs] Add attachments in dropbox configuration

parent 2bb706f4
/*global window, rJS, RSVP, URI, location, /*global window, rJS, RSVP*/
loopEventListener, btoa */
/*jslint nomen: true, indent: 2, maxerr: 3*/ /*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, RSVP, console) { (function (window, rJS, RSVP) {
"use strict"; "use strict";
function setDropboxConfiguration(gadget, token) { function setDropboxConfiguration(gadget, token) {
return gadget.getSetting("portal_type") return new RSVP.Queue()
.push(function (portal_type) { .push(function () {
var old_date = new Date(), return RSVP.all([
configuration = {}; gadget.getSetting("portal_type"),
// We are looking for documents modified in the past 3 month gadget.getSetting("erp5_attachment_synchro", "")
old_date = new Date(old_date.getFullYear(), old_date.getMonth() - 3); ]);
})
.push(function (setting) {
var configuration = {},
attachment_synchro = setting[1] !== "";
configuration = { configuration = {
type: "replicate", type: "replicate",
// XXX This drop the signature lists...
query: { query: {
query: 'portal_type:"' + portal_type + '" ', query: 'portal_type:"' + setting[0] + '" ',
// XX Synchonizing the whole module is too much, here is a way to start quietly limit: [0, 100],
// Supsended until modification_date is handled for synchronization sort_on: [["modification_date", "descending"]]
limit: [0, 1234567890]
}, },
use_remote_post: false, use_remote_post: false,
conflict_handling: 2, conflict_handling: 2,
check_local_attachment_modification: attachment_synchro,
check_local_attachment_creation: attachment_synchro,
check_remote_attachment_modification: attachment_synchro,
check_remote_attachment_creation: attachment_synchro,
check_remote_attachment_deletion: attachment_synchro,
check_local_modification: true, check_local_modification: true,
check_local_creation: true, check_local_creation: true,
check_local_deletion: false, check_local_deletion: false,
check_remote_modification: true, check_remote_modification: true,
check_remote_creation: true, check_remote_creation: true,
check_remote_deletion: true, check_remote_deletion: true,
signature_sub_storage: {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: "officejs-dropbox-hash"
}
}
},
local_sub_storage: { local_sub_storage: {
type: "mapping", type: "mapping",
attachment: { attachment: {
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.64671.63974.47513</string> </value> <value> <string>961.26184.18077.10393</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1501593492.98</float> <float>1502716653.05</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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