diff --git a/app/custom.js b/app/custom.js deleted file mode 100644 index f2332fa40f42d0c03ec64ffd2f7c26a8e8f8e57c..0000000000000000000000000000000000000000 --- a/app/custom.js +++ /dev/null @@ -1,43 +0,0 @@ -/*This is the custom file made by OPENSLX members to integrate -noVNC with our own website*/ - - -/* about 'onunload' and 'onbefore unload': - -onunload is responsible for executing an instruction when the -page is closed. It also causes issue with IE and AJAX. - -onbeforeunload is more efficient because it does not run in -competition with the actual closing of the window and is triggered before onunload - -I know Opera used to not acknowledge onbeforeunload - not sure if -they've fixed that, but I always register the listener for both to be safe: - -window.onunload = window.onbeforeunload = (function(){...*/ - -//this is called whenever the user refreshes/goes back or forward/goes to a new url/closes the tab -$(window).on('beforeunload', function(){ - //if you want an event that happens only when the 'x' button is clicked then refer to: - // http://stackoverflow.com/questions/20853142/trying-to-detect-browser-close-event - //and look at the second answer - - console.log('root says bye byee'); //this is working but alerts aren't working - //TODO:send message to the server to shut down the VM - - return 'something'; -}); - -/*TODO: under systems management/modules make a button to 'install' software in -the VM. into that page's HTML we already have the imgid, token and imgtoken. -Just send all of it to the server so it knows which VM to turn on. - -After that the server should fire the taskmanager to actually oṕen the vm -and fire the following commands in different processes: - -virt-run.sh iso - -./utils/launch.sh --vnc localhost:5930 - - -The second command returns a link to access the VM. This link should be sent to the client. -TODO: restrict the webpage pointed by the link ONLY to the user who OWNS the VM. diff --git a/app/images/handle_hz.svg b/app/images/handle_hz.svg new file mode 100644 index 0000000000000000000000000000000000000000..4877ca1adec79773bfc0b1ba4a39b9211e9f5f94 --- /dev/null +++ b/app/images/handle_hz.svg @@ -0,0 +1,188 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="50" + height="15" + viewBox="0 0 50 15" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="handle_hz.svg" + inkscape:export-filename="/home/ossman/devel/noVNC/images/drag.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#959595" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:zoom="8" + inkscape:cx="1.7079645" + inkscape:cy="17.282829" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:object-paths="true" + showguides="false" + inkscape:window-width="1280" + inkscape:window-height="998" + inkscape:window-x="1600" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:snap-smooth-nodes="true" + inkscape:object-nodes="true" + inkscape:snap-intersection-paths="true" + inkscape:snap-nodes="true" + inkscape:snap-global="true"> + <inkscape:grid + type="xygrid" + id="grid4136" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1037.3622)"> + <g + id="g3390" + transform="translate(17.5,17.500017)"> + <rect + transform="matrix(0,-1,1,0,0,0)" + ry="1.7382812e-05" + y="-11.000009" + x="-1025.3622" + height="1.0000174" + width="1" + id="rect4249" + style="opacity:0.25;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + style="opacity:0.25;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4255" + width="1" + height="1.0000174" + x="-1025.3622" + y="-6.0000086" + ry="1.7382812e-05" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + style="opacity:0.25;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4261" + width="1" + height="1.0000174" + x="-1030.3622" + y="-11.000009" + ry="1.7382812e-05" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + ry="1.7382812e-05" + y="-6.0000086" + x="-1030.3622" + height="1.0000174" + width="1" + id="rect4263" + style="opacity:0.25;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + style="opacity:0.25;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4265" + width="1" + height="1.0000174" + x="-1025.3622" + y="19.99999" + ry="1.7382812e-05" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + ry="1.7382812e-05" + y="24.99999" + x="-1025.3622" + height="1.0000174" + width="1" + id="rect4267" + style="opacity:0.25;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + ry="1.7382812e-05" + y="19.99999" + x="-1030.3622" + height="1.0000174" + width="1" + id="rect4269" + style="opacity:0.25;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + style="opacity:0.25;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4271" + width="1" + height="1.0000174" + x="-1030.3622" + y="24.99999" + ry="1.7382812e-05" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + ry="1.7382812e-05" + y="-1.0000087" + x="-1025.3622" + height="1.0000174" + width="1" + id="rect4273" + style="opacity:0.25;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + style="opacity:0.25;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4275" + width="1" + height="1.0000174" + x="-1030.3622" + y="-1.0000087" + ry="1.7382812e-05" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + ry="1.7382812e-05" + y="14.999991" + x="-1025.3622" + height="1.0000174" + width="1" + id="rect4277" + style="opacity:0.25;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + style="opacity:0.25;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4279" + width="1" + height="1.0000174" + x="-1030.3622" + y="14.999991" + ry="1.7382812e-05" /> + </g> + </g> +</svg> diff --git a/app/images/handleup.svg b/app/images/handleup.svg new file mode 100644 index 0000000000000000000000000000000000000000..49c816720125a41ab30e126c5142493f3f13d982 --- /dev/null +++ b/app/images/handleup.svg @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="6" + height="5" + viewBox="0 0 6 5" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="handleup.svg" + inkscape:export-filename="/home/ossman/devel/noVNC/images/drag.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#959595" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:zoom="32" + inkscape:cx="-3.8479472" + inkscape:cy="8.7800329" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:object-paths="true" + showguides="false" + inkscape:window-width="1280" + inkscape:window-height="998" + inkscape:window-x="1600" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:snap-smooth-nodes="true" + inkscape:object-nodes="true" + inkscape:snap-intersection-paths="true" + inkscape:snap-nodes="true" + inkscape:snap-global="true"> + <inkscape:grid + type="xygrid" + id="grid4136" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1047.3622)"> + <path + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="m 3,1048.3622 -2.00000002,3 4.00000002,0 z" + id="path4247" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccc" /> + </g> +</svg> diff --git a/app/styles/base.css b/app/styles/base.css index aa7f89719e1cd161c85f9c22244bedcacbfa33ff..1e13348749384dc6c1ba16246f73b4fbb8c4a06f 100644 --- a/app/styles/base.css +++ b/app/styles/base.css @@ -280,7 +280,7 @@ select:active { left: auto; right: 0; } - +/* copied till here */ #noVNC_control_bar { position: relative; left: -100%; @@ -869,3 +869,176 @@ select:active { font-size: 90px; } } + +/* ---------------------------------------- + * Generate System button + * ---------------------------------------- + */ + +/* vcenter */ + +.genImg_vcenter { + display: -webkit-flex; + display: flex; + flex-direction: row; + justify-content: flex-end; + position: fixed; + bottom: 0; + right: 5%; + height: 81px; + width: 100%; + pointer-events: none; +} +.genImg_vcenter > * { + pointer-events: auto; +} + +/* anchor */ + +#genImg_control_bar_anchor { + /* The anchor is needed to get z-stacking to work */ + position: fixed; + z-index: 10; + + transition: 0.5s ease-in-out; + + /* Edge misrenders animations wihthout this */ + transform: translateY(0); +} +:root.noVNC_connected #genImg_control_bar_anchor.genImg_idle { + opacity: 0.8; +} +#genImg_control_bar_anchor.genImg_right { + bottom: auto; + top: 0; +} + +/* control_bar */ + +#genImg_control_bar { + position: relative; + bottom: -100%; + + transition: 0.5s ease-in-out; + + background-color: rgb(110, 132, 163); + border-radius: 0 10px 10px 0; + +} +#genImg_control_bar.genImg_open { + box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.5); + bottom: 0; +} +#genImg_control_bar::before { + /* This extra element is to get a proper shadow */ + content: ""; + position: absolute; + z-index: -1; + height: 100%; + width: 30px; + left: -30px; + transition: box-shadow 0.5s ease-in-out; +} +#genImg_control_bar.genImg_open::before { + box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.5); + border-radius: 0px 10px 10px 0px; + +} +.genImg_right #genImg_control_bar { + bottom: 100%; + border-radius: 10px 0 0 10px; +} +.genImg_right #genImg_control_bar.genImg_open { + bottom: 0; +} +.genImg_right #genImg_control_bar::before { + visibility: hidden; +} + +/* handle */ + +#genImg_control_bar_handle { + position: absolute; + bottom: -15px; + right: 95px; + transform: translateX(35px); + height: calc(100% + 30px); + width: 50px; + z-index: -1; + cursor: pointer; + border-radius: 5px; + background-color: rgb(83, 99, 122); + background-image: url("../images/handle_hz.svg"); + background-repeat: no-repeat; + background-position: top; + box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.5); +} +#genImg_control_bar_handle:after { + content: ""; + transition: transform 0.5s ease-in-out; + background: url("../images/handleup.svg"); + position: absolute; + left: 22px; /* (50px-6px)/2 */ + top: 5px; + width: 6px; + height: 5px; +} +#genImg_control_bar.genImg_open #genImg_control_bar_handle:after { + transform: translateY(1px) rotate(180deg); +} +:root:not(.noVNC_connected) #genImg_control_bar_handle { + display: none; +} +.genImg_right #genImg_control_bar_handle { + background-position: left; +} +.genImg_right #genImg_control_bar_handle:after { + left: 5px; + right: 0; + transform: translateX(1px) rotate(180deg); +} + +.genImg_right #genImg_control_bar.genImg_open #genImg_control_bar_handle:after { + transform: none; +} + +/* Mocelin's additions */ + +#generateImage-form { + cursor: pointer; + + padding: 10px; + + color: white; + background-color: rgb(110, 132, 163); + border-radius: 12px; + + text-align: center; + font-size: 20px; + + position: absolute; + right: 10%; + bottom: 0; +} + +#generateImage-form div { + margin: 2px; + padding: 5px 30px; + border: 1px solid rgb(83, 99, 122); + border-bottom-width: 2px; + border-radius: 5px; + background: linear-gradient(to top, rgb(110, 132, 163), rgb(99, 119, 147)); + + /* This avoids it jumping around when :active */ + vertical-align: middle; +} +#generateImage-form div:active { + border-bottom-width: 1px; + margin-top: 3px; +} +:root:not(.noVNC_touch) #generateImage-form div:hover { + background: linear-gradient(to top, rgb(110, 132, 163), rgb(105, 125, 155)); +} + +/* end of Mocelin's addidtions */ + diff --git a/app/ui.js b/app/ui.js index ace9240d3a0cca7a6d8c1467114b60c3356606c0..7cd04afd43d1e1f5b36dbcf38721df93499543bf 100644 --- a/app/ui.js +++ b/app/ui.js @@ -1080,7 +1080,6 @@ var UI; }, disconnect: function() { - console.log('luiza disconnect'); UI.closeAllPanels(); UI.rfb.disconnect(); @@ -1105,9 +1104,8 @@ var UI; }, disconnectFinished: function (rfb, reason) { - alert("luiza disconnect fnished"); - console.log('luiza disconnected finished'); - if (typeof reason !== 'undefined') { + + if (typeof reason !== 'undefined') { UI.showStatus(reason, 'error'); } else if (UI.getSetting('reconnect', false) === true && !UI.inhibit_reconnect) { document.getElementById("noVNC_transition_text").textContent = _("Reconnecting..."); @@ -1728,6 +1726,57 @@ var UI; }; /* [module] UI.load(); */ -})(); /* [module] export default UI; */ + + +/* -------------- + * /OPENSLX'S additions + * ============== + */ + + $("#imgid").val(WebUtil.getQueryVar("imgid", "")); + $("#accesstoken").val(WebUtil.getQueryVar("accesstoken", "")); + + $("#genImg_control_bar_handle").click(function(){ + $("#genImg_control_bar").toggleClass("genImg_open"); + }); + + /* about 'onunload' and 'onbefore unload': + + onunload is responsible for executing an instruction when the + page is closed. It also causes issue with IE and AJAX. + + onbeforeunload is more efficient because it does not run in + competition with the actual closing of the window and is triggered before onunload + + I know Opera used to not acknowledge onbeforeunload - not sure if + they've fixed that, but I always register the listener for both to be safe: + + window.onunload = window.onbeforeunload = (function(){...*/ + + //this is called whenever the user refreshes/goes back or forward/goes to a new url/closes the tab + + + $(document).on("click", "#generateImage-form", function () { + $("#generate-form").submit(); + }); + + +})(); + + + + + + + + + + + + + + + + diff --git a/slxcustom.html b/slxcustom.html new file mode 100644 index 0000000000000000000000000000000000000000..e4fc46769d818cf6be2a9fba3dd80cd36cabaf82 --- /dev/null +++ b/slxcustom.html @@ -0,0 +1,289 @@ +<!DOCTYPE html> +<html> +<head> + + <!-- + noVNC example: simple example using default UI + Copyright (C) 2012 Joel Martin + Copyright (C) 2013 Samuel Mannehed for Cendio AB + noVNC is licensed under the MPL 2.0 (see LICENSE.txt) + This file is licensed under the 2-Clause BSD license (see LICENSE.txt). + + Connect parameters are provided in query string: + http://example.com/?host=HOST&port=PORT&encrypt=1&true_color=1 + or the fragment: + http://example.com/#host=HOST&port=PORT&encrypt=1&true_color=1 + --> + <title>noVNC</title> + + <meta charset="utf-8"> + + <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame + Remove this if you use the .htaccess --> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + + <!-- Apple iOS Safari settings --> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> + <meta name="apple-mobile-web-app-capable" content="yes" /> + <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> + <!-- App Start Icon --> + <link rel="apple-touch-startup-image" href="app/images/screen_320x460.png" /> + <!-- For iOS devices set the icon to use if user bookmarks app on their homescreen --> + <link rel="apple-touch-icon" href="app/images/screen_57x57.png"> + <!-- + <link rel="apple-touch-icon-precomposed" href="app/images/screen_57x57.png" /> + --> + + + <!-- Stylesheets --> + <link rel="stylesheet" href="app/styles/auto.css"> + + <!-- + <script type='text/javascript' + src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script> + --> + <script src="core/util.js"></script> + <script src="app/webutil.js"></script> +</head> + +<body style="margin: 0px;"> + <div id="noVNC_container"> + <div id="noVNC_status_bar" class="noVNC_status_bar" style="margin-top: 0px;"> + <table border=0 width="100%"><tr> + <td><div id="noVNC_status" style="position: relative; height: auto;"> + Loading + </div></td> + <td width="1%"><div id="noVNC_buttons"> + <input type=button value="Send CtrlAltDel" + id="sendCtrlAltDelButton"> + <span id="noVNC_xvp_buttons"> + <input type=button value="Shutdown" + id="xvpShutdownButton"> + <input type=button value="Reboot" + id="xvpRebootButton"> + <input type=button value="Reset" + id="xvpResetButton"> + </span> + </div></td> + </tr></table> + </div> + <canvas id="noVNC_canvas" width="640px" height="20px"> + Canvas not supported. + </canvas> + </div> + + <script> + /*jslint white: false */ + /*global window, $, Util, RFB, */ + "use strict"; + + // Load supporting scripts + WebUtil.load_scripts({ + 'core': ["base64.js", "websock.js", "des.js", "input/keysymdef.js", + "input/xtscancodes.js", "input/util.js", "input/devices.js", + "display.js", "inflator.js", "rfb.js", "input/keysym.js"]}); + + var rfb; + var resizeTimeout; + var desktopName; + + + function UIresize() { + if (WebUtil.getConfigVar('resize', false)) { + var innerW = window.innerWidth; + var innerH = window.innerHeight; + var controlbarH = document.getElementById('noVNC_status_bar').offsetHeight; + if (innerW !== undefined && innerH !== undefined) + rfb.requestDesktopSize(innerW, innerH - controlbarH); + } + } + function FBUComplete(rfb, fbu) { + UIresize(); + rfb.set_onFBUComplete(function() { }); + } + function updateDesktopName(rfb, name) { + desktopName = name; + } + function passwordRequired(rfb, msg) { + if (typeof msg === 'undefined') { + msg = 'Password Required: '; + } + var html; + html = '<form onsubmit="return setPassword();"'; + html += ' style="margin-bottom: 0px">'; + html += '<label></label>' + html += '<input type=password size=10 id="password_input" class="noVNC_status">'; + html += '<\/form>'; + + // bypass status() because it sets text content + document.getElementById('noVNC_status_bar').setAttribute("class", "noVNC_status_warn"); + document.getElementById('noVNC_status').innerHTML = html; + document.getElementById('noVNC_status').querySelector('label').textContent = msg; + } + function setPassword() { + rfb.sendPassword(document.getElementById('password_input').value); + return false; + } + function sendCtrlAltDel() { + rfb.sendCtrlAltDel(); + return false; + } + function xvpShutdown() { + rfb.xvpShutdown(); + return false; + } + function xvpReboot() { + rfb.xvpReboot(); + return false; + } + function xvpReset() { + rfb.xvpReset(); + return false; + } + function status(text, level) { + switch (level) { + case 'normal': + case 'warn': + case 'error': + break; + default: + level = "warn"; + } + document.getElementById('noVNC_status_bar').setAttribute("class", "noVNC_status_" + level); + document.getElementById('noVNC_status').textContent = text; + } + function updateState(rfb, state, oldstate) { + var cad = document.getElementById('sendCtrlAltDelButton'); + switch (state) { + case 'connecting': + status("Connecting", "normal"); + break; + case 'connected': + if (rfb && rfb.get_encrypt()) { + status("Connected (encrypted) to " + + desktopName, "normal"); + } else { + status("Connected (unencrypted) to " + + desktopName, "normal"); + } + break; + case 'disconnecting': + status("Disconnecting", "normal"); + break; + case 'disconnected': + status("Disconnected", "normal"); + break; + default: + status(state, "warn"); + break; + } + + if (state === 'connected') { + cad.disabled = false; + } else { + cad.disabled = true; + xvpInit(0); + } + + } + function disconnected(rfb, reason) { + if (typeof(reason) !== 'undefined') { + status(reason, "error"); + } + } + function notification(rfb, msg, level, options) { + status(msg, level); + } + + window.onresize = function () { + // When the window has been resized, wait until the size remains + // the same for 0.5 seconds before sending the request for changing + // the resolution of the session + clearTimeout(resizeTimeout); + resizeTimeout = setTimeout(function(){ + UIresize(); + }, 500); + }; + + function xvpInit(ver) { + var xvpbuttons; + xvpbuttons = document.getElementById('noVNC_xvp_buttons'); + if (ver >= 1) { + xvpbuttons.style.display = 'inline'; + } else { + xvpbuttons.style.display = 'none'; + } + } + + window.onscriptsload = function () { + var host, port, password, path, token; + + document.getElementById('sendCtrlAltDelButton').style.display = "inline"; + document.getElementById('sendCtrlAltDelButton').onclick = sendCtrlAltDel; + document.getElementById('xvpShutdownButton').onclick = xvpShutdown; + document.getElementById('xvpRebootButton').onclick = xvpReboot; + document.getElementById('xvpResetButton').onclick = xvpReset; + + WebUtil.init_logging(WebUtil.getConfigVar('logging', 'warn')); + document.title = unescape(WebUtil.getConfigVar('title', 'noVNC')); + // By default, use the host and port of server that served this file + host = WebUtil.getConfigVar('host', window.location.hostname); + port = WebUtil.getConfigVar('port', window.location.port); + + // if port == 80 (or 443) then it won't be present and should be + // set manually + if (!port) { + if (window.location.protocol.substring(0,5) == 'https') { + port = 443; + } + else if (window.location.protocol.substring(0,4) == 'http') { + port = 80; + } + } + + password = WebUtil.getConfigVar('password', ''); + path = WebUtil.getConfigVar('path', 'websockify'); + + // If a token variable is passed in, set the parameter in a cookie. + // This is used by nova-novncproxy. + token = WebUtil.getConfigVar('token', null); + if (token) { + + // if token is already present in the path we should use it + path = WebUtil.injectParamIfMissing(path, "token", token); + + WebUtil.createCookie('token', token, 1) + } + + if ((!host) || (!port)) { + status('Must specify host and port in URL', 'error'); + return; + } + + try { + rfb = new RFB({'target': document.getElementById('noVNC_canvas'), + 'encrypt': WebUtil.getConfigVar('encrypt', + (window.location.protocol === "https:")), + 'repeaterID': WebUtil.getConfigVar('repeaterID', ''), + 'true_color': WebUtil.getConfigVar('true_color', true), + 'local_cursor': WebUtil.getConfigVar('cursor', true), + 'shared': WebUtil.getConfigVar('shared', true), + 'view_only': WebUtil.getConfigVar('view_only', false), + 'onNotification': notification, + 'onUpdateState': updateState, + 'onDisconnected': disconnected, + 'onXvpInit': xvpInit, + 'onPasswordRequired': passwordRequired, + 'onFBUComplete': FBUComplete, + 'onDesktopName': updateDesktopName}); + } catch (exc) { + status('Unable to create RFB client -- ' + exc, 'error'); + return; // don't continue trying to connect + } + + rfb.connect(host, port, password, path); + }; + </script> + + </body> +</html> diff --git a/vnc.html b/vnc.html index 1f29657fcaf946e3e195f79a012771f4cac0f84b..4e9e015667733b06897460eb672455bdbc9e02a8 100644 --- a/vnc.html +++ b/vnc.html @@ -13,8 +13,8 @@ Connect parameters are provided in query string: http://example.com/?host=HOST&port=PORT&encrypt=1&true_color=1 or the fragment: - http://example.com/#host=HOST&port=PORT&encrypt=1&true_color=1 - --> + http://example.com/#host=HOST&port=PORT&encrypt=1&true_color=1 + --> <title>noVNC</title> <meta charset="utf-8" /> @@ -54,9 +54,11 @@ <!-- Stylesheets --> <link rel="stylesheet" href="app/styles/base.css" /> -<!-- added by luiza --> + + <!-- added by openslx --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> -<!-- end od added by luiza --> + <!-- end of added by openslx --> + <!-- <script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script> @@ -316,7 +318,23 @@ Canvas not supported. </canvas> </div> - + <div id="genImg_control_bar_anchor" class="genImg_vcenter"> + + <div id="genImg_control_bar"> + <div id="genImg_control_bar_handle" title="Hide/Show the control bar"><div></div></div> + + <div id="generateImage-form"> + <div> + <form action="/?do=Imgmanagement" method="post" id="generate-form"> + <input type="hidden" name="action" value="callGenerateSystem"> + <input type="hidden" name="imgid" id="imgid" value=""> + <input type="hidden" name="token" id="accesstoken" value=""> + Generate System + </form> + </div> + </div> + </div> + </div> </div> <audio id="noVNC_bell">