IDEMPIERE-4512 zk9.5 - Timeout page is not working (#386)

- Fix a javascript error when session timeout
- Add support for session timeout alert
This commit is contained in:
hengsin 2020-11-17 18:05:10 +08:00 committed by GitHub
parent 052a9e8474
commit 4125e5a10b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 12 deletions

View File

@ -56,6 +56,6 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
<javascript package="org.idempiere.websocket" merge="false" />
<javascript package="adempiere.local.storage" merge="false" />
<javascript-module name="jawwa.atmosphere" version="202011161530"/>
<javascript-module name="jawwa.atmosphere" version="202011170510"/>
<javascript-module name="adempiere.local.storage" version="202011151100"/>
</language>

View File

@ -41,7 +41,7 @@
this.ajaxOptions.error = function(jqxhr, textStatus, errorThrown) {
if (me.trace)
console.log("error: " + textStatus + " dtid: " + me.desktop.id);
if (textStatus != "timeout" && textStatus != "abort") {
if (textStatus != "timeout" && textStatus != "abort" && errorThrown != "SessionNotFound") {
if (typeof console == "object") {
console.error(textStatus);
console.error(errorThrown);
@ -59,7 +59,7 @@
if (me.trace)
console.log("complete"+ " dtid: " + me.desktop.id);
if (me._req && me._req.statusText == "SessionNotFound" && me._req.status == 400) {
me._timeout();
;
} else {
me._schedule();
}
@ -71,7 +71,7 @@
setTimeout(this.proxy(this._send), this.delay);
} else {
this.stop();
this._serverError();
jawwa.atmosphere.serverNotAvailable();
}
},
_send: function() {
@ -100,19 +100,20 @@
this._req.abort();
this._req = null;
}
},
_timeout: function() {
_serverError();
},
_serverError: function() {
zk.confirmClose = false;
}
});
jawwa.atmosphere.serverNotAvailable = function() {
zk.confirmClose = false;
adempiere.get("zkTimeoutText", function(ok, val) {
if (ok && !!val)
{
zk.errorDismiss();
alert(val);
}
window.location.href="index.zul";
});
}
});
};
jawwa.atmosphere.sessionTimeout = function() {
jawwa.atmosphere.serverNotAvailable();
};
})();

View File

@ -40,6 +40,11 @@
<device-type>ajax</device-type>
<automatic-timeout>true</automatic-timeout>
<timeout-uri>/timeout.zul</timeout-uri>
<!--
Comment out timeout-uri above and un-comment timeout-message below if you prefer timeout
message alert over a timeout page
<timeout-message>script:<![CDATA[jawwa.atmosphere.sessionTimeout();]]></timeout-message>
-->
</session-config>
<!--