From 2bca0332dbdb5c518cef32b0b04094e0361f1ab8 Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 13 Aug 2025 16:53:09 +0000 Subject: [PATCH] Show Mode in DXCluster (preparation for passing it to the gate) --- application/models/Dxcluster_model.php | 64 ++++++++++++++++++++------ application/views/bandmap/list.php | 1 + assets/js/sections/bandmap_list.js | 16 +++++-- 3 files changed, 63 insertions(+), 18 deletions(-) diff --git a/application/models/Dxcluster_model.php b/application/models/Dxcluster_model.php index 26d5d494e7..b5f431dc9a 100644 --- a/application/models/Dxcluster_model.php +++ b/application/models/Dxcluster_model.php @@ -69,6 +69,7 @@ public function dxc_spotlist($band = '20m', $maxage = 60, $de = '', $mode = 'All continue; } $singlespot->band=$spotband; + $singlespot->mode=$this->get_mode($singlespot); if (($band != 'All') && ($band != $spotband)) { continue; } if (($mode != 'All') && ($mode != $this->modefilter($singlespot, $mode))) { continue; } $datetimecurrent = new DateTime("now", new DateTimeZone('UTC')); // Today's Date/Time @@ -134,6 +135,25 @@ public function dxc_spotlist($band = '20m', $maxage = 60, $de = '', $mode = 'All // We need to build functions that check the frequency limit // Right now this is just a proof of concept to determine mode + function get_mode($spot) { + if ($this->Frequency2Mode($spot->frequency) != '') { + return $this->Frequency2Mode($spot->frequency); + } + + // Fallbacks using message keywords + if (isset($spot->message)) { + $message = strtolower($spot->message); + if (strpos($message, 'cw') !== false) { + return 'cw';; + } + if ((strpos($message, 'ft8') !== false || strpos($message, 'rtty') !== false || strpos($message, 'sstv') !== false)) { + return 'digi';; + } + } + + return ''; + } + function modefilter($spot, $mode) { $mode = strtolower($mode); // Normalize case @@ -155,22 +175,36 @@ function modefilter($spot, $mode) { return false; } + public function Frequency2Mode($frequency) { + // Ensure frequency is in Hz if input is in kHz + if ($frequency < 1_000_000) { + $frequency *= 1000; + } + + foreach ($this->bandedges as $band) { + if ($frequency >= $band['frequencyfrom'] && $frequency < $band['frequencyto']) { + return $band['mode']; + } + } + return ''; + } + public function isFrequencyInMode($frequency, $mode) { - // Ensure frequency is in Hz if input is in kHz - if ($frequency < 1_000_000) { - $frequency *= 1000; - } - - foreach ($this->bandedges as $band) { - if (strtolower($band['mode']) === strtolower($mode)) { - if ($frequency >= $band['frequencyfrom'] && $frequency < $band['frequencyto']) { - return true; - } - } - } - - return false; - } + // Ensure frequency is in Hz if input is in kHz + if ($frequency < 1_000_000) { + $frequency *= 1000; + } + + foreach ($this->bandedges as $band) { + if (strtolower($band['mode']) === strtolower($mode)) { + if ($frequency >= $band['frequencyfrom'] && $frequency < $band['frequencyto']) { + return true; + } + } + } + + return false; + } public function dxc_qrg_lookup($qrg, $maxage = 120) { $this->load->helper(array('psr4_autoloader')); diff --git a/application/views/bandmap/list.php b/application/views/bandmap/list.php index 97f1f51a17..6ab6a769e6 100644 --- a/application/views/bandmap/list.php +++ b/application/views/bandmap/list.php @@ -132,6 +132,7 @@ + diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index 73535a916b..748f427572 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -26,7 +26,13 @@ $(function() { $(td).addClass("spotted_call"); $(td).attr( "title", lang_click_to_prepare_logging); } - } + }, + { + 'targets': 8, + 'createdCell': function (td, cellData, rowData, row, col) { + $(td).addClass("mode"); + } + }, ], "language": { url: getDataTablesLanguageUrl(), @@ -117,6 +123,7 @@ $(function() { } else { data[0].push(''); } + data[0].push(single.mode || ''); if (oldtable.length > 0) { let update=false; oldtable.each( function (srow) { @@ -233,15 +240,18 @@ $(function() { let ready_listener = true; let call=this.innerText; let qrg='' + let mode=''; if (this.parentNode.parentNode.className.indexOf('spotted_call')>=0) { qrg=this.parentNode.parentNode.parentNode.cells[1].textContent*1000; + mode=this.parentNode.parentNode.parentNode.cells[8].textContent; } else { qrg=this.parentNode.parentNode.cells[1].textContent*1000; + mode=this.parentNode.parentNode.cells[8].textContent; } try { - irrelevant=fetch(CatCallbackURL + '/'+qrg).catch(() => { - openedWindow = window.open(CatCallbackURL + '/' + qrg); + irrelevant=fetch(CatCallbackURL + '/'+qrg+'/'+mode).catch(() => { + openedWindow = window.open(CatCallbackURL + '/' + qrg + '/' + mode); openedWindow.close(); }); } finally {}