mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
Ticket #268: Implement enum field type.
This commit is contained in:
@@ -169,7 +169,41 @@ GuacAdmin.Field.CHECKBOX = function(value) {
|
||||
|
||||
};
|
||||
|
||||
GuacAdmin.Field._HTML_INPUT.prototype = new GuacAdmin.Field();
|
||||
GuacAdmin.Field.CHECKBOX.prototype = new GuacAdmin.Field();
|
||||
|
||||
/**
|
||||
* Enumerated field type.
|
||||
*
|
||||
* @augments GuacAdmin.Field
|
||||
*/
|
||||
GuacAdmin.Field.ENUM = function(values) {
|
||||
|
||||
// Call parent constructor
|
||||
GuacAdmin.Field.apply(this);
|
||||
|
||||
// Create backing element
|
||||
var element = GuacUI.createElement("select");
|
||||
for (var name in values) {
|
||||
var option = GuacUI.createChildElement(element, "option");
|
||||
option.textContent = values[name];
|
||||
option.value = name;
|
||||
}
|
||||
|
||||
this.getValue = function() {
|
||||
return element.value;
|
||||
};
|
||||
|
||||
this.getElement = function() {
|
||||
return element;
|
||||
};
|
||||
|
||||
this.setValue = function(value) {
|
||||
element.value = value;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
GuacAdmin.Field.ENUM.prototype = new GuacAdmin.Field();
|
||||
|
||||
|
||||
/**
|
||||
@@ -539,6 +573,10 @@ GuacAdmin.addConnection = function(connection) {
|
||||
field = new GuacAdmin.Field.CHECKBOX(parameter.value);
|
||||
break;
|
||||
|
||||
case "enum":
|
||||
field = new GuacAdmin.Field.ENUM(parameter.options);
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
|
||||
|
Reference in New Issue
Block a user