Commit b4d74f8e authored by Roque's avatar Roque

erp5_officejs: allowed sub types managed by new layout properties

parent e28d03dc
......@@ -91,13 +91,17 @@
.declareMethod("getFormDefinition", function (portal_type, action_reference) {
var gadget = this,
all_allowed_sub_types_list = [],
allowed_sub_types_list = [],
i = 0,
query,
action_type,
action_title,
form_definition,
query_type,
query_parent,
query_reference;
query_reference,
pair;
query_reference = new SimpleQuery({
key: "reference",
operator: "",
......@@ -137,10 +141,21 @@
form_definition = form_result.form_definition;
form_definition.action_type = action_type;
form_definition.title = action_title;
return gadget.jio_get("portal_types/" + portal_type);
return gadget.getSetting("app_allowed_sub_types");
})
.push(function (portal_type_definition) {
form_definition.allowed_sub_types_list = portal_type_definition.type_allowed_content_type_list;
.push(function (allowed_sub_types) {
allowed_sub_types = allowed_sub_types.replace(/\(/g, '[')
.replace(/\)/g, ']')
.replace(/,\]/g, ']')
.replace(/\'/g, '"');
all_allowed_sub_types_list = JSON.parse(allowed_sub_types);
for (i = 0; i < all_allowed_sub_types_list.length; i++) {
pair = all_allowed_sub_types_list[i].split(" | ");
if (pair[0] === portal_type) {
allowed_sub_types_list.push(pair[1]);
}
}
form_definition.allowed_sub_types_list = allowed_sub_types_list;
return gadget.checkMoreActions(portal_type, action_type);
})
.push(function (has_more_dict) {
......
......@@ -269,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.22359.27411.27050</string> </value>
<value> <string>976.29977.52189.65245</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1560329876.02</float>
<float>1560786832.33</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.25433.13146.32819</string> </value>
<value> <string>976.29901.4312.20343</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1560517773.74</float>
<float>1560785129.07</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -269,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.25423.55011.64512</string> </value>
<value> <string>976.29933.16046.63863</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1560513625.91</float>
<float>1560784206.19</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -85,6 +85,7 @@
})
.declareMethod("getAllActions", function (portal_type, options) {
//TODO for now this takes also views. Views should be handle in another gadget like "..tab_office.js"
var gadget = this,
action_info_dict = {views: {}, actions: {}},
query = 'portal_type: "Action Information" AND parent_relative_url: "portal_types/' + portal_type + '"';
......@@ -101,6 +102,8 @@
.push(function (action_document_list) {
var action_settings_list = [], page, action_key, action_doc, key, action_settings;
for (action_key in action_document_list) {
//TODO filter actions: discard actions that are not in getSettings("app_actions")
//there must be one "View" action. If not, use default view (like jio_view in getsettings)
if (action_document_list.hasOwnProperty(action_key)) {
action_doc = action_document_list[action_key];
page = "handle_action";
......@@ -128,13 +131,6 @@
}
}
}
//var default_view = "text_editor_view";
//TODO use app settings to get the default view, and then:
//if (action_info_dict.views.hasOwnProperty(default_view) {
// remove all other views (iterate and delete every view in view_categories distinct from default view
//}
//if portal_type has both view and jio_view, remove classic 'view'
//is the 'classic view' action needed at all here? -maybe it shouldn't be added in appcache manifest
if (action_info_dict.views.hasOwnProperty("view") && action_info_dict.views.hasOwnProperty("jio_view")) {
delete action_info_dict.views.view;
}
......@@ -162,7 +158,7 @@
gadget.getHTMLElementList(action_info_dict.actions)
]);
})
// TODO: check other lists like clone or delete?
// check other lists like clone or delete? NO. For now, they will be actions
.push(function (all_html_elements) {
return RSVP.all([
renderLinkList(gadget, "Views", "eye", all_html_elements[0]),
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.25441.59429.45926</string> </value>
<value> <string>976.29913.52.4761</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1560517786.94</float>
<float>1560785127.88</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -335,6 +335,46 @@
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_app_action_prefix</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_header_jump_button</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>int</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_app_actions</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>lines</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_app_allowed_sub_types</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>lines</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
......@@ -365,6 +405,27 @@
</tuple>
</value>
</item>
<item>
<key> <string>configuration_app_action_prefix</string> </key>
<value> <string>some_action_prefix</string> </value>
</item>
<item>
<key> <string>configuration_app_actions</string> </key>
<value>
<tuple>
<string>Web Page | text_editor_view</string>
<string>Web Page | jio_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>configuration_app_allowed_sub_types</string> </key>
<value>
<tuple>
<string>Web Page Module | Web Page</string>
</tuple>
</value>
</item>
<item>
<key> <string>configuration_application_title</string> </key>
<value> <string>Text Editor</string> </value>
......@@ -393,6 +454,10 @@
<key> <string>configuration_header_gadget_url</string> </key>
<value> <string>gadget_erp5_header.html</string> </value>
</item>
<item>
<key> <string>configuration_header_jump_button</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>configuration_jio_gadget_url</string> </key>
<value> <string>gadget_ojs_local_jio.html</string> </value>
......@@ -694,7 +759,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.20971.62073.32870</string> </value>
<value> <string>976.29963.55292.21623</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -712,7 +777,7 @@
</tuple>
<state>
<tuple>
<float>1560246622.09</float>
<float>1560786002.25</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