mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Add ability to set current selected value of groups and connections.
This commit is contained in:
@@ -926,6 +926,20 @@ GuacUI.GroupView = function(root_group, multiselect) {
|
||||
var element = GuacUI.createElement("div", "group-view");
|
||||
var list = GuacUI.createChildElement(element, "div", "list");
|
||||
|
||||
/**
|
||||
* Set of all group checkboxes, indexed by ID. Only applicable when
|
||||
* multiselect is enabled.
|
||||
* @private
|
||||
*/
|
||||
var group_checkboxes = {};
|
||||
|
||||
/**
|
||||
* Set of all connection checkboxes, indexed by ID. Only applicable when
|
||||
* multiselect is enabled.
|
||||
* @private
|
||||
*/
|
||||
var connection_checkboxes = {};
|
||||
|
||||
/**
|
||||
* Set of all connections, indexed by ID.
|
||||
*/
|
||||
@@ -976,6 +990,28 @@ GuacUI.GroupView = function(root_group, multiselect) {
|
||||
return element;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the current value of the group with the given ID. This function
|
||||
* only has an effect when multiselect is enabled.
|
||||
*
|
||||
* @param {String} id The ID of the group to change.
|
||||
* @param {Boolean} value Whether the group should be selected.
|
||||
*/
|
||||
this.setGroupValue = function(id, value) {
|
||||
group_checkboxes[id].checked = value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the current value of the connection with the given ID. This function
|
||||
* only has an effect when multiselect is enabled.
|
||||
*
|
||||
* @param {String} id The ID of the connection to change.
|
||||
* @param {Boolean} value Whether the connection should be selected.
|
||||
*/
|
||||
this.setConnectionValue = function(id, value) {
|
||||
connection_checkboxes[id].checked = value;
|
||||
};
|
||||
|
||||
// Create pager for contents
|
||||
var pager = new GuacUI.Pager(list);
|
||||
pager.page_capacity = 20;
|
||||
@@ -1031,6 +1067,9 @@ GuacUI.GroupView = function(root_group, multiselect) {
|
||||
connection_checkbox.addEventListener("click", fire_connection_change, false);
|
||||
connection_checkbox.addEventListener("change", fire_connection_change, false);
|
||||
|
||||
// Add checbox to set of connection checkboxes
|
||||
connection_checkboxes[connection.id] = connection_checkbox;
|
||||
|
||||
}
|
||||
else
|
||||
appendChild(guacui_connection.getElement());
|
||||
@@ -1085,6 +1124,9 @@ GuacUI.GroupView = function(root_group, multiselect) {
|
||||
group_checkbox.addEventListener("click", fire_group_change, false);
|
||||
group_checkbox.addEventListener("change", fire_group_change, false);
|
||||
|
||||
// Add checbox to set of group checkboxes
|
||||
group_checkboxes[child_group.id] = group_checkbox;
|
||||
|
||||
}
|
||||
else
|
||||
appendChild(list_group.getElement());
|
||||
|
Reference in New Issue
Block a user