From 344f9dfe0e8a4da4024f5af1b284d2e567800bd9 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 7 Jul 2020 16:39:59 +0200 Subject: [locationinfo] Support styling clients with special runmode Implemented for remoteaccess runmode for now --- modules-available/locationinfo/api.inc.php | 2 +- .../locationinfo/inc/infopanel.inc.php | 3 +- .../locationinfo/templates/frontend-default.html | 59 ++++++++++++---------- 3 files changed, 35 insertions(+), 29 deletions(-) diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php index c44ec72d..d3ff9ebd 100644 --- a/modules-available/locationinfo/api.inc.php +++ b/modules-available/locationinfo/api.inc.php @@ -99,7 +99,7 @@ function getPcStates($idList, $paneluuid) } $locationInfoList = array(); - InfoPanel::appendMachineData($locationInfoList, $idList, true); + InfoPanel::appendMachineData($locationInfoList, $idList); $panel = Database::queryFirst('SELECT paneluuid, panelconfig FROM locationinfo_panel WHERE paneluuid = :paneluuid', compact('paneluuid')); diff --git a/modules-available/locationinfo/inc/infopanel.inc.php b/modules-available/locationinfo/inc/infopanel.inc.php index b0ee0d56..001f31ea 100644 --- a/modules-available/locationinfo/inc/infopanel.inc.php +++ b/modules-available/locationinfo/inc/infopanel.inc.php @@ -108,7 +108,7 @@ class InfoPanel if ($withHostname) { $extraCols .= 'm.hostname,'; } - $query = "SELECT m.locationid, m.machineuuid, m.hostname, $extraCols m.logintime, m.lastseen, m.lastboot, m.state FROM machine m + $query = "SELECT m.locationid, m.machineuuid, $extraCols m.logintime, m.lastseen, m.lastboot, m.state, m.currentrunmode FROM machine m WHERE m.locationid IN (:idlist)"; $dbquery = Database::simpleQuery($query, array('idlist' => $idList)); @@ -147,6 +147,7 @@ class InfoPanel } } } + $pc['runmode'] = $row['currentrunmode']; $pc['pcState'] = LocationInfo::getPcState($row); //$pc['pcState'] = ['BROKEN', 'OFFLINE', 'IDLE', 'OCCUPIED', 'STANDBY'][mt_rand(0,4)]; // XXX diff --git a/modules-available/locationinfo/templates/frontend-default.html b/modules-available/locationinfo/templates/frontend-default.html index 2868c034..324ee559 100755 --- a/modules-available/locationinfo/templates/frontend-default.html +++ b/modules-available/locationinfo/templates/frontend-default.html @@ -215,13 +215,28 @@ optional: .screen-frame { position: relative; - background: black; + background: #000; border-radius: 11%; width: 100%; height: 83%; padding: 6%; } + .screen-foot1 { + margin: 0 auto; + width: 10%; + height: 7%; + background: #000; + } + + .screen-foot2 { + margin: 0 auto; + width: 80%; + height: 7%; + background: #000; + border-radius: 30% 30% 0 0; + } + .screen-inner { width: 100%; height: 100%; @@ -253,31 +268,25 @@ optional: .IDLE .screen-inner, .STANDBY .screen-inner { - background: linear-gradient(to bottom, #0d0, #0c0 9%, #250 13%, #050 100%); + background: linear-gradient(to bottom, #0d0, #0c0 10%, #250 13%, #050 100%); } .OCCUPIED .screen-inner { background: #d23; } + .OCCUPIED.rm-remoteaccess .screen-inner { + background: linear-gradient(to bottom, #d23, #f90 80%); + } + .OCCUPIED .screen-inner:after { content: '\01F464'; font-weight: bold; } - .screen-foot1 { - margin: 0 auto; - width: 10%; - height: 7%; - background: black; - } - - .screen-foot2 { - margin: 0 auto; - width: 80%; - height: 7%; - background: black; - border-radius: 30% 30% 0 0; + .STANDBY .screen-inner:after { + content: '\01F319'; + font-weight: bold; } .pc-overlay-container { @@ -289,15 +298,6 @@ optional: display: table; } - .pc-img { - position: absolute; - left: 0; - top: 0; - width: 100%; - height: 100%; - - } - .overlay { display: inline-block; position: relative; @@ -1434,7 +1434,6 @@ optional: function setUpRoom(room, layout) { for (var i = 0; i < layout.length; i++) { if (!isNaN(layout[i].y) && !isNaN(layout[i].x)) { - //var $img = $('').prop('id', "pc-img_" + room.id + "_" + layout[i].id).addClass('pc-img'); var $overlays = $('
').addClass('pc-overlay-container'); layout[i].$div = $('
').prop('id', "pc_" + room.id + "_" + layout[i].id).addClass('pc-container'); layout[i].$div.append($('
').addClass('screen-frame').append($('
').addClass('screen-inner').append($('
').addClass('pcname').text(layout[i].host)))); @@ -1575,8 +1574,14 @@ optional: freePcs++; } } - - $div.removeClass('BROKEN OFFLINE IDLE OCCUPIED STANDBY'.replace(update[i].pcState, '')).addClass(update[i].pcState); + if (!$div.hasClass(update[i].pcState)) { + $div.removeClass('BROKEN OFFLINE IDLE OCCUPIED STANDBY'.replace(update[i].pcState, '')).addClass(update[i].pcState); + } + if (!$div.hasClass('rm-' + update[i].runmode)) { + $div.removeClass(function (i, cn) { + return (cn.match(/\brm-\S*/g) || []).join(' '); + }).addClass('rm-' + update[i].runmode); + } } room.freePcs = freePcs; room.numPcs = numPcs; -- cgit v1.2.3-55-g7522