From cde56a6a3442470ff6f7acf3661132603a52ae8a Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 13 Aug 2013 17:19:08 -0700 Subject: [PATCH] Add ability to enable/disable groups and connections (controls whether they are selectable). --- guacamole/src/main/webapp/scripts/guac-ui.js | 50 ++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/guacamole/src/main/webapp/scripts/guac-ui.js b/guacamole/src/main/webapp/scripts/guac-ui.js index 081e0ee41..3fe23963c 100644 --- a/guacamole/src/main/webapp/scripts/guac-ui.js +++ b/guacamole/src/main/webapp/scripts/guac-ui.js @@ -990,6 +990,56 @@ GuacUI.GroupView = function(root_group, multiselect) { return element; }; + /** + * Sets whether the group with the given ID can be selected. This function + * only has an effect when multiselect is enabled. + * + * @param {String} id The ID of the group to alter. + * @param {Boolean} value Whether the group should be selected. + */ + this.setGroupEnabled = function(id, value) { + + var checkbox = group_checkboxes[id]; + + // If enabled, show checkbox, allow select + if (value) { + checkbox.style.visibility = ""; + checkbox.disabled = false; + } + + // Otherwise, hide checkbox + else { + checkbox.style.visibility = "hidden"; + checkbox.disabled = true; + } + + }; + + /** + * Sets whether the connection with the given ID can be selected. This + * function only has an effect when multiselect is enabled. + * + * @param {String} id The ID of the connection to alter. + * @param {Boolean} value Whether the connection can be selected. + */ + this.setConnectionEnabled = function(id, value) { + + var checkbox = connection_checkboxes[id]; + + // If enabled, show checkbox, allow select + if (value) { + checkbox.style.visibility = ""; + checkbox.disabled = false; + } + + // Otherwise, hide checkbox + else { + checkbox.style.visibility = "hidden"; + checkbox.disabled = true; + } + + }; + /** * Sets the current value of the group with the given ID. This function * only has an effect when multiselect is enabled.