From 5e42ebca208378a436c1628a905ad413f4849a7b Mon Sep 17 00:00:00 2001 From: Jan Hegr Date: Mon, 31 Jan 2022 00:18:29 +0100 Subject: [PATCH] Proposal of screen-reader accessible interpretation of modes and networks status overview. Draft of tooltips as the legend is missing. --- css/pistar-css-mini.php | 37 ++++++++++++++++++++ css/pistar-css.php | 37 ++++++++++++++++++++ mmdvmhost/functions.php | 76 ++++++++++++++++++++++++++++++++++------- 3 files changed, 137 insertions(+), 13 deletions(-) diff --git a/css/pistar-css-mini.php b/css/pistar-css-mini.php index 44367129..6b4035ff 100755 --- a/css/pistar-css-mini.php +++ b/css/pistar-css-mini.php @@ -405,3 +405,40 @@ -moz-border-radius : 3px 3px 3px 3px; } } + +/* Tooltip container */ +.hasTooltip { + position: relative; + display: inline-block; +} + +/* Tooltip text */ +.hasTooltip .tooltipText { + visibility: hidden; + width: 120px; + text-align: center; + padding: 5px 0; + border-radius: 6px; + position: absolute; + z-index: 1; +} + +/* Show the tooltip text when you mouse over the tooltip container */ +.hasTooltip:hover .tooltipText { + visibility: visible; +} + +/* Screenreader-only */ +.sr-only { + border: 0 !important; + clip: rect(1px, 1px, 1px, 1px) !important; /* 1 */ + -webkit-clip-path: inset(50%) !important; + clip-path: inset(50%) !important; /* 2 */ + height: 1px !important; + margin: -1px !important; + overflow: hidden !important; + padding: 0 !important; + position: absolute !important; + width: 1px !important; + white-space: nowrap !important; /* 3 */ +} diff --git a/css/pistar-css.php b/css/pistar-css.php index b6f52b6f..84528e5b 100755 --- a/css/pistar-css.php +++ b/css/pistar-css.php @@ -423,3 +423,40 @@ content: "[ ]"; } */ + +/* Tooltip container */ +.hasTooltip { + position: relative; + display: inline-block; +} + +/* Tooltip text */ +.hasTooltip .tooltipText { + visibility: hidden; + width: 120px; + text-align: center; + padding: 5px 0; + border-radius: 6px; + position: absolute; + z-index: 1; +} + +/* Show the tooltip text when you mouse over the tooltip container */ +.hasTooltip:hover .tooltipText { + visibility: visible; +} + +/* Screenreader-only */ +.sr-only { + border: 0 !important; + clip: rect(1px, 1px, 1px, 1px) !important; /* 1 */ + -webkit-clip-path: inset(50%) !important; + clip-path: inset(50%) !important; /* 2 */ + height: 1px !important; + margin: -1px !important; + overflow: hidden !important; + padding: 0 !important; + position: absolute !important; + width: 1px !important; + white-space: nowrap !important; /* 3 */ +} diff --git a/mmdvmhost/functions.php b/mmdvmhost/functions.php index 9553b9fc..0ac9ccfd 100755 --- a/mmdvmhost/functions.php +++ b/mmdvmhost/functions.php @@ -104,57 +104,87 @@ function checkDMRLogin ($dmrDaemon) { function showMode($mode, $mmdvmconfigs) { // shows if mode is enabled or not. + // TODO: Consider localiZation + $states = array( + "ok" => "OK", + "stopped" => "Stopped", + "error" => "Connection error", + "disabled" => "Disabled" + ); + if (getEnabled($mode, $mmdvmconfigs) == 1) { if ($mode == "D-Star Network") { if (isProcessRunning("ircddbgatewayd")) { echo ""; + $state = "ok"; } else { echo ""; + $state = "stopped"; } } elseif ($mode == "System Fusion Network") { if (isProcessRunning("YSFGateway")) { echo ""; + $state = "ok"; } else { echo ""; + $state = "stopped"; } } elseif ($mode == "P25 Network") { if (isProcessRunning("P25Gateway")) { echo ""; + $state = "ok"; } else { echo ""; + $state = "stopped"; } } elseif ($mode == "NXDN Network") { if (isProcessRunning("NXDNGateway")) { echo ""; + $state = "ok"; } else { echo ""; + $state = "stopped"; } } elseif ($mode == "DAPNET Network") { if (isProcessRunning("DAPNETGateway")) { echo ""; + $state = "ok"; } else { echo ""; + $state = "stopped"; } } elseif ($mode == "DMR Network") { if (getConfigItem("DMR Network", "Address", $mmdvmconfigs) == '127.0.0.1') { if (isProcessRunning("DMRGateway")) { - if (checkDMRLogin("DMRGateway") > 0) { echo ""; } - else { echo ""; } + if (checkDMRLogin("DMRGateway") > 0) { + echo ""; + $state = "error"; + } else { + echo ""; + $state = "ok"; + } } else { echo ""; + $state = "stopped"; } } else { if (isProcessRunning("MMDVMHost")) { - if (checkDMRLogin("MMDVMHost") > 0) { echo ""; } - else { echo ""; } + if (checkDMRLogin("MMDVMHost") > 0) { + echo ""; + $state = "error"; + } else { + echo ""; + $state = "ok"; + } } else { echo ""; + $state = "stopped"; } } } @@ -162,8 +192,10 @@ function showMode($mode, $mmdvmconfigs) { if ($mode == "D-Star" || $mode == "DMR" || $mode == "System Fusion" || $mode == "P25" || $mode == "NXDN" || $mode == "POCSAG") { if (isProcessRunning("MMDVMHost")) { echo ""; + $state = "ok"; } else { echo ""; + $state = "stopped"; } } } @@ -171,60 +203,78 @@ function showMode($mode, $mmdvmconfigs) { elseif ( ($mode == "YSF XMode") && (getEnabled("System Fusion", $mmdvmconfigs) == 1) ) { if ( (isProcessRunning("MMDVMHost")) && (isProcessRunning("YSF2DMR") || isProcessRunning("YSF2NXDN") || isProcessRunning("YSF2P25")) ) { echo ""; + $state = "ok"; } else { - echo "\">"; + echo ""; + $state = "disabled"; } } elseif ( ($mode == "DMR XMode") && (getEnabled("DMR", $mmdvmconfigs) == 1) ) { if ( (isProcessRunning("MMDVMHost")) && (isProcessRunning("DMR2YSF") || isProcessRunning("DMR2NXDN")) ) { echo ""; + $state = "ok"; } else { - echo "\">"; + echo ""; + $state = "disabled"; } } elseif ( ($mode == "YSF2DMR Network") && (getEnabled("System Fusion", $mmdvmconfigs) == 1) ) { if (isProcessRunning("YSF2DMR")) { echo ""; + $state = "ok"; } else { - echo "\">"; + echo ""; + $state = "disabled"; } } elseif ( ($mode == "YSF2NXDN Network") && (getEnabled("System Fusion", $mmdvmconfigs) == 1) ) { if (isProcessRunning("YSF2NXDN")) { echo ""; + $state = "ok"; } else { - echo "\">"; + echo ""; + $state = "disabled"; } } elseif ( ($mode == "YSF2P25 Network") && (getEnabled("System Fusion", $mmdvmconfigs) == 1) ) { if (isProcessRunning("YSF2P25")) { echo ""; + $state = "ok"; } else { - echo "\">"; + echo ""; + $state = "disabled"; } } elseif ( ($mode == "DMR2NXDN Network") && (getEnabled("DMR", $mmdvmconfigs) == 1) ) { if (isProcessRunning("DMR2NXDN")) { echo ""; + $state = "ok"; } else { - echo "\">"; + echo ""; + $state = "disabled"; } } elseif ( ($mode == "DMR2YSF Network") && (getEnabled("DMR", $mmdvmconfigs) == 1) ) { if (isProcessRunning("DMR2YSF")) { echo ""; + $state = "ok"; } else { - echo "\">"; + echo ""; + $state = "disabled"; } } else { - echo "\">"; + echo ""; + $state = "disabled"; } $mode = str_replace("System Fusion", "YSF", $mode); $mode = str_replace("Network", "Net", $mode); if (strpos($mode, 'YSF2') > -1) { $mode = str_replace(" Net", "", $mode); } if (strpos($mode, 'DMR2') > -1) { $mode = str_replace(" Net", "", $mode); } - echo $mode."\n"; + echo '
' . $mode; + echo ': ' . $states[$state] . ""; + echo '' . $states[$state] . ""; + echo "
\n"; } function getMMDVMLog() {