diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index f03e0d1af..dc39fc28b 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -135,7 +135,7 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams', // Get DAO for reading connections and groups var connectionGroupDAO = $injector.get('connectionGroupDAO'); var connectionDAO = $injector.get('connectionDAO'); - var ClientProperties = $injector.get('clientProperties'); + var ClientProperties = $injector.get('ClientProperties'); // Client settings and state $scope.clientProperties = new ClientProperties(); diff --git a/guacamole/src/main/webapp/app/client/directives/guacClient.js b/guacamole/src/main/webapp/app/client/directives/guacClient.js index 9ec3b2c39..2fb05307a 100644 --- a/guacamole/src/main/webapp/app/client/directives/guacClient.js +++ b/guacamole/src/main/webapp/app/client/directives/guacClient.js @@ -30,12 +30,29 @@ angular.module('client').directive('guacClient', [function guacClient() { restrict: 'E', replace: true, scope: { - // Parameters for controlling client state - clientProperties : '=', + + /** + * Parameters for controlling client state. + * + * @type ClientProperties|Object + */ + clientProperties : '=', - // Parameters for initially connecting - id : '=', - connectionParameters : '=' + /** + * The ID of the Guacamole connection to connect to. + * + * @type String + */ + id : '=', + + /** + * Arbitrary URL-encoded parameters to append to the connection + * string when connecting. + * + * @type String + */ + connectionParameters : '=' + }, templateUrl: 'app/client/templates/guacClient.html', controller: ['$scope', '$injector', '$element', function guacClientController($scope, $injector, $element) { diff --git a/guacamole/src/main/webapp/app/client/services/clientProperties.js b/guacamole/src/main/webapp/app/client/types/ClientProperties.js similarity index 74% rename from guacamole/src/main/webapp/app/client/services/clientProperties.js rename to guacamole/src/main/webapp/app/client/types/ClientProperties.js index a6ae11397..7c08b360e 100644 --- a/guacamole/src/main/webapp/app/client/services/clientProperties.js +++ b/guacamole/src/main/webapp/app/client/types/ClientProperties.js @@ -23,14 +23,20 @@ /** * A service for generating new guacClient properties objects. */ -angular.module('client').factory('clientProperties', [function clientProperties() { +angular.module('client').factory('ClientProperties', [function defineClientProperties() { /** * Object used for interacting with a guacClient directive. * * @constructor + * @param {ClientProperties|Object} [template={}] + * The object whose properties should be copied within the new + * ClientProperties. */ - return function() { + var ClientProperties = function ClientProperties(template) { + + // Use empty object by default + template = template || {}; /** * Whether the display should be scaled automatically to fit within the @@ -38,7 +44,7 @@ angular.module('client').factory('clientProperties', [function clientProperties( * * @type Boolean */ - this.autoFit = true; + this.autoFit = template.autoFit || true; /** * The current scale. If autoFit is true, the effect of setting this @@ -46,28 +52,28 @@ angular.module('client').factory('clientProperties', [function clientProperties( * * @type Number */ - this.scale = 1; + this.scale = template.scale || 1; /** * The minimum scale value. * * @type Number */ - this.minScale = 1; + this.minScale = template.minScale || 1; /** * The maximum scale value. * * @type Number */ - this.maxScale = 3; + this.maxScale = template.maxScale || 3; /** * Whether or not the client should listen to keyboard events. * * @type Boolean */ - this.keyboardEnabled = true; + this.keyboardEnabled = template.keyboardEnabled || true; /** * Whether translation of touch to mouse events should emulate an @@ -75,8 +81,10 @@ angular.module('client').factory('clientProperties', [function clientProperties( * * @type Boolean */ - this.emulateAbsoluteMouse = true; + this.emulateAbsoluteMouse = template.emulateAbsoluteMouse || true; }; + return ClientProperties; + }]); \ No newline at end of file