Commit 71259344 authored by Roque's avatar Roque

erp5_officejs: actions can be a dialog form

parent 9e73268a
......@@ -47,7 +47,7 @@
var gadget = this,
parent = "portal_types/" + portal_type,
query = 'portal_type: "Action Information" AND reference: "' + action_reference + '" AND parent_relative_url: "' + parent + '"',
action_type;
action_type, action_title;
return gadget.jio_allDocs({query: query})
.push(function (data) {
if (data.data.rows.length === 0) {
......@@ -56,11 +56,13 @@
return gadget.jio_get(data.data.rows[0].id);
})
.push(function (action_result) {
action_title = action_result.title;
action_type = action_result.action_type;
return gadget.jio_get(action_result.action);
})
.push(function (form_result) {
form_result.form_definition.action_type = action_type;
form_result.form_definition.title = action_title;
return form_result.form_definition;
});
});
......
......@@ -269,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.17658.62401.59067</string> </value>
<value> <string>975.23763.60402.39680</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1556202022.57</float>
<float>1556568356.85</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -50,12 +50,12 @@
doc: jio_document,
child_gadget_url: child_gadget_url,
form_definition: form_definition,
form_type: 'page',
editable: false,
view: options.view,
//HARDCODED: following fields should be indicated by the configuration
has_more_views: false,
has_more_actions: options.view === "view",
is_form_list: false
has_more_actions: options.view === "view"
});
});
})
......
......@@ -225,7 +225,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.17968.931.9949</string> </value>
<value> <string>975.23887.3080.29184</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -243,7 +243,7 @@
</tuple>
<state>
<tuple>
<float>1556220490.79</float>
<float>1556575627.18</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -219,6 +219,8 @@ officejs_logo_text_editor.png\n
gadget_officejs_discussion_tool_router.html\n
gadget_erp5_pt_form_view_editable.html\n
gadget_erp5_pt_form_view_editable.js\n
gadget_erp5_pt_form_dialog.html\n
gadget_erp5_pt_form_dialog.js\n
gadget_erp5_page_action_offline.html\n
gadget_erp5_page_action_offline.js\n
gadget_erp5_page_ojs_controller.html\n
......@@ -744,7 +746,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.16181.55679.14097</string> </value>
<value> <string>975.23755.19438.47564</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -762,7 +764,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1556114650.11</float>
<float>1556573144.76</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -148,7 +148,7 @@
})
.push(function (result_list) {
var url_list = result_list[0], header_dict;
if (gadget.state.is_form_list) {
if (gadget.state.form_type === 'list') {
header_dict = {
panel_action: true,
jump_url: "",
......@@ -157,6 +157,12 @@
filter_action: true,
page_title: result_list[2]
};
} else if (gadget.state.form_type === 'dialog') {
header_dict = {
page_title: gadget.state.doc.title,
//TODO: find correct url
cancel_url: url_list[6]
};
} else {
header_dict = {
selection_url: url_list[2],
......@@ -174,6 +180,7 @@
if (gadget.state.has_more_actions) {
header_dict.actions_url = url_list[1];
}
//TODO: fix index (must be last index, not a number)
if (url_list[7]) {
header_dict.add_url = url_list[7];
}
......
......@@ -269,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.16239.52422.35396</string> </value>
<value> <string>975.23841.30794.8294</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1556116804.34</float>
<float>1556572935.87</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -57,7 +57,8 @@
gadget.element.appendChild(fragment);
return gadget.declareGadget(action_gadget_url, {
scope: "action_field",
element: fragment
element: fragment/*,
sandbox: 'iframe'*/
})
.push(function (action_gadget) {
return action_gadget.render(options, action_reference, form_definition);
......@@ -65,7 +66,7 @@
}
}
// avoid crash if form doesn't have gadget_field_action_js_script or object_jio_js_script action
// render form without submit (and warn/inform user?)
// TODO: render form without submit (and warn/inform user?)
});
})
......
......@@ -269,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.23581.9849.38673</string> </value>
<value> <string>975.23867.41521.38092</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1556559118.24</float>
<float>1556575547.56</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