[gen] Allow an ajax request to return a message, carried as a custom HTTP header and retrieved by appy.js to display a message.
This commit is contained in:
parent
8d03f6ca9c
commit
4a393e76af
5 changed files with 33 additions and 15 deletions
gen/ui
|
@ -148,6 +148,9 @@ function getAjaxChunk(pos) {
|
|||
for (var i=0; i<innerScripts.length; i++) {
|
||||
eval(innerScripts[i].innerHTML);
|
||||
}
|
||||
// Display the Appy message if present
|
||||
var msg = xhrObjects[pos].xhr.getResponseHeader('Appy-Message');
|
||||
if (msg) showAppyMessage(decodeURIComponent(escape(msg)));
|
||||
}
|
||||
if (responseOk) xhrObjects[pos].freed = 1;
|
||||
}
|
||||
|
@ -814,6 +817,15 @@ function backFromPopup() {
|
|||
window.parent.location = window.parent.location;
|
||||
}
|
||||
|
||||
function showAppyMessage(message) {
|
||||
// Fill the message zone with the message to display
|
||||
var messageZone = document.getElementById('appyMessageContent');
|
||||
messageZone.innerHTML = message;
|
||||
// Display the message zone
|
||||
var messageDiv = document.getElementById('appyMessage');
|
||||
messageDiv.style.display = 'block';
|
||||
}
|
||||
|
||||
// Function triggered when an action needs to be confirmed by the user
|
||||
function askConfirm(actionType, action, msg, showComment) {
|
||||
/* Store the actionType (send a form, call an URL or call a script) and the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue