From 8f328d68f98eed349b80fdc7f78b0afc55309779 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 14 Aug 2013 14:16:54 -0700 Subject: [PATCH] Store parent group in Connection and ConnectionGroup. --- guacamole/src/main/webapp/scripts/service.js | 38 ++++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/guacamole/src/main/webapp/scripts/service.js b/guacamole/src/main/webapp/scripts/service.js index f4d8fcd79..8f2f00e9b 100644 --- a/guacamole/src/main/webapp/scripts/service.js +++ b/guacamole/src/main/webapp/scripts/service.js @@ -51,6 +51,14 @@ GuacamoleService.ConnectionGroup = function(type, id, name) { */ this.name = name; + /** + * The parent connection group of this group. If this group is the root + * group, this will be null. + * + * @type GuacamoleService.ConnectionGroup + */ + this.parent = null; + /** * All connection groups contained within this group. * @type GuacamoleService.ConnectionGroup[] @@ -105,6 +113,12 @@ GuacamoleService.Connection = function(protocol, id, name) { */ var guac_connection = this; + /** + * The parent connection group of this connection. + * @type GuacamoleService.ConnectionGroup + */ + this.parent = null; + /** * The protocol associated with this connection. */ @@ -357,11 +371,13 @@ GuacamoleService.Connections = { * Parse the contents of the given connection element within XML, * returning a corresponding GuacamoleService.Connection. * - * @param {Element} element + * @param {GuacamoleService.ConnectionGroup} The connection group + * containing this connection. + * @param {Element} element The element being parsed. * @return {GuacamoleService.Connection} The connection represented by * the element just parsed. */ - function parseConnection(element) { + function parseConnection(parent, element) { var i; @@ -371,6 +387,9 @@ GuacamoleService.Connections = { element.getAttribute("name") ); + // Set parent + connection.parent = parent; + // Add parameter values for each parmeter received var paramElements = element.getElementsByTagName("param"); for (i=0; i