Initial CNTY support for non-US countries as in ADIF v3.1.5

This commit is contained in:
Alexey Khromov
2025-05-17 00:37:14 +03:00
parent 8c2478dc69
commit d05a7d2dd0
3 changed files with 73 additions and 17 deletions

View File

@@ -114,11 +114,28 @@ class Stations extends CI_Model {
$state = xss_clean($this->input->post('station_state', true));
}
// Check if DXCC is USA, Alaska or Hawaii. If not true, we clear the County field due to complex adif specs
if (($this->input->post('dxcc') == 291 || $this->input->post('dxcc') == 006 || $this->input->post('dxcc') == 110) && $this->input->post('station_cnty') !="") {
$county = xss_clean($this->input->post('station_cnty', true));
} else {
$county = '';
// Check if DXCC is USA, Alaska or Hawaii, RU, UR, and others with subareas.
// If not true, we clear the County field due to complex adif specs
switch ($this->input->post('dxcc')) {
case 6:
case 110:
case 291:
case 15:
case 54:
case 61:
case 126:
case 151:
case 288:
case 339:
case 170:
case 21:
case 29:
case 32:
case 281:
$county = xss_clean($this->input->post('station_cnty', true));
break;
default:
$county = '';
}
// Create data array with field values
@@ -179,11 +196,28 @@ class Stations extends CI_Model {
$state = xss_clean($this->input->post('station_state', true));
}
// Check if DXCC is USA, Alaska or Hawaii. If not true, we clear the County field due to complex adif specs
if (($this->input->post('dxcc') == 291 || $this->input->post('dxcc') == 006 || $this->input->post('dxcc') == 110) && $this->input->post('station_cnty') !="") {
$county = xss_clean($this->input->post('station_cnty', true));
} else {
$county = '';
// Check if DXCC is USA, Alaska or Hawaii, RU, UR, and others with subareas.
// If not true, we clear the County field due to complex adif specs
switch ($this->input->post('dxcc')) {
case 6:
case 110:
case 291:
case 15:
case 54:
case 61:
case 126:
case 151:
case 288:
case 339:
case 170:
case 21:
case 29:
case 32:
case 281:
$county = xss_clean($this->input->post('station_cnty', true));
break;
default:
$county = '';
}
$data = array(

View File

@@ -138,7 +138,7 @@ if ($dxcc_list->result() > 0) {
<!-- US County -->
<div class="mb-3" id="location_us_county">
<label for="stationCntyInput"><?= __("Station County"); ?></label>
<label for="stationCntyInputEdit"><?= __("Station County"); ?></label>
<input type="text" class="form-control" name="station_cnty" id="stationCntyInputEdit" aria-describedby="stationCntyInputHelp" value="<?php if(set_value('station_cnty') != "") { echo set_value('station_cnty'); } else { echo $my_station_profile->station_cnty; } ?>">
<small id="stationCntyInputHelp" class="form-text text-muted"><?= __("Station County (Only used for USA/Alaska/Hawaii)."); ?></small>
</div>

View File

@@ -623,12 +623,34 @@ async function updateStateDropdown(dxcc_field, state_label, county_div, county_i
});
}
if (selectedDxcc.val() == '291' || selectedDxcc.val() == '110' || selectedDxcc.val() == '6') {
$(county_div).show();
} else {
$(county_div).hide();
$(county_input).val();
}
switch (selectedDxcc.val()) {
case '6':
case '110':
case '291':
$(county_div).find('.form-control').hide();
$(county_div).find('.selectize-control').show();
$(county_div).show();
break;
case '15':
case '54':
case '61':
case '126':
case '151':
case '288':
case '339':
case '170':
case '21':
case '29':
case '32':
case '281':
$(county_div).find('.form-control').show();
$(county_div).find('.selectize-control').hide();
$(county_div).show();
break;
default:
$(county_div).hide();
$(county_input).val();
}
}
function spawnQrbCalculator(locator1, locator2) {