mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge pull request #2809 from phl0/checkSatSupport
Show info about SAT support by LoTW
This commit is contained in:
@@ -227,16 +227,25 @@ 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);
|
||||
}
|
||||
|
||||
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');
|
||||
@@ -384,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;
|
||||
@@ -660,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);
|
||||
}
|
||||
|
||||
@@ -189,9 +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');
|
||||
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();
|
||||
|
||||
@@ -38,6 +38,9 @@ switch ($date_format) {
|
||||
var lang_qso_wait_before_saving = "<?= __("Please wait before saving another QSO"); ?>";
|
||||
var latlng=[<?php echo $lat.','.$lng;?>];
|
||||
var user_date_format = "<?php echo $date_format; ?>"; // Pass the user's date format to JavaScript
|
||||
var lang_qso_sat_lotw_support_not_found = "<?= __("Satellite not found"); ?>";
|
||||
var lang_qso_sat_lotw_supported = "<?= __("Supported by LoTW"); ?>";
|
||||
var lang_qso_sat_lotw_not_supported = "<?= __("Not supported by LoTW"); ?>";
|
||||
</script>
|
||||
|
||||
<!--- DX Waterfall --->
|
||||
@@ -668,7 +671,9 @@ if (typeof window.DX_WATERFALL_FIELD_MAP === 'undefined') {
|
||||
<label for="sat_name"><?= __("Satellite Name"); ?></label>
|
||||
|
||||
<input list="satellite_names" id="sat_name" type="text" name="sat_name" class="form-control" value="<?php echo $this->session->userdata('sat_name'); ?>">
|
||||
|
||||
<div style="min-height: 24px;">
|
||||
<small id="lotw_support" class="form-text text-muted" style="min-height: 20px;"> </small>
|
||||
</div>
|
||||
<datalist id="satellite_names" class="satellite_names_list"></datalist>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<div class="tleinfo">
|
||||
<?php
|
||||
if ($tleinfo) {
|
||||
if ($tleinfo->tle) {
|
||||
echo sprintf(__("TLE information for %s (last updated: %s)"), $satinfo[0]->name, date($custom_date_format . " H:i", strtotime($tleinfo->updated)));
|
||||
echo '<br /><br /><pre>' . $tleinfo->tle . '</pre>';
|
||||
echo '<button class="btn btn-sm btn-danger deletetlebutton" onclick="deleteTle(' . $satinfo[0]->id . ');">'.__("Delete TLE"). '</button>';
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -933,10 +933,18 @@ $("#sat_name").on('change', function () {
|
||||
$("#selectPropagation").val("");
|
||||
stop_az_ele_ticker();
|
||||
} else {
|
||||
get_tles();
|
||||
$('#lotw_support').text("");
|
||||
$('#lotw_support').removeClass();
|
||||
get_sat_info();
|
||||
}
|
||||
});
|
||||
|
||||
$("#sat_name").on('focusout', function () {
|
||||
if ($(this).val().length == 0) {
|
||||
$('#lotw_support').text("");
|
||||
$('#lotw_support').removeClass();
|
||||
}
|
||||
});
|
||||
|
||||
var satupdater;
|
||||
|
||||
@@ -997,27 +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);
|
||||
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');
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
console.log('Something went wrong while trying to fetch TLE 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 () {
|
||||
@@ -1214,6 +1234,8 @@ function reset_fields() {
|
||||
pendingReferencesMap.clear();
|
||||
|
||||
$('#locator_info').text("");
|
||||
$('#lotw_support').text("");
|
||||
$('#lotw_support').removeClass();
|
||||
$('#comment').val("");
|
||||
$('#country').val("");
|
||||
$('#continent').val("");
|
||||
@@ -2846,6 +2868,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("");
|
||||
|
||||
Reference in New Issue
Block a user