Commit 379bd22d authored by Roque's avatar Roque

discussion tool: cleanup on controller gadget

parent 581c808b
/*global document, window, rJS, RSVP, jIO */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (document, window, rJS, RSVP, jIO, console, XMLHttpRequest) {
(function (document, window, rJS, RSVP, jIO) {
"use strict";
function renderField(field_id, field_definition, document) {
......@@ -16,7 +16,7 @@
if (tales_expr !== undefined && tales_expr !== null && tales_expr !== '') {
try {
final_value = eval(tales_expr);
} catch (e) {} // TALES expressions are usually python code, so ignore
} catch (e) {} // TALES expressions are usually python code, so for now ignore
}
if (final_value === undefined) {
if (override !== undefined && override !== null && override !== '') {
......@@ -89,7 +89,6 @@
/////////////////////////////////////////////////////////////////
.declareMethod("getFormDefinition", function (jio_key) {
//preparing a less hardcoded version, moving form definition to erp5 side
var gadget = this;
return new RSVP.Queue()
.push(function () {
......@@ -106,26 +105,12 @@
default_view_reference: setting_list[1]
},
jio_storage = jIO.createJIO(jio_options),
//jio_storage = jIO.createJIO(jio_options_indexdb),
form_path = 'portal_skins/erp5_officejs_jio_connector/' +
setting_list[2].portal_type.replace(/ /g, '') +
'_viewAsJio';
return new RSVP.Queue()
.push(function () {
// manual request to hateoas script to test if the script json dict result is correctly cached in appcache
var xmlHttp = new XMLHttpRequest(),
url = "https://softinst112382.host.vifib.net/erp5/web_site_module/officejs_discussion_tool/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_officejs_jio_connector%2FHTMLPost_viewAsJio&view=jio_view";
xmlHttp.open("GET", url, false); // false for synchronous request
xmlHttp.send(null);
return JSON.parse(xmlHttp.responseText);
})
return jio_storage.get(form_path)
.push(function (result) {
//return result._embedded._view.my_form_definition["default"];
// jio.get ends up calling hateoas script
return jio_storage.get(form_path)
.push(function (result) {
return result.form_definition;
});
return result.form_definition;
});
});
})
......@@ -133,6 +118,7 @@
.declareMethod("renderForm", function (form_definition, document) {
return renderForm(form_definition, document);
})
.allowPublicAcquisition('submitContent', function (options) {
var gadget = this,
jio_key = options[0],
......@@ -245,4 +231,4 @@
});
});
}(document, window, rJS, RSVP, jIO, console, XMLHttpRequest));
\ No newline at end of file
}(document, window, rJS, RSVP, jIO));
\ No newline at end of file
......@@ -225,7 +225,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.12826.51404.40908</string> </value>
<value> <string>974.18369.12138.30429</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -243,7 +243,7 @@
</tuple>
<state>
<tuple>
<float>1551979865.57</float>
<float>1552312445.03</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