Commit fcdc01fc authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: add display_erp5_dialog_with_history router command

parent 34611e5b
......@@ -28,6 +28,8 @@
COMMAND_KEEP_HISTORY_AND_CANCEL_DIALOG_STATE = "cancel_dialog_with_history",
// Display an action on the jio document + the history
COMMAND_KEEP_HISTORY_AND_DISPLAY_ERP5_ACTION = "display_erp5_action_with_history",
// Display a dialog on the jio document + the history
COMMAND_KEEP_HISTORY_AND_DISPLAY_ERP5_DIALOG = "display_erp5_dialog_with_history",
// Store the jio key for the person document of the user
COMMAND_LOGIN = "login",
// Display a raw string URL
......@@ -70,6 +72,7 @@
VALID_URL_COMMAND_DICT[COMMAND_KEEP_HISTORY_AND_DISPLAY_DIALOG_STATE] = null;
VALID_URL_COMMAND_DICT[COMMAND_KEEP_HISTORY_AND_CANCEL_DIALOG_STATE] = null;
VALID_URL_COMMAND_DICT[COMMAND_KEEP_HISTORY_AND_DISPLAY_ERP5_ACTION] = null;
VALID_URL_COMMAND_DICT[COMMAND_KEEP_HISTORY_AND_DISPLAY_ERP5_DIALOG] = null;
VALID_URL_COMMAND_DICT[COMMAND_DISPLAY_STORED_STATE] = null;
VALID_URL_COMMAND_DICT[COMMAND_CHANGE_STATE] = null;
VALID_URL_COMMAND_DICT[COMMAND_DISPLAY_ERP5_ACTION] = null;
......@@ -394,7 +397,7 @@
);
}
function execDisplayERP5ActionCommand(gadget, previous_options, next_options, keep_history) {
function execDisplayERP5ActionCommand(gadget, previous_options, next_options, command) {
return gadget.jio_getAttachment(next_options.jio_key, 'links')
.push(function (document_view) {
var action, action_data, i, j, new_options;
......@@ -412,10 +415,16 @@
view: action_data.href
};
copyStickyParameterDict(previous_options, new_options);
if (keep_history) {
if (command === 0) {
return execDisplayCommand(gadget, new_options);
}
if (command === 1) {
return execPushHistoryCommand(gadget, previous_options, new_options);
}
return execDisplayCommand(gadget, new_options);
if (command === 2) {
return execKeepHistoryAndDisplayCommand(gadget, previous_options, new_options, true);
}
throw new Error('execDisplayERP5ActionCommand. Not supported command ' + command);
}
}
}
......@@ -909,7 +918,10 @@
return execKeepHistoryAndCancelDialogCommand(gadget, previous_options);
}
if (command_options.path === COMMAND_KEEP_HISTORY_AND_DISPLAY_ERP5_ACTION) {
return execDisplayERP5ActionCommand(gadget, previous_options, next_options, true);
return execDisplayERP5ActionCommand(gadget, previous_options, next_options, 1);
}
if (command_options.path === COMMAND_KEEP_HISTORY_AND_DISPLAY_ERP5_DIALOG) {
return execDisplayERP5ActionCommand(gadget, previous_options, next_options, 2);
}
if (command_options.path === COMMAND_DISPLAY_STORED_STATE) {
return execDisplayStoredStateCommand(gadget, next_options, drop_options);
......@@ -921,7 +933,7 @@
return execChangeCommand(previous_options, next_options, drop_options);
}
if (command_options.path === COMMAND_DISPLAY_ERP5_ACTION) {
return execDisplayERP5ActionCommand(gadget, previous_options, next_options);
return execDisplayERP5ActionCommand(gadget, previous_options, next_options, 0);
}
if (command_options.path === COMMAND_STORE_AND_CHANGE_STATE) {
return execStoreAndChangeCommand(gadget, previous_options, next_options, drop_options);
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>989.58905.49586.62361</string> </value>
<value> <string>990.5085.9603.7731</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1613145957.49</float>
<float>1613566000.18</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