Allow logout button to work where no Java app used
[guacamole.git] / src / main / webapp / client.xhtml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html>
3
4 <!--
5     Guacamole - Clientless Remote Desktop
6     Copyright (C) 2010  Michael Jumper
7
8     This program is free software: you can redistribute it and/or modify
9     it under the terms of the GNU Affero General Public License as published by
10     the Free Software Foundation, either version 3 of the License, or
11     (at your option) any later version.
12
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU Affero General Public License for more details.
17
18     You should have received a copy of the GNU Affero General Public License
19     along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 -->
21
22 <html xmlns="http://www.w3.org/1999/xhtml">
23
24     <head>
25         <link rel="icon" type="image/png" href="images/guacamole-logo-64.png"/>
26         <link rel="stylesheet" type="text/css" href="styles/client.css"/>
27         <link rel="stylesheet" type="text/css" href="styles/keyboard.css"/>
28         <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi"/>
29         <meta name="apple-mobile-web-app-capable" content="yes"/>
30         <title>Guacamole ${project.version}</title>
31     </head>
32
33     <body>
34
35         <!-- Menu -->
36         <div id="menu">
37
38             <!-- Clipboard -->
39             <button id="showClipboard">Show Clipboard</button>
40             <div id="clipboardDiv">
41                 <h2>Clipboard</h2>
42                 <p>
43                 Text copied/cut within Guacamole will appear here. Changes to the text will affect the remote clipboard, and will be pastable within the remote desktop. Use the textbox below as an interface between the client and server clipboards.
44                 </p>
45                 <textarea rows="10" cols="40" id="clipboard"></textarea>
46             </div>
47
48             <button id="showKeyboard">Show Keyboard</button>
49             <button id="ctrlAltDelete">Ctrl-Alt-Delete</button>
50             <button id="logout">Logout</button>
51
52             <!-- Logo and status -->
53             <img id="status-logo" class="logo" src="images/guacamole-logo-24.png" alt="Guacamole" title="Guacamole ${project.version}"/>
54
55         </div>
56
57         <!-- Touch-specific menu -->
58         <div id="touchMenu"><img id="touchShowClipboard" src="images/menu-icons/tango/edit-paste.png"/><img id="touchShowKeyboard" src="images/menu-icons/tango/input-keyboard.png"/><img id="touchLogout" src="images/menu-icons/tango/system-log-out.png"/></div>
59
60         <!-- Touch-specific clipboard -->
61         <div id="touchClipboardDiv">
62             <h2>Clipboard</h2>
63             <p>
64             Text copied/cut within Guacamole will appear here. Changes to the text will affect the remote clipboard, and will be pastable within the remote desktop. Use the textbox below as an interface between the client and server clipboards.
65             </p>
66             <textarea rows="10" cols="40" id="touchClipboard"></textarea>
67         </div>
68
69         <!-- Keyboard event target for platforms with native OSKs -->
70         <textarea id="eventTarget"></textarea>
71
72         <!-- Display -->
73         <div id="display">
74             
75             <!-- Menu trigger -->
76             <div id="menuControl"></div>
77
78         </div>
79
80         <!-- On-screen keyboard -->
81         <div id="keyboardContainer"></div>
82
83         <!-- Dimensional clone of viewport -->
84         <div id="viewportClone"/>
85
86         <!-- Dialogs -->
87         <div class="dialogOuter">
88             <div class="dialogMiddle">
89
90                 <!-- Status Dialog -->
91                 <div id="statusDialog" class="dialog">
92                     <p id="statusText"></p>
93                     <div class="buttons"><button id="reconnect">Reconnect</button></div>
94                 </div>
95
96             </div>
97         </div>
98
99         <!-- guacamole-common-js scripts -->
100         <script type="text/javascript" src="guacamole-common-js/keyboard.js"></script>
101         <script type="text/javascript" src="guacamole-common-js/mouse.js"></script>
102         <script type="text/javascript" src="guacamole-common-js/layer.js"></script>
103         <script type="text/javascript" src="guacamole-common-js/tunnel.js"></script>
104         <script type="text/javascript" src="guacamole-common-js/guacamole.js"></script>
105         <script type="text/javascript" src="guacamole-common-js/oskeyboard.js"></script>
106
107         <!-- guacamole-default-webapp scripts -->
108         <script type="text/javascript" src="scripts/interface.js"></script>
109
110         <!-- Init -->
111         <script type="text/javascript"> /* <![CDATA[ */
112
113             // Start connect after control returns from onload (allow browser
114             // to consider the page loaded).
115             window.onload = function() {
116                 window.setTimeout(function() {
117
118                     var tunnel;
119
120                     function getParameter (paramName, defaultValue) {
121                        var regex = new RegExp('[?][^#]*' + paramName + '=([^&#]*)');
122                        if (typeof defaultValue === 'undefined') {
123                            defaultValue = null;
124                        }
125                        return (window.location.href.match(regex) || ['', defaultValue])[1];
126                     }
127
128                     var tunneltype = getParameter("tunnel");
129                     var wsendpoint = getParameter("wsendpoint", "websocket-tunnel");
130                     var httpendpoint = getParameter("httpendpoint", "tunnel");
131                      /* Should Window close on logout */
132                     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 */
133
134                     switch (tunneltype) {
135                       case 'http':
136                         tunnel = new Guacamole.HTTPTunnel(httpendpoint);
137                         break;
138                       case 'ws':
139                         if (window.WebSocket)
140                             tunnel = new Guacamole.WebSocketTunnel(wsendpoint);
141                         break;
142                       case 'chained':
143                         if (window.WebSocket)
144                             tunnel = new Guacamole.ChainedTunnel(
145                                 new Guacamole.WebSocketTunnel(wsendpoint),
146                                 new Guacamole.HTTPTunnel(httpendpoint)
147                             );
148                         break;
149                       default:
150                         // Try to guess what tunnel we are using
151                         // If WebSocket available, try to use it.
152                         if (window.WebSocket)
153                             tunnel = new Guacamole.ChainedTunnel(
154                                 new Guacamole.WebSocketTunnel(wsendpoint),
155                                 new Guacamole.HTTPTunnel(httpendpoint)
156                             );
157                         // If no WebSocket, then use HTTP.
158                         else
159                             tunnel = new Guacamole.HTTPTunnel(httpendpoint);
160                         break;
161                     }
162
163                     // Instantiate client
164                     var guac = new Guacamole.Client(tunnel);
165
166                     // Add client to UI
167                     guac.getDisplay().className = "software-cursor";
168                     GuacamoleUI.display.appendChild(guac.getDisplay());
169
170                     // Tie UI to client
171                     GuacamoleUI.attach(guac);
172
173                     try {
174
175                         // Get entire query string, and pass to connect().
176                         // Normally, only the "id" parameter is required, but
177                         // all parameters should be preserved and passed on for
178                         // the sake of authentication.
179
180                         var connect_string = window.location.search.substring(1);
181                         guac.connect(connect_string);
182
183                     }
184                     catch (e) {
185                         GuacamoleUI.showError(e.message);
186                     }
187
188                 }, 0);
189             };
190
191         /* ]]> */ </script>
192
193     </body>
194
195 </html>