source: OpenRLabs-Git/web2py/applications/rlabs/static/scripts/connections.js

main
Last change on this file was 42bd667, checked in by David Fuertes <dfuertes@…>, 4 years ago

Historial Limpio

  • Property mode set to 100644
File size: 1.6 KB
Line 
1
2/*
3 *  Guacamole - Clientless Remote Desktop
4 *  Copyright (C) 2010  Michael Jumper
5 *
6 *  This program is free software: you can redistribute it and/or modify
7 *  it under the terms of the GNU Affero General Public License as published by
8 *  the Free Software Foundation, either version 3 of the License, or
9 *  (at your option) any later version.
10 *
11 *  This program is distributed in the hope that it will be useful,
12 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 *  GNU Affero General Public License for more details.
15 *
16 *  You should have received a copy of the GNU Affero General Public License
17 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20function Config(protocol, id) {
21    this.protocol = protocol;
22    this.id = id;
23}
24
25function getConfigList(parameters) {
26
27    // Construct request URL
28    var configs_url = "configs";
29    if (parameters) configs_url += "?" + parameters;
30
31    // Get config list
32    var xhr = new XMLHttpRequest();
33    xhr.open("GET", configs_url, false);
34    xhr.send(null);
35
36    // If fail, throw error
37    if (xhr.status != 200)
38        throw new Error(xhr.statusText);
39
40    // Otherwise, get list
41    var configs = new Array();
42
43    var configElements = xhr.responseXML.getElementsByTagName("config");
44    for (var i=0; i<configElements.length; i++) {
45        configs.push(new Config(
46            configElements[i].getAttribute("protocol"),
47            configElements[i].getAttribute("id")
48        ));
49    }
50
51    return configs;
52   
53}
Note: See TracBrowser for help on using the repository browser.