mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Added backend for continent update
This commit is contained in:
@@ -801,4 +801,10 @@ class Logbookadvanced extends CI_Controller {
|
||||
header("Content-Type: application/json");
|
||||
print json_encode($q);
|
||||
}
|
||||
|
||||
public function fixContinent() {
|
||||
$this->load->model('logbookadvanced_model');
|
||||
$result = $this->logbookadvanced_model->check_missing_continent();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,17 +338,6 @@ class Update extends CI_Controller {
|
||||
$this->logbook_model->check_missing_dxcc_id($all);
|
||||
}
|
||||
|
||||
public function check_missing_continent() {
|
||||
$this->load->model('user_model');
|
||||
if (!$this->user_model->authorize(99)) {
|
||||
$this->session->set_flashdata('error', __("You're not allowed to do that!"));
|
||||
redirect('dashboard');
|
||||
}
|
||||
|
||||
$this->load->model('logbook_model');
|
||||
$this->logbook_model->check_missing_continent();
|
||||
}
|
||||
|
||||
public function check_missing_grid($all = false){
|
||||
$this->load->model('user_model');
|
||||
if (!$this->user_model->authorize(99)) {
|
||||
|
||||
@@ -5619,16 +5619,6 @@ class Logbook_model extends CI_Model {
|
||||
print("$count updated\n");
|
||||
}
|
||||
|
||||
public function check_missing_continent() {
|
||||
// get all records with no COL_CONT
|
||||
$this->db->trans_start();
|
||||
$sql = "UPDATE " . $this->config->item('table_name') . " JOIN dxcc_entities ON " . $this->config->item('table_name') . ".col_dxcc = dxcc_entities.adif SET col_cont = dxcc_entities.cont WHERE COALESCE(" . $this->config->item('table_name') . ".col_cont, '') = ''";
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
print($this->db->affected_rows() . " updated\n");
|
||||
$this->db->trans_complete();
|
||||
}
|
||||
|
||||
public function check_missing_grid_id($all) {
|
||||
// get all records with no COL_GRIDSQUARE
|
||||
$this->db->select("COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF");
|
||||
|
||||
@@ -1240,4 +1240,20 @@ class Logbookadvanced_model extends CI_Model {
|
||||
|
||||
$query = $this->db->query($sql, array(json_decode($ids, true), $this->session->userdata('user_id')));
|
||||
}
|
||||
|
||||
public function check_missing_continent() {
|
||||
// get all records with no COL_CONT
|
||||
$this->db->trans_start();
|
||||
$sql = "UPDATE " . $this->config->item('table_name') . "
|
||||
JOIN dxcc_entities ON " . $this->config->item('table_name') . ".col_dxcc = dxcc_entities.adif
|
||||
JOIN station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id
|
||||
SET col_cont = dxcc_entities.cont
|
||||
WHERE COALESCE(" . $this->config->item('table_name') . ".col_cont, '') = '' and station_profile.user_id = ?";
|
||||
|
||||
$query = $this->db->query($sql, array($this->session->userdata('user_id')));
|
||||
$result = $this->db->affected_rows();
|
||||
$this->db->trans_complete();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
let lang_gen_advanced_logbook_select_only_one_row_quickfilter = '<?= __("Only 1 row can be selected for Quickfilter!"); ?>';
|
||||
let lang_gen_advanced_logbook_select_at_least_one_row_quickfilter = '<?= __("You need to select a row to use the Quickfilters!"); ?>';
|
||||
let lang_gen_advanced_logbook_select_at_least_one_row_qslcard = '<?= __("You need to select a least 1 row to display a QSL card!"); ?>';
|
||||
let lang_gen_advanced_logbook_continents_updated = '<?= __("Continents updated successfully!"); ?>';
|
||||
let lang_gen_advanced_logbook_problem_fixing_continents = '<?= __("There was a problem fixing Continents."); ?>';
|
||||
let lang_gen_advanced_logbook_error = '<?= __("ERROR"); ?>';
|
||||
let lang_gen_advanced_logbook_success = '<?= __("SUCCESS"); ?>';
|
||||
let lang_gen_advanced_logbook_info = '<?= __("INFO"); ?>';
|
||||
@@ -38,6 +40,7 @@
|
||||
let lang_gen_advanced_logbook_qsl_card = '<?= __("QSL Card"); ?>';
|
||||
let lang_gen_advanced_logbook_close = '<?= __("Close"); ?>';
|
||||
let lang_gen_advanced_logbook_save = '<?= __("Save"); ?>';
|
||||
let lang_gen_advanced_logbook_update_now = '<?= __("Update now"); ?>';
|
||||
let lang_gen_advanced_logbook_options = '<?= __("'Options for the Advanced Logbook'"); ?>';
|
||||
let lang_gen_advanced_logbook_label_print_error = '<?= __("Something went wrong with label print. Go to labels and check if you have defined a label, and that it is set for print!"); ?>';
|
||||
let lang_gen_advanced_logbook_select_at_least_one_row = '<?= __("You need to select a least 1 row!"); ?>';
|
||||
|
||||
@@ -34,39 +34,24 @@
|
||||
and update existing metadata as well, in case it has changed."); ?>
|
||||
<br/><br/><b class="badge text-bg-danger"><?= __("WARNING"); ?></b>: <?= __("This affects ALL QSOs of ANY user on this instance. The function is deprectated and will be removed in a future version of Wavelog. As replacement use the Logbook-Advanced!"); ?>
|
||||
</p>
|
||||
<button class="btn btn-primary mb-3 ld-ext-right"
|
||||
<button class="btn btn-primary mb-3 ld-ext-right"
|
||||
hx-get="<?php echo site_url('update/check_missing_dxcc');?>"
|
||||
hx-target="#missing_dxcc_results"
|
||||
hx-target="#missing_dxcc_results"
|
||||
hx-on:htmx:before-request="this.disabled = true; this.classList.add('running');"
|
||||
hx-on:htmx:after-request="this.disabled = false; this.classList.remove('running'); document.getElementById('missing_dxcc_results').style.display = 'block';">
|
||||
<?= __("Check QSOs missing DXCC data"); ?>
|
||||
<div class="ld ld-ring ld-spin"></div>
|
||||
</button><br>
|
||||
<div id="missing_dxcc_results" class="alert alert-secondary mb-3 w-25 w-lg-100" style="display: none;"></div>
|
||||
<button class="btn btn-primary mb-3 ld-ext-right"
|
||||
hx-get="<?php echo site_url('update/check_missing_dxcc/all');?>"
|
||||
hx-target="#missing_dxcc_results_all"
|
||||
<button class="btn btn-primary mb-3 ld-ext-right"
|
||||
hx-get="<?php echo site_url('update/check_missing_dxcc/all');?>"
|
||||
hx-target="#missing_dxcc_results_all"
|
||||
hx-on:htmx:before-request="this.disabled = true; this.classList.add('running');"
|
||||
hx-on:htmx:after-request="this.disabled = false; this.classList.remove('running'); document.getElementById('missing_dxcc_results_all').style.display = 'block';">
|
||||
<?= __("Re-check all QSOs in logbook"); ?>
|
||||
<div class="ld ld-ring ld-spin"></div>
|
||||
</button>
|
||||
<div id="missing_dxcc_results_all" class="alert alert-secondary mb-3 w-25 w-lg-100" style="display: none;"></div>
|
||||
|
||||
<h5><?= __("Apply Continent Data to Logbook"); ?></h5>
|
||||
<p class="card-text">
|
||||
<?= __("This function can be used to update QSO continent information for all QSOs in Wavelog missing that information."); ?>
|
||||
<br/><br/><b class="badge text-bg-danger"><?= __("WARNING"); ?></b>: <?= __("This affects ALL QSOs of ANY user on this instance. The function is deprectated and will be removed in a future version of Wavelog. As replacement use the Logbook-Advanced!"); ?>
|
||||
</p>
|
||||
<button class="btn btn-primary mb-3 ld-ext-right"
|
||||
hx-get="<?php echo site_url('update/check_missing_continent');?>"
|
||||
hx-target="#continent_results"
|
||||
hx-on:htmx:before-request="this.disabled = true; this.classList.add('running');"
|
||||
hx-on:htmx:after-request="this.disabled = false; this.classList.remove('running'); document.getElementById('continent_results').style.display = 'block';">
|
||||
<?= __("Check QSOs missing continent data"); ?>
|
||||
<div class="ld ld-ring ld-spin"></div>
|
||||
</button>
|
||||
<div id="continent_results" class="alert alert-secondary mb-3 w-25 w-lg-100" style="display: none;"></div>
|
||||
<style>
|
||||
#dxcc_update_status{
|
||||
display: None;
|
||||
|
||||
@@ -1119,12 +1119,10 @@ $(document).ready(function () {
|
||||
message: html,
|
||||
buttons: [
|
||||
{
|
||||
label: 'Update now',
|
||||
label: lang_gen_advanced_logbook_update_now,
|
||||
cssClass: 'btn btn-sm btn-primary',
|
||||
id: 'closeButton',
|
||||
action: function (dialogItself) {
|
||||
$('#optionButton').prop("disabled", false);
|
||||
dialogItself.close();
|
||||
runContinentFix();
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1132,18 +1130,35 @@ $(document).ready(function () {
|
||||
cssClass: 'btn btn-sm btn-secondary',
|
||||
id: 'closeButton',
|
||||
action: function (dialogItself) {
|
||||
$('#optionButton').prop("disabled", false);
|
||||
dialogItself.close();
|
||||
}
|
||||
}],
|
||||
onhide: function(dialogRef){
|
||||
$('#optionButton').prop("disabled", false);
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function runContinentFix() {
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/logbookadvanced/fixContinent',
|
||||
type: 'POST',
|
||||
success: function (response) {
|
||||
BootstrapDialog.alert({
|
||||
title: lang_gen_advanced_logbook_success,
|
||||
message: lang_gen_advanced_logbook_continents_updated,
|
||||
type: BootstrapDialog.TYPE_SUCCESS
|
||||
});
|
||||
},
|
||||
error: function () {
|
||||
BootstrapDialog.alert({
|
||||
title: lang_gen_advanced_logbook_error,
|
||||
message: lang_gen_advanced_logbook_problem_fixing_continents,
|
||||
type: BootstrapDialog.TYPE_DANGER
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#fixItuZones').click(function (event) {
|
||||
const id_list = getSelectedIds();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user