From 149b37b09a6e29a83e73d4f240b145e862f0111b Mon Sep 17 00:00:00 2001 From: Steven Hiscocks Date: Sat, 26 Apr 2025 17:39:49 +0100 Subject: [PATCH] Add WWBOTA spots --- ajax/trigger_update.php | 2 +- db.inc.php | 5 +++++ destinations.php | 7 ++++++- js/trigger_editor.js | 37 +++++++++++++++++++++++++++++++++++++ js/triggers.js | 13 +++++++++++-- myspot.php | 3 +++ 6 files changed, 63 insertions(+), 4 deletions(-) diff --git a/ajax/trigger_update.php b/ajax/trigger_update.php index 4a6708c..62c4bc1 100644 --- a/ajax/trigger_update.php +++ b/ajax/trigger_update.php @@ -9,7 +9,7 @@ refreshUser(); // Validate -$arrayConditions = ['summitRef', 'callsign', 'fullCallsign', 'notCallsign', 'notFullCallsign', 'prefix', 'notPrefix', 'spotter', 'notSpotter', 'spotterPrefix', 'mode', 'band', 'source', 'dxcc', 'callsignDxcc', 'spotterDxcc', 'cq', 'spotterCq', 'continent', 'spotterContinent', 'qsl', 'state', 'spotterState', 'summitAssociation', 'summitRegion', 'iotaGroupRef', 'wwffDivision', 'wwffRef', 'bandslot']; +$arrayConditions = ['summitRef', 'callsign', 'fullCallsign', 'notCallsign', 'notFullCallsign', 'prefix', 'notPrefix', 'spotter', 'notSpotter', 'spotterPrefix', 'mode', 'band', 'source', 'dxcc', 'callsignDxcc', 'spotterDxcc', 'cq', 'spotterCq', 'continent', 'spotterContinent', 'qsl', 'state', 'spotterState', 'summitAssociation', 'summitRegion', 'iotaGroupRef', 'wwffDivision', 'wwffRef', 'wwbotaScheme', 'bandslot']; $arrayMaxEntries = 5000; $errors = []; if (!is_array($trigger['conditions'])) diff --git a/db.inc.php b/db.inc.php index 439f826..6d3f760 100644 --- a/db.inc.php +++ b/db.inc.php @@ -414,6 +414,11 @@ function getWwffParksForDivision($division) { return $db->wwffParks->find(['division' => $division, 'status' => 'active'], ['sort' => ['reference' => 1]])->toArray(); } +function getAllWwbotaSchemes() { + global $db; + return $db->wwffSchemes->find([], ['sort' => ['scheme' => 1]])->toArray(); +} + function getAllIotaGroups() { global $db; return $db->iotaGroups->find([], ['sort' => ['grpRef' => 1]])->toArray(); diff --git a/destinations.php b/destinations.php index 7b7d0c3..1e8f34d 100644 --- a/destinations.php +++ b/destinations.php @@ -468,7 +468,7 @@ function removeDevice(el) { source - Spot source: 'rbn', 'sotawatch', 'cluster', 'pskreporter', 'pota' or 'wwff' + Spot source: 'rbn', 'sotawatch', 'cluster', 'pskreporter', 'pota', 'wwff' or 'wwbota' rbn @@ -546,6 +546,11 @@ function removeDevice(el) { Park reference * EAFF-0065 + + wwbotaScheme + WWBOTA scheme * + UKBOTA + diff --git a/js/trigger_editor.js b/js/trigger_editor.js index 0deb02b..bbb0bf4 100644 --- a/js/trigger_editor.js +++ b/js/trigger_editor.js @@ -2,6 +2,7 @@ var currentTrigger; var dxccs, dxccKeyValueList; var associations, associationsKeyValueList; var wwffDivisions, wwffDivisionsKeyValueList; +var wwbotaSchemes, wwbotaSchemesKeyValueList; var iotaGroups, iotaGroupsKeyValueList; var hasChanges; @@ -162,6 +163,13 @@ var editorFunctions = { 'wwffRefs': function(conditionName) { return conditionTextArea(conditionName) }, + 'wwbotaScheme': function(conditionName) { + return conditionValuePickerAsync(conditionName, function(callback) { + fetchWwbotaSchemes(function(wwbotaSchemes, wwbotaSchemesKeyValueList) { + callback(wwbotaSchemesKeyValueList); + }) + }); + }, 'iotaGroupRef': function(conditionName) { return conditionValuePickerAsync(conditionName, function(callback) { fetchIotaGroups(function(iotaGroups, iotaGroupsKeyValueList) { @@ -266,6 +274,25 @@ function fetchWwffDivisions(callback) { }); } +function fetchWwbotaSchemes(callback) { + if (wwbotaSchemes) { + callback(wwbotaSchemes, wwbotaSchemesKeyValueList); + return; + } + + $.get({ + url: 'ajax/wwbota_schemes', + success: function(newWwbotaSchemes) { + wwbotaSchemes = {}; + newWwbotaSchemes.forEach(function(scheme) { + wwbotaSchemes[scheme.scheme] = scheme; + }); + wwbotaSchemesKeyValueList = makeWwbotaSchemesKeyValueList(newWwbotaSchemes); + callback(wwbotaSchemes, wwbotaSchemesKeyValueList); + } + }); +} + function fetchIotaGroups(callback) { if (iotaGroups) { callback(iotaGroups, iotaGroupsKeyValueList); @@ -904,6 +931,16 @@ function makeWwffDivisionsKeyValueList(wwffDivisions) { return kvl; } +// Returns an array of key/value pairs +function makeWwbotaSchemesKeyValueList(wwbotaSchemes) { + var kvl = wwbotaSchemes.map(function(value) { + return [value.scheme, value.scheme, undefined]; + }); + // add "any" entry + kvl.unshift(['*', '* (any)']); + return kvl; +} + function makeWwffParksKeyValueList(parks) { return parks.map(function(value) { // Limit park name length to avoid breaking popup diff --git a/js/triggers.js b/js/triggers.js index 8cc3b47..634b25d 100644 --- a/js/triggers.js +++ b/js/triggers.js @@ -35,7 +35,8 @@ var conditionLabels = { 'summitRefs': 'Summit reference list', 'wwffDivision': 'Park division', 'wwffRef': 'Park reference', - 'wwffRefs': 'Park reference list' + 'wwffRefs': 'Park reference list', + 'wwbotaScheme': 'WWBOTA scheme', }; var conditionsOrder = [ @@ -48,6 +49,7 @@ var conditionsOrder = [ 'iotaGroupRef', 'summitAssociation', 'summitRegion', 'summitRef', 'summitRefs', 'summitPointsFrom', 'summitActivationsFrom', 'wwffDivision', 'wwffRef', 'wwffRefs', + 'wwffScheme', 'notCallsign', 'notFullCallsign', 'notSpotter', 'notPrefix' ]; @@ -61,6 +63,7 @@ var conditionsGroups = [ {title: 'IOTA', conditions: ['iotaGroupRef']}, {title: 'SOTA', conditions: ['summitAssociation', 'summitRegion', 'summitRef', 'summitRefs', 'summitPointsFrom', 'summitActivationsFrom']}, {title: 'WWFF/POTA', conditions: ['wwffDivision', 'wwffRef', 'wwffRefs']}, + {title: 'WWBOTA', conditions: ['wwffScheme']}, {title: 'Callsign exclusions', conditions: ['notCallsign', 'notFullCallsign', 'notSpotter', 'notPrefix']} ]; @@ -237,6 +240,11 @@ var arrayConditions = { maxDisplaySmall: 2, suffix: 'parks' }, + 'wwbotaScheme': { + maxDisplay: 3, + maxDisplaySmall: 5, + suffix: 'schemes' + }, }; var sources = { @@ -245,7 +253,8 @@ var sources = { 'cluster': 'Cluster', 'pskreporter': 'PSK Reporter', 'pota': 'POTA', - 'wwff': 'WWFFwatch' + 'wwff': 'WWFFwatch', + 'wwbota': 'WWBOTA' }; var modes = { diff --git a/myspot.php b/myspot.php index 6c14523..142fc0b 100644 --- a/myspot.php +++ b/myspot.php @@ -54,6 +54,9 @@ } else if (@$spot['wwffRef']) { $addInfo = "WWFF: " . $spot['wwffRef'] . " " . $spot['wwffName']; } + } else if (@$spot['wwbotaRef']) { + $addInfo = "WWBOTA: " . $spot['wwbotaRef'] . " " . $spot['wwbotaName']; + } $spotInfo = "last spotted on " . $spot['receivedDate']->toDateTime()->format("Y-m-d H:i:s") . "Z\nby " . $spot['spotter'] . " via " . $config['sources'][$spot['source']]; if (preg_match("/^SIMULATED/", @$spot['rawText'])) $spotInfo .= " (simulated)";