diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 6ba957325..f593dd2f9 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -1263,16 +1263,6 @@ class Logbook extends CI_Controller { print json_encode($latlng); } - function latlngqrajson() { - $lat = xss_clean($this->input->post('lat')); - $lng = xss_clean($this->input->post('lng')); - if(!$this->load->is_loaded('Qra')) { - $this->load->library('Qra'); - } - $qra = $this->qra->latlong2qra($lat, $lng); - print json_encode($qra); - } - function get_qsos($num, $offset) { $this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_NAME, '.$this->config->item('table_name').'.COL_COUNTRY, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, station_profile.*'); $this->db->from($this->config->item('table_name')); diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 2e2eab2f2..8ce180acd 100644 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -103,6 +103,11 @@ class QSO extends CI_Controller { $options_object = $this->user_options_model->get_options('eqsl_default_qslmsg',array('option_name'=>'key_station_id','option_key'=>$data['active_station_profile']))->result(); $data['qslmsg'] = (isset($options_object[0]->option_value))?$options_object[0]->option_value:''; + $footerData = []; + $footerData['scripts'] = [ + 'assets/js/leaflet/geocoding.js', + ]; + if ($this->form_validation->run() == FALSE) { $data['page_title'] = __("Add QSO"); if (validation_errors() != '') { // we're coming from a failed ajax-call @@ -110,7 +115,7 @@ class QSO extends CI_Controller { } else { // we're not coming from a POST $this->load->view('interface_assets/header', $data); $this->load->view('qso/index'); - $this->load->view('interface_assets/footer'); + $this->load->view('interface_assets/footer', $footerData); } } else { // Store Basic QSO Info for reuse diff --git a/application/libraries/Qra.php b/application/libraries/Qra.php index bb43f2675..c7c63063f 100644 --- a/application/libraries/Qra.php +++ b/application/libraries/Qra.php @@ -217,24 +217,6 @@ class Qra { else if (preg_match('/^[A-Ra-r]{2}[0-9]{2}[A-Za-z]{2}[0-9]{2}[A-Za-z]{2}$/', $grid)) return true; return false; } - - function latlong2qra($lat, $lng) { - $longitude = intval($lng) + 180; - $latitude = intval($lat) + 90; - - $letterA = ord('A'); - $numberZero = ord('0'); - - $locator = chr($letterA + intval($longitude / 20)); - $locator .= chr($letterA + intval($latitude / 10)); - $locator .= chr($numberZero + intval(($longitude % 20) / 2)); - $locator .= chr($numberZero + intval($latitude % 10)); - $locator .= chr($letterA + intval(($longitude - intval($longitude / 2) * 2) / (2 / 24))); - $locator .= chr($letterA + intval(($latitude - intval($latitude / 1) * 1 ) / (1 / 24))); - - return $locator; - } - } diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index eb55476a9..aa0e94ae7 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -1117,20 +1117,7 @@ $($('#callsign')).on('keypress',function(e) { id: 'mapbox.streets' }).addTo(mymap); mymap.on('click', function(e) { - $.ajax({ - url: base_url + 'index.php/logbook/latlngqrajson', - type: 'post', - data: { - lat: e.latlng.lat, - lng: e.latlng.lng - }, - success: function(data) { - result = JSON.parse(data); - $('#locator').val(result).trigger('input'); - }, - error: function() { - }, - }); + $('#locator').val((latLngToLocator(e.latlng.lat, e.latlng.lng).toUpperCase())); });