First attempt of getting AJAX-TX-Info-section
Actual only last callsign starting TX shown, but working
This commit is contained in:
parent
bb21c7ec9d
commit
c4fc382cd5
5 changed files with 142 additions and 15 deletions
|
@ -123,6 +123,14 @@ function getMMDVMLog() {
|
|||
return $logLines;
|
||||
}
|
||||
|
||||
function getShortMMDVMLog() {
|
||||
// Open Logfile and copy loglines into LogLines-Array()
|
||||
$logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log";
|
||||
|
||||
$logLines = explode("\n", `tail -n10 $logPath`);
|
||||
return $logLines;
|
||||
}
|
||||
|
||||
function getYSFGatewayLog() {
|
||||
// Open Logfile and copy loglines into LogLines-Array()
|
||||
$logLines = array();
|
||||
|
@ -142,7 +150,7 @@ function getYSFGatewayLog() {
|
|||
// M: 2016-04-29 00:15:00.013 D-Star, received network header from DG9VH /ZEIT to CQCQCQ via DCS002 S
|
||||
// M: 2016-04-29 19:43:21.839 DMR Slot 2, received network voice header from DL1ESZ to TG 9
|
||||
// M: 2016-04-30 14:57:43.072 DMR Slot 2, received RF voice header from DG9VH to 5000
|
||||
function getHeardList($logLines) {
|
||||
function getHeardList($logLines, $onlyLast) {
|
||||
//array_multisort($logLines,SORT_DESC);
|
||||
$heardList = array();
|
||||
$ts1duration = "";
|
||||
|
@ -279,16 +287,19 @@ function getHeardList($logLines) {
|
|||
$duration = "";
|
||||
$loss ="";
|
||||
$ber = "";
|
||||
if ($onlyLast) {
|
||||
return $heardList;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $heardList;
|
||||
}
|
||||
|
||||
function getLastHeard($logLines) {
|
||||
function getLastHeard($logLines, $onlyLast) {
|
||||
//returns last heard list from log
|
||||
$lastHeard = array();
|
||||
$heardCalls = array();
|
||||
$heardList = getHeardList($logLines);
|
||||
$heardList = getHeardList($logLines, $onlyLast);
|
||||
$counter = 0;
|
||||
foreach ($heardList as $listElem) {
|
||||
if ( ($listElem[1] == "D-Star") || ($listElem[1] == "YSF") || (startsWith($listElem[1], "DMR")) ) {
|
||||
|
@ -526,16 +537,4 @@ function getName($callsign) {
|
|||
return $name;
|
||||
}
|
||||
|
||||
//Some basic inits
|
||||
$mmdvmconfigs = getMMDVMConfig();
|
||||
$logLinesMMDVM = getMMDVMLog();
|
||||
$reverseLogLinesMMDVM = $logLinesMMDVM;
|
||||
array_multisort($reverseLogLinesMMDVM,SORT_DESC);
|
||||
$lastHeard = getLastHeard($reverseLogLinesMMDVM);
|
||||
if (defined("ENABLEYSFGATEWAY")) {
|
||||
$YSFGatewayconfigs = getYSFGatewayConfig();
|
||||
$logLinesYSFGateway = getYSFGatewayLog();
|
||||
$reverseLogLinesYSFGateway = $logLinesYSFGateway;
|
||||
array_multisort($reverseLogLinesYSFGateway,SORT_DESC);
|
||||
}
|
||||
?>
|
||||
|
|
14
include/init.php
Normal file
14
include/init.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
//Some basic inits
|
||||
$mmdvmconfigs = getMMDVMConfig();
|
||||
$logLinesMMDVM = getMMDVMLog();
|
||||
$reverseLogLinesMMDVM = $logLinesMMDVM;
|
||||
array_multisort($reverseLogLinesMMDVM,SORT_DESC);
|
||||
$lastHeard = getLastHeard($reverseLogLinesMMDVM);
|
||||
if (defined("ENABLEYSFGATEWAY")) {
|
||||
$YSFGatewayconfigs = getYSFGatewayConfig();
|
||||
$logLinesYSFGateway = getYSFGatewayLog();
|
||||
$reverseLogLinesYSFGateway = $logLinesYSFGateway;
|
||||
array_multisort($reverseLogLinesYSFGateway,SORT_DESC);
|
||||
}
|
||||
?>
|
84
include/txinfo.php
Normal file
84
include/txinfo.php
Normal file
|
@ -0,0 +1,84 @@
|
|||
<div class="panel panel-default">
|
||||
<!-- Standard-Panel-Inhalt -->
|
||||
<div class="panel-heading">Currently TXing</div>
|
||||
<!-- Tabelle -->
|
||||
<div class="table-responsive">
|
||||
<table id="currtx" class="table table-condensed table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Time (UTC)</th>
|
||||
<th>Mode</th>
|
||||
<th>Callsign</th>
|
||||
<?php
|
||||
if (defined("ENABLEXTDLOOKUP")) {
|
||||
?>
|
||||
<th>Name</th>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<th>DSTAR-ID</th>
|
||||
<th>Target</th>
|
||||
<th>Source</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr id="txline">
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<?php
|
||||
if (defined("ENABLEXTDLOOKUP")) {
|
||||
?>
|
||||
<td></td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function doXMLHTTPRequest(scriptname, elem) {
|
||||
var xmlhttp;
|
||||
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
|
||||
xmlhttp=new XMLHttpRequest();
|
||||
} else {// code for IE6, IE5
|
||||
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
xmlhttp.onreadystatechange=function() {
|
||||
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
|
||||
document.getElementById(elem).innerHTML=xmlhttp.responseText;
|
||||
}
|
||||
}
|
||||
xmlhttp.open("GET",scriptname,true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function refreshInQSOAndLastHeardList() {
|
||||
doXMLHTTPRequest("txinfo.php","txline");
|
||||
}
|
||||
|
||||
var transmitting = false;
|
||||
function loadXMLDoc() {
|
||||
var xmlhttp;
|
||||
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
|
||||
xmlhttp=new XMLHttpRequest();
|
||||
} else {// code for IE6, IE5
|
||||
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
xmlhttp.onreadystatechange=function() {
|
||||
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
|
||||
document.getElementById("txline").innerHTML=xmlhttp.responseText;
|
||||
}
|
||||
}
|
||||
xmlhttp.open("GET","txinfo.php",true);
|
||||
xmlhttp.send();
|
||||
|
||||
var timeout = window.setTimeout("loadXMLDoc()", 1000);
|
||||
}
|
||||
loadXMLDoc();
|
||||
</script>
|
|
@ -8,6 +8,7 @@ $start = $time;
|
|||
include "config/config.php";
|
||||
include "include/tools.php";
|
||||
include "include/functions.php";
|
||||
include "include/init.php";
|
||||
include "version.php";
|
||||
?>
|
||||
<!doctype html>
|
||||
|
@ -63,6 +64,7 @@ if (defined("ENABLEMANAGEMENT")) {
|
|||
}
|
||||
checkSetup();
|
||||
// Here you can feel free to disable info-sections by commenting out with // before include
|
||||
include "include/txinfo.php";
|
||||
include "include/sysinfo.php";
|
||||
include "include/disk.php";
|
||||
include "include/repeaterinfo.php";
|
||||
|
|
28
txinfo.php
Normal file
28
txinfo.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
include "config/config.php";
|
||||
include "include/tools.php";
|
||||
include "include/functions.php";
|
||||
$mmdvmconfigs = getMMDVMConfig();
|
||||
$logLinesMMDVM = getShortMMDVMLog();
|
||||
$reverseLogLinesMMDVM = $logLinesMMDVM;
|
||||
array_multisort($reverseLogLinesMMDVM,SORT_DESC);
|
||||
$lastHeard = getLastHeard($reverseLogLinesMMDVM, True);
|
||||
$listElem = $lastHeard[0];
|
||||
if ($listElem[6] == null) {
|
||||
echo"<td class=\"nowrap\">$listElem[0]</td>";
|
||||
echo"<td class=\"nowrap\">$listElem[1]</td>";
|
||||
echo"<td class=\"nowrap\">$listElem[2]</td>";
|
||||
if (defined("ENABLEXTDLOOKUP")) {
|
||||
echo "<td class=\"nowrap\">".getName($listElem[2])."</td>";
|
||||
}
|
||||
echo"<td class=\"nowrap\">$listElem[3]</td>";
|
||||
echo"<td class=\"nowrap\">$listElem[4]</td>";
|
||||
if ($listElem[5] == "RF"){
|
||||
echo "<td class=\nowrap\"><span class=\"label label-success\">RF</span></td>";
|
||||
}else{
|
||||
echo"<td class=\"nowrap\">$listElem[5]</td>";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in a new issue