-
@@ -205,62 +271,71 @@
-
+
-
Agent Remote Desktop
-
-
-
Scaling
-
-
-
-
Frame rate
-
-
-
+
Agent Remote Desktop
+
-
Intel® AMT Hardware KVM
-
-
Image Encoding
-
-
-
+
Intel® AMT Hardware KVM
+
+
+ Encoding |
+
+
+ |
+
+
@@ -285,6 +360,7 @@
var debugmode = urlargs.debug;
var attemptWebRTC = false;
var updateSessionTimer = null;
+ var deskKeyboardShortcuts = [];
var StatusStrs = ["Disconnected", "Connecting...", "Setup...", "Connected", "Intel® AMT Connected"];
var nodeName = decodeURIComponent('{{{nodeName}}}');
var webPageFullScreen = false;
@@ -318,10 +394,14 @@
var p13FilesConsoleMsgTimer = null;
function start() {
- window.onresize = deskAdjust;
- document.onkeypress = ondockeypress;
- document.onkeydown = ondockeydown;
- document.onkeyup = ondockeyup;
+ window.onresize = center;
+ center();
+ document.onkeypress = ondeskkeypress;
+ document.onkeydown = ondeskkeydown;
+ document.onkeyup = ondeskkeyup;
+ //document.onkeypress = ondockeypress;
+ //document.onkeydown = ondockeydown;
+ //document.onkeyup = ondockeyup;
setupDesktop();
setupTerminal();
setupFiles();
@@ -351,6 +431,13 @@
else if (features & 1) { go(12); } // Goto terminal
else if (features & 4) { go(13); } // Goto files
deskAdjust();
+
+ // Set the user's desktop shortcut keys
+ deskKeyboardShortcuts = [];
+ var deskKeyboardShortcutsStr = '0x0A002E,0x100000,0x100028,0x100026,0x10004C,0x10004D,0x11004D,0x100052,0x020073,0x080057,0x020009,0x100025,0x100027'.split(',');
+ for (var i in deskKeyboardShortcutsStr) { deskKeyboardShortcuts.push(parseInt(deskKeyboardShortcutsStr[i])); }
+ updateDeskShortcutKeys();
+ //updateTermShortcutKeys();
}
//
@@ -363,21 +450,34 @@
function deskAdjust() {
if ((xxcurrentView == 12) && (terminal != null) && (xtermfit != null)) { xtermfit.fit(); } // Terminal
QS('fileArea4')['height'] = 'calc(100vh - ' + (90 + Q('fileArea2').clientHeight) + 'px)'; // Files
- var parentH = Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth;
- var deskH = Q('Desk').height, deskW = Q('Desk').width;
- // Fixed aspect ratio
- if ((parentH / parentW) > (deskH / deskW)) {
- var hNew = ((deskH * parentW) / deskW) + 'px';
- QS('Desk').height = hNew;
+ if (fullscreen) {
+ QS('Desk')['margin-top'] = null;
+ QS('Desk')['margin-bottom'] = null;
+ QS('deskarea3x')['padding-right'] = '55px';
QS('Desk').width = '100%';
- } else {
- var wNew = ((deskW * parentH) / deskH) + 'px';
QS('Desk').height = '100%';
- QS('Desk').width = wNew;
+ var parentH = Q('p11').clientHeight, parentW = Q('p11').clientWidth;
+ var deskH = Q('deskarea3x').clientHeight, deskW = Q('deskarea3x').clientWidth - 55;
+ if (parentH > deskH) { QS('deskarea3x').top = ((parentH - deskH) / 2) + 'px'; } else { QS('deskarea3x').top = null; }
+ if (parentW > deskW) { QS('deskarea3x').left = ((parentW - deskW) / 2) + 'px'; } else { QS('deskarea3x').left = null; }
+ } else {
+ var parentH = Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth;
+ var deskH = Q('Desk').height, deskW = Q('Desk').width;
+
+ // Fixed aspect ratio
+ if ((parentH / parentW) > (deskH / deskW)) {
+ var hNew = ((deskH * parentW) / deskW) + 'px';
+ QS('Desk').height = hNew;
+ QS('Desk').width = '100%';
+ } else {
+ var wNew = ((deskW * parentH) / deskH) + 'px';
+ QS('Desk').height = '100%';
+ QS('Desk').width = wNew;
+ }
+ QS('Desk')['margin-top'] = null;
+ QS('deskarea3x')['padding-right'] = null;
}
- QS('Desk')['margin-top'] = null;
- QS('DeskParent').overflow = 'hidden';
}
function setupDesktop() {
@@ -427,8 +527,8 @@
// Display this only if we have Chat & Notify permissions
QV('DeskSaveImageButton', (deskState == 3) && (Q('Desk')['toBlob'] != null));
QV('DeskControlSpan', viewOnly != 1);
- QV('deskActionsBtn', (browserfullscreen == false));
- QV('deskActionsSettings', (browserfullscreen == false));
+ QV('deskActionsBtn', true);
+ QV('deskActionsSettings', (deskState != 3));
Q('DeskControl').checked = true;
QS('DeskControlSpan').color = Q('DeskControl').checked ? null : 'red';
}
@@ -639,6 +739,8 @@
if ((desktop != null) && (desktop.webRtcActive == true)) { str += ", WebRTC"; }
//if (desktop.m.stopInput == true) { str += ', Loopback'; }
QH('deskstatus', str);
+ QV('deskFullScreen', state == 3);
+ QV('deskActionsSettings', state != 3);
switch (state) {
case 0:
// Stop recording
@@ -647,7 +749,6 @@
// Disconnect and clean up the remote desktop
desktop.Stop();
desktop = null;
- QV('DeskFocus', false);
QV('termdisplays', false);
QV('deskRecordIcon', false);
if (fullscreen == true) { deskToggleFull(); }
@@ -694,8 +795,6 @@
function showDesktopSettingsChanged() {
desktopsettings.encoding = d7desktopmode.value;
- desktopsettings.showfocus = d7showfocus.checked;
- desktopsettings.showmouse = d7showcursor.checked;
desktopsettings.quality = d7bitmapquality.value;
desktopsettings.scaling = d7bitmapscaling.value;
desktopsettings.framerate = d7framelimiter.value;
@@ -723,8 +822,6 @@
for (var i in ops) { r += '
'; }
QH('d7bitmapquality', r);
d7desktopmode.value = desktopsettings.encoding;
- d7showfocus.checked = desktopsettings.showfocus;
- d7showcursor.checked = desktopsettings.showmouse;
d7bitmapquality.value = 40; // Default value
if (ops.indexOf(parseInt(desktopsettings.quality)) >= 0) { d7bitmapquality.value = desktopsettings.quality; }
d7bitmapscaling.value = desktopsettings.scaling;
@@ -734,72 +831,120 @@
if (desktopsettings.localkeymap) { d7localKeyMap.checked = desktopsettings.localkeymap; }
}
- // Enter browser fullscreen
- function enterBrowserFullscreen(elem) {
- if (elem.requestFullscreen) { elem.requestFullscreen(); }
- else if (elem.msRequestFullscreen) { elem.msRequestFullscreen(); }
- else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); }
- else if (elem.webkitRequestFullscreen) { elem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); }
+ function toggleMenu(x) {
+ if (xxdialogMode) return;
+ QV('deskButtonMenu', fullscreen && !x && (xxcurrentView == 11));
+ QV('termButtonMenu', fullscreen && !x && (xxcurrentView == 12));
+ QV('deskkeybutton3a', fullscreen && x);
+ QV('deskkeybutton3b', fullscreen && !x);
}
- // Exit browser fullscreen
- function exitBrowserFullscreen() {
- if (document.exitFullscreen) { document.exitFullscreen(); }
- else if (document.msExitFullscreen) { document.msExitFullscreen(); }
- else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); }
- else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); }
+ function deskChangeMouseButton(x) {
+ if (xxdialogMode) return;
+ if (desktop == null) return;
+ desktop.m.SwapMouse = !desktop.m.SwapMouse;
+ QV('deskkeybutton4a', fullscreen && (!desktop.m.SwapMouse));
+ QV('deskkeybutton4b', fullscreen && (desktop.m.SwapMouse));
}
- // Return true if the browser is fullscreen. This is a delayed method that will return true/false late. Not very useful.
- function isBrowserFullscreen() {
- if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) { return false; } else { return true; }
+ function deskChangeFullscreenZoom() {
+ if (xxdialogMode) return;
+ if (xxcurrentView == 11) {
+ if (desktop == null) return;
+ if (fullscreenzoom == 1) { fullscreenzoom = 0.5; } else { fullscreenzoom = 1; }
+ QV('deskkeybutton5a', fullscreen && (fullscreenzoom == 1));
+ QV('deskkeybutton5b', fullscreen && (fullscreenzoom != 1));
+ QS('deskarea3x').width = (desktop.m.ScreenWidth * fullscreenzoom) + 'px';
+ QS('deskarea3x').height = (desktop.m.ScreenHeight * fullscreenzoom) + 'px';
+ deskAdjust();
+ }
+ if (xxcurrentView == 12) {
+ if (terminal == null) return;
+ xterm.setOption('fontSize', (xterm.getOption('fontSize') == 15) ? 10 : 15)
+ }
}
var fullscreen = false;
- var browserfullscreen = false;
+ var fullscreenzoom = 1;
function deskToggleFull(e) {
var xtermActive = !((urlargs.xterm === 0) || ((terminal != null) && (xterm == null)));
fullscreen = !fullscreen;
if (fullscreen) {
- QC('body').add('fulldesk');
- QS('deskarea3x')['height'] = '100%';
- QS('deskarea3x')['max-height'] = '100%';
+ QV('deskarea1', false);
+ QV('deskarea4', false);
+ QV('xfooter', false);
+ QS('p11').bottom = '0px';
+ QS('deskarea0').overflow = 'scroll';
+ QS('deskarea3x').width = (desktop.m.ScreenWidth * fullscreenzoom) + 'px';
+ QS('deskarea3x').height = QS('deskarea3x')['max-height'] = (desktop.m.ScreenHeight * fullscreenzoom) + 'px';
+ QS('deskarea3x')['padding-right'] = '55px';
if (xtermActive) {
// XTerm terminal
- QS('termTable')['position'] = 'absolute';
- QS('termTable')['top'] = QS('termTable')['bottom'] = QS('termTable')['left'] = QS('termTable')['right'] = '0';
+ //QS('termTable')['position'] = 'absolute';
+ //QS('termTable')['top'] = QS('termTable')['bottom'] = QS('termTable')['left'] = QS('termTable')['right'] = '0';
} else {
// Legacy terminal
- QS('termTable')['height'] = '100%';
- QS('termTable')['max-height'] = '100%';
- }
-
- // If shift is pressed, enter browser full screen.
- if (e.shiftKey == true) {
- enterBrowserFullscreen(Q('container'));
- browserfullscreen = true;
+ //QS('termTable')['height'] = '100%';
+ //QS('termTable')['max-height'] = '100%';
}
} else {
- QC('body').remove('fulldesk');
- var hide = urlargs.hide;
- if (footerBar == false) { hide |= 4; }
- var xh = (((hide & 1) ? 0 : 66) + ((hide & 2) ? 0 : 24) + ((hide & 4) ? 0 : 45) + ((hide & 8) ? 0 : 60)); // 0 to 195
- QS('deskarea3x')['height'] = 'calc(100vh - ' + (75 + xh) + 'px)';
- QS('deskarea3x')['max-height'] = 'calc(100vh - ' + (75 + xh) + 'px)';
+ QV('deskarea1', true);
+ QV('deskarea4', true);
+ QV('xfooter', true);
+ QS('p11').bottom = '32px';
+ QS('deskarea0').overflow = null;
+ QS('deskarea3x').width = null;
+ QS('deskarea3x').height = QS('deskarea3x')['max-height'] = 'calc(100vh - 60px)';
+ QS('deskarea3x')['padding-right'] = null;
if (xtermActive) {
// XTerm terminal
- QS('termTable')['position'] = null;
- QS('termTable')['top'] = QS('termTable')['bottom'] = QS('termTable')['left'] = QS('termTable')['right'] = null;
+ //QS('termTable')['position'] = null;
+ //QS('termTable')['top'] = QS('termTable')['bottom'] = QS('termTable')['left'] = QS('termTable')['right'] = null;
} else {
// Legacy terminal
- QS('termTable')['height'] = 'calc(100vh - ' + (75 + xh) + 'px)';
- QS('termTable')['max-height'] = 'calc(100vh - ' + (75 + xh) + 'px)';
+ //QS('termTable')['height'] = 'calc(100vh - ' + (75 + xh) + 'px)';
+ //QS('termTable')['max-height'] = 'calc(100vh - ' + (75 + xh) + 'px)';
}
- if (browserfullscreen == true) { exitBrowserFullscreen(); browserfullscreen = false; }
}
- deskAdjust();
+
+ inputAllowed = true; // todo
+
+ // Show full screen buttons if needed
+ QV('deskkeybutton1', fullscreen);
+ if (xxcurrentView == 11) { // Desktop panel is being shown (11 = Desktop, 12 = Terminal)
+ // Move shortcut key to desktop position
+ QS('deskkeybutton2a').top = QS('deskkeybutton2b').top = '210px';
+ // Move the zoom button to normal or top position
+ QS('deskkeybutton5a').top = QS('deskkeybutton5b').top = (inputAllowed) ? '160px' : '60px'; // Zoom
+ QV('deskkeybutton2a', fullscreen && inputAllowed);
+ QV('deskkeybutton2b', false);
+ QV('deskkeybutton3a', fullscreen && inputAllowed);
+ QV('deskkeybutton3b', false);
+ QV('deskkeybutton4a', fullscreen && inputAllowed && (!desktop.m.SwapMouse));
+ QV('deskkeybutton4b', fullscreen && inputAllowed && (desktop.m.SwapMouse));
+ QV('deskkeybutton5a', fullscreen && (fullscreenzoom == 1));
+ QV('deskkeybutton5b', fullscreen && (fullscreenzoom != 1));
+ }
+ if (xxcurrentView == 12) {
+ // Move right buttons to terminal position
+ //QS('deskkeybutton3a').top = QS('deskkeybutton3b').top = '60px'; // Shortcuts
+ //QS('deskkeybutton5a').top = QS('deskkeybutton5b').top = '110px'; // Zoom
+ QS('deskkeybutton2a').top = QS('deskkeybutton2b').top = '110px'; // Keyboard
+ QV('deskkeybutton2a', fullscreen);
+ QV('deskkeybutton2b', false);
+ QV('deskkeybutton3a', fullscreen);
+ QV('deskkeybutton3b', false);
+ QV('deskkeybutton4a', false);
+ QV('deskkeybutton4b', false);
+ QV('deskkeybutton5a', false);
+ QV('deskkeybutton5a', false);
+ //QV('deskkeybutton5a', xterm.getOption('fontSize') == 15);
+ //QV('deskkeybutton5b', xterm.getOption('fontSize') != 15);
+ }
+
+ if (xxcurrentView == 11) { deskAdjust(); }
updateDesktopButtons();
- adjustPanels();
+ //adjustPanels();
//setTimeout(adjustPanels, 10);
//setTimeout(function() { xtermfit.fit(); }, 10);
if (xterm != null) { if (xxcurrentView == 12) { xtermfit.fit(); xterm.focus(); } }
@@ -911,57 +1056,100 @@
}
}
- function ondockeypress(e) {
+
+ var gotKeyPressEvent = false;
+ function ondeskkeypress(e, t) {
setSessionActivity();
- if (!xxdialogMode && desktop && isInputAllowed()) {
+ if (desktop && !xxdialogMode && (xxcurrentView == 11)) {
+ gotKeyPressEvent = true;
+ Q('softKeyboard').value = '';
// Check what keys we are allows to send
- /*
- if (currentNode != null) {
- var meshrights = GetNodeRights(currentNode);
- var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
- if (inputAllowed == false) return false;
- var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
- if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
- }
- */
+ var inputAllowed = true; // TODO
+ if (inputAllowed == false) return false;
return desktop.m.handleKeys(e);
}
+ if (terminal && !xxdialogMode && (xxcurrentView == 12) (t !== 1)) {
+ if (e.altKey == true) { return true; }
+ gotKeyPressEvent = true;
+ Q('softKeyboard').value = '';
+ var k = 0;
+ if (e.charCode != 0) { k = e.charCode; } else if (e.keyCode != 0) { k = e.keyCode; }
+ if (k != 0) {
+ if (terminal.urlname == 'sshterminalrelay.ashx') {
+ // SSH
+ terminal.socket.send('~' + String.fromCharCode(k));
+ } else {
+ // Agent
+ terminal.sendText(String.fromCharCode(k));
+ }
+ }
+ return false;
+ }
}
- function ondockeydown(e) {
+ function ondeskkeydown(e, t) {
setSessionActivity();
- if (!xxdialogMode && desktop && isInputAllowed()) {
+ if (desktop && !xxdialogMode && (xxcurrentView == 11)) {
+ gotKeyPressEvent = false;
+ Q('softKeyboard').value = '';
// Check what keys we are allows to send
- /*
- if (currentNode != null) {
- var meshrights = GetNodeRights(currentNode);
- var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
- if (inputAllowed == false) return false;
- var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
- if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
- }
- */
+ var inputAllowed = true; // TODO
+ if (inputAllowed == false) return false;
return desktop.m.handleKeyDown(e);
}
- }
-
- function ondockeyup(e) {
- setSessionActivity();
- if (!xxdialogMode && desktop && isInputAllowed()) {
- // Check what keys we are allows to send
- /*
- if (currentNode != null) {
- var meshrights = GetNodeRights(currentNode);
- var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
- if (inputAllowed == false) return false;
- var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
- if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
+ if (terminal && !xxdialogMode && (xxcurrentView == 12) && (t !== 1)) {
+ if (e.altKey == true) { return true; }
+ Q('softKeyboard').value = '';
+ gotKeyPressEvent = false;
+ var k = 0;
+ if (e.charCode != 0) { k = e.charCode; } else if (e.keyCode != 0) { k = e.keyCode; }
+ if (k == 8) { terminal.sendText(String.fromCharCode(k)); } // Enter and backspace
+ else if (e.ctrlKey && (k >= 64) && (k <= 95)) {
+ // Ctrl keys
+ if (terminal.urlname == 'sshterminalrelay.ashx') {
+ // SSH
+ terminal.socket.send('~' + String.fromCharCode(k - 64));
+ } else {
+ // Agent
+ terminal.sendText(String.fromCharCode(k - 64));
+ }
}
- */
- return desktop.m.handleKeyUp(e);
}
}
+ function ondeskkeyup(e, t) {
+ setSessionActivity();
+ if (desktop && !xxdialogMode && (xxcurrentView == 11)) {
+ var inputStr = Q('softKeyboard').value;
+ Q('softKeyboard').value = '';
+ // Check what keys we are allows to send
+ var inputAllowed = true; // TODO
+ if (inputAllowed == false) return false;
+ if ((gotKeyPressEvent == false) && (inputStr.length > 0) && desktop.m.SendKeyUnicode) {
+ // This is a mobile keyboard, we need to send that is in the input control.
+ var inputchar = inputStr[inputStr.length - 1].charCodeAt(0);
+ desktop.m.SendKeyUnicode(desktop.m.KeyAction.DOWN, inputchar);
+ desktop.m.SendKeyUnicode(desktop.m.KeyAction.UP, inputchar);
+ } else {
+ return desktop.m.handleKeyUp(e);
+ }
+ }
+ if (terminal && !xxdialogMode && (xxcurrentView == 12) && (gotKeyPressEvent == false) && (t !== 1)) {
+ if (e.altKey == true) { return true; }
+ var inputStr = Q('softKeyboard').value;
+ Q('softKeyboard').value = '';
+ if (terminal.urlname == 'sshterminalrelay.ashx') {
+ // SSH
+ terminal.socket.send('~' + inputStr);
+ } else {
+ // Agent
+ if (inputStr) terminal.sendText(inputStr);
+ }
+ return false;
+ }
+ }
+
+
// Remote desktop typing
function showDeskType() {
if (xxdialogMode || desktop == null || desktop.State != 3) return;
@@ -1043,136 +1231,6 @@
desktop.m.sendcad();
}
- /*
- // Show process dialogs
- function toggleDeskTools() {
- if (xxdialogMode) return;
- if (QS('DeskTools').display == 'none') {
- QV('DeskTools', true);
- Q('DeskTools').nodeid = currentNode._id;
- QH('DeskToolsProcesses', '');
- QH('DeskToolsServices', '');
- QV('deskToolsTopTabService', false);
- changeDeskToolTab(0)
- refreshDeskTools(0);
- refreshDeskTools(1);
- } else {
- QV('DeskTools', false);
- }
- }
-
- var deskToolTabSelection = 0;
- function changeDeskToolTab(tabnum) {
- deskToolTabSelection = tabnum;
- QV('DeskToolsProcessTab', tabnum == 0);
- QV('DeskToolsServiceTab', tabnum == 1);
- QS('deskToolsTopTabProcess')['bottom'] = (tabnum == 0) ? '0px' : '3px';
- QS('deskToolsTopTabService')['bottom'] = (tabnum == 1) ? '0px' : '3px';
- QS('deskToolsTopTabProcess')['color'] = (tabnum == 0) ? 'black' : 'gray';
- QS('deskToolsTopTabService')['color'] = (tabnum == 1) ? 'black' : 'gray';
- }
-
- // Refresh all of the desktop tool panels
- function refreshDeskTools(x) {
- var sel = (x == null) ? deskToolTabSelection : x;
- QV('DeskToolsRefreshButton', false);
- setTimeout(refreshDeskToolsEx, 500);
- if (sel == 0) meshserver.send({ action: 'msg', type: 'ps', nodeid: currentNode._id });
- if (sel == 1) meshserver.send({ action: 'msg', type: 'services', nodeid: currentNode._id });
- }
- function refreshDeskToolsEx() { QV('DeskToolsRefreshButton', true); }
- var deskTools = { sort: 1, ssort: 1, msg: null, smsg: null };
- function sortProcess(sort) { deskTools.sort = sort; showDeskToolsProcesses(deskTools.msg); }
- function sortService(sort) { deskTools.ssort = sort; showDeskToolsServices(deskTools.smsg); }
- function sortProcessPid(a, b) { if (a.p > b.p) return 1; if (a.p < b.p) return (-1); return sortProcessName(a, b); }
- function sortProcessName(a, b) { if (a.d > b.d) return 1; if (a.d < b.d) return (-1); return 0; }
- function showDeskToolsProcesses(message) {
- deskTools.msg = message;
- if (message == null) { QH('DeskToolsProcesses', ''); return; }
- if (Q('DeskTools').nodeid != message.nodeid) return;
- var p = [], processes = null;
- try { processes = JSON.parse(message.value); } catch (e) { }
- if (processes != null) {
- for (var pid in processes) { p.push({ p: parseInt(pid), c: processes[pid].cmd, d: processes[pid].cmd.toLowerCase(), u: processes[pid].user }); }
- if (deskTools.sort == 0) { p.sort(sortProcessPid); } else if (deskTools.sort == 1) { p.sort(sortProcessName); }
- var x = '';
- for (var i in p) {
- if (p[i].p != 0) {
- var c = p[i].c;
- if (c.length > 30) { c = '
' + EscapeHtml(c.substring(0, 30)) + '...' } else { c = EscapeHtml(c); }
- x += '
';
- }
- }
- QH('DeskToolsProcesses', x);
- }
- }
- function showDeskToolsServices(message) {
- deskTools.smsg = message;
- if (message == null) { QH('DeskToolsProcesses', ''); return; }
- if (Q('DeskTools').nodeid != message.nodeid) return;
- QV('deskToolsTopTabService', true);
- var s = [], services = null;
- try { services = JSON.parse(message.value); } catch (e) { }
- deskTools.services = services;
- if (services != null) {
- for (var i in services) {
- if (services[i].status) {
- // Windows
- s.push({ p: capitalizeFirstLetter(services[i].status.state.toLowerCase()), d: services[i].displayName, i: i });
- } else if (services[i].serviceType) {
- // Linux (TODO: This the service status is not displayed, not sure start/stop/restart will work).
- s.push({ p: services[i].serviceType, d: services[i].name, i: i });
- }
- }
- if (deskTools.ssort == 0) { s.sort(sortProcessPid); } else if (deskTools.ssort == 1) { s.sort(sortProcessName); }
- var x = '';
- for (var i in s) {
- if (s[i].p != 0) {
- var c = s[i].d;
- if (c.length > 30) { c = '
' + c.substring(0, 30) + '...' } else { c = EscapeHtml(c); }
- x += '
';
- }
- }
- QH('DeskToolsServices', x);
- }
- }
-
- function showServiceDetailsDialog(index) {
- if (xxdialogMode) return;
- var service = deskTools.services[index];
- if (service != null) {
- var x = '';
- if (service.name) { x += addHtmlValue("Name", service.name); }
- if (service.displayName) { x += addHtmlValue("Display name", service.displayName); }
- if (service.status) {
- if (service.status.state) { x += addHtmlValue("State", capitalizeFirstLetter(service.status.state.toLowerCase())); }
- if (service.status.pid) { x += addHtmlValue("PID", service.status.pid); }
- var serviceTypes = [];
- if (service.status.isFileSystemDriver === true) { serviceTypes.push("FileSystemDriver"); }
- if (service.status.isInteractive === true) { serviceTypes.push("Interactive"); }
- if (service.status.isKernelDriver === true) { serviceTypes.push("KernelDriver"); }
- if (service.status.isOwnProcess === true) { serviceTypes.push("OwnProcess"); }
- if (service.status.isSharedProcess === true) { serviceTypes.push("SharedProcess"); }
- if (serviceTypes.length > 0) { x += addHtmlValue("Type", serviceTypes.join(', ')); }
- }
- x += '
';
- setDialogMode(2, "Service Details", 8, null, x, name);
- }
- }
-
- function showServiceDetailsDialogEx(action, index) {
- setDialogMode(0);
- if (action == 0) return;
- var service = deskTools.services[index];
- if (service != null) {
- if (action == 1) { meshserver.send({ action: 'msg', type: 'serviceStart', nodeid: currentNode._id, serviceName: service.name }); }
- if (action == 2) { meshserver.send({ action: 'msg', type: 'serviceStop', nodeid: currentNode._id, serviceName: service.name }); }
- if (action == 3) { meshserver.send({ action: 'msg', type: 'serviceRestart', nodeid: currentNode._id, serviceName: service.name }); }
- setTimeout(function () { refreshDeskTools(1) }, 1000);
- }
- }
- */
-
// Toggle mouse and keyboard input
function toggleKvmControl() { QS('DeskControlSpan').color = Q('DeskControl').checked ? null : 'red'; }
@@ -1212,10 +1270,209 @@
dblClickDetectArgs.y = e.clientY;
}
- function dmousedown(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; if (!xxdialogMode && desktop != null && isInputAllowed()) { if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mousedown(e); desktop.m.sendKeepAlive(); } else { desktop.m.mousedown(e); } } dblClickDetect(e); }
- function dmouseup(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; if (!xxdialogMode && desktop != null && isInputAllowed()) if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mouseup(e); desktop.m.sendKeepAlive(); } else { desktop.m.mouseup(e); } }
- function dmousemove(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; if (!xxdialogMode && desktop != null && isInputAllowed()) { if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mousemove(e); desktop.m.sendKeepAlive(); } else { desktop.m.mousemove(e); } } }
- function dmousewheel(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; if (!xxdialogMode && desktop != null && isInputAllowed()) { if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mousewheel(e); desktop.m.sendKeepAlive(); } else { if (desktop.m.mousewheel) { desktop.m.mousewheel(e); } } haltEvent(e); return true; } return false; }
+ function dmousedown(e) { setSessionActivity(); if ((!xxdialogMode && desktop != null)) { if (fullscreen) { e.addx = Q('deskarea0').scrollLeft * (1 / fullscreenzoom); e.addy = Q('deskarea0').scrollTop * (1 / fullscreenzoom); } desktop.m.mousedown(e); } }
+ function dmouseup(e) { setSessionActivity(); if ((!xxdialogMode && desktop != null)) { if (fullscreen) { e.addx = Q('deskarea0').scrollLeft * (1 / fullscreenzoom); e.addy = Q('deskarea0').scrollTop * (1 / fullscreenzoom); } desktop.m.mouseup(e); } }
+ function dmousemove(e) { setSessionActivity(); if ((!xxdialogMode && desktop != null)) { if (fullscreen) { e.addx = Q('deskarea0').scrollLeft * (1 / fullscreenzoom); e.addy = Q('deskarea0').scrollTop * (1 / fullscreenzoom); } desktop.m.mousemove(e); } }
+ function dmousewheel(e) { setSessionActivity(); if ((!xxdialogMode && desktop != null) && desktop.m.mousewheel) { if (fullscreen) { e.addx = Q('deskarea0').scrollLeft * (1 / fullscreenzoom); e.addy = Q('deskarea0').scrollTop * (1 / fullscreenzoom); } desktop.m.mousewheel(e); haltEvent(e); return true; } return false; }
+
+ var keyboardShown = false;
+ var keyboardShownTimer = null;
+ var fullScreenMode = false;
+ function toggleKeyboard() {
+ if (xxdialogMode) return;
+ if (keyboardShownTimer != null) { clearTimeout(keyboardShownTimer); }
+ if (keyboardShown) { Q('softKeyboard').blur(); keyboardShown = false; } else { Q('softKeyboard').focus(); keyboardShown = true; }
+ QV('deskkeybutton2a', fullscreen && !keyboardShown);
+ QV('deskkeybutton2b', fullscreen && keyboardShown);
+ }
+
+ function keyboardFocusChange() {
+ keyboardShownTimer = setTimeout(function () {
+ keyboardShownTimer = null;
+ keyboardShown = (Q('softKeyboard') == document.activeElement);
+ QV('deskkeybutton2a', fullscreen && !keyboardShown);
+ QV('deskkeybutton2b', fullscreen && keyboardShown);
+ }, 100);
+ }
+
+ function exitButton() {
+ if (xxdialogMode) return;
+ QV('deskButtonMenu', false);
+ QV('termButtonMenu', false);
+ if (fullscreenzoom == 1) {
+ deskToggleFull();
+ } else {
+ deskChangeFullscreenZoom();
+ setTimeout(deskToggleFull, 10);
+ }
+ }
+
+ function deskMenuButton(x) {
+ toggleMenu(true);
+ deskSendKeys(x);
+ }
+
+
+ //
+ // Desktop Shortcut Keys
+ //
+
+ function updateDeskShortcutKeys() {
+ var x = ''; //'';
+ for (var i in deskKeyboardShortcuts) { x += ''; }
+ QH('deskButtonMenu', x);
+ }
+
+ var keyStrings = { 8: "BackSpace", 9: "Tab", 13: "Enter", 27: "Escape", 44: "Print Screen", 45: "Insert", 46: "Del", 36: "Home", 35: "End", 33: "Page Up", 34: "Page Down", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 0: "None" }
+
+ function keyShortcutTotext(n) {
+ var x = [];
+ if (n & 0x010000) { x.push("Shift"); }
+ if (n & 0x020000) { x.push("Alt"); }
+ if (n & 0x080000) { x.push("Ctrl"); }
+ if (n & 0x100000) { x.push("Win"); }
+ n = (n & 0xFFFF);
+ if ((n >= 112) && (n <= 123)) { x.push('F' + (n - 111)); } // Fx keys
+ else if ((n != 0) && (keyStrings[n])) { x.push(keyStrings[n]); }
+ else { if (n != 0) { x.push(String.fromCharCode(n)); } }
+ return x.join(' + ');
+ }
+
+ // Customize keyboard shortcuts
+ function deskCustomizeKeys() {
+ if (xxdialogMode) return;
+ var x = '
';
+ x += ' ' + "Win" + '';
+ x += '
';
+ QH('p10dialog2', x);
+ xxdialogMode = 2;
+ QV('p10dialog', true);
+ deskUpdateShortcutList();
+ }
+
+ function deskCustomizeKeysEx() {
+ QV('p10dialog', false);
+ xxdialogMode = 0;
+ //putstore('deskKeyShortcuts', deskKeyboardShortcuts.join(','));
+ updateDeskShortcutKeys();
+ }
+
+ function deskUpdateShortcutList() {
+ var x = '';
+ for (var i in deskKeyboardShortcuts) {
+ var kt = keyShortcutTotext(deskKeyboardShortcuts[i]), orderButtons = '';
+ if (i != (deskKeyboardShortcuts.length - 1)) { orderButtons += '
'; }
+ if (i != 0) { orderButtons += '
'; }
+ x += '
' + kt + '
' + orderButtons + '
';
+ }
+ if (x == '') { x = '
' + "No keyboard shortcuts defined" + ''; }
+ QH('d2shortcuts', x);
+ }
+
+ function deskCustomizeKeyDown(k) {
+ var i = deskKeyboardShortcuts.indexOf(k), x = deskKeyboardShortcuts[i + 1];
+ deskKeyboardShortcuts[i + 1] = deskKeyboardShortcuts[i];
+ deskKeyboardShortcuts[i] = x;
+ deskUpdateShortcutList();
+ }
+
+ function deskCustomizeKeyUp(k) {
+ var i = deskKeyboardShortcuts.indexOf(k), x = deskKeyboardShortcuts[i];
+ deskKeyboardShortcuts[i] = deskKeyboardShortcuts[i - 1];
+ deskKeyboardShortcuts[i - 1] = x;
+ deskUpdateShortcutList();
+ }
+
+ function removeDeskCustomizeKey(k) {
+ var na = [];
+ for (var i in deskKeyboardShortcuts) { if (deskKeyboardShortcuts[i] != k) { na.push(deskKeyboardShortcuts[i]); } }
+ deskKeyboardShortcuts = na;
+ deskUpdateShortcutList();
+ }
+
+ function addDeskCustomizeKey() {
+ var k = parseInt(Q('d2keySelect').value);
+ if (Q('d1kshift').checked) { k |= 0x010000; }
+ if (Q('d1kalt').checked) { k |= 0x020000; }
+ if (Q('d1kctrl').checked) { k |= 0x080000; }
+ if (Q('d1kwin').checked) { k |= 0x100000; }
+ if ((k > 0) && (deskKeyboardShortcuts.indexOf(k) == -1)) { deskKeyboardShortcuts.push(k); deskUpdateShortcutList(); }
+ }
+
+ // Remote desktop special key combos for Windows
+ function deskSendKeys(ks) {
+ if (xxdialogMode || desktop == null || desktop.State != 3) return;
+
+ // Construct the key command
+ if (ks == -1) { deskCustomizeKeys(); return; } // Customize
+ if (ks == 0x0A002E) { desktop.m.sendcad(); return; } // CTRL-ALT-DEL
+ //if ((desktop.contype == 1) && (ks == 0x10004C)) { desktop.sendCtrlMsg('{"action":"lock"}'); return; } // Lock desktop, WIN + L
+
+ var flags = (ks & 0xFF0000) >> 16, key = (ks & 0xFFFF), keyArray = [], keyArray2 = [];
+ var amtTranslate = {
+ 8: 0xff08, // BackSpace
+ 9: 0xff09, // Tab
+ 13: 0xff0d, // Return or Enter
+ 27: 0xff1b, // Escape
+ 45: 0xff63, // Insert
+ 46: 0xffff, // Delete
+ 36: 0xff50, // Home
+ 35: 0xff57, // End
+ 33: 0xff55, // Page Up
+ 34: 0xff56, // Page Down
+ 37: 0xff51, // Left arrow
+ 38: 0xff52, // Up arrow
+ 39: 0xff53, // Right arrow
+ 40: 0xff54, // Down arrow
+ 112: 0xffbe, // F1
+ 113: 0xffbf, // F2
+ 114: 0xffc0, // F3
+ 115: 0xffc1, // F4
+ 116: 0xffc2, // F5
+ 117: 0xffc3, // F6
+ 118: 0xffc4, // F7
+ 119: 0xffc5, // F8
+ 120: 0xffc6, // F9
+ 121: 0xffc7, // F10
+ 122: 0xffc8, // F11
+ 123: 0xffc9 // F12
+ }
+
+ // 0x010000 = Shift
+ // 0x020000 = Left-Alt
+ // 0x080000 = Ctrl
+ // 0x100000 = Window
+
+ if (desktop.contype == 2) {
+ // Intel AMT
+ if (flags & 1) { keyArray.push([0xffe1, 1]); keyArray2.push([0xffe1, 0]); } // Shift
+ if (flags & 2) { keyArray.push([0xffe9, 1]); keyArray2.push([0xffe9, 0]); } // Left-alt
+ if (flags & 8) { keyArray.push([0xffe3, 1]); keyArray2.push([0xffe3, 0]); } // Ctrl
+ if (flags & 16) { keyArray.push([0xffe7, 1]); keyArray2.push([0xffe7, 0]); } // Windows key
+ if (amtTranslate[key]) { key = amtTranslate[key]; }
+ if ((key >= 65) && (key <= 90)) { key += 32; }
+ if (key != 0) { keyArray.push([key, 1]); keyArray2.push([key, 0]); }
+ keyArray2.reverse();
+ for (var i = 0; i < keyArray2.length; i++) { keyArray.push(keyArray2[i]); }
+ desktop.m.sendkey(keyArray);
+ } else {
+ // Agent desktop
+ if (flags & 1) { keyArray.push([desktop.m.KeyAction.DOWN, 16]); keyArray2.push([desktop.m.KeyAction.UP, 16]); } // Shift
+ if (flags & 2) { keyArray.push([desktop.m.KeyAction.EXDOWN, 18]); keyArray2.push([desktop.m.KeyAction.EXUP, 18]); } // Left-alt
+ if (flags & 8) { keyArray.push([desktop.m.KeyAction.EXDOWN, 17]); keyArray2.push([desktop.m.KeyAction.EXUP, 17]); } // Ctrl
+ if (flags & 16) { keyArray.push([desktop.m.KeyAction.EXDOWN, 0x5B]); keyArray2.push([desktop.m.KeyAction.EXUP, 0x5B]); } // Windows key
+ if (key != 0) { keyArray.push([desktop.m.KeyAction.DOWN, key]); keyArray2.push([desktop.m.KeyAction.UP, key]); }
+ keyArray2.reverse();
+ for (var i = 0; i < keyArray2.length; i++) { keyArray.push(keyArray2[i]); }
+ desktop.m.SendKeyMsgKC(keyArray);
+ }
+ }
+
//
// Terminal
@@ -2191,6 +2448,8 @@
QH('xfooterMenu', '
' + x);
}
+ function center() { if (xtermfit) xtermfit.fit(); QS('dialog').left = ((((getDocWidth() - 300) / 2)) + 'px'); deskAdjust(); }
+ function getDocWidth() { if (window.innerWidth) return window.innerWidth; if (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientWidth != 0) return document.documentElement.clientWidth; return document.getElementsByTagName('body')[0].clientWidth; }
function messagebox(t, m) { setSessionActivity(); QH('id_dialogMessage', m); setDialogMode(1, t, 1); }
function statusbox(t, m) { setSessionActivity(); QH('id_dialogMessage', m); setDialogMode(1, t); }
function haltEvent(e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }