From 27eb3066f29277233c83f5662ce61c386bc9de09 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 15 Aug 2013 02:42:46 -0700 Subject: [PATCH] Implement SHOW_ROOT_GROUP flag for GroupView. Use said flag for dropdown group selector. --- guacamole/src/main/webapp/scripts/admin-ui.js | 2 +- guacamole/src/main/webapp/scripts/guac-ui.js | 265 ++++++++++-------- 2 files changed, 147 insertions(+), 120 deletions(-) diff --git a/guacamole/src/main/webapp/scripts/admin-ui.js b/guacamole/src/main/webapp/scripts/admin-ui.js index c7aeb8520..af246e606 100644 --- a/guacamole/src/main/webapp/scripts/admin-ui.js +++ b/guacamole/src/main/webapp/scripts/admin-ui.js @@ -1217,7 +1217,7 @@ GuacAdmin.ConnectionGroupSelect = function(group) { var group_outside = GuacUI.createChildElement(container, "div", "overlay"); var group_section = GuacUI.createChildElement(container, "div", "dropdown"); - var view = new GuacUI.GroupView(group); + var view = new GuacUI.GroupView(group, GuacUI.GroupView.SHOW_ROOT_GROUP); group_section.appendChild(view.getElement()); // Hide when clicked outside diff --git a/guacamole/src/main/webapp/scripts/guac-ui.js b/guacamole/src/main/webapp/scripts/guac-ui.js index 4b49a6a99..11a102ae8 100644 --- a/guacamole/src/main/webapp/scripts/guac-ui.js +++ b/guacamole/src/main/webapp/scripts/guac-ui.js @@ -963,6 +963,11 @@ GuacUI.GroupView = function(root_group, flags) { */ var show_connections = flags & GuacUI.GroupView.SHOW_CONNECTIONS; + /** + * Whether the root group should be included in the view. + */ + var show_root = flags & GuacUI.GroupView.SHOW_ROOT_GROUP; + /** * Set of all group checkboxes, indexed by ID. Only applicable when * multiselect is enabled. @@ -1125,137 +1130,154 @@ GuacUI.GroupView = function(root_group, flags) { pager.page_capacity = 20; /** - * Adds the given group to the given display parent object. This object - * must have an addElement() function, which will be used for adding all - * child elements representing child connections and groups. + * Adds the contents of the given group via the given appendChild() + * function, but not the given group itself. * - * @param {GuacamoleService.ConnectionGroup} group The group to add. - * @param {Function} appendChild A function which, given an element, will add that - * element the the display as desired. + * @param {GuacamoleService.ConnectionGroup} group The group whose contents + * should be added. + * @param {Function} appendChild A function which, given an element, will + * add that element the the display as + * desired. */ - function addGroup(group, appendChild) { + function addGroupContents(group, appendChild) { var i; - group_view.groups[group.id] = group; // Add all contained connections if (show_connections) { - for (i=0; i