Commit 69d79d7b authored by Vincent Bechu's avatar Vincent Bechu

[OfficeJS] Add officejs storage file and remove old storage file

parent 20e4a6a9
......@@ -119,8 +119,7 @@ font-awesome/font-awesome-webfont.woff2\n
font-awesome/font-awesome-webfont.ttf\n
font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_ojs_storage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -344,7 +343,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -358,7 +357,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.40807.30284.14097</string> </value>
<value> <string>962.42958.18622.47018</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -376,7 +375,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1503579323.73</float>
<float>1507552624.72</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -116,8 +116,7 @@ font-awesome/font-awesome-webfont.woff2\n
font-awesome/font-awesome-webfont.ttf\n
font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_ojs_storage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -336,7 +335,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -350,7 +349,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.59292.36287.51694</string> </value>
<value> <string>962.42958.18622.47018</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -368,7 +367,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1504882629.57</float>
<float>1507552630.74</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -10,8 +10,7 @@
<script src="renderjs.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<script src="jio_mappingstorage.js" type="text/javascript"></script>
<script src="jio_fixstorage.js" type="text/javascript"></script>
<script src="jio_ojs_storage.js" type="text/javascript"></script>
<!-- custom script -->
......
......@@ -224,7 +224,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>960.3901.52182.22272</string> </value>
<value> <string>962.42958.18622.47018</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1497517315.49</float>
<float>1507552322.86</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -116,8 +116,7 @@ font-awesome/font-awesome-webfont.woff2\n
font-awesome/font-awesome-webfont.ttf\n
font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_ojs_storage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -336,7 +335,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -350,7 +349,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.62559.15643.59750</string> </value>
<value> <string>962.42958.18622.47018</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -368,7 +367,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1504882651.79</float>
<float>1507552642.43</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -113,8 +113,7 @@
# images/ajax-loader.gif\n
CACHE:\n
jiodev.js\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_ojs_storage.js\n
renderjs.js\n
rsvp.js\n
gadget_officejs_setting.js\n
......@@ -251,7 +250,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -265,7 +264,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>960.57151.51816.16622</string> </value>
<value> <string>962.42958.18622.47018</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -283,7 +282,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1501160529.99</float>
<float>1507552649.8</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -120,8 +120,7 @@ font-awesome/font-awesome-webfont.woff2\n
font-awesome/font-awesome-webfont.ttf\n
font-awesome/font-awesome-webfont.svg\n
gadget_officejs_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_ojs_storage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -340,7 +339,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -354,7 +353,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.62559.15643.59750</string> </value>
<value> <string>962.42958.18622.47018</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -372,7 +371,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1504882642.06</float>
<float>1507552655.47</float>
<string>UTC</string>
</tuple>
</state>
......
/*globals jIO, Blob, Rusha, RSVP, URI*/
/*jslint indent: 2, maxlen: 80, nomen: true*/
(function (jIO, Blob, Rusha, RSVP, URI) {
"use strict";
function repairDocumentSignature(storage, signature_document) {
/* The aim is deleted corrupted data to have fresh one from server
And clear signature for inexistant document
This can be consider like a HACK
*/
return storage._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(
storage._sub_storage.remove(doc_list[i].id)
);
}
}
return RSVP.all(promise_list);
})
.push(function () {
signature_document.is_fixed = true;
return storage._local_storage.put(
storage._signature_hash, signature_document
);
});
}
function CompatibilityStorage(spec) {
this._sub_storage = jIO.createJIO(spec.sub_storage);
this._replicate_storage = this._sub_storage.__storage;
this._local_storage = this._replicate_storage._local_sub_storage;
this._signature_hash = this._replicate_storage._signature_hash;
}
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 storage = this, signature_doc;
// Here fix the local storage for some cases.
return storage._local_storage.get(this._signature_hash)
.push(undefined, function (error) {
if (error.status_code === 404) {
return {is_fixed: false};
}
})
.push(function (doc) {
if (!doc.is_fixed) {
return repairDocumentSignature(storage, doc);
}
})
.push(function () {
return storage._sub_storage.repair.apply(
storage._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
......@@ -616,4 +616,180 @@
jIO.addStorage('mapping', MappingStorage);
}(jIO, RSVP, UriTemplate, SimpleQuery, ComplexQuery, QueryFactory, Query,
FormData));
\ No newline at end of file
FormData));
/*jslint nomen: true*/
(function (jIO) {
"use strict";
/**
* The jIO DateUpdaterStorage extension
*
* @class DateUpdaterStorage
* @constructor
*/
function updateDocument(doc, property_list) {
var i, len = property_list.length;
for (i = 0; i < len; i += 1) {
doc[property_list[i]] = new Date().toUTCString().replace('GMT', '+0000');
}
return doc;
}
function DateUpdaterStorage(spec) {
this._sub_storage = jIO.createJIO(spec.sub_storage);
this._property_list = spec.property_list || [];
}
DateUpdaterStorage.prototype.get = function () {
return this._sub_storage.get.apply(this._sub_storage, arguments);
};
DateUpdaterStorage.prototype.allAttachments = function () {
return this._sub_storage.allAttachments.apply(this._sub_storage, arguments);
};
DateUpdaterStorage.prototype.post = function (doc) {
doc = updateDocument(doc, this._property_list);
return this._sub_storage.post(doc);
};
DateUpdaterStorage.prototype.put = function (id, doc) {
doc = updateDocument(doc, this._property_list);
return this._sub_storage.put(id, doc);
};
DateUpdaterStorage.prototype.remove = function () {
return this._sub_storage.remove.apply(this._sub_storage, arguments);
};
DateUpdaterStorage.prototype.getAttachment = function () {
return this._sub_storage.getAttachment.apply(this._sub_storage, arguments);
};
DateUpdaterStorage.prototype.putAttachment = function (id) {
var storage = this, argument_list = arguments;
return storage.get(id)
.push(function (doc) {
return storage.put(id, doc);
})
.push(function () {
return storage._sub_storage.putAttachment.apply(
storage._sub_storage,
argument_list
);
});
};
DateUpdaterStorage.prototype.removeAttachment = function (id) {
var storage = this, argument_list = arguments;
return storage.get(id)
.push(function (doc) {
return storage.put(id, doc);
})
.push(function () {
return storage._sub_storage.removeAttachment.apply(
storage._sub_storage,
argument_list
);
});
};
DateUpdaterStorage.prototype.repair = function () {
return this._sub_storage.repair.apply(this._sub_storage, arguments);
};
DateUpdaterStorage.prototype.hasCapacity = function (name) {
return this._sub_storage.hasCapacity(name);
};
DateUpdaterStorage.prototype.buildQuery = function () {
return this._sub_storage.buildQuery.apply(this._sub_storage,
arguments);
};
jIO.addStorage('dateupdater', DateUpdaterStorage);
}(jIO));
/*jslint nomen: true*/
(function (jIO) {
"use strict";
/**
* The jIO SafeRepairStorage extension
*
* @class SafeRepairStorage
* @constructor
*/
function SafeRepairStorage(spec) {
this._sub_storage = jIO.createJIO(spec.sub_storage);
this._id_dict = {};
}
SafeRepairStorage.prototype.get = function () {
return this._sub_storage.get.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.allAttachments = function () {
return this._sub_storage.allAttachments.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.post = function () {
return this._sub_storage.post.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.put = function (id, doc) {
var storage = this;
return this._sub_storage.put.apply(this._sub_storage, arguments)
.push(undefined, function (error) {
if (error instanceof jIO.util.jIOError &&
error.status_code === 403) {
if (storage._id_dict[id]) {
return storage._sub_storage.put(storage._id_dict[id], doc);
}
return storage._sub_storage.post(doc)
.push(function (sub_id) {
storage._id_dict[id] = sub_id;
return sub_id;
});
}
});
};
SafeRepairStorage.prototype.remove = function () {
return;
};
SafeRepairStorage.prototype.getAttachment = function () {
return this._sub_storage.getAttachment.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.putAttachment = function (id, attachment_id,
attachment) {
var storage = this;
return this._sub_storage.putAttachment.apply(this._sub_storage, arguments)
.push(undefined, function (error) {
if (error instanceof jIO.util.jIOError &&
error.status_code === 403) {
return new RSVP.Queue()
.push(function () {
if (storage._id_dict[id]) {
return storage._id_dict[id];
}
return storage._sub_storage.get(id)
.push(function (doc) {
return storage._sub_storage.post(doc);
});
})
.push(function (sub_id) {
storage._id_dict[id] = sub_id;
return storage._sub_storage.putAttachment(sub_id, attachment_id,
attachment);
});
}
});
};
SafeRepairStorage.prototype.removeAttachment = function () {
return;
};
SafeRepairStorage.prototype.repair = function () {
return this._sub_storage.repair.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.hasCapacity = function (name) {
return this._sub_storage.hasCapacity(name);
};
SafeRepairStorage.prototype.buildQuery = function () {
return this._sub_storage.buildQuery.apply(this._sub_storage,
arguments);
};
jIO.addStorage('saferepair', SafeRepairStorage);
}(jIO));
\ No newline at end of file
......@@ -24,6 +24,7 @@
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
......@@ -42,6 +43,8 @@
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
......@@ -74,7 +77,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>jio_mappingstorage.js</string> </value>
<value> <string>jio_ojs_storage.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -84,7 +87,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>jio_mappingstorage_js</string> </value>
<value> <string>jio_ojs_storage_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -102,7 +105,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>jio_mappingstorage.js</string> </value>
<value> <string>jio_ojs_storage.js</string> </value>
</item>
<item>
<key> <string>url_string</string> </key>
......@@ -168,11 +171,11 @@
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish</string> </value>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -194,7 +197,7 @@
</tuple>
<state>
<tuple>
<float>1486561509.52</float>
<float>1507730066.16</float>
<string>UTC</string>
</tuple>
</state>
......@@ -203,7 +206,7 @@
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published</string> </value>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
......@@ -225,7 +228,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -239,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>960.25496.14411.56081</string> </value>
<value> <string>962.45923.44376.29252</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1502900157.25</float>
<float>1507730215.96</float>
<string>UTC</string>
</tuple>
</state>
......@@ -284,7 +287,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -314,7 +317,7 @@
</tuple>
<state>
<tuple>
<float>1486542996.4</float>
<float>1507197694.87</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -116,8 +116,7 @@ font-awesome/font-awesome-webfont.woff2\n
font-awesome/font-awesome-webfont.ttf\n
font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_ojs_storage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -338,7 +337,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -352,7 +351,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.62559.15643.59750</string> </value>
<value> <string>962.42958.18622.47018</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -370,7 +369,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1504882749.21</float>
<float>1507552636.58</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -116,8 +116,7 @@ font-awesome/font-awesome-webfont.woff2\n
font-awesome/font-awesome-webfont.ttf\n
font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_ojs_storage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -330,7 +329,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -344,7 +343,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.62559.15643.59750</string> </value>
<value> <string>962.42958.18622.47018</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -362,7 +361,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1504882740.68</float>
<float>1507552665.08</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -116,8 +116,7 @@ font-awesome/font-awesome-webfont.woff2\n
font-awesome/font-awesome-webfont.ttf\n
font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_ojs_storage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -336,7 +335,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -350,7 +349,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.62559.15643.59750</string> </value>
<value> <string>962.42958.18622.47018</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -368,7 +367,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1504882731.36</float>
<float>1507552671.36</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -116,8 +116,7 @@ font-awesome/font-awesome-webfont.woff2\n
font-awesome/font-awesome-webfont.ttf\n
font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_ojs_storage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -336,7 +335,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -350,7 +349,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.62559.15643.59750</string> </value>
<value> <string>962.42958.18622.47018</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -368,7 +367,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1504882719.22</float>
<float>1507552677.3</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -116,8 +116,7 @@ font-awesome/font-awesome-webfont.woff2\n
font-awesome/font-awesome-webfont.ttf\n
font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_ojs_storage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -336,7 +335,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -350,7 +349,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.62559.15643.59750</string> </value>
<value> <string>962.42966.4115.56900</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -368,7 +367,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1504882676.53</float>
<float>1507639011.94</float>
<string>UTC</string>
</tuple>
</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