mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 09:03:21 +00:00 
			
		
		
		
	GUACAMOLE-422: Implement client-side timezone detection.
This commit is contained in:
		
				
					committed by
					
						 Virtually Nick
						Virtually Nick
					
				
			
			
				
	
			
			
			
						parent
						
							8b443dc9d5
						
					
				
				
					commit
					ea913c98fe
				
			| @@ -38,6 +38,7 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe | ||||
|             // Required services | ||||
|             var $translate            = $injector.get('$translate'); | ||||
|             var authenticationService = $injector.get('authenticationService'); | ||||
|             var formService           = $injector.get('formService'); | ||||
|             var guacNotification      = $injector.get('guacNotification'); | ||||
|             var languageService       = $injector.get('languageService'); | ||||
|             var permissionService     = $injector.get('permissionService'); | ||||
|   | ||||
| @@ -98,6 +98,17 @@ angular.module('settings').provider('preferenceService', ['$injector', | ||||
|         return language.replace(/-/g, '_'); | ||||
|  | ||||
|     }; | ||||
|      | ||||
|     /** | ||||
|      * Return the timezone detected for the current browser session | ||||
|      * by the JSTZ timezone library. | ||||
|      *  | ||||
|      * @returns String | ||||
|      *     The name of the currently-detected timezone. | ||||
|      */ | ||||
|     var getDetectedTimezone = function getDetectedTimezone() { | ||||
|         return jstz.determine().name(); | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * All currently-set preferences, as name/value pairs. Each property name | ||||
| @@ -128,7 +139,13 @@ angular.module('settings').provider('preferenceService', ['$injector', | ||||
|          *  | ||||
|          * @type String | ||||
|          */ | ||||
|         language : getDefaultLanguageKey() | ||||
|         language : getDefaultLanguageKey(), | ||||
|          | ||||
|         /** | ||||
|          * The timezone set by the uesr. | ||||
|          * @type String | ||||
|          */ | ||||
|         timezone : getDetectedTimezone() | ||||
|  | ||||
|     }; | ||||
|  | ||||
|   | ||||
| @@ -18,7 +18,7 @@ | ||||
|  */ | ||||
|  | ||||
| .preferences .update-password .form,  | ||||
| .preferences .language .form { | ||||
| .preferences .locale .form { | ||||
|     padding-left: 0.5em; | ||||
|     border-left: 3px solid rgba(0, 0, 0, 0.125); | ||||
| } | ||||
| @@ -1,8 +1,8 @@ | ||||
| <div class="preferences" ng-class="{loading: !isLoaded()}"> | ||||
|  | ||||
|     <!-- Language settings --> | ||||
|     <div class="settings section language"> | ||||
|         <p>{{'SETTINGS_PREFERENCES.HELP_LANGUAGE' | translate}}</p> | ||||
|     <!-- Locale settings --> | ||||
|     <div class="settings section locale"> | ||||
|         <p>{{'SETTINGS_PREFERENCES.HELP_LOCALE' | translate}}</p> | ||||
|  | ||||
|         <!-- Language selection --> | ||||
|         <div class="form"> | ||||
| @@ -13,6 +13,15 @@ | ||||
|                 </tr> | ||||
|             </table> | ||||
|         </div> | ||||
|          | ||||
|         <!-- Timezone selection --> | ||||
|         <div class="form"> | ||||
|             <guac-form-field | ||||
|                 field="{ 'type' : 'TIMEZONE', 'name' : 'timezone' }" | ||||
|                 model="preferences.timezone" | ||||
|                 namespace="'SETTINGS_PREFERENCES'"> | ||||
|             </guac-form-field> | ||||
|         </div> | ||||
|     </div> | ||||
|      | ||||
|     <!-- Password update --> | ||||
|   | ||||
| @@ -85,6 +85,9 @@ | ||||
|         <script type="text/javascript" src="webjars/angular-translate-interpolation-messageformat/2.16.0/angular-translate-interpolation-messageformat.min.js"></script> | ||||
|         <script type="text/javascript" src="webjars/angular-translate-loader-static-files/2.16.0/angular-translate-loader-static-files.min.js"></script> | ||||
|  | ||||
|         <!-- JSTZ --> | ||||
|         <script type="text/javascript" src="webjars/jstz/1.0.10/dist/jstz.min.js"></script> | ||||
|          | ||||
|         <!-- Polyfills for the "datalist" element, Blob and the FileSaver API --> | ||||
|         <script type="text/javascript" src="webjars/blob-polyfill/1.0.20150320/Blob.js"></script> | ||||
|         <script type="text/javascript" src="webjars/datalist-polyfill/1.14.0/datalist-polyfill.min.js"></script> | ||||
|   | ||||
| @@ -755,6 +755,7 @@ | ||||
|         "FIELD_HEADER_PASSWORD_OLD"       : "Current Password:", | ||||
|         "FIELD_HEADER_PASSWORD_NEW"       : "New Password:", | ||||
|         "FIELD_HEADER_PASSWORD_NEW_AGAIN" : "Confirm New Password:", | ||||
|         "FIELD_HEADER_TIMEZONE"           : "Timezone:", | ||||
|         "FIELD_HEADER_USERNAME"           : "Username:", | ||||
|          | ||||
|         "HELP_DEFAULT_INPUT_METHOD" : "The default input method determines how keyboard events are received by Guacamole. Changing this setting may be necessary when using a mobile device, or when typing through an IME. This setting can be overridden on a per-connection basis within the Guacamole menu.", | ||||
| @@ -762,7 +763,7 @@ | ||||
|         "HELP_INPUT_METHOD_NONE"    : "@:CLIENT.HELP_INPUT_METHOD_NONE", | ||||
|         "HELP_INPUT_METHOD_OSK"     : "@:CLIENT.HELP_INPUT_METHOD_OSK", | ||||
|         "HELP_INPUT_METHOD_TEXT"    : "@:CLIENT.HELP_INPUT_METHOD_TEXT", | ||||
|         "HELP_LANGUAGE"             : "Select a different language below to change the language of all text within Guacamole. Available choices will depend on which languages are installed.", | ||||
|         "HELP_LOCALE"               : "Options below are related to the locale of the user and will impact how various parts of the interface are displayed.", | ||||
|         "HELP_MOUSE_MODE_ABSOLUTE"  : "@:CLIENT.HELP_MOUSE_MODE_ABSOLUTE", | ||||
|         "HELP_MOUSE_MODE_RELATIVE"  : "@:CLIENT.HELP_MOUSE_MODE_RELATIVE", | ||||
|         "HELP_UPDATE_PASSWORD"      : "If you wish to change your password, enter your current password and the desired new password below, and click \"Update Password\". The change will take effect immediately.", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user