diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index ec28da550..9d7175256 100644 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -92,8 +92,14 @@ class QSO extends CI_Controller { $qkey_opt=$this->user_options_model->get_options('dxwaterfall',array('option_name'=>'enable','option_key'=>'boolean'))->result(); if (count($qkey_opt)>0) { $data['user_dxwaterfall_enable'] = $qkey_opt[0]->option_value; + $data['dxcluster_default_decont'] = $this->optionslib->get_option('dxcluster_decont') ?? 'EU'; + $data['dxcluster_default_maxage'] = $this->optionslib->get_option('dxcluster_maxage') ?? 60; } else { $data['user_dxwaterfall_enable'] = 0; + + // default but not used, prevent unset variable, without the need of a db call + $data['dxcluster_default_decont'] = 'EU'; + $data['dxcluster_default_maxage'] = 60; } $data['qso_count'] = $this->session->userdata('qso_page_last_qso_count'); diff --git a/application/views/components/dxwaterfall.php b/application/views/components/dxwaterfall.php index 32f59b96b..2812d0c54 100644 --- a/application/views/components/dxwaterfall.php +++ b/application/views/components/dxwaterfall.php @@ -56,8 +56,8 @@ var lang_dxwaterfall_spotted_by = ""; // DX Waterfall Configuration from User Options - let dxwaterfall_decont = 'optionslib->get_option('dxcluster_decont'); ?>'; - let dxwaterfall_maxage = 'optionslib->get_option('dxcluster_maxage'); ?>'; + let dxcluster_default_decont = ""; + let dxcluster_default_maxage = ""; // Helper function to safely check if optional field exists window.DX_WATERFALL_HAS_FIELD = function(fieldName) { diff --git a/assets/js/dxwaterfall.js b/assets/js/dxwaterfall.js index 2f7f46e00..8c55bab8c 100644 --- a/assets/js/dxwaterfall.js +++ b/assets/js/dxwaterfall.js @@ -1267,8 +1267,8 @@ var dxWaterfall = { spotInfoDiv: null, spotTooltipDiv: null, lastSpotInfoKey: null, - currentContinent: 'NA', - currentMaxAge: 60, + currentContinent: dxcluster_default_decont, + currentMaxAge: dxcluster_default_maxage, // ======================================== // SPOT NAVIGATION STATE @@ -3297,9 +3297,9 @@ var dxWaterfall = { var age = 60; // minutes var de = this.currentContinent; // Use current continent (may have been cycled) - // Check if dxwaterfall_maxage is defined - if (typeof dxwaterfall_maxage !== "undefined" && dxwaterfall_maxage != null) { - age = dxwaterfall_maxage; + // Check if dxcluster_default_maxage is defined + if (typeof dxcluster_default_maxage !== "undefined" && dxcluster_default_maxage != null) { + age = dxcluster_default_maxage; } // Store current settings