From e01aaa31f80ef09da3ac1ff0bec98b4a4f1776e5 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Sat, 15 Jul 2023 15:29:35 +0200 Subject: [PATCH 1/7] [Gridmap] Added button to clear lines and markers on map --- application/views/gridmap/index.php | 5 +++-- assets/js/leaflet/geocoding.js | 10 ++++++++++ assets/js/sections/gridmap.js | 21 +++++++++++++++++---- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/application/views/gridmap/index.php b/application/views/gridmap/index.php index 158ed40c..43168a75 100644 --- a/application/views/gridmap/index.php +++ b/application/views/gridmap/index.php @@ -27,7 +27,7 @@ margin: 0 8px 0 0; } .coordinates { - justify-content: center; + justify-content: center; align-items: stretch; } .cohidden { @@ -108,7 +108,8 @@ - + + session->flashdata('message')) { ?> diff --git a/assets/js/leaflet/geocoding.js b/assets/js/leaflet/geocoding.js index 4730d2ae..39bb9de2 100644 --- a/assets/js/leaflet/geocoding.js +++ b/assets/js/leaflet/geocoding.js @@ -6,6 +6,9 @@ const degToRad = deg => (deg % 360) * Math.PI / 180; const radToDeg = rad => (rad / Math.PI *180) % 360; const isValidPoint = (lat, lng) => (lat >= -90 && lat <= 90) && (lng >= -180 && lng <= 180); +var clickmarkers = []; +var clicklines = []; + function ConvertDDToDMS(lat, lng) { var LatLng = []; @@ -79,6 +82,8 @@ function onMapClick(event) { var marker = L.marker([fromCoords[0], fromCoords[1]], {closeOnClick: false, autoClose: false}).addTo(map).bindPopup(homegrid); + clickmarkers.push(marker); + var result = bearingDistance(homegrid, locator); var distance = Math.round(result.km * 10) / 10 + ' km'; @@ -99,6 +104,9 @@ function onMapClick(event) { var marker2 = L.marker([lat, lng], {closeOnClick: false, autoClose: false}).addTo(map); + + clickmarkers.push(marker2); + marker2.bindTooltip(popupmessage); const geodesic = L.geodesic(multiplelines, { @@ -108,6 +116,8 @@ function onMapClick(event) { wrap: false, steps: 100 }).addTo(map); + + clicklines.push(geodesic); }; const bearingDistance = (from, to) => { diff --git a/assets/js/sections/gridmap.js b/assets/js/sections/gridmap.js index 06af4d2f..b8ab1687 100644 --- a/assets/js/sections/gridmap.js +++ b/assets/js/sections/gridmap.js @@ -16,8 +16,8 @@ var grid_four_confirmed = ''; var grid_six_confirmed = ''; function gridPlot(form) { - $(".ld-ext-right").addClass('running'); - $(".ld-ext-right").prop('disabled', true); + $(".ld-ext-right-plot").addClass('running'); + $(".ld-ext-right-plot").prop('disabled', true); $('#plot').prop("disabled", true); // If map is already initialized var container = L.DomUtil.get('gridsquare_map'); @@ -41,8 +41,8 @@ function gridPlot(form) { }, success: function (data) { $('.cohidden').show(); - $(".ld-ext-right").removeClass('running'); - $(".ld-ext-right").prop('disabled', false); + $(".ld-ext-right-plot").removeClass('running'); + $(".ld-ext-right-plot").prop('disabled', false); $('#plot').prop("disabled", false); grid_two = data.grid_2char; grid_four = data.grid_4char; @@ -148,6 +148,19 @@ function spawnGridsquareModal(loc_4char) { }); } +function clearMarkers() { + $(".ld-ext-right-clear").addClass('running'); + $(".ld-ext-right-clear").prop('disabled', true); + clicklines.forEach(function (item) { + map.removeLayer(item) + }); + clickmarkers.forEach(function (item) { + map.removeLayer(item) + }); + $(".ld-ext-right-clear").removeClass('running'); + $(".ld-ext-right-clear").prop('disabled', false); +} + $(document).ready(function(){ gridPlot(this.form); }) From 6aab4f7bbcec8efc22d54a3de0afa689703df9d0 Mon Sep 17 00:00:00 2001 From: int2001 Date: Sun, 16 Jul 2023 11:53:53 +0000 Subject: [PATCH 2/7] Implemented DXCluster-Lookup for current QRG --- application/config/config.sample.php | 13 +++++++++++++ application/views/interface_assets/footer.php | 18 +++++++++++++++++- application/views/qso/index.php | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/application/config/config.sample.php b/application/config/config.sample.php index 081a62e8..b388af57 100644 --- a/application/config/config.sample.php +++ b/application/config/config.sample.php @@ -598,3 +598,16 @@ $config['rewrite_short_tags'] = FALSE; | Array: array('10.0.1.200', '192.168.5.0/24') */ $config['proxy_ips'] = ''; + +/* +|-------------------------------------------------------------------------- +| DXCluster-API Base-URL +|-------------------------------------------------------------------------- +| +| If you have access to a DXCluster-API ( see https://github.com/int2001/DXClusterAPI for running your own ) +| put the base-URL for that API here +| +| Example: 'https://log.jo30.de/dxcache' +| Leave blank to disable: '' +*/ +$config['dxcluster_provider']=''; diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 574f57fb..dd753bf6 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -933,9 +933,25 @@ $(document).on('keypress',function(e) { uri->segment(1) == "qso") { ?> - config->item('dxcluster_provider') != ''){ ?> + +load->model('stations'); $active_station_id = $this->stations->find_active(); $station_profile = $this->stations->profile($active_station_id); diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 4533b6b5..ec127c54 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -63,7 +63,7 @@
- + config->item('dxcluster_provider') != '') { ?> 
From 1857151ba42c9fd49ccd17b6e640a25f2a425d54 Mon Sep 17 00:00:00 2001 From: int2001 Date: Sun, 16 Jul 2023 12:43:13 +0000 Subject: [PATCH 3/7] Trigger QRZ-Lookup, etc. after DXCluster-Lookup in js --- application/views/interface_assets/footer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index dd753bf6..ddf0dc07 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -943,6 +943,7 @@ $(document).on('keypress',function(e) { $.ajax({ url: dxcluster_provider+"/spot/"+$("#frequency").val()/1000, cache: false, dataType: "json" }).done( function(dxspot) { $("#callsign").val(dxspot.spotted); + $("#callsign").trigger("blur"); } ); }); From 9783cf0ec3a2ff3a093f103c189db6d82a082fb7 Mon Sep 17 00:00:00 2001 From: int2001 Date: Tue, 18 Jul 2023 15:45:56 +0000 Subject: [PATCH 4/7] Moved DXCluster-Cache-Settings from config-file to Admin page --- application/config/config.sample.php | 13 ------- application/controllers/Options.php | 37 +++++++++++++++++++ application/language/english/options_lang.php | 9 ++++- application/language/german/options_lang.php | 8 ++++ application/views/interface_assets/footer.php | 4 +- application/views/options/sidebar.php | 3 +- application/views/qso/index.php | 2 +- 7 files changed, 58 insertions(+), 18 deletions(-) diff --git a/application/config/config.sample.php b/application/config/config.sample.php index b388af57..081a62e8 100644 --- a/application/config/config.sample.php +++ b/application/config/config.sample.php @@ -598,16 +598,3 @@ $config['rewrite_short_tags'] = FALSE; | Array: array('10.0.1.200', '192.168.5.0/24') */ $config['proxy_ips'] = ''; - -/* -|-------------------------------------------------------------------------- -| DXCluster-API Base-URL -|-------------------------------------------------------------------------- -| -| If you have access to a DXCluster-API ( see https://github.com/int2001/DXClusterAPI for running your own ) -| put the base-URL for that API here -| -| Example: 'https://log.jo30.de/dxcache' -| Leave blank to disable: '' -*/ -$config['dxcluster_provider']=''; diff --git a/application/controllers/Options.php b/application/controllers/Options.php index 21a74b60..c83bcf27 100644 --- a/application/controllers/Options.php +++ b/application/controllers/Options.php @@ -136,6 +136,43 @@ class Options extends CI_Controller { } } + // function used to display the /dxcluster url + function dxcluster() { + $data['page_title'] = $this->lang->line('options_cloudlog_options'); + $data['sub_heading'] = $this->lang->line('options_dxcluster_settings'); + + $this->load->view('interface_assets/header', $data); + $this->load->view('options/dxcluster'); + $this->load->view('interface_assets/footer'); + } + + // Handles saving the DXCluster options to the options system. + function dxcluster_save() { + + // Get Language Options + + $data['page_title'] = $this->lang->line('options_cloudlog_options'); + $data['sub_heading'] = $this->lang->line('options_dxcluster_settings'); + + $this->load->helper(array('form', 'url')); + + $this->load->library('form_validation'); + + $this->form_validation->set_rules('dxcache_url', 'URL of DXCache', 'valid_url'); + + if ($this->form_validation->run() == FALSE) { + $this->load->view('interface_assets/header', $data); + $this->load->view('options/dxcluster'); + $this->load->view('interface_assets/footer'); + } else { + $dxcache_url_update = $this->optionslib->update('dxcache_url', $this->input->post('dxcache_url'), 'yes'); + if($dxcache_url_update == TRUE) { + $this->session->set_flashdata('success', $this->lang->line('options_dxcache_url_changed_to').$this->input->post('dxcache_url')); + } + redirect('/options/dxcluster'); + } + } + // function used to display the /radio url function radio() { diff --git a/application/language/english/options_lang.php b/application/language/english/options_lang.php index af31fe80..d0bdc06f 100644 --- a/application/language/english/options_lang.php +++ b/application/language/english/options_lang.php @@ -58,4 +58,11 @@ $lang['options_grouped_search'] = 'Grouped search'; $lang['options_when_this_is_on_all_station_locations_with_oqrs_active_will_be_searched_at_once'] = 'When this is on, all station locations with OQRS active, will be searched at once.'; $lang['options_oqrs_options_have_been_saved'] = 'OQRS options have been saved.'; -$lang['options_save'] = 'Save'; \ No newline at end of file +$lang['options_dxcluster'] = 'DXCluster'; +$lang['options_dxcluster_provider'] = 'Provider of DXClusterCache'; +$lang['options_dxcluster_longtext'] = 'The Provider of the DXCluister-Cache. You can set up your own Cache with DXClusterAPI or use a public one'; +$lang['options_dxcluster_hint'] = 'URL of the DXCluster-Cache. e.g. https://dxc.jo30.de/dxcache'; +$lang['options_dxcluster_settings'] = 'DXCluster'; +$lang['options_dxcache_url_changed_to'] = 'DXCluster Cache URL changed to '; + +$lang['options_save'] = 'Save'; diff --git a/application/language/german/options_lang.php b/application/language/german/options_lang.php index 50032646..def76f21 100644 --- a/application/language/german/options_lang.php +++ b/application/language/german/options_lang.php @@ -58,4 +58,12 @@ $lang['options_grouped_search'] = 'Gruppierte Suche'; $lang['options_when_this_is_on_all_station_locations_with_oqrs_active_will_be_searched_at_once'] = 'Wenn aktiviert, werden alle Stationsstandorte auf einmal durchsucht.'; $lang['options_oqrs_options_have_been_saved'] = 'OQRS options have been saved.'; +$lang['options_dxcluster'] = 'DXCluster'; +$lang['options_dxcluster_provider'] = 'Provider des DXClusterCache'; +$lang['options_dxcluster_longtext'] = 'Der Provider des DXCluister-Caches. Du kannst Deinen eigenen Cache mit DXClusterAPI aufsetzen, oder einen öffentlichen nutzen'; +$lang['options_dxcluster_hint'] = 'URL des DXCluster-Caches. z.B. https://dxc.jo30.de/dxcache'; +$lang['options_dxcluster_settings'] = 'DXCluster'; +$lang['options_dxcache_url_changed_to'] = 'DXCluster Cache URL geänder zu '; + + $lang['options_save'] = 'Speichern'; diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index ddf0dc07..db2d2fb2 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -935,9 +935,9 @@ $(document).on('keypress',function(e) { config->item('dxcluster_provider') != ''){ ?> + if ($this->optionslib->get_option('dxcache_url') != ''){ ?>