diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index f1624333..cd405b62 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -542,7 +542,8 @@ class Awards extends CI_Controller { $data['gridsquares_gridsquares']= lang('gridsquares_gridsquares'); $data['gridsquares_gridsquares_worked']= lang('gridsquares_gridsquares_worked'); - $data['gridsquares_gridsquares_confirmed']= lang('gridsquares_gridsquares_confirmed'); + $data['gridsquares_gridsquares_lotw']= lang('gridsquares_gridsquares_lotw'); + $data['gridsquares_gridsquares_paper']= lang('gridsquares_gridsquares_paper'); $footerData = []; $footerData['scripts']= [ @@ -560,61 +561,68 @@ class Awards extends CI_Controller { $this->load->model('gridmaster_model'); $array_grid_4char = array(); - - $array_grid_4char_confirmed = array(); + $array_grid_4char_lotw = array(); + $array_grid_4char_paper = array(); $grid_4char = ""; + $grid_4char_lotw = ""; - $grid_4char_confirmed = ""; - - $query = $this->gridmaster_model->get_confirmed(); - + $query = $this->gridmaster_model->get_lotw(); if ($query && $query->num_rows() > 0) { foreach ($query->result() as $row) { - $grid_4char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,4)); - - if(!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)){ - array_push($array_grid_4char_confirmed, $grid_4char_confirmed); + $grid_4char_lotw = strtoupper(substr($row->GRID_SQUARES,0,4)); + if(!in_array($grid_4char_lotw, $array_grid_4char_lotw)){ + array_push($array_grid_4char_lotw, $grid_4char_lotw); } + } + } + $query = $this->gridmaster_model->get_paper(); + if ($query && $query->num_rows() > 0) { + foreach ($query->result() as $row) { + $grid_4char_paper = strtoupper(substr($row->GRID_SQUARES,0,4)); + if(!in_array($grid_4char_paper, $array_grid_4char_paper)){ + array_push($array_grid_4char_paper, $grid_4char_paper); + } } } $query = $this->gridmaster_model->get_worked(); - if ($query && $query->num_rows() > 0) { foreach ($query->result() as $row) { - $grid_four = strtoupper(substr($row->GRID_SQUARES,0,4)); - if(!in_array($grid_four, $array_grid_4char)){ array_push($array_grid_4char, $grid_four); } - } } - $vucc_grids = $this->gridmaster_model->get_vucc_confirmed(); - + $vucc_grids = $this->gridmaster_model->get_vucc_lotw(); foreach($vucc_grids as $key) { - $grid_four_confirmed = strtoupper(substr($key,0,4)); + $grid_four_lotw = strtoupper(substr($key,0,4)); + if(!in_array($grid_four_lotw, $array_grid_4char_lotw)){ + array_push($array_grid_4char_lotw, $grid_four_lotw); + } + } - if(!in_array($grid_four_confirmed, $array_grid_4char_confirmed)){ - array_push($array_grid_4char_confirmed, $grid_four_confirmed); + $vucc_grids = $this->gridmaster_model->get_vucc_paper(); + foreach($vucc_grids as $key) { + $grid_four_paper = strtoupper(substr($key,0,4)); + if(!in_array($grid_four_paper, $array_grid_4char_paper)){ + array_push($array_grid_4char_paper, $grid_four_paper); } } $vucc_grids = $this->gridmaster_model->get_vucc_worked(); - foreach($vucc_grids as $key) { $grid_four = strtoupper(substr($key,0,4)); - if(!in_array($grid_four, $array_grid_4char)){ array_push($array_grid_4char, $grid_four); } } - $data['grid_4char_confirmed'] = ($array_grid_4char_confirmed); + $data['grid_4char_lotw'] = ($array_grid_4char_lotw); + $data['grid_4char_paper'] = ($array_grid_4char_paper); $data['grid_4char'] = ($array_grid_4char); header('Content-Type: application/json'); diff --git a/application/language/chinese_simplified/gridsquares_lang.php b/application/language/chinese_simplified/gridsquares_lang.php index 7f461cc1..a2d127dd 100644 --- a/application/language/chinese_simplified/gridsquares_lang.php +++ b/application/language/chinese_simplified/gridsquares_lang.php @@ -23,5 +23,7 @@ $lang['gridsquares_button_plot'] = '绘制'; $lang['gridsquares_gridsquares'] = '网格'; $lang['gridsquares_gridsquares_confirmed'] = '已确认的网格'; $lang['gridsquares_gridsquares_not_confirmed'] = '未确认的网格'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_total_worked'] = '总共工作过的网格'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/czech/gridsquares_lang.php b/application/language/czech/gridsquares_lang.php index fd6949fb..13ffd30d 100644 --- a/application/language/czech/gridsquares_lang.php +++ b/application/language/czech/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Zobrazit'; $lang['gridsquares_gridsquares'] = 'Lokátory'; $lang['gridsquares_gridsquares_confirmed'] = 'Potvrzené lokátory'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Nepotvrzené lokátory'; $lang['gridsquares_gridsquares_total_worked'] = 'Celkový počet odpracovaných lokátorů'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/dutch/gridsquares_lang.php b/application/language/dutch/gridsquares_lang.php index aa739b29..d8d4a1b7 100644 --- a/application/language/dutch/gridsquares_lang.php +++ b/application/language/dutch/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; $lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file diff --git a/application/language/english/gridsquares_lang.php b/application/language/english/gridsquares_lang.php index b1a3162d..0b18933e 100644 --- a/application/language/english/gridsquares_lang.php +++ b/application/language/english/gridsquares_lang.php @@ -23,6 +23,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_worked'] = 'Gridsquares worked'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; $lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/finnish/gridsquares_lang.php b/application/language/finnish/gridsquares_lang.php index fadea256..af17febc 100644 --- a/application/language/finnish/gridsquares_lang.php +++ b/application/language/finnish/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Merkitse'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; $lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file diff --git a/application/language/french/gridsquares_lang.php b/application/language/french/gridsquares_lang.php index 572124c8..d1611bf6 100644 --- a/application/language/french/gridsquares_lang.php +++ b/application/language/french/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Locators'; $lang['gridsquares_gridsquares_confirmed'] = 'Locators confirmés'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Locators non confirmés'; $lang['gridsquares_gridsquares_total_worked'] = 'Total des Locators contactés'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/german/gridsquares_lang.php b/application/language/german/gridsquares_lang.php index 6fc2a3c9..0022e947 100644 --- a/application/language/german/gridsquares_lang.php +++ b/application/language/german/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Kartieren'; $lang['gridsquares_gridsquares'] = 'Planquadrate'; $lang['gridsquares_gridsquares_confirmed'] = 'Planquadrate bestätigt'; -$lang['gridsquares_gridsquares_not_confirmed'] = 'Planquadrate nicht bestätigt'; +$lang['gridsquares_gridsquares_lotw'] = 'Auf LoTW bestätigte Planquadrate'; +$lang['gridsquares_gridsquares_paper'] = 'Per Papier QSL bestätigte Planquadrate'; +$lang['gridsquares_gridsquares_not_confirmed'] = 'Unbestätigte Planquadrate'; $lang['gridsquares_gridsquares_total_worked'] = 'Summe gearbeiteter Planquadrate'; -$lang['gridsquares_gridsquares_total_activated'] = 'Summe aktivierter Planquadrate'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Summe aktivierter Planquadrate'; diff --git a/application/language/greek/gridsquares_lang.php b/application/language/greek/gridsquares_lang.php index ae5e2867..cecb256c 100644 --- a/application/language/greek/gridsquares_lang.php +++ b/application/language/greek/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/italian/gridsquares_lang.php b/application/language/italian/gridsquares_lang.php index ae5e2867..cecb256c 100644 --- a/application/language/italian/gridsquares_lang.php +++ b/application/language/italian/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/polish/gridsquares_lang.php b/application/language/polish/gridsquares_lang.php index ae5e2867..cecb256c 100644 --- a/application/language/polish/gridsquares_lang.php +++ b/application/language/polish/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/russian/gridsquares_lang.php b/application/language/russian/gridsquares_lang.php index 224dca7f..3f7ccdd2 100644 --- a/application/language/russian/gridsquares_lang.php +++ b/application/language/russian/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Отобразить'; $lang['gridsquares_gridsquares'] = 'Квадраты'; $lang['gridsquares_gridsquares_confirmed'] = 'Подтверждёно квадратов'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Неподтверждёно квадратов'; $lang['gridsquares_gridsquares_total_worked'] = 'Всего сработано квадратов'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/spanish/gridsquares_lang.php b/application/language/spanish/gridsquares_lang.php index ae5e2867..cecb256c 100644 --- a/application/language/spanish/gridsquares_lang.php +++ b/application/language/spanish/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/swedish/gridsquares_lang.php b/application/language/swedish/gridsquares_lang.php index 48e8bdee..32b06bd0 100644 --- a/application/language/swedish/gridsquares_lang.php +++ b/application/language/swedish/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares bekräftad'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares inte bekräftat'; $lang['gridsquares_gridsquares_total_worked'] = 'Totala gridsquares arbetade'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/turkish/gridsquares_lang.php b/application/language/turkish/gridsquares_lang.php index ae5e2867..cecb256c 100644 --- a/application/language/turkish/gridsquares_lang.php +++ b/application/language/turkish/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/models/Gridmaster_model.php b/application/models/Gridmaster_model.php index 6bf9d7b7..868c7b44 100644 --- a/application/models/Gridmaster_model.php +++ b/application/models/Gridmaster_model.php @@ -35,7 +35,7 @@ class Gridmaster_model extends CI_Model { 'EL87', 'EL97', 'EL06', 'EL16', 'EL86', 'EL96', 'EL15', 'EL95', 'EL84', 'EL94' ]; - function get_confirmed() { + function get_lotw() { $CI =& get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -54,6 +54,25 @@ class Gridmaster_model extends CI_Model { return $this->db->query($sql); } + function get_paper() { + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + + $sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,4) as GRID_SQUARES FROM ' + .$this->config->item('table_name') + .' WHERE station_id in ('.$location_list.')' + ." and COL_QSL_RCVD = 'Y'" + ." and COL_PROP_MODE = 'SAT'" + .' AND substring(COL_GRIDSQUARE,1,4) in (\''.implode('\',\'', $this->us_grids).'\')'; + return $this->db->query($sql); + } + function get_worked() { $CI =& get_instance(); $CI->load->model('logbooks_model'); @@ -72,7 +91,7 @@ class Gridmaster_model extends CI_Model { return $this->db->query($sql); } - function get_vucc_confirmed() { + function get_vucc_lotw() { $CI =& get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -104,6 +123,38 @@ class Gridmaster_model extends CI_Model { return $vucc_grids; } + function get_vucc_paper() { + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + + $sql = 'SELECT distinct COL_VUCC_GRIDS as VUCC_GRIDS FROM ' + .$this->config->item('table_name') + .' WHERE station_id in ('.$location_list.')' + ." and COL_QSL_RCVD = 'Y'" + ." and COL_VUCC_GRIDS != ''" + ." and COL_VUCC_GRIDS IS NOT NULL" + ." and COL_PROP_MODE = 'SAT'"; + $query = $this->db->query($sql); + $vucc_grids = []; + foreach ($query->result() as $row) { + $grids = explode(',', $row->VUCC_GRIDS); + foreach ($grids as $grid) { + if (in_array(substr($grid, 0, 4), $this->us_grids)) { + if (!in_array(substr($grid, 0, 4), $vucc_grids)) { + $vucc_grids[] = substr($grid, 0, 4); + } + } + } + } + return $vucc_grids; + } + function get_vucc_worked() { $CI =& get_instance(); $CI->load->model('logbooks_model'); diff --git a/application/views/awards/gridmaster/index.php b/application/views/awards/gridmaster/index.php index 4a390d0b..6caed124 100644 --- a/application/views/awards/gridmaster/index.php +++ b/application/views/awards/gridmaster/index.php @@ -78,6 +78,7 @@ var type = "worked"; echo 'var gridsquares_gridsquares = "' . $gridsquares_gridsquares . '";'; echo 'var gridsquares_gridsquares_worked = "' . $gridsquares_gridsquares_worked . '";'; - echo 'var gridsquares_gridsquares_confirmed = "' . $gridsquares_gridsquares_confirmed . '";'; + echo 'var gridsquares_gridsquares_lotw = "' . $gridsquares_gridsquares_lotw . '";'; + echo 'var gridsquares_gridsquares_paper = "' . $gridsquares_gridsquares_paper . '";'; ?> diff --git a/assets/js/leaflet/L.MaidenheadColouredGridmasterMap.js b/assets/js/leaflet/L.MaidenheadColouredGridmasterMap.js index f75f9fff..6aedd75e 100644 --- a/assets/js/leaflet/L.MaidenheadColouredGridmasterMap.js +++ b/assets/js/leaflet/L.MaidenheadColouredGridmasterMap.js @@ -39,7 +39,6 @@ L.Maidenhead = L.LayerGroup.extend({ var lat_cor = new Array(0, 8, 8, 8, 2.5, 2.2, 6, 8, 8, 8, 1.4, 2.5, 3, 3.5, 4, 4, 3.5, 3.5, 3, 1.8, 1.6); // Used for gridsquare text offset var bounds = map.getBounds(); var zoom = map.getZoom(); - console.log(zoom); var unit = d3[zoom]; var lcor = lat_cor[zoom]; var w = bounds.getWest(); @@ -48,7 +47,7 @@ L.Maidenhead = L.LayerGroup.extend({ var s = bounds.getSouth(); var field_lat_cor = new Array(0, 8, 8, 9, 8, 7, 6, 8, 8, 8, 1.4, 2.5, 3, 3.5, 4, 4, 3.5, 3.5, 3, 1.8, 1.6); // Used for field text offset var field_cor = field_lat_cor[zoom]; - if (zoom==1) {var c = 2;} else {var c = 0.2;} // Height offset + var c = 0.2; if (n > 85) n = 85; if (s < -85) s = -85; var left = Math.floor(w/(unit*2))*(unit*2); @@ -97,9 +96,12 @@ L.Maidenhead = L.LayerGroup.extend({ if(grid_four.includes(locator)) { - if(grid_four_confirmed.includes(locator)) { + if(grid_four_lotw.includes(locator)) { var rectConfirmed = L.rectangle(bounds, {className: 'grid-rectangle grid-confirmed', color: 'rgba(144,238,144, 0.6)', weight: 1, fillOpacity: 1, fill:true, interactive: false}); this.addLayer(rectConfirmed); + } else if (grid_four_paper.includes(locator)) { + var rectPaper = L.rectangle(bounds, {className: 'grid-rectangle grid-confirmed', color: 'rgba(0,176,240, 0.6)', weight: 1, fillOpacity: 1, fill:true, interactive: false}); + this.addLayer(rectPaper); } else { var rectWorked = L.rectangle(bounds, {className: 'grid-rectangle grid-worked', color: 'rgba(255,215,87, 0.6)', weight: 1, fillOpacity: 1, fill:true, interactive: false}) this.addLayer(rectWorked); @@ -115,7 +117,7 @@ L.Maidenhead = L.LayerGroup.extend({ } } // Added this to print fields and field name, while still showing worked/confirmed gridsquares - unit = 10; + unit = 1; var left = Math.floor(w / (unit * 2)) * (unit * 2); var right = Math.ceil(e / (unit * 2)) * (unit * 2); var top = Math.ceil(n / unit) * unit; @@ -181,50 +183,6 @@ L.Maidenhead = L.LayerGroup.extend({ return locator; }, - /* - Need this for the field printing, while showing worked/confirmed grids - */ - _getLabel2: function(lon,lat) { - var title_size = new Array(0, 10, 12, 16, 20, 26, 26, 16, 24, 36, 12, 14, 20, 36, 60, 12, 20, 36, 60, 12, 24); - var zoom = map.getZoom(); - var size = title_size[zoom]+'px'; - var title = '' + this._getLocator2(lon,lat) + ''; - var myIcon = L.divIcon({className: 'my-div-icon', html: title}); - var marker = L.marker([lat,lon], {icon: myIcon}, clickable=false); - return marker; - }, - - /* - Need this for the field printing, while showing worked/confirmed grids - */ - _getLocator2: function(lon,lat) { - var ydiv_arr=new Array(10, 1, 1/24, 1/240, 1/240/24); - var d1 = "ABCDEFGHIJKLMNOPQR".split(""); - var d2 = "ABCDEFGHIJKLMNOPQRSTUVWX".split(""); - var d4 = new Array(0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5); - var locator = ""; - var x = lon; - var y = lat; - var precision = d4[map.getZoom()]; - while (x < -180) {x += 360;} - while (x > 180) {x -=360;} - x = x + 180; - y = y + 90; - locator = locator + d1[Math.floor(x/20)] + d1[Math.floor(y/10)]; - for (var i=0; i<4; i=i+1) { - if (precision > i+1) { - rlon = x%(ydiv_arr[i]*2); - rlat = y%(ydiv_arr[i]); - if ((i%2)==0) { - locator += Math.floor(rlon/(ydiv_arr[i+1]*2)) +""+ Math.floor(rlat/(ydiv_arr[i+1])); - } else { - locator += d2[Math.floor(rlon/(ydiv_arr[i+1]*2))] +""+ d2[Math.floor(rlat/(ydiv_arr[i+1]))]; - } - } - } - return locator; - }, - }); L.maidenhead = function (options) { diff --git a/assets/js/sections/gridmaster.js b/assets/js/sections/gridmaster.js index 6208853c..f8c8d2d7 100644 --- a/assets/js/sections/gridmaster.js +++ b/assets/js/sections/gridmaster.js @@ -1,14 +1,11 @@ var map; -var grid_two = ''; var grid_four = ''; -var grid_six = ''; -var grid_two_confirmed = ''; -var grid_four_confirmed = ''; -var grid_six_confirmed = ''; +var grid_four_lotw = ''; +var grid_four_paper = ''; function gridPlot(form) { $(".ld-ext-right-plot").addClass('running'); - $(".ld-ext-right-plot").prop('disabled', true); + $(".ld-ext-right-plot").prop('disabled', true); $('#plot').prop("disabled", true); // If map is already initialized var container = L.DomUtil.get('gridsquare_map'); @@ -22,15 +19,16 @@ function gridPlot(form) { ajax_url = site_url + '/awards/getGridmasterGridsjs'; $.ajax({ - url: ajax_url, - type: 'get', - success: function (data) { + url: ajax_url, + type: 'get', + success: function (data) { $('.cohidden').show(); $(".ld-ext-right-plot").removeClass('running'); $(".ld-ext-right-plot").prop('disabled', false); $('#plot').prop("disabled", false); grid_four = data.grid_4char; - grid_four_confirmed = data.grid_4char_confirmed; + grid_four_lotw = data.grid_4char_lotw; + grid_four_paper = data.grid_4char_paper; var layer = L.tileLayer(jslayer, { maxZoom: 12, attribution: jsattribution, @@ -41,9 +39,8 @@ function gridPlot(form) { layers: [layer], center: [38, -95], zoom: 5, - minZoom: 5, - maxZoom: 5, - dragging: false, + minZoom: 4, + maxZoom: 12, fullscreenControl: true, fullscreenControlOptions: { position: 'topleft' @@ -64,8 +61,9 @@ function gridPlot(form) { legend.onAdd = function(map) { var div = L.DomUtil.create("div", "legend"); div.innerHTML += "