gluon-config-mode-geo-location: rebase on master
This commit is contained in:
parent
3569f12944
commit
908efde194
@ -6,8 +6,114 @@ PKG_VERSION:=1
|
|||||||
include ../gluon.mk
|
include ../gluon.mk
|
||||||
|
|
||||||
define Package/gluon-config-mode-geo-location
|
define Package/gluon-config-mode-geo-location
|
||||||
TITLE:=Set geographic location of a node
|
TITLE:=Set geographic location of a node manualy and share it.
|
||||||
|
CONFLICTS:=+gluon-config-mode-geo-location-with-geloc-map +gluon-config-mode-geo-location-with-geloc +gluon-config-mode-geo-location-with-map
|
||||||
DEPENDS:=+gluon-config-mode-core +gluon-node-info
|
DEPENDS:=+gluon-config-mode-core +gluon-node-info
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-config-mode-geo-location-with-map
|
||||||
|
TITLE:=Set geographic location of a node manualy and share it, optionally show a map if internet available.
|
||||||
|
CONFLICTS:=+gluon-config-mode-geo-location +gluon-config-mode-geo-location-with-geloc-map +gluon-config-mode-geo-location-with-geloc
|
||||||
|
DEPENDS:=+gluon-config-mode-core +gluon-node-info +gluon-web-osm
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-config-mode-geo-location-with-geloc
|
||||||
|
TITLE:=Set geographic location of a node manualy or automatically recive geo locations via surrunding wifis and share it.
|
||||||
|
CONFLICTS:=+gluon-config-mode-geo-location +gluon-config-mode-geo-location-with-geloc-map +gluon-config-mode-geo-location-with-map
|
||||||
|
DEPENDS:=+gluon-config-mode-core +gluon-node-info +gluon-geolocator
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-config-mode-geo-location-with-geloc-map
|
||||||
|
TITLE:=Set geographic location of a node manualy or automatically recive geo locations via surrunding wifis and share it, optionally show a map if internet available.
|
||||||
|
CONFLICTS:=+gluon-config-mode-geo-location +gluon-config-mode-geo-location-with-geloc +gluon-config-mode-geo-location-with-map
|
||||||
|
DEPENDS:=+gluon-config-mode-core +gluon-node-info +gluon-geolocator +gluon-web-osm
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Configure
|
||||||
|
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location{,-with-map,-with-geloc,-with-geloc-map}/{luasrc/lib/gluon/config-mode/wizard/,i18n/}
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
$(CC) -E -x c -P $(PKG_BUILD_DIR)/0400-geo-location.lua.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua
|
||||||
|
$(CC) -E -x c -P $(PKG_BUILD_DIR)/gluon-config-mode-geo-location.pot.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot
|
||||||
|
$(CC) -E -x c -P $(PKG_BUILD_DIR)/check_site.lua.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location/check_site.lua
|
||||||
|
$(CC) -E -x c -P $(PKG_BUILD_DIR)/de.po.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location/i18n/de.po
|
||||||
|
$(CC) -E -x c -P $(PKG_BUILD_DIR)/fr.po.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location/i18n/fr.po
|
||||||
|
$(call GluonBuildI18N,gluon-config-mode-geo-location,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location/i18n)
|
||||||
|
$(call GluonSrcDiet,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location/luasrc,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location/luadest/)
|
||||||
|
|
||||||
|
$(CC) -DWITHMAP -E -x c -P $(PKG_BUILD_DIR)/0400-geo-location.lua.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua
|
||||||
|
$(CC) -DWITHMAP -E -x c -P $(PKG_BUILD_DIR)/gluon-config-mode-geo-location.pot.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/i18n/gluon-config-mode-geo-location-with-map.pot
|
||||||
|
$(CC) -DWITHMAP -E -x c -P $(PKG_BUILD_DIR)/check_site.lua.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/check_site.lua
|
||||||
|
$(CC) -DWITHMAP -E -x c -P $(PKG_BUILD_DIR)/de.po.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/i18n/de.po
|
||||||
|
$(CC) -DWITHMAP -E -x c -P $(PKG_BUILD_DIR)/fr.po.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/i18n/fr.po
|
||||||
|
$(call GluonBuildI18N,gluon-config-mode-geo-location-with-map,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/i18n)
|
||||||
|
$(call GluonSrcDiet,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/luasrc,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/luadest/)
|
||||||
|
|
||||||
|
$(CC) -DWITHGELOC -E -x c -P $(PKG_BUILD_DIR)/0400-geo-location.lua.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua
|
||||||
|
$(CC) -DWITHGELOC -E -x c -P $(PKG_BUILD_DIR)/gluon-config-mode-geo-location.pot.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc/i18n/gluon-config-mode-geo-location-with-geloc.pot
|
||||||
|
$(CC) -DWITHGELOC -E -x c -P $(PKG_BUILD_DIR)/check_site.lua.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc/check_site.lua
|
||||||
|
$(CC) -DWITHGELOC -E -x c -P $(PKG_BUILD_DIR)/de.po.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc/i18n/de.po
|
||||||
|
$(CC) -DWITHGELOC -E -x c -P $(PKG_BUILD_DIR)/fr.po.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc/i18n/fr.po
|
||||||
|
$(call GluonBuildI18N,gluon-config-mode-geo-location-with-geloc,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc/i18n)
|
||||||
|
$(call GluonSrcDiet,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc/luasrc,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc/luadest/)
|
||||||
|
|
||||||
|
$(CC) -DWITHMAP -DWITHGELOC -E -x c -P $(PKG_BUILD_DIR)/0400-geo-location.lua.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc-map/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua
|
||||||
|
$(CC) -DWITHMAP -DWITHGELOC -E -x c -P $(PKG_BUILD_DIR)/gluon-config-mode-geo-location.pot.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc-map/i18n/gluon-config-mode-geo-location-with-geloc-map.pot
|
||||||
|
$(CC) -DWITHMAP -DWITHGELOC -E -x c -P $(PKG_BUILD_DIR)/check_site.lua.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc-map/check_site.lua
|
||||||
|
$(CC) -DWITHMAP -DWITHGELOC -E -x c -P $(PKG_BUILD_DIR)/de.po.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc-map/i18n/de.po
|
||||||
|
$(CC) -DWITHMAP -DWITHGELOC -E -x c -P $(PKG_BUILD_DIR)/fr.po.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc-map/i18n/fr.po
|
||||||
|
$(call GluonBuildI18N,gluon-config-mode-geo-location-with-geloc-map,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc-map/i18n)
|
||||||
|
$(call GluonSrcDiet,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc-map/luasrc,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc-map/luadest/)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-config-mode-geo-location/install
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location/luadest/* $(1)/
|
||||||
|
$(call GluonInstallI18N,gluon-config-mode-geo-location,$(1))
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-config-mode-geo-location-with-map/install
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/luadest/* $(1)/
|
||||||
|
$(INSTALL_DIR) $(1)/lib/gluon/config-mode/www/static/
|
||||||
|
$(LN) /lib/gluon/web/www/static/osm.js $(1)/lib/gluon/config-mode/www/static/osm.js
|
||||||
|
$(call GluonInstallI18N,gluon-config-mode-geo-location-with-map,$(1))
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-config-mode-geo-location-with-geloc/install
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc/luadest/* $(1)/
|
||||||
|
$(call GluonInstallI18N,gluon-config-mode-geo-location-with-geloc,$(1))
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-config-mode-geo-location-with-geloc-map/install
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc-map/luadest/* $(1)/
|
||||||
|
$(INSTALL_DIR) $(1)/lib/gluon/config-mode/www/static/
|
||||||
|
$(LN) /lib/gluon/web/www/static/osm.js $(1)/lib/gluon/config-mode/www/static/osm.js
|
||||||
|
$(call GluonInstallI18N,gluon-config-mode-geo-location-with-geloc-map,$(1))
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-config-mode-geo-location/postinst
|
||||||
|
#!/bin/sh
|
||||||
|
$(call GluonCheckSite,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location/check_site.lua)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-config-mode-geo-location-with-map/postinst
|
||||||
|
#!/bin/sh
|
||||||
|
$(call GluonCheckSite,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/check_site.lua)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-config-mode-geo-location-with-geloc/postinst
|
||||||
|
#!/bin/sh
|
||||||
|
$(call GluonCheckSite,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc/check_site.lua)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-config-mode-geo-location-with-geloc-map/postinst
|
||||||
|
#!/bin/sh
|
||||||
|
$(call GluonCheckSite,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc-map/check_site.lua)
|
||||||
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackageGluon,gluon-config-mode-geo-location))
|
$(eval $(call BuildPackageGluon,gluon-config-mode-geo-location))
|
||||||
|
$(eval $(call BuildPackageGluon,gluon-config-mode-geo-location-with-map))
|
||||||
|
$(eval $(call BuildPackageGluon,gluon-config-mode-geo-location-with-geloc))
|
||||||
|
$(eval $(call BuildPackageGluon,gluon-config-mode-geo-location-with-geloc-map))
|
||||||
|
@ -1 +0,0 @@
|
|||||||
need_boolean(in_site({'config_mode', 'geo_location', 'show_altitude'}), false)
|
|
@ -1,6 +0,0 @@
|
|||||||
({
|
|
||||||
baseUrl: "src",
|
|
||||||
include: "osm.js",
|
|
||||||
optimize: "uglify2",
|
|
||||||
out: "osm.js",
|
|
||||||
})
|
|
@ -1,70 +0,0 @@
|
|||||||
function findObj(name) {
|
|
||||||
list = document.getElementsByClassName("gluon-input-text");
|
|
||||||
for(i = 0; i < list.length; i++) {
|
|
||||||
item = list.item(i);
|
|
||||||
if(item.id.indexOf(name) >= 0) return item;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showMap() {
|
|
||||||
if ("object" == typeof OpenLayers && false !== findObj("longitude")) {
|
|
||||||
document.getElementById("locationPickerMap").style.display = "block";
|
|
||||||
var e = new OpenLayers.Projection("EPSG:4326"),
|
|
||||||
a = new OpenLayers.Projection("EPSG:900913"),
|
|
||||||
t = 12,
|
|
||||||
n = new OpenLayers.Layer.Markers("Markers");
|
|
||||||
OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
|
|
||||||
defaultHandlerOptions: {
|
|
||||||
single: !0,
|
|
||||||
"double": !1,
|
|
||||||
pixelTolerance: 0,
|
|
||||||
stopSingle: !1,
|
|
||||||
stopDouble: !1
|
|
||||||
},
|
|
||||||
initialize: function() {
|
|
||||||
this.handlerOptions = OpenLayers.Util.extend({}, this.defaultHandlerOptions), OpenLayers.Control.prototype.initialize.apply(this, arguments), this.handler = new OpenLayers.Handler.Click(this, {
|
|
||||||
click: this.trigger
|
|
||||||
}, this.handlerOptions)
|
|
||||||
},
|
|
||||||
trigger: function(t) {
|
|
||||||
var i = osmMap.getLonLatFromPixel(t.xy);
|
|
||||||
oLon = findObj("longitude");
|
|
||||||
oLat = findObj("latitude");
|
|
||||||
lonlat1 = new OpenLayers.LonLat(i.lon, i.lat).transform(a, e),
|
|
||||||
oLon.value = lonlat1.lon,
|
|
||||||
oLat.value = lonlat1.lat,
|
|
||||||
n.clearMarkers(),
|
|
||||||
n.addMarker(new OpenLayers.Marker(i)),
|
|
||||||
oLon.className = oLon.className.replace(/ gluon-input-invalid/g, ""),
|
|
||||||
oLat.className = oLat.className.replace(/ gluon-input-invalid/g, "");
|
|
||||||
//Anyone knows how to trigger the change event?
|
|
||||||
//oLon.onChange()
|
|
||||||
//oLat.onChange()
|
|
||||||
}
|
|
||||||
}), osmMap = new OpenLayers.Map("locationPickerMap", {
|
|
||||||
controls: [new OpenLayers.Control.Navigation, new OpenLayers.Control.PanZoomBar, new OpenLayers.Control.MousePosition],
|
|
||||||
maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
|
|
||||||
numZoomLevels: 18,
|
|
||||||
maxResolution: 156543,
|
|
||||||
units: "m",
|
|
||||||
projection: a,
|
|
||||||
displayProjection: e
|
|
||||||
});
|
|
||||||
var i = new OpenLayers.Layer.OSM("OpenStreetMap");
|
|
||||||
osmMap.addLayer(i), osmMap.addLayer(n);
|
|
||||||
var o = longitude,
|
|
||||||
r = latitude;
|
|
||||||
oLon = findObj("longitude");
|
|
||||||
oLat = findObj("latitude");
|
|
||||||
"" != oLon.value && (o = oLon.value),
|
|
||||||
"" != oLat.value && (r = oLat.value),
|
|
||||||
n.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(o, r).transform(e, a)));
|
|
||||||
var l = new OpenLayers.LonLat(o, r),
|
|
||||||
d = l.transform(e, a);
|
|
||||||
osmMap.setCenter(d, t);
|
|
||||||
var s = new OpenLayers.Control.Click;
|
|
||||||
osmMap.addControl(s), s.activate()
|
|
||||||
} else setTimeout(showMap, 1e3)
|
|
||||||
}
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
|||||||
return function(form, uci)
|
|
||||||
local pkg_i18n = i18n 'gluon-config-mode-geo-location'
|
|
||||||
local site_i18n = i18n 'gluon-site'
|
|
||||||
|
|
||||||
local site = require 'gluon.site'
|
|
||||||
|
|
||||||
local location = uci:get_first("gluon-node-info", "location")
|
|
||||||
|
|
||||||
local function show_altitude()
|
|
||||||
if site.config_mode.geo_location.show_altitude(true) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return uci:get_bool("gluon-node-info", location, "altitude")
|
|
||||||
end
|
|
||||||
|
|
||||||
local text = site_i18n._translate("gluon-config-mode:geo-location-help") or pkg_i18n.translate(
|
|
||||||
'If you want the location of your node to ' ..
|
|
||||||
'be displayed on the map, you can enter its coordinates here.'
|
|
||||||
)
|
|
||||||
if show_altitude() then
|
|
||||||
text = text .. ' ' .. site_i18n.translate("gluon-config-mode:altitude-help")
|
|
||||||
end
|
|
||||||
|
|
||||||
local s = form:section(Section, nil, text)
|
|
||||||
|
|
||||||
local o
|
|
||||||
|
|
||||||
local share_location = s:option(Flag, "location", pkg_i18n.translate("Show node on the map"))
|
|
||||||
share_location.default = uci:get_bool("gluon-node-info", location, "share_location")
|
|
||||||
function share_location:write(data)
|
|
||||||
uci:set("gluon-node-info", location, "share_location", data)
|
|
||||||
end
|
|
||||||
|
|
||||||
o = s:option(Value, "latitude", pkg_i18n.translate("Latitude"), pkg_i18n.translatef("e.g. %s", "53.873621"))
|
|
||||||
o.default = uci:get("gluon-node-info", location, "latitude")
|
|
||||||
o:depends(share_location, true)
|
|
||||||
o.datatype = "float"
|
|
||||||
function o:write(data)
|
|
||||||
uci:set("gluon-node-info", location, "latitude", data)
|
|
||||||
end
|
|
||||||
|
|
||||||
o = s:option(Value, "longitude", pkg_i18n.translate("Longitude"), pkg_i18n.translatef("e.g. %s", "10.689901"))
|
|
||||||
o.default = uci:get("gluon-node-info", location, "longitude")
|
|
||||||
o:depends(share_location, true)
|
|
||||||
o.datatype = "float"
|
|
||||||
function o:write(data)
|
|
||||||
uci:set("gluon-node-info", location, "longitude", data)
|
|
||||||
end
|
|
||||||
|
|
||||||
if show_altitude() then
|
|
||||||
o = s:option(Value, "altitude", site_i18n.translate("gluon-config-mode:altitude-label"), pkg_i18n.translatef("e.g. %s", "11.51"))
|
|
||||||
o.default = uci:get("gluon-node-info", location, "altitude")
|
|
||||||
o:depends(share_location, true)
|
|
||||||
o.datatype = "float"
|
|
||||||
o.optional = true
|
|
||||||
function o:write(data)
|
|
||||||
uci:set("gluon-node-info", location, "altitude", data)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return {'gluon-node-info'}
|
|
||||||
end
|
|
@ -1,4 +1,7 @@
|
|||||||
return function(form, uci)
|
return function(form, uci)
|
||||||
|
local pkg_i18n = i18n 'gluon-config-mode-geo-location'
|
||||||
|
local site_i18n = i18n 'gluon-site'
|
||||||
|
|
||||||
local site = require 'gluon.site'
|
local site = require 'gluon.site'
|
||||||
|
|
||||||
local location = uci:get_first("gluon-node-info", "location")
|
local location = uci:get_first("gluon-node-info", "location")
|
||||||
@ -43,7 +46,7 @@ return function(form, uci)
|
|||||||
return uci:get_bool("gluon-node-info", location, "altitude")
|
return uci:get_bool("gluon-node-info", location, "altitude")
|
||||||
end
|
end
|
||||||
|
|
||||||
local text = translate(
|
local text = site_i18n._translate("gluon-config-mode:geo-location-help") or pkg_i18n.translate(
|
||||||
'If you want the location of your node to be displayed on the map, you can ' ..
|
'If you want the location of your node to be displayed on the map, you can ' ..
|
||||||
#ifdef WITHGELOC
|
#ifdef WITHGELOC
|
||||||
'set an automatically localization of your router or ' ..
|
'set an automatically localization of your router or ' ..
|
||||||
@ -60,16 +63,16 @@ return function(form, uci)
|
|||||||
)
|
)
|
||||||
|
|
||||||
if show_altitude() then
|
if show_altitude() then
|
||||||
text = text .. ' ' .. translate("gluon-config-mode:altitude-help")
|
text = text .. ' ' .. site_i18n.translate("gluon-config-mode:altitude-help")
|
||||||
end
|
end
|
||||||
|
|
||||||
#ifdef WITHMAP
|
#ifdef WITHMAP
|
||||||
|
|
||||||
text = text .. [[
|
text = text .. [[
|
||||||
<div id="locationPickerMap" style="width:100%; height:300px; display: none;"></div>
|
<div id="locationPickerMap" style="width:100%; height:300px; display: none;"></div>
|
||||||
<script src="]] .. show_olurl() .. [["></script>
|
<script type="text/javascript" src="]] .. show_olurl() .. [["></script>
|
||||||
<script src="/static/gluon/osm.js"></script>
|
<script type="text/javascript" src="/static/osm.js"></script>
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
var latitude=]] .. show_lon() .. ",longitude=" .. show_lat() .. [[;
|
var latitude=]] .. show_lon() .. ",longitude=" .. show_lat() .. [[;
|
||||||
document.addEventListener("DOMContentLoaded", showMap, false);
|
document.addEventListener("DOMContentLoaded", showMap, false);
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
@ -89,13 +92,13 @@ return function(form, uci)
|
|||||||
|
|
||||||
local uci_share_location = uci:get_bool("gluon-node-info", location, "share_location")
|
local uci_share_location = uci:get_bool("gluon-node-info", location, "share_location")
|
||||||
|
|
||||||
local geolocation = s:option(ListValue, "geolocation", translate("Geo-Location"))
|
local geolocation = s:option(ListValue, "geolocation", pkg_i18n.translate("Geo-Location"))
|
||||||
#ifdef WITHGELOC
|
#ifdef WITHGELOC
|
||||||
geolocation:value("automatic", translate("Automatic (geolocator)"))
|
geolocation:value("automatic", pkg_i18n.translate("Automatic (geolocator)"))
|
||||||
geolocation:value("auto_static", translate("Automatic & Static"))
|
geolocation:value("auto_static", pkg_i18n.translate("Automatic & Static"))
|
||||||
#endif
|
#endif
|
||||||
geolocation:value("static", translate("Static location"))
|
geolocation:value("static", pkg_i18n.translate("Static location"))
|
||||||
geolocation:value("none", translate("Disabled"))
|
geolocation:value("none", pkg_i18n.translate("Disabled"))
|
||||||
#ifdef WITHGELOC
|
#ifdef WITHGELOC
|
||||||
local auto_location = uci:get_bool("geolocator", "settings", "auto_location")
|
local auto_location = uci:get_bool("geolocator", "settings", "auto_location")
|
||||||
local static_location = uci:get_bool("geolocator", "settings", "static_location")
|
local static_location = uci:get_bool("geolocator", "settings", "static_location")
|
||||||
@ -118,7 +121,7 @@ return function(form, uci)
|
|||||||
end
|
end
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
local share_location = s:option(Flag, "sharelocation", translate("Share your location to see your router on the map"))
|
local share_location = s:option(Flag, "sharelocation", pkg_i18n.translate("Share your location to see your router on the map"))
|
||||||
share_location.default = uci_share_location
|
share_location.default = uci_share_location
|
||||||
#ifdef WITHGELOC
|
#ifdef WITHGELOC
|
||||||
share_location:depends(geolocation, "automatic")
|
share_location:depends(geolocation, "automatic")
|
||||||
@ -128,19 +131,19 @@ return function(form, uci)
|
|||||||
|
|
||||||
#ifdef WITHGELOC
|
#ifdef WITHGELOC
|
||||||
--[[ -- Currently not available
|
--[[ -- Currently not available
|
||||||
o = s:option(DummyValue, "automatic_disc", " ", translatef("Automaticaly location service over wifi."))
|
o = s:option(DummyValue, "automatic_disc", " ", pkg_i18n.translatef("Automaticaly location service over wifi."))
|
||||||
o:depends(geolocation, "automatic")
|
o:depends(geolocation, "automatic")
|
||||||
o.description = translatef("Automaticaly location service over wifi.")
|
o.description = pkg_i18n.translatef("Automaticaly location service over wifi.")
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local interval = s:option(Value, "interval", translate("Interval in minutes"), 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_first("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"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
local latitude = s:option(Value, "latitude", translate("Latitude"), translatef("e.g. %s", "50.364931"))
|
local latitude = s:option(Value, "latitude", pkg_i18n.translate("Latitude"), pkg_i18n.translatef("e.g. %s", "50.364931"))
|
||||||
latitude.default = uci_latitude
|
latitude.default = uci_latitude
|
||||||
latitude:depends(geolocation, "static")
|
latitude:depends(geolocation, "static")
|
||||||
#ifdef WITHGELOC
|
#ifdef WITHGELOC
|
||||||
@ -148,7 +151,7 @@ return function(form, uci)
|
|||||||
#endif
|
#endif
|
||||||
latitude.datatype = "float"
|
latitude.datatype = "float"
|
||||||
|
|
||||||
local longitude = s:option(Value, "longitude", translate("Longitude"), translatef("e.g. %s", "7.606417"))
|
local longitude = s:option(Value, "longitude", pkg_i18n.translate("Longitude"), pkg_i18n.translatef("e.g. %s", "7.606417"))
|
||||||
longitude.default = uci_longitude
|
longitude.default = uci_longitude
|
||||||
longitude:depends(geolocation, "static")
|
longitude:depends(geolocation, "static")
|
||||||
#ifdef WITHGELOC
|
#ifdef WITHGELOC
|
||||||
@ -158,7 +161,7 @@ return function(form, uci)
|
|||||||
|
|
||||||
local altitude;
|
local altitude;
|
||||||
if show_altitude() then
|
if show_altitude() then
|
||||||
altitude = s:option(Value, "altitude", translate("gluon-config-mode:altitude-label"), translatef("e.g. %s", "11.51"))
|
altitude = s:option(Value, "altitude", site_i18n.translate("gluon-config-mode:altitude-label"), pkg_i18n.translatef("e.g. %s", "11.51"))
|
||||||
altitude.default = uci:get("gluon-node-info", location, "altitude")
|
altitude.default = uci:get("gluon-node-info", location, "altitude")
|
||||||
altitude:depends(geolocation, "static")
|
altitude:depends(geolocation, "static")
|
||||||
#ifdef WITHGELOC
|
#ifdef WITHGELOC
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
if need_table('config_mode', nil, false) and need_table('config_mode.geo_location', nil, false) then
|
need_boolean(in_site({'config_mode', 'geo_location', 'show_altitude'}), false)
|
||||||
need_boolean('config_mode.geo_location.show_altitude', false)
|
|
||||||
#ifdef WITHMAP
|
#ifdef WITHMAP
|
||||||
need_string('config_mode.geo_location.olurl', false)
|
need_string(in_site({'config_mode', 'geo_location', 'olurl'}), false)
|
||||||
need_number('config_mode.geo_location.map_lon', false)
|
need_number(in_site({'config_mode', 'geo_location', 'map_lon'}), false)
|
||||||
need_number('config_mode.geo_location.map_lat', false)
|
need_number(in_site({'config_mode', 'geo_location', 'map_lat'}), false)
|
||||||
#endif
|
#endif
|
||||||
end
|
|
||||||
|
Loading…
Reference in New Issue
Block a user