Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUACAMOLE-124: Add full-screen action #470

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
var User = $injector.get('User');

// Get required services
var $log = $injector.get('$log');
var $location = $injector.get('$location');
var $route = $injector.get('$route');
var authenticationService = $injector.get('authenticationService');
Expand Down Expand Up @@ -134,6 +135,23 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
return authenticationService.isAnonymous();
};

/**
* Toggles fullscreen for the Guacamole page.
*/
$scope.fullscreen = function fullscreen() {
var fullscreenElem = !!(document.fullscreenElement
|| document.msFullscreenElement
|| document.mozFullScreenElement
|| document.webkitFullscreenElement);

if (!fullscreenElem) {
document.documentElement.requestFullscreen();
}
else {
document.exitFullscreen();
}
madmath03 marked this conversation as resolved.
Show resolved Hide resolved
};

/**
* Logs out the current user, redirecting them to back to the root
* after logout completes.
Expand All @@ -149,6 +167,15 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
});
};

/**
* Action which requests fullscreen for the Guacamole page.
*/
var FULLSCREEN_ACTION = {
name : 'USER_MENU.ACTION_FULLSCREEN',
className : 'fullscreen',
callback : $scope.fullscreen
};

/**
* Action which logs out the current user, redirecting them to back
* to the login screen after logout completes.
Expand All @@ -164,6 +191,36 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
*/
$scope.actions = [ LOGOUT_ACTION ];

// Initialize fullscreen functions
var docElem = document.documentElement;
var requestFullscreen = docElem.requestFullscreen
|| docElem.mozRequestFullScreen
|| docElem.webkitRequestFullscreen
|| docElem.msRequestFullscreen;
var exitFullscreen = document.exitFullscreen
|| document.mozCancelFullScreen
|| document.webkitExitFullscreen
|| document.msExitFullscreen;

if (!!requestFullscreen && !!exitFullscreen) {
// Bind browser-specific fullscreen functions
if (!docElem.requestFullscreen) {
docElem.requestFullscreen = (requestFullscreen).bind(docElem);
}
if (!document.exitFullscreen) {
document.exitFullscreen = (exitFullscreen).bind(document);
}

/**
* Add fullscreen action for the current user.
*/
$scope.actions.unshift( FULLSCREEN_ACTION );

}
else {
$log.warn('Fullscreen not available on this device');
}

}] // end controller

};
Expand Down
2 changes: 2 additions & 0 deletions guacamole/src/main/webapp/translations/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"ACTION_DOWNLOAD" : "Stáhnout",
"ACTION_LOGIN" : "Přihlásit",
"ACTION_LOGOUT" : "Odhlásit",
"ACTION_FULLSCREEN" : "Celá obrazovka",
"ACTION_MANAGE_CONNECTIONS" : "Připojení",
"ACTION_MANAGE_PREFERENCES" : "Vlastnosti",
"ACTION_MANAGE_SETTINGS" : "Nastavení",
Expand Down Expand Up @@ -964,6 +965,7 @@
"USER_MENU" : {

"ACTION_LOGOUT" : "@:APP.ACTION_LOGOUT",
"ACTION_FULLSCREEN" : "@:APP.ACTION_FULLSCREEN",
"ACTION_MANAGE_CONNECTIONS" : "@:APP.ACTION_MANAGE_CONNECTIONS",
"ACTION_MANAGE_PREFERENCES" : "@:APP.ACTION_MANAGE_PREFERENCES",
"ACTION_MANAGE_SESSIONS" : "@:APP.ACTION_MANAGE_SESSIONS",
Expand Down
2 changes: 2 additions & 0 deletions guacamole/src/main/webapp/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"ACTION_DOWNLOAD" : "Download",
"ACTION_LOGIN" : "Anmelden",
"ACTION_LOGOUT" : "Abmelden",
"ACTION_FULLSCREEN" : "Ganzer Bildschirm",
"ACTION_MANAGE_CONNECTIONS" : "Verbindungen",
"ACTION_MANAGE_PREFERENCES" : "Einstellungen",
"ACTION_MANAGE_SETTINGS" : "Einstellungen",
Expand Down Expand Up @@ -862,6 +863,7 @@
"USER_MENU" : {

"ACTION_LOGOUT" : "@:APP.ACTION_LOGOUT",
"ACTION_FULLSCREEN" : "@:APP.ACTION_FULLSCREEN",
"ACTION_MANAGE_CONNECTIONS" : "@:APP.ACTION_MANAGE_CONNECTIONS",
"ACTION_MANAGE_PREFERENCES" : "@:APP.ACTION_MANAGE_PREFERENCES",
"ACTION_MANAGE_SESSIONS" : "@:APP.ACTION_MANAGE_SESSIONS",
Expand Down
2 changes: 2 additions & 0 deletions guacamole/src/main/webapp/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"ACTION_DOWNLOAD" : "Download",
"ACTION_LOGIN" : "Login",
"ACTION_LOGOUT" : "Logout",
"ACTION_FULLSCREEN" : "Fullscreen",
"ACTION_MANAGE_CONNECTIONS" : "Connections",
"ACTION_MANAGE_PREFERENCES" : "Preferences",
"ACTION_MANAGE_SETTINGS" : "Settings",
Expand Down Expand Up @@ -967,6 +968,7 @@
"USER_MENU" : {

"ACTION_LOGOUT" : "@:APP.ACTION_LOGOUT",
"ACTION_FULLSCREEN" : "@:APP.ACTION_FULLSCREEN",
"ACTION_MANAGE_CONNECTIONS" : "@:APP.ACTION_MANAGE_CONNECTIONS",
"ACTION_MANAGE_PREFERENCES" : "@:APP.ACTION_MANAGE_PREFERENCES",
"ACTION_MANAGE_SESSIONS" : "@:APP.ACTION_MANAGE_SESSIONS",
Expand Down
2 changes: 2 additions & 0 deletions guacamole/src/main/webapp/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"ACTION_DOWNLOAD" : "Descargar",
"ACTION_LOGIN" : "Iniciar Sesión",
"ACTION_LOGOUT" : "Cerrar Sesión",
"ACTION_FULLSCREEN" : "Pantalla completa",
"ACTION_MANAGE_CONNECTIONS" : "Conexiones",
"ACTION_MANAGE_PREFERENCES" : "Preferencias",
"ACTION_MANAGE_SETTINGS" : "Configuración",
Expand Down Expand Up @@ -729,6 +730,7 @@
"USER_MENU" : {

"ACTION_LOGOUT" : "@:APP.ACTION_LOGOUT",
"ACTION_FULLSCREEN" : "@:APP.ACTION_FULLSCREEN",
"ACTION_MANAGE_CONNECTIONS" : "@:APP.ACTION_MANAGE_CONNECTIONS",
"ACTION_MANAGE_PREFERENCES" : "@:APP.ACTION_MANAGE_PREFERENCES",
"ACTION_MANAGE_SESSIONS" : "@:APP.ACTION_MANAGE_SESSIONS",
Expand Down
2 changes: 2 additions & 0 deletions guacamole/src/main/webapp/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"ACTION_DELETE_SESSIONS" : "Fermer les Sessions",
"ACTION_LOGIN" : "Se connecter",
"ACTION_LOGOUT" : "Se déconnecter",
"ACTION_FULLSCREEN" : "Plein écran",
"ACTION_MANAGE_CONNECTIONS" : "Connexions",
"ACTION_MANAGE_PREFERENCES" : "Préférences",
"ACTION_MANAGE_SETTINGS" : "Paramètres",
Expand Down Expand Up @@ -648,6 +649,7 @@
"USER_MENU" : {

"ACTION_LOGOUT" : "@:APP.ACTION_LOGOUT",
"ACTION_FULLSCREEN" : "@:APP.ACTION_FULLSCREEN",
"ACTION_MANAGE_CONNECTIONS" : "@:APP.ACTION_MANAGE_CONNECTIONS",
"ACTION_MANAGE_PREFERENCES" : "@:APP.ACTION_MANAGE_PREFERENCES",
"ACTION_MANAGE_SESSIONS" : "@:APP.ACTION_MANAGE_SESSIONS",
Expand Down
2 changes: 2 additions & 0 deletions guacamole/src/main/webapp/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"ACTION_DELETE_SESSIONS" : "Termina Sessione",
"ACTION_LOGIN" : "Entra",
"ACTION_LOGOUT" : "Esci",
"ACTION_FULLSCREEN" : "A schermo intero",
"ACTION_MANAGE_CONNECTIONS" : "Connessioni",
"ACTION_MANAGE_PREFERENCES" : "Preferenze",
"ACTION_MANAGE_SETTINGS" : "Opzioni",
Expand Down Expand Up @@ -590,6 +591,7 @@
"USER_MENU" : {

"ACTION_LOGOUT" : "@:APP.ACTION_LOGOUT",
"ACTION_FULLSCREEN" : "@:APP.ACTION_FULLSCREEN",
"ACTION_MANAGE_CONNECTIONS" : "@:APP.ACTION_MANAGE_CONNECTIONS",
"ACTION_MANAGE_PREFERENCES" : "@:APP.ACTION_MANAGE_PREFERENCES",
"ACTION_MANAGE_SESSIONS" : "@:APP.ACTION_MANAGE_SESSIONS",
Expand Down
2 changes: 2 additions & 0 deletions guacamole/src/main/webapp/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"ACTION_DOWNLOAD" : "ダウンロード",
"ACTION_LOGIN" : "ログイン",
"ACTION_LOGOUT" : "ログアウト",
"ACTION_FULLSCREEN" : "全画面表示",
"ACTION_MANAGE_CONNECTIONS" : "接続",
"ACTION_MANAGE_PREFERENCES" : "ユーザ設定",
"ACTION_MANAGE_SETTINGS" : "設定",
Expand Down Expand Up @@ -733,6 +734,7 @@
"USER_MENU" : {

"ACTION_LOGOUT" : "@:APP.ACTION_LOGOUT",
"ACTION_FULLSCREEN" : "@:APP.ACTION_FULLSCREEN",
"ACTION_MANAGE_CONNECTIONS" : "@:APP.ACTION_MANAGE_CONNECTIONS",
"ACTION_MANAGE_PREFERENCES" : "@:APP.ACTION_MANAGE_PREFERENCES",
"ACTION_MANAGE_SESSIONS" : "@:APP.ACTION_MANAGE_SESSIONS",
Expand Down
2 changes: 2 additions & 0 deletions guacamole/src/main/webapp/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"ACTION_DELETE_SESSIONS" : "Verwijder Sessies",
"ACTION_LOGIN" : "Inloggen",
"ACTION_LOGOUT" : "Uitloggen",
"ACTION_FULLSCREEN" : "Volledig scherm",
"ACTION_MANAGE_CONNECTIONS" : "Verbindingen",
"ACTION_MANAGE_PREFERENCES" : "Voorkeuren",
"ACTION_MANAGE_SETTINGS" : "Instellingen",
Expand Down Expand Up @@ -678,6 +679,7 @@
"USER_MENU" : {

"ACTION_LOGOUT" : "@:APP.ACTION_LOGOUT",
"ACTION_FULLSCREEN" : "@:APP.ACTION_FULLSCREEN",
"ACTION_MANAGE_CONNECTIONS" : "@:APP.ACTION_MANAGE_CONNECTIONS",
"ACTION_MANAGE_PREFERENCES" : "@:APP.ACTION_MANAGE_PREFERENCES",
"ACTION_MANAGE_SESSIONS" : "@:APP.ACTION_MANAGE_SESSIONS",
Expand Down
2 changes: 2 additions & 0 deletions guacamole/src/main/webapp/translations/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"ACTION_DELETE_SESSIONS" : "Avslutt Sesjoner",
"ACTION_LOGIN" : "Logg inn",
"ACTION_LOGOUT" : "Logg ut",
"ACTION_FULLSCREEN" : "Full skjerm",
"ACTION_MANAGE_CONNECTIONS" : "Forbindelser",
"ACTION_MANAGE_PREFERENCES" : "Mine valg",
"ACTION_MANAGE_SETTINGS" : "Innstillinger",
Expand Down Expand Up @@ -659,6 +660,7 @@
"USER_MENU" : {

"ACTION_LOGOUT" : "@:APP.ACTION_LOGOUT",
"ACTION_FULLSCREEN" : "@:APP.ACTION_FULLSCREEN",
"ACTION_MANAGE_CONNECTIONS" : "@:APP.ACTION_MANAGE_CONNECTIONS",
"ACTION_MANAGE_PREFERENCES" : "@:APP.ACTION_MANAGE_PREFERENCES",
"ACTION_MANAGE_SESSIONS" : "@:APP.ACTION_MANAGE_SESSIONS",
Expand Down
2 changes: 2 additions & 0 deletions guacamole/src/main/webapp/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"ACTION_DELETE_SESSIONS" : "Завершить сессии",
"ACTION_LOGIN" : "Вход",
"ACTION_LOGOUT" : "Выход",
"ACTION_FULLSCREEN" : "Полноэкранный",
"ACTION_MANAGE_CONNECTIONS" : "Подключения",
"ACTION_MANAGE_PREFERENCES" : "Настройки",
"ACTION_MANAGE_SETTINGS" : "Опции",
Expand Down Expand Up @@ -574,6 +575,7 @@
"USER_MENU" : {

"ACTION_LOGOUT" : "@:APP.ACTION_LOGOUT",
"ACTION_FULLSCREEN" : "@:APP.ACTION_FULLSCREEN",
"ACTION_MANAGE_CONNECTIONS" : "@:APP.ACTION_MANAGE_CONNECTIONS",
"ACTION_MANAGE_PREFERENCES" : "@:APP.ACTION_MANAGE_PREFERENCES",
"ACTION_MANAGE_SESSIONS" : "@:APP.ACTION_MANAGE_SESSIONS",
Expand Down
2 changes: 2 additions & 0 deletions guacamole/src/main/webapp/translations/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"ACTION_DOWNLOAD" : "下载",
"ACTION_LOGIN" : "登录",
"ACTION_LOGOUT" : "登出",
"ACTION_FULLSCREEN" : "全屏",
"ACTION_MANAGE_CONNECTIONS" : "连接",
"ACTION_MANAGE_PREFERENCES" : "偏好",
"ACTION_MANAGE_SETTINGS" : "设置",
Expand Down Expand Up @@ -764,6 +765,7 @@
"USER_MENU" : {

"ACTION_LOGOUT" : "@:APP.ACTION_LOGOUT",
"ACTION_FULLSCREEN" : "@:APP.ACTION_FULLSCREEN",
"ACTION_MANAGE_CONNECTIONS" : "@:APP.ACTION_MANAGE_CONNECTIONS",
"ACTION_MANAGE_PREFERENCES" : "@:APP.ACTION_MANAGE_PREFERENCES",
"ACTION_MANAGE_SESSIONS" : "@:APP.ACTION_MANAGE_SESSIONS",
Expand Down