gluon-config-mode-geo-location-with-map: add site.conf zoom parameter
This commit is contained in:
parent
33573168fa
commit
6729624b68
@ -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,
|
||||
},
|
||||
},
|
||||
|
@ -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)
|
||||
<div id="locationPickerMap" style="width:100%; height:300px; display: none;"></div>
|
||||
<script type="text/javascript" src="/static/osm.js"></script>
|
||||
<script type="text/javascript">
|
||||
var latitude=]] .. show_lon() .. ",longitude=" .. show_lat() .. [[;
|
||||
var latitude=]] .. show_lon() .. ",longitude=" .. show_lat() .. ",zoom=" .. site_zoom() .. [[;
|
||||
function loadedContent() {
|
||||
document.addEventListener("DOMContentLoaded", showMap, false);
|
||||
setInterval(function() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
need_boolean(in_site({'config_mode', 'geo_location', 'show_altitude'}), false)
|
||||
#ifdef WITHMAP
|
||||
need_string(in_site({'config_mode', 'geo_location', 'openlayers_js_url'}), false)
|
||||
need_number(in_site({'config_mode', 'geo_location', 'map_lon'}), false)
|
||||
need_number(in_site({'config_mode', 'geo_location', 'map_lat'}), false)
|
||||
need_string(in_site({'config_mode', 'geo_location', 'map', 'openlayers_js_url'}), false)
|
||||
need_number(in_site({'config_mode', 'geo_location', 'map', 'lon'}), false)
|
||||
need_number(in_site({'config_mode', 'geo_location', 'map', 'lat'}), false)
|
||||
need_number(in_site({'config_mode', 'geo_location', 'map', 'zoom'}), false)
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user