mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-12-16 07:20:11 +00:00
#268: Add stub user properties form and selectable items.
This commit is contained in:
@@ -190,8 +190,40 @@ GuacAdmin.UserManager = function() {
|
|||||||
var element = GuacUI.createElement("div", "user-list");
|
var element = GuacUI.createElement("div", "user-list");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User property form.
|
* The selected username.
|
||||||
*/
|
*/
|
||||||
|
this.selected = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the DOM element representing this UserManager.
|
||||||
|
*/
|
||||||
|
this.getElement = function() {
|
||||||
|
return element;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the given username to the users visible within this UserManager.
|
||||||
|
*/
|
||||||
|
this.add = function(username) {
|
||||||
|
|
||||||
|
// Create item
|
||||||
|
var item = new GuacAdmin.ListItem("user", username);
|
||||||
|
var item_element = item.getElement();
|
||||||
|
|
||||||
|
// Select on click
|
||||||
|
item_element.onclick = function() {
|
||||||
|
|
||||||
|
// If nothing selected, select this item
|
||||||
|
if (!user_manager.selected) {
|
||||||
|
|
||||||
|
// Change styling to reflect selected item
|
||||||
|
GuacUI.addClass(element, "disabled");
|
||||||
|
GuacUI.addClass(item_element, "selected");
|
||||||
|
|
||||||
|
// Update selected item
|
||||||
|
user_manager.selected = username;
|
||||||
|
|
||||||
|
// User property form.
|
||||||
var user_properties = new GuacAdmin.Form(
|
var user_properties = new GuacAdmin.Form(
|
||||||
|
|
||||||
/* Fields */
|
/* Fields */
|
||||||
@@ -206,22 +238,15 @@ GuacAdmin.UserManager = function() {
|
|||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Display properties
|
||||||
|
item_element.appendChild(user_properties.getElement());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the DOM element representing this UserManager.
|
|
||||||
*/
|
|
||||||
this.getElement = function() {
|
|
||||||
return element;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
// Append item
|
||||||
* Adds the given username to the users visible within this UserManager.
|
element.appendChild(item_element);
|
||||||
*/
|
|
||||||
this.add = function(username) {
|
|
||||||
|
|
||||||
// Create and append item
|
|
||||||
var item = new GuacAdmin.ListItem("user", username);
|
|
||||||
element.appendChild(item.getElement());
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user