From 462664f7bf841778852672e5b773faa8cdb24025 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 8 Dec 2025 16:23:53 +0100 Subject: [PATCH] Use html view to load result instead --- application/controllers/Logbookadvanced.php | 9 +- .../views/logbookadvanced/checkresult.php | 89 ++++++++++--------- .../logbookadvanced/statecheckresult.php | 45 ++++++++++ assets/js/sections/logbookadvanced.js | 53 ++++------- 4 files changed, 110 insertions(+), 86 deletions(-) create mode 100644 application/views/logbookadvanced/statecheckresult.php diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index a32553769..88d748a8e 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -899,13 +899,12 @@ class Logbookadvanced extends CI_Controller { $type = $this->input->post('type', true); $this->load->model('logbookadvanced_model'); + $data['result'] = $this->logbookadvanced_model->runCheckDb($type); if ($type == 'checkstate') { - $data['result'] = $this->logbookadvanced_model->runCheckDb($type); - $this->load->view('logbookadvanced/checkresult', $data); + $this->load->view('logbookadvanced/statecheckresult', $data); } else { - $result = $this->logbookadvanced_model->runCheckDb($type); - header("Content-Type: application/json"); - echo json_encode($result); + $data['type'] = $type; + $this->load->view('logbookadvanced/checkresult', $data); } } diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index 512bcfb4f..f105fe2dd 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -1,45 +1,46 @@ - 0): ?> -
-
-

+ - - - - - - - - - - - $item): ?> - dxcc_name) ? $item->dxcc_name : ''; - $formattedName = ucwords(strtolower($rawName), "- (/"); - $name = htmlspecialchars($formattedName, ENT_QUOTES, 'UTF-8'); - $qsos = isset($item->count) ? intval($item->count) : 0; - ?> - - - - - - - - -
prefix; ?> - - -
-
- - -
-
-

-
- +function check_missing_distance($result) { ?> +
Distance Check Results
+ QSOs to update found: count; ?> + +
Continent Check Results
+ QSOs to update found: count; ?> + +
DXCC Check Results
+ QSOs to update found: count; ?> + +
CQ Zone Check Results
+ QSOs to update found: count; ?> + +
ITU Zone Check Results
+ QSOs to update found: count; ?> + 0): ?> +
+
+

+ +
+ + + + + + + + + + + $item): ?> + dxcc_name) ? $item->dxcc_name : ''; + $formattedName = ucwords(strtolower($rawName), "- (/"); + $name = htmlspecialchars($formattedName, ENT_QUOTES, 'UTF-8'); + $qsos = isset($item->count) ? intval($item->count) : 0; + ?> + + + + + + + + +
prefix; ?> + + +
+
+
+ +
+
+

+
+ diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 89632ee81..f83c8c29d 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -2032,7 +2032,6 @@ function saveOptions() { $('#checkUpdateDistancesBtn').prop("disabled", true).addClass("running"); $('#closeButton').prop("disabled", true); - $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { @@ -2042,23 +2041,20 @@ function saveOptions() { success: function(response) { $('#checkUpdateDistancesBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop("disabled", false); - // Create a nice display for the results - let resultHtml = '
Distance Check Results
'; - resultHtml += '

QSO to update found: ' + (response[0].count) + '

'; - $('.result').html(resultHtml); + $('.result').html(response); }, error: function(xhr, status, error) { - $('#checkUpdateDistancesBtn').prop('disabled', false).text(''); + $('#checkUpdateDistancesBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop('disabled', false); - let errorMsg = ''; + let errorMsg = 'Error checking distance information'; if (xhr.responseJSON && xhr.responseJSON.message) { errorMsg += ': ' + xhr.responseJSON.message; } BootstrapDialog.alert({ - title: '', + title: 'Error', message: errorMsg, type: BootstrapDialog.TYPE_DANGER }); @@ -2070,7 +2066,6 @@ function saveOptions() { $('#checkMissingDxccsBtn').prop("disabled", true).addClass("running"); $('#closeButton').prop("disabled", true); - $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { @@ -2080,23 +2075,19 @@ function saveOptions() { success: function(response) { $('#checkMissingDxccsBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop("disabled", false); - // Create a nice display for the results - let resultHtml = '
DXCC Check Results
'; - resultHtml += '

QSOs without DXCC information found: ' + (response[0].count) + '

'; - - $('.result').html(resultHtml); + $('.result').html(response); }, error: function(xhr, status, error) { $('#checkMissingDxccsBtn').prop('disabled', false).text(''); $('#closeButton').prop('disabled', false); - let errorMsg = ''; + let errorMsg = 'Error checking DXCC information'; if (xhr.responseJSON && xhr.responseJSON.message) { errorMsg += ': ' + xhr.responseJSON.message; } BootstrapDialog.alert({ - title: '', + title: 'Error', message: errorMsg, type: BootstrapDialog.TYPE_DANGER }); @@ -2117,23 +2108,19 @@ function saveOptions() { success: function(response) { $('#checkFixContinentBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop("disabled", false); - // Create a nice display for the results - let resultHtml = '
Continent Check Results
'; - resultHtml += '

QSOs with missing or invalid continent information found: ' + (response[0].count) + '

'; - - $('.result').html(resultHtml); + $('.result').html(response); }, error: function(xhr, status, error) { $('#checkFixContinentBtn').prop('disabled', false).text(''); $('#closeButton').prop('disabled', false); - let errorMsg = ''; + let errorMsg = 'Error checking continent information'; if (xhr.responseJSON && xhr.responseJSON.message) { errorMsg += ': ' + xhr.responseJSON.message; } BootstrapDialog.alert({ - title: '', + title: 'Error', message: errorMsg, type: BootstrapDialog.TYPE_DANGER }); @@ -2161,13 +2148,13 @@ function saveOptions() { $('#checkFixStateBtn').prop('disabled', false).text(''); $('#closeButton').prop('disabled', false); - let errorMsg = ''; + let errorMsg = 'Error checking state information'; if (xhr.responseJSON && xhr.responseJSON.message) { errorMsg += ': ' + xhr.responseJSON.message; } BootstrapDialog.alert({ - title: '', + title: 'Error', message: errorMsg, type: BootstrapDialog.TYPE_DANGER }); @@ -2188,11 +2175,7 @@ function saveOptions() { success: function(response) { $('#checkFixCqZonesBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop("disabled", false); - // Create a nice display for the results - let resultHtml = '
CQ Zone Check Results
'; - resultHtml += '

QSOs with missing CQ zone information found: ' + (response[0].count) + '

'; - - $('.result').html(resultHtml); + $('.result').html(response); }, error: function(xhr, status, error) { $('#checkFixCqZonesBtn').prop('disabled', false).text(''); @@ -2204,7 +2187,7 @@ function saveOptions() { } BootstrapDialog.alert({ - title: '', + title: 'Error', message: errorMsg, type: BootstrapDialog.TYPE_DANGER }); @@ -2225,11 +2208,7 @@ function saveOptions() { success: function(response) { $('#checkFixItuZonesBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop("disabled", false); - // Create a nice display for the results - let resultHtml = '
ITU Zone Check Results
'; - resultHtml += '

QSOs with missing ITU zone information found: ' + (response[0].count) + '

'; - - $('.result').html(resultHtml); + $('.result').html(response); }, error: function(xhr, status, error) { $('#checkFixItuZonesBtn').prop('disabled', false).text(''); @@ -2241,7 +2220,7 @@ function saveOptions() { } BootstrapDialog.alert({ - title: '', + title: 'Error', message: errorMsg, type: BootstrapDialog.TYPE_DANGER });