Remove old menu and UI, link clipboards between connections.

This commit is contained in:
Michael Jumper
2012-11-04 15:58:59 -08:00
parent 68b53e0c08
commit bf7a973477
10 changed files with 54 additions and 469 deletions

View File

@@ -81,6 +81,14 @@
<div id="other-connections">
</div>
<h2>Clipboard</h2>
<div id="clipboardDiv">
<p>
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.
</p>
<textarea rows="10" cols="40" id="clipboard"></textarea>
</div>
</div>
<div id="version-dialog">
@@ -92,6 +100,29 @@
<!-- Init -->
<script type="text/javascript"> /* <![CDATA[ */
var clients = [];
var clipboard = document.getElementById("clipboard");
clipboard.onchange = function() {
propagateClipboard(clipboard.value);
};
function setClipboard(text) {
clipboard.value = text;
propagateClipboard(text);
}
// Propogate clipboard data across all open clients
function propagateClipboard(text) {
for (var i=0; i<clients.length; i++) {
var guac = clients[i].GuacamoleUI.client;
if (guac)
guac.setClipboard(text);
}
}
// Constructs the URL for a client which connects to the connection
// with the given id.
function getClientURL(id) {
@@ -125,12 +156,6 @@
}
// If only one connection, redirect to that.
if (configs.length == 1) {
window.location.href = getClientURL(configs[0].id);
return;
}
// Remove all rows from connections list
var recent_connections = document.getElementById("recent-connections");
var other_connections = document.getElementById("other-connections");
@@ -171,9 +196,9 @@
var thumbnail = document.createElement("div");
thumbnail.className = "thumbnail";
function redirect(url) {
function new_client(url) {
return function() {
window.location = url;
clients.push(window.open(url));
};
}
@@ -181,7 +206,7 @@
var clientLink = document.createElement("a");
var url = getClientURL(configs[i].id)
clientLink.setAttribute("href", url);
connection.onclick = redirect(url);
connection.onclick = new_client(url);
protocol.appendChild(protocolIcon);