gluon-config-mode-geo-location: refactor lua code and fix interval uci request
This commit is contained in:
parent
908efde194
commit
d24abe9636
@ -14,36 +14,24 @@ return function(form, uci)
|
|||||||
if uci_longitude ~= nil then
|
if uci_longitude ~= nil then
|
||||||
return uci_longitude
|
return uci_longitude
|
||||||
end
|
end
|
||||||
if site.config_mode.geo_location.map_lon(false) then
|
return site.config_mode.geo_location.map_lon(0.0)
|
||||||
return site.config_mode.geo_location.map_lon()
|
|
||||||
end
|
|
||||||
return 0.0
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function show_lat()
|
local function show_lat()
|
||||||
if uci_latitude ~= nil then
|
if uci_latitude ~= nil then
|
||||||
return uci_latitude
|
return uci_latitude
|
||||||
end
|
end
|
||||||
if site.config_mode.geo_location.map_lat(false) then
|
return site.config_mode.geo_location.map_lat(0.0)
|
||||||
return site.config_mode.geo_location.map_lat()
|
|
||||||
end
|
|
||||||
return 0.0
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function show_olurl()
|
local function show_olurl()
|
||||||
if site.config_mode.geo_location.olurl(false) then
|
return site.config_mode.geo_location.olurl('http://dev.openlayers.org/OpenLayers.js')
|
||||||
return site.config_mode.geo_location.olurl()
|
|
||||||
end
|
|
||||||
return 'http://dev.openlayers.org/OpenLayers.js'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
-- show altitude if site.json retruns true or nil and uci an value. Dont show if site.json retruns false or uci nil!
|
||||||
local function show_altitude()
|
local function show_altitude()
|
||||||
if site.config_mode.geo_location.show_altitude(true) then
|
return site.config_mode.geo_location.show_altitude(uci:get("gluon-node-info", location, "altitude") ~= nil)
|
||||||
return true
|
|
||||||
end
|
|
||||||
return uci:get_bool("gluon-node-info", location, "altitude")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local text = site_i18n._translate("gluon-config-mode:geo-location-help") or pkg_i18n.translate(
|
local text = site_i18n._translate("gluon-config-mode:geo-location-help") or pkg_i18n.translate(
|
||||||
@ -137,7 +125,7 @@ return function(form, uci)
|
|||||||
--]]
|
--]]
|
||||||
|
|
||||||
local interval = s:option(Value, "interval", pkg_i18n.translate("Interval in minutes"), pkg_i18n.translatef("Set refresh interval"))
|
local interval = s:option(Value, "interval", pkg_i18n.translate("Interval in minutes"), pkg_i18n.translatef("Set refresh interval"))
|
||||||
interval.default = uci:get_first("geolocator", "settings", "refresh_interval")
|
interval.default = uci:get("geolocator", "settings", "refresh_interval")
|
||||||
interval:depends(geolocation, "automatic")
|
interval:depends(geolocation, "automatic")
|
||||||
interval:depends(geolocation, "auto_static")
|
interval:depends(geolocation, "auto_static")
|
||||||
interval.datatype = "uinteger"
|
interval.datatype = "uinteger"
|
||||||
|
Loading…
Reference in New Issue
Block a user