clockwerk-guacamole – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 eva 1  
2  
3 function Config(protocol, id) {
4 this.protocol = protocol;
5 this.id = id;
6 }
7  
8 function getConfigList(parameters) {
9  
10 // Construct request URL
11 var configs_url = "configs";
12 if (parameters) configs_url += "?" + parameters;
13  
14 // Get config list
15 var xhr = new XMLHttpRequest();
16 xhr.open("GET", configs_url, false);
17 xhr.send(null);
18  
19 // If fail, throw error
20 if (xhr.status != 200)
21 throw new Error(xhr.statusText);
22  
23 // Otherwise, get list
24 var configs = new Array();
25  
26 var configElements = xhr.responseXML.getElementsByTagName("config");
27 for (var i=0; i<configElements.length; i++) {
28 configs.push(new Config(
29 configElements[i].getAttribute("protocol"),
30 configElements[i].getAttribute("id")
31 ));
32 }
33  
34 return configs;
35  
36 }