Merge pull request #348 from HB9HIL/map_height

Responsive GridMap height
This commit is contained in:
HB9HIL
2024-05-08 14:19:42 +02:00
committed by GitHub
17 changed files with 495 additions and 441 deletions

View File

@@ -1,4 +1,4 @@
<div class="container">
<div class="container gridsquare_map_form">
<br>
@@ -96,7 +96,7 @@
</div>
<div id="gridmapcontainer">
<div id="gridsquare_map" class="map-leaflet" style="width: 100%; height: 800px"></div>
<div id="gridsquare_map" class="map-leaflet" style="width: 100%;"></div>
</div>
<div class="coordinates d-flex">
<div class="cohidden"><?php echo lang('gen_hamradio_latitude')?>:&nbsp;</div>

View File

@@ -1,21 +1,5 @@
<style>
.coordinates {
justify-content: center;
align-items: stretch;
}
.cohidden {
display:none;
}
#latDeg, #lngDeg {
width: 170px;
}
#locator, #distance, #bearing {
width: 120px;
}
</style>
<div class="container">
<div class="container gridsquare_map_form">
<!-- Award Info Box -->
<br>
<div id="awardInfoButton">
@@ -40,7 +24,7 @@
</div>
<div id="gridmapcontainer">
<div id="gridsquare_map" class="map-leaflet" style="width: 100%; height: 800px"></div>
<div id="gridsquare_map" class="map-leaflet" style="width: 100%;"></div>
</div>
<div class="coordinates d-flex">
<div class="cohidden"><?php echo lang('gen_hamradio_latitude')?>: </div>

View File

@@ -1,4 +1,4 @@
<div class="container">
<div class="container gridsquare_map_form">
<!-- Award Info Box -->
<br>
<div id="awardInfoButton">
@@ -23,7 +23,7 @@
<div id="gridmapcontainer">
<div id="gridsquare_map" class="map-leaflet" style="width: 100%; height: 800px"></div>
<div id="gridsquare_map" class="map-leaflet" style="width: 100%;"></div>
</div>
<div class="coordinates d-flex">
<div class="cohidden"><?php echo lang('gen_hamradio_latitude')?>: </div>

View File

@@ -1,4 +1,4 @@
<div class="container">
<div class="container gridsquare_map_form">
<br>
@@ -140,7 +140,7 @@
</div>
<div id="gridmapcontainer">
<div id="gridsquare_map" class="map-leaflet" style="width: 100%; height: 800px"></div>
<div id="gridsquare_map" class="map-leaflet" style="width: 100%;"></div>
</div>
<div class="coordinates d-flex">
<div class="cohidden"><?php echo lang('gen_hamradio_latitude') ?>:&nbsp;</div>

View File

@@ -1,67 +1,67 @@
<script type="text/javascript">
/*
*
* Define custom date format
*
*/
var custom_date_format = "<?php echo $custom_date_format ?>";
var lang_gen_hamradio_latitude = '<?php echo lang('gen_hamradio_latitude'); ?>';
var lang_gen_hamradio_longitude = '<?php echo lang('gen_hamradio_longitude'); ?>';
var lang_gen_hamradio_gridsquare = '<?php echo lang('gen_hamradio_gridsquare'); ?>';
var lang_gen_hamradio_distance = '<?php echo lang('gen_hamradio_distance'); ?>';
var lang_gen_hamradio_bearing = '<?php echo lang('gen_hamradio_bearing'); ?>';
<?php
echo "var homegrid ='" . strtoupper($homegrid[0]) . "';";
if (!isset($options)) {
$options = "{\"datetime\":{\"show\":\"true\"},\"de\":{\"show\":\"true\"},\"dx\":{\"show\":\"true\"},\"mode\":{\"show\":\"true\"},\"rstr\":{\"show\":\"true\"},\"rsts\":{\"show\":\"true\"},\"band\":{\"show\":\"true\"},\"myrefs\":{\"show\":\"true\"},\"refs\":{\"show\":\"true\"},\"name\":{\"show\":\"true\"},\"qslvia\":{\"show\":\"true\"},\"qsl\":{\"show\":\"true\"},\"lotw\":{\"show\":\"true\"},\"eqsl\":{\"show\":\"true\"},\"qslmsg\":{\"show\":\"true\"},\"dxcc\":{\"show\":\"true\"},\"state\":{\"show\":\"true\"},\"cqzone\":{\"show\":\"true\"},\"ituzone\":{\"show\":\"true\"},\"iota\":{\"show\":\"true\"},\"pota\":{\"show\":\"true\"},\"operator\":{\"show\":\"true\"},\"comment\":{\"show\":\"true\"}}";
}
$current_opts=json_decode($options);
echo "var user_options = $options;";
if (!isset($current_opts->pota)) {
echo "\nvar o_template = { pota: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
if (!isset($current_opts->operator)) {
echo "\nvar o_template = { operator: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
if (!isset($current_opts->comment)) {
echo "\nvar o_template = { comment: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
if (!isset($current_opts->ituzone)) {
echo "\nvar o_template = { ituzone: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
/*
*
* Define custom date format
*
*/
var custom_date_format = "<?php echo $custom_date_format ?>";
var lang_gen_hamradio_latitude = '<?php echo lang('gen_hamradio_latitude'); ?>';
var lang_gen_hamradio_longitude = '<?php echo lang('gen_hamradio_longitude'); ?>';
var lang_gen_hamradio_gridsquare = '<?php echo lang('gen_hamradio_gridsquare'); ?>';
var lang_gen_hamradio_distance = '<?php echo lang('gen_hamradio_distance'); ?>';
var lang_gen_hamradio_bearing = '<?php echo lang('gen_hamradio_bearing'); ?>';
<?php
echo "var homegrid ='" . strtoupper($homegrid[0]) . "';";
if (!isset($options)) {
$options = "{\"datetime\":{\"show\":\"true\"},\"de\":{\"show\":\"true\"},\"dx\":{\"show\":\"true\"},\"mode\":{\"show\":\"true\"},\"rstr\":{\"show\":\"true\"},\"rsts\":{\"show\":\"true\"},\"band\":{\"show\":\"true\"},\"myrefs\":{\"show\":\"true\"},\"refs\":{\"show\":\"true\"},\"name\":{\"show\":\"true\"},\"qslvia\":{\"show\":\"true\"},\"qsl\":{\"show\":\"true\"},\"lotw\":{\"show\":\"true\"},\"eqsl\":{\"show\":\"true\"},\"qslmsg\":{\"show\":\"true\"},\"dxcc\":{\"show\":\"true\"},\"state\":{\"show\":\"true\"},\"cqzone\":{\"show\":\"true\"},\"ituzone\":{\"show\":\"true\"},\"iota\":{\"show\":\"true\"},\"pota\":{\"show\":\"true\"},\"operator\":{\"show\":\"true\"},\"comment\":{\"show\":\"true\"}}";
}
$current_opts = json_decode($options);
echo "var user_options = $options;";
if (!isset($current_opts->pota)) {
echo "\nvar o_template = { pota: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
if (!isset($current_opts->operator)) {
echo "\nvar o_template = { operator: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
if (!isset($current_opts->comment)) {
echo "\nvar o_template = { comment: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
if (!isset($current_opts->ituzone)) {
echo "\nvar o_template = { ituzone: {show: 'true'}};";
echo "\nuser_options={...user_options, ...o_template};";
}
foreach ($mapoptions as $mo) {
if ($mo != null) {
echo "var " . $mo->option_name . "=" . $mo->option_value . ";";
}
}
?>
var tileUrl="<?php echo $this->optionslib->get_option('option_map_tile_server');?>"
foreach ($mapoptions as $mo) {
if ($mo != null) {
echo "var " . $mo->option_name . "=" . $mo->option_value . ";";
}
}
?>
var tileUrl = "<?php echo $this->optionslib->get_option('option_map_tile_server'); ?>"
</script>
<style>
.row>[class*="col-"] {
padding-right: 5px;
padding-left: 5px;
}
.row>[class*="col-"] {
padding-right: 5px;
padding-left: 5px;
}
</style>
<?php
$options = json_decode($options);
?>
<div class="container-fluid qso_manager pt-3 ps-4 pe-4">
<?php if ($this->session->flashdata('message')) { ?>
<!-- Display Message -->
<div class="alert-message error">
<p><?php echo $this->session->flashdata('message'); ?></p>
</div>
<?php } ?>
<div class="row">
<div id="lba_div">
<div class="container-fluid qso_manager pt-3 ps-4 pe-4">
<?php if ($this->session->flashdata('message')) { ?>
<!-- Display Message -->
<div class="alert-message error">
<p><?php echo $this->session->flashdata('message'); ?></p>
</div>
<?php } ?>
<div class="row">
<form id="searchForm" name="searchForm" action="<?php echo base_url()."index.php/logbookadvanced/search";?>"
method="post">
<form id="searchForm" name="searchForm" action="<?php echo base_url()."index.php/logbookadvanced/search";?>" method="post">
<input type="hidden" id="dupes" name="dupes" value="">
<div class="filterbody collapse">
<div class="row">
@@ -112,8 +112,7 @@ $options = json_decode($options);
</div>
<div class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl">
<label class="form-label" for="gridsquare"><?php echo lang('gen_hamradio_gridsquare'); ?></label>
<input type="text" name="gridsquare" id="gridsquare" class="form-control form-control-sm"
value="">
<input type="text" name="gridsquare" id="gridsquare" class="form-control form-control-sm" value="">
</div>
<div class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl">
<label class="form-label" for="mode"><?php echo lang('gen_hamradio_mode'); ?></label>
@@ -392,13 +391,13 @@ $options = json_decode($options);
</div>
<div class="row pt-2">
<div class="mb-3 d-flex align-items-center col-lg d-flex flex-row justify-content-center align-items-center">
<button type="button" class="btn btn-sm btn-primary me-1" data-bs-toggle="collapse"
<button type="button" class="btn btn-sm btn-primary me-1 lba_buttons" data-bs-toggle="collapse"
data-bs-target=".quickfilterbody"><?php echo lang('filter_quickfilters'); ?></button>
<button type="button" class="btn btn-sm btn-primary me-1" data-bs-toggle="collapse"
<button type="button" class="btn btn-sm btn-primary me-1 lba_buttons" data-bs-toggle="collapse"
data-bs-target=".qslfilterbody"><?php echo lang('filter_qsl_filters'); ?></button>
<button type="button" class="btn btn-sm btn-primary me-1" data-bs-toggle="collapse"
<button type="button" class="btn btn-sm btn-primary me-1 lba_buttons" data-bs-toggle="collapse"
data-bs-target=".filterbody"><?php echo lang('filter_filters'); ?></button>
<button type="button" class="btn btn-sm btn-primary me-1" data-bs-toggle="collapse"
<button type="button" class="btn btn-sm btn-primary me-1 lba_buttons" data-bs-toggle="collapse"
data-bs-target=".actionbody"><?php echo lang('filter_actions'); ?></button>
<label for="qsoResults" class="me-2"><?php echo lang('filter_results'); ?></label>
<select id="qsoResults" name="qsoresults" class="form-select form-select-sm me-2 w-auto">
@@ -434,87 +433,88 @@ $options = json_decode($options);
<button type="options" class="btn btn-sm btn-primary me-1" id="optionButton"><?php echo lang('filter_options'); ?></button>
<button type="reset" class="btn btn-sm btn-danger me-1" id="resetButton"><?php echo lang('filter_reset'); ?></button>
</div>
</div>
</form>
<table style="width:100%" class="table-sm table table-bordered table-hover table-striped table-condensed text-center" id="qsoList">
<thead>
<tr>
<th>
<div class="form-check" style="margin-top: -1.5em"><input class="form-check-input" type="checkbox" id="checkBoxAll" /></div>
</th>
<?php if (($options->datetime->show ?? "true") == "true") {
echo '<th>' . lang('general_word_datetime') . '</th>';
} ?>
<?php if (($options->de->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_de') . '</th>';
} ?>
<?php if (($options->dx->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_dx') . '</th>';
} ?>
<?php if (($options->mode->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_mode') . '</th>';
} ?>
<?php if (($options->rsts->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_rsts') . '</th>';
} ?>
<?php if (($options->rstr->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_rstr') . '</th>';
} ?>
<?php if (($options->band->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_band') . '</th>';
} ?>
<?php if (($options->myrefs->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_myrefs') . '</th>';
} ?>
<?php if (($options->refs->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_refs') . '</th>';
} ?>
<?php if (($options->name->show ?? "true") == "true") {
echo '<th>' . lang('general_word_name') . '</th>';
} ?>
<?php if (($options->qslvia->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_qslvia') . '</th>';
} ?>
<?php if (($options->qsl->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_qsl') . '</th>';
} ?>
<?php if ($this->session->userdata('user_eqsl_name') != "" && ($options->eqsl->show ?? "true") == "true") {
echo '<th class="eqslconfirmation">eQSL</th>';
} ?>
<?php if ($this->session->userdata('user_lotw_name') != "" && ($options->lotw->show ?? "true") == "true") {
echo '<th class="lotwconfirmation">LoTW</th>';
} ?>
<?php if (($options->qslmsg->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_qslmsg') . '</th>';
} ?>
<?php if (($options->dxcc->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_dxcc') . '</th>';
} ?>
<?php if (($options->state->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_state') . '</th>';
} ?>
<?php if (($options->cqzone->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_cq_zone') . '</th>';
} ?>
<?php if (($options->ituzone->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_itu_zone') . '</th>';
} ?>
<?php if (($options->iota->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_iota') . '</th>';
} ?>
<?php if (($options->pota->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_pota') . '</th>';
} ?>
<?php if (($options->operator->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_operator') . '</th>';
} ?>
<?php if (($options->comment->show ?? "true") == "true") {
echo '<th>' . lang('general_word_comment') . '</th>';
} ?>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</form>
<table style="width:100%" class="table-sm table table-bordered table-hover table-striped table-condensed text-center" id="qsoList">
<thead>
<tr>
<th>
<div class="form-check" style="margin-top: -1.5em"><input class="form-check-input" type="checkbox" id="checkBoxAll" /></div>
</th>
<?php if (($options->datetime->show ?? "true") == "true") {
echo '<th>' . lang('general_word_datetime') . '</th>';
} ?>
<?php if (($options->de->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_de') . '</th>';
} ?>
<?php if (($options->dx->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_dx') . '</th>';
} ?>
<?php if (($options->mode->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_mode') . '</th>';
} ?>
<?php if (($options->rsts->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_rsts') . '</th>';
} ?>
<?php if (($options->rstr->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_rstr') . '</th>';
} ?>
<?php if (($options->band->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_band') . '</th>';
} ?>
<?php if (($options->myrefs->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_myrefs') . '</th>';
} ?>
<?php if (($options->refs->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_refs') . '</th>';
} ?>
<?php if (($options->name->show ?? "true") == "true") {
echo '<th>' . lang('general_word_name') . '</th>';
} ?>
<?php if (($options->qslvia->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_qslvia') . '</th>';
} ?>
<?php if (($options->qsl->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_qsl') . '</th>';
} ?>
<?php if ($this->session->userdata('user_eqsl_name') != "" && ($options->eqsl->show ?? "true") == "true"){
echo '<th class="eqslconfirmation">eQSL</th>';
} ?>
<?php if ($this->session->userdata('user_lotw_name') != "" && ($options->lotw->show ?? "true") == "true"){
echo '<th class="lotwconfirmation">LoTW</th>';
} ?>
<?php if (($options->qslmsg->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_qslmsg') . '</th>';
} ?>
<?php if (($options->dxcc->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_dxcc') . '</th>';
} ?>
<?php if (($options->state->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_state') . '</th>';
} ?>
<?php if (($options->cqzone->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_cq_zone') . '</th>';
} ?>
<?php if (($options->ituzone->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_itu_zone') . '</th>';
} ?>
<?php if (($options->iota->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_iota') . '</th>';
} ?>
<?php if (($options->pota->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_pota') . '</th>';
} ?>
<?php if (($options->operator->show ?? "true") == "true") {
echo '<th>' . lang('gen_hamradio_operator') . '</th>';
} ?>
<?php if (($options->comment->show ?? "true") == "true") {
echo '<th>' . lang('general_word_comment') . '</th>';
} ?>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>

View File

@@ -59,6 +59,32 @@
<script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/L.MaidenheadColoured.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/sections/gridmap.js?"></script>
<script>
// auto setting of gridmap height
function set_map_height() {
//header menu
var headerNavHeight = $('nav').outerHeight();
// console.log('nav: ' + headerNavHeight);
// line with coordinates
// var coordinatesHeight = $('.coordinates').outerHeight();
// console.log('.coordinates: ' + coordinatesHeight);
// form for gridsquare map
var gridsquareFormHeight = $('.gridsquare_map_form').outerHeight();
// console.log('.gridsquare_map_form: ' + gridsquareFormHeight);
// calculate correct map height
var gridsquareMapHeight = window.innerHeight - headerNavHeight - gridsquareFormHeight - 8;
// and set it
$('#gridsquare_map').css('height', gridsquareMapHeight + 'px');
// console.log('#gridsquare_map: ' + gridsquareMapHeight);
}
</script>
<script>
var layer = L.tileLayer('<?php echo $this->optionslib->get_option('option_map_tile_server');?>', {

View File

@@ -65,11 +65,6 @@
height: 500px !important;
}
#gridsquare_map {
height: calc(100vh - 380px) !important;
max-height: 900px !important;
}
@media (min-width: 992px) {
.modal-lg, .modal-xl {
max-width: 1300px;

View File

@@ -223,11 +223,6 @@ path.grid-worked {
height: 500px !important;
}
#gridsquare_map {
height: calc(100vh - 380px) !important;
max-height: 900px !important;
}
#mapqso {
height: 400px !important;
}

View File

@@ -241,11 +241,6 @@ div.alert-danger {
height: 500px !important;
}
#gridsquare_map {
height: calc(100vh - 380px) !important;
max-height: 900px !important;
}
#mapqso {
height: 400px !important;
}

View File

@@ -65,11 +65,6 @@ thead > tr > td {
height: 500px !important;
}
#gridsquare_map {
height: calc(100vh - 380px) !important;
max-height: 900px !important;
}
@media (min-width: 992px) {
.modal-lg, .modal-xl {
max-width: 1300px;

View File

@@ -666,11 +666,6 @@ div#station_logbooks_linked_table_paginate {
margin-bottom: 0px;
}
#advancedmap {
height: calc(100vh - 280px) !important;
max-height: 1000px !important;
}
.lotw-cert-list table {
margin-bottom: 0px;
}
@@ -840,9 +835,14 @@ label {
}
.coordinates {
justify-content: center;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
justify-content: center;
align-items: stretch;
}
.cohidden {
display:none;
}

View File

@@ -87,11 +87,6 @@ path.grid-worked {
height: 400px !important;
}
#gridsquare_map {
height: calc(100vh - 380px) !important;
max-height: 900px !important;
}
/*
* Dark Navigation
*/

View File

@@ -929,6 +929,28 @@ $(document).ready(function() {
}
});
// auto setting of gridmap height
function set_map_height() {
//header menu
var headerNavHeight = $('nav').outerHeight();
// console.log('nav: ' + headerNavHeight);
// line with coordinates
var coordinatesHeight = $('.coordinates').outerHeight();
// console.log('.coordinates: ' + coordinatesHeight);
// form for gridsquare map
var gridsquareFormHeight = $('.gridsquare_map_form').outerHeight();
// console.log('.gridsquare_map_form: ' + gridsquareFormHeight);
// calculate correct map height
var gridsquareMapHeight = window.innerHeight - headerNavHeight - coordinatesHeight - gridsquareFormHeight;
// and set it
$('#gridsquare_map').css('height', gridsquareMapHeight + 'px');
// console.log('#gridsquare_map: ' + gridsquareMapHeight);
}
console.log("Ready to unleash your coding prowess and join the fun?\n\n" +
"Check out our GitHub Repository and dive into the coding adventure:\n\n" +

View File

@@ -13,7 +13,8 @@ function gridPlot(form) {
if(container != null){
container._leaflet_id = null;
container.remove();
$("#gridmapcontainer").append('<div id="gridsquare_map" class="map-leaflet" style="width: 100%; height: 800px"></div>');
$("#gridmapcontainer").append('<div id="gridsquare_map" class="map-leaflet" style="width: 100%;"></div>');
set_map_height();
}
ajax_url = site_url + '/awards/getFfmaGridsjs';
@@ -23,6 +24,7 @@ function gridPlot(form) {
type: 'get',
success: function (data) {
$('.cohidden').show();
set_map_height();
$(".ld-ext-right-plot").removeClass('running');
$(".ld-ext-right-plot").prop('disabled', false);
$('#plot').prop("disabled", false);
@@ -145,5 +147,8 @@ function spawnGridsquareModal(loc_4char) {
}
$(document).ready(function(){
gridPlot(this.form);
gridPlot(this.form);
$(window).resize(function () {
set_map_height();
});
})

View File

@@ -39,7 +39,8 @@ function gridPlot(form, visitor=true) {
if(container != null){
container._leaflet_id = null;
container.remove();
$("#gridmapcontainer").append('<div id="gridsquare_map" class="map-leaflet" style="width: 100%; height: 800px"></div>');
$("#gridmapcontainer").append('<div id="gridsquare_map" class="map-leaflet" style="width: 100%;"></div>');
set_map_height();
}
if (typeof type == 'undefined') { type=''; }
@@ -68,6 +69,7 @@ function gridPlot(form, visitor=true) {
},
success: function (data) {
$('.cohidden').show();
set_map_height();
$(".ld-ext-right-plot").removeClass('running');
$(".ld-ext-right-plot").prop('disabled', false);
$('#plot').prop("disabled", false);
@@ -219,5 +221,8 @@ function clearMarkers() {
}
$(document).ready(function(){
gridPlot(this.form, visitor);
gridPlot(this.form, visitor);
$(window).resize(function () {
set_map_height();
});
})

View File

@@ -13,7 +13,8 @@ function gridPlot(form, dxcc) {
if(container != null){
container._leaflet_id = null;
container.remove();
$("#gridmapcontainer").append('<div id="gridsquare_map" class="map-leaflet" style="width: 100%; height: 800px"></div>');
$("#gridmapcontainer").append('<div id="gridsquare_map" class="map-leaflet" style="width: 100%;"></div>');
set_map_height();
}
ajax_url = site_url + '/awards/getGridmasterGridsjs/'+dxcc;
@@ -27,6 +28,7 @@ function gridPlot(form, dxcc) {
success: function (data) {
$('.cohidden').show();
set_map_height();
$(".ld-ext-right-plot").removeClass('running');
$(".ld-ext-right-plot").prop('disabled', false);
$('#plot').prop("disabled", false);
@@ -151,5 +153,8 @@ function spawnGridsquareModal(loc_4char) {
}
$(document).ready(function(){
gridPlot(this.form, dxcc);
gridPlot(this.form, dxcc);
$(window).resize(function () {
set_map_height();
});
})

View File

@@ -273,8 +273,8 @@ function loadMap(data, iconsList) {
container._leaflet_id = null;
container.remove();
$(".coordinates").remove();
$(".qso_manager").append('<div id="advancedmap" class="map-leaflet"></div>');
$(".qso_manager").append('<div class="coordinates d-flex">' +
$("#lba_div").append('<div id="advancedmap" class="map-leaflet"></div>');
$("#lba_div").append('<div class="coordinates d-flex">' +
'<div class="cohidden">' + lang_gen_hamradio_latitude + '&nbsp;</div>' +
'<div class="cohidden col-auto text-success fw-bold" id="latDeg"></div>' +
'<div class="cohidden">' + lang_gen_hamradio_longitude + '&nbsp;</div>' +
@@ -287,6 +287,7 @@ function loadMap(data, iconsList) {
'<div class="cohidden col-auto text-success fw-bold" id="bearing"></div>' +
'</div>');
$('.cohidden').show();
set_advancedmap_height();
}
map = new L.Map('advancedmap', {
@@ -435,204 +436,204 @@ function loadMap(data, iconsList) {
}
}
function createContentMessage(qso) {
var table = '<table><tbody>' +
'<tr>' +
'<td>' +
'Station callsign: ' + qso.mycallsign +
"</td></tr>" +
'<tr>' +
'<td>' +
'Gridsquare: ' + qso.mygridsquare +
"</td></tr>";
return (table += "</tbody></table>");
}
function createContentMessage(qso) {
var table = '<table><tbody>' +
'<tr>' +
'<td>' +
'Station callsign: ' + qso.mycallsign +
"</td></tr>" +
'<tr>' +
'<td>' +
'Gridsquare: ' + qso.mygridsquare +
"</td></tr>";
return (table += "</tbody></table>");
}
function createContentMessageDx(qso) {
var table = '<table><tbody>' +
'<tr>' +
'<td>Callsign</td>' +
'<td>' + qso.callsign + '</td>' +
'</tr>' +
'<tr>' +
'<td>Date/time</td>' +
'<td>' + qso.datetime + '</td>' +
function createContentMessageDx(qso) {
var table = '<table><tbody>' +
'<tr>' +
'<td>Callsign</td>' +
'<td>' + qso.callsign + '</td>' +
'</tr>' +
'<tr>' +
'<td>Date/time</td>' +
'<td>' + qso.datetime + '</td>' +
'</tr>' +
'<tr>';
if (qso.satname != "") {
table += '<td>Band</td>' +
'<td>SAT ' + qso.satname
if (qso.orbit != "") {
table += ' (' + qso.orbit + ') '
}
table += '</td>' +
'</tr>' +
'<tr>';
if (qso.satname != "") {
table += '<td>Band</td>' +
'<td>SAT ' + qso.satname
if (qso.orbit != "") {
table += ' (' + qso.orbit + ') '
} else {
table += '<td>Band</td>' +
'<td>' + qso.band + '</td>' +
'</tr>' +
'<tr>';
}
table += '<td>Mode</td>' +
'<td>' + qso.mode + '</td>' +
'</tr>' +
'<tr>';
if (qso.gridsquare != undefined) {
table += '<td>Gridsquare</td>' +
'<td>' + qso.gridsquare + '</td>' +
'</tr>';
}
if (qso.distance != undefined) {
table += '<td>Distance</td>' +
'<td>' + qso.distance + '</td>' +
'</tr>';
}
if (qso.bearing != undefined) {
table += '<td>Bearing</td>' +
'<td>' + qso.bearing + '</td>' +
'</tr>';
}
return (table += '</tbody></table>');
}
function loadMapOptions(data) {
$.ajax({
url: base_url + 'index.php/user_options/get_map_custom',
type: 'GET',
dataType: 'json',
error: function () {
},
success: function (json_mapinfo) {
if (typeof json_mapinfo.qso !== "undefined") {
iconsList = json_mapinfo;
}
table += '</td>' +
'</tr>' +
'<tr>';
} else {
table += '<td>Band</td>' +
'<td>' + qso.band + '</td>' +
'</tr>' +
'<tr>';
loadMap(data, iconsList)
}
table += '<td>Mode</td>' +
'<td>' + qso.mode + '</td>' +
'</tr>' +
'<tr>';
if (qso.gridsquare != undefined) {
table += '<td>Gridsquare</td>' +
'<td>' + qso.gridsquare + '</td>' +
'</tr>';
}
if (qso.distance != undefined) {
table += '<td>Distance</td>' +
'<td>' + qso.distance + '</td>' +
'</tr>';
}
if (qso.bearing != undefined) {
table += '<td>Bearing</td>' +
'<td>' + qso.bearing + '</td>' +
'</tr>';
}
return (table += '</tbody></table>');
});
}
function mapQsos(form) {
$('#mapButton').prop("disabled", true).addClass("running");
var id_list=[];
var elements = $('#qsoList tbody input:checked');
var nElements = elements.length;
elements.each(function() {
let id = $(this).first().closest('tr').data('qsoID')
id_list.push(id);
unselectQsoID(id);
});
$("#qsoList").attr("Hidden", true);
$("#qsoList_wrapper").attr("Hidden", true);
$("#qsoList_info").attr("Hidden", true);
amap = $('#advancedmap').val();
if (amap == undefined) {
$("#lba_div").append('<div id="advancedmap" class="map-leaflet"></div>');
}
function loadMapOptions(data) {
if (id_list.length > 0) {
$.ajax({
url: base_url + 'index.php/logbookadvanced/mapSelectedQsos',
type: 'post',
data: {
ids: id_list,
de: form.de.value
},
success: function(data) {
loadMapOptions(data);
},
error: function() {
$('#mapButton').prop("disabled", false).removeClass("running");
},
});
} else {
$.ajax({
url: base_url + 'index.php/logbookadvanced/mapQsos',
type: 'post',
data: {
dateFrom: form.dateFrom.value,
dateTo: form.dateTo.value,
de: form.de.value,
dx: form.dx.value,
mode: form.mode.value,
band: form.band.value,
qslSent: form.qslSent.value,
qslReceived: form.qslReceived.value,
qslSentMethod: this.qslSentMethod.value,
qslReceivedMethod: this.qslReceivedMethod.value,
iota: form.iota.value,
dxcc: form.dxcc.value,
propmode: form.propmode.value,
gridsquare: form.gridsquare.value,
state: form.state.value,
qsoresults: form.qsoresults.value,
sats: form.sats.value,
orbits: form.orbits.value,
cqzone: form.cqzone.value,
lotwSent: form.lotwSent.value,
lotwReceived: form.lotwReceived.value,
eqslSent: form.eqslSent.value,
eqslReceived: form.eqslReceived.value,
qslvia: $('[name="qslvia"]').val(),
sota: form.sota.value,
pota: form.pota.value,
operator: form.operator.value,
wwff: form.wwff.value,
qslimages: form.qslimages.value,
},
success: function(data) {
loadMapOptions(data);
},
error: function() {
$('#mapButton').prop("disabled", false).removeClass("running");
},
});
}
};
function mapGlobeQsos(form) {
var container = L.DomUtil.get('advancedmap');
if(container != null){
container._leaflet_id = null;
container.remove();
$(".coordinates").remove();
}
var id_list=[];
var elements = $('#qsoList tbody input:checked');
var nElements = elements.length;
elements.each(function() {
let id = $(this).first().closest('tr').data('qsoID')
id_list.push(id);
unselectQsoID(id);
});
$("#qsoList").attr("Hidden", true);
$("#qsoList_wrapper").attr("Hidden", true);
$("#qsoList_info").attr("Hidden", true);
amap = $('#advancedmap').val();
if (amap == undefined) {
$("#lba_div").append('<div id="advancedmap" class="map-leaflet"></div>');
}
if (id_list.length > 0) {
$.ajax({
url: base_url + 'index.php/user_options/get_map_custom',
type: 'GET',
dataType: 'json',
error: function () {
},
success: function (json_mapinfo) {
if (typeof json_mapinfo.qso !== "undefined") {
iconsList = json_mapinfo;
}
loadMap(data, iconsList)
}
});
}
function mapQsos(form) {
$('#mapButton').prop("disabled", true).addClass("running");
var id_list=[];
var elements = $('#qsoList tbody input:checked');
var nElements = elements.length;
elements.each(function() {
let id = $(this).first().closest('tr').data('qsoID')
id_list.push(id);
unselectQsoID(id);
});
$("#qsoList").attr("Hidden", true);
$("#qsoList_wrapper").attr("Hidden", true);
$("#qsoList_info").attr("Hidden", true);
amap = $('#advancedmap').val();
if (amap == undefined) {
$(".qso_manager").append('<div id="advancedmap" class="map-leaflet"></div>');
}
if (id_list.length > 0) {
$.ajax({
url: base_url + 'index.php/logbookadvanced/mapSelectedQsos',
type: 'post',
data: {
ids: id_list,
de: form.de.value
},
success: function(data) {
loadMapOptions(data);
},
error: function() {
$('#mapButton').prop("disabled", false).removeClass("running");
},
});
} else {
$.ajax({
url: base_url + 'index.php/logbookadvanced/mapQsos',
type: 'post',
data: {
dateFrom: form.dateFrom.value,
dateTo: form.dateTo.value,
de: form.de.value,
dx: form.dx.value,
mode: form.mode.value,
band: form.band.value,
qslSent: form.qslSent.value,
qslReceived: form.qslReceived.value,
qslSentMethod: this.qslSentMethod.value,
qslReceivedMethod: this.qslReceivedMethod.value,
iota: form.iota.value,
dxcc: form.dxcc.value,
propmode: form.propmode.value,
gridsquare: form.gridsquare.value,
state: form.state.value,
qsoresults: form.qsoresults.value,
sats: form.sats.value,
orbits: form.orbits.value,
cqzone: form.cqzone.value,
lotwSent: form.lotwSent.value,
lotwReceived: form.lotwReceived.value,
eqslSent: form.eqslSent.value,
eqslReceived: form.eqslReceived.value,
qslvia: $('[name="qslvia"]').val(),
sota: form.sota.value,
pota: form.pota.value,
operator: form.operator.value,
wwff: form.wwff.value,
qslimages: form.qslimages.value,
},
success: function(data) {
loadMapOptions(data);
},
error: function() {
$('#mapButton').prop("disabled", false).removeClass("running");
},
});
}
};
function mapGlobeQsos(form) {
var container = L.DomUtil.get('advancedmap');
if(container != null){
container._leaflet_id = null;
container.remove();
$(".coordinates").remove();
}
var id_list=[];
var elements = $('#qsoList tbody input:checked');
var nElements = elements.length;
elements.each(function() {
let id = $(this).first().closest('tr').data('qsoID')
id_list.push(id);
unselectQsoID(id);
});
$("#qsoList").attr("Hidden", true);
$("#qsoList_wrapper").attr("Hidden", true);
$("#qsoList_info").attr("Hidden", true);
amap = $('#advancedmap').val();
if (amap == undefined) {
$(".qso_manager").append('<div id="advancedmap" class="map-leaflet"></div>');
}
if (id_list.length > 0) {
$.ajax({
url: base_url + 'index.php/logbookadvanced/mapSelectedQsos',
type: 'post',
data: {
ids: id_list,
de: form.de.value
},
success: function(data) {
globemap(data);
},
error: function() {
url: base_url + 'index.php/logbookadvanced/mapSelectedQsos',
type: 'post',
data: {
ids: id_list,
de: form.de.value
},
success: function(data) {
globemap(data);
},
error: function() {
},
});
@@ -676,51 +677,82 @@ function loadMap(data, iconsList) {
},
error: function() {
},
});
}
};
function globemap(x) {
globePayArc=[];
globePayLab=[];
x.forEach((element) => {
let OneQsoArc={};
OneQsoArc.startLat=element.latlng1[0];
OneQsoArc.startLng=element.latlng1[1];
OneQsoArc.endLat=element.latlng2[0];
OneQsoArc.endLng=element.latlng2[1];
OneQsoArc.name=element.callsign;
if (element.confirmed) {
OneQsoArc.color = 'green';
} else {
OneQsoArc.color = 'red';
}
// OneQsoArc.color = [['red', 'white', 'blue', 'green'][Math.round(Math.random() * 3)], ['red', 'white', 'blue', 'green'][Math.round(Math.random() * 3)]]
OneQsoArc.altitude=0.15;
globePayArc.push(OneQsoArc);
let OneQsoLab={};
OneQsoLab.lat=element.latlng2[0];
OneQsoLab.lng=element.latlng2[1];
OneQsoLab.text=element.callsign;
globePayLab.push(OneQsoLab);
},
});
renderGlobe(globePayArc,globePayLab);
}
};
function renderGlobe(arcsData,labelData) {
Globe()
.globeImageUrl(base_url + '/assets/images/earth-blue-marble.jpg')
.pointOfView({ lat: arcsData[0].startLat, lng: arcsData[0].startLng, altitude:1}, 100)
.labelsData(labelData)
.arcsData(arcsData)
.arcColor('color')
//.arcAltitude('altitude')
.arcAltitudeAutoScale(.3)
.arcStroke(.2)
.arcDashLength(() => .1)
.arcDashGap(() => 0.01)
.arcDashAnimateTime(() => 4000 + 500)
(document.getElementById('advancedmap'))
}
function globemap(x) {
globePayArc=[];
globePayLab=[];
x.forEach((element) => {
let OneQsoArc={};
OneQsoArc.startLat=element.latlng1[0];
OneQsoArc.startLng=element.latlng1[1];
OneQsoArc.endLat=element.latlng2[0];
OneQsoArc.endLng=element.latlng2[1];
OneQsoArc.name=element.callsign;
if (element.confirmed) {
OneQsoArc.color = 'green';
} else {
OneQsoArc.color = 'red';
}
// OneQsoArc.color = [['red', 'white', 'blue', 'green'][Math.round(Math.random() * 3)], ['red', 'white', 'blue', 'green'][Math.round(Math.random() * 3)]]
OneQsoArc.altitude=0.15;
globePayArc.push(OneQsoArc);
let OneQsoLab={};
OneQsoLab.lat=element.latlng2[0];
OneQsoLab.lng=element.latlng2[1];
OneQsoLab.text=element.callsign;
globePayLab.push(OneQsoLab);
});
renderGlobe(globePayArc,globePayLab);
}
function renderGlobe(arcsData,labelData) {
Globe()
.globeImageUrl(base_url + '/assets/images/earth-blue-marble.jpg')
.pointOfView({ lat: arcsData[0].startLat, lng: arcsData[0].startLng, altitude:1}, 100)
.labelsData(labelData)
.arcsData(arcsData)
.arcColor('color')
//.arcAltitude('altitude')
.arcAltitudeAutoScale(.3)
.arcStroke(.2)
.arcDashLength(() => .1)
.arcDashGap(() => 0.01)
.arcDashAnimateTime(() => 4000 + 500)
(document.getElementById('advancedmap'))
}
// auto setting of gridmap height
function set_advancedmap_height() {
//header menu
var headerNavHeight = $('nav').outerHeight();
// console.log('nav: ' + headerNavHeight);
// line with coordinates
var coordinatesHeight = $('.coordinates').outerHeight();
// console.log('.coordinates: ' + coordinatesHeight);
// form for gridsquare map
var qsoManagerHeight = $('.qso_manager').outerHeight();
// console.log('.qso_manager: ' + qsoManagerHeight);
// calculate correct map height
var advancedMapHeight = window.innerHeight - headerNavHeight - coordinatesHeight - qsoManagerHeight;
// and set it
$('#advancedmap').css('height', advancedMapHeight + 'px');
// console.log('#advancedmap: ' + advancedMapHeight);
}
$(document).ready(function() {
$(window).resize(function() {
set_advancedmap_height();
});
$('.lba_buttons').click(function() {
// we need some delay because of the bs collapse menu
setTimeout(set_advancedmap_height, 400);
});
});