From bcf888301632b24788b1d4197df9aa6ef4358f33 Mon Sep 17 00:00:00 2001 From: Tobias Oetiker Date: Thu, 29 Aug 2024 17:32:04 +0200 Subject: [PATCH 1/2] add code 7 to force browser reload --- CHANGES | 3 ++ lib/CallBackery.pm | 2 +- .../source/class/callbackery/data/Server.js | 30 +++++++++++++------ 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index 149f248..310a485 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +0.50.0 2024-08-29 17:12:41 +0200 Tobias Oetiker + + - reload the browser window when an exception with status 7 is returned - warn if trm() is called with undefined arguments 0.49.6 2024-07-17 17:25:39 +0200 Tobias Oetiker diff --git a/lib/CallBackery.pm b/lib/CallBackery.pm index 652e7d3..b13609c 100644 --- a/lib/CallBackery.pm +++ b/lib/CallBackery.pm @@ -38,7 +38,7 @@ use CallBackery::Database; use CallBackery::User; use Scalar::Util qw(weaken); -our $VERSION = '0.49.6'; +our $VERSION = '0.50.0'; =head2 config diff --git a/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/data/Server.js b/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/data/Server.js index 3501135..327e938 100644 --- a/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/data/Server.js +++ b/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/data/Server.js @@ -49,16 +49,28 @@ qx.Class.define("callbackery.data.Server", { var localeMgr = qx.locale.Manager.getInstance(); var newArgs = Array.prototype.slice.call(arguments); newArgs[0] = function(ret, exc, id) { - if (exc && exc.code == 6) { - var login = callbackery.ui.Login.getInstance(); - login.addListenerOnce('login', function(e) { - var ret = e.getData(); - origThis.setSessionCookie(ret.sessionCookie); - origArguments.callee.base.apply(origThis, origArguments); - }); + if (exc) { + switch (exc.code) { + case 6: + let login = callbackery.ui.Login.getInstance(); + login.addListenerOnce('login', (e) => { + let ret = e.getData(); + origThis.setSessionCookie(ret.sessionCookie); + origArguments.callee.base.apply(origThis, origArguments); + }); - login.open(); - return; + login.open(); + return; + case 7: + const msg = callbackery.ui.MsgBox.getInstance(); + msg.addListenerOnce('ok', (e) => { window.location.reload(true); }); + msg.info( + this.tr('Session Expired'), + this.xtr(exc.message), + false + ); + return; + } } try { handler(ret, exc, id); From 0f9af1cee6d3fdacb823b69c5e01cc8514e952a8 Mon Sep 17 00:00:00 2001 From: Tobias Oetiker Date: Fri, 30 Aug 2024 12:28:49 +0200 Subject: [PATCH 2/2] show popup before reloading --- CHANGES | 4 ++++ lib/CallBackery.pm | 2 +- .../source/class/callbackery/data/Server.js | 20 ++++++++++++------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 310a485..ddccd0c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +0.50.1 2024-08-30 12:27:22 +0200 Tobias Oetiker + + - show a popup before reloading the page + 0.50.0 2024-08-29 17:12:41 +0200 Tobias Oetiker - reload the browser window when an exception with status 7 is returned diff --git a/lib/CallBackery.pm b/lib/CallBackery.pm index b13609c..e20c710 100644 --- a/lib/CallBackery.pm +++ b/lib/CallBackery.pm @@ -38,7 +38,7 @@ use CallBackery::Database; use CallBackery::User; use Scalar::Util qw(weaken); -our $VERSION = '0.50.0'; +our $VERSION = '0.50.1'; =head2 config diff --git a/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/data/Server.js b/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/data/Server.js index 327e938..a3b1176 100644 --- a/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/data/Server.js +++ b/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/data/Server.js @@ -58,16 +58,22 @@ qx.Class.define("callbackery.data.Server", { origThis.setSessionCookie(ret.sessionCookie); origArguments.callee.base.apply(origThis, origArguments); }); - login.open(); return; case 7: - const msg = callbackery.ui.MsgBox.getInstance(); - msg.addListenerOnce('ok', (e) => { window.location.reload(true); }); - msg.info( - this.tr('Session Expired'), - this.xtr(exc.message), - false + if (window.console){ + window.console.log("Session Expired. Reloading page"); + } + callbackery.ui.Busy.getInstance().vanish(); + let mb = callbackery.ui.MsgBox.getInstance() + mb.addListenerOnce('choice',(e) => { + if (e.getData() == 'ok'){ + window.location.reload(true); + } + }); + mb.info( + mb.tr('Session Expired'), + mb.xtr(exc.message) ); return; }