Implement basic UI in vnc_auto.html

This commit is contained in:
Malcolm Scott 2013-09-28 19:25:15 +01:00
parent b67a101d9e
commit a5753460b5
1 changed files with 41 additions and 3 deletions

View File

@ -50,9 +50,17 @@
<td><div id="noVNC_status" style="position: relative; height: auto;"> <td><div id="noVNC_status" style="position: relative; height: auto;">
Loading Loading
</div></td> </div></td>
<td width="1%"><div id="noVNC_buttons"> <td width="1%"><div id="noVNC_buttons" style="white-space: nowrap">
<input type=button value="Send CtrlAltDel" <input type=button value="Send CtrlAltDel"
id="sendCtrlAltDelButton"> id="sendCtrlAltDelButton">
<span id="xvp_buttons" style="display: none">
<input type=button value="Shutdown"
id="xvpShutdownButton">
<input type=button value="Reboot"
id="xvpRebootButton">
<input type=button value="Reset"
id="xvpResetButton">
</span>
</div></td> </div></td>
</tr></table> </tr></table>
</div> </div>
@ -90,6 +98,18 @@
rfb.sendCtrlAltDel(); rfb.sendCtrlAltDel();
return false; return false;
} }
function xvpShutdown() {
rfb.xvpShutdown();
return false;
}
function xvpReboot() {
rfb.xvpReboot();
return false;
}
function xvpReset() {
rfb.xvpReset();
return false;
}
function updateState(rfb, state, oldstate, msg) { function updateState(rfb, state, oldstate, msg) {
var s, sb, cad, level; var s, sb, cad, level;
s = $D('noVNC_status'); s = $D('noVNC_status');
@ -104,8 +124,12 @@
default: level = "warn"; break; default: level = "warn"; break;
} }
if (state === "normal") { cad.disabled = false; } if (state === "normal") {
else { cad.disabled = true; } cad.disabled = false;
} else {
cad.disabled = true;
xvpInit(0);
}
if (typeof(msg) !== 'undefined') { if (typeof(msg) !== 'undefined') {
sb.setAttribute("class", "noVNC_status_" + level); sb.setAttribute("class", "noVNC_status_" + level);
@ -113,11 +137,24 @@
} }
} }
function xvpInit(ver) {
var xvpbuttons;
xvpbuttons = $D('xvp_buttons');
if (ver >= 1) {
xvpbuttons.style.display = 'inline';
} else {
xvpbuttons.style.display = 'none';
}
}
window.onscriptsload = function () { window.onscriptsload = function () {
var host, port, password, path, token; var host, port, password, path, token;
$D('sendCtrlAltDelButton').style.display = "inline"; $D('sendCtrlAltDelButton').style.display = "inline";
$D('sendCtrlAltDelButton').onclick = sendCtrlAltDel; $D('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
$D('xvpShutdownButton').onclick = xvpShutdown;
$D('xvpRebootButton').onclick = xvpReboot;
$D('xvpResetButton').onclick = xvpReset;
WebUtil.init_logging(WebUtil.getQueryVar('logging', 'warn')); WebUtil.init_logging(WebUtil.getQueryVar('logging', 'warn'));
document.title = unescape(WebUtil.getQueryVar('title', 'noVNC')); document.title = unescape(WebUtil.getQueryVar('title', 'noVNC'));
@ -161,6 +198,7 @@
'shared': WebUtil.getQueryVar('shared', true), 'shared': WebUtil.getQueryVar('shared', true),
'view_only': WebUtil.getQueryVar('view_only', false), 'view_only': WebUtil.getQueryVar('view_only', false),
'updateState': updateState, 'updateState': updateState,
'onXvpInit': xvpInit,
'onPasswordRequired': passwordRequired}); 'onPasswordRequired': passwordRequired});
rfb.connect(host, port, password, path); rfb.connect(host, port, password, path);
}; };