Split up dxrefs into it's own columns

This commit is contained in:
Andreas Kristiansen
2024-05-22 19:16:33 +02:00
parent bd6a53f75d
commit d32f621e87
6 changed files with 145 additions and 68 deletions

View File

@@ -493,7 +493,6 @@ class Logbookadvanced extends CI_Controller {
$json_string['rsts']['show'] = $this->input->post('rsts');
$json_string['band']['show'] = $this->input->post('band');
$json_string['myrefs']['show'] = $this->input->post('myrefs');
$json_string['refs']['show'] = $this->input->post('refs');
$json_string['name']['show'] = $this->input->post('name');
$json_string['qslvia']['show'] = $this->input->post('qslvia');
$json_string['qsl']['show'] = $this->input->post('qsl');
@@ -510,6 +509,10 @@ class Logbookadvanced extends CI_Controller {
$json_string['comment']['show'] = $this->input->post('comment');
$json_string['propagation']['show'] = $this->input->post('propagation');
$json_string['contest']['show'] = $this->input->post('contest');
$json_string['gridsquare']['show'] = $this->input->post('gridsquare');
$json_string['sota']['show'] = $this->input->post('sota');
$json_string['dok']['show'] = $this->input->post('dok');
$json_string['sig']['show'] = $this->input->post('sig');
$obj['column_settings']= json_encode($json_string);

View File

@@ -22,7 +22,6 @@
\"rsts\":{\"show\":\"true\"},
\"band\":{\"show\":\"true\"},
\"myrefs\":{\"show\":\"true\"},
\"refs\":{\"show\":\"true\"},
\"name\":{\"show\":\"true\"},
\"qslvia\":{\"show\":\"true\"},
\"qsl\":{\"show\":\"true\"},
@@ -38,7 +37,12 @@
\"operator\":{\"show\":\"true\"},
\"comment\":{\"show\":\"true\"},
\"propagation\":{\"show\":\"true\"},
\"contest\":{\"show\":\"true\"}
\"contest\":{\"show\":\"true\"},
\"gridsquare\":{\"show\":\"true\"},
\"sota\":{\"show\":\"true\"},
\"dok\":{\"show\":\"true\"},
\"wwff\":{\"show\":\"true\"},
\"sig\":{\"show\":\"true\"}
}";
}
$current_opts = json_decode($options);
@@ -67,6 +71,26 @@
echo "\nvar o_template = { contest: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
if (!isset($current_opts->gridsquare)) {
echo "\nvar o_template = { gridsquare: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
if (!isset($current_opts->sota)) {
echo "\nvar o_template = { sota: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
if (!isset($current_opts->dok)) {
echo "\nvar o_template = { dok: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
if (!isset($current_opts->wwff)) {
echo "\nvar o_template = { wwff: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
if (!isset($current_opts->sig)) {
echo "\nvar o_template = { sig: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
foreach ($mapoptions as $mo) {
@@ -392,7 +416,7 @@ $options = json_decode($options);
<?php if (($options->state->show ?? "true") == "true") { ?>
<button type="button" class="btn btn-sm btn-primary me-1" id="searchState"><?php echo lang('filter_search_state'); ?></button><?php
} ?>
<?php if (($options->refs->show ?? "true") == "true") { ?>
<?php if (($options->gridsquare->show ?? "true") == "true") { ?>
<button type="button" class="btn btn-sm btn-primary me-1" id="searchGridsquare"><?php echo lang('filter_search_gridsquare'); ?></button><?php
} ?>
<?php if (($options->cqzone->show ?? "true") == "true") { ?>
@@ -410,13 +434,13 @@ $options = json_decode($options);
<?php if (($options->iota->show ?? "true") == "true") { ?>
<button type="button" class="btn btn-sm btn-primary me-1" id="searchIota"><?php echo lang('filter_search_iota'); ?></button><?php
} ?>
<?php if (($options->refs->show ?? "true") == "true") { ?>
<?php if (($options->sota->show ?? "true") == "true") { ?>
<button type="button" class="btn btn-sm btn-primary me-1" id="searchSota"><?php echo lang('filter_search_sota'); ?></button><?php
} ?>
<?php if (($options->refs->show ?? "true") == "true") { ?>
<?php if (($options->pota->show ?? "true") == "true") { ?>
<button type="button" class="btn btn-sm btn-primary me-1" id="searchPota"><?php echo lang('filter_search_pota'); ?></button><?php
} ?>
<?php if (($options->refs->show ?? "true") == "true") { ?>
<?php if (($options->wwff->show ?? "true") == "true") { ?>
<button type="button" class="btn btn-sm btn-primary me-1" id="searchWwff"><?php echo lang('filter_search_wwff'); ?></button><?php
} ?>
<?php if (($options->operator->show ?? "true") == "true") { ?>
@@ -501,9 +525,6 @@ $options = json_decode($options);
<?php if (($options->myrefs->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_myrefs') . '</th>';
} ?>
<?php if (($options->refs->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_refs') . '</th>';
} ?>
<?php if (($options->name->show ?? "true") == "true") {
echo '<th>' . lang('general_word_name') . '</th>';
} ?>
@@ -551,6 +572,21 @@ $options = json_decode($options);
} ?>
<?php if (($options->contest->show ?? "true") == "true") {
echo '<th>Contest</th>';
} ?>
<?php if (($options->gridsquare->show ?? "true") == "true") {
echo '<th>Gridsquare</th>';
} ?>
<?php if (($options->sota->show ?? "true") == "true") {
echo '<th>SOTA</th>';
} ?>
<?php if (($options->dok->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_dok') . '</th>';
} ?>
<?php if (($options->wwff->show ?? "true") == "true") {
echo '<th>WWFF</th>';
} ?>
<?php if (($options->sig->show ?? "true") == "true") {
echo '<th>SIG</th>';
} ?>
</tr>
</thead>

View File

@@ -50,10 +50,6 @@
<td><?php echo lang('gen_hamradio_myrefs'); ?></td>
<td><div class="form-check"><input class="form-check-input" name="myrefs" type="checkbox" <?php if (($options->myrefs->show ?? "true") == "true") { echo 'checked'; } ?>></div></td>
</tr>
<tr>
<td><?php echo lang('gen_hamradio_refs'); ?></td>
<td><div class="form-check"><input class="form-check-input" name="refs" type="checkbox" <?php if (($options->refs->show ?? "true") == "true") { echo 'checked'; } ?>></div></td>
</tr>
<tr>
<td><?php echo lang('general_word_name'); ?></td>
<td><div class="form-check"><input class="form-check-input" name="name" type="checkbox" <?php if (($options->name->show ?? "true") == "true") { echo 'checked'; } ?>></div></td>
@@ -122,6 +118,22 @@
<td>Contest</td>
<td><div class="form-check"><input class="form-check-input" name="contest" type="checkbox" <?php if (($options->contest->show ?? "true") == "true") { echo 'checked'; } ?>></div></td>
</tr>
<tr>
<td>Gridsquare</td>
<td><div class="form-check"><input class="form-check-input" name="gridsquare" type="checkbox" <?php if (($options->gridsquare->show ?? "true") == "true") { echo 'checked'; } ?>></div></td>
</tr>
<tr>
<td>DOK</td>
<td><div class="form-check"><input class="form-check-input" name="dok" type="checkbox" <?php if (($options->dok->show ?? "true") == "true") { echo 'checked'; } ?>></div></td>
</tr>
<tr>
<td>WWFF</td>
<td><div class="form-check"><input class="form-check-input" name="wwff" type="checkbox" <?php if (($options->wwff->show ?? "true") == "true") { echo 'checked'; } ?>></div></td>
</tr>
<tr>
<td>SIG</td>
<td><div class="form-check"><input class="form-check-input" name="sig" type="checkbox" <?php if (($options->sig->show ?? "true") == "true") { echo 'checked'; } ?>></div></td>
</tr>
</tbody>
</table>
</div>

View File

@@ -52,9 +52,6 @@ function updateRow(qso) {
if (user_options.myrefs.show == "true"){
cells.eq(c++).text(qso.deRefs);
}
if (user_options.refs.show == "true"){
cells.eq(c++).html(qso.dxRefs);
}
if (user_options.name.show == "true"){
cells.eq(c++).text(qso.name);
}
@@ -103,6 +100,21 @@ function updateRow(qso) {
if ( (user_options.contest) && (user_options.contest.show == "true")){
cells.eq(c++).html(qso.contest);
}
if ( (user_options.gridsquare) && (user_options.gridsquare.show == "true")){
cells.eq(c++).html(qso.gridsquare);
}
if ( (user_options.sota) && (user_options.sota.show == "true")){
cells.eq(c++).html(qso.sota);
}
if ( (user_options.dok) && (user_options.dok.show == "true")){
cells.eq(c++).html(qso.dok);
}
if ( (user_options.wwff) && (user_options.wwff.show == "true")){
cells.eq(c++).html(qso.wwff);
}
if ( (user_options.sig) && (user_options.sig.show == "true")){
cells.eq(c++).html(qso.sig);
}
$('[data-bs-toggle="tooltip"]').tooltip();
return row;
@@ -166,9 +178,6 @@ function loadQSOTable(rows) {
if (user_options.myrefs.show == "true"){
data.push(qso.deRefs);
}
if (user_options.refs.show == "true"){
data.push(qso.dxRefs);
}
if (user_options.name.show == "true"){
data.push(qso.name);
}
@@ -217,6 +226,21 @@ function loadQSOTable(rows) {
if (user_options.contest.show == "true"){
data.push(qso.contest);
}
if (user_options.gridsquare.show == "true"){
data.push(qso.gridsquare);
}
if (user_options.sota.show == "true"){
data.push(qso.sota);
}
if (user_options.dok.show == "true"){
data.push(qso.dok);
}
if (user_options.wwff.show == "true"){
data.push(qso.wwff);
}
if (user_options.sig.show == "true"){
data.push(qso.sig);
}
let createdRow = table.row.add(data).index();
table.rows(createdRow).nodes().to$().data('qsoID', qso.qsoID);
@@ -905,7 +929,6 @@ function saveOptions() {
rstr: $('input[name="rstr"]').is(':checked') ? true : false,
band: $('input[name="band"]').is(':checked') ? true : false,
myrefs: $('input[name="myrefs"]').is(':checked') ? true : false,
refs: $('input[name="refs"]').is(':checked') ? true : false,
name: $('input[name="name"]').is(':checked') ? true : false,
qslvia: $('input[name="qslvia"]').is(':checked') ? true : false,
qsl: $('input[name="qsl"]').is(':checked') ? true : false,
@@ -922,6 +945,11 @@ function saveOptions() {
comment: $('input[name="comment"]').is(':checked') ? true : false,
propagation: $('input[name="propagation"]').is(':checked') ? true : false,
contest: $('input[name="contest"]').is(':checked') ? true : false,
gridsquare: $('input[name="gridsquare"]').is(':checked') ? true : false,
sota: $('input[name="sota"]').is(':checked') ? true : false,
dok: $('input[name="dok"]').is(':checked') ? true : false,
wwff: $('input[name="wwff"]').is(':checked') ? true : false,
sig: $('input[name="sig"]').is(':checked') ? true : false,
gridsquare_layer: $('input[name="gridsquareoverlay"]').is(':checked') ? true : false,
path_lines: $('input[name="pathlines"]').is(':checked') ? true : false,
cqzone_layer: $('input[name="cqzones"]').is(':checked') ? true : false,

View File

@@ -327,6 +327,12 @@ function loadMap(data, iconsList) {
this.latlng1[1] = parseFloat(this.latlng1[1])+360;
}
if ((this.latlng1[1] - this.latlng2[1]) < -180) {
this.latlng2[1] = parseFloat(this.latlng2[1]) -360;
} else if ((this.latlng1[1] - this.latlng2[1]) > 180) {
this.latlng2[1] = parseFloat(this.latlng2[1]) +360;
}
var popupmessage = createContentMessage(this);
var popupmessage2 = createContentMessageDx(this);

View File

@@ -41,7 +41,6 @@ class QSO
/** @var string[] */
private string $deVUCCGridsquares;
private string $dxGridsquare;
private string $dxIOTA;
private string $dxSig;
private string $dxSigInfo;
private string $dxDARCDOK;
@@ -127,7 +126,6 @@ class QSO
'COL_COMMENT',
];
foreach ($requiredKeys as $requiredKey) {
if (!array_key_exists($requiredKey, $data)) {
throw new DomainException("Required key $requiredKey does not exist");
@@ -175,7 +173,6 @@ class QSO
$this->deVUCCGridsquares = $data['COL_MY_VUCC_GRIDS'] ?? '';
$this->dxGridsquare = $data['COL_GRIDSQUARE'] ?? '';
$this->dxIOTA = $data['COL_IOTA'] ?? '';
$this->dxSig = $data['COL_SIG'] ?? '';
$this->dxSigInfo = $data['COL_SIG_INFO'] ?? '';
$this->dxDARCDOK = $data['COL_DARC_DOK'] ?? '';
@@ -626,15 +623,13 @@ class QSO
*/
public function getDxGridsquare(): string
{
return $this->dxGridsquare;
}
/**
* @return string
*/
public function getDxIOTA(): string
{
return $this->dxIOTA;
$returnstring = '';
if ($this->dxVUCCGridsquares !== '') {
$returnstring = '<span id="dxgrid">' . $this->dxVUCCGridsquares . '</span> ' . $this->getQrbLink($this->deGridsquare, $this->dxVUCCGridsquares, $this->dxGridsquare);
} else if ($this->dxGridsquare !== '') {
$returnstring = '<span id="dxgrid">' . $this->dxGridsquare . '</span> ' . $this->getQrbLink($this->deGridsquare, $this->dxVUCCGridsquares, $this->dxGridsquare);
}
return $returnstring;
}
/**
@@ -653,14 +648,6 @@ class QSO
return $this->dxSigInfo;
}
/**
* @return string
*/
public function getDxDARCDOK(): string
{
return $this->dxDARCDOK;
}
/**
* @return string
*/
@@ -823,7 +810,6 @@ class QSO
'rstR' => $this->rstR,
'band' => $this->getFormattedBand(),
'deRefs' => $this->getFormattedDeRefs(),
'dxRefs' => $this->getFormattedDxRefs(),
'qslVia' => $this->QSLVia,
'qsl' => $this->getqsl(),
'lotw' => $this->getlotw(),
@@ -844,10 +830,30 @@ class QSO
'comment' => $this->comment,
'orbit' => $this->orbit,
'propagation' => $this->getPropagationMode(),
'contest' => $this->contest
'contest' => $this->contest,
'gridsquare' => $this->getDxGridsquare(),
'sota' => $this->getFormattedSotaLink(),
'dok' => $this->getFormattedDok(),
'wwff' => $this->getFormattedWwff(),
'sig' => $this->getFormattedSig()
];
}
private function getFormattedDok(): string
{
$dokstring = '';
if (preg_match('/^[A-Y]\d{2}$/', $this->dxDARCDOK)) {
$dokstring = '<a href="https://www.darc.de/' . $this->dxDARCDOK . '" target="_blank">' . $this->dxDARCDOK . '</a>';
} else if (preg_match('/^DV[ABCDEFGHIKLMNOPQRSTUVWXY]$/', $this->dxDARCDOK)) {
$dokstring = '<a href="https://www.darc.de/der-club/distrikte/' . strtolower(substr($this->dxDARCDOK, 2, 1)) . '" target="_blank">' . $this->dxDARCDOK . '</a>';
} else if (preg_match('/^Z\d{2}$/', $this->dxDARCDOK)) {
$dokstring = '<a href="https://' . $this->dxDARCDOK . 'vfdb.org" target="_blank">' . $this->dxDARCDOK . '</a>';
} else {
$dokstring = $this->dxDARCDOK;
}
return $dokstring;
}
private function getFormattedMode(): string
{
if ($this->submode !== '') {
@@ -909,34 +915,20 @@ class QSO
return trim(implode(" ", $refs));
}
private function getFormattedDxRefs(): string
private function getFormattedSotaLink() {
return '<span id="dxsota"><a href="https://summits.sota.org.uk/summit/' . $this->dxSOTAReference . '" target="_blank">' . $this->dxSOTAReference . '</a></span>';
}
private function getFormattedSig(): string
{
$includedInRefs=[];
$refs = [];
if ($this->dxVUCCGridsquares !== '') {
$refs[] = '<span id="dxgrid">' . $this->dxVUCCGridsquares . '</span> ' .$this->getQrbLink($this->deGridsquare, $this->dxVUCCGridsquares, $this->dxGridsquare);
} else if ($this->dxGridsquare !== '') {
$refs[] = '<span id="dxgrid">' . $this->dxGridsquare . '</span> ' .$this->getQrbLink($this->deGridsquare, $this->dxVUCCGridsquares, $this->dxGridsquare);
}
if ($this->dxSOTAReference !== '') {
$refs[] = "SOTA: " . '<span id="dxsota">' . $this->dxSOTAReference. '</span>';
}
if ($this->dxPOTAReference !== '') {
$refs[] = "POTA: " . '<span id="dxpota">' . $this->dxPOTAReference. '</span>';
}
if ($this->dxWWFFReference !== '') {
$includedInRefs[] = "WWFF";
$refs[] = "WWFF: " . '<span id="dxwwff">' . $this->dxWWFFReference. '</span>';
}
if ($this->dxSig !== '') {
if (!in_array($this->dxSig, $includedInRefs)) {
$refs[] = $this->dxSig . ":" . $this->dxSigInfo;
}
return $this->dxSig . ":" . $this->dxSigInfo;
}
if ($this->dxDARCDOK !== '') {
$refs[] = "DOK:" . $this->dxDARCDOK;
}
return implode(" ", $refs);
return '';
}
private function getFormattedWwff() {
return '<a href="https://www.cqgma.org/zinfo.php?ref=' . $this->dxWWFFReference . '" target="_blank"><span id="dxwwff">'. $this->dxWWFFReference . '</span></a>';
}
private function getFormattedQSLSent(): string