Commit 7e0db3ad authored by Vincent Bechu's avatar Vincent Bechu

erp5_officejs: commit fix_storage

/reviewed-on !313
parent bf94f426
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
return RSVP.all([ return RSVP.all([
gadget.getSetting("portal_type"), gadget.getSetting("portal_type"),
gadget.getSetting("erp5_attachment_synchro", undefined), gadget.getSetting("erp5_attachment_synchro", undefined),
gadget.getSetting("default_view_reference", "jio_view") gadget.getSetting("default_view_reference", "jio_view"),
gadget.getSetting("storage_attachment_issue", false)
]); ]);
}) })
.push(function (result) { .push(function (result) {
...@@ -19,6 +20,7 @@ ...@@ -19,6 +20,7 @@
portal_type = result[0], portal_type = result[0],
attachment_synchro = result[1] !== undefined, attachment_synchro = result[1] !== undefined,
extended_attachment_url = result[1]; extended_attachment_url = result[1];
configuration = { configuration = {
type: "replicate", type: "replicate",
// XXX This drop the signature lists... // XXX This drop the signature lists...
...@@ -41,15 +43,12 @@ ...@@ -41,15 +43,12 @@
check_remote_creation: true, check_remote_creation: true,
check_remote_deletion: true, check_remote_deletion: true,
local_sub_storage: { local_sub_storage: {
type: "fix_local", type: "query",
sub_storage: { sub_storage: {
type: "query", type: "uuid",
sub_storage: { sub_storage: {
type: "uuid", type: "indexeddb",
sub_storage: { database: "officejs-erp5"
type: "indexeddb",
database: "officejs-erp5"
}
} }
} }
}, },
...@@ -72,17 +71,28 @@ ...@@ -72,17 +71,28 @@
sub_storage: { sub_storage: {
type: "erp5", type: "erp5",
url: (new URI("hateoas")) url: (new URI("hateoas"))
.absoluteTo(erp5_url) .absoluteTo(erp5_url)
.toString(), .toString(),
default_view_reference: result[2] default_view_reference: result[2]
} }
} }
}; };
// This is only for onlyoffice
if (extended_attachment_url === "/{+id}/Document_downloadForOnlyOfficeApp") {
configuration = {
type: "fix_local",
is_fixed: result[3],
sub_storage: configuration
};
}
return gadget.setSetting('jio_storage_description', configuration); return gadget.setSetting('jio_storage_description', configuration);
}) })
.push(function () { .push(function () {
return gadget.setSetting('jio_storage_name', "ERP5"); return gadget.setSetting('jio_storage_name', "ERP5");
}) })
.push(function () {
return gadget.setSetting('storage_attachment_issue', true);
})
.push(function () { .push(function () {
return gadget.setGlobalSetting('erp5_url', erp5_url); return gadget.setGlobalSetting('erp5_url', erp5_url);
}) })
......
...@@ -273,7 +273,7 @@ ...@@ -273,7 +273,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.25496.14411.56081</string> </value> <value> <string>960.32726.32486.40567</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -291,7 +291,7 @@ ...@@ -291,7 +291,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498834693.92</float> <float>1499160764.83</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*globals jIO, Blob, Rusha, RSVP, URI*/
/*jslint indent: 2, maxlen: 80, nomen: true*/
(function (jIO, Blob, Rusha, RSVP, URI) {
"use strict";
var rusha = new Rusha(), stringify = jIO.util.stringify;
function CompatibilityStorage(spec) {
this._sub_storage = jIO.createJIO(spec.sub_storage);
this._is_fixed = spec.is_fixed;
}
CompatibilityStorage.prototype.get = function () {
return this._sub_storage.get.apply(this._sub_storage, arguments);
};
CompatibilityStorage.prototype.put = function () {
return this._sub_storage.put.apply(this._sub_storage, arguments);
};
CompatibilityStorage.prototype.post = function () {
return this._sub_storage.post.apply(this._sub_storage, arguments);
};
CompatibilityStorage.prototype.remove = function () {
return this._sub_storage.remove.apply(this._sub_storage, arguments);
};
CompatibilityStorage.prototype.hasCapacity = function () {
return this._sub_storage.hasCapacity.apply(this._sub_storage, arguments);
};
CompatibilityStorage.prototype.repair = function () {
var context = this;
// Here fix the local storage for some cases.
if (!context._is_fixed) {
return context._sub_storage.allDocs({
select_list: ["content_type"]
})
.push(function (result) {
var i, promise_list = [], doc_list = result.data.rows;
for (i = 0; i < result.data.total_rows; i += 1) {
if (doc_list[i].value.content_type !== undefined &&
!doc_list[i].value.content_type.startsWith("application/x-asc")) {
promise_list.push(
context._sub_storage.remove(doc_list[i].id)
);
}
}
return RSVP.all(promise_list);
})
.push(function () {
return context._sub_storage.repair.apply(
context._sub_storage, arguments
);
});
}
};
CompatibilityStorage.prototype.allAttachments = function (doc_id) {
return this._sub_storage.allAttachments.apply(
this._sub_storage,
arguments
);
};
CompatibilityStorage.prototype.getAttachment = function (doc_id) {
var context = this;
return context._sub_storage.getAttachment.apply(
this._sub_storage,
arguments
);
};
CompatibilityStorage.prototype.putAttachment = function () {
return this._sub_storage.putAttachment.apply(this._sub_storage, arguments);
};
CompatibilityStorage.prototype.removeAttachment = function () {
return this._sub_storage.removeAttachment.apply(
this._sub_storage,
arguments
);
};
CompatibilityStorage.prototype.buildQuery = function () {
return this._sub_storage.buildQuery.apply(
this._sub_storage,
arguments
);
};
jIO.addStorage('fix_local', CompatibilityStorage);
}(jIO, Blob, Rusha, RSVP, URI));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>jio_fixstorage.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>jio_fixstorage_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1498817425.15</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>960.25570.27528.1382</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1499160625.83</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>empty</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1498814308.48</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
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