From fd399ece8539c5b1fb171d813bd03a743ff3982a Mon Sep 17 00:00:00 2001
From: Michael Jumper
Date: Thu, 7 Feb 2013 01:56:49 -0800
Subject: [PATCH] #268: Implement admin component stubs.
---
guacamole/src/main/webapp/admin.xhtml | 30 +--
guacamole/src/main/webapp/scripts/admin.js | 267 +++++++++++++++++++
guacamole/src/main/webapp/scripts/guac-ui.js | 215 ---------------
guacamole/src/main/webapp/styles/ui.css | 87 +++---
4 files changed, 310 insertions(+), 289 deletions(-)
create mode 100644 guacamole/src/main/webapp/scripts/admin.js
diff --git a/guacamole/src/main/webapp/admin.xhtml b/guacamole/src/main/webapp/admin.xhtml
index d344da336..68f3ce85b 100644
--- a/guacamole/src/main/webapp/admin.xhtml
+++ b/guacamole/src/main/webapp/admin.xhtml
@@ -41,10 +41,12 @@
on your access level, users can be added and deleted, and their
passwords can be changed.
-
+
+
@@ -58,9 +60,11 @@
can be changed.
+
@@ -68,6 +72,7 @@
Guacamole ${project.version}
+
@@ -75,29 +80,10 @@
diff --git a/guacamole/src/main/webapp/scripts/admin.js b/guacamole/src/main/webapp/scripts/admin.js
new file mode 100644
index 000000000..b6d5b72c9
--- /dev/null
+++ b/guacamole/src/main/webapp/scripts/admin.js
@@ -0,0 +1,267 @@
+/*
+ * Guacamole - Clientless Remote Desktop
+ * Copyright (C) 2010 Michael Jumper
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * Main Guacamole admin namespace.
+ * @namespace
+ */
+var GuacAdmin = GuacAdmin || {};
+
+/**
+ * An arbitrary input field. Note that this object is not a component, and has
+ * no corresponding element. Other objects which use GuacAdmin.Field may
+ * interpret its values and render an element, however.
+ *
+ * @constructor
+ * @param {String} title A human-readable title for the field.
+ * @param {String} type The type of the input field.
+ * @param {String} value The default value, if any.
+ */
+GuacAdmin.Field = function(title, type, value) {
+
+ /**
+ * A human-readable title describing this field.
+ */
+ this.title = title;
+
+ /**
+ * The type of this field. Possible values are "text", "password", and
+ * "checkbox".
+ */
+ this.type = type;
+
+ /**
+ * The default value of this field.
+ */
+ this.value = value;
+
+};
+
+/**
+ * An arbitrary button. Note that this object is not a component, and has
+ * no corresponding element. Other objects which use GuacAdmin.Button may
+ * interpret its values and render an element, however.
+ *
+ * @constructor
+ * @param {String} title A human-readable title for the button.
+ */
+GuacAdmin.Button = function(title) {
+
+ /**
+ * A human-readable title describing this button.
+ */
+ this.title = title;
+
+};
+
+/**
+ * An arbitrary table-based form. Given an array of fields and an array
+ * of buttons, GuacAdmin.Form constructs a clean HTML form using DOM Elements.
+ *
+ * @constructor
+ * @param {GuacAdmin.Field[]} fields An array of all fields to include in the
+ * form.
+ * @param {GuacAdmin.Button[]} buttons An array of all buttons to include in the
+ * form.
+ */
+GuacAdmin.Form = function(fields, buttons) {
+
+ // Main div and fields
+ var element = GuacUI.createElement("div", "form");
+ var field_table = GuacUI.createChildElement(element, "table", "fields");
+
+ // Buttons
+ var button_div = GuacUI.createChildElement(element, "div", "object-buttons");
+
+ /**
+ * Returns the DOM element representing this form.
+ */
+ this.getElement = function() {
+ return element;
+ };
+
+ /*
+ * Add all fields
+ */
+
+ var i;
+ for (i=0; i