From 34c0a925f2746e37a702f11ab2bb1dca74e1cb04 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Thu, 29 Jun 2023 18:59:12 +0200 Subject: [PATCH 1/2] [Advanced Logbook] Added eQSL/LoTW filter and DXCC/CQ/IOTA lookup --- application/controllers/Logbookadvanced.php | 4 + application/models/Logbookadvanced_model.php | 18 +++++ application/views/logbookadvanced/index.php | 49 +++++++++++- assets/js/sections/common.js | 82 ++++++++++++-------- assets/js/sections/logbookadvanced.js | 6 +- 5 files changed, 124 insertions(+), 35 deletions(-) diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index b2ed5e60..736fc077 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -106,6 +106,10 @@ class Logbookadvanced extends CI_Controller { 'state' => xss_clean($this->input->post('state')), 'qsoresults' => xss_clean($this->input->post('qsoresults')), 'sats' => xss_clean($this->input->post('sats')), + 'lotwSent' => xss_clean($this->input->post('lotwSent')), + 'lotwReceived' => xss_clean($this->input->post('lotwReceived')), + 'eqslSent' => xss_clean($this->input->post('eqslSent')), + 'eqslReceived' => xss_clean($this->input->post('eqslReceived')), ); $qsos = []; diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 490450cf..d30f7b8a 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -56,6 +56,24 @@ class Logbookadvanced_model extends CI_Model { $binding[] = $searchCriteria['qslReceived']; } + if ($searchCriteria['lotwSent'] !== '') { + $conditions[] = "COL_LOTW_QSL_SENT = ?"; + $binding[] = $searchCriteria['lotwSent']; + } + if ($searchCriteria['lotwReceived'] !== '') { + $conditions[] = "COL_LOTW_QSL_RCVD = ?"; + $binding[] = $searchCriteria['lotwReceived']; + } + + if ($searchCriteria['eqslSent'] !== '') { + $conditions[] = "COL_EQSL_QSL_SENT = ?"; + $binding[] = $searchCriteria['eqslSent']; + } + if ($searchCriteria['eqslReceived'] !== '') { + $conditions[] = "COL_EQSL_QSL_RCVD = ?"; + $binding[] = $searchCriteria['eqslReceived']; + } + if ($searchCriteria['iota'] !== '') { $conditions[] = "COL_IOTA = ?"; $binding[] = $searchCriteria['iota']; diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index 45539220..671ba95c 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -144,7 +144,9 @@ -
+
+
+
- +
+ + +
+
+ + +
+
+ + +
+
+ + +
diff --git a/assets/js/sections/common.js b/assets/js/sections/common.js index ceb493e5..94d04727 100644 --- a/assets/js/sections/common.js +++ b/assets/js/sections/common.js @@ -358,7 +358,7 @@ function validateLocator(locator) { } // This displays the dialog with the form and it's where the resulttable is displayed -function spawnLookupModal() { +function spawnLookupModal(searchphrase, searchtype) { $.ajax({ url: base_url + 'index.php/lookup', type: 'post', @@ -372,38 +372,22 @@ function spawnLookupModal() { onshown: function(dialog) { $('#quicklookuptype').change(function(){ var type = $('#quicklookuptype').val(); - if (type == "dxcc") { - $('#quicklookupdxcc').show(); - $('#quicklookupiota').hide(); - $('#quicklookupcqz').hide(); - $('#quicklookupwas').hide(); - $('#quicklookuptext').hide(); - } else if (type == "iota") { - $('#quicklookupiota').show(); - $('#quicklookupdxcc').hide(); - $('#quicklookupcqz').hide(); - $('#quicklookupwas').hide(); - $('#quicklookuptext').hide(); - } else if (type == "vucc" || type == "sota" || type == "wwff") { - $('#quicklookuptext').show(); - $('#quicklookupiota').hide(); - $('#quicklookupdxcc').hide(); - $('#quicklookupcqz').hide(); - $('#quicklookupwas').hide(); - } else if (type == "cq") { - $('#quicklookupcqz').show(); - $('#quicklookupiota').hide(); - $('#quicklookupdxcc').hide(); - $('#quicklookupwas').hide(); - $('#quicklookuptext').hide(); - } else if (type == "was") { - $('#quicklookupwas').show(); - $('#quicklookupcqz').hide(); - $('#quicklookupiota').hide(); - $('#quicklookupdxcc').hide(); - $('#quicklookuptext').hide(); - } + changeLookupType(type); }); + if (searchtype !== undefined) { + $('#quicklookuptype').val(searchtype); + if (searchtype == 'dxcc') { + $("#quicklookupdxcc").val(searchphrase); + } else if (searchtype == 'iota') { + $("#quicklookupiota").val(searchphrase); + } else if (searchtype == 'cq') { + $("#quicklookupcqz").val(searchphrase); + } else { + $("#quicklookuptext").val(searchphrase); + } + changeLookupType(searchtype); + getLookupResult(this.form); + } }, buttons: [{ label: 'Close', @@ -416,6 +400,40 @@ function spawnLookupModal() { }); } +function changeLookupType(type) { + if (type == "dxcc") { + $('#quicklookupdxcc').show(); + $('#quicklookupiota').hide(); + $('#quicklookupcqz').hide(); + $('#quicklookupwas').hide(); + $('#quicklookuptext').hide(); + } else if (type == "iota") { + $('#quicklookupiota').show(); + $('#quicklookupdxcc').hide(); + $('#quicklookupcqz').hide(); + $('#quicklookupwas').hide(); + $('#quicklookuptext').hide(); + } else if (type == "vucc" || type == "sota" || type == "wwff") { + $('#quicklookuptext').show(); + $('#quicklookupiota').hide(); + $('#quicklookupdxcc').hide(); + $('#quicklookupcqz').hide(); + $('#quicklookupwas').hide(); + } else if (type == "cq") { + $('#quicklookupcqz').show(); + $('#quicklookupiota').hide(); + $('#quicklookupdxcc').hide(); + $('#quicklookupwas').hide(); + $('#quicklookuptext').hide(); + } else if (type == "was") { + $('#quicklookupwas').show(); + $('#quicklookupcqz').hide(); + $('#quicklookupiota').hide(); + $('#quicklookupdxcc').hide(); + $('#quicklookuptext').hide(); + } +} + // This function executes the call to the backend for fetching queryresult and displays the table in the dialog function getLookupResult() { $(".ld-ext-right").addClass('running'); diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index f447c8d2..85e7d2b9 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -187,7 +187,11 @@ $(document).ready(function () { gridsquare: this.gridsquare.value, state: this.state.value, qsoresults: this.qsoResults.value, - sats: this.sats.value + sats: this.sats.value, + lotwSent: this.lotwSent.value, + lotwReceived: this.lotwReceived.value, + eqslSent: this.eqslSent.value, + eqslReceived: this.eqslReceived.value, }, dataType: 'json', success: function (data) { From 5d4681696a8c5c1a203995ece12cdd9346deee62 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 30 Jun 2023 07:59:12 +0200 Subject: [PATCH 2/2] [Advanced Logbook] Added missing changes --- src/QSLManager/QSO.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/QSLManager/QSO.php b/src/QSLManager/QSO.php index 98a4a614..5d85a1be 100644 --- a/src/QSLManager/QSO.php +++ b/src/QSLManager/QSO.php @@ -188,9 +188,9 @@ class QSO $this->lotw = $this->getLotwString($data, $custom_date_format); $this->eqsl = $this->getEqslString($data, $custom_date_format); - $this->cqzone = ($data['COL_CQZ'] === null) ? '' : $data['COL_CQZ']; + $this->cqzone = ($data['COL_CQZ'] === null) ? '' : ''.$data['COL_CQZ'].''; $this->state = ($data['COL_STATE'] === null) ? '' :$data['COL_STATE']; - $this->dxcc = ($data['name'] === null) ? '- NONE -' : ucwords(strtolower($data['name']), "- (/"); + $this->dxcc = ($data['name'] === null) ? '- NONE -' : ''.ucwords(strtolower($data['name']), "- (/").''; $this->iota = ($data['COL_IOTA'] === null) ? '' : $this->getIotaLink($data['COL_IOTA']); if (array_key_exists('end', $data)) { $this->end = ($data['end'] === null) ? null : DateTime::createFromFormat("Y-m-d", $data['end'], new DateTimeZone('UTC')); @@ -961,7 +961,7 @@ class QSO private function getIotaLink($iota) : string { if ($iota !== '') { - return '' . $iota . ''; + return ''.$iota.' '; } return ''; }