From 001c4984800097bf0b91b0df2df9e9ca857e1c41 Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 13 Jan 2026 23:49:37 +0100 Subject: [PATCH 1/5] Show info about SAT support by LoTW --- application/controllers/Satellite.php | 9 ++++++ application/models/Satellite_model.php | 7 ++++ application/views/qso/index.php | 7 +++- assets/js/sections/qso.js | 44 ++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 1 deletion(-) diff --git a/application/controllers/Satellite.php b/application/controllers/Satellite.php index 129669559..cdf285253 100644 --- a/application/controllers/Satellite.php +++ b/application/controllers/Satellite.php @@ -237,6 +237,15 @@ class Satellite extends CI_Controller { echo json_encode($satellite_data, JSON_FORCE_OBJECT); } + public function lotw_support() { + $sat = $this->security->xss_clean($this->input->post('sat')); + $this->load->model('satellite_model'); + $lotw_data = $this->satellite_model->lotw_support($sat); + + header('Content-Type: application/json'); + echo json_encode($lotw_data); + } + public function pass() { $this->load->model('satellite_model'); diff --git a/application/models/Satellite_model.php b/application/models/Satellite_model.php index 46a7d0784..4e435ed5e 100644 --- a/application/models/Satellite_model.php +++ b/application/models/Satellite_model.php @@ -197,6 +197,13 @@ class Satellite_model extends CI_Model { return $query->row(); } + function lotw_support($sat) { + $this->db->select('satellite.lotw AS lotw_support'); + $this->db->where('name', $sat); + $query = $this->db->get('satellite'); + return $query->row(); + } + } ?> diff --git a/application/views/qso/index.php b/application/views/qso/index.php index bd657926b..b2d5ec4a3 100644 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -38,6 +38,9 @@ switch ($date_format) { var lang_qso_wait_before_saving = ""; var latlng=[]; var user_date_format = ""; // Pass the user's date format to JavaScript + var lang_qso_sat_lotw_support_not_found = ""; + var lang_qso_sat_lotw_supported = ""; + var lang_qso_sat_lotw_not_supported = ""; @@ -668,7 +671,9 @@ if (typeof window.DX_WATERFALL_FIELD_MAP === 'undefined') { - +
+   +
diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 8b8e61e86..83578e432 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -933,10 +933,19 @@ $("#sat_name").on('change', function () { $("#selectPropagation").val(""); stop_az_ele_ticker(); } else { + $('#lotw_support').text(""); + $('#lotw_support').removeClass(); get_tles(); + get_lotw_support(); } }); +$("#sat_name").on('focusout', function () { + if ($(this).val().length == 0) { + $('#lotw_support').text(""); + $('#lotw_support').removeClass(); + } +}); var satupdater; @@ -1016,6 +1025,37 @@ function get_tles() { }); } +function get_lotw_support() { + $.ajax({ + url: base_url + 'index.php/satellite/lotw_support', + type: 'post', + data: { + sat: $("#sat_name").val(), + }, + success: function (data) { + if (data == null) { + $('#lotw_support').html(lang_qso_sat_lotw_support_not_found).fadeIn("slow"); + $('#lotw_support').addClass('badge bg-warning'); + //} else if (typeof data === 'string') { + } else { + console.log("TEST "+data.lotw_support); + if (data) { + if (data.lotw_support == 'Y') { + $('#lotw_support').html(lang_qso_sat_lotw_supported).fadeIn("slow"); + $('#lotw_support').addClass('badge bg-success'); + } else if (data.lotw_support == 'N') { + $('#lotw_support').html(lang_qso_sat_lotw_not_supported).fadeIn("slow"); + $('#lotw_support').addClass('badge bg-danger'); + } + } + } + }, + error: function (data) { + console.log('Something went wrong while trying to determine LoTW support for sat: '+$("#sat_name")); + }, + }); +} + if ($("#sat_name").val() !== '') { get_tles(); } @@ -1214,6 +1254,8 @@ function reset_fields() { pendingReferencesMap.clear(); $('#locator_info').text(""); + $('#lotw_support').text(""); + $('#lotw_support').removeClass(); $('#comment').val(""); $('#country').val(""); $('#continent').val(""); @@ -2846,6 +2888,8 @@ function highlightSCP(term, base) { function resetDefaultQSOFields() { $('#callsign_info').text(""); $('#locator_info').text(""); + $('#lotw_support').text(""); + $('#lotw_support').removeClass(); $('#country').val(""); $('#continent').val(""); $("#distance").val(""); From 32748c6e3ccdf5db2429066e8fd9db3aee568473 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 14 Jan 2026 09:40:07 +0100 Subject: [PATCH 2/5] Remove debug stuff --- assets/js/sections/qso.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 83578e432..3fed03b2f 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -1036,9 +1036,7 @@ function get_lotw_support() { if (data == null) { $('#lotw_support').html(lang_qso_sat_lotw_support_not_found).fadeIn("slow"); $('#lotw_support').addClass('badge bg-warning'); - //} else if (typeof data === 'string') { } else { - console.log("TEST "+data.lotw_support); if (data) { if (data.lotw_support == 'Y') { $('#lotw_support').html(lang_qso_sat_lotw_supported).fadeIn("slow"); From dc4da32f2671a715d02be261339425daa4bfb351 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 14 Jan 2026 09:41:27 +0100 Subject: [PATCH 3/5] Rephrase and correct --- application/views/qso/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/views/qso/index.php b/application/views/qso/index.php index b2d5ec4a3..c3424093a 100644 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -38,9 +38,9 @@ switch ($date_format) { var lang_qso_wait_before_saving = ""; var latlng=[]; var user_date_format = ""; // Pass the user's date format to JavaScript - var lang_qso_sat_lotw_support_not_found = ""; - var lang_qso_sat_lotw_supported = ""; - var lang_qso_sat_lotw_not_supported = ""; + var lang_qso_sat_lotw_support_not_found = ""; + var lang_qso_sat_lotw_supported = ""; + var lang_qso_sat_lotw_not_supported = ""; From 8f20b339fd58b58d14614e28db8884c176290293 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 14 Jan 2026 10:04:35 +0100 Subject: [PATCH 4/5] Merge into a single (existing) lookup request --- application/controllers/Satellite.php | 10 ++--- application/models/Satellite_model.php | 13 ++----- application/views/satellite/tleinfo.php | 2 +- assets/js/sections/qso.js | 50 ++++++++----------------- 4 files changed, 25 insertions(+), 50 deletions(-) diff --git a/application/controllers/Satellite.php b/application/controllers/Satellite.php index cdf285253..8638cfc6f 100644 --- a/application/controllers/Satellite.php +++ b/application/controllers/Satellite.php @@ -227,11 +227,11 @@ class Satellite extends CI_Controller { $this->load->view('satellite/schedule',$data); } - public function get_tle() { + public function get_sat_info() { $sat = $this->security->xss_clean($this->input->post('sat')); $this->load->model('satellite_model'); - $satellite_data = $this->satellite_model->get_tle($sat); + $satellite_data = $this->satellite_model->get_sat_info($sat); header('Content-Type: application/json'); echo json_encode($satellite_data, JSON_FORCE_OBJECT); @@ -393,12 +393,12 @@ class Satellite extends CI_Controller { foreach ($satellites as $sat) { // Loop through known SATs if ( (count($input_sat) > 0) && !((count($input_sat) == 1) && (($input_sat[0] ?? '') == '')) ) { // User wants specific SATs (which isn't "All" or empty)?? if (in_array($sat->satname,$input_sat)) { - $tles[]=$this->satellite_model->get_tle($sat->satname); + $tles[]=$this->satellite_model->get_sat_info($sat->satname); } else { continue; } } else { // No specific SAT, but all - $tles[]=$this->satellite_model->get_tle($sat->satname); + $tles[]=$this->satellite_model->get_sat_info($sat->satname); } } return $tles; @@ -669,7 +669,7 @@ class Satellite extends CI_Controller { $this->load->model('satellite_model'); $data['satinfo'] = $this->satellite_model->getsatellite($id)->result(); - $data['tleinfo'] = $this->satellite_model->get_tle($data['satinfo'][0]->name); + $data['tleinfo'] = $this->satellite_model->get_sat_info($data['satinfo'][0]->name); $this->load->view('satellite/tleinfo', $data); } diff --git a/application/models/Satellite_model.php b/application/models/Satellite_model.php index 4e435ed5e..67fa8f6b4 100644 --- a/application/models/Satellite_model.php +++ b/application/models/Satellite_model.php @@ -189,16 +189,9 @@ class Satellite_model extends CI_Model { return $groups; } - function get_tle($sat) { - $this->db->select('satellite.name AS satellite, satellite.displayname AS displayname, tle.tle, tle.updated'); - $this->db->join('tle', 'satellite.id = tle.satelliteid'); - $this->db->where('name', $sat); - $query = $this->db->get('satellite'); - return $query->row(); - } - - function lotw_support($sat) { - $this->db->select('satellite.lotw AS lotw_support'); + function get_sat_info($sat) { + $this->db->select('satellite.name AS satellite, satellite.displayname AS displayname, tle.tle, tle.updated, satellite.lotw AS lotw_support'); + $this->db->join('tle', 'satellite.id = tle.satelliteid', 'left'); $this->db->where('name', $sat); $query = $this->db->get('satellite'); return $query->row(); diff --git a/application/views/satellite/tleinfo.php b/application/views/satellite/tleinfo.php index 81ee748dd..6806ef1bb 100644 --- a/application/views/satellite/tleinfo.php +++ b/application/views/satellite/tleinfo.php @@ -2,7 +2,7 @@
tle) { echo sprintf(__("TLE information for %s (last updated: %s)"), $satinfo[0]->name, date($custom_date_format . " H:i", strtotime($tleinfo->updated))); echo '

' . $tleinfo->tle . '
'; echo ''; diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 3fed03b2f..73ecb119e 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -935,8 +935,7 @@ $("#sat_name").on('change', function () { } else { $('#lotw_support').text(""); $('#lotw_support').removeClass(); - get_tles(); - get_lotw_support(); + get_sat_info(); } }); @@ -1006,56 +1005,39 @@ function start_az_ele_ticker(tle) { satupdater=setInterval(updateAzEl, 1000); } -function get_tles() { +function get_sat_info() { stop_az_ele_ticker(); $.ajax({ - url: base_url + 'index.php/satellite/get_tle', + url: base_url + 'index.php/satellite/get_sat_info', type: 'post', data: { sat: $("#sat_name").val(), }, success: function (data) { if (data !== null) { - start_az_ele_ticker(data); - } - }, - error: function (data) { - console.log('Something went wrong while trying to fetch TLE for sat: '+$("#sat_name")); - }, - }); -} - -function get_lotw_support() { - $.ajax({ - url: base_url + 'index.php/satellite/lotw_support', - type: 'post', - data: { - sat: $("#sat_name").val(), - }, - success: function (data) { - if (data == null) { + if (data.tle) { + start_az_ele_ticker(data); + } + if (data.lotw_support == 'Y') { + $('#lotw_support').html(lang_qso_sat_lotw_supported).fadeIn("slow"); + $('#lotw_support').addClass('badge bg-success'); + } else if (data.lotw_support == 'N') { + $('#lotw_support').html(lang_qso_sat_lotw_not_supported).fadeIn("slow"); + $('#lotw_support').addClass('badge bg-danger'); + } + } else { $('#lotw_support').html(lang_qso_sat_lotw_support_not_found).fadeIn("slow"); $('#lotw_support').addClass('badge bg-warning'); - } else { - if (data) { - if (data.lotw_support == 'Y') { - $('#lotw_support').html(lang_qso_sat_lotw_supported).fadeIn("slow"); - $('#lotw_support').addClass('badge bg-success'); - } else if (data.lotw_support == 'N') { - $('#lotw_support').html(lang_qso_sat_lotw_not_supported).fadeIn("slow"); - $('#lotw_support').addClass('badge bg-danger'); - } - } } }, error: function (data) { - console.log('Something went wrong while trying to determine LoTW support for sat: '+$("#sat_name")); + console.log('Something went wrong while trying to fetch info for sat: '+$("#sat_name")); }, }); } if ($("#sat_name").val() !== '') { - get_tles(); + get_sat_info(); } $('#stateDropdown').on('change', function () { From 6e6bc0b73a534b53e2b3e30af28c2df3d6648439 Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 20 Jan 2026 08:22:09 +0100 Subject: [PATCH 5/5] Fix flightpath --- assets/js/sections/flightpath.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/sections/flightpath.js b/assets/js/sections/flightpath.js index 3e6cfaebc..94d06e5d2 100644 --- a/assets/js/sections/flightpath.js +++ b/assets/js/sections/flightpath.js @@ -719,7 +719,7 @@ function plot_sat() { } $.ajax({ - url: base_url + 'index.php/satellite/get_tle', + url: base_url + 'index.php/satellite/get_sat_info', type: 'post', data: { sat: $("#sats").val(),