mirror of
https://github.com/magicbug/Cloudlog
synced 2024-11-22 17:52:16 +00:00
added pota and iota, improved regex
This commit is contained in:
parent
485f4ba85c
commit
8272fbbc5a
@ -125,7 +125,7 @@
|
|||||||
<th><?php echo lang('gen_hamradio_rsts'); ?></th>
|
<th><?php echo lang('gen_hamradio_rsts'); ?></th>
|
||||||
<th><?php echo lang('gen_hamradio_rstr'); ?></th>
|
<th><?php echo lang('gen_hamradio_rstr'); ?></th>
|
||||||
<th><?php echo lang('gen_hamradio_operator'); ?></th>
|
<th><?php echo lang('gen_hamradio_operator'); ?></th>
|
||||||
<th>SOTA/WWFF</th>
|
<th>SOTA | IOTA | POTA | WWFF</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="qsoTableBody">
|
<tbody id="qsoTableBody">
|
||||||
|
@ -110,7 +110,7 @@ function handleInput() {
|
|||||||
qsotime = qsotime.slice(0, -2) + item;
|
qsotime = qsotime.slice(0, -2) + item;
|
||||||
} else if (
|
} else if (
|
||||||
item.match(
|
item.match(
|
||||||
/^([A-Z]*[F]{2}-\d{4})|([A-Z]*[A-Z]\/[A-Z]{2}-\d{3})$/i
|
/^[A-Z0-9]{1,3}\/[A-Z]{2}-\d{3}|[AENOS]*[FNSUACA]-\d{3}|(?!.*FF)[A-Z0-9]{1,3}-\d{4}|[A-Z0-9]{1,3}[F]{2}-\d{4}$/i
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
sotaWff = item.toUpperCase();
|
sotaWff = item.toUpperCase();
|
||||||
@ -407,98 +407,100 @@ for (const [key, value] of Object.entries(Bands)) {
|
|||||||
}
|
}
|
||||||
$(".js-band-settings").html(htmlSettings);
|
$(".js-band-settings").html(htmlSettings);
|
||||||
|
|
||||||
$(".js-download-adif").click(function () {
|
// This function is not in use anymore and probably outdated !!!!
|
||||||
var operator = $("#operator").val();
|
|
||||||
operator = operator.toUpperCase();
|
|
||||||
var ownCallsign = $("#station-call").val().toUpperCase();
|
|
||||||
ownCallsign = ownCallsign.toUpperCase();
|
|
||||||
var mySotaWwff = $("#my-sota-wwff").val().toUpperCase();
|
|
||||||
|
|
||||||
var myPower = $("#my-power").val();
|
// $(".js-download-adif").click(function () {
|
||||||
var myGrid = $("#my-grid").val().toUpperCase();
|
// var operator = $("#operator").val();
|
||||||
|
// operator = operator.toUpperCase();
|
||||||
|
// var ownCallsign = $("#station-call").val().toUpperCase();
|
||||||
|
// ownCallsign = ownCallsign.toUpperCase();
|
||||||
|
// var mySotaWwff = $("#my-sota-wwff").val().toUpperCase();
|
||||||
|
|
||||||
const adifHeader = `
|
// var myPower = $("#my-power").val();
|
||||||
ADIF export from Simple fast log entry by Petr, OK2CQR
|
// var myGrid = $("#my-grid").val().toUpperCase();
|
||||||
|
|
||||||
Internet: https://sfle.ok2cqr.com
|
// const adifHeader = `
|
||||||
|
// ADIF export from Simple fast log entry by Petr, OK2CQR
|
||||||
|
|
||||||
<ADIF_VER:5>2.2.1
|
// Internet: https://sfle.ok2cqr.com
|
||||||
<PROGRAMID:4>SFLE
|
|
||||||
<PROGRAMVERSION:5>0.0.1
|
|
||||||
<EOH>
|
|
||||||
|
|
||||||
`;
|
// <ADIF_VER:5>2.2.1
|
||||||
|
// <PROGRAMID:4>SFLE
|
||||||
|
// <PROGRAMVERSION:5>0.0.1
|
||||||
|
// <EOH>
|
||||||
|
|
||||||
if (false === isBandModeEntered()) {
|
// `;
|
||||||
alert("Some QSO do not have band and/or mode defined!");
|
|
||||||
|
|
||||||
return false;
|
// if (false === isBandModeEntered()) {
|
||||||
}
|
// alert("Some QSO do not have band and/or mode defined!");
|
||||||
|
|
||||||
var adif = adifHeader;
|
// return false;
|
||||||
qsoList.forEach((item) => {
|
// }
|
||||||
const qsodate = item[0].replace("-", "").replace("-", "");
|
|
||||||
qso = getAdifTag("QSO_DATE", qsodate);
|
|
||||||
qso = qso + getAdifTag("TIME_ON", item[1].replace(":", ""));
|
|
||||||
qso = qso + getAdifTag("CALL", item[2]);
|
|
||||||
qso = qso + getAdifTag("FREQ", item[3]);
|
|
||||||
qso = qso + getAdifTag("BAND", item[4]);
|
|
||||||
qso = qso + getAdifTag("MODE", item[5]);
|
|
||||||
|
|
||||||
var rst = item[6];
|
// var adif = adifHeader;
|
||||||
settingsMode = getSettingsMode(rst);
|
// qsoList.forEach((item) => {
|
||||||
if (settingsMode === "SSB") {
|
// const qsodate = item[0].replace("-", "").replace("-", "");
|
||||||
rst = "59";
|
// qso = getAdifTag("QSO_DATE", qsodate);
|
||||||
}
|
// qso = qso + getAdifTag("TIME_ON", item[1].replace(":", ""));
|
||||||
qso = qso + getAdifTag("RST_SENT", rst);
|
// qso = qso + getAdifTag("CALL", item[2]);
|
||||||
|
// qso = qso + getAdifTag("FREQ", item[3]);
|
||||||
|
// qso = qso + getAdifTag("BAND", item[4]);
|
||||||
|
// qso = qso + getAdifTag("MODE", item[5]);
|
||||||
|
|
||||||
var rst = item[7];
|
// var rst = item[6];
|
||||||
settingsMode = getSettingsMode(rst);
|
// settingsMode = getSettingsMode(rst);
|
||||||
if (settingsMode === "SSB") {
|
// if (settingsMode === "SSB") {
|
||||||
rst = "59";
|
// rst = "59";
|
||||||
}
|
// }
|
||||||
qso = qso + getAdifTag("RST_RCVD", rst);
|
// qso = qso + getAdifTag("RST_SENT", rst);
|
||||||
|
|
||||||
qso = qso + getAdifTag("OPERATOR", operator);
|
// var rst = item[7];
|
||||||
qso = qso + getAdifTag("STATION_CALLSIGN", ownCallsign);
|
// settingsMode = getSettingsMode(rst);
|
||||||
|
// if (settingsMode === "SSB") {
|
||||||
|
// rst = "59";
|
||||||
|
// }
|
||||||
|
// qso = qso + getAdifTag("RST_RCVD", rst);
|
||||||
|
|
||||||
if (isSOTA(mySotaWwff)) {
|
// qso = qso + getAdifTag("OPERATOR", operator);
|
||||||
qso = qso + getAdifTag("MY_SOTA_REF", mySotaWwff);
|
// qso = qso + getAdifTag("STATION_CALLSIGN", ownCallsign);
|
||||||
} else if (isWWFF(mySotaWwff)) {
|
|
||||||
qso = qso + getAdifTag("MY_SIG", "WWFF");
|
|
||||||
qso = qso + getAdifTag("MY_SIG_INFO", mySotaWwff);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isSOTA(item[8])) {
|
// if (isSOTA(mySotaWwff)) {
|
||||||
qso = qso + getAdifTag("SOTA_REF", item[8]);
|
// qso = qso + getAdifTag("MY_SOTA_REF", mySotaWwff);
|
||||||
} else if (isWWFF(item[8])) {
|
// } else if (isWWFF(mySotaWwff)) {
|
||||||
qso = qso + getAdifTag("SIG", "WWFF");
|
// qso = qso + getAdifTag("MY_SIG", "WWFF");
|
||||||
qso = qso + getAdifTag("SIG_INFO", item[8]);
|
// qso = qso + getAdifTag("MY_SIG_INFO", mySotaWwff);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (myPower) {
|
// if (isSOTA(item[8])) {
|
||||||
qso = qso + getAdifTag("TX_PWR", myPower);
|
// qso = qso + getAdifTag("SOTA_REF", item[8]);
|
||||||
}
|
// } else if (isWWFF(item[8])) {
|
||||||
|
// qso = qso + getAdifTag("SIG", "WWFF");
|
||||||
|
// qso = qso + getAdifTag("SIG_INFO", item[8]);
|
||||||
|
// }
|
||||||
|
|
||||||
if (myGrid) {
|
// if (myPower) {
|
||||||
qso = qso + getAdifTag("MY_GRIDSQUARE", myGrid);
|
// qso = qso + getAdifTag("TX_PWR", myPower);
|
||||||
}
|
// }
|
||||||
|
|
||||||
qso = qso + "<EOR>";
|
// if (myGrid) {
|
||||||
|
// qso = qso + getAdifTag("MY_GRIDSQUARE", myGrid);
|
||||||
|
// }
|
||||||
|
|
||||||
adif = adif + qso + "\n";
|
// qso = qso + "<EOR>";
|
||||||
});
|
|
||||||
|
|
||||||
qsodate = qsoList[0][0].replace("-", "").replace("-", "");
|
// adif = adif + qso + "\n";
|
||||||
const filename =
|
// });
|
||||||
operator.replace("/", "-") +
|
|
||||||
"_" +
|
// qsodate = qsoList[0][0].replace("-", "").replace("-", "");
|
||||||
mySotaWwff.replace("/", "-") +
|
// const filename =
|
||||||
"_" +
|
// operator.replace("/", "-") +
|
||||||
qsodate +
|
// "_" +
|
||||||
".adi";
|
// mySotaWwff.replace("/", "-") +
|
||||||
download(filename, adif);
|
// "_" +
|
||||||
});
|
// qsodate +
|
||||||
|
// ".adi";
|
||||||
|
// download(filename, adif);
|
||||||
|
// });
|
||||||
|
|
||||||
function isBandModeEntered() {
|
function isBandModeEntered() {
|
||||||
let isBandModeOK = true;
|
let isBandModeOK = true;
|
||||||
@ -547,15 +549,27 @@ function getReportByMode(rst, mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isSOTA(value) {
|
function isSOTA(value) {
|
||||||
if (value.match(/^[A-Z]*[A-Z]\/[A-Z]{2}-\d{3}$/)) {
|
if (value.match(/^[A-Z0-9]{1,3}\/[A-Z]{2}-\d{3}$/)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isIOTA(value) {
|
||||||
|
if (value.match(/^[AENOS]*[FNSUACA]-\d{3}$/)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isPOTA(value) {
|
||||||
|
if (value.match(/^(?!.*FF)[A-Z0-9]{1,3}-\d{4}$/)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function isWWFF(value) {
|
function isWWFF(value) {
|
||||||
if (value.match(/^[A-Z]*[F]{2}-\d{4}$/)) {
|
if (value.match(/^[A-Z0-9]{1,3}[F]{2}-\d{4}$/)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -672,13 +686,17 @@ $(".js-save-to-log").click(function () {
|
|||||||
var freq_display = item[3];
|
var freq_display = item[3];
|
||||||
var station_profile = $(".station_id").val();
|
var station_profile = $(".station_id").val();
|
||||||
var sota_ref = '';
|
var sota_ref = '';
|
||||||
var sig = '';
|
var iota_ref = '';
|
||||||
var sig_info = '';
|
var pota_ref = '';
|
||||||
|
var wwff_ref = '';
|
||||||
if (isSOTA(item[8])) {
|
if (isSOTA(item[8])) {
|
||||||
sota_ref = item[8];
|
sota_ref = item[8];
|
||||||
|
} else if (isIOTA(item[8])) {
|
||||||
|
iota_ref = item[8];
|
||||||
|
} else if (isPOTA(item[8])) {
|
||||||
|
pota_ref = item[8];
|
||||||
} else if (isWWFF(item[8])) {
|
} else if (isWWFF(item[8])) {
|
||||||
sig = "WWFF";
|
wwff_ref = item[8];
|
||||||
sig_info = item[8];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -695,8 +713,9 @@ $(".js-save-to-log").click(function () {
|
|||||||
start_time: start_time,
|
start_time: start_time,
|
||||||
station_profile: station_profile,
|
station_profile: station_profile,
|
||||||
sota_ref: sota_ref,
|
sota_ref: sota_ref,
|
||||||
sig: sig,
|
iota_ref: iota_ref,
|
||||||
sig_info: sig_info
|
pota_ref: pota_ref,
|
||||||
|
wwff_ref: wwff_ref,
|
||||||
},
|
},
|
||||||
success: function (result) {},
|
success: function (result) {},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user