Merge pull request #461 from AndreasK79/dxcc_choice

Added posibility to manually set dxcc and cq zone in qso entry window.
pull/473/head
Peter Goodhall 2020-04-22 15:24:03 +01:00 zatwierdzone przez GitHub
commit 4a0e8547a2
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 149 dodań i 52 usunięć

Wyświetl plik

@ -53,6 +53,15 @@ class Logbook extends CI_Controller {
}
function jsonentity($adif) {
$this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
$return['dxcc'] = $this->getentity($adif);
header('Content-Type: application/json');
echo json_encode($return, JSON_PRETTY_PRINT);
}
function json($callsign, $type, $band, $mode)
{
$this->load->model('user_model');
@ -547,6 +556,13 @@ class Logbook extends CI_Controller {
return $ans;
}
function getentity($adif) {
$this->load->model("logbook_model");
$entity = $this->logbook_model->get_entity($adif);
return $entity;
}
/* return station bearing */
function searchbearing($locator) {

Wyświetl plik

@ -23,6 +23,8 @@ class QSO extends CI_Controller {
$data['stations'] = $this->stations->all();
$data['radios'] = $this->cat->radios();
$data['query'] = $this->logbook_model->last_custom('5');
$data['dxcc'] = $this->logbook_model->fetchDxcc();
$data['iota'] = $this->logbook_model->fetchIota();
$this->load->library('form_validation');

Wyświetl plik

@ -62,7 +62,7 @@ class Logbook_model extends CI_Model {
}
} else {
$dxcc_id = $this->input->post('dxcc_id');
$dxcc_id = $this->input->post('dxcc_id');
}
// Create array with QSO Data
@ -1190,7 +1190,8 @@ class Logbook_model extends CI_Model {
if (isset($record['call'])){
if ($dxccAdif != NULL) {
if (isset($record['dxcc'])) {
$dxcc = array($record['dxcc'], $this->get_entity($record['dxcc']));
$entity = $this->get_entity($record['dxcc']);
$dxcc = array($record['dxcc'], $entity['name']);
} else {
$dxcc = NULL;
}
@ -1711,12 +1712,12 @@ class Logbook_model extends CI_Model {
}
public function get_entity($dxcc){
$sql = "select name from dxcc_entities where adif = " . $dxcc;
$sql = "select name, cqz, lat, `long` from dxcc_entities where adif = " . $dxcc;
$query = $this->db->query($sql);
if ($query->result() > 0){
$row = $query->row_array();
return $row['name'];
return $row;
}
return '';
}
@ -1816,6 +1817,24 @@ class Logbook_model extends CI_Model {
return 0;
}
function fetchDxcc() {
$sql = "select adif, prefix, name, date(end) Enddate, date(start) Startdate from dxcc_entities";
$sql .= ' order by prefix';
$query = $this->db->query($sql);
return $query->result();
}
function fetchIota() {
$sql = "select tag, name from iota";
$sql .= ' order by tag';
$query = $this->db->query($sql);
return $query->result();
}
}
@ -1826,4 +1845,6 @@ function validateADIFDate($date, $format = 'Ymd')
}
?>

Wyświetl plik

@ -414,6 +414,76 @@ $(document).on('keypress',function(e) {
}
});
$('#dxcc_id').on('change', function() {
$.getJSON('logbook/jsonentity/' + $(this).val(), function (result) {
if (result.dxcc.name != undefined) {
$('#country').val(convert_case(result.dxcc.name));
$('#cqz').val(convert_case(result.dxcc.cqz));
$('#callsign_info').removeClass("badge-secondary");
$('#callsign_info').removeClass("badge-success");
$('#callsign_info').removeClass("badge-danger");
$('#callsign_info').attr('title', '');
$('#callsign_info').text(convert_case(result.dxcc.name));
changebadge(result.dxcc.name);
// Set Map to Lat/Long it locator is not empty
if($('#locator').val() == "") {
markers.clearLayers();
var marker = L.marker([result.dxcc.lat, result.dxcc.long]);
mymap.panTo([result.dxcc.lat, result.dxcc.long], 8);
markers.addLayer(marker).addTo(mymap);
}
}
});
});
function changebadge(entityname) {
if($("#sat_name" ).val() != "") {
$.getJSON('logbook/jsonlookupdxcc/' + convert_case(entityname) + '/SAT/0/0', function(result)
{
$('#callsign_info').removeClass("badge-secondary");
$('#callsign_info').removeClass("badge-success");
$('#callsign_info').removeClass("badge-danger");
$('#callsign_info').attr('title', '');
if (result.workedBefore)
{
$('#callsign_info').addClass("badge-success");
$('#callsign_info').attr('title', 'DXCC was already worked in the past on this band and mode!');
}
else
{
$('#callsign_info').addClass("badge-danger");
$('#callsign_info').attr('title', 'New DXCC, not worked on this band and mode!');
}
})
} else {
$.getJSON('logbook/jsonlookupdxcc/' + convert_case(entityname) + '/0/' + $("#band").val() +'/' + $("#mode").val(), function(result)
{
// Reset CSS values before updating
$('#callsign_info').removeClass("badge-secondary");
$('#callsign_info').removeClass("badge-success");
$('#callsign_info').removeClass("badge-danger");
$('#callsign_info').attr('title', '');
if (result.workedBefore)
{
$('#callsign_info').addClass("badge-success");
$('#callsign_info').attr('title', 'DXCC was already worked in the past on this band and mode!');
}
else
{
$('#callsign_info').addClass("badge-danger");
$('#callsign_info').attr('title', 'New DXCC, not worked on this band and mode!');
}
})
}
}
$("#callsign").focusout(function() {
if ($(this).val().length >= 3) {
@ -478,51 +548,8 @@ $(document).on('keypress',function(e) {
}
})
}
if($("#sat_name" ).val() != "") {
//logbook/jsonlookupgrid/io77/SAT/0/0
$.getJSON('logbook/jsonlookupdxcc/' + convert_case(result.dxcc.entity) + '/SAT/0/0', function(result)
{
$('#callsign_info').removeClass("badge-secondary");
$('#callsign_info').removeClass("badge-success");
$('#callsign_info').removeClass("badge-danger");
$('#callsign_info').attr('title', '');
if (result.workedBefore)
{
$('#callsign_info').addClass("badge-success");
$('#callsign_info').attr('title', 'DXCC was already worked in the past on this band and mode!');
}
else
{
$('#callsign_info').addClass("badge-danger");
$('#callsign_info').attr('title', 'New DXCC, not worked on this band and mode!');
}
})
} else {
$.getJSON('logbook/jsonlookupdxcc/' + convert_case(result.dxcc.entity) + '/0/' + $("#band").val() +'/' + $("#mode").val(), function(result)
{
// Reset CSS values before updating
$('#callsign_info').removeClass("badge-secondary");
$('#callsign_info').removeClass("badge-success");
$('#callsign_info').removeClass("badge-danger");
$('#callsign_info').attr('title', '');
if (result.workedBefore)
{
$('#callsign_info').addClass("badge-success");
$('#callsign_info').attr('title', 'DXCC was already worked in the past on this band and mode!');
}
else
{
$('#callsign_info').addClass("badge-danger");
$('#callsign_info').attr('title', 'New DXCC, not worked on this band and mode!');
}
})
}
changebadge(result.dxcc.entity);
}
if(result.lotw_member == "active") {
@ -531,6 +558,7 @@ $(document).on('keypress',function(e) {
$('#dxcc_id').val(result.dxcc.adif);
$('#cqz').val(result.dxcc.cqz);
$('#ituz').val(result.dxcc.ituz);

Wyświetl plik

@ -6,8 +6,6 @@
<div class="card">
<form id="qso_input" method="post" action="<?php echo site_url('qso') . "?manual=" . $_GET['manual']; ?>" name="qsos">
<input type="hidden" id="dxcc_id" name="dxcc_id" value=""/>
<input type="hidden" id="cqz" name="cqz" value=""/>
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs pull-right" id="myTab" role="tablist">
@ -63,7 +61,6 @@
<small id="callsign_info" class="badge badge-secondary"></small> <small id="lotw_info" class="badge badge-light"></small>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="mode">Mode</label>
@ -155,6 +152,7 @@
<input type="text" class="form-control form-control-sm" name="comment" id="comment" value="">
</div>
</div>
</div>
<!-- Station Panel Data -->
@ -197,6 +195,29 @@
<!-- General Items -->
<div class="tab-pane fade" id="general" role="tabpanel" aria-labelledby="general-tab">
<div class="form-group">
<label for="dxcc_id">DXCC</label>
<select class="custom-select" id="dxcc_id" name="dxcc_id" required>
<?php
foreach($dxcc as $d){
echo '<option value=' . $d->adif . '>' . $d->prefix . ' - ' . $d->name . '</option>';
}
?>
</select>
</div>
<div class="form-group">
<label for="cqz">CQ Zone</label>
<select class="custom-select" id="cqz" name="cqz" required>
<?php
for ($i = 1; $i<=40; $i++) {
echo '<option value="'. $i . '">'. $i .'</option>';
}
?>
</select>
</div>
<div class="form-group">
<label for="selectPropagation">Propagation Mode</label>
<select class="custom-select" id="selectPropagation" name="prop_mode">
@ -281,7 +302,16 @@
<div class="form-group">
<label for="iota_ref">IOTA Reference</label>
<input class="form-control" id="iota_ref" type="text" name="iota_ref" value="" /> e.g: EU-005
<select class="custom-select" id="iota_ref" name="iota_ref">
<option value =""></option>
<?php
foreach($iota as $i){
echo '<option value=' . $i->tag . '>' . $i->tag . ' - ' . $i->name . '</option>';
}
?>
</select>
</div>
<div class="form-group">