From 6de5cff09777338b60b578a0c96069ea2de168fc Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 10 Dec 2025 12:40:59 +0100 Subject: [PATCH] Handle absent colors in award maps --- application/controllers/Awards.php | 2 +- assets/js/sections/cqmap.js | 14 +++++++++----- assets/js/sections/iotamap.js | 14 +++++++++----- assets/js/sections/itumap.js | 14 +++++++++----- assets/js/sections/jccmap.js | 14 +++++++++----- assets/js/sections/racmap.js | 14 +++++++++----- assets/js/sections/wajamap.js | 14 +++++++++----- assets/js/sections/wapmap.js | 14 +++++++++----- assets/js/sections/wasmap.js | 14 +++++++++----- 9 files changed, 73 insertions(+), 41 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 426a62551..bdd98ac16 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -20,7 +20,7 @@ class Awards extends CI_Controller { if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $map_custom = json_decode($this->optionslib->get_map_custom()); - $this->user_map_color_qso = $map_custom->qso->color; + $this->user_map_color_qso = $map_custom->qso->color ?? ''; $this->user_map_color_qsoconfirm = $map_custom->qsoconfirm->color ?? ''; $this->user_map_color_unworked = $map_custom->unworked->color ?? ''; } diff --git a/assets/js/sections/cqmap.js b/assets/js/sections/cqmap.js index dcff0fad4..795a7c461 100644 --- a/assets/js/sections/cqmap.js +++ b/assets/js/sections/cqmap.js @@ -4,13 +4,17 @@ var geojson; var map; var info; -let confirmedColor = user_map_custom.qsoconfirm.color; -let workedColor = user_map_custom.qso.color; -let unworkedColor = ''; +let unworkedColor = 'red'; if (typeof(user_map_custom.unworked) !== 'undefined') { unworkedColor = user_map_custom.unworked.color; -} else { - unworkedColor = 'red'; +} +let workedColor = 'rgba(255, 0, 0)'; +if (typeof(user_map_custom.qso) !== 'undefined') { + workedColor = user_map_custom.qso.color; +} +let confirmedColor = 'rgba(144,238,144)'; +if (typeof(user_map_custom.qsoconfirm) !== 'undefined') { + confirmedColor = user_map_custom.qsoconfirm.color; } document.addEventListener("DOMContentLoaded", function() { diff --git a/assets/js/sections/iotamap.js b/assets/js/sections/iotamap.js index d422e6294..6848c5175 100644 --- a/assets/js/sections/iotamap.js +++ b/assets/js/sections/iotamap.js @@ -1,10 +1,14 @@ -let confirmedColor = user_map_custom.qsoconfirm.color; -let workedColor = user_map_custom.qso.color; -let unworkedColor = ''; +let unworkedColor = 'red'; if (typeof(user_map_custom.unworked) !== 'undefined') { unworkedColor = user_map_custom.unworked.color; -} else { - unworkedColor = 'red'; +} +let workedColor = 'rgba(255, 0, 0)'; +if (typeof(user_map_custom.qso) !== 'undefined') { + workedColor = user_map_custom.qso.color; +} +let confirmedColor = 'rgba(144,238,144)'; +if (typeof(user_map_custom.qsoconfirm) !== 'undefined') { + confirmedColor = user_map_custom.qsoconfirm.color; } var osmUrl = $('#iotamapjs').attr("tileUrl"); diff --git a/assets/js/sections/itumap.js b/assets/js/sections/itumap.js index fa9ff07b4..ce6f191ff 100644 --- a/assets/js/sections/itumap.js +++ b/assets/js/sections/itumap.js @@ -4,13 +4,17 @@ let geojson; let map; let info; -let confirmedColor = user_map_custom.qsoconfirm.color; -let workedColor = user_map_custom.qso.color; -let unworkedColor = ''; +let unworkedColor = 'red'; if (typeof(user_map_custom.unworked) !== 'undefined') { unworkedColor = user_map_custom.unworked.color; -} else { - unworkedColor = 'red'; +} +let workedColor = 'rgba(255, 0, 0)'; +if (typeof(user_map_custom.qso) !== 'undefined') { + workedColor = user_map_custom.qso.color; +} +let confirmedColor = 'rgba(144,238,144)'; +if (typeof(user_map_custom.qsoconfirm) !== 'undefined') { + confirmedColor = user_map_custom.qsoconfirm.color; } function load_itu_map() { diff --git a/assets/js/sections/jccmap.js b/assets/js/sections/jccmap.js index 9c282a3c6..8759f2412 100644 --- a/assets/js/sections/jccmap.js +++ b/assets/js/sections/jccmap.js @@ -1,11 +1,15 @@ let osmUrl = tileUrl; -let confirmedColor = user_map_custom.qsoconfirm.color; -let workedColor = user_map_custom.qso.color; -let unworkedColor = ''; +let unworkedColor = 'red'; if (typeof(user_map_custom.unworked) !== 'undefined') { unworkedColor = user_map_custom.unworked.color; -} else { - unworkedColor = 'red'; +} +let workedColor = 'rgba(255, 0, 0)'; +if (typeof(user_map_custom.qso) !== 'undefined') { + workedColor = user_map_custom.qso.color; +} +let confirmedColor = 'rgba(144,238,144)'; +if (typeof(user_map_custom.qsoconfirm) !== 'undefined') { + confirmedColor = user_map_custom.qsoconfirm.color; } function load_jcc_map() { diff --git a/assets/js/sections/racmap.js b/assets/js/sections/racmap.js index 8aa14d286..66e9f31ed 100644 --- a/assets/js/sections/racmap.js +++ b/assets/js/sections/racmap.js @@ -5,13 +5,17 @@ let map; let info; let clickmarkers = []; -let confirmedColor = user_map_custom.qsoconfirm.color; -let workedColor = user_map_custom.qso.color; -let unworkedColor = ''; +let unworkedColor = 'red'; if (typeof(user_map_custom.unworked) !== 'undefined') { unworkedColor = user_map_custom.unworked.color; -} else { - unworkedColor = 'red'; +} +let workedColor = 'rgba(255, 0, 0)'; +if (typeof(user_map_custom.qso) !== 'undefined') { + workedColor = user_map_custom.qso.color; +} +let confirmedColor = 'rgba(144,238,144)'; +if (typeof(user_map_custom.qsoconfirm) !== 'undefined') { + confirmedColor = user_map_custom.qsoconfirm.color; } const states = 'AB,BC,MB,NB,NL,NT,NS,NU,ON,PE,QC,SK,YT'; diff --git a/assets/js/sections/wajamap.js b/assets/js/sections/wajamap.js index 5726507f0..f13332ef2 100644 --- a/assets/js/sections/wajamap.js +++ b/assets/js/sections/wajamap.js @@ -5,13 +5,17 @@ let map; let info; let clickmarkers = []; -let confirmedColor = user_map_custom.qsoconfirm.color; -let workedColor = user_map_custom.qso.color; -let unworkedColor = ''; +let unworkedColor = 'red'; if (typeof(user_map_custom.unworked) !== 'undefined') { unworkedColor = user_map_custom.unworked.color; -} else { - unworkedColor = 'red'; +} +let workedColor = 'rgba(255, 0, 0)'; +if (typeof(user_map_custom.qso) !== 'undefined') { + workedColor = user_map_custom.qso.color; +} +let confirmedColor = 'rgba(144,238,144)'; +if (typeof(user_map_custom.qsoconfirm) !== 'undefined') { + confirmedColor = user_map_custom.qsoconfirm.color; } const states = '01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47'; diff --git a/assets/js/sections/wapmap.js b/assets/js/sections/wapmap.js index c0efbd40f..33055d2af 100644 --- a/assets/js/sections/wapmap.js +++ b/assets/js/sections/wapmap.js @@ -5,13 +5,17 @@ var map; var info; var clickmarkers = []; -let confirmedColor = user_map_custom.qsoconfirm.color; -let workedColor = user_map_custom.qso.color; -let unworkedColor = ''; +let unworkedColor = 'red'; if (typeof(user_map_custom.unworked) !== 'undefined') { unworkedColor = user_map_custom.unworked.color; -} else { - unworkedColor = 'red'; +} +let workedColor = 'rgba(255, 0, 0)'; +if (typeof(user_map_custom.qso) !== 'undefined') { + workedColor = user_map_custom.qso.color; +} +let confirmedColor = 'rgba(144,238,144)'; +if (typeof(user_map_custom.qsoconfirm) !== 'undefined') { + confirmedColor = user_map_custom.qsoconfirm.color; } const states = 'DR,FL,FR,GD,GR,LB,NB,NH,OV,UT,ZH,ZL'; diff --git a/assets/js/sections/wasmap.js b/assets/js/sections/wasmap.js index 282eea7cd..28ec490b2 100644 --- a/assets/js/sections/wasmap.js +++ b/assets/js/sections/wasmap.js @@ -5,13 +5,17 @@ let map; let info; let clickmarkers = []; -let confirmedColor = user_map_custom.qsoconfirm.color; -let workedColor = user_map_custom.qso.color; -let unworkedColor = ''; +let unworkedColor = 'red'; if (typeof(user_map_custom.unworked) !== 'undefined') { unworkedColor = user_map_custom.unworked.color; -} else { - unworkedColor = 'red'; +} +let workedColor = 'rgba(255, 0, 0)'; +if (typeof(user_map_custom.qso) !== 'undefined') { + workedColor = user_map_custom.qso.color; +} +let confirmedColor = 'rgba(144,238,144)'; +if (typeof(user_map_custom.qsoconfirm) !== 'undefined') { + confirmedColor = user_map_custom.qsoconfirm.color; } const states = 'AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY';