diff --git a/README.md b/README.md index c0aef1749..76900284f 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,6 @@ Thanks to Andy (VE7CXZ), Gavin (M1BXF), Graham (W5ISP), Robert (M0VFC), Corby (K Cloudlog is supported by Patreon and donations via PayPal, thanks to the following people: -Paul (M0TZO), Tim (G4VXE), Paul (N8HM), Michelle (W5NYV), Mitchell (AD0HJ), Dan (M0TCB), Martin (DK3ML), Juan Carlos (EA5WA), Iain (M0PCB), Charlie (GM1TGY), Ondrej (OK1CDJ), Trystan (G0KAY), Oliver (DL6KBG), Volkmar Schirmer, Jordan (M0PIR), Thomas Ziegler, Mathis (DB9MAT), Ken (VE3HLS), Tyler (WL7T), Jeremy Taylor, Ben Kuhn, Eric Thresher, Michael Cullen, Juuso (OH1JW), Anthony Castiglia, Fernando Ramirez-Ferrer, Robert Dixon, Mark Percival, Julia (KV1V), Timo Tomasini, Ant (NU1U), Christopher Williams, Danny Barnes, Vic, Tom (M0LTE), smurphboy, Lars (SM0TGU), Theo (PD9DP), Stefan (SM0RGM). Peter (G0ABI), Lou (KI5FTY), Michael (DG3NAB), Dragan (4O4A), minorsecond, Emily (W7AYQ), Steve (M0SKM), Rob (M0VFC), Doug (WA6L), Petr (OK1PKR), Fabian (HB9HI). +Paul (M0TZO), Tim (G4VXE), Paul (N8HM), Michelle (W5NYV), Mitchell (AD0HJ), Dan (M0TCB), Martin (DK3ML), Juan Carlos (EA5WA), Iain (M0PCB), Charlie (GM1TGY), Ondrej (OK1CDJ), Trystan (G0KAY), Oliver (DL6KBG), Volkmar Schirmer, Jordan (M0PIR), Thomas Ziegler, Mathis (DB9MAT), Ken (VE3HLS), Tyler (WL7T), Jeremy Taylor, Ben Kuhn, Eric Thresher, Michael Cullen, Juuso (OH1JW), Anthony Castiglia, Fernando Ramirez-Ferrer, Robert Dixon, Mark Percival, Julia (KV1V), Timo Tomasini, Ant (NU1U), Christopher Williams, Danny Barnes, Vic, Tom (M0LTE), smurphboy, Lars (SM0TGU), Theo (PD9DP), Stefan (SM0RGM). Peter (G0ABI), Lou (KI5FTY), Michael (DG3NAB), Dragan (4O4A), minorsecond, Emily (W7AYQ), Steve (M0SKM), Rob (M0VFC), Doug (WA6L), Petr (OK1PKR), Fabian (HB9HIL). If you'd like to donate to Cloudlog to help allow @magicbug spend less time doing commercial work and more time coding Cloudlog then you can donate via [PayPal](https://paypal.me/PGoodhall), [Github Sponsor](https://github.com/sponsors/magicbug) or become a [Patreon](https://www.patreon.com/2m0sql) diff --git a/application/config/migration.php b/application/config/migration.php index f11c7f7bd..769923a31 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ | */ -$config['migration_version'] = 140; +$config['migration_version'] = 143; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Api.php b/application/controllers/Api.php index 7a1e96345..1230ff20b 100644 --- a/application/controllers/Api.php +++ b/application/controllers/Api.php @@ -185,8 +185,6 @@ function qso() { die(); } - $this->api_model->update_last_used($obj['key']); - if($obj['type'] == "adif" && $obj['string'] != "") { // Load the logbook model for adding QSO records $this->load->model('logbook_model'); @@ -207,6 +205,14 @@ function qso() { if(isset($obj['station_profile_id'])) { + if(isset($record['station_callsign']) && $this->stations->check_station_against_callsign($obj['station_profile_id'], $record['station_callsign']) == false) { + http_response_code(401); + echo json_encode(['status' => 'failed', 'reason' => "station callsign does not match station callsign in station profile."]); + die(); + } + + $this->api_model->update_last_used($obj['key']); + $this->logbook_model->import($record, $obj['station_profile_id'], NULL, NULL, NULL, NULL, NULL, NULL, false, false, true); } diff --git a/application/controllers/Components.php b/application/controllers/Components.php new file mode 100644 index 000000000..942dcbc35 --- /dev/null +++ b/application/controllers/Components.php @@ -0,0 +1,24 @@ +load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + } + + public function index() { + $url = 'https://oscarwatch.org/scripts/hamsat_json.php'; + $json = file_get_contents($url); + $data['rovedata'] = json_decode($json, true); + + // load view + $this->load->view('components/hamsat/table', $data); + } +} \ No newline at end of file diff --git a/application/controllers/Hamsat.php b/application/controllers/Hamsat.php new file mode 100644 index 000000000..d2cc9b0be --- /dev/null +++ b/application/controllers/Hamsat.php @@ -0,0 +1,23 @@ +load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + } + + public function index() { + // Load public view + $data['page_title'] = "Hamsat - Satellite Roving"; + $this->load->view('interface_assets/header', $data); + $this->load->view('/hamsat/index'); + $this->load->view('interface_assets/footer'); + } +} \ No newline at end of file diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 95cb05ff7..801fafc0d 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -153,6 +153,7 @@ function json($tempcallsign, $temptype, $tempband, $tempmode, $tempstation_id = $return['callsign_state'] = $this->nval($callbook['state'] ?? '', $this->logbook_model->call_state($callsign)); $return['callsign_us_county'] = $this->nval($callbook['us_county'] ?? '', $this->logbook_model->call_us_county($callsign)); $return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $type, $band, $mode); + $return['confirmed'] = $this->confirmed_grid_before($return['callsign_qra'], $type, $band, $mode); if ($this->session->userdata('user_show_profile_image')) { if (isset($callbook)) { @@ -181,7 +182,70 @@ function nval($val1, $val2) { return (($val2 ?? "") === "" ? ($val1 ?? "") : ($val2 ?? "")); } - function worked_grid_before($gridsquare, $type, $band, $mode) + function confirmed_grid_before($gridsquare, $type, $band, $mode) { + if (strlen($gridsquare) < 4) + return false; + + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $user_gridmap_confirmation = $this->session->userdata('user_gridmap_confirmation'); + + if(!empty($logbooks_locations_array)) { + $extrawhere=''; + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'Q') !== false) { + $extrawhere="COL_QSL_RCVD='Y'"; + } + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'L') !== false) { + if ($extrawhere!='') { + $extrawhere.=" OR"; + } + $extrawhere.=" COL_LOTW_QSL_RCVD='Y'"; + } + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'E') !== false) { + if ($extrawhere!='') { + $extrawherei.=" OR"; + } + $extrawhere.=" COL_EQSL_QSL_RCVD='Y'"; + } + + + if($type == "SAT") { + $this->db->where('COL_PROP_MODE', 'SAT'); + if ($extrawhere != '') { + $this->db->where('('.$extrawhere.')'); + } else { + $this->db->where("1=0"); + } + } else { + $CI->load->model('logbook_model'); + $this->db->where('COL_MODE', $CI->logbook_model->get_main_mode_from_mode($mode)); + $this->db->where('COL_BAND', $band); + $this->db->where('COL_PROP_MODE !=','SAT'); + if ($extrawhere != '') { + $this->db->where('('.$extrawhere.')'); + } else { + $this->db->where("1=0"); + } + } + + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4)); + $this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "desc"); + $this->db->limit(1); + + + $query = $this->db->get($this->config->item('table_name')); + + + foreach ($query->result() as $workedBeforeRow) { + return true; + } + } + return false; + } + +function worked_grid_before($gridsquare, $type, $band, $mode) { if (strlen($gridsquare) < 4) return false; @@ -226,8 +290,9 @@ function worked_grid_before($gridsquare, $type, $band, $mode) function jsonlookupgrid($gridsquare, $type, $band, $mode) { $return = [ "workedBefore" => false, + "confirmed" => false, ]; - + $user_gridmap_confirmation = $this->session->userdata('user_gridmap_confirmation'); $CI =& get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -251,6 +316,51 @@ function jsonlookupgrid($gridsquare, $type, $band, $mode) { $return['workedBefore'] = true; } + + $extrawhere=''; + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'Q') !== false) { + $extrawhere="COL_QSL_RCVD='Y'"; + } + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'L') !== false) { + if ($extrawhere!='') { + $extrawhere.=" OR"; + } + $extrawhere.=" COL_LOTW_QSL_RCVD='Y'"; + } + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'E') !== false) { + if ($extrawhere!='') { + $extrawherei.=" OR"; + } + $extrawhere.=" COL_EQSL_QSL_RCVD='Y'"; + } + + if($type == "SAT") { + $this->db->where('COL_PROP_MODE', 'SAT'); + if ($extrawhere != '') { + $this->db->where('('.$extrawhere.')'); + } else { + $this->db->where("1=0"); + } + } else { + $CI->load->model('logbook_model'); + $this->db->where('COL_MODE', $CI->logbook_model->get_main_mode_from_mode($mode)); + $this->db->where('COL_BAND', $band); + $this->db->where('COL_PROP_MODE !=','SAT'); + if ($extrawhere != '') { + $this->db->where('('.$extrawhere.')'); + } else { + $this->db->where("1=0"); + } + } + + $this->db->where_in('station_id', $logbooks_locations_array); + + $this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4)); + $query = $this->db->get($this->config->item('table_name'), 1, 0); + foreach ($query->result() as $workedBeforeRow) { + $return['confirmed']=true; + } + header('Content-Type: application/json'); echo json_encode($return, JSON_PRETTY_PRINT); @@ -261,12 +371,14 @@ function jsonlookupdxcc($country, $type, $band, $mode) { $return = [ "workedBefore" => false, + "confirmed" => false, ]; + $user_gridmap_confirmation = $this->session->userdata('user_gridmap_confirmation'); $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $CI->load->model('logbook_model'); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $CI->load->model('logbook_model'); if(!empty($logbooks_locations_array)) { if($type == "SAT") { @@ -287,12 +399,59 @@ function jsonlookupdxcc($country, $type, $band, $mode) { $return['workedBefore'] = true; } + $extrawhere=''; + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'Q') !== false) { + $extrawhere="COL_QSL_RCVD='Y'"; + } + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'L') !== false) { + if ($extrawhere!='') { + $extrawhere.=" OR"; + } + $extrawhere.=" COL_LOTW_QSL_RCVD='Y'"; + } + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'E') !== false) { + if ($extrawhere!='') { + $extrawherei.=" OR"; + } + $extrawhere.=" COL_EQSL_QSL_RCVD='Y'"; + } + + + if($type == "SAT") { + $this->db->where('COL_PROP_MODE', 'SAT'); + if ($extrawhere != '') { + $this->db->where('('.$extrawhere.')'); + } else { + $this->db->where("1=0"); + } + } else { + $CI->load->model('logbook_model'); + $this->db->where('COL_MODE', $CI->logbook_model->get_main_mode_from_mode($mode)); + $this->db->where('COL_BAND', $band); + $this->db->where('COL_PROP_MODE !=','SAT'); + if ($extrawhere != '') { + $this->db->where('('.$extrawhere.')'); + } else { + $this->db->where("1=0"); + } + } + + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_COUNTRY', urldecode($country)); + + $query = $this->db->get($this->config->item('table_name'), 1, 0); + foreach ($query->result() as $workedBeforeRow) { + $return['confirmed']=true; + } + + header('Content-Type: application/json'); echo json_encode($return, JSON_PRETTY_PRINT); return; } else { $return['workedBefore'] = false; + $return['confirmed'] = false; header('Content-Type: application/json'); echo json_encode($return, JSON_PRETTY_PRINT); @@ -307,8 +466,10 @@ function jsonlookupcallsign($callsign, $type, $band, $mode) { $return = [ "workedBefore" => false, + "confirmed" => false, ]; + $user_gridmap_confirmation = $this->session->userdata('user_gridmap_confirmation'); $CI =& get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -333,11 +494,56 @@ function jsonlookupcallsign($callsign, $type, $band, $mode) { $return['workedBefore'] = true; } + $extrawhere=''; + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'Q') !== false) { + $extrawhere="COL_QSL_RCVD='Y'"; + } + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'L') !== false) { + if ($extrawhere!='') { + $extrawhere.=" OR"; + } + $extrawhere.=" COL_LOTW_QSL_RCVD='Y'"; + } + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'E') !== false) { + if ($extrawhere!='') { + $extrawherei.=" OR"; + } + $extrawhere.=" COL_EQSL_QSL_RCVD='Y'"; + } + + + if($type == "SAT") { + $this->db->where('COL_PROP_MODE', 'SAT'); + if ($extrawhere != '') { + $this->db->where('('.$extrawhere.')'); + } else { + $this->db->where("1=0"); + } + } else { + $CI->load->model('logbook_model'); + $this->db->where('COL_MODE', $CI->logbook_model->get_main_mode_from_mode($mode)); + $this->db->where('COL_BAND', $band); + $this->db->where('COL_PROP_MODE !=','SAT'); + if ($extrawhere != '') { + $this->db->where('('.$extrawhere.')'); + } else { + $this->db->where("1=0"); + } + } + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_CALL', strtoupper($callsign)); + + $query = $this->db->get($this->config->item('table_name'), 1, 0); + foreach ($query->result() as $workedBeforeRow) { + $return['confirmed'] = true; + } + header('Content-Type: application/json'); echo json_encode($return, JSON_PRETTY_PRINT); return; } else { $return['workedBefore'] = false; + $return['confirmed'] = false; header('Content-Type: application/json'); echo json_encode($return, JSON_PRETTY_PRINT); return; @@ -473,7 +679,7 @@ function partial($id) { $html = ""; if(!empty($logbooks_locations_array)) { - $this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_FREQ, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, station_profile.*'); + $this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_FREQ, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, '.$this->config->item('table_name').'.COL_MY_GRIDSQUARE, '.$this->config->item('table_name').'.COL_CONTEST_ID, '.$this->config->item('table_name').'.COL_STATE, station_profile.*'); $this->db->from($this->config->item('table_name')); $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); @@ -492,31 +698,27 @@ function partial($id) { $html .= "
"; $html .= ""; $html .= ""; - $html .= ""; - $html .= ""; - $html .= ""; - $html .= ""; - $html .= ""; - if ($this->session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { - $html .= ""; - } else { - $html .= ""; - } + $html .= ""; + $html .= ""; + $html .= $this->part_table_header_col($this, $this->session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1')); + $html .= $this->part_table_header_col($this, $this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2')); + $html .= $this->part_table_header_col($this, $this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3')); + $html .= $this->part_table_header_col($this, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')); switch($this->session->userdata('user_previous_qsl_type')) { case 0: - $html .= ""; + $html .= ""; break; case 1: - $html .= ""; + $html .= ""; break; case 2: - $html .= ""; + $html .= ""; break; default: - $html .= ""; + $html .= ""; break; } - $html .= ""; + $html .= ""; $html .= ""; // Get Date format @@ -536,21 +738,10 @@ function partial($id) { $html .= ""; $html .= ""; $html .= ""; - if ($row->COL_SUBMODE==null) - $html .= ""; - else - $html .= ""; - $html .= ""; - $html .= ""; - if($row->COL_SAT_NAME != null) { - $html .= ""; - } else { - if ($this->session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { - $html .= ""; - } else { - $html .= ""; - } - } + $html .= $this->part_table_col($row, $this->session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1')); + $html .= $this->part_table_col($row, $this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2')); + $html .= $this->part_table_col($row, $this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3')); + $html .= $this->part_table_col($row, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')); if ($this->session->userdata('user_previous_qsl_type') == 1) { $html .= "'; break; + case 'RSTS': $ret.= ''; break; + case 'RSTR': $ret.= ''; break; + case 'Country': $ret.= ''; break; + case 'IOTA': $ret.= ''; break; + case 'SOTA': $ret.= ''; break; + case 'WWFF': $ret.= ''; break; + case 'POTA': $ret.= ''; break; + case 'State': $ret.= ''; break; + case 'Grid': $ret.= ''; break; + case 'Distance': $ret.= ''; break; + case 'Band': $ret.= ''; break; + case 'Frequency': $ret.= ''; break; + case 'Operator': $ret.= ''; break; + } + return $ret; + } + + function part_QrbCalcLink($mygrid, $grid, $vucc) { + $ret=''; + if (!empty($grid)) { + $ret.= $grid . ' '; + } else if (!empty($vucc)) { + $ret.= $vucc .' '; + } + return $ret; + } + + function part_table_col($row, $name) { + $ret=''; + $ci =& get_instance(); + switch($name) { + case 'Mode': $ret.= ''; break; + case 'RSTS': $ret.= ''; break; + case 'RSTR': $ret.= ''; break; + case 'Country': $ret.= ''; break; + case 'IOTA': $ret.= ''; break; + case 'SOTA': $ret.= ''; break; + case 'WWFF': $ret.= ''; break; + case 'POTA': $ret.= ''; break; + case 'Grid': $ret.= ''; break; + case 'Distance': $ret.= ''; break; + case 'Band': $ret.= ''; } else { $ret.= strtolower($row->COL_BAND); } $ret.= ''; break; + case 'Frequency': $ret.= ''; } else { if($row->COL_FREQ != null) { $ret.= $ci->frequency->hz_to_mhz($row->COL_FREQ); } else { $ret.= strtolower($row->COL_BAND); } } $ret.= ''; break; + case 'State': $ret.= ''; break; + case 'Operator': $ret.= ''; break; + } + return $ret; + } } diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 456c3e26e..9fc9f54e5 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -25,6 +25,7 @@ function index() { $this->load->model('bands'); $this->load->model('iota'); $this->load->model('dxcc'); + $this->load->model('user_options_model'); $stationIds = []; @@ -40,6 +41,11 @@ function index() { $data['page_title'] = "Advanced logbook"; $data['hasDatePicker'] = true; + $userOptions = $this->user_options_model->get_options('LogbookAdvanced')->result(); + if (isset($userOptions[0])) { + $data['options'] = $userOptions[0]->option_value; + } + $pageData = []; $pageData['datePlaceholder'] = 'DD/MM/YYYY'; $pageData['deOptions'] = $deOptions; @@ -404,4 +410,42 @@ public function calculateCoordinates($qso, $lat, $long, $mygrid, $measurement_ba return $data; } + + public function userOptions() { + $this->load->model('user_options_model'); + $userOptions = $this->user_options_model->get_options('LogbookAdvanced')->result(); + if (isset($userOptions[0])) { + $data['options'] = $options = json_decode($userOptions[0]->option_value); + } else { + $data['options'] = null; + } + $this->load->view('logbookadvanced/useroptions', $data); + } + + public function setUserOptions() { + $json_string['datetime']['show'] = $this->input->post('datetime'); + $json_string['de']['show'] = $this->input->post('de'); + $json_string['dx']['show'] = $this->input->post('dx'); + $json_string['mode']['show'] = $this->input->post('mode'); + $json_string['rstr']['show'] = $this->input->post('rstr'); + $json_string['rsts']['show'] = $this->input->post('rsts'); + $json_string['band']['show'] = $this->input->post('band'); + $json_string['myrefs']['show'] = $this->input->post('myrefs'); + $json_string['refs']['show'] = $this->input->post('refs'); + $json_string['name']['show'] = $this->input->post('name'); + $json_string['qslvia']['show'] = $this->input->post('qslvia'); + $json_string['qsl']['show'] = $this->input->post('qsl'); + $json_string['lotw']['show'] = $this->input->post('lotw'); + $json_string['eqsl']['show'] = $this->input->post('eqsl'); + $json_string['qslmsg']['show'] = $this->input->post('qslmsg'); + $json_string['dxcc']['show'] = $this->input->post('dxcc'); + $json_string['state']['show'] = $this->input->post('state'); + $json_string['cqzone']['show'] = $this->input->post('cqzone'); + $json_string['iota']['show'] = $this->input->post('iota'); + + $obj['column_settings']= json_encode($json_string); + + $this->load->model('user_options_model'); + $this->user_options_model->set_option('LogbookAdvanced', 'LogbookAdvanced', $obj); + } } diff --git a/application/language/english/account_lang.php b/application/language/english/account_lang.php index 54025f593..645f27177 100644 --- a/application/language/english/account_lang.php +++ b/application/language/english/account_lang.php @@ -95,3 +95,4 @@ $lang['account_gridmap_settings'] = 'Settings for Gridsquare Map'; $lang['account_gridmap_default_band'] = 'Default Band'; +$lang['account_qsl_settings'] = 'Default QSL-Method shown in views (Gridsquare and Add-QSO)'; diff --git a/application/language/english/menu_lang.php b/application/language/english/menu_lang.php index 7a02243b8..4d6acd63b 100644 --- a/application/language/english/menu_lang.php +++ b/application/language/english/menu_lang.php @@ -14,8 +14,8 @@ $lang['menu_live_contest_logging'] = 'Live Contest Logging'; $lang['menu_post_contest_logging'] = 'Post Contest Logging'; $lang['menu_bandmap'] = 'Bandmap'; -$lang['menu_view_qsl'] = 'View QSL'; -$lang['menu_view_eqsl'] = 'View eQSL'; +$lang['menu_view_qsl'] = 'View QSL Cards'; +$lang['menu_view_eqsl'] = 'View eQSL Cards'; $lang['menu_notes'] = 'Notes'; diff --git a/application/language/german/account_lang.php b/application/language/german/account_lang.php index bd9ef7c68..4c853f137 100644 --- a/application/language/german/account_lang.php +++ b/application/language/german/account_lang.php @@ -95,3 +95,4 @@ $lang['account_gridmap_settings'] = 'Einstellung der Planquadratkarte'; $lang['account_gridmap_default_band'] = 'Standardband'; +$lang['account_qsl_settings'] = 'QSL-Methoden, die in der Planquadratkarte und beim anlegen eines QSOs angezeigt werden'; diff --git a/application/libraries/Qra.php b/application/libraries/Qra.php index a9122c29e..627fade1f 100644 --- a/application/libraries/Qra.php +++ b/application/libraries/Qra.php @@ -26,9 +26,12 @@ function bearing($tx, $rx, $unit = 'M') { $my = qra2latlong($tx); $stn = qra2latlong($rx); - $bearing = bearing($my[0], $my[1], $stn[0], $stn[1], $unit); - - return $bearing; + if ($my !== false && $stn !== false ) { + $bearing = bearing($my[0], $my[1], $stn[0], $stn[1], $unit); + return $bearing; + } else { + return false; + } } /* @@ -168,6 +171,11 @@ function qra2latlong($strQRA) { if (substr_count($strQRA, ',') == 3) { // Handle grid corners $grids = explode(',', $strQRA); + $gridlengths = array(strlen($grids[0]), strlen($grids[1]), strlen($grids[2]), strlen($grids[3])); + $same = array_count_values($gridlengths); + if (count($same) != 1) { + return false; + } $coords = array(0, 0); for($i=0; $i<4; $i++) { $cornercoords[$i] = qra2latlong($grids[$i]); @@ -178,6 +186,9 @@ function qra2latlong($strQRA) { } else if (substr_count($strQRA, ',') == 1) { // Handle grid lines $grids = explode(',', $strQRA); + if (strlen($grids[0]) != strlen($grids[1])) { + return false; + } $coords = array(0, 0); for($i=0; $i<2; $i++) { $linecoords[$i] = qra2latlong($grids[$i]); diff --git a/application/migrations/141_alter_user_options_table.php b/application/migrations/141_alter_user_options_table.php new file mode 100644 index 000000000..f62cbba65 --- /dev/null +++ b/application/migrations/141_alter_user_options_table.php @@ -0,0 +1,13 @@ +db->query("ALTER TABLE user_options CHANGE COLUMN option_value option_value text DEFAULT NULL;"); + } + + public function down(){ + } +} diff --git a/application/migrations/142_alter_lotw_user_table.php b/application/migrations/142_alter_lotw_user_table.php new file mode 100644 index 000000000..958982975 --- /dev/null +++ b/application/migrations/142_alter_lotw_user_table.php @@ -0,0 +1,16 @@ +db->query("ALTER TABLE lotw_users ADD UNIQUE INDEX callsign_UNIQUE (callsign ASC)"); + $this->db->query("ALTER TABLE lotw_users DROP INDEX callsign"); + } + + public function down(){ + $this->db->query("ALTER TABLE lotw_users DROP INDEX callsign_UNIQUE"); + $this->db->query("ALTER TABLE lotw_users ADD INDEX callsign (callsign)"); + } +} diff --git a/application/migrations/143_tag_2_4_9.php b/application/migrations/143_tag_2_4_9.php new file mode 100644 index 000000000..ec1bd57ec --- /dev/null +++ b/application/migrations/143_tag_2_4_9.php @@ -0,0 +1,24 @@ +db->where('option_name', 'version'); + $this->db->update('options', array('option_value' => '2.4.9')); + } + + public function down() + { + $this->db->where('option_name', 'version'); + $this->db->update('options', array('option_value' => '2.4.8')); + } +} \ No newline at end of file diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 42fe8bbc9..e2ef90739 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1132,7 +1132,7 @@ function last_custom($num) { $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); if(!empty($logbooks_locations_array)) { - $this->db->select('COL_CALL, COL_BAND, COL_FREQ, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME'); + $this->db->select('COL_CALL, COL_BAND, COL_FREQ, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_SRX, COL_SRX_STRING, COL_STX, COL_STX_STRING, COL_VUCC_GRIDS, COL_GRIDSQUARE, COL_MY_GRIDSQUARE, COL_OPERATOR, COL_IOTA, COL_WWFF_REF, COL_POTA_REF, COL_STATE, COL_CNTY, COL_DISTANCE, COL_SOTA_REF, COL_CONTEST_ID'); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->order_by("COL_TIME_ON", "desc"); $this->db->limit($num); @@ -1467,6 +1467,9 @@ function get_qsos($num, $offset, $StationLocationsArray = null) { $this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.*, lotw_users.callsign, lotw_users.lastupload'); $this->db->from($this->config->item('table_name')); + // remove anything thats duplicated based on COL_PRIMARY_KEY + $this->db->distinct(''.$this->config->item('table_name').'.COL_PRIMARY_KEY'); + $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); $this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left'); $this->db->join('lotw_users', 'lotw_users.callsign = '.$this->config->item('table_name').'.col_call', 'left outer'); diff --git a/application/models/Stations.php b/application/models/Stations.php index b780b0a93..054921cf1 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -485,6 +485,17 @@ public function check_station_against_user($stationid, $userid) { } return false; } + + public function check_station_against_callsign($stationid, $callsign) { + $this->db->select('station_id'); + $this->db->where('station_callsign', $callsign); + $this->db->where('station_id', $stationid); + $query = $this->db->get('station_profile'); + if ($query->num_rows() == 1) { + return true; + } + return false; + } } ?> diff --git a/application/views/components/hamsat/table.php b/application/views/components/hamsat/table.php new file mode 100644 index 000000000..bb56551bf --- /dev/null +++ b/application/views/components/hamsat/table.php @@ -0,0 +1,63 @@ +
+ +

Hamsat - Satellite Rovers

+

This data is from https://hams.at/

+
DateCallsignModeRST (S)RST (R)FrequencyBandDateCallsign".lang('gen_hamradio_qsl')."".lang('gen_hamradio_qsl')."".lang('lotw_short')."".lang('lotw_short')."".lang('eqsl_short')."".lang('eqsl_short')."".lang('gen_hamradio_qsl')."".lang('gen_hamradio_qsl')."
".date($custom_date_format, $timestamp). date(' H:i',strtotime($row->COL_TIME_ON)) . "" . str_replace('0','Ø',strtoupper($row->COL_CALL)) . "".$row->COL_MODE."".$row->COL_SUBMODE."".$row->COL_RST_SENT."".$row->COL_RST_RCVD."".$row->COL_SAT_NAME."".$this->frequency->hz_to_mhz($row->COL_FREQ)."".$row->COL_BAND.""; $html .= "input->post('grid')); + $station_id = xss_clean($this->input->post('stationProfile')); $this->load->library('Qra'); if($locator != null) { @@ -915,7 +1108,9 @@ function searchbearing($locator, $station_id = null) { } /* return distance */ - function searchdistance($locator, $station_id = null) { + function searchdistance() { + $locator = xss_clean($this->input->post('grid')); + $station_id = xss_clean($this->input->post('stationProfile')); $this->load->library('Qra'); if($locator != null) { @@ -1010,7 +1205,8 @@ function qralatlng($qra) { return $latlng; } - function qralatlngjson($qra) { + function qralatlngjson() { + $qra = xss_clean($this->input->post('qra')); $this->load->library('Qra'); $latlng = $this->qra->qra2latlong($qra); print json_encode($latlng); @@ -1029,4 +1225,56 @@ function get_qsos($num, $offset) { return $this->db->get(); } + function part_table_header_col($ctx, $name) { + $ret=''; + switch($name) { + case 'Mode': $ret.= ''.$ctx->lang->line('gen_hamradio_mode').''.$ctx->lang->line('gen_hamradio_rsts').''.$ctx->lang->line('gen_hamradio_rstr').''.$ctx->lang->line('general_word_country').''.$ctx->lang->line('gen_hamradio_iota').''.$ctx->lang->line('gen_hamradio_sota').''.$ctx->lang->line('gen_hamradio_wwff').''.$ctx->lang->line('gen_hamradio_pota').''.$ctx->lang->line('gen_hamradio_state').''.$ctx->lang->line('gen_hamradio_gridsquare').''.$ctx->lang->line('gen_hamradio_distance').''.$ctx->lang->line('gen_hamradio_band').''.$ctx->lang->line('gen_hamradio_frequency').''.$ctx->lang->line('gen_hamradio_operator').''; $ret.= $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE . '' . $row->COL_RST_SENT; if ($row->COL_STX) { $ret.= ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; $ret.=sprintf("%03d", $row->COL_STX); $ret.= '';} if ($row->COL_STX_STRING) { $ret.= ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_STX_STRING . '';} $ret.= '' . $row->COL_RST_RCVD; if ($row->COL_SRX) { $ret.= ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; $ret.=sprintf("%03d", $row->COL_SRX); $ret.= '';} if ($row->COL_SRX_STRING) { $ret.= ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_SRX_STRING . '';} $ret.= '' . ucwords(strtolower(($row->COL_COUNTRY))); if ($row->end != NULL) $ret.= ' '.$ci->lang->line('gen_hamradio_deleted_dxcc').'' . '' . ($row->COL_IOTA) . '' . ($row->COL_SOTA_REF) . '' . ($row->COL_WWFF_REF) . '' . ($row->COL_POTA_REF) . '' . $this->part_QrbCalcLink($row->COL_MY_GRIDSQUARE, $row->COL_VUCC_GRIDS, $row->COL_GRIDSQUARE) . '' . ($row->COL_DISTANCE ? $row->COL_DISTANCE . ' km' : '') . ''; if($row->COL_SAT_NAME != null) { $ret.= ''.$row->COL_SAT_NAME.''; if($row->COL_SAT_NAME != null) { $ret.= ''.$row->COL_SAT_NAME.'' . ($row->COL_STATE) . '' . ($row->COL_OPERATOR) . '
+ + + + + + + + + + + + + + + + + + + + +
Date / TimeCallsignSatelliteGridsquare
+ session->userdata('user_date_format')) { + // If Logged in and session exists + $custom_date_format = $this->session->userdata('user_date_format'); + } else { + // Get Default date format from /config/cloudlog.php + $custom_date_format = $this->config->item('qso_date_format'); + } + + ?> + + + + - - + + + + + load->model('logbook_model'); + $worked = $CI->logbook_model->check_if_grid_worked_in_logbook($rove['gridsquare'], null, "SAT"); + if ($worked != 0) { + echo " " . $rove['gridsquare'] . ""; + } else { + echo " " . $rove['gridsquare'] . ""; + } + ?> + + + Track
+
\ No newline at end of file diff --git a/application/views/hamsat/index.php b/application/views/hamsat/index.php new file mode 100644 index 000000000..aba617d2c --- /dev/null +++ b/application/views/hamsat/index.php @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 262abec5b..2fd8e4e37 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -32,6 +32,12 @@ + uri->segment(1) == "awards" && ($this->uri->segment(2) == "was") ) { ?> + - +
session->flashdata('message')) { ?> @@ -316,17 +324,35 @@ class="form-control" data-target="#dateTo" />
Quick search with selected: - - - - - - - - - - - + dx->show ?? "true") == "true") { + echo ''; + } ?> + dxcc->show ?? "true") == "true") { + echo ''; + } ?> + iota->show ?? "true") == "true") { + echo ''; + } ?> + state->show ?? "true") == "true") { + echo ''; + } ?> + refs->show ?? "true") == "true") { + echo ''; + } ?> + cqzone->show ?? "true") == "true") { + echo ''; + } ?> + mode->show ?? "true") == "true") { + echo ''; + } ?> + band->show ?? "true") == "true") { + echo ''; + } ?> + refs->show ?? "true") == "true") { + echo ''; + echo ''; + echo ''; + } ?>
@@ -347,43 +373,76 @@ class="form-control" data-target="#dateTo" /> - - + + + +
- +
- - - - - - - - - - - - - session->userdata('user_eqsl_name') != ""){ + datetime->show ?? "true") == "true") { + echo ''; + } ?> + de->show ?? "true") == "true") { + echo ''; + } ?> + dx->show ?? "true") == "true") { + echo ''; + } ?> + mode->show ?? "true") == "true") { + echo ''; + } ?> + rsts->show ?? "true") == "true") { + echo ''; + } ?> + rstr->show ?? "true") == "true") { + echo ''; + } ?> + band->show ?? "true") == "true") { + echo ''; + } ?> + myrefs->show ?? "true") == "true") { + echo ''; + } ?> + refs->show ?? "true") == "true") { + echo ''; + } ?> + name->show ?? "true") == "true") { + echo ''; + } ?> + qslvia->show ?? "true") == "true") { + echo ''; + } ?> + qsl->show ?? "true") == "true") { + echo ''; + } ?> + session->userdata('user_eqsl_name') != "" && ($options->eqsl->show ?? "true") == "true"){ echo ''; } ?> - session->userdata('user_lotw_name') != ""){ + session->userdata('user_lotw_name') != "" && ($options->lotw->show ?? "true") == "true"){ echo ''; } ?> - - - - - + qslmsg->show ?? "true") == "true") { + echo ''; + } ?> + dxcc->show ?? "true") == "true") { + echo ''; + } ?> + state->show ?? "true") == "true") { + echo ''; + } ?> + cqzone->show ?? "true") == "true") { + echo ''; + } ?> + iota->show ?? "true") == "true") { + echo ''; + } ?> diff --git a/application/views/logbookadvanced/useroptions.php b/application/views/logbookadvanced/useroptions.php new file mode 100644 index 000000000..31603b615 --- /dev/null +++ b/application/views/logbookadvanced/useroptions.php @@ -0,0 +1,86 @@ +
-
+
Date/TimeDeDxModeRST (S)RST (R)BandMy RefsRefsNameQSL ViaQSLDate/TimeDeDxModeRST (S)RST (R)BandMy RefsRefsNameQSL ViaQSLeQSLLoTWQSL MsgDXCCStateCQ ZoneIOTAQSL MsgDXCCStateCQ ZoneIOTA
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ColumnShow
Date/Time
datetime->show ?? "true") == "true") { echo 'checked'; } ?>>
De
de->show ?? "true") == "true") { echo 'checked'; } ?>>
Dx
dx->show ?? "true") == "true") { echo 'checked'; } ?>>
Mode
mode->show ?? "true") == "true") { echo 'checked'; } ?>>
RST (S)
rsts->show ?? "true") == "true") { echo 'checked'; } ?>>
RST (R)
rstr->show ?? "true") == "true") { echo 'checked'; } ?>>
Band
band->show ?? "true") == "true") { echo 'checked'; } ?>>
My Refs
myrefs->show ?? "true") == "true") { echo 'checked'; } ?>>
Refs
refs->show ?? "true") == "true") { echo 'checked'; } ?>>
Name
name->show ?? "true") == "true") { echo 'checked'; } ?>>
QSL Via
qslvia->show ?? "true") == "true") { echo 'checked'; } ?>>
QSL
qsl->show ?? "true") == "true") { echo 'checked'; } ?>>
LoTW
lotw->show ?? "true") == "true") { echo 'checked'; } ?>>
eQSL
eqsl->show ?? "true") == "true") { echo 'checked'; } ?>>
QSL Msg
qslmsg->show ?? "true") == "true") { echo 'checked'; } ?>>
DXCC
dxcc->show ?? "true") == "true") { echo 'checked'; } ?>>
State
state->show ?? "true") == "true") { echo 'checked'; } ?>>
CQ Zone
cqzone->show ?? "true") == "true") { echo 'checked'; } ?>>
IOTA
iota->show ?? "true") == "true") { echo 'checked'; } ?>>
diff --git a/application/views/qso/components/previous_contacts.php b/application/views/qso/components/previous_contacts.php index 7c13761c1..f0f8ad8dc 100644 --- a/application/views/qso/components/previous_contacts.php +++ b/application/views/qso/components/previous_contacts.php @@ -3,18 +3,15 @@
- - - - - - session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { - echo ''; - } else { - echo ''; - } - ?> - + + + session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1')); + echo_table_header_col($this, $this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2')); + echo_table_header_col($this, $this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3')); + echo_table_header_col($this, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')); + ?> + COL_CALL)); ?> - - - - COL_SAT_NAME != null) { ?> - - session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { - echo ''; - } else { - echo ''; - } - } ?> - + session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1')); + echo_table_col($row, $this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2')); + echo_table_col($row, $this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3')); + echo_table_col($row, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')); + ?> +
/'.lang('gen_hamradio_frequency').''.lang('gen_hamradio_band').'
/
COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; ?>COL_RST_SENT; ?>COL_RST_RCVD; ?>COL_SAT_NAME; ?>'; - if ($row->COL_FREQ != null) { - echo $this->frequency->hz_to_mhz($row->COL_FREQ); - } else { - echo $row->COL_BAND; - } - echo ''.$row->COL_BAND.'
- \ No newline at end of file + + +'; echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE . ''; break; + case 'RSTS': echo '' . $row->COL_RST_SENT; if ($row->COL_STX) { echo ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; printf("%03d", $row->COL_STX); echo '';} if ($row->COL_STX_STRING) { echo ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_STX_STRING . '';} echo ''; break; + case 'RSTR': echo '' . $row->COL_RST_RCVD; if ($row->COL_SRX) { echo ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; printf("%03d", $row->COL_SRX); echo '';} if ($row->COL_SRX_STRING) { echo ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_SRX_STRING . '';} echo ''; break; + case 'Country': echo '' . ucwords(strtolower(($row->COL_COUNTRY))); if ($row->end != NULL) echo ' '.$ci->lang->line('gen_hamradio_deleted_dxcc').'' . ''; break; + case 'IOTA': echo '' . ($row->COL_IOTA) . ''; break; + case 'SOTA': echo '' . ($row->COL_SOTA_REF) . ''; break; + case 'WWFF': echo '' . ($row->COL_WWFF_REF) . ''; break; + case 'POTA': echo '' . ($row->COL_POTA_REF) . ''; break; + case 'Grid': echo ''; echoQrbCalcLink($row->COL_MY_GRIDSQUARE, $row->COL_VUCC_GRIDS, $row->COL_GRIDSQUARE); echo ''; break; + case 'Distance': echo '' . ($row->COL_DISTANCE ? $row->COL_DISTANCE . ' km' : '') . ''; break; + case 'Band': echo ''; if($row->COL_SAT_NAME != null) { echo ''.$row->COL_SAT_NAME.''; } else { echo strtolower($row->COL_BAND); } echo ''; break; + case 'Frequency': echo ''; if($row->COL_SAT_NAME != null) { echo ''.$row->COL_SAT_NAME.''; } else { if($row->COL_FREQ != null) { echo $ci->frequency->hz_to_mhz($row->COL_FREQ); } else { echo strtolower($row->COL_BAND); } } echo ''; break; + case 'State': echo '' . ($row->COL_STATE) . ''; break; + case 'Operator': echo '' . ($row->COL_OPERATOR) . ''; break; + } +} + +function echo_table_header_col($ctx, $name) { + switch($name) { + case 'Mode': echo ''.$ctx->lang->line('gen_hamradio_mode').''; break; + case 'RSTS': echo ''.$ctx->lang->line('gen_hamradio_rsts').''; break; + case 'RSTR': echo ''.$ctx->lang->line('gen_hamradio_rstr').''; break; + case 'Country': echo ''.$ctx->lang->line('general_word_country').''; break; + case 'IOTA': echo ''.$ctx->lang->line('gen_hamradio_iota').''; break; + case 'SOTA': echo ''.$ctx->lang->line('gen_hamradio_sota').''; break; + case 'WWFF': echo ''.$ctx->lang->line('gen_hamradio_wwff').''; break; + case 'POTA': echo ''.$ctx->lang->line('gen_hamradio_pota').''; break; + case 'State': echo ''.$ctx->lang->line('gen_hamradio_state').''; break; + case 'Grid': echo ''.$ctx->lang->line('gen_hamradio_gridsquare').''; break; + case 'Distance': echo ''.$ctx->lang->line('gen_hamradio_distance').''; break; + case 'Band': echo ''.$ctx->lang->line('gen_hamradio_band').''; break; + case 'Frequency': echo ''.$ctx->lang->line('gen_hamradio_frequency').''; break; + case 'Operator': echo ''.$ctx->lang->line('gen_hamradio_operator').''; break; + } +} + +function echoQrbCalcLink($mygrid, $grid, $vucc) { + if (!empty($grid)) { + echo $grid . ' '; + } else if (!empty($vucc)) { + echo $vucc .' '; + } +} +?> diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 5c2575557..3f9a6850f 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -597,70 +597,8 @@ class="btn btn-primary"
-
- -
- - - - - - - - session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { - echo ''; - } else { - echo ''; - } - ?> - - - session->userdata('user_date_format')) { - // If Logged in and session exists - $custom_date_format = $this->session->userdata('user_date_format'); - } else { - // Get Default date format from /config/cloudlog.php - $custom_date_format = $this->config->item('qso_date_format'); - } - - $i = 0; - if($query != false) { - foreach ($query->result() as $row) { - echo ''; - echo ' - - - - - COL_SAT_NAME != null) { ?> - - session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { - echo ''; - } else { - echo ''; - } - } ?> - - -
/'.lang('gen_hamradio_frequency').''.lang('gen_hamradio_band').'
'; - $timestamp = strtotime($row->COL_TIME_ON); - echo date($custom_date_format, $timestamp); - echo date(' H:i',strtotime($row->COL_TIME_ON)); - ?> - - COL_CALL)); ?> - COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; ?>COL_RST_SENT; ?>COL_RST_RCVD; ?>COL_SAT_NAME; ?>'; - if ($row->COL_FREQ != null) { - echo $this->frequency->hz_to_mhz($row->COL_FREQ); - } else { - echo $row->COL_BAND; - } - echo ''.$row->COL_BAND.'
-
+
+
diff --git a/application/views/user/edit.php b/application/views/user/edit.php index f833d9973..179288b59 100644 --- a/application/views/user/edit.php +++ b/application/views/user/edit.php @@ -562,6 +562,11 @@ } ?> + +
+ +
+
diff --git a/application/views/view_log/qso.php b/application/views/view_log/qso.php index fdba5f55f..8da288cda 100644 --- a/application/views/view_log/qso.php +++ b/application/views/view_log/qso.php @@ -400,9 +400,17 @@ $hashtags .= " #WWFF ".$row->COL_WWFF_REF; } if (!isset($distance)) { - $twitter_string = urlencode("Just worked ".$row->COL_CALL." in ".ucwords(strtolower(($row->COL_COUNTRY)))." on ".$twitter_band_sat." using ".($row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE)." ".$hashtags); + $twitter_string = urlencode("Just worked ".$row->COL_CALL." "); + if ($row->COL_DXCC != 0) { + $twitter_string .= urlencode("in ".ucwords(strtolower(($row->COL_COUNTRY)))." "); + } + $twitter_string .= urlencode("on ".$twitter_band_sat." using ".($row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE)." ".$hashtags); } else { - $twitter_string = urlencode("Just worked ".$row->COL_CALL." in ".ucwords(strtolower(($row->COL_COUNTRY)))." (Gridsquare: ".$row->COL_GRIDSQUARE." / distance: ".$distance.") on ".$twitter_band_sat." using ".($row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE)." ".$hashtags); + $twitter_string = urlencode("Just worked ".$row->COL_CALL." "); + if ($row->COL_DXCC != 0) { + $twitter_string .= urlencode("in ".ucwords(strtolower(($row->COL_COUNTRY)))." "); + } + $twitter_string .= urlencode("(Gridsquare: ".$row->COL_GRIDSQUARE." / distance: ".$distance.") on ".$twitter_band_sat." using ".($row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE)." ".$hashtags); } ?> diff --git a/assets/css/general.css b/assets/css/general.css index a4ba54d6c..6a9794d73 100644 --- a/assets/css/general.css +++ b/assets/css/general.css @@ -144,10 +144,14 @@ thead > tr > td { text-transform: uppercase; } -.workedGrid { +.confirmedGrid { border-color: green; } +.workedGrid { + border-color: yellow; +} + .newGrid { border-color: red; border-width: 2px; @@ -528,4 +532,8 @@ div#station_logbooks_linked_table_paginate { .qso_panel a i.fa.fa-star:hover { color: #FFD700 !important; -} \ No newline at end of file +} + +#dx, #state, #gridsquare, #sota, #wwff, #pota { + text-transform: uppercase; +} diff --git a/assets/js/sections/common.js b/assets/js/sections/common.js index 158b1228d..4f6778644 100644 --- a/assets/js/sections/common.js +++ b/assets/js/sections/common.js @@ -152,9 +152,33 @@ function qso_edit(id) { $('#locator').change(function(){ if ($(this).val().length >= 4) { - $('#locator_info').load(base_url + "index.php/logbook/searchbearing/" + $(this).val() + "/" + $('#stationProfile').val()).fadeIn("slow"); - $.get(base_url + 'index.php/logbook/searchdistance/' + $(this).val() + "/" + $('#stationProfile').val(), function(result) { - document.getElementById("distance").value = result; + $.ajax({ + url: base_url + 'index.php/logbook/searchbearing', + type: 'post', + data: { + grid: $(this).val(), + stationProfile: $('#stationProfile').val() + }, + success: function(data) { + $('#locator_info').html(data).fadeIn("slow"); + }, + error: function() { + $('#locator_info').text("Error loading bearing!").fadeIn("slow"); + }, + }); + $.ajax({ + url: base_url + 'index.php/logbook/searchdistance', + type: 'post', + data: { + grid: $(this).val(), + stationProfile: $('#stationProfile').val() + }, + success: function(data) { + document.getElementById("distance").value = data; + }, + error: function() { + document.getElementById("distance").value = null; + }, }); } }); diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 824da49aa..c23287fed 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -24,29 +24,63 @@ function updateRow(qso) { let row = $('#qsoID-' + qso.qsoID); let cells = row.find('td'); let c = 1; - cells.eq(c++).text(qso.qsoDateTime); - cells.eq(c++).text(qso.de); - cells.eq(c++).html(''+qso.dx+'' + (qso.callsign == '' ? '' : ' L') + ' Lookup ' + qso.dx + ' on QRZ.com Lookup ' + qso.dx + ' on HamQTH'); - cells.eq(c++).text(qso.mode); - cells.eq(c++).text(qso.rstS); - cells.eq(c++).text(qso.rstR); - cells.eq(c++).text(qso.band); - cells.eq(c++).text(qso.deRefs); - cells.eq(c++).html(qso.dxRefs); - cells.eq(c++).text(qso.name); - cells.eq(c++).text(qso.qslVia); - cells.eq(c++).html(qso.qsl); - if ($(".eqslconfirmation")[0]){ + if (user_options.datetime.show == "true"){ + cells.eq(c++).text(qso.qsoDateTime); + } + if (user_options.de.show == "true"){ + cells.eq(c++).text(qso.de); + } + if (user_options.dx.show == "true"){ + cells.eq(c++).html(''+qso.dx+'' + (qso.callsign == '' ? '' : ' L') + ' Lookup ' + qso.dx + ' on QRZ.com Lookup ' + qso.dx + ' on HamQTH'); + } + if (user_options.mode.show == "true"){ + cells.eq(c++).text(qso.mode); + } + if (user_options.rsts.show == "true"){ + cells.eq(c++).text(qso.rstS); + } + if (user_options.rstr.show == "true"){ + cells.eq(c++).text(qso.rstR); + } + if (user_options.band.show == "true"){ + cells.eq(c++).text(qso.band); + } + if (user_options.myrefs.show == "true"){ + cells.eq(c++).text(qso.deRefs); + } + if (user_options.refs.show == "true"){ + cells.eq(c++).html(qso.dxRefs); + } + if (user_options.name.show == "true"){ + cells.eq(c++).text(qso.name); + } + if (user_options.qslvia.show == "true"){ + cells.eq(c++).text(qso.qslVia); + } + if (user_options.qsl.show == "true"){ + cells.eq(c++).html(qso.qsl); + } + if ($(".eqslconfirmation")[0] && user_options.eqsl.show == "true"){ cells.eq(c++).html(qso.eqsl); } - if ($(".lotwconfirmation")[0]){ + if ($(".lotwconfirmation")[0] && user_options.lotw.show == "true"){ cells.eq(c++).html(qso.lotw); } - cells.eq(c++).text(qso.qslMessage); - cells.eq(c++).html(qso.dxcc); - cells.eq(c++).text(qso.state); - cells.eq(c++).html(qso.cqzone); - cells.eq(c++).html(qso.iota); + if (user_options.qslmsg.show == "true"){ + cells.eq(c++).text(qso.qslMessage); + } + if (user_options.dxcc.show == "true"){ + cells.eq(c++).html(qso.dxcc); + } + if (user_options.state.show == "true"){ + cells.eq(c++).text(qso.state); + } + if (user_options.cqzone.show == "true"){ + cells.eq(c++).html(qso.cqzone); + } + if (user_options.iota.show == "true"){ + cells.eq(c++).html(qso.iota); + } $('[data-toggle="tooltip"]').tooltip(); return row; @@ -67,6 +101,10 @@ function loadQSOTable(rows) { "scrollCollapse": true, "paging": false, "scrollX": true, + // colReorder: { + // order: [0, 2,1,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18] + // // order: [0, customsortorder] + // }, }); }); @@ -79,29 +117,63 @@ function loadQSOTable(rows) { var data = []; data.push('
'); - data.push(qso.qsoDateTime); - data.push(qso.de); - data.push(''+qso.dx+'' + (qso.callsign == '' ? '' : ' L') + ' Lookup ' + qso.dx + ' on QRZ.com Lookup ' + qso.dx + ' on HamQTH'); - data.push(qso.mode); - data.push(qso.rstS); - data.push(qso.rstR); - data.push(qso.band); - data.push(qso.deRefs); - data.push(qso.dxRefs); - data.push(qso.name); - data.push(qso.qslVia); - data.push(qso.qsl); - if ($(".eqslconfirmation")[0]){ + if (user_options.datetime.show == "true"){ + data.push(qso.qsoDateTime); + } + if (user_options.de.show == "true"){ + data.push(qso.de); + } + if (user_options.dx.show == "true"){ + data.push(''+qso.dx+'' + (qso.callsign == '' ? '' : ' L') + ' Lookup ' + qso.dx + ' on QRZ.com Lookup ' + qso.dx + ' on HamQTH'); + } + if (user_options.mode.show == "true"){ + data.push(qso.mode); + } + if (user_options.rsts.show == "true"){ + data.push(qso.rstS); + } + if (user_options.rstr.show == "true"){ + data.push(qso.rstR); + } + if (user_options.band.show == "true"){ + data.push(qso.band); + } + if (user_options.myrefs.show == "true"){ + data.push(qso.deRefs); + } + if (user_options.refs.show == "true"){ + data.push(qso.dxRefs); + } + if (user_options.name.show == "true"){ + data.push(qso.name); + } + if (user_options.qslvia.show == "true"){ + data.push(qso.qslVia); + } + if (user_options.qsl.show == "true"){ + data.push(qso.qsl); + } + if ($(".eqslconfirmation")[0] && user_options.eqsl.show == "true"){ data.push(qso.eqsl); } - if ($(".lotwconfirmation")[0]){ + if ($(".lotwconfirmation")[0] && user_options.lotw.show == "true"){ data.push(qso.lotw); } - data.push(qso.qslMessage); - data.push(qso.dxcc+(qso.end == null ? '' : ' Deleted DXCC')); - data.push(qso.state); - data.push(qso.cqzone); - data.push(qso.iota); + if (user_options.qslmsg.show == "true"){ + data.push(qso.qslMessage); + } + if (user_options.dxcc.show == "true"){ + data.push(qso.dxcc+(qso.end == null ? '' : ' Deleted DXCC')); + } + if (user_options.state.show == "true"){ + data.push(qso.state); + } + if (user_options.cqzone.show == "true"){ + data.push(qso.cqzone); + } + if (user_options.iota.show == "true"){ + data.push(qso.iota); + } let createdRow = table.row.add(data).index(); table.rows(createdRow).nodes().to$().data('qsoID', qso.qsoID); @@ -423,6 +495,49 @@ $(document).ready(function () { quickSearch('pota'); }); + $('#optionButton').click(function (event) { + $('#optionButton').prop("disabled", true); + $.ajax({ + url: base_url + 'index.php/logbookadvanced/userOptions', + type: 'post', + success: function (html) { + BootstrapDialog.show({ + title: 'Options for the Advanced Logbook', + size: BootstrapDialog.SIZE_NORMAL, + cssClass: 'options', + nl2br: false, + message: html, + onshown: function(dialog) { + }, + buttons: [{ + label: 'Save', + cssClass: 'btn-primary btn-sm', + id: 'saveButton', + action: function (dialogItself) { + $('#optionButton').prop("disabled", false); + $('#closeButton').prop("disabled", true); + saveOptions(); + dialogItself.close(); + location.reload(); + } + }, + { + label: 'Close', + cssClass: 'btn-sm', + id: 'closeButton', + action: function (dialogItself) { + $('#optionButton').prop("disabled", false); + dialogItself.close(); + } + }], + onhide: function(dialogRef){ + $('#optionButton').prop("disabled", false); + }, + }); + } + }); + }); + $('#qslSlideshow').click(function (event) { var elements = $('#qsoList tbody input:checked'); var nElements = elements.length; @@ -920,3 +1035,40 @@ function loadMap(data) { } return (table += ''); } + + function saveOptions() { + $('#saveButton').prop("disabled", true); + $('#closeButton').prop("disabled", true); + $.ajax({ + url: base_url + 'index.php/logbookadvanced/setUserOptions', + type: 'post', + data: { + datetime: $('input[name="datetime"]').is(':checked') ? true : false, + de: $('input[name="de"]').is(':checked') ? true : false, + dx: $('input[name="dx"]').is(':checked') ? true : false, + mode: $('input[name="mode"]').is(':checked') ? true : false, + rsts: $('input[name="rsts"]').is(':checked') ? true : false, + rstr: $('input[name="rstr"]').is(':checked') ? true : false, + band: $('input[name="band"]').is(':checked') ? true : false, + myrefs: $('input[name="myrefs"]').is(':checked') ? true : false, + refs: $('input[name="refs"]').is(':checked') ? true : false, + name: $('input[name="name"]').is(':checked') ? true : false, + qslvia: $('input[name="qslvia"]').is(':checked') ? true : false, + qsl: $('input[name="qsl"]').is(':checked') ? true : false, + lotw: $('input[name="lotw"]').is(':checked') ? true : false, + eqsl: $('input[name="eqsl"]').is(':checked') ? true : false, + qslmsg: $('input[name="qslmsg"]').is(':checked') ? true : false, + dxcc: $('input[name="dxcc"]').is(':checked') ? true : false, + state: $('input[name="state"]').is(':checked') ? true : false, + cqzone: $('input[name="cqzone"]').is(':checked') ? true : false, + iota: $('input[name="iota"]').is(':checked') ? true : false, + }, + success: function(data) { + $('#saveButton').prop("disabled", false); + $('#closeButton').prop("disabled", false); + }, + error: function() { + $('#saveButton').prop("disabled", false); + }, + }); + } diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 9e2c92d2e..6d10cc00c 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -386,18 +386,20 @@ function changebadge(entityname) { $.getJSON(base_url + 'index.php/logbook/jsonlookupdxcc/' + convert_case(entityname) + '/SAT/0/0', function(result) { + $('#callsign_info').removeClass("lotw_info_orange"); $('#callsign_info').removeClass("badge-secondary"); $('#callsign_info').removeClass("badge-success"); $('#callsign_info').removeClass("badge-danger"); $('#callsign_info').attr('title', ''); - if (result.workedBefore) - { + if (result.confirmed) { $('#callsign_info').addClass("badge-success"); + $('#callsign_info').attr('title', 'DXCC was already worked and confirmed in the past on this band and mode!'); + } else if (result.workedBefore) { + $('#callsign_info').addClass("badge-success"); + $('#callsign_info').addClass("lotw_info_orange"); $('#callsign_info').attr('title', 'DXCC was already worked in the past on this band and mode!'); - } - else - { + } else { $('#callsign_info').addClass("badge-danger"); $('#callsign_info').attr('title', 'New DXCC, not worked on this band and mode!'); } @@ -406,18 +408,20 @@ function changebadge(entityname) { $.getJSON(base_url + 'index.php/logbook/jsonlookupdxcc/' + convert_case(entityname) + '/0/' + $("#band").val() +'/' + $("#mode").val(), function(result) { // Reset CSS values before updating + $('#callsign_info').removeClass("lotw_info_orange"); $('#callsign_info').removeClass("badge-secondary"); $('#callsign_info').removeClass("badge-success"); $('#callsign_info').removeClass("badge-danger"); $('#callsign_info').attr('title', ''); - if (result.workedBefore) - { + if (result.confirmed) { + $('#callsign_info').addClass("badge-success"); + $('#callsign_info').attr('title', 'DXCC was already worked and confirmed in the past on this band and mode!'); + } else if (result.workedBefore) { $('#callsign_info').addClass("badge-success"); + $('#callsign_info').addClass("lotw_info_orange"); $('#callsign_info').attr('title', 'DXCC was already worked in the past on this band and mode!'); - } - else - { + } else { $('#callsign_info').addClass("badge-danger"); $('#callsign_info').attr('title', 'New DXCC, not worked on this band and mode!'); } @@ -445,8 +449,10 @@ function reset_fields() { $('#locator').val(""); $('#iota_ref').val(""); $('#sota_ref').val(""); + $("#locator").removeClass("confirmedGrid"); $("#locator").removeClass("workedGrid"); $("#locator").removeClass("newGrid"); + $("#callsign").removeClass("confirmedGrid"); $("#callsign").removeClass("workedGrid"); $("#callsign").removeClass("newGrid"); $('#callsign_info').removeClass("badge-secondary"); @@ -521,11 +527,14 @@ $("#callsign").focusout(function() { { // Reset CSS values before updating $('#callsign').removeClass("workedGrid"); + $('#callsign').removeClass("confirmedGrid"); $('#callsign').removeClass("newGrid"); $('#callsign').attr('title', ''); - if (result.workedBefore) - { + if (result.confirmed) { + $('#callsign').addClass("confirmedGrid"); + $('#callsign').attr('title', 'Callsign was already worked and confirmed in the past on this band and mode!'); + } else if (result.workedBefore) { $('#callsign').addClass("workedGrid"); $('#callsign').attr('title', 'Callsign was already worked in the past on this band and mode!'); } @@ -539,20 +548,22 @@ $("#callsign").focusout(function() { $.getJSON(base_url + 'index.php/logbook/jsonlookupcallsign/' + find_callsign.replace(/\//g, "-") + '/0/' + $("#band").val() +'/' + $("#mode").val(), function(result) { // Reset CSS values before updating + $('#callsign').removeClass("confirmedGrid"); $('#callsign').removeClass("workedGrid"); $('#callsign').removeClass("newGrid"); $('#callsign').attr('title', ''); - if (result.workedBefore) - { + if (result.confirmed) { + $('#callsign').addClass("confirmedGrid"); + $('#callsign').attr('title', 'Callsign was already worked and confirmed in the past on this band and mode!'); + } else if (result.workedBefore) { $('#callsign').addClass("workedGrid"); $('#callsign').attr('title', 'Callsign was already worked in the past on this band and mode!'); - } - else - { + } else { $('#callsign').addClass("newGrid"); $('#callsign').attr('title', 'New Callsign!'); } + }) } @@ -632,20 +643,19 @@ $("#callsign").focusout(function() { if (result.callsign_qra != "") { - if (result.workedBefore) - { + if (result.confirmed) { + $('#locator').addClass("confirmedGrid"); + $('#locator').attr('title', 'Grid was already worked and confirmed in the past'); + } else if (result.workedBefore) { $('#locator').addClass("workedGrid"); $('#locator').attr('title', 'Grid was already worked in the past'); - } - else - { + } else { $('#locator').addClass("newGrid"); $('#locator').attr('title', 'New grid!'); } - } - else - { + } else { $('#locator').removeClass("workedGrid"); + $('#locator').removeClass("confirmedGrid"); $('#locator').removeClass("newGrid"); $('#locator').attr('title', ''); } @@ -773,17 +783,18 @@ $("#locator").keyup(function(){ $.getJSON(base_url + 'index.php/logbook/jsonlookupgrid/' + qra_lookup.toUpperCase() + '/SAT/0/0', function(result) { // Reset CSS values before updating + $('#locator').removeClass("confirmedGrid"); $('#locator').removeClass("workedGrid"); $('#locator').removeClass("newGrid"); $('#locator').attr('title', ''); - if (result.workedBefore) - { + if (result.confirmed) { + $('#locator').addClass("confirmedGrid"); + $('#locator').attr('title', 'Grid was already worked and confirmed in the past'); + } else if (result.workedBefore) { $('#locator').addClass("workedGrid"); $('#locator').attr('title', 'Grid was already worked in the past'); - } - else - { + } else { $('#locator').addClass("newGrid"); $('#locator').attr('title', 'New grid!'); } @@ -792,46 +803,81 @@ $("#locator").keyup(function(){ $.getJSON(base_url + 'index.php/logbook/jsonlookupgrid/' + qra_lookup.toUpperCase() + '/0/' + $("#band").val() +'/' + $("#mode").val(), function(result) { // Reset CSS values before updating + $('#locator').removeClass("confirmedGrid"); $('#locator').removeClass("workedGrid"); $('#locator').removeClass("newGrid"); $('#locator').attr('title', ''); - - if (result.workedBefore) - { + + if (result.confirmed) { + $('#locator').addClass("confirmedGrid"); + $('#locator').attr('title', 'Grid was already worked and confimred in the past'); + } else if (result.workedBefore) { $('#locator').addClass("workedGrid"); $('#locator').attr('title', 'Grid was already worked in the past'); - } - else - { + } else { $('#locator').addClass("newGrid"); $('#locator').attr('title', 'New grid!'); } + }) } } if(qra_input.length >= 4 && $(this).val().length > 0) { - $.getJSON(base_url + 'index.php/logbook/qralatlngjson/' + $(this).val(), function(result) - { - // Set Map to Lat/Long - markers.clearLayers(); - if (typeof result !== "undefined") { - var redIcon = L.icon({ - iconUrl: icon_dot_url, - iconSize: [18, 18], // size of the icon - }); + $.ajax({ + url: base_url + 'index.php/logbook/qralatlngjson', + type: 'post', + data: { + qra: $(this).val(), + }, + success: function(data) { + // Set Map to Lat/Long + result = JSON.parse(data); + markers.clearLayers(); + if (typeof result[0] !== "undefined" && typeof result[1] !== "undefined") { + var redIcon = L.icon({ + iconUrl: icon_dot_url, + iconSize: [18, 18], // size of the icon + }); - var marker = L.marker([result[0], result[1]], {icon: redIcon}); - mymap.setZoom(8); - mymap.panTo([result[0], result[1]]); - mymap.setView([result[0], result[1]], 8); - } - markers.addLayer(marker).addTo(mymap); - }) + var marker = L.marker([result[0], result[1]], {icon: redIcon}); + mymap.setZoom(8); + mymap.panTo([result[0], result[1]]); + mymap.setView([result[0], result[1]], 8); + markers.addLayer(marker).addTo(mymap); + } + }, + error: function() { + }, + }); - $('#locator_info').load(base_url +"index.php/logbook/searchbearing/" + $(this).val() + "/" + $('#stationProfile').val()).fadeIn("slow"); - $.get(base_url + 'index.php/logbook/searchdistance/' + $(this).val() + "/" + $('#stationProfile').val(), function(result) { - document.getElementById("distance").value = result; + $.ajax({ + url: base_url + 'index.php/logbook/searchbearing', + type: 'post', + data: { + grid: $(this).val(), + stationProfile: $('#stationProfile').val() + }, + success: function(data) { + $('#locator_info').html(data).fadeIn("slow"); + }, + error: function() { + $('#locator_info').text("Error loading bearing!").fadeIn("slow"); + }, + }); + $.ajax({ + url: base_url + 'index.php/logbook/searchdistance', + type: 'post', + data: { + grid: $(this).val(), + stationProfile: $('#stationProfile').val() + }, + success: function(data) { + document.getElementById("distance").value = data; + }, + error: function() { + document.getElementById("distance").value = null; + }, }); } } @@ -921,8 +967,10 @@ function resetDefaultQSOFields() { $('#iota_ref').val(""); $('#sota_ref').val(""); $("#locator").removeClass("workedGrid"); + $("#locator").removeClass("confirmedGrid"); $("#locator").removeClass("newGrid"); $("#callsign").removeClass("workedGrid"); + $("#callsign").removeClass("confirmedGrid"); $("#callsign").removeClass("newGrid"); $('#callsign_info').removeClass("badge-secondary"); $('#callsign_info').removeClass("badge-success"); diff --git a/src/QSLManager/QSO.php b/src/QSLManager/QSO.php index f488fdc21..31c3ce939 100644 --- a/src/QSLManager/QSO.php +++ b/src/QSLManager/QSO.php @@ -38,7 +38,6 @@ class QSO private string $iota; /** @var string[] */ private string $deVUCCGridsquares; - private string $stationGridsquare; private string $dxGridsquare; private string $dxIOTA; private string $dxSig; @@ -156,17 +155,15 @@ public function __construct(array $data) $this->email = $data['COL_EMAIL'] ?? ''; $this->address = $data['COL_ADDRESS'] ?? ''; - $this->deGridsquare = $data['COL_MY_GRIDSQUARE'] ?? ''; - $this->deIOTA = $data['COL_MY_IOTA'] ?? ''; - $this->deSig = $data['COL_MY_SIG'] ?? ''; - $this->deSigInfo = $data['COL_MY_SIG_INFO'] ?? ''; + $this->deGridsquare = $data['station_gridsquare'] ?? ''; + $this->deIOTA = $data['station_iota'] ?? ''; + $this->deSig = $data['station_sig'] ?? ''; + $this->deSigInfo = $data['station_sig_info'] ?? ''; $this->deIOTAIslandID = $data['COL_MY_IOTA_ISLAND_ID'] ?? ''; - $this->deSOTAReference = $data['COL_MY_SOTA_REF'] ?? ''; + $this->deSOTAReference = $data['station_sota'] ?? ''; $this->deVUCCGridsquares = $data['COL_MY_VUCC_GRIDS'] ?? ''; - $this->stationGridsquare = $data['station_gridsquare'] ?? ''; - $this->dxGridsquare = $data['COL_GRIDSQUARE'] ?? ''; $this->dxIOTA = $data['COL_IOTA'] ?? ''; $this->dxSig = $data['COL_SIG'] ?? ''; @@ -862,9 +859,9 @@ private function getFormattedDxRefs(): string { $refs = []; if ($this->dxVUCCGridsquares !== '') { - $refs[] = '' . $this->dxVUCCGridsquares . ' ' .$this->getQrbLink($this->stationGridsquare, $this->dxVUCCGridsquares, $this->dxGridsquare); + $refs[] = '' . $this->dxVUCCGridsquares . ' ' .$this->getQrbLink($this->deGridsquare, $this->dxVUCCGridsquares, $this->dxGridsquare); } else if ($this->dxGridsquare !== '') { - $refs[] = '' . $this->dxGridsquare . ' ' .$this->getQrbLink($this->stationGridsquare, $this->dxVUCCGridsquares, $this->dxGridsquare); + $refs[] = '' . $this->dxGridsquare . ' ' .$this->getQrbLink($this->deGridsquare, $this->dxVUCCGridsquares, $this->dxGridsquare); } if ($this->dxSOTAReference !== '') { $refs[] = "SOTA: " . '' . $this->dxSOTAReference. '';