make mode updated by ajax

This commit is contained in:
dg9vh 2016-10-09 20:34:09 +00:00
parent 4982146762
commit be58ad46fa
5 changed files with 10 additions and 5 deletions

View file

@ -11,6 +11,10 @@ $logLinesMMDVM = getMMDVMLog();
$reverseLogLinesMMDVM = $logLinesMMDVM; $reverseLogLinesMMDVM = $logLinesMMDVM;
array_multisort($reverseLogLinesMMDVM,SORT_DESC); array_multisort($reverseLogLinesMMDVM,SORT_DESC);
//$lastHeard = $_SESSION['lastHeard']; //$lastHeard = $_SESSION['lastHeard'];
if ($_GET['section'] == "mode") {
$mode = getActualMode(getLastHeard($reverseLogLinesMMDVM, TRUE), $mmdvmconfigs);
echo $mode;
}
if ($_GET['section'] == "lastHeard") { if ($_GET['section'] == "lastHeard") {
$lastHeard = getLastHeard($reverseLogLinesMMDVM, FALSE); $lastHeard = getLastHeard($reverseLogLinesMMDVM, FALSE);
echo '{"data": '.json_encode($lastHeard)."}"; echo '{"data": '.json_encode($lastHeard)."}";

View file

@ -328,7 +328,7 @@ function getActualMode($metaLastHeard, $mmdvmconfigs) {
if (startsWith($mode, "DMR")) { if (startsWith($mode, "DMR")) {
$mode = "DMR"; $mode = "DMR";
} }
if ($listElem[6] ==="") { if ($listElem[7] ==="") {
return $mode; return $mode;
} else { } else {
$now = new DateTime(); $now = new DateTime();

View file

@ -13,7 +13,7 @@
</tr> </tr>
<?php <?php
echo"<tr>"; echo"<tr>";
echo"<td>".getActualMode($lastHeard, $mmdvmconfigs)."</td>"; echo"<td id=\"mode\">".getActualMode($lastHeard, $mmdvmconfigs)."</td>";
echo"<td>".getActualLink($reverseLogLinesMMDVM, "D-Star")."</td>"; echo"<td>".getActualLink($reverseLogLinesMMDVM, "D-Star")."</td>";
echo"<td>".getYSFReflectorById(getActualLink($reverseLogLinesYSFGateway, "YSF"), $activeYSFReflectors)."</td>"; echo"<td>".getYSFReflectorById(getActualLink($reverseLogLinesYSFGateway, "YSF"), $activeYSFReflectors)."</td>";
echo"<td>".getActualLink($reverseLogLinesMMDVM, "DMR Slot 1")."</td>"; echo"<td>".getActualLink($reverseLogLinesMMDVM, "DMR Slot 1")."</td>";

View file

@ -44,8 +44,8 @@ function doXMLHTTPRequest(scriptname, elem) {
xmlhttp.send(); xmlhttp.send();
} }
function refreshInQSOAndLastHeardList() { function refreshMode() {
doXMLHTTPRequest("txinfo.php","txline"); doXMLHTTPRequest("ajax.php?section=mode","mode");
} }
var transmitting = false; var transmitting = false;
@ -65,6 +65,7 @@ function loadXMLDoc() {
xmlhttp.send(); xmlhttp.send();
var timeout = window.setTimeout("loadXMLDoc()", 1000); var timeout = window.setTimeout("loadXMLDoc()", 1000);
refreshMode();
} }
loadXMLDoc(); loadXMLDoc();
</script> </script>

View file

@ -1,3 +1,3 @@
<?php <?php
define("VERSION", "20161009-2"); define("VERSION", "20161009-3");
?> ?>