mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
@@ -44,25 +44,26 @@ class Dxcluster extends CI_Controller {
|
||||
$calls_found = $this->dxcluster_model->dxc_spotlist($band, $age, $de, $mode);
|
||||
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(200);
|
||||
if ($calls_found && !empty($calls_found)) {
|
||||
http_response_code(200);
|
||||
echo json_encode($calls_found, JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
$this->_return_not_found();
|
||||
echo json_encode([], JSON_PRETTY_PRINT); // "error: not found" would be misleading here. No spots are not an error. Therefore we return an empty array
|
||||
}
|
||||
}
|
||||
|
||||
public function qrg_lookup($qrg) {
|
||||
$call_found = $this->dxcluster_model->dxc_qrg_lookup($this->security->xss_clean($qrg));
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(200);
|
||||
if ($call_found) {
|
||||
http_response_code(200);
|
||||
echo json_encode($call_found, JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
$this->_return_not_found();
|
||||
echo json_encode([], JSON_PRETTY_PRINT); // "error: not found" would be misleading here. No call is not an error, the call is just not in the spotlist. Therefore we return an empty array
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Is this used anywhere? If not, remove it!
|
||||
public function call($call) {
|
||||
$date = date('Y-m-d', time());
|
||||
$dxccobj = new Dxcc($date);
|
||||
@@ -70,17 +71,11 @@ class Dxcluster extends CI_Controller {
|
||||
$dxcc = $dxccobj->dxcc_lookup($call, $date);
|
||||
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(200);
|
||||
if ($dxcc) {
|
||||
http_response_code(200);
|
||||
echo json_encode($dxcc, JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
$this->_return_not_found();
|
||||
echo json_encode(['error' => 'not found'], JSON_PRETTY_PRINT);
|
||||
}
|
||||
}
|
||||
|
||||
private function _return_not_found() {
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(404);
|
||||
echo json_encode(['error' => 'not found'], JSON_PRETTY_PRINT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,9 @@ switch ($date_format) {
|
||||
var lang_qso_sat_lotw_support_not_found = "<?= __("Satellite not found"); ?>";
|
||||
var lang_qso_sat_lotw_supported = "<?= __("Supported by LoTW"); ?>";
|
||||
var lang_qso_sat_lotw_not_supported = "<?= __("Not supported by LoTW"); ?>";
|
||||
var lang_general_word_info = "<?= __("Info"); ?>";
|
||||
var lang_qso_you_already_filled_an_qso = "<?= __("You have already filled in a callsign. First finish this QSO before filling the last spot from DXcluster."); ?>";
|
||||
var lang_qso_no_spots_found = "<?= __("No spots found in this frequency.") ?>";
|
||||
</script>
|
||||
|
||||
<!--- DX Waterfall --->
|
||||
|
||||
@@ -281,13 +281,24 @@ $('#locator').on('input', function () {
|
||||
});
|
||||
|
||||
$("#check_cluster").on("click", function () {
|
||||
$.ajax({ url: dxcluster_provider + "/qrg_lookup/" + $("#frequency").val() / 1000, cache: false, dataType: "json" }).done(
|
||||
function (dxspot) {
|
||||
reset_fields();
|
||||
$("#callsign").val(dxspot.spotted);
|
||||
$("#callsign").trigger("blur");
|
||||
}
|
||||
);
|
||||
if ($("#callsign").val().trim() == '') {
|
||||
$.ajax({
|
||||
url: dxcluster_provider + "/qrg_lookup/" + $("#frequency").val() / 1000,
|
||||
cache: false,
|
||||
dataType: "json",
|
||||
success: function (dxspot) {
|
||||
if ((dxspot.spotted ?? '') != '') {
|
||||
reset_fields();
|
||||
$("#callsign").val(dxspot.spotted);
|
||||
$("#callsign").trigger("blur");
|
||||
} else {
|
||||
showToast(lang_general_word_info, lang_qso_no_spots_found, 'bg-info text-dark', 2000);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showToast(lang_general_word_info, lang_qso_you_already_filled_an_qso, 'bg-info text-dark', 2000);
|
||||
}
|
||||
});
|
||||
|
||||
function set_timers() {
|
||||
|
||||
Reference in New Issue
Block a user