mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
@@ -1,66 +0,0 @@
|
||||
<script>
|
||||
var dxcluster_provider="<?php echo base_url(); ?>index.php/dxcluster";
|
||||
var dxcluster_maxage=<?php echo $this->optionslib->get_option('dxcluster_maxage') ?? 60; ?>;
|
||||
var cat_timeout_interval="<?php echo $this->optionslib->get_option('cat_timeout_interval'); ?>";
|
||||
</script>
|
||||
|
||||
|
||||
<div class="container">
|
||||
<br>
|
||||
<center><button type="button" class="btn" id="menutoggle"><i class="fa fa-arrow-up" id="menutoggle_i"></i></button></center>
|
||||
<h2 id="dxtitle"><?php echo $page_title; ?></h2>
|
||||
<div class="tabs" id="dxtabs">
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="index"><?= __("BandMap"); ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="list"><?= __("BandList"); ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div class="messages my-1 me-2"></div>
|
||||
<div class="d-flex align-items-center">
|
||||
<label class="my-1 me-2" for="radio"><?= __("Radio"); ?></label>
|
||||
<select class="form-select form-select-sm radios my-1 me-sm-2 w-auto" id="radio" name="radio">
|
||||
<option value="0" selected="selected"><?= __("None"); ?></option>
|
||||
<?php foreach ($radios->result() as $row) { ?>
|
||||
<option value="<?php echo $row->id; ?>" <?php if($this->session->userdata('radio') == $row->id) { echo "selected=\"selected\""; } ?>><?php echo $row->radio; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
|
||||
<label class="my-1 me-2" for="decontSelect"><?= __("Spots de"); ?></label>
|
||||
<select class="form-select form-select-sm my-1 me-sm-2 w-auto" id="decontSelect" name="dxcluster_decont" aria-describedby="dxcluster_decontHelp" required>
|
||||
<option value="Any">*</option>
|
||||
<option value="AF"<?php if ($this->optionslib->get_option('dxcluster_decont') == 'AF') { echo " selected"; } ?>><?= __("Africa"); ?></option>
|
||||
<option value="AN"<?php if ($this->optionslib->get_option('dxcluster_decont') == 'AN') { echo " selected"; } ?>><?= __("Antarctica"); ?></option>
|
||||
<option value="AS"<?php if ($this->optionslib->get_option('dxcluster_decont') == 'AS') { echo " selected"; } ?>><?= __("Asia"); ?></option>
|
||||
<option value="EU"<?php if ($this->optionslib->get_option('dxcluster_decont') == 'EU') { echo " selected"; } ?>><?= __("Europe"); ?></option>
|
||||
<option value="NA"<?php if ($this->optionslib->get_option('dxcluster_decont') == 'NA') { echo " selected"; } ?>><?= __("North America"); ?></option>
|
||||
<option value="OC"<?php if ($this->optionslib->get_option('dxcluster_decont') == 'OC') { echo " selected"; } ?>><?= __("Oceania"); ?></option>
|
||||
<option value="SA"<?php if ($this->optionslib->get_option('dxcluster_decont') == 'SA') { echo " selected"; } ?>><?= __("South America"); ?></option>
|
||||
</select>
|
||||
|
||||
<label class="my-1 me-2" for="band"><?= __("Band"); ?></label>
|
||||
<select id="band" class="form-select form-select-sm my-1 me-sm-2 w-auto" name="band">
|
||||
<?php foreach($bands as $key=>$bandgroup) {
|
||||
echo '<optgroup label="' . strtoupper($key) . '">';
|
||||
foreach($bandgroup as $band) {
|
||||
echo '<option value="' . $band . '"';
|
||||
if ($band == "20m") echo ' selected';
|
||||
echo '>' . $band . '</option>'."\n";
|
||||
}
|
||||
echo '</optgroup>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<figure class="highcharts-figure">
|
||||
<div id="bandmap"></div>
|
||||
<p class="highcharts-description">
|
||||
</p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
@@ -50,17 +50,6 @@
|
||||
|
||||
<h2 id="dxtitle"><?php echo $page_title; ?></h2>
|
||||
|
||||
<div id="dxtabs" class="tabs">
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="index"><?= __("BandMap"); ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="list"><?= __("BandList"); ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div class="messages my-1 me-2"></div>
|
||||
<div class="d-flex align-items-center">
|
||||
|
||||
@@ -1,254 +0,0 @@
|
||||
$(function() {
|
||||
(function(H) {
|
||||
H.seriesTypes.timeline.prototype.distributeDL = function() {
|
||||
var series = this,
|
||||
dataLabelsOptions = series.options.dataLabels,
|
||||
options,
|
||||
pointDLOptions,
|
||||
newOptions = {},
|
||||
visibilityIndex = 1,
|
||||
j = 2,
|
||||
distance;
|
||||
|
||||
series.points.forEach(function(point, i) {
|
||||
distance = dataLabelsOptions.distance;
|
||||
|
||||
if (point.visible && !point.isNull) {
|
||||
options = point.options;
|
||||
pointDLOptions = point.options.dataLabels;
|
||||
|
||||
if (!series.hasRendered) {
|
||||
point.userDLOptions = H.merge({}, pointDLOptions);
|
||||
}
|
||||
|
||||
/*
|
||||
if (i === j || i === j + 1) {
|
||||
distance = distance * 2.5
|
||||
|
||||
if (i === j + 1) {
|
||||
j += 4
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (i % 6 == 0) { distance = distance * 1; }
|
||||
if (i % 6 == 1) { distance = distance * -1; }
|
||||
if (i % 6 == 2) { distance = distance * 2; }
|
||||
if (i % 6 == 3) { distance = distance * -2; }
|
||||
if (i % 6 == 4) { distance = distance * 3; }
|
||||
if (i % 6 == 5) { distance = distance * -3; }
|
||||
|
||||
newOptions[series.chart.inverted ? 'x' : 'y'] = distance;
|
||||
// newOptions[series.chart.inverted ? 'x' : 'y'] = dataLabelsOptions.alternate && (visibilityIndex % 3 != 0) ? -distance : distance;
|
||||
|
||||
options.dataLabels = H.merge(newOptions, point.userDLOptions);
|
||||
visibilityIndex++;
|
||||
}
|
||||
});
|
||||
}
|
||||
}(Highcharts));
|
||||
|
||||
var bandMapChart;
|
||||
var color = ifDarkModeThemeReturn('white', 'grey');
|
||||
|
||||
function render_chart (band,spot_data) {
|
||||
let chartObject=Highcharts.chart('bandmap', {
|
||||
chart: {
|
||||
type: 'timeline',
|
||||
zoomType: 'x',
|
||||
inverted: true,
|
||||
backgroundColor: getBodyBackground(),
|
||||
height: '800px'
|
||||
},
|
||||
accessibility: {
|
||||
screenReaderSection: {
|
||||
beforeChartFormat: '<h5>{chartTitle}</h5>' +
|
||||
'<div>{typeDescription}</div>' +
|
||||
'<div>{chartSubtitle}</div>' +
|
||||
'<div>{chartLongdesc}</div>' +
|
||||
'<div>{viewTableButton}</div>'
|
||||
},
|
||||
point: {
|
||||
valueDescriptionFormat: '{index}. {point.label}. {point.description}.'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
lineColor: color,
|
||||
visible: true,
|
||||
type: 'linear',
|
||||
labels: {
|
||||
style: {
|
||||
color: color,
|
||||
}
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
visible: false,
|
||||
},
|
||||
title: {
|
||||
text: band,
|
||||
style: {
|
||||
color: color
|
||||
}
|
||||
},
|
||||
series: [ { data: spot_data } ]
|
||||
});
|
||||
return chartObject;
|
||||
}
|
||||
|
||||
function SortByQrg(a, b){
|
||||
var a = a.frequency;
|
||||
var b = b.frequency;
|
||||
return ((a< b) ? -1 : ((a> b) ? 1 : 0));
|
||||
}
|
||||
|
||||
function reduce_spots(spotobject) {
|
||||
let unique=[];
|
||||
spotobject.forEach((single) => {
|
||||
if (!spotobject.find((item) => ((item.spotted == single.spotted) && (item.frequency == single.frequency) && (Date.parse(item.when)>Date.parse(single.when))))) {
|
||||
unique.push(single);
|
||||
}
|
||||
});
|
||||
return unique;
|
||||
}
|
||||
|
||||
function convert2high(spotobject) {
|
||||
let ret={};
|
||||
ret.name=spotobject.spotted;
|
||||
ret.x=spotobject.frequency;
|
||||
ret.description=spotobject.frequency + " / "+Math.round( (Date.now() - Date.parse(spotobject.when)) / 1000 / 60)+"min. ago";
|
||||
ret.dataLabels={};
|
||||
ret.dataLabels.alternate=true;
|
||||
ret.dataLabels.distance=200;
|
||||
return ret;
|
||||
}
|
||||
|
||||
function update_chart(band,maxAgeMinutes) {
|
||||
if ((band != '') && (band !== undefined)) {
|
||||
let dxurl = dxcluster_provider + "/spots/" + band + "/" +maxAgeMinutes;
|
||||
$.ajax({
|
||||
url: dxurl,
|
||||
cache: false,
|
||||
dataType: "json"
|
||||
}).done(function(dxspots) {
|
||||
spots4chart=[];
|
||||
if (dxspots.length>0) {
|
||||
dxspots.sort(SortByQrg);
|
||||
dxspots=reduce_spots(dxspots);
|
||||
dxspots.forEach((single) => {
|
||||
spots4chart.push(convert2high(single));
|
||||
});
|
||||
}
|
||||
bandMapChart.title.text=band;
|
||||
bandMapChart.series[0].setData(spots4chart);
|
||||
bandMapChart.redraw();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function set_chart(band, de, maxAgeMinutes) {
|
||||
if ((band != '') && (band !== undefined)) {
|
||||
let dxurl = dxcluster_provider + "/spots/" + band + "/" +maxAgeMinutes + "/" + de;
|
||||
$.ajax({
|
||||
url: dxurl,
|
||||
cache: false,
|
||||
dataType: "json"
|
||||
}).done(function(dxspots) {
|
||||
spots4chart=[];
|
||||
if (dxspots.length>0) {
|
||||
dxspots.sort(SortByQrg);
|
||||
dxspots=reduce_spots(dxspots);
|
||||
dxspots.forEach((single) => {
|
||||
spots4chart.push(convert2high(single));
|
||||
});
|
||||
}
|
||||
bandMapChart=render_chart(band,spots4chart);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$("#menutoggle").on("click", function() {
|
||||
if ($('.navbar').is(":hidden")) {
|
||||
$('.navbar').show();
|
||||
$('#dxtabs').show();
|
||||
$('#dxtitle').show();
|
||||
$('#menutoggle_i').removeClass('fa-arrow-down');
|
||||
$('#menutoggle_i').addClass('fa-arrow-up');
|
||||
} else {
|
||||
$('.navbar').hide();
|
||||
$('#dxtabs').hide();
|
||||
$('#dxtitle').hide();
|
||||
$('#menutoggle_i').removeClass('fa-arrow-up');
|
||||
$('#menutoggle_i').addClass('fa-arrow-down');
|
||||
}
|
||||
});
|
||||
|
||||
set_chart($('#band option:selected').val(), $('#decontSelect option:selected').val(), dxcluster_maxage);
|
||||
setInterval(function () { update_chart($('#band option:selected').val(),dxcluster_maxage); },60000);
|
||||
$("#band").on("change",function() {
|
||||
set_chart($('#band option:selected').val(), $('#decontSelect option:selected').val(), dxcluster_maxage);
|
||||
});
|
||||
|
||||
$("#decontSelect").on("change",function() {
|
||||
set_chart($('#band option:selected').val(), $('#decontSelect option:selected').val(), dxcluster_maxage);
|
||||
});
|
||||
});
|
||||
|
||||
var updateFromCAT = function() {
|
||||
if($('select.radios option:selected').val() != '0') {
|
||||
radioID = $('select.radios option:selected').val();
|
||||
$.getJSON( base_url + "index.php/radio/json/" + radioID, function( data ) {
|
||||
|
||||
if (data.error) {
|
||||
if (data.error == 'not_logged_in') {
|
||||
$(".radio_cat_state" ).remove();
|
||||
if($('.radio_login_error').length == 0) {
|
||||
$('.messages').prepend('<div class="alert alert-danger radio_login_error" role="alert"><i class="fas fa-broadcast-tower"></i> You\'re not logged it. Please <a href="'+base_url+'">login</a></div>');
|
||||
}
|
||||
}
|
||||
// Put future Errorhandling here
|
||||
} else {
|
||||
if($('.radio_login_error').length != 0) {
|
||||
$(".radio_login_error" ).remove();
|
||||
}
|
||||
var band = frequencyToBand(data.frequency);
|
||||
|
||||
if (band !== $("#band").val()) {
|
||||
$("#band").val(band);
|
||||
$("#band").trigger("change");
|
||||
}
|
||||
|
||||
var minutes = Math.floor(cat_timeout_interval / 60);
|
||||
|
||||
if(data.updated_minutes_ago > minutes) {
|
||||
$(".radio_cat_state" ).remove();
|
||||
if($('.radio_timeout_error').length == 0) {
|
||||
$('.messages').prepend('<div class="alert alert-danger radio_timeout_error" role="alert"><i class="fas fa-broadcast-tower"></i> Radio connection timed-out: ' + $('select.radios option:selected').text() + ' data is ' + data.updated_minutes_ago + ' minutes old.</div>');
|
||||
} else {
|
||||
$('.radio_timeout_error').html('Radio connection timed-out: ' + $('select.radios option:selected').text() + ' data is ' + data.updated_minutes_ago + ' minutes old.');
|
||||
}
|
||||
} else {
|
||||
$(".radio_timeout_error" ).remove();
|
||||
text = '<i class="fas fa-broadcast-tower"></i><span style="margin-left:10px;"></span><b>TX:</b> '+(Math.round(parseInt(data.frequency)/100)/10000).toFixed(4)+' MHz';
|
||||
if(data.mode != null) {
|
||||
text = text+'<span style="margin-left:10px"></span>'+data.mode;
|
||||
}
|
||||
if(data.power != null && data.power != 0) {
|
||||
text = text+'<span style="margin-left:10px"></span>'+data.power+' W';
|
||||
}
|
||||
if (! $('#radio_cat_state').length) {
|
||||
$('.messages').prepend('<div aria-hidden="true"><div id="radio_cat_state" class="alert alert-success radio_cat_state" role="alert">'+text+'</div></div>');
|
||||
} else {
|
||||
$('#radio_cat_state').html(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Update frequency every three second
|
||||
setInterval(updateFromCAT, 3000);
|
||||
|
||||
// If a radios selected from drop down select radio update.
|
||||
$('.radios').change(updateFromCAT);
|
||||
Reference in New Issue
Block a user