Java-side refactor to support new concept of Connections. Still need JavaScript refactor.

This commit is contained in:
Michael Jumper
2013-01-31 14:30:29 -08:00
parent df6426e04a
commit c05286c486
6 changed files with 52 additions and 115 deletions

View File

@@ -55,15 +55,15 @@
<url-pattern>/logout</url-pattern>
</servlet-mapping>
<!-- Configuration List Servlet -->
<!-- Connection List Servlet -->
<servlet>
<description>Configuration list servlet.</description>
<servlet-name>Configs</servlet-name>
<servlet-class>net.sourceforge.guacamole.net.basic.ConfigurationList</servlet-class>
<description>Connection list servlet.</description>
<servlet-name>Connections</servlet-name>
<servlet-class>net.sourceforge.guacamole.net.basic.ConnectionList</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Configs</servlet-name>
<url-pattern>/configs</url-pattern>
<servlet-name>Connections</servlet-name>
<url-pattern>/connections</url-pattern>
</servlet-mapping>
<!-- User List Servlet -->

View File

@@ -136,7 +136,6 @@
Guacamole ${project.version}
</div>
<script type="text/javascript" src="scripts/connections.js"></script>
<script type="text/javascript" src="scripts/session.js"></script>
<script type="text/javascript" src="scripts/history.js"></script>
<script type="text/javascript" src="scripts/root-ui.js"></script>

View File

@@ -1,53 +0,0 @@
/*
* Guacamole - Clientless Remote Desktop
* Copyright (C) 2010 Michael Jumper
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function Config(protocol, id) {
this.protocol = protocol;
this.id = id;
}
function getConfigList(parameters) {
// Construct request URL
var configs_url = "configs";
if (parameters) configs_url += "?" + parameters;
// Get config list
var xhr = new XMLHttpRequest();
xhr.open("GET", configs_url, false);
xhr.send(null);
// If fail, throw error
if (xhr.status != 200)
throw new Error(xhr.statusText);
// Otherwise, get list
var configs = new Array();
var configElements = xhr.responseXML.getElementsByTagName("config");
for (var i=0; i<configElements.length; i++) {
configs.push(new Config(
configElements[i].getAttribute("protocol"),
configElements[i].getAttribute("id")
));
}
return configs;
}