GUACAMOLE-292: Add support for email fields.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/8830123c Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/8830123c Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/8830123c Branch: refs/heads/master Commit: 8830123c9b38fb838dff1701b005c311adaf77e4 Parents: afd051e Author: Michael Jumper <[email protected]> Authored: Wed Feb 22 01:04:27 2017 -0800 Committer: Michael Jumper <[email protected]> Committed: Sat May 27 11:28:13 2017 -0700 ---------------------------------------------------------------------- .../org/apache/guacamole/form/EmailField.java | 37 ++++++++++++++++++++ .../java/org/apache/guacamole/form/Field.java | 6 ++++ .../webapp/app/form/services/formService.js | 10 ++++++ .../webapp/app/form/templates/emailField.html | 8 +++++ .../src/main/webapp/app/index/styles/input.css | 4 +-- .../webapp/app/manage/styles/attributes.css | 1 + .../app/manage/styles/connection-parameter.css | 1 + .../src/main/webapp/app/rest/types/Field.js | 8 +++++ 8 files changed, 73 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole-ext/src/main/java/org/apache/guacamole/form/EmailField.java ---------------------------------------------------------------------- diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/form/EmailField.java b/guacamole-ext/src/main/java/org/apache/guacamole/form/EmailField.java new file mode 100644 index 0000000..e56a757 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/form/EmailField.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.form; + +/** + * Represents a text field which may contain an email address. + */ +public class EmailField extends Field { + + /** + * Creates a new EmailField with the given name. + * + * @param name + * The unique name to associate with this field. + */ + public EmailField(String name) { + super(name, Field.Type.EMAIL); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java ---------------------------------------------------------------------- diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java b/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java index dba1065..19f1ead 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java @@ -48,6 +48,12 @@ public class Field { public static String TEXT = "TEXT"; /** + * An email address field. This field type generally behaves + * identically to arbitrary text fields, but has semantic differences. + */ + public static String EMAIL = "EMAIL"; + + /** * A username field. This field type generally behaves identically to * arbitrary text fields, but has semantic differences. */ http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole/src/main/webapp/app/form/services/formService.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/form/services/formService.js b/guacamole/src/main/webapp/app/form/services/formService.js index 0d12259..c117bbf 100644 --- a/guacamole/src/main/webapp/app/form/services/formService.js +++ b/guacamole/src/main/webapp/app/form/services/formService.js @@ -48,6 +48,16 @@ angular.module('form').provider('formService', function formServiceProvider() { }, /** + * Email address field type. + * + * @see {@link Field.Type.EMAIL} + * @type FieldType + */ + 'EMAIL' : { + templateUrl : 'app/form/templates/emailField.html' + }, + + /** * Numeric field type. * * @see {@link Field.Type.NUMERIC} http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole/src/main/webapp/app/form/templates/emailField.html ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/form/templates/emailField.html b/guacamole/src/main/webapp/app/form/templates/emailField.html new file mode 100644 index 0000000..db6d3be --- /dev/null +++ b/guacamole/src/main/webapp/app/form/templates/emailField.html @@ -0,0 +1,8 @@ +<div class="email-field"> + <input type="email" + ng-model="model" + ng-hide="readOnly" + autocorrect="off" + autocapitalize="off"/> + <a href="mailto:{{model}}" ng-show="readOnly">{{model}}</a> +</div> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole/src/main/webapp/app/index/styles/input.css ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/index/styles/input.css b/guacamole/src/main/webapp/app/index/styles/input.css index 1eb8d9b..4141c76 100644 --- a/guacamole/src/main/webapp/app/index/styles/input.css +++ b/guacamole/src/main/webapp/app/index/styles/input.css @@ -17,11 +17,11 @@ * under the License. */ -input[type=checkbox], input[type=number], input[type=text], input[type=radio], label, textarea { +input[type=checkbox], input[type=number], input[type=text], input[type=email], input[type=radio], label, textarea { -webkit-tap-highlight-color: rgba(128,192,128,0.5); } -div.location, input[type=text], input[type=number], input[type=password], textarea { +div.location, input[type=text], input[type=email], input[type=number], input[type=password], textarea { border: 1px solid #777; -moz-border-radius: 0.2em; -webkit-border-radius: 0.2em; http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole/src/main/webapp/app/manage/styles/attributes.css ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/manage/styles/attributes.css b/guacamole/src/main/webapp/app/manage/styles/attributes.css index 136ec5d..2b5bc92 100644 --- a/guacamole/src/main/webapp/app/manage/styles/attributes.css +++ b/guacamole/src/main/webapp/app/manage/styles/attributes.css @@ -19,6 +19,7 @@ /* Do not stretch attributes to fit available area */ .attributes input[type=text], +.attributes input[type=email], .attributes input[type=password], .attributes input[type=number] { width: auto; http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole/src/main/webapp/app/manage/styles/connection-parameter.css ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/manage/styles/connection-parameter.css b/guacamole/src/main/webapp/app/manage/styles/connection-parameter.css index a005703..8fe19d6 100644 --- a/guacamole/src/main/webapp/app/manage/styles/connection-parameter.css +++ b/guacamole/src/main/webapp/app/manage/styles/connection-parameter.css @@ -19,6 +19,7 @@ /* Do not stretch connection parameters to fit available area */ .connection-parameters input[type=text], +.connection-parameters input[type=email], .connection-parameters input[type=password], .connection-parameters input[type=number] { width: auto; http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole/src/main/webapp/app/rest/types/Field.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/rest/types/Field.js b/guacamole/src/main/webapp/app/rest/types/Field.js index 5204268..84dfe13 100644 --- a/guacamole/src/main/webapp/app/rest/types/Field.js +++ b/guacamole/src/main/webapp/app/rest/types/Field.js @@ -76,6 +76,14 @@ angular.module('rest').factory('Field', [function defineField() { TEXT : 'TEXT', /** + * The type string associated with parameters that may contain an email + * address. + * + * @type String + */ + EMAIL : 'EMAIL', + + /** * The type string associated with parameters that may contain an * arbitrary string, where that string represents the username of the * user authenticating with the remote desktop service.
