From 8634dd3ac37bc821afd0e7f321eb0064247074a2 Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Tue, 4 May 2021 15:20:14 +0000 Subject: #995 Show client link speed if available If the clients API response included speed information, show it in the default room view. In case link speed is less than 1000 Mbit, highlight so. --- admin/WebConsole/includes/restfunctions.php | 17 +++++++++++++++++ admin/WebConsole/principal/aula.php | 14 ++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/admin/WebConsole/includes/restfunctions.php b/admin/WebConsole/includes/restfunctions.php index e7b1e1e6..2141c3b1 100644 --- a/admin/WebConsole/includes/restfunctions.php +++ b/admin/WebConsole/includes/restfunctions.php @@ -77,6 +77,7 @@ define('OG_REST_PARAM_AM_PM', 'am_pm'); define('OG_REST_PARAM_MINUTES', 'minutes'); define('OG_REST_PARAM_MODE', 'mode'); define('OG_REST_PARAM_SCOPE_NAME', 'scope_name'); +define('OG_REST_PARAM_SPEED', 'speed'); define('TYPE_COMMAND', 1); define('TYPE_PROCEDURE', 2); @@ -188,6 +189,22 @@ function clients($case, $ips) { return $trama_notificacion; } +function clients_v2($case, $ips) { + + switch ($case) { + case 1: + $type = POST; + $data = array(OG_REST_PARAM_CLIENTS => $ips); + break; + case 2: + $type = GET; + $data = null; + break; + } + + return common_request(OG_REST_CMD_CLIENTS, $type, $data); +} + function wol($type_wol, $ips) { switch ($type_wol) { diff --git a/admin/WebConsole/principal/aula.php b/admin/WebConsole/principal/aula.php index efc09178..81c7b676 100644 --- a/admin/WebConsole/principal/aula.php +++ b/admin/WebConsole/principal/aula.php @@ -15,6 +15,7 @@ include_once("../clases/MenuContextual.php"); include_once("../includes/constantes.php"); include_once("../includes/comunes.php"); include_once("../includes/CreaComando.php"); +include_once("../includes/restfunctions.php"); include_once("../idiomas/php/".$idioma."/aulas_".$idioma.".php"); include_once("../idiomas/php/".$idioma."/estados_".$idioma.".php"); include_once("../idiomas/php/".$idioma."/comandos/mensajes_".$idioma.".php"); @@ -286,6 +287,12 @@ function pintaordenadores(){ global $map; global $max_col; + $clients = clients_v2(2, $Mip); + $get_speed = function($cli) { + return $cli['speed'] ? $cli['speed'] : '-1'; + }; + $speeds = array_map($get_speed, $clients['clients']); + $ntr=0; // Numero de ordenadores por fila if ($nombreaula!=""){ echo '
'; @@ -313,6 +320,13 @@ function pintaordenadores(){ echo ' '.$Mip[$i].''; echo '
'; echo ' '.$Mmac[$i].''; + echo '
'; + if ($speeds[$i] > 0 && $speeds[$i] < 1000) { + echo ' '.$speeds[$i].' Mbit'; + } + if ($speeds[$i] > 0 && $speeds[$i] >= 1000) { + echo ' '.$speeds[$i].' Mbit'; + } echo ''; echo ''; echo ''; -- cgit v1.2.3-18-g5258