From 6729624b685a670491f4c79e943910f462c22561 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Sun, 22 Jul 2018 15:11:27 +0200 Subject: [PATCH] gluon-config-mode-geo-location-with-map: add site.conf zoom parameter --- .../gluon-config-mode-geo-location.rst | 31 ++++++++++++------- .../src/0400-geo-location.lua.in | 12 ++++--- .../src/check_site.lua.in | 7 +++-- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/docs/package/gluon-config-mode-geo-location.rst b/docs/package/gluon-config-mode-geo-location.rst index 8bb86134..2015bbcd 100644 --- a/docs/package/gluon-config-mode-geo-location.rst +++ b/docs/package/gluon-config-mode-geo-location.rst @@ -37,29 +37,36 @@ config_mode.geo_location.show_altitude \: optional The remaining options are only valid for the ``gluon-config-mode-geo-location-with-map`` package: -config_mode.geo_location.map_lon \: optional +config_mode.geo_location.map.lon \: optional - represents the default longitude value to use for the center of the map. - defaults to ``0.0`` -config_mode.geo_location.map_lat \: optional +config_mode.geo_location.map.lat \: optional - represents the default latitude value to use for the center of the map. - defaults to ``0.0`` -The map will center to the position defined in map_lat and map_lon, unless a +The map will center to the position defined in **lat** and **lon**, unless a location was already defined. The new defined location will become the new center. -config_mode.geo_location.openlayers_js_url \: optional +config_mode.geo_location.map.zoom \: optional + - Natural number between ``0-17`` for the zoom level of the map. + - defaults to ``12`` + +config_mode.geo_location.map.openlayers_js_url \: optional - ``url`` set an URL for OpenStreetMap layers. - defaults to ``http://dev.openlayers.org/OpenLayers.js`` Example:: - config_mode = { - geo_location = { - map_lon = 52.951947558, - map_lat = 7.844238281, - openlayers_js_url = 'http://osm.ffnw.de/.static/ol/OpenLayers.js', - show_altitude = true, - }, - }, + config_mode = { + geo_location = { + map = { + lon = 52.951947558, + lat = 7.844238281, + zoom = 12, + openlayers_js_url = 'http://osm.ffnw.de/.static/ol/OpenLayers.js', + }, + show_altitude = true, + }, + }, diff --git a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in index 9b011f10..25d3ffbc 100644 --- a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in +++ b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in @@ -14,18 +14,22 @@ return function(form, uci) if uci_longitude ~= nil then return uci_longitude end - return site.config_mode.geo_location.map_lon(0.0) + return site.config_mode.geo_location.map.lon(0.0) end local function show_lat() if uci_latitude ~= nil then return uci_latitude end - return site.config_mode.geo_location.map_lat(0.0) + return site.config_mode.geo_location.map.lat(0.0) + end + + local function site_zoom() + return site.config_mode.geo_location.map.zoom(12) end local function show_olurl() - return site.config_mode.geo_location.openlayers_js_url('http://dev.openlayers.org/OpenLayers.js') + return site.config_mode.geo_location.map.openlayers_js_url('http://dev.openlayers.org/OpenLayers.js') end #endif @@ -58,7 +62,7 @@ return function(form, uci)