mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Show info about SAT support by LoTW
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -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 = "<?= __("Satelite not found"); ?>";
|
||||
var lang_qso_sat_lotw_supported = "<?= __("LoTW support"); ?>";
|
||||
var lang_qso_sat_lotw_not_supported = "<?= __("No LoTW support"); ?>";
|
||||
</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>
|
||||
|
||||
|
||||
@@ -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("");
|
||||
|
||||
Reference in New Issue
Block a user