Commit d0e41b15 authored by Boris Kocherov's avatar Boris Kocherov

[erp5_only_office] sync with new rjs_json_form

parent 7ec2fcd8
/*jslint nomen: true, maxlen: 200, indent: 2*/ /*jslint nomen: true, maxlen: 200, indent: 2*/
/*global rJS, console, window, document, RSVP, Xmla, Error*/ /*global rJS, console, window, document, RSVP, Xmla*/
(function (window, rJS) { (function (window, rJS) {
"use strict"; "use strict";
...@@ -230,29 +230,21 @@ ...@@ -230,29 +230,21 @@
.declareAcquiredMethod("notifyChange", "notifyChange") .declareAcquiredMethod("notifyChange", "notifyChange")
.allowPublicAcquisition("notifyChange", function (arr, scope) { .allowPublicAcquisition("notifyChange", function (arr, scope) {
var g = this, var g = this,
p = arr[0], p = arr[0].path,
gadget_settings, gadget_settings,
path; path;
function f(p) { function f(settings_path, rerender_path) {
var settings;
return g.getDeclaredGadget("xmla_settings") return g.getDeclaredGadget("xmla_settings")
.push(function (gadget) { .push(function (gadget) {
gadget_settings = gadget; gadget_settings = gadget;
return gadget.getContent(p); return gadget.getContent(settings_path);
}) })
.push(function (c) { .push(function (settings) {
settings = c; return generateSchema(settings);
return generateSchema(c);
}) })
.push(function (schema) { .push(function (schema) {
return gadget_settings.getGadgetByPath(p + '/properties') return gadget_settings.rerender(rerender_path, schema);
.push(function (ret) {
return ret.gadget.rerender({
schema: schema,
value: convertOnMultiLevel(settings, '/properties')
});
});
}) })
.push(function () { .push(function () {
return g.notifyChange(); return g.notifyChange();
...@@ -262,7 +254,7 @@ ...@@ -262,7 +254,7 @@
for (path in g.props.xmla_connections) { for (path in g.props.xmla_connections) {
if (g.props.xmla_connections.hasOwnProperty(path) && if (g.props.xmla_connections.hasOwnProperty(path) &&
p.startsWith(path)) { p.startsWith(path)) {
return f(path); return f(path, g.props.xmla_connections[path]);
} }
} }
return g.notifyChange(); return g.notifyChange();
...@@ -276,22 +268,20 @@ ...@@ -276,22 +268,20 @@
connection_path; connection_path;
if ("urn:jio:properties_from_xmla.connection.json" === url) { if ("urn:jio:properties_from_xmla.connection.json" === url) {
connection_path = path.split('/').slice(0, -1).join('/'); connection_path = path.split('/').slice(0, -1).join('/');
if (!g.props.xmla_connections[connection_path]) { return new RSVP.Queue()
return new RSVP.Queue() .push(function () {
.push(function () { if (g.props.init_value) {
if (g.props.init_value) { settings = convertOnMultiLevel(g.props.init_value, connection_path);
settings = convertOnMultiLevel(g.props.init_value, connection_path); if (settings) {
if (settings) { convertOnMultiLevel(g.props.init_value, connection_path, []);
convertOnMultiLevel(g.props.init_value, connection_path, []);
}
} }
return generateSchema(settings); }
}) return generateSchema(settings);
.push(function (s) { })
g.props.xmla_connections[connection_path] = false; .push(function (s) {
return s; g.props.xmla_connections[connection_path] = path;
}); return s;
} });
} }
throw new Error("urn: '" + url + "' not supported"); throw new Error("urn: '" + url + "' not supported");
}); });
......
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