[Config][Maps] Added Openstreetmap tile server settings to options table

pull/778/head
Peter Goodhall 2020-12-26 14:58:41 +00:00
rodzic 3e6998460d
commit 3fe6a69807
3 zmienionych plików z 35 dodań i 15 usunięć

Wyświetl plik

@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 59;
$config['migration_version'] = 60;
/*
|--------------------------------------------------------------------------

Wyświetl plik

@ -0,0 +1,26 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* This migration creates a table called options which will hold global options needed within cloudlog
* removing the need for lots of configuration files.
*/
class Migration_add_tileserver_to_options extends CI_Migration {
public function up()
{
$data = array(
array('option_name' => "map_tile_server", 'option_value' => "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", 'autoload' => "yes"),
array('option_name' => "map_tile_server_copyright", 'option_value' => "Map data &copy; <a href=\"https://www.openstreetmap.org/\">OpenStreetMap</a>", 'autoload' => "yes")
);
$this->db->insert_batch('options', $data);
}
public function down()
{
// No option to down
}
}

Wyświetl plik

@ -418,11 +418,9 @@ $(document).on('change', 'input', function(){
var markers = L.layerGroup();
var mymap = L.map('qsomap').setView([51.505, -0.09], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
L.tileLayer('<?php echo $this->optionslib->get_option('map_tile_server');?>', {
maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Created by Cloudlog',
attribution: '<?php echo $this->optionslib->get_option('map_tile_server_copyright');?>',
id: 'mapbox.streets'
}).addTo(mymap);
@ -1111,10 +1109,9 @@ $(document).on('change', 'input', function(){
var mymap = L.map('map').setView([lat,long], 5);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
L.tileLayer('<?php echo $this->optionslib->get_option('map_tile_server');?>', {
maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a>, ' +
'Generated by <a href="http://www.cloudlog.co.uk/">Cloudlog</a>',
attribution: '<?php echo $this->optionslib->get_option('map_tile_server_copyright');?>',
id: 'mapbox.streets'
}).addTo(mymap);
@ -1162,11 +1159,9 @@ $(document).ready(function(){
<script>
var layer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
var layer = L.tileLayer('<?php echo $this->optionslib->get_option('map_tile_server');?>', {
maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Created by Cloudlog',
attribution: '<?php echo $this->optionslib->get_option('map_tile_server_copyright');?>',
id: 'mapbox.streets'
});
@ -1519,10 +1514,9 @@ $(document).ready(function(){
var callsign = $("#callsign").text();
var mymap = L.map('mapqso').setView([lat,long], 5);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
L.tileLayer('<?php echo $this->optionslib->get_option('map_tile_server');?>', {
maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a>, ' +
'Generated by <a href="http://www.cloudlog.co.uk/">Cloudlog</a>',
attribution: '<?php echo $this->optionslib->get_option('map_tile_server_copyright');?>',
id: 'mapbox.streets'
}).addTo(mymap);