mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	Initial stab at fixing the CRUD servlets and service JS.
This commit is contained in:
		| @@ -71,7 +71,7 @@ | ||||
|                 </p> | ||||
|  | ||||
|                 <div id="connection-add-form"> | ||||
|                     <div class="icon connection add"/><input type="text" id="connection-id" class="name" placeholder="Add connection"/><button id="add-connection">Add</button> | ||||
|                     <div class="icon connection add"/><input type="text" id="connection-name" class="name" placeholder="Add connection"/><button id="add-connection">Add</button> | ||||
|                 </div> | ||||
|                  | ||||
|                 <div id="connection-list"> | ||||
|   | ||||
| @@ -37,8 +37,8 @@ var GuacAdmin = { | ||||
|     }, | ||||
|  | ||||
|     "fields" : { | ||||
|         "connection_id" : document.getElementById("connection-id"), | ||||
|         "username"      : document.getElementById("username") | ||||
|         "connection_name" : document.getElementById("connection-name"), | ||||
|         "username"        : document.getElementById("username") | ||||
|     }, | ||||
|  | ||||
|     "cached_permissions" : null, | ||||
| @@ -661,7 +661,7 @@ GuacAdmin.connectionPager = null; | ||||
|  */ | ||||
| GuacAdmin.addConnection = function(connection, parameters) { | ||||
|  | ||||
|     var item = new GuacAdmin.ListItem("connection", connection.id); | ||||
|     var item = new GuacAdmin.ListItem("connection", connection.name); | ||||
|     var item_element = item.getElement(); | ||||
|     GuacAdmin.connectionPager.addElement(item_element); | ||||
|  | ||||
| @@ -676,7 +676,7 @@ GuacAdmin.addConnection = function(connection, parameters) { | ||||
|         // Create form base elements | ||||
|         var form_element = GuacUI.createElement("div", "form"); | ||||
|         var connection_header = GuacUI.createChildElement(form_element, "h2"); | ||||
|         connection_header.textContent = connection.id; | ||||
|         connection_header.textContent = connection.name; | ||||
|  | ||||
|         var sections = GuacUI.createChildElement( | ||||
|             GuacUI.createChildElement(form_element, "div", "settings section"), | ||||
| @@ -885,7 +885,8 @@ GuacAdmin.addConnection = function(connection, parameters) { | ||||
|                 // Build connection | ||||
|                 var updated_connection = new GuacamoleService.Connection( | ||||
|                     protocol_field.value, | ||||
|                     connection.id | ||||
|                     connection.id, | ||||
|                     connection.name | ||||
|                 ); | ||||
|  | ||||
|                 // Populate parameters | ||||
| @@ -930,7 +931,7 @@ GuacAdmin.addConnection = function(connection, parameters) { | ||||
|  | ||||
|                 // Delete connection upon confirmation | ||||
|                 if (confirm("Are you sure you want to delete the connection \"" | ||||
|                             + connection.id + "\"?")) { | ||||
|                             + connection.name + "\"?")) { | ||||
|  | ||||
|                     // Attempt to delete connection | ||||
|                     try { | ||||
| @@ -1004,9 +1005,9 @@ GuacAdmin.reset = function() { | ||||
|             // Try to create connection | ||||
|             try { | ||||
|                 var connection = new GuacamoleService.Connection( | ||||
|                     GuacAdmin.cached_protocols[0].name, GuacAdmin.fields.connection_id.value); | ||||
|                     GuacAdmin.cached_protocols[0].name, null, GuacAdmin.fields.connection_name.value); | ||||
|                 GuacamoleService.Connections.create(connection, parameters); | ||||
|                 GuacAdmin.fields.connection_id.value = ""; | ||||
|                 GuacAdmin.fields.connection_name.value = ""; | ||||
|                 GuacAdmin.reset(); | ||||
|             } | ||||
|  | ||||
|   | ||||
| @@ -28,8 +28,9 @@ var GuacamoleService = GuacamoleService || {}; | ||||
|  * @constructor | ||||
|  * @param {String} protocol The protocol used by this connection. | ||||
|  * @param {String} id The ID associated with this connection. | ||||
|  * @param {String} name The human-readable name associated with this connection. | ||||
|  */ | ||||
| GuacamoleService.Connection = function(protocol, id) { | ||||
| GuacamoleService.Connection = function(protocol, id, name) { | ||||
|  | ||||
|     /** | ||||
|      * Reference to this connection. | ||||
| @@ -58,7 +59,7 @@ GuacamoleService.Connection = function(protocol, id) { | ||||
|      *  | ||||
|      * @type String[] | ||||
|      */ | ||||
|     this.path = id.split("/"); | ||||
|     this.path = name.split("/"); | ||||
|  | ||||
|     /** | ||||
|      * The name of this connection. This name is arbitrary and local to the | ||||
| @@ -251,7 +252,7 @@ GuacamoleService.Connections = { | ||||
|      * Comparator which compares two GuacamoleService.Connection objects. | ||||
|      */ | ||||
|     "comparator" : function(a, b) { | ||||
|         return a.id.localeCompare(b.id); | ||||
|         return a.name.localeCompare(b.name); | ||||
|     }, | ||||
|  | ||||
|      /** | ||||
| @@ -288,7 +289,8 @@ GuacamoleService.Connections = { | ||||
|             var connectionElement = connectionElements[i]; | ||||
|             var connection = new GuacamoleService.Connection( | ||||
|                 connectionElement.getAttribute("protocol"), | ||||
|                 connectionElement.getAttribute("id") | ||||
|                 connectionElement.getAttribute("id"), | ||||
|                 connectionElement.getAttribute("name") | ||||
|             ) | ||||
|  | ||||
|             var j; | ||||
| @@ -352,7 +354,7 @@ GuacamoleService.Connections = { | ||||
|     "create" : function(connection, parameters) { | ||||
|  | ||||
|         // Construct request URL | ||||
|         var users_url = "connections/create?id=" + encodeURIComponent(connection.id); | ||||
|         var users_url = "connections/create?name=" + encodeURIComponent(connection.name); | ||||
|         if (parameters) users_url += "&" + parameters; | ||||
|  | ||||
|         // Init POST data | ||||
| @@ -389,7 +391,9 @@ GuacamoleService.Connections = { | ||||
|         if (parameters) users_url += "&" + parameters; | ||||
|  | ||||
|         // Init POST data | ||||
|         var data = "protocol=" + encodeURIComponent(connection.protocol); | ||||
|         var data = | ||||
|                   "name="      + encodeURIComponent(connection.name) | ||||
|                 + "&protocol=" + encodeURIComponent(connection.protocol); | ||||
|  | ||||
|         // Add parameters | ||||
|         for (var name in connection.parameters) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user