Commit 47ee7f53 authored by Vincent Bechu's avatar Vincent Bechu Committed by Vincent Bechu

erp5_officejs: fix add document in codeeditor

parent 8509511d
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
<div class="ui-field-contain"> <div class="ui-field-contain">
<label data-i18n="Url String:">Url String</label> <label data-i18n="Url String:">Url String</label>
<input type="text" name="url_string" value="{{url_string}}"> <input type="text" name="url_string" value="{{url_string}}" required>
</div> </div>
<div class="ui-field-contain"> <div class="ui-field-contain">
<label data-i18n="Version:">Version:</label> <label data-i18n="Portal Type:">Portal Type:</label>
<input type="text" name="version" value="{{version}}"></label> <input type="text" name="portal_type" value="{{portal_type}}" required></label>
</div> </div>
<div class="ui-field-contain"> <div class="ui-field-contain">
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.55534.43957.17220</string> </value> <value> <string>955.59479.11249.61201</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481330026.08</float> <float>1481540323.2</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -97,6 +97,10 @@ ...@@ -97,6 +97,10 @@
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value> <value> <string>Web Script</string> </value>
</item> </item>
<item>
<key> <string>revision</string> </key>
<value> <string>13</string> </value>
</item>
<item> <item>
<key> <string>short_title</string> </key> <key> <string>short_title</string> </key>
<value> <value>
...@@ -240,7 +244,7 @@ ...@@ -240,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.56020.64919.42120</string> </value> <value> <string>955.59464.8628.44953</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +262,7 @@ ...@@ -258,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481331946.97</float> <float>1481541034.32</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.55463.25205.4966</string> </value> <value> <string>955.56066.6312.29166</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481295803.59</float> <float>1481541101.2</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.55463.28674.13312</string> </value> <value> <string>955.56066.6312.29166</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481295806.77</float> <float>1481541119.53</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
type: "replicate", type: "replicate",
// XXX This drop the signature lists... // XXX This drop the signature lists...
query: { query: {
query: '(portal_type: ("Web Page","Web Script","Web Manifest","Web Style")) ' + query: 'portal_type: ("Web Page","Web Script","Web Manifest","Web Style")',
' AND (version: "' + version + '")',
limit: [0, 30], limit: [0, 30],
sort_on: [["modification_date", "descending"]] sort_on: [["modification_date", "descending"]]
}, },
...@@ -27,37 +26,38 @@ ...@@ -27,37 +26,38 @@
database: version + "_hash" database: version + "_hash"
} }
}, },
use_remote_post: true, use_remote_post: false,
conflict_handling: 1, conflict_handling: 1,
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: false,
local_sub_storage: { local_sub_storage: {
type: "mapping", type: "query",
mapping_dict: {
"id": {"equal": "relative_url"},
"url_string": {"equal": "id"}
},
sub_storage: { sub_storage: {
type: "query", type: "uuid",
sub_storage: { sub_storage: {
type: "uuid", type: "indexeddb",
sub_storage: { database: version
type: "indexeddb",
database: version
}
} }
} }
}, },
remote_sub_storage: { remote_sub_storage: {
type: "erp5", type: "mapping",
url: (new URI("hateoas")) mapping_dict: {
.absoluteTo(erp5_url) "id": {"equal": "url_string"},
.toString(), "relative_url": "ignore",
default_view_reference: "jio_view" "version": {"default_value": version}
},
sub_storage: {
type: "erp5",
url: (new URI("hateoas"))
.absoluteTo(erp5_url)
.toString(),
default_view_reference: "jio_view"
}
} }
} }
); );
......
...@@ -97,6 +97,16 @@ ...@@ -97,6 +97,16 @@
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value> <value> <string>Web Script</string> </value>
</item> </item>
<item>
<key> <string>revision</string> </key>
<value> <string>7</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>OfficeJS jIO ERP5 Configurator Page JS</string> </value> <value> <string>OfficeJS jIO ERP5 Configurator Page JS</string> </value>
...@@ -234,7 +244,7 @@ ...@@ -234,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.55534.6594.50944</string> </value> <value> <string>955.59548.4928.4881</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +262,7 @@ ...@@ -252,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481327828.02</float> <float>1481541022.38</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.55462.40798.5324</string> </value> <value> <string>955.56066.6312.29166</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481295757.83</float> <float>1481502794.84</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -8883,10 +8883,10 @@ return new Parser; ...@@ -8883,10 +8883,10 @@ return new Parser;
use_bulk_get: use_bulk_get, use_bulk_get: use_bulk_get,
conflict_force: (context._conflict_handling === conflict_force: (context._conflict_handling ===
CONFLICT_KEEP_REMOTE), CONFLICT_KEEP_REMOTE),
conflict_ignore: ((context._conflict_handling === conflict_ignore: (context._conflict_handling ===
CONFLICT_CONTINUE) || CONFLICT_CONTINUE) ||
(context._conflict_handling === (context._conflict_handling ===
CONFLICT_KEEP_LOCAL)), CONFLICT_KEEP_LOCAL),
check_modification: context._check_remote_modification, check_modification: context._check_remote_modification,
check_creation: context._check_remote_creation, check_creation: context._check_remote_creation,
check_deletion: context._check_remote_deletion check_deletion: context._check_remote_deletion
...@@ -12077,7 +12077,8 @@ return new Parser; ...@@ -12077,7 +12077,8 @@ return new Parser;
}; };
IndexedDBStorage.prototype.getAttachment = function (id, name, options) { IndexedDBStorage.prototype.getAttachment = function (id, name, options) {
var type, var transaction,
type,
start, start,
end; end;
if (options === undefined) { if (options === undefined) {
...@@ -12085,63 +12086,48 @@ return new Parser; ...@@ -12085,63 +12086,48 @@ return new Parser;
} }
return openIndexedDB(this) return openIndexedDB(this)
.push(function (db) { .push(function (db) {
return new RSVP.Promise(function (resolve, reject) { transaction = openTransaction(db, ["attachment", "blob"], "readonly");
var transaction = openTransaction(db, ["attachment", "blob"], // XXX Should raise if key is not good
"readonly"), return handleGet(transaction.objectStore("attachment")
// XXX Should raise if key is not good .get(buildKeyPath([id, name])));
request = transaction.objectStore("attachment") })
.get(buildKeyPath([id, name])); .push(function (attachment) {
request.onerror = function (error) { var total_length = attachment.info.length,
transaction.abort(); i,
reject(error); promise_list = [],
}; store = transaction.objectStore("blob"),
request.onsuccess = function () { start_index,
var attachment = request.result, end_index;
total_length,
i,
promise_list = [],
store = transaction.objectStore("blob"),
start_index,
end_index;
if (!attachment) {
return reject(
new jIO.util.jIOError("Cannot find attachment", 404)
);
}
total_length = attachment.info.length; type = attachment.info.content_type;
type = attachment.info.content_type; start = options.start || 0;
start = options.start || 0; end = options.end || total_length;
end = options.end || total_length; if (end > total_length) {
if (end > total_length) { end = total_length;
end = total_length; }
}
if (start < 0 || end < 0) { if (start < 0 || end < 0) {
throw new jIO.util.jIOError("_start and _end must be positive", throw new jIO.util.jIOError("_start and _end must be positive",
400); 400);
} }
if (start > end) { if (start > end) {
throw new jIO.util.jIOError("_start is greater than _end", throw new jIO.util.jIOError("_start is greater than _end",
400); 400);
} }
start_index = Math.floor(start / UNITE); start_index = Math.floor(start / UNITE);
end_index = Math.floor(end / UNITE); end_index = Math.floor(end / UNITE);
if (end % UNITE === 0) { if (end % UNITE === 0) {
end_index -= 1; end_index -= 1;
} }
for (i = start_index; i <= end_index; i += 1) { for (i = start_index; i <= end_index; i += 1) {
promise_list.push( promise_list.push(
handleGet(store.get(buildKeyPath([id, handleGet(store.get(buildKeyPath([id,
name, i]))) name, i])))
); );
} }
resolve(RSVP.all(promise_list)); return RSVP.all(promise_list);
};
});
}) })
.push(function (result_list) { .push(function (result_list) {
var array_buffer_list = [], var array_buffer_list = [],
...@@ -12201,12 +12187,10 @@ return new Parser; ...@@ -12201,12 +12187,10 @@ return new Parser;
} }
// Remove previous attachment // Remove previous attachment
transaction = openTransaction(db, ["attachment", "blob"], transaction = openTransaction(db, ["attachment", "blob"], "readwrite");
"readwrite", false);
return removeAttachment(transaction, id, name); return removeAttachment(transaction, id, name);
}) })
.push(function () { .push(function () {
transaction = openTransaction(db, ["attachment", "blob"], "readwrite");
var promise_list = [ var promise_list = [
handleRequest(transaction.objectStore("attachment").put({ handleRequest(transaction.objectStore("attachment").put({
...@@ -12882,10 +12866,6 @@ return new Parser; ...@@ -12882,10 +12866,6 @@ return new Parser;
if (sub_doc.id !== undefined) { if (sub_doc.id !== undefined) {
return sub_doc.id; return sub_doc.id;
} }
throw new jIO.util.jIOError(
"Cannot find id field related",
400
);
} }
query = new SimpleQuery({ query = new SimpleQuery({
key: storage._mapping_dict.id.equal, key: storage._mapping_dict.id.equal,
...@@ -12938,6 +12918,10 @@ return new Parser; ...@@ -12938,6 +12918,10 @@ return new Parser;
return property; return property;
} }
} }
if (!storage._map_all_property ||
storage._mapping_dict[property] === "ignore") {
return false;
}
if (storage._map_all_property) { if (storage._map_all_property) {
sub_doc[property] = doc[property]; sub_doc[property] = doc[property];
return property; return property;
...@@ -12960,6 +12944,10 @@ return new Parser; ...@@ -12960,6 +12944,10 @@ return new Parser;
return property; return property;
} }
} }
if (!storage._map_all_property ||
storage._mapping_dict[property] === "ignore") {
return property;
}
if (storage._map_all_property) { if (storage._map_all_property) {
if (sub_doc.hasOwnProperty(property)) { if (sub_doc.hasOwnProperty(property)) {
doc[property] = sub_doc[property]; doc[property] = sub_doc[property];
...@@ -13262,7 +13250,6 @@ return new Parser; ...@@ -13262,7 +13250,6 @@ return new Parser;
) )
.push(function (result) { .push(function (result) {
for (i = 0; i < result.data.total_rows; i += 1) { for (i = 0; i < result.data.total_rows; i += 1) {
result.data.rows[i].value.id = result.data.rows[i].id;
result.data.rows[i].value = result.data.rows[i].value =
mapToMainDocument( mapToMainDocument(
context, context,
......
...@@ -97,6 +97,16 @@ ...@@ -97,6 +97,16 @@
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value> <value> <string>Web Script</string> </value>
</item> </item>
<item>
<key> <string>revision</string> </key>
<value> <string>10</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>jio.js</string> </value> <value> <string>jio.js</string> </value>
...@@ -234,7 +244,7 @@ ...@@ -234,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.55534.6594.50944</string> </value> <value> <string>955.59479.27056.28433</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +262,7 @@ ...@@ -252,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481328691.34</float> <float>1481540344.93</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.55436.28704.31573</string> </value> <value> <string>955.59498.53728.18602</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481294187.07</float> <float>1481538523.87</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