[Advanced Logbook] Added continent link

This commit is contained in:
Andreas Kristiansen
2025-02-05 15:32:40 +01:00
parent 633027686a
commit a57918d872
2 changed files with 17 additions and 12 deletions

View File

@@ -2,8 +2,6 @@ var callBookProcessingDialog = null;
var inCallbookProcessing = false;
var inCallbookItemProcessing = false;
// Array of valid continent codes
const validContinents = ['AF', 'EU', 'AS', 'SA', 'NA', 'OC', 'AN'];
$('#band').change(function () {
var band = $("#band option:selected").text();
@@ -321,15 +319,7 @@ function loadQSOTable(rows) {
data.push(qso.deRefs);
}
if (user_options.continent.show == "true"){
if (qso.continent === '') {
data.push(qso.continent);
} else if (!validContinents.includes(qso.continent.toUpperCase())) {
// Check if qso.continent is not in the list of valid continents
data.push('<span class="bg-danger">Invalid continent</span> ' + qso.continent);
} else {
// Continent is valid
data.push(qso.continent);
}
data.push(qso.continent);
}
if (user_options.distance.show == "true"){
data.push(qso.distance);

View File

@@ -288,6 +288,21 @@ class QSO
}
/**
* @return string
*/
function getContinentLink(): string
{
if ($this->continent == '') return '';
$validContinents = ['AF', 'EU', 'AS', 'SA', 'NA', 'OC', 'AN'];
if (in_array($this->continent, $validContinents, true)) {
return '<a href="javascript:spawnLookupModal(\''.strtolower($this->continent).'\',\'continent\');">'.$this->continent.'</a>';
}
return '<span class="bg-danger">Invalid continent</span> ' . $this->continent;
}
/**
* @return string
*/
@@ -1223,7 +1238,7 @@ class QSO
'dok' => $this->getFormattedDok(),
'wwff' => $this->getFormattedWwff(),
'sig' => $this->getFormattedSig(),
'continent' => $this->continent,
'continent' => $this->getContinentLink(),
'profilename' => $this->profilename,
'stationpower' => empty($this->stationpower) ? null : $this->stationpower.' W',
'distance' => $this->getFormattedDistance(),