Show all HoN-Entries if there are multiple ones in src-file

This commit is contained in:
int2001
2026-02-19 06:13:03 +00:00
parent 50fefc860d
commit f1d3fa0183
4 changed files with 17 additions and 24 deletions

View File

@@ -184,9 +184,9 @@ class Lookup extends CI_Controller {
$uppercase_callsign = strtoupper($call);
$this->load->model('Pota');
$query = $this->Pota->ham_of_note($uppercase_callsign);
if ($query->row()) {
if ($query->num_rows() > 0) {
header('Content-Type: application/json');
echo json_encode($query->row());
echo json_encode($query->result());
} else {
return null;
}

View File

@@ -27,7 +27,6 @@ class Pota extends CI_Model {
function ham_of_note($callsign) {
$this->db->where('callsign', $callsign);
$this->db->order_by('description asc');
$this->db->limit(1);
return $this->db->get('hams_of_note');
}

View File

@@ -220,7 +220,7 @@ if (typeof window.DX_WATERFALL_FIELD_MAP === 'undefined') {
<div style="min-height: 24px;">
<small id="callsign_info" class="badge text-bg-secondary"></small> <a id="lotw_link"><small id="lotw_info" class="badge text-bg-success"></small></a>
</div>
<p id="ham_of_note_line" style="margin-top: 5px; display: none"><small id="ham_of_note_info"></small><small><a id="ham_of_note_link" target="_blank"></a></small></p>
<div id="ham_of_note_line" style="margin-top: 5px; display: none"></div>
</div>
</div>

View File

@@ -1272,10 +1272,7 @@ function reset_fields() {
$('#continent').val("");
$('#email').val("");
$('#region').val("");
$('#ham_of_note_info').text("");
$('#ham_of_note_link').html("");
$('#ham_of_note_link').removeAttr('href');
$('#ham_of_note_line').hide();
$('#ham_of_note_line').empty().hide();
$('#lotw_info').text("");
$('#lotw_info').attr('data-bs-original-title', "");
$('#lotw_info').removeClass("lotw_info_red");
@@ -1506,10 +1503,7 @@ $("#callsign").on("focusout", function () {
$('#callsign').removeClass("confirmedGrid");
$('#callsign').removeClass("newGrid");
$('#callsign').attr('title', '');
$('#ham_of_note_info').text("");
$('#ham_of_note_link').html("");
$('#ham_of_note_link').removeAttr('href');
$('#ham_of_note_line').hide();
$('#ham_of_note_line').empty().hide();
if (result.confirmed) {
$('#callsign').addClass("confirmedGrid");
@@ -1530,10 +1524,7 @@ $("#callsign").on("focusout", function () {
$('#callsign').removeClass("workedGrid");
$('#callsign').removeClass("newGrid");
$('#callsign').attr('title', '');
$('#ham_of_note_info').text("");
$('#ham_of_note_link').html("");
$('#ham_of_note_link').removeAttr('href');
$('#ham_of_note_line').hide();
$('#ham_of_note_line').empty().hide();
if (result.confirmed) {
$('#callsign').addClass("confirmedGrid");
@@ -1600,15 +1591,18 @@ $("#callsign").on("focusout", function () {
}
$.getJSON(base_url + 'index.php/lookup/ham_of_note/' + $('#callsign').val().toUpperCase().replaceAll('Ø', '0').replaceAll('/','-'), function (result) {
if (result) {
$('#ham_of_note_info').html('<span class="minimize">'+result.description+'</span>');
if (result.link != null) {
$('#ham_of_note_link').html(" "+result.linkname);
$('#ham_of_note_link').attr('href', result.link);
}
$('#ham_of_note_line').show("slow");
if (result && result.length > 0) {
var html = '';
$.each(result, function(i, entry) {
var linkHtml = '';
if (entry.link != null) {
linkHtml = ' <a href="' + entry.link + '" target="_blank">' + entry.linkname + '</a>';
}
html += '<p class="mb-1"><small><span class="minimize">' + entry.description + '</span>' + linkHtml + '</small></p>';
});
$('#ham_of_note_line').html(html).show("slow");
var minimized_elements = $('span.minimize');
var minimized_elements = $('#ham_of_note_line span.minimize');
var maxlen = 50;
minimized_elements.each(function(){