mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-10 07:01:21 +00:00
Allow GroupViews to be controlled by flags. Implement MULTISELECT and SHOW_CONNECTIONS flags.
This commit is contained in:
@@ -497,7 +497,8 @@ GuacAdmin.UserEditor = function(name, parameters) {
|
|||||||
var connections_section = GuacUI.createChildElement(sections, "dd");
|
var connections_section = GuacUI.createChildElement(sections, "dd");
|
||||||
|
|
||||||
// Construct group view for all readable connections
|
// Construct group view for all readable connections
|
||||||
var group_view = new GuacUI.GroupView(GuacAdmin.cached_root_group, true);
|
var group_view = new GuacUI.GroupView(GuacAdmin.cached_root_group,
|
||||||
|
GuacUI.GroupView.SHOW_CONNECTIONS | GuacUI.GroupView.MULTISELECT);
|
||||||
connections_section.appendChild(group_view.getElement());
|
connections_section.appendChild(group_view.getElement());
|
||||||
|
|
||||||
// Update connection permissions when changed
|
// Update connection permissions when changed
|
||||||
@@ -1231,7 +1232,7 @@ GuacAdmin.reset = function() {
|
|||||||
|
|
||||||
// Add new group view
|
// Add new group view
|
||||||
GuacAdmin.containers.connection_list.innerHTML = "";
|
GuacAdmin.containers.connection_list.innerHTML = "";
|
||||||
var group_view = new GuacUI.GroupView(GuacAdmin.cached_root_group, false);
|
var group_view = new GuacUI.GroupView(GuacAdmin.cached_root_group, GuacUI.GroupView.SHOW_CONNECTIONS);
|
||||||
GuacAdmin.containers.connection_list.appendChild(group_view.getElement());
|
GuacAdmin.containers.connection_list.appendChild(group_view.getElement());
|
||||||
|
|
||||||
// Show connection editor when connections are clicked
|
// Show connection editor when connections are clicked
|
||||||
|
@@ -912,9 +912,10 @@ GuacUI.ListGroup = function(caption) {
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @param {GuacamoleService.ConnectionGroup} root_group The group to display
|
* @param {GuacamoleService.ConnectionGroup} root_group The group to display
|
||||||
* within the view.
|
* within the view.
|
||||||
* @param {Boolean} multiselect Whether multiple objects are selectable.
|
* @param {Number} flags Any flags (such as MULTISELECT or SHOW_CONNECTIONS)
|
||||||
|
* for modifying the behavior of this group view.
|
||||||
*/
|
*/
|
||||||
GuacUI.GroupView = function(root_group, multiselect) {
|
GuacUI.GroupView = function(root_group, flags) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference to this GroupView.
|
* Reference to this GroupView.
|
||||||
@@ -926,6 +927,16 @@ GuacUI.GroupView = function(root_group, multiselect) {
|
|||||||
var element = GuacUI.createElement("div", "group-view");
|
var element = GuacUI.createElement("div", "group-view");
|
||||||
var list = GuacUI.createChildElement(element, "div", "list");
|
var list = GuacUI.createChildElement(element, "div", "list");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether multiselect is enabled.
|
||||||
|
*/
|
||||||
|
var multiselect = flags & GuacUI.GroupView.MULTISELECT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether connections should be included in the view.
|
||||||
|
*/
|
||||||
|
var show_connections = flags & GuacUI.GroupView.SHOW_CONNECTIONS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set of all group checkboxes, indexed by ID. Only applicable when
|
* Set of all group checkboxes, indexed by ID. Only applicable when
|
||||||
* multiselect is enabled.
|
* multiselect is enabled.
|
||||||
@@ -1102,6 +1113,7 @@ GuacUI.GroupView = function(root_group, multiselect) {
|
|||||||
group_view.groups[group.id] = group;
|
group_view.groups[group.id] = group;
|
||||||
|
|
||||||
// Add all contained connections
|
// Add all contained connections
|
||||||
|
if (show_connections) {
|
||||||
for (i=0; i<group.connections.length; i++) {
|
for (i=0; i<group.connections.length; i++) {
|
||||||
|
|
||||||
// Add connection to set
|
// Add connection to set
|
||||||
@@ -1155,6 +1167,7 @@ GuacUI.GroupView = function(root_group, multiselect) {
|
|||||||
})(connection);
|
})(connection);
|
||||||
|
|
||||||
} // end for each connection
|
} // end for each connection
|
||||||
|
}
|
||||||
|
|
||||||
// Add all contained groups
|
// Add all contained groups
|
||||||
for (i=0; i<group.groups.length; i++) {
|
for (i=0; i<group.groups.length; i++) {
|
||||||
@@ -1229,6 +1242,16 @@ GuacUI.GroupView = function(root_group, multiselect) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When set, allows multiple groups (or connections to be selected).
|
||||||
|
*/
|
||||||
|
GuacUI.GroupView.MULTISELECT = 0x1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When set, also displays connections within the visible groups.
|
||||||
|
*/
|
||||||
|
GuacUI.GroupView.SHOW_CONNECTIONS = 0x2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple modal dialog providing a header, body, and footer. No other
|
* Simple modal dialog providing a header, body, and footer. No other
|
||||||
* functionality is provided other than a reasonable hierarchy of divs and
|
* functionality is provided other than a reasonable hierarchy of divs and
|
||||||
|
@@ -176,7 +176,7 @@ GuacamoleRootUI.reset = function() {
|
|||||||
|
|
||||||
|
|
||||||
// Create group view
|
// Create group view
|
||||||
var group_view = new GuacUI.GroupView(root_group);
|
var group_view = new GuacUI.GroupView(root_group, GuacUI.GroupView.SHOW_CONNECTIONS);
|
||||||
GuacamoleRootUI.sections.all_connections.appendChild(group_view.getElement());
|
GuacamoleRootUI.sections.all_connections.appendChild(group_view.getElement());
|
||||||
|
|
||||||
// Add any connections with thumbnails
|
// Add any connections with thumbnails
|
||||||
|
Reference in New Issue
Block a user