Browse Source

automatically fill in member number in manual logging mode

master
Fabian Kurz 2 months ago
parent
commit
c42314ff6a
  1. 4
      api.php
  2. 17
      functions.php
  3. 25
      index.php

4
api.php

@ -76,6 +76,10 @@
}
echo lookup($call, 'json', $date);
break;
case 'member_lookup':
$call = validate_get('hiscall');
echo member_lookup($call);
break;
case 'overview':
echo stats($_SESSION['callsign']);
break;

17
functions.php

@ -181,7 +181,7 @@ function aca($c, $y) {
echo mysqli_error($db);
}
$cnt = 1;
$ret .= "<table><tr><th>Count</th><th>CWops</th><th>Call</th><th>Date</th><th>Band</th></tr>\n";
$ret .= "<table><tr><th>Count</th><th>CWops</th><th>Call</th><th>Date</th><th>Band (m)</th></tr>\n";
while ($r = mysqli_fetch_row($q)) {
$ret .= "<tr><td>".$cnt++."</td><td>".$r[0]."</td><td>".$r[1]."</td><td>".$r[2]."</td><td>".$r[3]."</td></tr>\n";
}
@ -199,7 +199,7 @@ function cma($c) {
echo mysqli_error($db);
}
$cnt = 1;
$ret .= "<table><tr><th>Count</th><th>CWops</th><th>Call</th><th>Date</th><th>Band</th></tr>\n";
$ret .= "<table><tr><th>Count</th><th>CWops</th><th>Call</th><th>Date</th><th>Band (m)</th></tr>\n";
while ($r = mysqli_fetch_row($q)) {
$ret .= "<tr><td>".$cnt++."</td><td>".$r[0]."</td><td>".$r[1]."</td><td>".$r[2]."</td><td>".$r[3]."</td></tr>\n";
}
@ -748,6 +748,17 @@ function f2b ($f) {
return 0;
}
function member_lookup($call) {
global $associates;
$members = get_memberlist($call);
foreach ($members as $m) {
if ($m["callsign"] == $call) {
return json_encode($m);
}
}
}
# look up calls on HamQTH's API
# Save all data in a local Redis Database to avoid flooding the API
# Also load exceptions from OK1RR's country file.
@ -963,7 +974,7 @@ function editformline($hiscallv, $nrv, $datev, $bandv, $dxccv, $wazv, $wasv, $wa
<input type="text" name="hiscall<?=$edit;?>" id="hiscall<?=$edit;?>" value="<?=$hiscallv;?>" <?
if ($new) {
?>
onblur="javascript:dxcc_lookup(this.value);"
onblur="javascript:dxcc_lookup(this.value);member_lookup(this.value);"
<?
}
?> size=10>

25
index.php

@ -219,6 +219,31 @@ if (array_key_exists("id", $_SESSION)) {
request.send();
}
// When entering a QSO manually, fill FOC nr and status
function member_lookup(c) {
console.log("member_lookup=" + c);
var request = new XMLHttpRequest();
request.open("GET", '/api?action=member_lookup&hiscall=' + c, true);
request.onreadystatechange = function() {
var done = 4, ok = 200;
if (request.readyState == done && request.status == ok) {
if (request.responseText) {
try {
var o = JSON.parse(request.responseText);
if (o['nr']) {
var d = document.getElementById('nr0');
d.value = o['nr'];
}
}
catch (e) {
console.log("parsing lookup json failed");
}
}
}
}
request.send();
}
function clear_form (nr) {
var items = ['hiscall', 'nr', 'date', 'band'];

Loading…
Cancel
Save