From 9783cf0ec3a2ff3a093f103c189db6d82a082fb7 Mon Sep 17 00:00:00 2001 From: int2001 Date: Tue, 18 Jul 2023 15:45:56 +0000 Subject: [PATCH] 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') != ''){ ?>