Added an option to add callsign database URL for lookups on a map.

This commit is contained in:
Marat Fayzullin 2022-07-25 22:55:18 -04:00
parent 6192978f2f
commit 2ccdc90cc5
4 changed files with 24 additions and 2 deletions

View File

@ -37,6 +37,7 @@ $(function(){
var retention_time = 2 * 60 * 60 * 1000; var retention_time = 2 * 60 * 60 * 1000;
var strokeOpacity = 0.8; var strokeOpacity = 0.8;
var fillOpacity = 0.35; var fillOpacity = 0.35;
var callsign_url = null;
var colorKeys = {}; var colorKeys = {};
var colorScale = chroma.scale(['red', 'blue', 'green']).mode('hsl'); var colorScale = chroma.scale(['red', 'blue', 'green']).mode('hsl');
@ -286,6 +287,9 @@ $(function(){
if ('map_position_retention_time' in config) { if ('map_position_retention_time' in config) {
retention_time = config.map_position_retention_time * 1000; retention_time = config.map_position_retention_time * 1000;
} }
if ('callsign_url' in config) {
callsign_url = config['callsign_url'];
}
break; break;
case "update": case "update":
processUpdates(json.value); processUpdates(json.value);
@ -340,6 +344,15 @@ $(function(){
return infowindow; return infowindow;
} }
var linkifyCallsign = function(callsign) {
if ((callsign_url == null) || (callsign_url == ''))
return callsign;
else
return '<a href="#" onclick="window.open(' + "'" +
callsign_url.replaceAll('{}', callsign) +
"','callsign_info'" + ');">' + callsign + '</a>';
};
var infowindow; var infowindow;
var showLocatorInfoWindow = function(locator, pos) { var showLocatorInfoWindow = function(locator, pos) {
var infowindow = getInfoWindow(); var infowindow = getInfoWindow();
@ -357,7 +370,7 @@ $(function(){
'<ul>' + '<ul>' +
inLocator.map(function(i){ inLocator.map(function(i){
var timestring = moment(i.lastseen).fromNow(); var timestring = moment(i.lastseen).fromNow();
var message = i.callsign + ' (' + timestring + ' using ' + i.mode; var message = linkifyCallsign(i.callsign) + ' (' + timestring + ' using ' + i.mode;
if (i.band) message += ' on ' + i.band; if (i.band) message += ' on ' + i.band;
message += ')'; message += ')';
return '<li>' + message + '</li>' return '<li>' + message + '</li>'
@ -378,7 +391,7 @@ $(function(){
commentString = '<div>' + marker.comment + '</div>'; commentString = '<div>' + marker.comment + '</div>';
} }
infowindow.setContent( infowindow.setContent(
'<h3>' + callsign + '</h3>' + '<h3>' + linkifyCallsign(callsign) + '</h3>' +
'<div>' + timestring + ' using ' + marker.mode + ( marker.band ? ' on ' + marker.band : '' ) + '</div>' + '<div>' + timestring + ' using ' + marker.mode + ( marker.band ? ' on ' + marker.band : '' ) + '</div>' +
commentString commentString
); );

View File

@ -147,6 +147,7 @@ defaultConfig = PropertyLayer(
squelch_auto_margin=10, squelch_auto_margin=10,
google_maps_api_key="", google_maps_api_key="",
map_position_retention_time=2 * 60 * 60, map_position_retention_time=2 * 60 * 60,
callsign_url="https://www.qrzcq.com/call/{}",
decoding_queue_workers=2, decoding_queue_workers=2,
decoding_queue_length=10, decoding_queue_length=10,
wsjt_decoding_depth=3, wsjt_decoding_depth=3,

View File

@ -456,6 +456,7 @@ class MapConnection(OpenWebRxClient):
"google_maps_api_key", "google_maps_api_key",
"receiver_gps", "receiver_gps",
"map_position_retention_time", "map_position_retention_time",
"callsign_url",
"receiver_name", "receiver_name",
) )
filtered_config.wire(self.write_config) filtered_config.wire(self.write_config)

View File

@ -168,6 +168,13 @@ class GeneralSettingsController(SettingsFormController):
infotext="Specifies how log markers / grids will remain visible on the map", infotext="Specifies how log markers / grids will remain visible on the map",
append="s", append="s",
), ),
TextInput(
"callsign_url",
"Callsign database URL",
infotext="Specifies callsign lookup URL, such as QRZ.COM "
+ "or QRZCQ.COM. Place curly brackers ({}) where callsign "
+ "is supposed to be.",
),
), ),
] ]