Disabled ctrlAltDel button when N/A.

This commit is contained in:
Joel Martin 2010-06-15 17:56:38 -05:00
parent 63708ff5a8
commit 160fabf65c
2 changed files with 13 additions and 2 deletions

View File

@ -49,6 +49,7 @@ load: function(target) {
html += ' <td><div id="VNC_status">Loading</div></td>'; html += ' <td><div id="VNC_status">Loading</div></td>';
html += ' <td width=10%><div id="VNC_buttons">'; html += ' <td width=10%><div id="VNC_buttons">';
html += ' <input type=button value="Send CtrlAltDel"'; html += ' <input type=button value="Send CtrlAltDel"';
html += ' id="sendCtrlAltDelButton"';
html += ' onclick="DefaultControls.sendCtrlAltDel();"></div></td>'; html += ' onclick="DefaultControls.sendCtrlAltDel();"></div></td>';
html += ' </tr></table>'; html += ' </tr></table>';
html += ' </div>'; html += ' </div>';
@ -98,15 +99,18 @@ updateState: function(state, msg) {
s = $('VNC_status'); s = $('VNC_status');
sb = $('VNC_status_bar'); sb = $('VNC_status_bar');
c = $('VNC_connect_button'); c = $('VNC_connect_button');
cad = $('sendCtrlAltDelButton');
switch (state) { switch (state) {
case 'failed': case 'failed':
c.disabled = true; c.disabled = true;
cad.disabled = true;
klass = "VNC_status_error"; klass = "VNC_status_error";
break; break;
case 'normal': case 'normal':
c.value = "Disconnect"; c.value = "Disconnect";
c.onclick = DefaultControls.disconnect; c.onclick = DefaultControls.disconnect;
c.disabled = false; c.disabled = false;
cad.disabled = false;
klass = "VNC_status_normal"; klass = "VNC_status_normal";
break; break;
case 'disconnected': case 'disconnected':
@ -114,10 +118,12 @@ updateState: function(state, msg) {
c.onclick = DefaultControls.connect; c.onclick = DefaultControls.connect;
c.disabled = false; c.disabled = false;
cad.disabled = true;
klass = "VNC_status_normal"; klass = "VNC_status_normal";
break; break;
default: default:
c.disabled = true; c.disabled = true;
cad.disabled = true;
klass = "VNC_status_warn"; klass = "VNC_status_warn";
break; break;
} }

View File

@ -17,6 +17,7 @@ Connect parameters are provided in query string:
<td><div id="VNC_status">Loading</div></td> <td><div id="VNC_status">Loading</div></td>
<td width=10%><div id="VNC_buttons"> <td width=10%><div id="VNC_buttons">
<input type=button value="Send CtrlAltDel" <input type=button value="Send CtrlAltDel"
id="sendCtrlAltDelButton"
onclick="sendCtrlAltDel();"></div></td> onclick="sendCtrlAltDel();"></div></td>
</tr></table> </tr></table>
</div> </div>
@ -39,13 +40,17 @@ Connect parameters are provided in query string:
var s, sb, klass, html; var s, sb, klass, html;
s = $('VNC_status'); s = $('VNC_status');
sb = $('VNC_status_bar'); sb = $('VNC_status_bar');
cad = $('sendCtrlAltDelButton');
switch (state) { switch (state) {
case 'failed': klass = "VNC_status_error"; break; case 'failed': klass = "VNC_status_error"; break;
case 'normal': klass = "VNC_status_normal"; break; case 'normal': klass = "VNC_status_normal"; break;
case 'disconnected': klass = "VNC_status_normal"; break; case 'disconnected': klass = "VNC_status_normal"; break;
default: klass = "VNC_status_warn"; break; default: klass = "VNC_status_warn"; break;
} }
if (state === "normal") { cad.disabled = false; }
else { cad.disabled = true; }
if (typeof(msg) !== 'undefined') { if (typeof(msg) !== 'undefined') {
sb.setAttribute("class", klass); sb.setAttribute("class", klass);
s.innerHTML = msg; s.innerHTML = msg;