Added device and device group notes on mobile web site.

This commit is contained in:
Ylian Saint-Hilaire 2021-03-18 21:09:56 -07:00
parent 607849e0e7
commit 9c2a276087
7 changed files with 97 additions and 54 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

File diff suppressed because one or more lines are too long

View File

@ -78,7 +78,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
obj.UnGrabKeyInput(); obj.UnGrabKeyInput();
obj.UnGrabMouseInput(); obj.UnGrabMouseInput();
obj.touchenabled = 0; obj.touchenabled = 0;
if (obj.onScreenSizeChange != null) obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); if (obj.onScreenSizeChange != null) { obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); }
obj.Canvas.clearRect(0, 0, obj.CanvasId.width, obj.CanvasId.height); obj.Canvas.clearRect(0, 0, obj.CanvasId.width, obj.CanvasId.height);
} }
@ -193,6 +193,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
while (obj.PendingOperations.length > 0) { obj.PendingOperations.shift(); } while (obj.PendingOperations.length > 0) { obj.PendingOperations.shift(); }
obj.SendCompressionLevel(1); obj.SendCompressionLevel(1);
obj.SendUnPause(); obj.SendUnPause();
// No need to event the display size change now, it will be evented on first draw.
if (obj.onScreenSizeChange != null) { obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); } if (obj.onScreenSizeChange != null) { obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); }
} }
@ -520,7 +521,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
obj.Canvas.canvas.width = obj.ScreenWidth; obj.Canvas.canvas.width = obj.ScreenWidth;
obj.Canvas.canvas.height = obj.ScreenHeight; obj.Canvas.canvas.height = obj.ScreenHeight;
obj.Canvas.fillRect(0, 0, obj.ScreenWidth, obj.ScreenHeight); obj.Canvas.fillRect(0, 0, obj.ScreenWidth, obj.ScreenHeight);
if (obj.onScreenSizeChange != null) obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); if (obj.onScreenSizeChange != null) { obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); }
} }
obj.FirstDraw = false; obj.FirstDraw = false;
if (obj.debugmode > 1) { console.log("onResize: " + obj.ScreenWidth + " x " + obj.ScreenHeight); } if (obj.debugmode > 1) { console.log("onResize: " + obj.ScreenWidth + " x " + obj.ScreenHeight); }
@ -789,7 +790,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
obj.ScreenWidth = obj.Canvas.canvas.width; obj.ScreenWidth = obj.Canvas.canvas.width;
obj.ScreenHeight = obj.Canvas.canvas.height; obj.ScreenHeight = obj.Canvas.canvas.height;
if (obj.onScreenSizeChange != null) obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); if (obj.onScreenSizeChange != null) { console.log('s4', obj.ScreenWidth, obj.ScreenHeight); obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); }
return true; return true;
} }

View File

@ -2851,6 +2851,14 @@ a {
width: 28px; width: 28px;
} }
.viewSelector7 {
margin-left: 2px;
margin-top: 2px;
background: url(../images/views.png) -364px 0px;
height: 28px;
width: 28px;
}
.fulldesk .viewSelector5 { .fulldesk .viewSelector5 {
background: url(../images/views.png) -252px 0px; background: url(../images/views.png) -252px 0px;
} }

View File

@ -11945,10 +11945,17 @@
"zh-chs": "台式机", "zh-chs": "台式机",
"zh-cht": "台式電腦", "zh-cht": "台式電腦",
"xloc": [ "xloc": [
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarView->viewselect->5", "default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarView->viewselect->9",
"default.handlebars->container->column_l->p1->p1title->devListToolbarViewIcons",
"default.handlebars->container->column_l->p1->p1title->devListToolbarViewIcons" "default.handlebars->container->column_l->p1->p1title->devListToolbarViewIcons"
] ]
}, },
{
"en": "Desktops Fixed Width",
"xloc": [
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarView->viewselect->5"
]
},
{ {
"cs": "Podrobnosti", "cs": "Podrobnosti",
"de": "Details", "de": "Details",

View File

@ -1497,6 +1497,20 @@
updateDeviceDetails(getNodeFromId(message.nodeid), null, message); updateDeviceDetails(getNodeFromId(message.nodeid), null, message);
break; break;
} }
case 'getNotes': {
var n = Q('d2devNotes');
if (n && (message.id == decodeURIComponent(n.attributes['noteid'].value))) {
if (message.notes) { QH('d2devNotes', decodeURIComponent(message.notes)); } else { QH('d2devNotes', ''); }
var ro = (n.attributes['ro'].value == 'true');
if (ro == false) { // If we have permissions, set read/write on this note.
n.removeAttribute('readonly');
QE('idx_dlgOkButton', true);
QV('idx_dlgOkButton', true);
focusTextBox('d2devNotes');
}
}
break;
}
case 'otpauth-request': { case 'otpauth-request': {
if ((xxdialogMode == 2) && (xxdialogTag == 'otpauth-request')) { if ((xxdialogMode == 2) && (xxdialogTag == 'otpauth-request')) {
var secret = message.secret; var secret = message.secret;
@ -3244,8 +3258,9 @@
x += '</table><br />'; x += '</table><br />';
x += '<input type=button value=\"' + "Actions" + '\" onclick=deviceActionFunction() />'; x += '<input type=button value=\"' + "Actions" + '\" onclick=deviceActionFunction() />';
//x += '<input type=button value=Notes onclick=showNotes(' + ((meshrights & 128) == 0) + ',"' + encodeURIComponent(node._id) + '") />'; x += '<input type=button value=Notes onclick=showNotes(' + ((meshrights & 128) == 0) + ',"' + encodeURIComponent(node._id) + '") />';
//if ((connectivity & 1) && (meshrights & 8) && (node.agent.id < 5)) { x += '<input type=button value=Toast onclick=deviceToastFunction() />'; } //if ((connectivity & 1) && (meshrights & 8) && (node.agent.id < 5)) { x += '<input type=button value=Toast onclick=deviceToastFunction() />'; }
QH('p10html', x); QH('p10html', x);
// Show node last 7 days timeline // Show node last 7 days timeline
@ -3355,6 +3370,16 @@
setDialogMode(2, "Device Action", (count == 0) ? 1 : 3, deviceActionFunctionEx, x); setDialogMode(2, "Device Action", (count == 0) ? 1 : 3, deviceActionFunctionEx, x);
} }
function showNotes(readonly, noteid) {
if (xxdialogMode) return;
var x = '<textarea id=d2devNotes ro=' + readonly + ' noteid=' + noteid + ' readonly style=background-color:#fcf3cf;width:100%;height:200px;resize:none;overflow-y:scroll></textarea>';
if (noteid.startsWith('node%2F%2F')) { x += '<span style=font-size:10px>' + "Device group notes can be viewed and changed by other device group administrators." + '<span>'; }
setDialogMode(2, "Notes", 2, showNotesEx, x, noteid);
meshserver.send({ action: 'getNotes', id: decodeURIComponent(noteid) });
}
function showNotesEx(buttons, tag) { meshserver.send({ action: 'setNotes', id: decodeURIComponent(tag), notes: encodeURIComponentEx(Q('d2devNotes').value) }); }
function deviceChat(e) { function deviceChat(e) {
if (xxdialogMode) return; if (xxdialogMode) return;
setDialogMode(2, "Device Action", 3, function () { setDialogMode(2, "Device Action", 3, function () {
@ -5107,7 +5132,7 @@
x += addHtmlValue("Type", meshtype); x += addHtmlValue("Type", meshtype);
//x += addHtmlValue('Identifier', currentMesh._id.split('/')[2]); //x += addHtmlValue('Identifier', currentMesh._id.split('/')[2]);
//x += '<br><input type=button value=Notes onclick=showNotes(false,"' + encodeURIComponent(currentMesh._id) + '") />'; x += '<br><input type=button value=Notes onclick=showNotes(false,"' + encodeURIComponent(currentMesh._id) + '") />';
x += '<br style=clear:both><br>'; x += '<br style=clear:both><br>';
var currentMeshLinks = currentMesh.links[userinfo._id]; var currentMeshLinks = currentMesh.links[userinfo._id];

View File

@ -238,6 +238,7 @@
<div tabindex=0 id=devViewButton1 class=viewSelector onclick=onDeviceViewChange(1) onkeypress="if (event.key == 'Enter') { onDeviceViewChange(1); }" title="Columns"><div class="viewSelector2"></div></div> <div tabindex=0 id=devViewButton1 class=viewSelector onclick=onDeviceViewChange(1) onkeypress="if (event.key == 'Enter') { onDeviceViewChange(1); }" title="Columns"><div class="viewSelector2"></div></div>
<div tabindex=0 id=devViewButton2 class=viewSelector onclick=onDeviceViewChange(2) onkeypress="if (event.key == 'Enter') { onDeviceViewChange(2); }" title="List"><div class="viewSelector1"></div></div> <div tabindex=0 id=devViewButton2 class=viewSelector onclick=onDeviceViewChange(2) onkeypress="if (event.key == 'Enter') { onDeviceViewChange(2); }" title="List"><div class="viewSelector1"></div></div>
<div tabindex=0 id=devViewButton3 class=viewSelector onclick=onDeviceViewChange(3) onkeypress="if (event.key == 'Enter') { onDeviceViewChange(3); }" title="Desktops"><div class="viewSelector3"></div></div> <div tabindex=0 id=devViewButton3 class=viewSelector onclick=onDeviceViewChange(3) onkeypress="if (event.key == 'Enter') { onDeviceViewChange(3); }" title="Desktops"><div class="viewSelector3"></div></div>
<div tabindex=0 id=devViewButton5 class=viewSelector onclick=onDeviceViewChange(5) onkeypress="if (event.key == 'Enter') { onDeviceViewChange(5); }" title="Desktops"><div class="viewSelector7"></div></div>
<div tabindex=0 id=devViewButton4 class=viewSelector onclick=onDeviceViewChange(4) onkeypress="if (event.key == 'Enter') { onDeviceViewChange(4); }" title="Map" style="display:none"><div class="viewSelector4"></div></div> <div tabindex=0 id=devViewButton4 class=viewSelector onclick=onDeviceViewChange(4) onkeypress="if (event.key == 'Enter') { onDeviceViewChange(4); }" title="Map" style="display:none"><div class="viewSelector4"></div></div>
</div><div><h1>My Devices</h1></div> </div><div><h1>My Devices</h1></div>
</div> </div>
@ -283,8 +284,9 @@
<select id=viewselect onchange=onDeviceViewChange()> <select id=viewselect onchange=onDeviceViewChange()>
<option value=1>Columns</option> <option value=1>Columns</option>
<option value=2>List</option> <option value=2>List</option>
<option value=3>Desktops</option> <option value=3>Desktops Fixed Width</option>
<option id=viewselectmapoption value=4 style="display:none">Map</option> <option id=viewselectmapoption value=4 style="display:none">Map</option>
<option value=5>Desktops</option>
</select> </select>
</div> </div>
<div style="display:none" id=devListToolbarSort> <div style="display:none" id=devListToolbarSort>
@ -3357,7 +3359,7 @@
function onDeviceViewChange(i) { function onDeviceViewChange(i) {
if (i != null) { Q('viewselect').value = i; } if (i != null) { Q('viewselect').value = i; }
for (var j = 1; j < 5; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); } for (var j = 1; j < 6; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); }
Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel'); Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel');
putstore('deviceView', Q('viewselect').value); putstore('deviceView', Q('viewselect').value);
putstore('viewsize', Q('sizeselect').value); putstore('viewsize', Q('sizeselect').value);
@ -3521,16 +3523,16 @@
function updateDevices() { function updateDevices() {
if ((nodes == null) || (xxcurrentView != 1)) { return; } if ((nodes == null) || (xxcurrentView != 1)) { return; }
var r = '', c = 0, current = null, count = 0, scount = 0, displayedMeshes = {}, view = Q('viewselect').value, groups = {}, groupCount = {}; var r = '', c = 0, current = null, count = 0, scount = 0, displayedMeshes = {}, view = Q('viewselect').value, groups = {}, groupCount = {};
QV('xdevices', view < 4); QV('xdevices', view != 4);
QV('xdevicesmap', view == 4); QV('xdevicesmap', view == 4);
QV('devListToolbar', view < 3); QV('devListToolbar', view < 3);
QV('kvmListToolbar', view == 3); QV('kvmListToolbar', (view == 3) || (view == 5));
QV('devMapToolbar', view == 4); QV('devMapToolbar', view == 4);
QV('devListToolbarSize', view == 3); QV('devListToolbarSize', (view == 3) || (view == 5));
QV('NoMeshesPanel', (nodes.length == 0) && (meshcount == 0)); QV('NoMeshesPanel', (nodes.length == 0) && (meshcount == 0));
//QV('devListToolbarView', (meshcount != 0) && (nodes.length > 0)); //QV('devListToolbarView', (meshcount != 0) && (nodes.length > 0));
QV('devListToolbarViewIcons', nodes.length > 0); QV('devListToolbarViewIcons', nodes.length > 0);
QV('devListToolbarSort', (nodes.length > 0) && (view < 4)); QV('devListToolbarSort', (nodes.length > 0) && (view != 4));
if (nodes.length == 0) { view = 1; sort = 0; } if (nodes.length == 0) { view = 1; sort = 0; }
if (view == 4) { if (view == 4) {
setTimeout( function() { if (xxmap.map != null) { xxmap.map.updateSize(); } }, 200); setTimeout( function() { if (xxmap.map != null) { xxmap.map.updateSize(); } }, 200);
@ -3564,7 +3566,7 @@
if (sort == 0) { if (sort == 0) {
// Mesh header // Mesh header
if (((meshes[node.meshid]?node.meshid:'*') != current)) { if (((meshes[node.meshid]?node.meshid:'*') != current)) {
if (((view == 1) || (view == 3)) && (current != null)) { r += '</div>'; } // Close collapse div if (((view == 1) || (view == 3) || (view == 5)) && (current != null)) { r += '</div>'; } // Close collapse div
deviceHeaderSet(); deviceHeaderSet();
var extra = ''; var extra = '';
if (view == 2) { r += '<tr><td colspan=5>'; } if (view == 2) { r += '<tr><td colspan=5>'; }
@ -3574,7 +3576,7 @@
r += '<div class=DevSt style=width:100%;padding-top:4px><span style=float:right>'; r += '<div class=DevSt style=width:100%;padding-top:4px><span style=float:right>';
r += '<span id=DevxHeader' + deviceHeaderId + ' class=devHeaderx></span>' + extra; r += '<span id=DevxHeader' + deviceHeaderId + ' class=devHeaderx></span>' + extra;
r += '</span>'; r += '</span>';
if ((view == 1) || (view == 2) || (view == 3)) { if ((view == 1) || (view == 2) || (view == 3) || (view == 5)) {
var collapsed = CollapsedGroups[node.meshid]; var collapsed = CollapsedGroups[node.meshid];
r += '<img class=collapseImage cmenu=expandAllContextMenu id="DevxColImg' + deviceHeaderId + '" src=images/c' + ((collapsed === true)?'1':'2') + '.png height=8 width=8 style=margin-left:2px;margin-right:2px;cursor:pointer onclick=toggleCollapseGroup("' + deviceHeaderId + '","' + node.meshid + '",' + view + ')></img>'; // Collapse action r += '<img class=collapseImage cmenu=expandAllContextMenu id="DevxColImg' + deviceHeaderId + '" src=images/c' + ((collapsed === true)?'1':'2') + '.png height=8 width=8 style=margin-left:2px;margin-right:2px;cursor:pointer onclick=toggleCollapseGroup("' + deviceHeaderId + '","' + node.meshid + '",' + view + ')></img>'; // Collapse action
} }
@ -3588,19 +3590,19 @@
if (view == 2) { r += '</div>'; } if (view == 2) { r += '</div>'; }
displayedMeshes[current] = 1; displayedMeshes[current] = 1;
c = 0; c = 0;
if ((view == 1) || (view == 3)) { r += '<div id=DevxCol' + deviceHeaderId + ((collapsed === true)?' style=display:none':'') + '>'; } // Open collapse div if ((view == 1) || (view == 3) || (view == 5)) { r += '<div id=DevxCol' + deviceHeaderId + ((collapsed === true)?' style=display:none':'') + '>'; } // Open collapse div
} }
} else if (sort == 1) { } else if (sort == 1) {
// Power header // Power header
var pwr = node.pwr?node.pwr:0; var pwr = node.pwr?node.pwr:0;
if (pwr !== current) { if (pwr !== current) {
if (((view == 1) || (view == 3)) && (current != null)) { r += '</div>'; } // Close collapse div if (((view == 1) || (view == 3) || (view == 5)) && (current != null)) { r += '</div>'; } // Close collapse div
deviceHeaderSet(); deviceHeaderSet();
if ((view == 1) && (current !== null)) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } if (r != '') { r += '</tr></table>'; } } if ((view == 1) && (current !== null)) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } if (r != '') { r += '</tr></table>'; } }
if (view == 2) { r += '<tr><td colspan=5>'; } if (view == 2) { r += '<tr><td colspan=5>'; }
r += '<div class=DevSt style=width:100%;padding-top:4px><span id=DevxHeader' + deviceHeaderId + ' class=devHeaderx style=float:right></span>'; r += '<div class=DevSt style=width:100%;padding-top:4px><span id=DevxHeader' + deviceHeaderId + ' class=devHeaderx style=float:right></span>';
if ((view == 1) || (view == 2) || (view == 3)) { if ((view == 1) || (view == 2) || (view == 3) || (view == 5)) {
var collapsed = CollapsedGroups['pwr:' + pwr]; var collapsed = CollapsedGroups['pwr:' + pwr];
r += '<img class=collapseImage cmenu=expandAllContextMenu id="DevxColImg' + deviceHeaderId + '" src=images/c' + ((collapsed === true)?'1':'2') + '.png height=8 width=8 style=margin-left:2px;margin-right:2px;cursor:pointer onclick=toggleCollapseGroup("' + deviceHeaderId + '","pwr:' + pwr + '",' + view + ')></img>'; // Collapse action r += '<img class=collapseImage cmenu=expandAllContextMenu id="DevxColImg' + deviceHeaderId + '" src=images/c' + ((collapsed === true)?'1':'2') + '.png height=8 width=8 style=margin-left:2px;margin-right:2px;cursor:pointer onclick=toggleCollapseGroup("' + deviceHeaderId + '","pwr:' + pwr + '",' + view + ')></img>'; // Collapse action
} }
@ -3608,7 +3610,7 @@
current = pwr; current = pwr;
c = 0; c = 0;
if ((view == 1) || (view == 3)) { r += '<div id=DevxCol' + deviceHeaderId + ((collapsed === true)?' style=display:none':'') + '>'; } // Open collapse div if ((view == 1) || (view == 3) || (view == 5)) { r += '<div id=DevxCol' + deviceHeaderId + ((collapsed === true)?' style=display:none':'') + '>'; } // Open collapse div
} }
} else if (sort == 2) { } else if (sort == 2) {
// Device header // Device header
@ -3626,10 +3628,10 @@
else if ((sort == 3) || (sort == 4)) { collapseName = 'tag:**xx**xx*TaG*xx**xx**'; } else if ((sort == 3) || (sort == 4)) { collapseName = 'tag:**xx**xx*TaG*xx**xx**'; }
var collapsed = (sort != 3) & (sort != 4) & CollapsedGroups[collapseName]; var collapsed = (sort != 3) & (sort != 4) & CollapsedGroups[collapseName];
r += '<tr name=xxdevice2 colname=DevxCol' + collapseName + ' style=height:20px' + (collapsed?';display:none':'') + ' id=xv2' + node._id + '></tr>'; r += '<tr name=xxdevice2 colname=DevxCol' + collapseName + ' style=height:20px' + (collapsed?';display:none':'') + ' id=xv2' + node._id + '></tr>';
} else if ((view == 3) && (node.conn & 1) && (((meshrights & 8) || (meshrights & 256)) != 0) && ((node.agent.caps & 1) != 0)) { // Check if we have rights and agent is capable of KVM. } else if (((view == 3) || (view == 5)) && (node.conn & 1) && (((meshrights & 8) || (meshrights & 256)) != 0) && ((node.agent.caps & 1) != 0)) { // Check if we have rights and agent is capable of KVM.
// Draw the device (TODO: See if we can replace this with a standin in the future) // Draw the device (TODO: See if we can replace this with a standin in the future)
if ((Object.keys(checkedNodeids).length == 0) || checkedNodeids[node._id]) { if ((Object.keys(checkedNodeids).length == 0) || checkedNodeids[node._id]) {
r += updateDeviceViewHtml(3, null, node); r += updateDeviceViewHtml(view, null, node);
kvmDivs.push(node._id); kvmDivs.push(node._id);
} }
} }
@ -3643,7 +3645,7 @@
var collapsed = CollapsedGroups['tag:' + tag]; var collapsed = CollapsedGroups['tag:' + tag];
var r2 = r.replace('**xx**xx*TaG*xx**xx**', encodeURIComponentEx(tag) + (collapsed?' style=display:none':'')); var r2 = r.replace('**xx**xx*TaG*xx**xx**', encodeURIComponentEx(tag) + (collapsed?' style=display:none':''));
if (groups[tag] == null) { groups[tag] = r2; groupCount[tag] = 1; } else { groups[tag] += r2; groupCount[tag] += 1; } if (groups[tag] == null) { groups[tag] = r2; groupCount[tag] = 1; } else { groups[tag] += r2; groupCount[tag] += 1; }
if (view == 3) break; if ((view == 3) || (view == 5)) break;
} }
} }
r = ''; r = '';
@ -3762,21 +3764,24 @@
p1updateInfo(); p1updateInfo();
// Take care of KVM surfaces in desktop view mode // Take care of KVM surfaces in desktop view mode
if ((view == 3) && (xxcurrentView == 1)) { if (((view == 3) || (view == 5)) && (xxcurrentView == 1)) {
// Figure out and adjust the size to fill the width of the div // Figure out and adjust the size to fill the width of the div
var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex]; var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex];
//var realw = vsize.x + 2, tw = Q('xdevices').clientWidth - 30, xw = Math.floor(tw / realw); if ((view == 3)) { // If we are in fixed width mode, correct the size for the screen width.
var realw = vsize.x + 2, tw = totalDeviceViewWidth - 5, xw = Math.floor(tw / realw); var realw = vsize.x + 2, tw = totalDeviceViewWidth - 5, xw = Math.floor(tw / realw);
xw = realw + Math.floor((tw - (xw * realw)) / xw); xw = realw + Math.floor((tw - (xw * realw)) / xw);
vsize.y = vsize.y * (xw / vsize.x); vsize.y = vsize.y * (xw / vsize.x);
vsize.x = xw; vsize.x = xw;
}
for (var i in multiDesktop) { multiDesktop[i].xxdelete = true; } for (var i in multiDesktop) { multiDesktop[i].xxdelete = true; }
for (var i in kvmDivs) { for (var i in kvmDivs) {
var id = kvmDivs[i], shortid = id.split('/')[2], desk = multiDesktop[id]; var id = kvmDivs[i], shortid = id.split('/')[2], desk = multiDesktop[id];
if (desk != null) { if (desk != null) {
// This device already has a canvas, use it. // This device already has a canvas, use it.
desk.m.CanvasId.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px'); var width = (view == 5)?((desk.m.width * vsize.y) / desk.m.height):vsize.x;
desk.m.CanvasId.setAttribute('style', 'background-color:black;width:' + width + 'px;height:' + vsize.y + 'px');
Q('xkvmid_' + shortid).appendChild(desk.m.CanvasId); Q('xkvmid_' + shortid).appendChild(desk.m.CanvasId);
delete desk.xxdelete; delete desk.xxdelete;
QH('skvmid_' + shortid, ["Disconnected", "Connecting...", "Setup...", '', ''][((desk.m.State == null)?desk.m.state:desk.m.State)]); QH('skvmid_' + shortid, ["Disconnected", "Connecting...", "Setup...", '', ''][((desk.m.State == null)?desk.m.state:desk.m.State)]);
@ -3785,8 +3790,9 @@
if ((desktopNode == node) && (desktop != null)) { // Check if the main desktop is this device, if it is, use that. if ((desktopNode == node) && (desktop != null)) { // Check if the main desktop is this device, if it is, use that.
// This device already has a canvas, use it. // This device already has a canvas, use it.
var c = desktop.m.CanvasId; var c = desktop.m.CanvasId;
var width = (view == 5)?((desktop.m.width * vsize.y) / desktop.m.height):vsize.x;
c.setAttribute('id', 'kvmid_' + shortid); c.setAttribute('id', 'kvmid_' + shortid);
c.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px'); c.setAttribute('style', 'background-color:black;width:' + width + 'px;height:' + vsize.y + 'px');
c.setAttribute('onclick', 'toggleKvmDevice(\'' + id + '\')'); c.setAttribute('onclick', 'toggleKvmDevice(\'' + id + '\')');
c.removeAttribute('onmousedown'); c.removeAttribute('onmousedown');
c.removeAttribute('onmouseup'); c.removeAttribute('onmouseup');
@ -3977,12 +3983,12 @@
r += '<div class=style10 style=cursor:pointer;font-size:14px title="' + title + '" onclick=gotoDevice(\'' + node._id + '\',null,null,event)><span style=width:300px>' + name + '</span></div></div>' + devNotify + '</td>'; r += '<div class=style10 style=cursor:pointer;font-size:14px title="' + title + '" onclick=gotoDevice(\'' + node._id + '\',null,null,event)><span style=width:300px>' + name + '</span></div></div>' + devNotify + '</td>';
r += '<td style=text-align:center>' + getUserShortStr(node) + '<td style=text-align:center>' + (node.ip != null ? node.ip : '') + '<td style=text-align:center>' + states.join('&nbsp;+&nbsp;'); r += '<td style=text-align:center>' + getUserShortStr(node) + '<td style=text-align:center>' + (node.ip != null ? node.ip : '') + '<td style=text-align:center>' + states.join('&nbsp;+&nbsp;');
div.innerHTML = r; div.innerHTML = r;
} else if (view == 3) { } else if ((view == 3) || (view == 5)) {
// Draw the device and canvas // Draw the device and canvas
var r = '<div id=devs cmenu=devsContentMenu style=display:inline-block;position:relative;margin:1px;background-color:lightgray;border-radius:5px;position:relative><div tabindex=0 style=padding:3px;cursor:pointer onclick=gotoDevice(\'' + node._id + '\',11,null,event) onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',11,null,event)">' + devNotify; var r = '<div id=devs cmenu=devsContentMenu style=display:inline-block;position:relative;margin:1px;background-color:lightgray;border-radius:5px;position:relative><div tabindex=0 style=padding:3px;cursor:pointer onclick=gotoDevice(\'' + node._id + '\',11,null,event) onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',11,null,event)">' + devNotify;
//r += '<input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox style=float:left>'; //r += '<input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox style=float:left>';
r += '<div class="j' + icon + '" style=width:16px;float:left></div>&nbsp;' + name + '</div>'; r += '<div class="j' + icon + '" style=width:16px;float:left></div>&nbsp;' + name + '</div>';
r += '<span onclick=gotoDevice(\'' + node._id + '\',null,null,event)></span><div id=xkvmid_' + node._id.split('/')[2] + '><div id=skvmid_' + node._id.split('/')[2] + ' tabindex=0 style="position:absolute;color:white;left:5px;top:27px;text-shadow:0px 0px 5px #000;z-index:1000;cursor:default" onclick=toggleKvmDevice(\'' + node._id + '\') onkeypress="if (event.key==\'Enter\') toggleKvmDevice(\'' + node._id + '\')">' + "Disconnected" + '</div></div>'; r += '<span onclick=gotoDevice(\'' + node._id + '\',null,null,event)></span><div id=xkvmid_' + node._id.split('/')[2] + '><div id=skvmid_' + node._id.split('/')[2] + ' tabindex=0 style="position:absolute;color:white;left:5px;top:27px;text-shadow:0px 0px 5px #000;z-index:10;cursor:default" onclick=toggleKvmDevice(\'' + node._id + '\') onkeypress="if (event.key==\'Enter\') toggleKvmDevice(\'' + node._id + '\')">' + "Disconnected" + '</div></div>';
r += '</div>'; r += '</div>';
return r; return r;
} }
@ -4164,8 +4170,7 @@
desk.m.useZRLE = true; desk.m.useZRLE = true;
desk.m.showmouse = true; desk.m.showmouse = true;
desk.m.onKvmData = function (data) { console.log('KVM Data received in multi-desktop mode, this is not supported.'); }; // KVM Data Channel not supported in multi-desktop right now. desk.m.onKvmData = function (data) { console.log('KVM Data received in multi-desktop mode, this is not supported.'); }; // KVM Data Channel not supported in multi-desktop right now.
//desk.m.onScreenSizeChange = deskAdjust; desk.m.onScreenSizeChange = mdeskAdjust; // Multi-Desktop Adjust
if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust
desk.Start(nodeid, 16994, '*', '*', 0); desk.Start(nodeid, 16994, '*', '*', 0);
desk.contype = 2; desk.contype = 2;
multiDesktop[nodeid] = desk; multiDesktop[nodeid] = desk;
@ -4183,8 +4188,8 @@
if (multidesktopsettings.swapmouse) { desk.m.SwapMouse = multidesktopsettings.swapmouse; } if (multidesktopsettings.swapmouse) { desk.m.SwapMouse = multidesktopsettings.swapmouse; }
if (multidesktopsettings.remotekeymap == true) { desk.m.remoteKeyMap = multidesktopsettings.remotekeymap; } if (multidesktopsettings.remotekeymap == true) { desk.m.remoteKeyMap = multidesktopsettings.remotekeymap; }
//desk.m.onDisplayinfo = deskDisplayInfo; //desk.m.onDisplayinfo = deskDisplayInfo;
//desk.m.onScreenSizeChange = deskAdjust; desk.m.onScreenSizeChange = mdeskAdjust; // Multi-Desktop Adjust
if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust //if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; }
desk.Start(nodeid); desk.Start(nodeid);
desk.contype = 1; desk.contype = 1;
multiDesktop[nodeid] = desk; multiDesktop[nodeid] = desk;
@ -7121,7 +7126,7 @@
QV('d7meshkvm', (webRtcDesktop) || ((currentNode.agent != null) && (currentNode.agent.caps & 1) && ((deskState == false) || (desktop.contype == 1)))); QV('d7meshkvm', (webRtcDesktop) || ((currentNode.agent != null) && (currentNode.agent.caps & 1) && ((deskState == false) || (desktop.contype == 1))));
// Enable buttons // Enable buttons
var inputAllowed = (currentNode.agent.id != 14) && ((rights == 0xFFFFFFFF) || (((rights & 8) != 0) && ((rights & 256) == 0) && ((rights & 4096) == 0))); var inputAllowed = ((currentNode.agent == null) || (currentNode.agent.id != 14)) && ((rights == 0xFFFFFFFF) || (((rights & 8) != 0) && ((rights & 256) == 0) && ((rights & 4096) == 0)));
var online = ((currentNode.conn & 1) != 0); // If Agent (1) connected, enable remote desktop var online = ((currentNode.conn & 1) != 0); // If Agent (1) connected, enable remote desktop
QE('connectbutton1', online); QE('connectbutton1', online);
var hwonline = ((currentNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal var hwonline = ((currentNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal
@ -7561,6 +7566,7 @@
} }
function deskAdjust() { function deskAdjust() {
//if (xxcurrentView == 1) return;
var parentH = Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth; var parentH = Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth;
var deskH = Q('Desk').height, deskW = Q('Desk').width; var deskH = Q('Desk').height, deskW = Q('Desk').width;
@ -7603,24 +7609,20 @@
} }
} }
function mdeskAdjust(mod, sw, sh, cv) { function mdeskAdjust(module, sw, sh, cv) {
if (!mod || !sw || !sh || !cv) return; if (!module || !sw || !sh || !cv) return;
var view = Q('viewselect').value;
if ((view != 3) && (view != 5)) return;
// Check if we are in single desktop mode // Check if we are in single desktop mode
if (cv.id == 'Desk') { deskAdjust(); return; } if (cv.id == 'Desk') { deskAdjust(); return; }
// Figure out and adjust the size to fill the width of the div if (view == 5) { // If not in fixed width mode, compute the with
var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex]; var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex];
var realw = vsize.x + 2, tw = Q('xdevices').clientWidth - 30, xw = Math.floor(tw / realw); QS(cv.id)['width'] = ((module.State != 0)?((sw * vsize.y) / sh):(vsize.x)) + 'px';
xw = realw + Math.floor((tw - (xw * realw)) / xw); }
vsize.y = vsize.y * (xw / vsize.x); QS(cv.id)['margin-top'] = null;
vsize.x = xw; QS(cv.id)['margin-bottom'] = null;
var mh = vsize.y, mw = vsize.x;
if (mod.State != 0) { mh = vsize.y; mw = (sw / sh) * vsize.y; }
QS(cv.id)['max-height'] = mh + 'px';
QS(cv.id)['max-width'] = mw + 'px';
QS(cv.id)['margin-top'] = '0';
QS(cv.id)['margin-bottom'] = '0';
} }
// Press ESC key // Press ESC key