mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
[Exportmap] Added options
This commit is contained in:
@@ -279,6 +279,7 @@ class Stationsetup extends CI_Controller {
|
||||
if($public_slug != '') {
|
||||
$htmret .= '<a target="_blank" href="'.site_url('visitor')."/".$public_slug.'" class="btn btn-outline-primary btn-sm"><i class="fas fa-globe" title="'.lang('station_logbooks_view_public') . $logbook_name.'"></i></a>';
|
||||
$htmret .= ' <button id="' . $id . '" class="deletePublicSlug btn btn-outline-danger btn-sm" cnftext="Are you sure you want to delete the public slug?"><i class="fas fa-trash-alt"></i></button>';
|
||||
$htmret .= ' <button id="' . $id . '" class="editExportmapOptions btn btn-outline-primary btn-sm"><i class="fas fa-globe-europe"></i></button>';
|
||||
}
|
||||
return $htmret;
|
||||
}
|
||||
@@ -428,4 +429,36 @@ class Stationsetup extends CI_Controller {
|
||||
}
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
public function editExportmapOptions() {
|
||||
$this->load->model('stationsetup_model');
|
||||
$container = $this->stationsetup_model->getContainer(xss_clean($this->input->post('id', true)))->row();
|
||||
$slug = $container->public_slug;
|
||||
$data['logbookid'] = xss_clean($this->input->post('id', true));
|
||||
|
||||
$exportmapoptions['gridsquare_layer'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'gridsquare_layer','option_key'=>$slug))->row();
|
||||
$exportmapoptions['path_lines'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'path_lines','option_key'=>$slug))->row();
|
||||
$exportmapoptions['cqzone_layer'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'cqzone_layer','option_key'=>$slug))->row();
|
||||
$exportmapoptions['qsocount'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'qsocount','option_key'=>$slug))->row();
|
||||
$exportmapoptions['nightshadow_layer'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'nightshadow_layer','option_key'=>$slug))->row();
|
||||
|
||||
$data['exportmapoptions'] = $exportmapoptions;
|
||||
|
||||
$data['page_title'] = "Edit Export Map options";
|
||||
$this->load->view('stationsetup/exportmapoptions', $data);
|
||||
}
|
||||
|
||||
public function saveExportmapOptions() {
|
||||
$this->load->model('stationsetup_model');
|
||||
$container = $this->stationsetup_model->getContainer(xss_clean($this->input->post('id', true)))->row();
|
||||
$slug = $container->public_slug;
|
||||
|
||||
$this->load->model('user_options_model');
|
||||
|
||||
$this->user_options_model->set_option('ExportMapOptions', 'gridsquare_layer', array($slug => xss_clean($this->input->post('gridsquare_layer'))));
|
||||
$this->user_options_model->set_option('ExportMapOptions', 'path_lines', array($slug => xss_clean($this->input->post('path_lines'))));
|
||||
$this->user_options_model->set_option('ExportMapOptions', 'cqzone_layer', array($slug => xss_clean($this->input->post('cqzone_layer'))));
|
||||
$this->user_options_model->set_option('ExportMapOptions', 'nightshadow_layer', array($slug => xss_clean($this->input->post('nightshadow_layer'))));
|
||||
$this->user_options_model->set_option('ExportMapOptions', 'qsocount', array($slug => xss_clean($this->input->post('qsocount'))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,6 +420,9 @@ class Visitor extends CI_Controller {
|
||||
}
|
||||
|
||||
public function exportmap() {
|
||||
$slug = $this->security->xss_clean($this->uri->segment(3));
|
||||
$data['slug'] = $slug;
|
||||
|
||||
$data['page_title'] = "Export Map";
|
||||
$this->load->view('visitor/exportmap/header', $data);
|
||||
$this->load->view('visitor/exportmap/exportmap', $data);
|
||||
@@ -431,13 +434,13 @@ class Visitor extends CI_Controller {
|
||||
|
||||
$this->load->library('qra');
|
||||
|
||||
$slug = $this->security->xss_clean($this->input->get('slug'));
|
||||
$qsocount = $this->security->xss_clean($this->input->get('qsocount')) == '' ? '100' : $this->security->xss_clean($this->input->get('qsocount'));
|
||||
$band = $this->security->xss_clean($this->input->get('band'));
|
||||
$slug = $this->security->xss_clean($this->input->post('slug'));
|
||||
$qsocount = $this->security->xss_clean($this->input->post('qsocount')) == '' ? '100' : $this->security->xss_clean($this->input->post('qsocount'));
|
||||
$band = $this->security->xss_clean($this->input->post('band'));
|
||||
|
||||
$this->load->model('stationsetup_model');
|
||||
$logbook_id = $this->stationsetup_model->public_slug_exists_logbook_id($slug);
|
||||
if($logbook_id != false)
|
||||
if ($logbook_id != false)
|
||||
{
|
||||
// Get associated station locations for mysql queries
|
||||
$logbooks_locations_array = $this->stationsetup_model->get_container_relations($logbook_id);
|
||||
@@ -522,6 +525,12 @@ class Visitor extends CI_Controller {
|
||||
if ($options->option_name=='icon') $jsonout[$options->option_key]=json_decode($options->option_value,true);
|
||||
else $jsonout[$options->option_name.'_'.$options->option_key]=$options->option_value;
|
||||
}
|
||||
$jsonout['gridsquare_layer'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'gridsquare_layer','option_key'=>$slug), $userid)->row()->option_value ?? true;
|
||||
$jsonout['path_lines'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'path_lines','option_key'=>$slug), $userid)->row()->option_value ?? true;
|
||||
$jsonout['cqzone_layer'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'cqzone_layer','option_key'=>$slug), $userid)->row()->option_value ?? true;
|
||||
$jsonout['qsocount'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'qsocount','option_key'=>$slug), $userid)->row()->option_value ?? 250;
|
||||
$jsonout['nightshadow_layer'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'nightshadow_layer','option_key'=>$slug), $userid)->row()->option_value ?? true;
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($jsonout);
|
||||
}
|
||||
|
||||
31
application/views/stationsetup/exportmapoptions.php
Normal file
31
application/views/stationsetup/exportmapoptions.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<input type="hidden" id="logbookid" name="id" value="<?php echo $logbookid; ?>">
|
||||
<table style="width:100%" class="table-sm table table-hover table-striped table-condensed text-start" id="useroptions">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-start">Options</th>
|
||||
<th><?php echo lang('filter_options_show'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>CQ Zone overlay</td>
|
||||
<td><div class="form-check"><input class="form-check-input" name="cqzone_layer" type="checkbox" <?php if (($exportmapoptions['cqzone_layer']->option_value ?? "true") == "true") { echo 'checked'; } ?>></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gridsquare overlay</td>
|
||||
<td><div class="form-check"><input class="form-check-input" name="gridsquare_layer" type="checkbox" <?php if (($exportmapoptions['gridsquare_layer']->option_value ?? "true") == "true") { echo 'checked'; } ?>></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Night shadow overlay</td>
|
||||
<td><div class="form-check"><input class="form-check-input" name="nightshadow_layer" type="checkbox" <?php if (($exportmapoptions['nightshadow_layer']->option_value ?? "true") == "true") { echo 'checked'; } ?>></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Path lines</td>
|
||||
<td><div class="form-check"><input class="form-check-input" name="path_lines" type="checkbox" <?php if (($exportmapoptions['path_lines']->option_value ?? "true") == "true") { echo 'checked'; } ?>></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td># QSOs shown</td>
|
||||
<td><input class="form-control input-group-sm" type="number" id="qsocount" name="qsos" value="<?php echo ($exportmapoptions['qsocount']->option_value ?? 250); ?>"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -65,6 +65,7 @@
|
||||
title="<?php echo lang('station_logbooks_view_public') . $row->logbook_name;?>"></i>
|
||||
</a>
|
||||
<button id="<?php echo $row->logbook_id; ?>" class="deletePublicSlug btn btn-outline-danger btn-sm" cnftext="Are you sure you want to delete the public slug?"><i class="fas fa-trash-alt"></i></button>
|
||||
<button id="<?php echo $row->logbook_id; ?>" class="editExportmapOptions btn btn-outline-primary btn-sm"><i class="fas fa-globe-europe"></i></button>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
<script>
|
||||
var slug = '<?php echo $slug; ?>';
|
||||
</script>
|
||||
<style>
|
||||
#exportmap {
|
||||
height: 100vh;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
<script type="text/javascript" src="<?php echo base_url();?>assets/js/sections/exportmap.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url();?>assets/js/sections/cqmap_geojson.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/leaflet.geodesic.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/L.Terminator.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -18,34 +18,17 @@ $(document).ready(function () {
|
||||
mapQsos();
|
||||
});
|
||||
|
||||
function mapQsos(form) {
|
||||
const queryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(queryString);
|
||||
const slug = urlParams.get('slug');
|
||||
const qsocount = urlParams.get('qsocount');
|
||||
const showgrid = urlParams.get('showgrid');
|
||||
const showcq = urlParams.get('showcq');
|
||||
const band = urlParams.get('band');
|
||||
const showlines = urlParams.get('showlines');
|
||||
function mapQsos() {
|
||||
// const queryString = window.location.search;
|
||||
// const urlParams = new URLSearchParams(queryString);
|
||||
// const slug = urlParams.get('slug');
|
||||
// const qsocount = urlParams.get('qsocount');
|
||||
// const showgrid = urlParams.get('showgrid');
|
||||
// const showcq = urlParams.get('showcq');
|
||||
// const band = urlParams.get('band');
|
||||
// const showlines = urlParams.get('showlines');
|
||||
let iconsList;
|
||||
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/visitor/mapqsos/',
|
||||
type: 'get',
|
||||
data: {
|
||||
slug: slug,
|
||||
qsocount: qsocount,
|
||||
band: band
|
||||
},
|
||||
success: function(data) {
|
||||
|
||||
loadMapOptions(data, showgrid, showcq, showlines, slug);
|
||||
},
|
||||
error: function() {
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
function loadMapOptions(data, showgrid, showcq, showlines, slug) {
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/visitor/get_map_custom',
|
||||
type: 'POST',
|
||||
@@ -59,12 +42,32 @@ function loadMapOptions(data, showgrid, showcq, showlines, slug) {
|
||||
if (typeof json_mapinfo.qso !== "undefined") {
|
||||
iconsList = json_mapinfo;
|
||||
}
|
||||
loadMap(data, showgrid, showcq, showlines, iconsList);
|
||||
loadQsos(slug, iconsList);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
function loadQsos(slug, iconsList) {
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/visitor/mapqsos',
|
||||
type: 'post',
|
||||
data: {
|
||||
slug: slug,
|
||||
qsocount: iconsList.qsocount,
|
||||
band: iconsList.band
|
||||
},
|
||||
success: function(data) {
|
||||
|
||||
loadMap(data, iconsList);
|
||||
},
|
||||
error: function() {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function loadMap(data, showgrid, showcq, showlines, iconsList) {
|
||||
function loadMap(data, iconsList) {
|
||||
var osmUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
var osmAttrib='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
|
||||
// If map is already initialized
|
||||
@@ -126,7 +129,7 @@ function loadMap(data, showgrid, showcq, showlines, iconsList) {
|
||||
linecolor = iconsList.qso.color;
|
||||
}
|
||||
|
||||
if (showlines === "true") {
|
||||
if (iconsList.path_lines === "true") {
|
||||
const multiplelines = [];
|
||||
multiplelines.push(
|
||||
new L.LatLng(this.latlng1[0], this.latlng1[1]),
|
||||
@@ -145,11 +148,15 @@ function loadMap(data, showgrid, showcq, showlines, iconsList) {
|
||||
}
|
||||
});
|
||||
|
||||
if (showgrid === "true") {
|
||||
if (iconsList.gridsquare_layer === "true") {
|
||||
maidenhead = L.maidenheadqrb().addTo(map);
|
||||
}
|
||||
|
||||
if (showcq === "true") {
|
||||
if (iconsList.nightshadow_layer === "true") {
|
||||
nightlayer = L.terminator().addTo(map);
|
||||
}
|
||||
|
||||
if (iconsList.cqzone_layer === "true") {
|
||||
geojson = L.geoJson(zonestuff, {style: style}).addTo(map);
|
||||
for (var i = 0; i < cqzonenames.length; i++) {
|
||||
|
||||
|
||||
@@ -74,6 +74,9 @@ $(document).ready(function () {
|
||||
$(document).on('click', '.publicSearchCheckbox', async function (e) { // Dynamic binding, since element doesn't exists when loading this JS
|
||||
togglePublicSearch(e.currentTarget.id, this);
|
||||
});
|
||||
$(document).on('click', '.editExportmapOptions', async function (e) { // Dynamic binding, since element doesn't exists when loading this JS
|
||||
editExportmapDialog(e.currentTarget.id);
|
||||
});
|
||||
|
||||
$("#station_logbooks_table").DataTable({
|
||||
stateSave: true,
|
||||
@@ -132,6 +135,73 @@ $(document).ready(function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
function editExportmapDialog(id) {
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/stationsetup/editExportmapOptions',
|
||||
type: 'post',
|
||||
data: {
|
||||
id: id,
|
||||
},
|
||||
success: function (data) {
|
||||
BootstrapDialog.show({
|
||||
title: 'Edit Export Map options',
|
||||
size: BootstrapDialog.SIZE_NORMAL,
|
||||
cssClass: 'options',
|
||||
id: "NewStationLogbookModal",
|
||||
nl2br: false,
|
||||
message: data,
|
||||
onshown: function(dialog) {
|
||||
},
|
||||
buttons: [{
|
||||
label: 'Save',
|
||||
cssClass: 'btn-primary btn-sm saveExportmapOptions',
|
||||
action: function (dialogItself) {
|
||||
saveExportmapOptions();
|
||||
dialogItself.close();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: lang_admin_close,
|
||||
cssClass: 'btn-sm',
|
||||
id: 'closeButton',
|
||||
action: function (dialogItself) {
|
||||
dialogItself.close();
|
||||
}
|
||||
}],
|
||||
});
|
||||
},
|
||||
error: function (data) {
|
||||
|
||||
},
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function saveExportmapOptions() {
|
||||
$('#saveButton').prop("disabled", true);
|
||||
$('#closeButton').prop("disabled", true);
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/stationsetup/saveExportmapOptions',
|
||||
type: 'post',
|
||||
data: {
|
||||
gridsquare_layer: $('input[name="gridsquare_layer"]').is(':checked') ? true : false,
|
||||
path_lines: $('input[name="path_lines"]').is(':checked') ? true : false,
|
||||
cqzone_layer: $('input[name="cqzone_layer"]').is(':checked') ? true : false,
|
||||
nightshadow_layer: $('input[name="nightshadow_layer"]').is(':checked') ? true : false,
|
||||
qsocount: $('#qsocount').val(),
|
||||
id: $('#logbookid').val(),
|
||||
},
|
||||
success: function(data) {
|
||||
$('#saveButton').prop("disabled", false);
|
||||
$('#closeButton').prop("disabled", false);
|
||||
},
|
||||
error: function() {
|
||||
$('#saveButton').prop("disabled", false);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function editContainerDialog(e) {
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/stationsetup/editContainerName',
|
||||
|
||||
Reference in New Issue
Block a user