=== modified file 'src/com/goldencode/p2j/main/WebClientSpawner.java' --- src/com/goldencode/p2j/main/WebClientSpawner.java 2016-03-01 05:48:20 +0000 +++ src/com/goldencode/p2j/main/WebClientSpawner.java 2016-03-01 19:32:12 +0000 @@ -20,6 +20,8 @@ ** 007 GES 20160201 Moved auth token processing here to be better encapsulated/hidden. Modified ** the constructor to handle trusted mode (and to pass the referrer directly ** instead of requiring a setter to be called later). +** SBI 20160301 Fixed the web server to redirect the authorized users to the dedicated web +** application handler. */ package com.goldencode.p2j.main; === modified file 'src/com/goldencode/p2j/ui/client/chui/driver/web/ChuiWebDriver.java' --- src/com/goldencode/p2j/ui/client/chui/driver/web/ChuiWebDriver.java 2016-03-01 05:48:20 +0000 +++ src/com/goldencode/p2j/ui/client/chui/driver/web/ChuiWebDriver.java 2016-03-01 19:33:15 +0000 @@ -25,6 +25,8 @@ ** 010 GES 20150312 Moved most of the embedded web server code to a common/shared class. ** 011 CA 20150820 Added waitInitialization, which waits for a notification from the web page ** that it has finished initialized. +** 012 SBI 20160301 Fixed an inconsistent state of the web page handlers to process requests by +** the dedicated web application handler. */ package com.goldencode.p2j.ui.client.chui.driver.web; === modified file 'src/com/goldencode/p2j/ui/client/driver/web/WebClientProtocol.java' --- src/com/goldencode/p2j/ui/client/driver/web/WebClientProtocol.java 2016-03-01 05:48:20 +0000 +++ src/com/goldencode/p2j/ui/client/driver/web/WebClientProtocol.java 2016-03-01 20:13:55 +0000 @@ -19,7 +19,7 @@ ** message result. ** 005 CA 20160203 Fixed deadlock for receivedMessages - it must lock on the "lock" field, as ** this object is used for all sock operations (including key reading). -** SBI 20160225 Added MSG_PARTIAL and MSG_PING_PONG. +** SBI 20160225 Added MSG_PARTIAL and MSG_PING_PONG, to handle MSG_QUIT. */ package com.goldencode.p2j.ui.client.driver.web; === modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js' --- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js 2016-02-17 21:39:23 +0000 +++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js 2016-03-01 18:54:03 +0000 @@ -22,7 +22,9 @@ ** the web which had a typo because I can find no evidence it is a real ** thing). Added cut event support. Added base implementation to respond to ** GUI processing, there are still open issues. -** 005 SBI 20151014 Implemented to set the current editors selection. +** 005 SBI 20151014 Implemented to set the current editors selection. The CHUI editor code requires +** EOL's simulating. +** 006 SBI 20160301 The CHUI editor code requires EOL's simulating. */ "use strict"; @@ -82,9 +84,12 @@ } else { - // replace line ends in order to be handled properly on the thin client + // CHUI: replace line ends in order to be handled properly on the thin client // as if "Enter" was pressed -// p2j.socket.sendStringBinaryMessage(0x03, text.replace(/\n/g,"\r")); + if (!p2j.isGui) + { + text = text.replace(/\n/g,"\r"); + } p2j.socket.sendStringBinaryMessage(0x03, text); } === modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.js' --- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.js 2016-03-01 05:48:20 +0000 +++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.js 2016-03-01 19:19:44 +0000 @@ -23,6 +23,8 @@ ** the "getter" access function. Changed to detect Chrome, IE11 and IE12 (Edge). ** SBI 20151217 Added displayWaitCursor/restoreCursor. ** SBI 20150104 Changed to reuse DOJO style API. +** SBI 20160301 Added new methods to save/restore JSON serialized objects in the session and +** local storages. */ "use strict"; === modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js' --- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js 2016-03-01 05:48:20 +0000 +++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js 2016-03-01 19:49:48 +0000 @@ -1339,10 +1339,7 @@ connected = true; ws.binaryType = 'arraybuffer'; - var exit = p2j.restoreObject("exitTheApplication", false); - var date = (new Date()).getTime(); - // reload use case - if (exit && (date < exit.date + 1000)) + if (isRequiredToRedirect()) { // reload use case doRedirectToLoginPage(); @@ -1350,11 +1347,7 @@ } else { - if (exit) - { - // reopen use case - p2j.deleteObject("exitTheApplication", false); - } + // new session or reopen use case exitTheApplication = false; @@ -1469,6 +1462,38 @@ } /** + * Checks if it is GUI mode and the current page is reloaded or reopened/new. If the GUI page + * is reloaded, then it returns true. + * + * @return True iff the GUI page is reloaded, otherwise false. + */ + function isRequiredToRedirect() + { + if (!p2j.isGui) + { + return false; + } + + var exit = p2j.restoreObject("exitTheApplication", false); + var date = (new Date()).getTime(); + + // reload use case + if (exit && (date < exit.date + 1000)) + { + // reload use case + return true; + } + + if (exit) + { + // reopen use case + p2j.deleteObject("exitTheApplication", false); + } + + return false; + } + + /** * Initialize module. * * @param {object} cfg configuration. @@ -1541,6 +1566,10 @@ */ window.onpagehide = function(evt) { + if (!p2j.isGui) + { + return; + } if (!exitTheApplication) { // close or reload cases @@ -1572,9 +1601,10 @@ */ window.onbeforeunload = function(evt) { - if (!exitTheApplication) + if (p2j.isGui && !exitTheApplication) { - var confirmationMessage = "Do you confirm to logout the P2J application?"; + var confirmationMessage = "ANY PENDING CHANGES WILL BE LOST!\n" + + "Please confirm that it is OK to exit the application."; // Gecko + IE (evt || window.event).returnValue = confirmationMessage; === modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java' --- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java 2016-03-01 05:48:20 +0000 +++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java 2016-03-01 19:32:56 +0000 @@ -43,6 +43,8 @@ ** method. Logic is now in WindowManager. ** 014 SBI 20151208 Added new parameters, scroll amount and scroll unit for wheel events and ** a mouse modifiers mask for all mouse events. +** 015 SBI 20160301 Fixed an inconsistent state of the web page handlers to process requests by +** the dedicated web application handler. */ package com.goldencode.p2j.ui.client.gui.driver.web;