back on track, make it work with NC 15
This commit is contained in:
Родитель
7083d8b54b
Коммит
7d29cf1c9c
|
@ -11,24 +11,31 @@
|
|||
|
||||
namespace OCA\Maps\AppInfo;
|
||||
|
||||
use OCP\AppFramework\App;
|
||||
|
||||
$app = new Application();
|
||||
$container = $app->getContainer();
|
||||
|
||||
|
||||
$l = \OC::$server->getL10N('maps');
|
||||
|
||||
\OCP\App::addNavigationEntry(array(
|
||||
// the string under which your app will be referenced in owncloud
|
||||
'id' => 'maps',
|
||||
$container->query('OCP\INavigationManager')->add(function () use ($container) {
|
||||
$urlGenerator = $container->query('OCP\IURLGenerator');
|
||||
$l10n = $container->query('OCP\IL10N');
|
||||
return [
|
||||
'id' => 'maps',
|
||||
|
||||
// sorting weight for the navigation. The higher the number, the higher
|
||||
// will it be listed in the navigation
|
||||
'order' => 10,
|
||||
'order' => 10,
|
||||
|
||||
// the route that will be shown on startup
|
||||
'href' => \OC::$server->getURLGenerator()->linkToRoute('maps.page.index'),
|
||||
// the route that will be shown on startup
|
||||
'href' => $urlGenerator->linkToRoute('maps.page.index'),
|
||||
|
||||
// the icon that will be shown in the navigation
|
||||
// this file needs to exist in img/
|
||||
'icon' => \OC::$server->getURLGenerator()->imagePath('maps', 'maps.svg'),
|
||||
// the icon that will be shown in the navigation
|
||||
// this file needs to exist in img/
|
||||
'icon' => $urlGenerator->imagePath('maps', 'maps.svg'),
|
||||
|
||||
// the title of your application. This will be used in the
|
||||
// navigation or on the settings page of your app
|
||||
'name' => $l->t('Maps')
|
||||
));
|
||||
// the title of your application. This will be used in the
|
||||
// navigation or on the settings page of your app
|
||||
'name' => $l10n->t('Maps'),
|
||||
];
|
||||
});
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<category>multimedia</category>
|
||||
<bugs>https://github.com/nextcloud/maps/issues</bugs>
|
||||
<dependencies>
|
||||
<nextcloud min-version="12" max-version="13"/>
|
||||
<nextcloud min-version="15" max-version="16"/>
|
||||
</dependencies>
|
||||
<navigations>
|
||||
<navigation>
|
||||
|
|
|
@ -8,10 +8,22 @@
|
|||
|
||||
#map {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
position: fixed;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.leaflet-bottom {
|
||||
bottom: 48px !important;
|
||||
}
|
||||
|
||||
.leaflet-right {
|
||||
right: 300px !important;
|
||||
}
|
||||
|
||||
#map *{
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
#opening-hours-table {
|
||||
margin-left: 25px;
|
||||
display: none;
|
||||
|
@ -24,9 +36,8 @@
|
|||
#opening-hours-table-toggle-expand {
|
||||
}
|
||||
|
||||
#app-content-wrapper {
|
||||
#app {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.inline-wrapper {
|
||||
|
@ -149,4 +160,4 @@ tr.selected td {
|
|||
line-height: 12px;
|
||||
text-align: center;
|
||||
padding: 3px;
|
||||
}
|
||||
}
|
||||
|
|
27
js/script.js
27
js/script.js
|
@ -54,16 +54,23 @@
|
|||
initMap: function() {
|
||||
var attribution = '© <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>';
|
||||
|
||||
var mapQuest = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution : attribution,
|
||||
var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution : attribution,
|
||||
noWrap: true,
|
||||
detectRetina: false
|
||||
});
|
||||
|
||||
var attributionESRI = 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community';
|
||||
var ESRIAerial = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
|
||||
attribution : attributionESRI,
|
||||
noWrap: false,
|
||||
detectRetina: true
|
||||
});
|
||||
this.map = L.map('map', {
|
||||
zoom: 3,
|
||||
zoom: 8,
|
||||
zoomControl: true,
|
||||
center: new L.LatLng(40.745, 74.2),
|
||||
maxBounds: new L.LatLngBounds(new L.LatLng(-90, 180), new L.LatLng(90, -180)),
|
||||
layers: [mapQuest]
|
||||
maxBounds: new L.LatLngBounds(new L.LatLng(-90, 180), new L.LatLng(90, -180))
|
||||
});
|
||||
this.locControl = L.control.locate({
|
||||
position: 'topright', // default = topleft
|
||||
|
@ -77,6 +84,16 @@
|
|||
}
|
||||
}).addTo(this.map);
|
||||
this.locControl.start(); // try to get the user's location
|
||||
|
||||
// tile layer selector
|
||||
this.map.addLayer(osm);
|
||||
var baseLayers = {
|
||||
'OpenStreetMap': osm,
|
||||
'ESRI Aerial': ESRIAerial
|
||||
}
|
||||
L.control.layers(baseLayers, {}, {position: 'bottomright'}).addTo(this.map);
|
||||
//var activeLayers = L.control.activeLayers(baseLayers, {});
|
||||
//activeLayers.addTo(this.map);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ class PageController extends Controller {
|
|||
$csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
|
||||
// map tiles
|
||||
$csp->addAllowedImageDomain('https://*.tile.openstreetmap.org');
|
||||
$csp->addAllowedImageDomain('https://server.arcgisonline.com');
|
||||
// poi images
|
||||
$csp->addAllowedImageDomain('https://nominatim.openstreetmap.org');
|
||||
// search and geocoder
|
||||
|
|
|
@ -11,9 +11,7 @@ style('maps', 'style');
|
|||
</div>
|
||||
|
||||
<div id="app-content">
|
||||
<div id="app-content-wrapper">
|
||||
<?php print_unescaped($this->inc('content/index')); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче