Merge pull request #1450 from phl0/qrzImage

Show profile pic of QSO partner upon logging
这个提交包含在:
Peter Goodhall 2022-04-05 16:42:46 +01:00 提交者 GitHub
当前提交 e173d202b9
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 13 个文件被更改,包括 143 次插入7 次删除

查看文件

@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to. | be upgraded / downgraded to.
| |
*/ */
$config['migration_version'] = 86; $config['migration_version'] = 87;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

查看文件

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

查看文件

@ -74,6 +74,7 @@ class User extends CI_Controller {
$data['user_column3'] = $this->input->post('user_column3'); $data['user_column3'] = $this->input->post('user_column3');
$data['user_column4'] = $this->input->post('user_column4'); $data['user_column4'] = $this->input->post('user_column4');
$data['user_column5'] = $this->input->post('user_column5'); $data['user_column5'] = $this->input->post('user_column5');
$data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image');
$this->load->view('user/add', $data); $this->load->view('user/add', $data);
} else { } else {
$this->load->view('user/add', $data); $this->load->view('user/add', $data);
@ -100,7 +101,8 @@ class User extends CI_Controller {
$this->input->post('user_column2'), $this->input->post('user_column2'),
$this->input->post('user_column3'), $this->input->post('user_column3'),
$this->input->post('user_column4'), $this->input->post('user_column4'),
$this->input->post('user_column5'))) { $this->input->post('user_column5'),
$this->input->post('user_show_qrz_image'))) {
// Check for errors // Check for errors
case EUSERNAMEEXISTS: case EUSERNAMEEXISTS:
$data['username_error'] = 'Username <b>'.$this->input->post('user_name').'</b> already in use!'; $data['username_error'] = 'Username <b>'.$this->input->post('user_name').'</b> already in use!';
@ -137,6 +139,7 @@ class User extends CI_Controller {
$data['user_column3'] = $this->input->post('user_column3'); $data['user_column3'] = $this->input->post('user_column3');
$data['user_column4'] = $this->input->post('user_column4'); $data['user_column4'] = $this->input->post('user_column4');
$data['user_column5'] = $this->input->post('user_column5'); $data['user_column5'] = $this->input->post('user_column5');
$data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image');
$this->load->view('user/add', $data); $this->load->view('user/add', $data);
$this->load->view('interface_assets/footer'); $this->load->view('interface_assets/footer');
} }
@ -308,6 +311,12 @@ class User extends CI_Controller {
$data['user_show_notes'] = $q->user_show_notes; $data['user_show_notes'] = $q->user_show_notes;
} }
if($this->input->post('user_show_qrz_image')) {
$data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image', false);
} else {
$data['user_show_qrz_image'] = $q->user_show_qrz_image;
}
if($this->input->post('user_column1')) { if($this->input->post('user_column1')) {
$data['user_column1'] = $this->input->post('user_column1', true); $data['user_column1'] = $this->input->post('user_column1', true);
} else { } else {
@ -387,6 +396,7 @@ class User extends CI_Controller {
$data['user_column4'] = $this->input->post('user_column4'); $data['user_column4'] = $this->input->post('user_column4');
$data['user_column4'] = $this->input->post('user_column4'); $data['user_column4'] = $this->input->post('user_column4');
$data['user_column5'] = $this->input->post('user_column5'); $data['user_column5'] = $this->input->post('user_column5');
$data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image');
$this->load->view('user/edit'); $this->load->view('user/edit');
$this->load->view('interface_assets/footer'); $this->load->view('interface_assets/footer');
} }
@ -599,4 +609,4 @@ class User extends CI_Controller {
redirect('user/login'); redirect('user/login');
} }
} }
} }

查看文件

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

查看文件

@ -6,6 +6,7 @@ defined('BASEPATH') OR exit('Direkter Zugriff auf Skripte ist nicht erlaubt');
$lang['qso_title_qso_map'] = 'QSO-Karte'; $lang['qso_title_qso_map'] = 'QSO-Karte';
$lang['qso_title_suggestions'] = 'Vorschläge'; $lang['qso_title_suggestions'] = 'Vorschläge';
$lang['qso_title_pervious_contacts'] = 'Vorherige Kontakte'; $lang['qso_title_pervious_contacts'] = 'Vorherige Kontakte';
$lang['qso_title_image'] = 'Profilbild von qrz.com';
// Input Help Text on the /QSO Display // Input Help Text on the /QSO Display
$lang['qso_transmit_power_helptext'] = 'Gib die Ausgangsleistung in Watt an. Erfasse nur Zahlen bei der Eingabe.'; $lang['qso_transmit_power_helptext'] = 'Gib die Ausgangsleistung in Watt an. Erfasse nur Zahlen bei der Eingabe.';

查看文件

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

查看文件

@ -0,0 +1,29 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Class Migration_create_eqsl_images_table
*
* Creates a boolean column with option to allow for activating showing of
* qrz.com profile picture in the log QSO section
*
*/
class Migration_add_qrz_image_option extends CI_Migration {
public function up()
{
if (!$this->db->field_exists('user_show_qrz_image', 'users')) {
$fields = array(
'user_show_qrz_image BOOLEAN DEFAULT FALSE',
);
$this->dbforge->add_column('users', $fields, 'user_column5');
}
}
public function down()
{
$this->dbforge->drop_column('users', 'user_show_qrz_image');
}
}

查看文件

@ -113,7 +113,7 @@ class User_Model extends CI_Model {
// Add a user // Add a user
function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone, function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone,
$measurement, $user_date_format, $user_stylesheet, $user_sota_lookup, $user_show_notes, $measurement, $user_date_format, $user_stylesheet, $user_sota_lookup, $user_show_notes,
$user_column1, $user_column2, $user_column3, $user_column4, $user_column5) { $user_column1, $user_column2, $user_column3, $user_column4, $user_column5, $user_show_qrz_image) {
// Check that the user isn't already used // Check that the user isn't already used
if(!$this->exists($username)) { if(!$this->exists($username)) {
$data = array( $data = array(
@ -136,6 +136,7 @@ class User_Model extends CI_Model {
'user_column3' => xss_clean($user_column3), 'user_column3' => xss_clean($user_column3),
'user_column4' => xss_clean($user_column4), 'user_column4' => xss_clean($user_column4),
'user_column5' => xss_clean($user_column5), 'user_column5' => xss_clean($user_column5),
'user_show_qrz_image' => xss_clean($user_show_qrz_image),
); );
// Check the password is valid // Check the password is valid
@ -184,6 +185,7 @@ class User_Model extends CI_Model {
'user_column3' => xss_clean($fields['user_column3']), 'user_column3' => xss_clean($fields['user_column3']),
'user_column4' => xss_clean($fields['user_column4']), 'user_column4' => xss_clean($fields['user_column4']),
'user_column5' => xss_clean($fields['user_column5']), 'user_column5' => xss_clean($fields['user_column5']),
'user_show_qrz_image' => xss_clean($fields['user_show_qrz_image']),
); );
// Check to see if the user is allowed to change user levels // Check to see if the user is allowed to change user levels
@ -293,6 +295,7 @@ class User_Model extends CI_Model {
'user_stylesheet' => $u->row()->user_stylesheet, 'user_stylesheet' => $u->row()->user_stylesheet,
'user_sota_lookup' => isset($u->row()->user_sota_lookup) ? $u->row()->user_sota_lookup : 0, 'user_sota_lookup' => isset($u->row()->user_sota_lookup) ? $u->row()->user_sota_lookup : 0,
'user_show_notes' => isset($u->row()->user_show_notes) ? $u->row()->user_show_notes : 1, 'user_show_notes' => isset($u->row()->user_show_notes) ? $u->row()->user_show_notes : 1,
'user_show_qrz_image' => isset($u->row()->user_show_qrz_image) ? $u->row()->user_show_qrz_image : 0,
'user_column1' => isset($u->row()->user_column1) ? $u->row()->user_column1: 'Mode', 'user_column1' => isset($u->row()->user_column1) ? $u->row()->user_column1: 'Mode',
'user_column2' => isset($u->row()->user_column2) ? $u->row()->user_column2: 'RSTS', 'user_column2' => isset($u->row()->user_column2) ? $u->row()->user_column2: 'RSTS',
'user_column3' => isset($u->row()->user_column3) ? $u->row()->user_column3: 'RSTR', 'user_column3' => isset($u->row()->user_column3) ? $u->row()->user_column3: 'RSTR',

查看文件

@ -521,6 +521,17 @@
<div class="card-body callsign-suggestions"></div> <div class="card-body callsign-suggestions"></div>
</div> </div>
<?php if ($this->session->userdata('user_show_qrz_image')) { ?>
<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>
<?php } ?>
<div class="card previous-qsos"> <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> <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>

查看文件

@ -227,6 +227,15 @@
</div> </div>
</div> </div>
<div class="form-group">
<label for="showqrzimages">Show profile picture of QSO partner from qrz.com profile in the log QSO section.</label>
<select class="custom-select" id="showqrzimages" name="user_show_qrz_image">
<option value="0"><?php echo $this->lang->line('general_word_no'); ?></option>
<option value="1"><?php echo $this->lang->line('general_word_yes'); ?></option>
</select>
<div class="small form-text text-muted">Please set your qrz.com credentials in the general config file.</div></td>
</div>
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" /> <input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
<button type="submit" class="btn btn-primary">Create Account</button> <button type="submit" class="btn btn-primary">Create Account</button>
</form> </form>

查看文件

@ -414,6 +414,29 @@
</div> </div>
</div> </div>
</div> </div>
<br>
<div class="row">
<!-- qrz.com Images -->
<div class="col-md">
<div class="card">
<div class="card-header">
qrz.com Images
</div>
<div class="card-body">
<div class="form-group">
<label for="showqrzimages">Show profile picture of QSO partner from qrz.com profile in the log QSO section.</label>
<select class="custom-select" id="showqrzimages" name="user_show_qrz_image">
<option value="1" <?php if ($user_show_qrz_image == 1) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_yes'); ?></option>
<option value="0" <?php if ($user_show_qrz_image == 0) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_no'); ?></option>
</select>
<div class="small form-text text-muted">Please set your qrz.com credentials in the general config file.</div></td>
</div>
</div>
</div>
</div>
</div>
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" /> <input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
<br> <br>

查看文件

@ -299,4 +299,25 @@ div#station_logbooks_linked_table_info {
div#station_logbooks_linked_table_paginate { div#station_logbooks_linked_table_paginate {
padding-right: 12px; padding-right: 12px;
padding-bottom: 12px; padding-bottom: 12px;
} }
/* qrz.com profile picture Styles */
.card-title {
margin-bottom: 0px;
}
.callsign-image {
margin-bottom: 10px;
}
.callsign-image-content {
display: block;
max-height: 300px;
text-align: center;
}
.callsign-image-pic {
max-height: 250px;
max-width: 100%;
}

查看文件

@ -279,6 +279,8 @@ function reset_fields() {
$('#callsign_info').removeClass("badge-secondary"); $('#callsign_info').removeClass("badge-secondary");
$('#callsign_info').removeClass("badge-success"); $('#callsign_info').removeClass("badge-success");
$('#callsign_info').removeClass("badge-danger"); $('#callsign_info').removeClass("badge-danger");
$('#callsign-image').attr('style', 'display: none;');
$('#callsign-image-content').text("");
$('#qsl_via').val(""); $('#qsl_via').val("");
$('#callsign_info').text(""); $('#callsign_info').text("");
$('#input_usa_state').val(""); $('#input_usa_state').val("");
@ -441,6 +443,12 @@ $("#callsign").focusout(function() {
$('#qth').val(result.callsign_qth); $('#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 * Update state with returned value
*/ */