diff --git a/guacamole/src/main/webapp/scripts/admin-ui.js b/guacamole/src/main/webapp/scripts/admin-ui.js index 1025a4cd0..2c100ce42 100644 --- a/guacamole/src/main/webapp/scripts/admin-ui.js +++ b/guacamole/src/main/webapp/scripts/admin-ui.js @@ -42,9 +42,7 @@ var GuacAdmin = { "cached_permissions" : null, "cached_protocols" : null, - "cached_root_group" : null, - - "selected_connection" : null + "cached_root_group" : null }; @@ -658,303 +656,283 @@ GuacAdmin.UserEditor = function(name, parameters) { }; /** - * Adds the given connection to the displayed connection list. + * Connection edit dialog which allows editing of the connection parameters. + * + * @param {GuacamoleService.Connection} connection The connection to edit. + * @param {String} parameters Any parameters to add to service requests for sake + * of authentication. */ -GuacAdmin.addConnection = function(connection, parameters) { +GuacAdmin.ConnectionEditor = function(connection, parameters) { - var item = new GuacAdmin.ListItem("connection", connection.name); - var item_element = item.getElement(); - GuacAdmin.connectionPager.addElement(item_element); + /** + * Dialog containing the user editor. + */ + var dialog = new GuacUI.Dialog(); - item_element.onclick = function() { + var i; - // Ignore clicks if any item is selected - if (GuacAdmin.selected_connection) return; - else GuacAdmin.selected_connection = connection.id; + // Create form base elements + var connection_header = GuacUI.createChildElement(dialog.getHeader(), "h2"); + var form_element = GuacUI.createChildElement(dialog.getBody(), "div", "form"); + connection_header.textContent = connection.name; - var i; + var sections = GuacUI.createChildElement( + GuacUI.createChildElement(form_element, "div", "settings section"), + "dl"); - // Create form base elements - var form_element = GuacUI.createElement("div", "form"); - var connection_header = GuacUI.createChildElement(form_element, "h2"); - connection_header.textContent = connection.name; + // Parameter header + var protocol_header = GuacUI.createChildElement(sections, "dt"); + protocol_header.textContent = "Protocol:"; + + var protocol_field = GuacUI.createChildElement(protocol_header, "select"); - var sections = GuacUI.createChildElement( - GuacUI.createChildElement(form_element, "div", "settings section"), - "dl"); + // Associative set of protocols + var available_protocols = {}; - // Parameter header - var protocol_header = GuacUI.createChildElement(sections, "dt") - protocol_header.textContent = "Protocol:"; + // All form fields by parameter name + var fields = {}; + + // Add protocols + for (i=0; i 0) { + + // History section + var history_section = GuacUI.createChildElement(sections, "dd"); + var history_table = GuacUI.createChildElement(history_section, + "table", "history section"); + + var history_table_header = GuacUI.createChildElement( + history_table, "tr"); + + GuacUI.createChildElement(history_table_header, "th").textContent = + "Username"; + + GuacUI.createChildElement(history_table_header, "th").textContent = + "Start Time"; + + GuacUI.createChildElement(history_table_header, "th").textContent = + "Duration"; + + // Paginated body of history + var history_buttons = GuacUI.createChildElement(history_section, "div", + "list-pager-buttons"); + var history_body = GuacUI.createChildElement(history_table, "tbody"); + var history_pager = new GuacUI.Pager(history_body); + + // Add history + for (i=0; i 0) { - - // History section - var history_section = GuacUI.createChildElement(sections, "dd"); - var history_table = GuacUI.createChildElement(history_section, - "table", "history section"); - - var history_table_header = GuacUI.createChildElement( - history_table, "tr"); - - GuacUI.createChildElement(history_table_header, "th").textContent = - "Username"; - - GuacUI.createChildElement(history_table_header, "th").textContent = - "Start Time"; - - GuacUI.createChildElement(history_table_header, "th").textContent = - "Duration"; - - // Paginated body of history - var history_buttons = GuacUI.createChildElement(history_section, "div", - "list-pager-buttons"); - var history_body = GuacUI.createChildElement(history_table, "tbody"); - var history_pager = new GuacUI.Pager(history_body); - - // Add history - for (i=0; i