Commit 3b15ad3d authored by Roque's avatar Roque

erp5_officejs: moving form definition to hateoas script

parent 45216535
......@@ -20,14 +20,16 @@
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("getFormDefinition", function () {
.declareMethod("getFormDefinition", function (jio_key) {
//preparing a less hardcoded version, moving form definition to erp5 side
/*var gadget = this;
var gadget = this;
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getSetting('hateoas_url'),
gadget.getSetting('default_view_reference')
gadget.getSetting('default_view_reference'),
gadget.jio_get(jio_key)
//gadget.jio_get("portal_skins/erp5_hal_json_style/roquetest")
]);
})
.push(function (setting_list) {
......@@ -36,12 +38,60 @@
url: setting_list[0],
default_view_reference: setting_list[1]
},
jio_storage = jIO.createJIO(jio_options);
return jio_storage.get('portal_skins/erp5_officejs_jio_connector/HTMLPost_viewAsJio')
jio_options_indexdb = {
type: "replicate",
check_remote_deletion: true,
check_local_creation: true,
check_local_deletion: false,
check_local_modification: true,
signature_sub_storage: {
type: "query",
sub_storage: {
type: "indexeddb",
database: "officejs-hash"
}
},
local_sub_storage: {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: "ojs_source_code"
}
}
},
remote_sub_storage: {
type: "appcache",
manifest: "gadget_officejs_discussion_tool.appcache",
version: "app/",
take_installer: true
}
},
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 () {
var xmlHttp = new XMLHttpRequest(),
url = "https://softinst112382.host.vifib.net/erp5/web_site_module/officejs_discussion_tool/app/portal_skins/erp5_hal_json_style/roquetest";
xmlHttp.open("GET", url, false); // false for synchronous request
xmlHttp.send(null);
return xmlHttp.responseText;
})
.push(function (result) {
return result.form_definition;
console.log("XMLHttpRequest result:");
console.log(result);
return jio_storage.get(form_path)
.push(function (result) {
console.log("jio_storage.get(" + form_path + ") RESULT:");
console.log(result);
return result.form_definition;
});
});
});*/
});
//somehow the form_definition should come from the erp5-doc/form (jio?)
//for now, hardcoded form_definition for POST VIEW
return {
......
......@@ -225,7 +225,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>973.45022.8574.58385</string> </value>
<value> <string>973.60782.51516.51131</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -243,7 +243,7 @@
</tuple>
<state>
<tuple>
<float>1550238642.63</float>
<float>1551184466.38</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -109,7 +109,9 @@
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string>CACHE MANIFEST\n
<value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n
# generated on Fri, 25 Jun 2016 11:45:33 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
......@@ -222,12 +224,15 @@ officejs_logo_text_editor.png\n
gadget_erp5_pt_form_view_editable.html\n
gadget_erp5_pt_form_view_editable.js\n
gadget_officejs_discussion_tool_router.html\n
gadget_erp5_page_ojs_controller.html\n
gadget_erp5_page_ojs_controller.js\n
gadget_erp5_page_ojs_post_list.html\n
gadget_erp5_page_ojs_post_list.js\n
gadget_erp5_page_ojs_add_post.html\n
gadget_erp5_page_ojs_add_post.js\n
\n
portal_skins/erp5_hal_json_style/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_officejs_jio_connector%2FHTMLPost_viewAsJio&view=jio_view\n
\n
#gadget_erp5_page_ojs_controller.html\n
#gadget_erp5_page_ojs_controller.js\n
#gadget_erp5_page_ojs_post_list.html\n
#gadget_erp5_page_ojs_post_list.js\n
#gadget_erp5_page_ojs_add_post.html\n
#gadget_erp5_page_ojs_add_post.js\n
\n
gadget_erp5_field_listbox.html\n
gadget_erp5_field_listbox.js\n
......@@ -571,7 +576,9 @@ ckeditor/ckeditor.js\n
ckeditor/adapters/jquery.js\n
\n
NETWORK:\n
*</string> </value>
*
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -712,7 +719,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>973.45023.7563.33484</string> </value>
<value> <string>973.60973.53293.46336</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -730,7 +737,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1550239187.57</float>
<float>1551212411.72</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -7,6 +7,7 @@
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="jio_appcachestorage.js"></script>
<!-- custom script -->
<script src="gadget_erp5_page_ojs_controller.js" type="text/javascript"></script>
......
......@@ -229,7 +229,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.578.63257.59545</string> </value>
<value> <string>973.44981.11075.37051</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -247,7 +247,7 @@
</tuple>
<state>
<tuple>
<float>1501163709.2</float>
<float>1551184378.85</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