1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 15:15:22 +00:00

console layout rearranged. fix indentation. add translate tags

This commit is contained in:
catborise 2020-01-23 15:45:41 +03:00
parent d95b5a4017
commit 34394c2b5e
3 changed files with 350 additions and 376 deletions

View file

@ -53,6 +53,7 @@
</head>
<body>
<div id='main_container' class="container">
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
@ -90,7 +91,7 @@
</div>
</div>
</nav>
<div id='main_container' class="container">
{% block content %}{% endblock %}
</div>
<script src="{% static "js/jquery.js" %}"></script>

View file

@ -26,7 +26,6 @@
{% load i18n %}
{% load staticfiles %}
{% block head %}
<title>WebVirtCloud - Spice Client - Full</title>
<script src="{% static "js/spice-html5/spicearraybuffer.js" %}"></script>
<script src="{% static "js/spice-html5/enums.js" %}"></script>
@ -58,29 +57,28 @@
<script src="{% static "js/spice-html5/resize.js" %}"></script>
<script src="{% static "js/spice-html5/filexfer.js" %}"></script>
<link rel="stylesheet" type="text/css" href="{% static "js/spice-html5/spice.css" %}" />
{% endblock %}
{% block content %}
<div id="login" hidden>
<span class="logo">SPICE</span>
<label for="host">Host:</label> <input type='text' id='host' value='{{ ws_host }}'> <!-- localhost -->
<label for="port">Port:</label> <input type='text' id='port' value='{{ ws_port }}'>
<label for="password">Password:</label> <input type='password' id='password' value='{{ console_passwd }}'>
<label for="show_console">Show console </label><input type="checkbox" id="show_console" value="1" onchange="toggle_console()" checked>
<button id="connectButton" onclick="connect();">Start</button>
<label for="host">{% trans 'Host' %}:</label> <input type='text' id='host' value='{{ ws_host }}'> <!-- localhost -->
<label for="port">{% trans 'Port' %}:</label> <input type='text' id='port' value='{{ ws_port }}'>
<label for="password">{% trans 'Password' %}:</label> <input type='password' id='password' value='{{ console_passwd }}'>
<label for="show_console">{% trans 'Show console' %}</label><input type="checkbox" id="show_console" value="1" onchange="toggle_console()" checked>
<button id="connectButton" onclick="connect();">{% trans 'Start' %}</button>
</div>
<div id="spice-area">
<div id="spice-screen" class="spice-screen"></div>
</div>
<div id="message-div" class="spice-message"></div>
</div>
<div id="debug-div">
<!-- If DUMPXXX is turned on, dumped images will go here -->
</div>
{% endblock %}
{% block foot %}
@ -89,13 +87,11 @@
var host = null, port = null;
var sc;
function spice_error(e)
{
function spice_error(e) {
disconnect();
}
function connect()
{
function connect() {
var host, port, password, scheme = "ws://", uri;
host = document.getElementById("host").value;
@ -105,7 +101,6 @@
}
password = document.getElementById("password").value;
if ((!host) || (!port)) {
console.log("must set host and port");
return;
@ -120,8 +115,7 @@
document.getElementById('connectButton').innerHTML = "Stop";
document.getElementById('connectButton').onclick = disconnect;
try
{
try {
sc = new SpiceMainConn({uri: uri, screen_id: "spice-screen", dump_id: "debug-div",
message_id: "message-div", password: password, onerror: spice_error, onagent: agent_connected });
}
@ -130,20 +124,16 @@
alert(e.toString());
disconnect();
}
}
function disconnect()
{
function disconnect() {
console.log(">> disconnect");
if (sc) {
sc.stop();
}
document.getElementById('connectButton').innerHTML = "Start";
document.getElementById('connectButton').onclick = connect;
if (window.File && window.FileReader && window.FileList && window.Blob)
{
if (window.File && window.FileReader && window.FileList && window.Blob) {
var spice_xfer_area = document.getElementById('spice-xfer-area');
document.getElementById('spice-area').removeChild(spice_xfer_area);
document.getElementById('spice-area').removeEventListener('dragover', handle_file_dragover, false);
@ -152,38 +142,32 @@
console.log("<< disconnect");
}
function agent_connected(sc)
{
function agent_connected(sc) {
window.addEventListener('resize', handle_resize);
window.spice_connection = this;
resize_helper(this);
if (window.File && window.FileReader && window.FileList && window.Blob)
{
if (window.File && window.FileReader && window.FileList && window.Blob) {
var spice_xfer_area = document.createElement("div");
spice_xfer_area.setAttribute('id', 'spice-xfer-area');
document.getElementById('spice-area').appendChild(spice_xfer_area);
document.getElementById('spice-area').addEventListener('dragover', handle_file_dragover, false);
document.getElementById('spice-area').addEventListener('drop', handle_file_drop, false);
}
else
{
else {
console.log("File API is not supported");
}
}
function toggle_console()
{
function toggle_console() {
var checkbox = document.getElementById('show_console');
var m = document.getElementById('message-div');
if (checkbox.checked)
{
if (checkbox.checked) {
m.style.display = 'block';
}
else
{
else {
m.style.display = 'none';
}

View file

@ -62,13 +62,11 @@
{% endblock %}
{% block content %}
<div id="spice-area">
<div id="spice-screen" class="spice-screen"></div>
</div>
<div id="message-div" class="spice-message"></div>
</div>
<div id="debug-div">
<!-- If DUMPXXX is turned on, dumped images will go here -->
@ -93,8 +91,7 @@
return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : defvalue;
}
function spice_error(e)
{
function spice_error(e) {
console.log(e);
disconnect();
if (e.message !== undefined) {
@ -105,8 +102,7 @@
}
}
function connect()
{
function connect() {
var host, port, password, scheme = "ws://", uri;
console.log('>> connect');
// By default, use the host and port of server that served this file
@ -159,17 +155,14 @@
uri += path[0] == '/' ? path : ('/' + path);
}
try
{
try {
sc = new SpiceMainConn({uri: uri, screen_id: "spice-screen", dump_id: "debug-div",
message_id: "message-div", password: password, onerror: spice_error, onagent: agent_connected });
}
catch (e)
{
catch (e) {
alert(e.toString());
disconnect();
}
console.log('<< connect')
}
@ -179,8 +172,7 @@
if (sc) {
sc.stop();
}
if (window.File && window.FileReader && window.FileList && window.Blob)
{
if (window.File && window.FileReader && window.FileList && window.Blob) {
var spice_xfer_area = document.getElementById('spice-xfer-area');
document.getElementById('spice-area').removeChild(spice_xfer_area);
document.getElementById('spice-area').removeEventListener('dragover', handle_file_dragover, false);
@ -189,23 +181,20 @@
console.log("<< disconnect");
}
function agent_connected(sc)
{
function agent_connected(sc) {
window.addEventListener('resize', handle_resize);
window.spice_connection = this;
resize_helper(this);
if (window.File && window.FileReader && window.FileList && window.Blob)
{
if (window.File && window.FileReader && window.FileList && window.Blob) {
var spice_xfer_area = document.createElement("div");
spice_xfer_area.setAttribute('id', 'spice-xfer-area');
document.getElementById('spice-area').appendChild(spice_xfer_area);
document.getElementById('spice-area').addEventListener('dragover', handle_file_dragover, false);
document.getElementById('spice-area').addEventListener('drop', handle_file_drop, false);
}
else
{
else {
console.log("File API is not supported");
}
}