mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
add trx number handling
This commit is contained in:
@@ -188,8 +188,11 @@ class Cabrillo extends CI_Controller {
|
||||
//get flag about the presence of the serial number
|
||||
$serial_number_present = ($this->input->post('serial_number_present', true) == 1);
|
||||
|
||||
//get flag about the presence of the trx number
|
||||
$trx_number_present = ($this->input->post('trx_number_present', true) == 1);
|
||||
|
||||
//parse the uploaded file
|
||||
$parsed_cbr = $this->cbr_parser->parse_from_file('./uploads/'.$data['upload_data']['file_name'], $serial_number_present);
|
||||
$parsed_cbr = $this->cbr_parser->parse_from_file('./uploads/'.$data['upload_data']['file_name'], $serial_number_present, $trx_number_present);
|
||||
|
||||
//return with error, reset upload filesize
|
||||
if(count($parsed_cbr["QSOS"]) < 1)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
class CBR_Parser
|
||||
{
|
||||
public function parse_from_file($filename, $serial_number_present = false) : array
|
||||
public function parse_from_file($filename, $serial_number_present = false, $trx_number_present = false) : array
|
||||
{
|
||||
//load file, call parser
|
||||
return $this->parse(mb_convert_encoding(file_get_contents($filename), "UTF-8"), $serial_number_present);
|
||||
return $this->parse(mb_convert_encoding(file_get_contents($filename), "UTF-8"), $serial_number_present, $trx_number_present);
|
||||
}
|
||||
|
||||
public function parse(string $input, $serial_number_present = false) : array
|
||||
public function parse(string $input, $serial_number_present = false, $trx_number_present = false) : array
|
||||
{
|
||||
//split the input into lines
|
||||
$lines = explode("\n", trim($input));
|
||||
@@ -35,6 +35,11 @@ class CBR_Parser
|
||||
$qso_mode = false;
|
||||
}
|
||||
|
||||
//if we encounter a QTC, skip that line
|
||||
if(strpos($line, 'QTC:') === 0){
|
||||
continue;
|
||||
}
|
||||
|
||||
//if we encounter "END-OF-LOG", stop processing lines
|
||||
if (strpos($line, 'END-OF-LOG') === 0) {
|
||||
break;
|
||||
@@ -171,7 +176,7 @@ class CBR_Parser
|
||||
//get all remaining received exchanges
|
||||
$exchange_nr = 1;
|
||||
$startindex = ($rcvd_59_pos + ($serial_number_present ? 2 : 1));
|
||||
$endindex = (count($line));
|
||||
$endindex = $trx_number_present ? (count($line)) -1 : (count($line));
|
||||
for ($i = $startindex; $i < $endindex; $i++) {
|
||||
$qso_line["RCVD_EXCH_" . $exchange_nr] = $line[$i];
|
||||
$exchange_nr++;
|
||||
@@ -292,7 +297,7 @@ class CBR_Parser
|
||||
$result["SENT_59_POS"] = $sent_59_pos;
|
||||
$result["RCVD_59_POS"] = $rcvd_59_pos;
|
||||
$result["SENT_EXCHANGE_COUNT"] = $rcvd_59_pos - $sent_59_pos - ($serial_number_present ? 3 : 2);
|
||||
$result["RCVD_EXCHANGE_COUNT"] = $max_qso_fields - 1 - $rcvd_59_pos - ($serial_number_present ? 1 : 0);
|
||||
$result["RCVD_EXCHANGE_COUNT"] = $max_qso_fields - 1 - $rcvd_59_pos - ($serial_number_present ? 1 : 0) - ($trx_number_present ? 1 : 0);
|
||||
|
||||
//return result
|
||||
return $result;
|
||||
|
||||
@@ -410,6 +410,10 @@
|
||||
echo '<option value="' . $contest['adifname'] . '">' . $contest['name'] . '</option>';
|
||||
} ?>
|
||||
</select>
|
||||
<div class="form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="trx_number_present" value="1" id="serial_number_present" unchecked>
|
||||
<label class="form-check-label" for="trx_number_present"><?= __("The CBR file contains a TRX number at the end of each line (for multi-op stations)") ?></label>
|
||||
</div>
|
||||
<div class="form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="serial_number_present" value="1" id="serial_number_present" unchecked>
|
||||
<label class="form-check-label" for="serial_number_present"><?= __("A serial number is ALWAYS part of the exchange for both parties in this contest.") ?></label>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<!-- Display imported information for contest data fixing if contest data was imported -->
|
||||
<?php if(count($imported_contests) > 0) {?>
|
||||
<div class="alert alert-dark" role="alert">
|
||||
<span class="badge text-bg-info"><?= __("Information"); ?></span> <i class="fas fa-list"></i> <b><?= __("Contest logs imported")?></b>
|
||||
<span class="badge text-bg-warning"><?= __("Information"); ?></span> <i class="fas fa-list"></i> <b><?= __("Contest logs imported")?></b>
|
||||
<p>
|
||||
<p><?= __("You imported at least 1 QSO containing a contest ID.")?> <?= __("Sometimes, depending on your contest logging software, your exchanges will not be imported properly from that softwares ADIF. If you like to correct that, switch to the CBR Import Tab of the ADIF Import page.")?></p>
|
||||
<p><?= __("We found the following numbers of QSOs for the following contest IDs:")?></p>
|
||||
|
||||
Reference in New Issue
Block a user