Pull image from qrz.com and display in QSO log window

This commit is contained in:
phl0 2022-04-03 10:28:36 +02:00
parent 8c84235698
commit d7a23d23a4
No known key found for this signature in database
GPG Key ID: 48EA1E640798CA9A
6 changed files with 57 additions and 2 deletions

View File

@ -126,11 +126,14 @@ class Logbook extends CI_Controller {
"bearing" => "",
"workedBefore" => false,
"lotw_member" => $lotw_member,
"image" => "",
];
$return['dxcc'] = $this->dxcheck($callsign);
$return['partial'] = $this->partial($callsign);
$callbook = $this->logbook_model->loadCallBook($callsign, $this->config->item('use_fullname'));
// Do we have local data for the Callsign?
if($this->logbook_model->call_name($callsign) != null)
{
@ -148,6 +151,15 @@ class Logbook extends CI_Controller {
$return['callsign_state'] = $this->logbook_model->call_state($callsign);
$return['bearing'] = $this->bearing($return['callsign_qra'], $measurement_base, $station_id);
$return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $type, $band, $mode);
if (isset($callbook)) {
if ($callbook['image'] == "") {
$return['image'] = "n/a";
} else {
$return['image'] = $callbook['image'];
}
} else {
$return['image'] = "n/a";
}
if ($return['callsign_qra'] != "") {
$return['latlng'] = $this->qralatlng($return['callsign_qra']);
@ -157,7 +169,7 @@ class Logbook extends CI_Controller {
return;
}
$callbook = $this->logbook_model->loadCallBook($callsign, $this->config->item('use_fullname'));
//$callbook = $this->logbook_model->loadCallBook($callsign, $this->config->item('use_fullname'));
if (isset($callbook))
{
@ -167,6 +179,11 @@ class Logbook extends CI_Controller {
$return['callsign_iota'] = $callbook['iota'];
$return['callsign_state'] = $callbook['state'];
$return['callsign_us_county'] = $callbook['us_county'];
if ($callbook['image'] == "") {
$return['image'] = "n/a";
} else {
$return['image'] = $callbook['image'];
}
if(isset($callbook['qslmgr'])) {
$return['qsl_manager'] = $callbook['qslmgr'];

View File

@ -6,6 +6,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
$lang['qso_title_qso_map'] = 'QSO Map';
$lang['qso_title_suggestions'] = 'Suggestions';
$lang['qso_title_pervious_contacts'] = 'Previous Contacts';
$lang['qso_title_image'] = 'Image';
// Input Help Text on the /QSO Display
$lang['qso_transmit_power_helptext'] = 'Give power value in Watts. Include only numbers in the input.';

View File

@ -88,6 +88,7 @@ class Qrz {
$data['long'] = (string)$xml->Callsign->lon;
$data['iota'] = (string)$xml->Callsign->iota;
$data['qslmgr'] = (string)$xml->Callsign->qslmgr;
$data['image'] = (string)$xml->Callsign->image;
if ($xml->Callsign->country == "United States") {
$data['state'] = (string)$xml->Callsign->state;

View File

@ -521,6 +521,15 @@
<div class="card-body callsign-suggestions"></div>
</div>
<div class="card callsign-image" id="callsign-image" style="display: none;">
<div class="card-header"><h4 style="font-size: 16px; font-weight: bold;" class="card-title"><?php echo $this->lang->line('qso_title_image'); ?></h4></div>
<div class="card-body callsign-image">
<div class="callsign-image-content" id="callsign-image-content">
</div>
</div>
</div>
<div class="card previous-qsos">
<div class="card-header"><h4 class="card-title" style="font-size: 16px; font-weight: bold;"><?php echo $this->lang->line('qso_title_pervious_contacts'); ?></h4></div>

View File

@ -145,6 +145,25 @@ TD.lotw{
margin-bottom: 0px;
}
.callsign-image .card-title {
margin-bottom: 0px;
}
.callsign-image {
margin-bottom: 10px;
margin-left: auto;
margin-right: auto;
}
.callsign-image-content {
display: block;
max-height: 300px;
}
.callsign-image-pic {
max-height: 250px;
}
.qso-map .card-title {
margin-bottom: 0px;
}
@ -255,4 +274,4 @@ color: #ffffff;
.modal-body {
max-height: calc(100vh - 200px);
overflow-y: auto;
}
}

View File

@ -279,6 +279,8 @@ function reset_fields() {
$('#callsign_info').removeClass("badge-secondary");
$('#callsign_info').removeClass("badge-success");
$('#callsign_info').removeClass("badge-danger");
$('#callsign-image').attr('style', 'display: none;');
$('#callsign-image-content').text("");
$('#qsl_via').val("");
$('#callsign_info').text("");
$('#input_usa_state').val("");
@ -441,6 +443,12 @@ $("#callsign").focusout(function() {
$('#qth').val(result.callsign_qth);
}
/* Find link to qrz.com picture */
if (result.image != "n/a") {
$('#callsign-image-content').html('<img class="callsign-image-pic" src="'+result.image+'">');
$('#callsign-image').attr('style', 'display: true;');
}
/*
* Update state with returned value
*/