From 613d17642c1757a6b4d1a76fb730fbd5eea4cab0 Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 26 Oct 2023 09:10:38 +0000 Subject: [PATCH 1/3] Added "Via" as option for labels --- application/controllers/Labels.php | 33 ++++++++++++++---------- application/views/labels/startatform.php | 6 +++++ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/application/controllers/Labels.php b/application/controllers/Labels.php index 008ec762..cf0b966c 100644 --- a/application/controllers/Labels.php +++ b/application/controllers/Labels.php @@ -134,28 +134,30 @@ class Labels extends CI_Controller { $ids = xss_clean(json_decode($this->input->post('id'))); $offset = xss_clean($this->input->post('startat')); $grid = $this->input->post('grid') === "true" ? 1 : 0; + $via = $this->input->post('via') === "true" ? 1 : 0; $this->load->model('labels_model'); $result = $this->labels_model->export_printrequestedids($ids); - $this->prepareLabel($result, true, $offset, $grid); + $this->prepareLabel($result, true, $offset, $grid, $via); } public function print($station_id) { $clean_id = xss_clean($station_id); $offset = xss_clean($this->input->post('startat')); $grid = xss_clean($this->input->post('grid') ?? 0); + $via = xss_clean($this->input->post('via') ?? 0); $this->load->model('stations'); if ($this->stations->check_station_is_accessible($station_id)) { $this->load->model('labels_model'); $result = $this->labels_model->export_printrequested($clean_id); - $this->prepareLabel($result, false, $offset, $grid); + $this->prepareLabel($result, false, $offset, $grid, $via); } else { redirect('labels'); } } - function prepareLabel($qsos, $jscall = false, $offset = 1, $grid = false) { + function prepareLabel($qsos, $jscall = false, $offset = 1, $grid = false, $via = false) { $this->load->model('labels_model'); $label = $this->labels_model->getDefaultLabel(); @@ -231,9 +233,9 @@ class Labels extends CI_Controller { if ($qsos->num_rows() > 0) { if ($label->qsos == 1) { - $this->makeMultiQsoLabel($qsos->result(), $pdf, 1, $offset, $ptype->orientation, $grid); + $this->makeMultiQsoLabel($qsos->result(), $pdf, 1, $offset, $ptype->orientation, $grid, $via); } else { - $this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos, $offset, $ptype->orientation, $grid); + $this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos, $offset, $ptype->orientation, $grid, $via); } } else { $this->session->set_flashdata('message', '0 QSOs found for print!'); @@ -242,7 +244,7 @@ class Labels extends CI_Controller { $pdf->Output(); } - function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $grid) { + function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $grid, $via) { $text = ''; $current_callsign = ''; $current_sat = ''; @@ -259,7 +261,7 @@ class Labels extends CI_Controller { ( ($qso->COL_BAND_RX !== $current_sat_bandrx) && ($this->pretty_sat_mode($qso->COL_SAT_MODE) !== '')) ) { // ((($qso->COL_SAT_NAME ?? '' !== $current_sat) || ($qso->COL_CALL !== $current_callsign)) && ($qso->COL_SAT_NAME ?? '' !== '') && ($col->COL_BAND_RX ?? '' !== $current_sat_bandrx))) { if (!empty($qso_data)) { - $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid); + $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via); $qso_data = []; } $current_callsign = $qso->COL_CALL; @@ -274,6 +276,7 @@ class Labels extends CI_Controller { 'mode' => $qso->COL_MODE, 'rst' => $qso->COL_RST_SENT, 'mygrid' => $qso->station_gridsquare, + 'via' => $qso->COL_QSL_VIA, 'sat' => $qso->COL_SAT_NAME, 'sat_mode' => $this->pretty_sat_mode($qso->COL_SAT_MODE ?? ''), 'sat_band_rx' => ($qso->COL_BAND_RX ?? ''), @@ -282,7 +285,7 @@ class Labels extends CI_Controller { ]; } if (!empty($qso_data)) { - $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid); + $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via); } } // New begin @@ -290,7 +293,7 @@ class Labels extends CI_Controller { return(strlen($sat_mode ?? '') == 2 ? (strtoupper($sat_mode[0]).'/'.strtoupper($sat_mode[1])) : strtoupper($sat_mode ?? '')); } - function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label,$orientation, $grid) { + function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label,$orientation, $grid, $via) { $tableData = []; $count_qso = 0; @@ -310,7 +313,7 @@ class Labels extends CI_Controller { if($count_qso == $qso_per_label){ - $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid); + $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via); $tableData = []; // reset the data $count_qso = 0; // reset the counter } @@ -318,16 +321,20 @@ class Labels extends CI_Controller { } // generate label for remaining QSOs if($count_qso > 0){ - $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid); + $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via); $preliminaryData = []; // reset the data } } - function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso,$orientation,$grid=true){ + function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso,$orientation,$grid=true, $via=false){ $builder = new \AsciiTable\Builder(); $builder->addRows($tableData); $text = "Confirming QSO".($numofqsos>1 ? 's' : '')." with "; - $text .= $current_callsign."\n"; + $text .= $current_callsign; + if (($via) && ($qso['via'] ?? '' != '')) { + $text.=' via '.substr($qso['via'],0,8); + } + $text .= "\n"; $text .= $builder->renderTable(); if($qso['sat'] != "") { if (($qso['sat_mode'] == '') && ($qso['sat_band_rx'] !== '')) { diff --git a/application/views/labels/startatform.php b/application/views/labels/startatform.php index a9de4d26..8bcf78ce 100644 --- a/application/views/labels/startatform.php +++ b/application/views/labels/startatform.php @@ -5,6 +5,12 @@ +
+ +
+ +
+
From 8e6c4733d96431c09fa9fbd000658da2901857f3 Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 26 Oct 2023 09:37:25 +0000 Subject: [PATCH 2/3] Added "QSL via" also to LBA --- application/controllers/Labels.php | 2 +- application/language/bulgarian/filter_lang.php | 1 + application/language/chinese_simplified/filter_lang.php | 1 + application/language/czech/filter_lang.php | 1 + application/language/dutch/filter_lang.php | 1 + application/language/english/filter_lang.php | 1 + application/language/finnish/filter_lang.php | 1 + application/language/french/filter_lang.php | 1 + application/language/german/filter_lang.php | 1 + application/language/greek/filter_lang.php | 1 + application/language/italian/filter_lang.php | 1 + application/language/polish/filter_lang.php | 1 + application/language/russian/filter_lang.php | 1 + application/language/spanish/filter_lang.php | 1 + application/language/swedish/filter_lang.php | 1 + application/language/turkish/filter_lang.php | 1 + application/views/logbookadvanced/startatform.php | 6 ++++++ assets/js/sections/logbookadvanced.js | 2 +- 18 files changed, 23 insertions(+), 2 deletions(-) diff --git a/application/controllers/Labels.php b/application/controllers/Labels.php index cf0b966c..76a514f3 100644 --- a/application/controllers/Labels.php +++ b/application/controllers/Labels.php @@ -332,7 +332,7 @@ class Labels extends CI_Controller { $text = "Confirming QSO".($numofqsos>1 ? 's' : '')." with "; $text .= $current_callsign; if (($via) && ($qso['via'] ?? '' != '')) { - $text.=' via '.substr($qso['via'],0,8); + $text.=' | send via '.substr($qso['via'],0,8); } $text .= "\n"; $text .= $builder->renderTable(); diff --git a/application/language/bulgarian/filter_lang.php b/application/language/bulgarian/filter_lang.php index 58fce8eb..b34f9a4f 100644 --- a/application/language/bulgarian/filter_lang.php +++ b/application/language/bulgarian/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/language/chinese_simplified/filter_lang.php b/application/language/chinese_simplified/filter_lang.php index 58fce8eb..b34f9a4f 100644 --- a/application/language/chinese_simplified/filter_lang.php +++ b/application/language/chinese_simplified/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/language/czech/filter_lang.php b/application/language/czech/filter_lang.php index 58fce8eb..b34f9a4f 100644 --- a/application/language/czech/filter_lang.php +++ b/application/language/czech/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/language/dutch/filter_lang.php b/application/language/dutch/filter_lang.php index 58fce8eb..b34f9a4f 100644 --- a/application/language/dutch/filter_lang.php +++ b/application/language/dutch/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/language/english/filter_lang.php b/application/language/english/filter_lang.php index 73574aa2..280429bd 100644 --- a/application/language/english/filter_lang.php +++ b/application/language/english/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/language/finnish/filter_lang.php b/application/language/finnish/filter_lang.php index 58fce8eb..b34f9a4f 100644 --- a/application/language/finnish/filter_lang.php +++ b/application/language/finnish/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/language/french/filter_lang.php b/application/language/french/filter_lang.php index 0f5c24a8..648e0419 100644 --- a/application/language/french/filter_lang.php +++ b/application/language/french/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/language/german/filter_lang.php b/application/language/german/filter_lang.php index bf614584..02aff861 100644 --- a/application/language/german/filter_lang.php +++ b/application/language/german/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Erhalten (Elektronisch)'; $lang['filter_actions_create_adif'] = 'Erstelle ADIF'; $lang['filter_actions_print_label'] = 'Label drucken'; $lang['filter_actions_start_print_title'] = 'Label Drucken'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Mit Planquadrat?'; $lang['filter_actions_start_print'] = 'Druck starten bei?'; $lang['filter_actions_print'] = 'Drucken'; diff --git a/application/language/greek/filter_lang.php b/application/language/greek/filter_lang.php index 58fce8eb..b34f9a4f 100644 --- a/application/language/greek/filter_lang.php +++ b/application/language/greek/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/language/italian/filter_lang.php b/application/language/italian/filter_lang.php index 58fce8eb..b34f9a4f 100644 --- a/application/language/italian/filter_lang.php +++ b/application/language/italian/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/language/polish/filter_lang.php b/application/language/polish/filter_lang.php index 58fce8eb..b34f9a4f 100644 --- a/application/language/polish/filter_lang.php +++ b/application/language/polish/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/language/russian/filter_lang.php b/application/language/russian/filter_lang.php index 58fce8eb..b34f9a4f 100644 --- a/application/language/russian/filter_lang.php +++ b/application/language/russian/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/language/spanish/filter_lang.php b/application/language/spanish/filter_lang.php index 58fce8eb..b34f9a4f 100644 --- a/application/language/spanish/filter_lang.php +++ b/application/language/spanish/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/language/swedish/filter_lang.php b/application/language/swedish/filter_lang.php index 58fce8eb..b34f9a4f 100644 --- a/application/language/swedish/filter_lang.php +++ b/application/language/swedish/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/language/turkish/filter_lang.php b/application/language/turkish/filter_lang.php index 58fce8eb..b34f9a4f 100644 --- a/application/language/turkish/filter_lang.php +++ b/application/language/turkish/filter_lang.php @@ -115,6 +115,7 @@ $lang['filter_actions_recv_electronic'] = 'Received (Electronic)'; $lang['filter_actions_create_adif'] = 'Create ADIF'; $lang['filter_actions_print_label'] = 'Print Label'; $lang['filter_actions_start_print_title'] = 'Print Labels'; +$lang['filter_actions_print_include_via'] = "Include Via"; $lang['filter_actions_print_include_grid'] = 'Include Grid?'; $lang['filter_actions_start_print'] = 'Start printing at?'; $lang['filter_actions_print'] = 'Print'; diff --git a/application/views/logbookadvanced/startatform.php b/application/views/logbookadvanced/startatform.php index f5672d79..463f00cc 100644 --- a/application/views/logbookadvanced/startatform.php +++ b/application/views/logbookadvanced/startatform.php @@ -5,6 +5,12 @@
+
+ +
+ +
+
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 1200ccbb..dd9f9f07 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -774,7 +774,7 @@ function printlabel() { data: {'id': JSON.stringify(id_list, null, 2), 'startat': $('#startat').val(), 'grid': $('#gridlabel')[0].checked, - + 'via': $('#via')[0].checked, }, xhr:function(){ var xhr = new XMLHttpRequest(); From 0e46192055dee6981e979eeff5b142c24b01eb5b Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 26 Oct 2023 11:29:58 +0000 Subject: [PATCH 3/3] Changed printed text to "via [via]" from " | send via [via]" --- application/controllers/Labels.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/Labels.php b/application/controllers/Labels.php index 76a514f3..cf0b966c 100644 --- a/application/controllers/Labels.php +++ b/application/controllers/Labels.php @@ -332,7 +332,7 @@ class Labels extends CI_Controller { $text = "Confirming QSO".($numofqsos>1 ? 's' : '')." with "; $text .= $current_callsign; if (($via) && ($qso['via'] ?? '' != '')) { - $text.=' | send via '.substr($qso['via'],0,8); + $text.=' via '.substr($qso['via'],0,8); } $text .= "\n"; $text .= $builder->renderTable();