Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screen-reader accessible modes and networks status overview #146

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions css/pistar-css-mini.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,43 @@
}
}

/* 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 */
}

/* nice-select dropdowns */
.nice-select.small, .nice-select-dropdown li.option {
height: 24px !important;
Expand Down
37 changes: 37 additions & 0 deletions css/pistar-css.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,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 */
}
76 changes: 63 additions & 13 deletions mmdvmhost/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,33 +116,49 @@ 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 "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
} else {
echo "<td style=\"background:#b00; color:#500; width:50%;\">";
$state = "stopped";
}
}
elseif ($mode == "System Fusion Network") {
if (isProcessRunning("YSFGateway")) {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
} else {
echo "<td style=\"background:#b00; color:#500; width:50%;\">";
$state = "stopped";
}
}
elseif ($mode == "P25 Network") {
if (isProcessRunning("P25Gateway")) {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
} else {
echo "<td style=\"background:#b00; color:#500; width:50%;\">";
$state = "stopped";
}
}
elseif ($mode == "NXDN Network") {
if (isProcessRunning("NXDNGateway")) {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
} else {
echo "<td style=\"background:#b00; color:#500; width:50%;\">";
$state = "stopped";
}
}
elseif ($mode == "M17 Network") {
Expand All @@ -155,95 +171,129 @@ function showMode($mode, $mmdvmconfigs) {
elseif ($mode == "POCSAG Network") {
if (isProcessRunning("DAPNETGateway")) {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
} else {
echo "<td style=\"background:#b00; color:#500; width:50%;\">";
$state = "stopped";
}
}
elseif ($mode == "DMR Network") {
if (getConfigItem("DMR Network", "Address", $mmdvmconfigs) == '127.0.0.1') {
if (isProcessRunning("DMRGateway")) {
if (checkDMRLogin("DMRGateway") > 0) { echo "<td style=\"background:#ff9; color:#030; width:50%;\">"; }
else { echo "<td style=\"background:#0b0; color:#030; width:50%;\">"; }
if (checkDMRLogin("DMRGateway") > 0) {
echo "<td style=\"background:#ff9; color:#030; width:50%;\">";
$state = "error";
} else {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
}
} else {
echo "<td style=\"background:#b00; color:#500; width:50%;\">";
$state = "stopped";
}
}
else {
if (isProcessRunning("MMDVMHost")) {
if (checkDMRLogin("MMDVMHost") > 0) { echo "<td style=\"background:#ff9; color:#030; width:50%;\">"; }
else { echo "<td style=\"background:#0b0; color:#030; width:50%;\">"; }
if (checkDMRLogin("MMDVMHost") > 0) {
echo "<td style=\"background:#ff9; color:#030; width:50%;\">";
$state = "error";
} else {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
}
} else {
echo "<td style=\"background:#b00; color:#500; width:50%;\">";
$state = "stopped";
}
}
}
else {
if ($mode == "D-Star" || $mode == "DMR" || $mode == "System Fusion" || $mode == "P25" || $mode == "NXDN" || $mode == "M17" || $mode == "FM" || $mode == "POCSAG") {
if (isProcessRunning("MMDVMHost")) {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
} else {
echo "<td style=\"background:#b00; color:#500; width:50%;\">";
$state = "stopped";
}
}
}
}
elseif ( ($mode == "YSF XMode") && (getEnabled("System Fusion", $mmdvmconfigs) == 1) ) {
if ( (isProcessRunning("MMDVMHost")) && (isProcessRunning("YSF2DMR") || isProcessRunning("YSF2NXDN") || isProcessRunning("YSF2P25")) ) {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
} else {
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true>\">";
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true\">";
$state = "disabled";
}
}
elseif ( ($mode == "DMR XMode") && (getEnabled("DMR", $mmdvmconfigs) == 1) ) {
if ( (isProcessRunning("MMDVMHost")) && (isProcessRunning("DMR2YSF") || isProcessRunning("DMR2NXDN")) ) {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
} else {
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true>\">";
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true\">";
$state = "disabled";
}
}
elseif ( ($mode == "YSF2DMR Network") && (getEnabled("System Fusion", $mmdvmconfigs) == 1) ) {
if (isProcessRunning("YSF2DMR")) {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
} else {
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true>\">";
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true\">";
$state = "disabled";
}
}
elseif ( ($mode == "YSF2NXDN Network") && (getEnabled("System Fusion", $mmdvmconfigs) == 1) ) {
if (isProcessRunning("YSF2NXDN")) {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
} else {
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true>\">";
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true\">";
$state = "disabled";
}
}
elseif ( ($mode == "YSF2P25 Network") && (getEnabled("System Fusion", $mmdvmconfigs) == 1) ) {
if (isProcessRunning("YSF2P25")) {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
} else {
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true>\">";
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true\">";
$state = "disabled";
}
}
elseif ( ($mode == "DMR2NXDN Network") && (getEnabled("DMR", $mmdvmconfigs) == 1) ) {
if (isProcessRunning("DMR2NXDN")) {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
} else {
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true>\">";
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true\">";
$state = "disabled";
}
}
elseif ( ($mode == "DMR2YSF Network") && (getEnabled("DMR", $mmdvmconfigs) == 1) ) {
if (isProcessRunning("DMR2YSF")) {
echo "<td style=\"background:#0b0; color:#030; width:50%;\">";
$state = "ok";
} else {
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true>\">";
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true\">";
$state = "disabled";
}
}
else {
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true>\">";
echo "<td style=\"background:#606060; color:#b0b0b0;\" aria-disabled=\"true\">";
$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."</td>\n";
echo '<div class="hasTooltip">' . $mode;
echo '<span class="sr-only">: ' . $states[$state] . "</span>";
echo '<span class="tooltipText">' . $states[$state] . "</span>";
echo "</div></td>\n";
}

function getMMDVMLog() {
Expand Down