Commit 30bdc0bb authored by Gabriel Monnerat's avatar Gabriel Monnerat Committed by Romain Courteaud

erp5_web_renderjs_ui: add generic function to merge action with raw actions by group

parent b3086168
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_jump</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>jump_to_portal_type</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Manage portal</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Edit Portal Type</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Base_redirectToPortalTypeDocument</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: portal.portal_preferences.isPreferredHtmlStyleDevelopperMode()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*global window, RSVP, SimpleQuery, ComplexQuery, Query, /*global window, RSVP, SimpleQuery, ComplexQuery, Query,
ensureArray */ ensureArray, Array*/
/*jslint indent: 2, maxerr: 3, nomen: true, unparam: true, continue: true */ /*jslint indent: 2, maxerr: 3, nomen: true, unparam: true, continue: true */
(function (window, RSVP, SimpleQuery, ComplexQuery, Query, (function (window, RSVP, SimpleQuery, ComplexQuery, Query,
ensureArray) { ensureArray, Array) {
"use strict"; "use strict";
/////////////////////////////// ///////////////////////////////
...@@ -164,6 +164,122 @@ ...@@ -164,6 +164,122 @@
/////////////////////////////// ///////////////////////////////
// Handle listbox action list // Handle listbox action list
/////////////////////////////// ///////////////////////////////
function mergeGlobalActionWithRawActionList(gadget, links, group_id_list,
command_mapping,
editable_mapping) {
var i, j, group,
action_type,
current_href,
class_name,
options,
command,
view = gadget.state.view,
jump_view = gadget.state.jump_view,
group_mapping = {},
url_mapping = {},
default_command_mapping = {
"view": "display_with_history",
"action_object_jio_jump": "display_dialog_with_history",
"action_object_jio_action": "display_with_history_and_cancel",
"action_object_view": "display_with_history",
"action_workflow": "display_dialog_with_history",
"action_object_clone_action": "display_with_history_and_cancel",
"action_object_delete_action": "display_with_history_and_cancel"
};
editable_mapping = editable_mapping || {};
command_mapping = command_mapping || {};
for (i = 0; i < group_id_list.length; i += 1) {
group = group_id_list[i][0];
if (group_id_list[i] instanceof Array) {
group_mapping[group] = ensureArray(links[group]);
action_type = group + "_raw";
if (links.hasOwnProperty(action_type)) {
if (links[action_type] instanceof Array) {
for (i = 0; i < links[action_type].length; i += 1) {
if (links[action_type][i].href) {
group_mapping[group].push(links[action_type][i]);
}
}
} else {
group_mapping[group].push(links[action_type]);
}
}
if (group_id_list[i].length > 1) {
for (j = 1; j < group_id_list[i].length; j += 1) {
group_mapping[group] = group_mapping[
group
].concat(
ensureArray(links[group_id_list[i][j]])
);
action_type = group_id_list[i][j] + "_raw";
if (links.hasOwnProperty(action_type)) {
if (links[action_type] instanceof Array) {
for (i = 0; i < links[action_type].length; i += 1) {
if (links[action_type][i].href) {
group_mapping[group].push(links[action_type][i]);
}
}
} else {
group_mapping[group].push(links[action_type]);
}
}
}
}
} else {
group_mapping[group_id_list[i]] = ensureArray(
links[group_id_list[i]]
);
}
}
for (group in group_mapping) {
if (group_mapping.hasOwnProperty(group)) {
if (!url_mapping.hasOwnProperty(group)) {
url_mapping[group] = [];
}
for (i = 0; i < group_mapping[group].length; i += 1) {
class_name = "";
current_href = group_mapping[group][i].href;
if (view === 'view' && group_mapping[group][i].name === view) {
class_name = 'active';
} else if (current_href === view) {
class_name = 'active';
} else if (jump_view && ((current_href === jump_view) ||
(current_href === view))) {
class_name = 'active';
}
if (group_mapping[group][i].name.indexOf("_raw") !== -1) {
command = "raw";
options = {
title: group_mapping[group][i].title,
href: group_mapping[group][i].href
};
} else {
command = command_mapping[group] || default_command_mapping[group];
options = {
title: group_mapping[group][i].title,
class_name: class_name,
jio_key: gadget.state.jio_key,
view: group_mapping[group][i].href,
editable: editable_mapping[group]
};
}
if (group === "view") {
// Views in ERP5 must be forms but because of
// OfficeJS we keep it empty for different default
options.page = undefined;
}
url_mapping[group].push({
command: command,
options: options
});
}
}
}
return url_mapping;
}
function getListboxClipboardActionList() { function getListboxClipboardActionList() {
var action_list = ensureArray(this.state.erp5_document._links.action_object_list_action || []), var action_list = ensureArray(this.state.erp5_document._links.action_object_list_action || []),
i, i,
...@@ -311,8 +427,9 @@ ...@@ -311,8 +427,9 @@
.allowPublicAcquisition("triggerListboxClipboardAction", .allowPublicAcquisition("triggerListboxClipboardAction",
triggerListboxClipboardAction); triggerListboxClipboardAction);
} }
window.mergeGlobalActionWithRawActionList = mergeGlobalActionWithRawActionList;
window.triggerListboxClipboardAction = triggerListboxClipboardAction; window.triggerListboxClipboardAction = triggerListboxClipboardAction;
window.declareGadgetClassCanHandleListboxClipboardAction = window.declareGadgetClassCanHandleListboxClipboardAction =
declareGadgetClassCanHandleListboxClipboardAction; declareGadgetClassCanHandleListboxClipboardAction;
}(window, RSVP, SimpleQuery, ComplexQuery, Query, ensureArray)); }(window, RSVP, SimpleQuery, ComplexQuery, Query, ensureArray, Array));
\ No newline at end of file \ No newline at end of file
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>986.51245.10858.8089</string> </value> <value> <string>989.47571.17838.51694</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1602058138.58</float> <float>1612185222.55</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, RSVP, domsugar, calculatePageTitle, ensureArray */ /*global window, rJS, RSVP, domsugar, calculatePageTitle, ensureArray,
console, mergeGlobalActionWithRawActionList */
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, domsugar, calculatePageTitle, ensureArray) { (function (window, rJS, RSVP, domsugar, calculatePageTitle, ensureArray,
mergeGlobalActionWithRawActionList) {
"use strict"; "use strict";
function generateSection(title, icon, view_list) { function generateSection(title, icon, view_list) {
var i, var i,
dom_list = []; dom_list = [];
for (i = 0; i < view_list.length; i += 1) { for (i = 0; i < view_list.length; i += 1) {
dom_list.push(domsugar('li', [domsugar('a', { dom_list.push(domsugar('li', [domsugar('a', {
href: view_list[i].link, href: view_list[i].link,
...@@ -66,36 +67,33 @@ ...@@ -66,36 +67,33 @@
// what view we are at. If no view available than fallback to "links". // what view we are at. If no view available than fallback to "links".
return gadget.jio_getAttachment(gadget.state.jio_key, gadget.state.view || "links") return gadget.jio_getAttachment(gadget.state.jio_key, gadget.state.view || "links")
.push(function (jio_attachment) { .push(function (jio_attachment) {
var i, j,
url_for_kw_list = [],
url_mapping = mergeGlobalActionWithRawActionList(gadget,
jio_attachment._links,
["action_workflow",
["action_object_jio_action",
"action_object_jio_button",
"action_object_jio_fast_input"],
"action_object_clone_action",
"action_object_delete_action"], {
"action_workflow": "display_with_history_and_cancel"
}, {
action_object_clone_action: true
});
erp5_document = jio_attachment; erp5_document = jio_attachment;
raw_list = ensureArray(erp5_document._links.action_object_development_mode_jump_raw); raw_list = ensureArray(erp5_document._links.action_object_development_mode_jump_raw);
var i,
j,
url_for_kw_list = [];
group_list = [ group_list = [
// Action list, editable, icon url_mapping.action_workflow, 'random',
ensureArray(erp5_document._links.action_workflow), undefined, 'random', url_mapping.action_object_jio_action, 'gear',
ensureArray(erp5_document._links.action_object_jio_action) url_mapping.action_object_clone_action, 'clone',
.concat(ensureArray(erp5_document._links.action_object_jio_button)) url_mapping.action_object_delete_action, 'trash-o'
.concat(ensureArray(erp5_document._links.action_object_jio_fast_input)), undefined, 'gear', ];
ensureArray(erp5_document._links.action_object_clone_action), true, 'clone',
ensureArray(erp5_document._links.action_object_delete_action), undefined, 'trash-o'];
for (i = 0; i < group_list.length; i += 3) {
for (j = 0; j < group_list[i].length; j += 1) {
url_for_kw_list.push({command: 'display_with_history_and_cancel', options: {
jio_key: gadget.state.jio_key,
view: group_list[i][j].href,
editable: group_list[i + 1]
}});
}
}
// Move this code one place that can be shared for (i = 0; i < group_list.length; i += 2) {
for (i in erp5_document._links) { for (j = 0; j < group_list[i].length; j += 1) {
if (i.match(/.*_raw$/) && erp5_document._links[i].href) { url_for_kw_list.push(group_list[i][j]);
raw_list.push(erp5_document._links[i]);
} }
} }
...@@ -126,17 +124,17 @@ ...@@ -126,17 +124,17 @@
raw_action_list = [], raw_action_list = [],
link_list; link_list;
for (i = 0; i < group_list.length; i += 3) { for (i = 0; i < group_list.length; i += 2) {
link_list = []; link_list = [];
for (j = 0; j < group_list[i].length; j += 1) { for (j = 0; j < group_list[i].length; j += 1) {
link_list.push({ link_list.push({
title: group_list[i][j].title, title: group_list[i][j].options.title,
link: result_dict.url_list[k] link: result_dict.url_list[k]
}); });
k += 1; k += 1;
} }
dom_list.push( dom_list.push(
generateSection(result_dict.translation_list[i / 3], group_list[i + 2], link_list) generateSection(result_dict.translation_list[i / 2], group_list[i + 1], link_list)
); );
} }
...@@ -164,4 +162,5 @@ ...@@ -164,4 +162,5 @@
return; return;
}); });
}(window, rJS, RSVP, domsugar, calculatePageTitle, ensureArray)); }(window, rJS, RSVP, domsugar, calculatePageTitle, ensureArray,
mergeGlobalActionWithRawActionList));
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>989.17757.52708.29969</string> </value> <value> <string>989.47954.24695.28433</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1610395382.6</float> <float>1612205919.8</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -23,7 +23,11 @@ ...@@ -23,7 +23,11 @@
<!-- renderjs --> <!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script> <script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="domsugar.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<script src="gadget_global.js" type="text/javascript"></script> <script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_global.js" type="text/javascript"></script>
<!-- custom script --> <!-- custom script -->
<script src="gadget_erp5_panel.js" type="text/javascript"></script> <script src="gadget_erp5_panel.js" type="text/javascript"></script>
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>985.48809.10432.44578</string> </value> <value> <string>989.30774.63276.56746</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1596701351.5</float> <float>1611763679.73</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint nomen: true, indent: 2, maxerr: 3, unparam: true */ /*jslint nomen: true, indent: 2, maxerr: 3, unparam: true */
/*global window, document, rJS, RSVP, Node, asBoolean , ensureArray*/ /*global window, document, rJS, RSVP, Node, asBoolean , ensureArray,
(function (window, document, rJS, RSVP, Node, asBoolean, ensureArray) { mergeGlobalActionWithRawActionList*/
(function (window, document, rJS, RSVP, Node, asBoolean, ensureArray,
mergeGlobalActionWithRawActionList) {
"use strict"; "use strict";
function appendDt(fragment, dt_title, dt_icon, function appendDt(fragment, dt_title, dt_icon,
...@@ -22,12 +24,16 @@ ...@@ -22,12 +24,16 @@
dd_element = document.createElement('dd'); dd_element = document.createElement('dd');
dd_element.setAttribute('class', 'document-listview'); dd_element.setAttribute('class', 'document-listview');
a_element = document.createElement('a'); a_element = document.createElement('a');
if (action_list[i].class_name) { if (action_list[i].options.class_name) {
// Avoid add class='undefined' in HTML // Avoid add class='undefined' in HTML
a_element.setAttribute('class', action_list[i].class_name); a_element.setAttribute('class', action_list[i].options.class_name);
} }
a_element.href = href_list[index + i]; if (action_list[i].command === "raw") {
a_element.textContent = action_list[i].title; a_element.href = action_list[i].options.href;
} else {
a_element.href = href_list[index + i];
}
a_element.textContent = action_list[i].options.title;
dd_element.appendChild(a_element); dd_element.appendChild(a_element);
fragment.appendChild(dd_element); fragment.appendChild(dd_element);
} }
...@@ -65,14 +71,15 @@ ...@@ -65,14 +71,15 @@
view = options.view, view = options.view,
jump_view = options.jump_view, jump_view = options.jump_view,
visible = options.visible, visible = options.visible,
queue = RSVP.Queue(),
display_workflow_list, display_workflow_list,
context = this, context = this,
workflow_list, workflow_list,
group_mapping,
view_list, view_list,
action_list, action_list,
clone_list, clone_list,
jump_list, jump_list;
i;
if (visible === undefined) { if (visible === undefined) {
visible = context.state.visible; visible = context.state.visible;
...@@ -85,44 +92,36 @@ ...@@ -85,44 +92,36 @@
} }
if ((erp5_document !== undefined) && (jio_key !== undefined)) { if ((erp5_document !== undefined) && (jio_key !== undefined)) {
workflow_list = ensureArray(erp5_document._links.action_workflow); group_mapping = mergeGlobalActionWithRawActionList({"state": {
view_list = ensureArray(erp5_document._links.action_object_view); "jio_key": jio_key,
action_list = ensureArray(erp5_document._links.action_object_jio_action) "view": view,
.concat(ensureArray(erp5_document._links.action_object_jio_button)) "jump_view": jump_view
.concat(ensureArray(erp5_document._links.action_object_jio_fast_input)); }},
clone_list = ensureArray(erp5_document._links.action_object_clone_action); erp5_document._links, [
jump_list = ensureArray(erp5_document._links.action_object_jio_jump); "action_workflow",
"action_object_view", [
if (view === 'view') { "action_object_jio_action",
for (i = 0; i < view_list.length; i += 1) { "action_object_jio_button",
view_list[i].class_name = view_list[i].name === view ? 'active' : ''; "action_object_jio_fast_input"
} ],
} else { "action_object_clone_action",
for (i = 0; i < workflow_list.length; i += 1) { "action_object_jio_jump"
workflow_list[i].class_name = workflow_list[i].href === view ? 'active' : ''; ], {
} "action_object_jio_action": "display_dialog_with_history",
for (i = 0; i < view_list.length; i += 1) { "action_object_clone_action": "display_dialog_with_history"
view_list[i].class_name = view_list[i].href === view ? 'active' : ''; }, {
} "action_object_clone_action": true
for (i = 0; i < action_list.length; i += 1) { });
action_list[i].class_name = action_list[i].href === view ? 'active' : ''; workflow_list = JSON.stringify(group_mapping.action_workflow);
} view_list = JSON.stringify(group_mapping.action_object_view);
for (i = 0; i < clone_list.length; i += 1) { action_list = JSON.stringify(group_mapping.action_object_jio_action);
clone_list[i].class_name = clone_list[i].href === view ? 'active' : ''; clone_list = JSON.stringify(group_mapping.action_object_clone_action);
} jump_list = JSON.stringify(group_mapping.action_object_jio_jump);
for (i = 0; i < jump_list.length; i += 1) {
jump_list[i].class_name = ((jump_list[i].href === jump_view) || (jump_list[i].href === view)) ? 'active' : '';
}
}
// Prevent has much as possible to modify the DOM panel
// stateChange prefer to compare strings
workflow_list = JSON.stringify(workflow_list);
view_list = JSON.stringify(view_list);
action_list = JSON.stringify(action_list);
clone_list = JSON.stringify(clone_list);
jump_list = JSON.stringify(jump_list);
} }
return context.getUrlParameter('editable') return queue
.push(function () {
return context.getUrlParameter('editable');
})
.push(function (editable) { .push(function (editable) {
return context.changeState({ return context.changeState({
visible: visible, visible: visible,
...@@ -140,11 +139,8 @@ ...@@ -140,11 +139,8 @@
}); });
}); });
}) })
.onStateChange(function onStateChange(modification_dict) { .onStateChange(function onStateChange(modification_dict) {
var context = this, var gadget = this,
gadget = this,
workflow_list,
queue = new RSVP.Queue(); queue = new RSVP.Queue();
if (modification_dict.hasOwnProperty("visible")) { if (modification_dict.hasOwnProperty("visible")) {
...@@ -162,7 +158,7 @@ ...@@ -162,7 +158,7 @@
if (modification_dict.hasOwnProperty("global")) { if (modification_dict.hasOwnProperty("global")) {
queue queue
.push(function () { .push(function () {
return context.getDeclaredGadget('erp5_searchfield'); return gadget.getDeclaredGadget('erp5_searchfield');
}) })
.push(function (search_gadget) { .push(function (search_gadget) {
return search_gadget.render({ return search_gadget.render({
...@@ -177,7 +173,7 @@ ...@@ -177,7 +173,7 @@
// Update the global links // Update the global links
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
context.getUrlForList([ gadget.getUrlForList([
{command: 'display'}, {command: 'display'},
{command: 'display', options: {page: "front"}}, {command: 'display', options: {page: "front"}},
{command: 'display', options: {page: "worklist"}}, {command: 'display', options: {page: "worklist"}},
...@@ -186,7 +182,7 @@ ...@@ -186,7 +182,7 @@
{command: 'display', options: {page: "preference"}}, {command: 'display', options: {page: "preference"}},
{command: 'display', options: {page: "logout"}} {command: 'display', options: {page: "logout"}}
]), ]),
context.getTranslationList([ gadget.getTranslationList([
'Editable', 'Editable',
'Home', 'Home',
'Modules', 'Modules',
...@@ -196,7 +192,7 @@ ...@@ -196,7 +192,7 @@
'Preferences', 'Preferences',
'Logout' 'Logout'
]), ]),
context.getDeclaredGadget("erp5_checkbox") gadget.getDeclaredGadget("erp5_checkbox")
]); ]);
}) })
.push(function (result_list) { .push(function (result_list) {
...@@ -214,7 +210,7 @@ ...@@ -214,7 +210,7 @@
'sliders', null, 'sliders', null,
'power-off', 'o' 'power-off', 'o'
], ],
ul_element = context.element.querySelector("ul"); ul_element = gadget.element.querySelector("ul");
for (i = 0; i < result_list[0].length; i += 1) { for (i = 0; i < result_list[0].length; i += 1) {
// <li><a href="URL" class="ui-btn-icon-left ui-icon-ICON" data-i18n="TITLE" accesskey="KEY"></a></li> // <li><a href="URL" class="ui-btn-icon-left ui-icon-ICON" data-i18n="TITLE" accesskey="KEY"></a></li>
...@@ -236,7 +232,7 @@ ...@@ -236,7 +232,7 @@
ul_element.appendChild(ul_fragment); ul_element.appendChild(ul_fragment);
// Update the checkbox field value // Update the checkbox field value
if (context.state.editable) { if (gadget.state.editable) {
editable_value = ['editable']; editable_value = ['editable'];
} }
return result_list[2].render({field_json: { return result_list[2].render({field_json: {
...@@ -265,59 +261,19 @@ ...@@ -265,59 +261,19 @@
} else { } else {
queue queue
.push(function () { .push(function () {
var i = 0, var action_list,
i = 0,
j = 0,
parameter_list = [], parameter_list = [],
view_list = JSON.parse(gadget.state.view_list), id_list = ["view_list", "workflow_list",
action_list = JSON.parse(gadget.state.action_list), "action_list",
clone_list = JSON.parse(gadget.state.clone_list), "clone_list", "jump_list"];
jump_list = JSON.parse(gadget.state.jump_list);
workflow_list = JSON.parse(gadget.state.workflow_list);
for (i = 0; i < view_list.length; i += 1) { for (i = 0; i < id_list.length; i += 1) {
parameter_list.push({ action_list = JSON.parse(gadget.state[id_list[i]]);
command: 'display_with_history', for (j = 0; j < action_list.length; j += 1) {
options: { parameter_list.push(action_list[j]);
jio_key: gadget.state.jio_key, }
view: view_list[i].href
}
});
}
for (i = 0; i < workflow_list.length; i += 1) {
parameter_list.push({
command: 'display_dialog_with_history',
options: {
jio_key: gadget.state.jio_key,
view: workflow_list[i].href
}
});
}
for (i = 0; i < action_list.length; i += 1) {
parameter_list.push({
command: 'display_dialog_with_history',
options: {
jio_key: gadget.state.jio_key,
view: action_list[i].href
}
});
}
for (i = 0; i < clone_list.length; i += 1) {
parameter_list.push({
command: 'display_dialog_with_history',
options: {
jio_key: gadget.state.jio_key,
view: clone_list[i].href,
editable: true
}
});
}
for (i = 0; i < jump_list.length; i += 1) {
parameter_list.push({
command: 'display_dialog_with_history',
options: {
jio_key: gadget.state.jio_key,
view: jump_list[i].href
}
});
} }
return RSVP.all([ return RSVP.all([
gadget.getUrlForList(parameter_list), gadget.getUrlForList(parameter_list),
...@@ -331,7 +287,8 @@ ...@@ -331,7 +287,8 @@
view_list = JSON.parse(gadget.state.view_list), view_list = JSON.parse(gadget.state.view_list),
action_list = JSON.parse(gadget.state.action_list), action_list = JSON.parse(gadget.state.action_list),
clone_list = JSON.parse(gadget.state.clone_list), clone_list = JSON.parse(gadget.state.clone_list),
jump_list = JSON.parse(gadget.state.jump_list); jump_list = JSON.parse(gadget.state.jump_list),
workflow_list = JSON.parse(gadget.state.workflow_list);
appendDt(dl_fragment, result_list[1][0], 'eye', appendDt(dl_fragment, result_list[1][0], 'eye',
view_list, result_list[0], 0); view_list, result_list[0], 0);
...@@ -448,4 +405,5 @@ ...@@ -448,4 +405,5 @@
}, /*useCapture=*/false, /*preventDefault=*/true); }, /*useCapture=*/false, /*preventDefault=*/true);
}(window, document, rJS, RSVP, Node, asBoolean, ensureArray)); }(window, document, rJS, RSVP, Node, asBoolean, ensureArray,
mergeGlobalActionWithRawActionList));
\ No newline at end of file
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>988.65434.35774.5563</string> </value> <value> <string>989.47833.1016.53060</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1609322633.89</float> <float>1612198632.86</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -281,9 +281,7 @@ ...@@ -281,9 +281,7 @@
]); ]);
}) })
.push(function (translated_title_list) { .push(function (translated_title_list) {
var field_href, var action_confirm = form_gadget.element.querySelector('input.dialogconfirm');
form_definition = modification_dict.form_definition,
action_confirm = form_gadget.element.querySelector('input.dialogconfirm');
if (action_confirm !== null) { if (action_confirm !== null) {
if (form_gadget.state.action_title) { if (form_gadget.state.action_title) {
action_confirm.value = form_gadget.state.action_title; action_confirm.value = form_gadget.state.action_title;
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>988.16932.41419.17169</string> </value> <value> <string>989.30774.63276.56746</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1607348224.53</float> <float>1612183252.61</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, RSVP, domsugar, URI, calculatePageTitle, ensureArray */ /*global window, rJS, RSVP, domsugar, URI, calculatePageTitle, ensureArray,
mergeGlobalActionWithRawActionList */
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 3 */
/** Page for displaying Views, Jump and BreadCrumb navigation for a document. /** Page for displaying Views, Jump and BreadCrumb navigation for a document.
*/ */
(function (window, rJS, RSVP, domsugar, URI, calculatePageTitle, ensureArray) { (function (window, rJS, RSVP, domsugar, URI, calculatePageTitle, ensureArray,
mergeGlobalActionWithRawActionList) {
"use strict"; "use strict";
/** Go recursively up the parent-chain and insert breadcrumbs in the last argument. /** Go recursively up the parent-chain and insert breadcrumbs in the last argument.
...@@ -101,31 +103,23 @@ ...@@ -101,31 +103,23 @@
jump_list; jump_list;
return gadget.jio_getAttachment(gadget.state.jio_key, "links") return gadget.jio_getAttachment(gadget.state.jio_key, "links")
.push(function (result) { .push(function (result) {
var i,
url_for_kw_list = [];
erp5_document = result; erp5_document = result;
view_list = ensureArray(erp5_document._links.view); return mergeGlobalActionWithRawActionList(gadget,
jump_list = ensureArray(erp5_document._links.action_object_jio_jump); erp5_document._links, [
"view",
for (i = 0; i < view_list.length; i += 1) { "action_object_jio_jump"
url_for_kw_list.push({command: 'display_with_history', options: { ]);
jio_key: gadget.state.jio_key, })
view: view_list[i].href, .push(function (group_mapping) {
page: undefined // Views in ERP5 must be forms but because of var url_for_kw_list = [];
// OfficeJS we keep it empty for different default view_list = group_mapping.view;
}}); jump_list = group_mapping.action_object_jio_jump;
}
for (i = 0; i < jump_list.length; i += 1) { url_for_kw_list = url_for_kw_list.concat(
url_for_kw_list.push({command: 'display_dialog_with_history', options: { view_list).concat(jump_list);
jio_key: gadget.state.jio_key,
view: jump_list[i].href
}});
}
url_for_kw_list.push({command: 'cancel_dialog_with_history'}); url_for_kw_list.push({command: 'cancel_dialog_with_history'});
return RSVP.hash({ return RSVP.hash({
url_list: gadget.getUrlForList(url_for_kw_list), url_list: gadget.getUrlForList(url_for_kw_list),
_: modifyBreadcrumbList(gadget, _: modifyBreadcrumbList(gadget,
...@@ -135,21 +129,20 @@ ...@@ -135,21 +129,20 @@
page_title: calculatePageTitle(gadget, erp5_document) page_title: calculatePageTitle(gadget, erp5_document)
}); });
}) })
.push(function (result_dict) { .push(function (result_dict) {
var i, var i,
j = 0; j = 0;
for (i = 0; i < view_list.length; i += 1) { for (i = 0; i < view_list.length; i += 1) {
tab_list.push({ tab_list.push({
title: view_list[i].title, title: view_list[i].options.title,
link: result_dict.url_list[j] link: result_dict.url_list[j]
}); });
j += 1; j += 1;
} }
for (i = 0; i < jump_list.length; i += 1) { for (i = 0; i < jump_list.length; i += 1) {
jump_action_list.push({ jump_action_list.push({
title: jump_list[i].title, title: jump_list[i].options.title,
link: result_dict.url_list[j] link: result_dict.url_list[j]
}); });
j += 1; j += 1;
...@@ -171,4 +164,4 @@ ...@@ -171,4 +164,4 @@
return; return;
}); });
}(window, rJS, RSVP, domsugar, URI, calculatePageTitle, ensureArray)); }(window, rJS, RSVP, domsugar, URI, calculatePageTitle, ensureArray, mergeGlobalActionWithRawActionList));
\ No newline at end of file \ No newline at end of file
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>981.62315.62619.21640</string> </value> <value> <string>989.31920.37858.10717</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1582128721.85</float> <float>1611626994.73</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -224,12 +224,12 @@ ...@@ -224,12 +224,12 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>romain</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
<value> <value>
<none/> <persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.45868.14105.29764</string> </value> <value> <string>989.47814.22170.38929</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,8 +256,8 @@ ...@@ -256,8 +256,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1445935505.72</float> <float>1612197547.78</float>
<string>GMT</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
...@@ -331,4 +331,36 @@ ...@@ -331,4 +331,36 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="Message" module="Products.ERP5Type.Message"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>Translation data updated from web site ${web_site_id}.</string> </value>
</item>
<item>
<key> <string>domain</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>mapping</string> </key>
<value>
<dictionary>
<item>
<key> <string>web_site_id</string> </key>
<value> <string>renderjs_runner</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>message</string> </key>
<value> <string>Translation data updated from web site ${web_site_id}.</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -12,4 +12,5 @@ Web Site | create_translation_data ...@@ -12,4 +12,5 @@ Web Site | create_translation_data
Web Style | version_view Web Style | version_view
Web Style | view Web Style | view
Web Style | view_editor Web Style | view_editor
Web Style | web_view Web Style | web_view
\ No newline at end of file portal_actions | jump_to_portal_type
\ No newline at end of file
...@@ -29,12 +29,12 @@ ...@@ -29,12 +29,12 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//ul[@class="document-listview"]/li/a[text()="Edit Portal Type Preference"]</td> <td>//ul[@class="document-listview"]/li/a[text()="Edit Portal Type"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//ul[@class="document-listview"]/li/a[text()="Edit Portal Type Preference"]</td> <td>//ul[@class="document-listview"]/li/a[text()="Edit Portal Type"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -29,17 +29,17 @@ ...@@ -29,17 +29,17 @@
</tr> </tr>
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>Edit Portal Type Accounting Transaction Module</td> <td>Edit Portal Type</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//dd[@class="document-listview"]/a[text()="Edit Portal Type Accounting Transaction Module"]</td> <td>//dd[@class="document-listview"]/a[text()="Edit Portal Type"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//dd[@class="document-listview"]/a[text()="Edit Portal Type Accounting Transaction Module"]</td> <td>//dd[@class="document-listview"]/a[text()="Edit Portal Type"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -54,12 +54,12 @@ ...@@ -54,12 +54,12 @@
</tr> </tr>
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>Edit Portal Type Base Type</td> <td>Edit Portal Type</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//dd[@class="document-listview"]/a[text()="Edit Portal Type Base Type"]</td> <td>//dd[@class="document-listview"]/a[text()="Edit Portal Type"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -74,12 +74,17 @@ ...@@ -74,12 +74,17 @@
</tr> </tr>
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>Edit Portal Type Accounting Transaction Module</td> <td>Edit Portal Type</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//dd[@class="document-listview"]/a[text()="Edit Portal Type Accounting Transaction Module"]</td> <td>//dd[@class="document-listview"]/a[text()="Edit Portal Type"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Accounting"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
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