Commit f8b47669 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Use same code than form_view

parent ebe4a9b1
/*global window, rJS, RSVP, calculatePageTitle, SimpleQuery, ComplexQuery,
Query, QueryFactory, ensureArray */
Query, QueryFactory, ensureArray, triggerListboxClipboardAction */
/*jslint nomen: true, indent: 2, maxerr: 3, continue: true */
(function (window, rJS, RSVP, calculatePageTitle, SimpleQuery, ComplexQuery,
Query, QueryFactory, ensureArray) {
Query, QueryFactory, ensureArray, triggerListboxClipboardAction) {
"use strict";
function updateSearchQueryFromSelection(extended_search, checked_uid_list,
......@@ -62,95 +62,6 @@
return Query.objectToSearchText(search_query);
}
function triggerListboxClipboardAction(argument_list) {
var action_list = ensureArray(this.state.erp5_document._links.action_object_list_action || []),
action_name = argument_list[0],
checked_uid_list = argument_list[1],
unchecked_uid_list = argument_list[2],
gadget = this,
extended_search = gadget.state.extended_search,
view,
i;
if (action_name === 'copy_document_list') {
if (checked_uid_list.length === 0) {
// If nothing is checked, use all unchecked values (same as xhtml style)
checked_uid_list = unchecked_uid_list;
}
if (checked_uid_list.length === 0) {
// XXX Queries do not correctly handle empty uid list
return gadget.redirect({
command: 'reload'
});
}
return gadget.setSetting('clipboard', checked_uid_list)
.push(function () {
return gadget.notifySubmitted({
"message": "Copied.",
"status": "success"
});
});
}
for (i = 0; i < action_list.length; i += 1) {
if (action_name === action_list[i].name) {
view = action_list[i].href;
}
}
if (checked_uid_list.length !== 0) {
// If nothing is checked, use original query
extended_search = updateSearchQueryFromSelection(
extended_search,
checked_uid_list,
'catalog.uid',
true
);
}
if (view === undefined) {
// Action was not found.
// Reload
return gadget.redirect({
command: 'reload'
});
}
if (action_name === 'paste_document_list') {
return gadget.getSetting('clipboard')
.push(function (uid_list) {
uid_list = uid_list || [];
if (uid_list.length === 0) {
// Nothing to paste, go away
uid_list = ['XXX'];
}
extended_search = updateSearchQueryFromSelection(
'',
uid_list,
'catalog.uid',
true
);
return gadget.redirect({
command: 'display_dialog_with_history',
options: {
"jio_key": gadget.state.jio_key,
"view": view,
"extended_search": extended_search
}
}, true);
});
}
return gadget.redirect({
command: 'display_dialog_with_history',
options: {
"jio_key": gadget.state.jio_key,
"view": view,
"extended_search": extended_search
}
}, true);
}
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
......@@ -457,4 +368,4 @@
.allowPublicAcquisition("triggerListboxClipboardAction", triggerListboxClipboardAction);
}(window, rJS, RSVP, calculatePageTitle, SimpleQuery, ComplexQuery, Query,
QueryFactory, ensureArray));
\ No newline at end of file
QueryFactory, ensureArray, triggerListboxClipboardAction));
\ No newline at end of file
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.42905.62205.2184</string> </value>
<value> <string>974.48318.49230.61986</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1553854591.89</float>
<float>1554109391.26</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