Allow logout button to work where no Java app used master
authorAlex Bligh <alex@alex.org.uk>
Wed, 28 Nov 2012 19:32:26 +0000 (19:32 +0000)
committerAlex Bligh <alex@alex.org.uk>
Wed, 28 Nov 2012 19:34:09 +0000 (19:34 +0000)
Add global variable of SELF_CLOSE which can be used to close the window during a logout instead or redirecting the window to another page.

Add the param selfclose=1 to the url to make it work

src/main/webapp/client.xhtml
src/main/webapp/scripts/interface.js

index afec1b4..66d6184 100644 (file)
                     var tunneltype = getParameter("tunnel");
                     var wsendpoint = getParameter("wsendpoint", "websocket-tunnel");
                     var httpendpoint = getParameter("httpendpoint", "tunnel");
+                     /* Should Window close on logout */
+                    window.SELF_CLOSE = getParameter("selfclose", 0); /* if 1 then the window will close on logout if 0 then the logout will redirect, defaults to 0 */
 
                     switch (tunneltype) {
                       case 'http':
index 45f6590..824219e 100644 (file)
@@ -315,8 +315,12 @@ var GuacamoleUI = {
 
             // Logout after warning user about session disconnect
             if (confirm(GuacamoleUI.LOGOUT_PROMPT)) {
-                window.location.href = "logout";
-                GuacamoleUI.hideTouchMenu();
+                if(1 == window.SELF_CLOSE){
+                    window.close();
+                }else{
+                    window.location.href = "logout";
+                    GuacamoleUI.hideTouchMenu();
+                }
             }
             
         };