Commit 4c7556ba authored by Roque's avatar Roque

erp5_officejs: post list form rendered using local storage form definition

parent 30a58f16
......@@ -255,7 +255,7 @@ jio_appcachestorage.js\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_officejs_jio_connector%2FHTMLPost_viewAsJio&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_officejs_jio_connector%2FHTMLPost_viewReplyDialog&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_post%2FPostModule_newHTMLPost&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_post%2FPostModule_viewHTMLPostList&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_post%2FPostModule_viewHTMLPostListAsJio&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F1&view=view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F2&view=view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F3&view=view&appcache=1\n
......@@ -748,7 +748,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.33891.43185.16366</string> </value>
<value> <string>975.35023.63449.27596</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -766,7 +766,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1557091528.6</float>
<float>1557159135.54</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -119,7 +119,7 @@ CACHE:\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_officejs_jio_connector%2FHTMLPost_viewAsJio&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_officejs_jio_connector%2FHTMLPost_viewReplyDialog&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_post%2FPostModule_newHTMLPost&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_post%2FPostModule_viewHTMLPostList&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_post%2FPostModule_viewHTMLPostListAsJio&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F1&view=view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F2&view=view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F3&view=view&appcache=1\n
......@@ -271,7 +271,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.33891.3939.51882</string> </value>
<value> <string>975.33927.59349.41574</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -289,7 +289,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1557091674.33</float>
<float>1557157442.14</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -17,63 +17,20 @@
// declared methods
/////////////////////////////////////////////////////////////////
//HARDCODED UNTIL form_def is stored in local storage
.declareMethod("getFormDefinition", function (gadget) {
var fake_thread_uid = "thread-" + ("0000" + ((Math.random() * Math.pow(36, 4)) | 0).toString(36)).slice(-4),
.declareMethod("render", function (options) {
var gadget = this,
default_view = "jio_view",
common_utils_gadget_url = "gadget_officejs_common_utils.html",
child_gadget_url = 'gadget_erp5_pt_form_list.html',
//HARDCODED NEW ACTION INFORMATION - TODO: get like in action_offline gadget (refactor/reuse code)
fake_thread_uid = "thread-" + ("0000" + ((Math.random() * Math.pow(36, 4)) | 0).toString(36)).slice(-4),
action_info = {
page: "handle_action",
action: "new",
portal_type: "HTML Post",
parent_portal_type: "Post Module",
my_source_reference: fake_thread_uid
},
form_definition = {
_debug: "traverse",
pt: "form_view",
title: "Post",
group_list: [[
"bottom",
[["my_listbox"]]
]],
//this fields_raw_properties is totally made up, but somewhere in the definition there must be
//information about the fields. So, foreach field: key->info
fields_raw_properties: {
"my_listbox": {
"type": "ListBox",
"key": "field_listbox", // or my_listbox ??
"values": {
"column_list": [['title', 'Title'], ['modification_date', 'Modification Date']],
"show_anchor": 0,
"default_params": {},
"editable": 1,
"editable_column_list": [],
"lines": 30,
"list_method": "portal_catalog",
// is this correct? the query should come from the form definition, right?
"query": "urn:jio:allDocs?query=portal_type%3A%22HTML Post%22",
"portal_type": [],
"search_column_list": [['title', 'Title'], ['modification_date', 'Modification Date']],
"sort_column_list": [['title', 'Title'], ['modification_date', 'Modification Date']],
"sort": [['modification_date', 'descending']],
"title": "Posts"
},
"tales": {},
"overrides": {},
"message_values": {}
}
},
action: "Base_edit",
update_action: "",
_links: { "type": { name: "" }, "action_object_new_content_action": action_info }
};
return form_definition;
})
.declareMethod("render", function (options) {
var gadget = this,
default_view = "jio_view",
common_utils_gadget_url = "gadget_officejs_common_utils.html",
child_gadget_url = 'gadget_erp5_pt_form_list.html';
return RSVP.Queue()
.push(function () {
return RSVP.all([
......@@ -82,10 +39,11 @@
]);
})
.push(function (result) {
return gadget.getFormDefinition();
//return result[1].getFormDefinition(result[0], default_view);
return result[1].getFormDefinition(result[0], default_view);
})
.push(function (form_definition) {
//HARDCODED ACTION INFORMATION
form_definition._links.action_object_new_content_action = action_info;
return gadget.changeState({
jio_key: options.jio_key,
child_gadget_url: child_gadget_url,
......
......@@ -269,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.33902.30639.19097</string> </value>
<value> <string>975.35049.45064.43076</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1557091447.99</float>
<float>1557158988.51</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