Convert bearing lookup to POST request

这个提交包含在:
phl0 2023-08-25 16:26:25 +02:00
父节点 522854377b
当前提交 3efcbf0b0d
找不到此签名对应的密钥
GPG 密钥 ID: 48EA1E640798CA9A
共有 3 个文件被更改,包括 31 次插入5 次删除

查看文件

@ -878,7 +878,9 @@ class Logbook extends CI_Controller {
/* return station bearing */
function searchbearing($locator, $station_id = null) {
function searchbearing() {
$locator = xss_clean($this->input->post('grid'));
$station_id = xss_clean($this->input->post('stationProfile'));
$this->load->library('Qra');
if($locator != null) {

查看文件

@ -26,9 +26,12 @@ class Qra {
$my = qra2latlong($tx);
$stn = qra2latlong($rx);
if ($my !== false && $stn !== false ) {
$bearing = bearing($my[0], $my[1], $stn[0], $stn[1], $unit);
return $bearing;
} else {
return false;
}
}
/*
@ -168,6 +171,11 @@ function qra2latlong($strQRA) {
if (substr_count($strQRA, ',') == 3) {
// Handle grid corners
$grids = explode(',', $strQRA);
$gridlengths = array(strlen($grids[0]), strlen($grids[1]), strlen($grids[2]), strlen($grids[3]));
$same = array_count_values($gridlengths);
if (count($same) != 1) {
return false;
}
$coords = array(0, 0);
for($i=0; $i<4; $i++) {
$cornercoords[$i] = qra2latlong($grids[$i]);
@ -178,6 +186,9 @@ function qra2latlong($strQRA) {
} else if (substr_count($strQRA, ',') == 1) {
// Handle grid lines
$grids = explode(',', $strQRA);
if (strlen($grids[0]) != strlen($grids[1])) {
return false;
}
$coords = array(0, 0);
for($i=0; $i<2; $i++) {
$linecoords[$i] = qra2latlong($grids[$i]);

查看文件

@ -829,7 +829,20 @@ $("#locator").keyup(function(){
markers.addLayer(marker).addTo(mymap);
})
$('#locator_info').load(base_url +"index.php/logbook/searchbearing/" + $(this).val() + "/" + $('#stationProfile').val()).fadeIn("slow");
$.ajax({
url: base_url + 'index.php/logbook/searchbearing',
type: 'post',
data: {
grid: $(this).val(),
stationProfile: $('#stationProfile').val()
},
success: function(data) {
$('#locator_info').html(data).fadeIn("slow");
},
error: function() {
$('#locator_info').text("Error loading bearing and distance").fadeIn("slow");
},
});
$.get(base_url + 'index.php/logbook/searchdistance/' + $(this).val() + "/" + $('#stationProfile').val(), function(result) {
document.getElementById("distance").value = result;
});