From 023e6f151f2d6fed3e0e84a4ffabc7293bb8699c Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 9 May 2023 17:36:30 +0200 Subject: [PATCH 01/77] Remove useless file writing --- application/controllers/Kmlexport.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/application/controllers/Kmlexport.php b/application/controllers/Kmlexport.php index b106900e8..711ebc688 100644 --- a/application/controllers/Kmlexport.php +++ b/application/controllers/Kmlexport.php @@ -90,17 +90,8 @@ class Kmlexport extends CI_Controller { $output .= ""; $output .= ""; - if (!file_exists('kml')) { - mkdir('kml', 0755, true); - } - - if ( ! write_file('kml/qsos.kml', $output)) { - echo 'Unable to write the file. Make sure the folder KML has write permissions.'; - } - else { - header("Content-Disposition: attachment; filename=\"qsos.kml\""); - echo $output; - } + header("Content-Disposition: attachment; filename=\"qsos.kml\""); + echo $output; } -} \ No newline at end of file +} From 21562bffc46a7d4421b37b7fbe16ad9f2d854e33 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 10 May 2023 16:03:30 +0200 Subject: [PATCH 02/77] Add eQSL card list/view --- application/controllers/Eqsl.php | 63 ++++++++++++++++++- application/models/Eqsl_images.php | 9 ++- application/views/eqslcard/index.php | 59 +++++++++++++++++ application/views/interface_assets/footer.php | 27 +++++++- application/views/interface_assets/header.php | 2 + 5 files changed, 157 insertions(+), 3 deletions(-) create mode 100644 application/views/eqslcard/index.php diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index 2268d5535..fa7a69e66 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -8,6 +8,23 @@ class eqsl extends CI_Controller { $this->load->helper(array('form', 'url')); } + // Default view when loading controller. + public function index() { + + $this->lang->load('qslcard'); + $folder_name = "assets/qslcard"; + $data['storage_used'] = $this->sizeFormat($this->folderSize($folder_name)); + + // Render Page + $data['page_title'] = "eQSL Cards"; + + $this->load->model('eqsl_images'); + $data['qslarray'] = $this->eqsl_images->eqsl_qso_list(); + + $this->load->view('interface_assets/header', $data); + $this->load->view('eqslcard/index'); + $this->load->view('interface_assets/footer'); + } public function import() { $this->load->model('user_model'); if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } @@ -599,5 +616,49 @@ class eqsl extends CI_Controller { $status = $this->uploadQso($adif, $qsl); } } - + +// Functions for storage, these need shifted to a libary to use across Cloudlog + function folderSize($dir){ + $count_size = 0; + $count = 0; + $dir_array = scandir($dir); + foreach($dir_array as $key=>$filename){ + if($filename!=".." && $filename!="."){ + if(is_dir($dir."/".$filename)){ + $new_foldersize = foldersize($dir."/".$filename); + $count_size = $count_size+ $new_foldersize; + }else if(is_file($dir."/".$filename)){ + $count_size = $count_size + filesize($dir."/".$filename); + $count++; + } + } + } + return $count_size; + } + + function sizeFormat($bytes){ + $kb = 1024; + $mb = $kb * 1024; + $gb = $mb * 1024; + $tb = $gb * 1024; + + if (($bytes >= 0) && ($bytes < $kb)) { + return $bytes . ' B'; + + } elseif (($bytes >= $kb) && ($bytes < $mb)) { + return ceil($bytes / $kb) . ' KB'; + + } elseif (($bytes >= $mb) && ($bytes < $gb)) { + return ceil($bytes / $mb) . ' MB'; + + } elseif (($bytes >= $gb) && ($bytes < $tb)) { + return ceil($bytes / $gb) . ' GB'; + + } elseif ($bytes >= $tb) { + return ceil($bytes / $tb) . ' TB'; + } else { + return $bytes . ' B'; + } + } + } // end class diff --git a/application/models/Eqsl_images.php b/application/models/Eqsl_images.php index 88137b01b..521f8fba5 100644 --- a/application/models/Eqsl_images.php +++ b/application/models/Eqsl_images.php @@ -24,6 +24,13 @@ class Eqsl_images extends CI_Model { $this->db->insert('eQSL_images', $data); } + function eqsl_qso_list() { + $this->db->select('qso_id, COL_CALL, COL_MODE, , COL_SUBMODE, COL_TIME_ON, COL_BAND, COL_SAT_NAME, image_file'); + $this->db->join($this->config->item('table_name'), 'qso_id = COL_PRIMARY_KEY', 'left outer'); + $this->db->order_by('COL_TIME_ON', 'DESC'); + return $this->db->get('eQSL_images'); + } + } -?> \ No newline at end of file +?> diff --git a/application/views/eqslcard/index.php b/application/views/eqslcard/index.php new file mode 100644 index 000000000..979f4ee3f --- /dev/null +++ b/application/views/eqslcard/index.php @@ -0,0 +1,59 @@ +
+ +
+ +

lang->line('general_word_eqslcards'); ?>

+ + + + 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'); + } + + if (is_array($qslarray->result())) { + echo ' + + + + + + + + + + + '; + + foreach ($qslarray->result() as $qsl) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + + echo '
'.$this->lang->line('gen_hamradio_callsign').''.$this->lang->line('gen_hamradio_mode').''.$this->lang->line('general_word_date').''.$this->lang->line('general_word_time').''.$this->lang->line('gen_hamradio_band').''.$this->lang->line('gen_hamradio_qsl').'
' . $qsl->COL_CALL . ''; + echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; + echo ''; + $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); + echo ''; + $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); + echo ''; + if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; + echo '' . $qsl->image_file . '
'; + } + ?> + +
diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index ffb92314a..cfef54851 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -2123,7 +2123,7 @@ $(document).ready(function(){ -uri->segment(1) == "qsl") { +uri->segment(1) == "qsl" || $this->uri->segment(1) == "eqsl") { // Get Date format if($this->session->userdata('user_date_format')) { // If Logged in and session exists @@ -2244,6 +2244,31 @@ function deleteQsl(id) { }); } + + +
session->flashdata('message')) { ?> diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 4040c594b..58cb84821 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -58,6 +58,7 @@ function loadQSOTable(rows) { }); uninitialized.each(function() { + $.fn.dataTable.moment(custom_date_format + ' HH:mm'); $(this).DataTable({ searching: false, responsive: false, @@ -66,7 +67,6 @@ function loadQSOTable(rows) { "scrollCollapse": true, "paging": false, "scrollX": true, - "order": [ 1, 'desc' ], }); }); From c5c7e79955724ba9656ff18b4cd4d634057d2f5e Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sat, 27 May 2023 22:09:44 +0100 Subject: [PATCH 68/77] [LoTW] use Ajax for manual sync When you click the LoTW manual sync button it now loads the contents into the page using ajax get request using htmx. --- application/views/lotw_views/index.php | 6 +++++- assets/css/general.css | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/application/views/lotw_views/index.php b/application/views/lotw_views/index.php index 447a498d4..fcdca8628 100644 --- a/application/views/lotw_views/index.php +++ b/application/views/lotw_views/index.php @@ -122,7 +122,11 @@
-

+ + +
diff --git a/assets/css/general.css b/assets/css/general.css index 24536bfcc..344c7a04f 100644 --- a/assets/css/general.css +++ b/assets/css/general.css @@ -436,4 +436,8 @@ div#station_logbooks_linked_table_paginate { .w-qsl{ max-height: calc(100vh - 270px); overflow-y: auto; +} + +#lotw_manual_results { + padding-top: 10px; } \ No newline at end of file From 8354bf609ff21b17319e149895c77e9cd87bfff8 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sat, 27 May 2023 22:12:12 +0100 Subject: [PATCH 69/77] [LoTW] Makes the cert table fill the card box rather than have a border --- application/views/lotw_views/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/lotw_views/index.php b/application/views/lotw_views/index.php index fcdca8628..0ce0a3d5d 100644 --- a/application/views/lotw_views/index.php +++ b/application/views/lotw_views/index.php @@ -9,7 +9,7 @@ -
+