Skip to content
Snippets Groups Projects
Commit 8361b51c authored by Martin Weinelt's avatar Martin Weinelt
Browse files

gluon-config-mode-geo-location: add altitude field

parent 127b576f
No related branches found
No related tags found
No related merge requests found
...@@ -5,8 +5,11 @@ local uci = luci.model.uci.cursor() ...@@ -5,8 +5,11 @@ local uci = luci.model.uci.cursor()
local M = {} local M = {}
function M.section(form) function M.section(form)
local s = form:section(cbi.SimpleSection, nil, local s = form:section(cbi.SimpleSection, nil, i18n.translate(
i18n.translate("If you want your node to be displayed on the map, you can enter its coodinates here.")) 'If you want the location of your node to be displayed on the map, '
.. 'you can enter its coordinates here. Specifying the altitude '
.. 'is optional and should only be done if a proper value is known.'))
local o local o
...@@ -27,6 +30,14 @@ function M.section(form) ...@@ -27,6 +30,14 @@ function M.section(form)
o.rmempty = false o.rmempty = false
o.datatype = "float" o.datatype = "float"
o.description = i18n.translatef("e.g. %s", "10.689901") o.description = i18n.translatef("e.g. %s", "10.689901")
o = s:option(cbi.Value, "_altitude", i18n.translate("Altitude"))
o.default = uci:get_first("gluon-node-info", "location", "altitude")
o:depends("_location", "1")
o.rmempty = true
o.datatype = "float"
o.description = i18n.translatef("e.g. %s", "11.51")
end end
function M.handle(data) function M.handle(data)
...@@ -36,6 +47,11 @@ function M.handle(data) ...@@ -36,6 +47,11 @@ function M.handle(data)
if data._location and data._latitude ~= nil and data._longitude ~= nil then if data._location and data._latitude ~= nil and data._longitude ~= nil then
uci:set("gluon-node-info", sname, "latitude", data._latitude) uci:set("gluon-node-info", sname, "latitude", data._latitude)
uci:set("gluon-node-info", sname, "longitude", data._longitude) uci:set("gluon-node-info", sname, "longitude", data._longitude)
if data._altitude ~= nil then
uci:set("gluon-node-info", sname, "altitude", data._altitude)
else
uci:delete("gluon-node-info", sname, "altitude")
end
end end
uci:save("gluon-node-info") uci:save("gluon-node-info")
uci:commit("gluon-node-info") uci:commit("gluon-node-info")
......
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: gluon-config-mode-geo-location\n"
"PO-Revision-Date: 2015-03-19 01:05+0100\n" "PO-Revision-Date: 2015-03-23 02:18+0100\n"
"Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\n" "Last-Translator: Martin Weinelt <martin@darmstadt.freifunk.net>\n"
"Language-Team: German\n" "Language-Team: German\n"
"Language: de\n" "Language: de\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
...@@ -11,11 +11,14 @@ msgstr "" ...@@ -11,11 +11,14 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "" msgid ""
"If you want your node to be displayed on the map, you can enter its " "If you want the location of your node to be displayed on the map, you can "
"coodinates here." "enter its coordinates here. Specifying the altitude is optional and should "
"only be done if a proper value is known."
msgstr "" msgstr ""
"Um deinen Knoten auf der Karte anzeigen zu können, benötigen wir seine " "Um deinen Knoten auf der Karte anzeigen zu können, benötigen wir seine "
"Koordinaten. Hier hast du die Möglichkeit, diese zu hinterlegen." "Koordinaten. Hier hast du die Möglichkeit, diese zu hinterlegen. Die "
"Höhenangabe ist optional und sollte nur gesetzt werden, wenn ein exakter "
"Wert bekannt ist."
msgid "Latitude" msgid "Latitude"
msgstr "Breitengrad" msgstr "Breitengrad"
...@@ -23,6 +26,9 @@ msgstr "Breitengrad" ...@@ -23,6 +26,9 @@ msgstr "Breitengrad"
msgid "Longitude" msgid "Longitude"
msgstr "Längengrad" msgstr "Längengrad"
msgid "Altitude"
msgstr "Höhenmeter über Normalnull"
msgid "Show node on the map" msgid "Show node on the map"
msgstr "Knoten auf der Karte anzeigen" msgstr "Knoten auf der Karte anzeigen"
......
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: gluon-config-mode-geo-location\n"
"PO-Revision-Date: 2015-03-19 01:04+0100\n" "PO-Revision-Date: 2015-03-23 02:19+0100\n"
"Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\n" "Last-Translator: Martin Weinelt <martin@darmstadt.freifunk.net>\n"
"Language-Team: English\n" "Language-Team: English\n"
"Language: en\n" "Language: en\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
...@@ -11,11 +11,13 @@ msgstr "" ...@@ -11,11 +11,13 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "" msgid ""
"If you want your node to be displayed on the map, you can enter its " "If you want the location of your node to be displayed on the map, you can "
"coodinates here." "enter its coordinates here. Specifying the altitude is optional and should "
"only be done if a proper value is known."
msgstr "" msgstr ""
"If you want your node to be displayed on the map, you can enter its " "If you want the location of your node to be displayed on the map, you can "
"coodinates here." "enter its coordinates here. Specifying the altitude is optional and should "
"only be done if a proper value is known."
msgid "Latitude" msgid "Latitude"
msgstr "Latitude" msgstr "Latitude"
...@@ -23,6 +25,9 @@ msgstr "Latitude" ...@@ -23,6 +25,9 @@ msgstr "Latitude"
msgid "Longitude" msgid "Longitude"
msgstr "Longitude" msgstr "Longitude"
msgid "Altitude"
msgstr "Altitude"
msgid "Show node on the map" msgid "Show node on the map"
msgstr "Show node on the map" msgstr "Show node on the map"
......
...@@ -2,8 +2,9 @@ msgid "" ...@@ -2,8 +2,9 @@ msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8" msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "" msgid ""
"If you want your node to be displayed on the map, you can enter its " "If you want the location of your node to be displayed on the map, you can "
"coodinates here." "enter its coordinates here. Specifying the altitude is optional and should "
"only be done if a proper value is known."
msgstr "" msgstr ""
msgid "Latitude" msgid "Latitude"
......
...@@ -2,5 +2,6 @@ if uci:get_first('gluon-node-info', 'location', 'share_location', false) then ...@@ -2,5 +2,6 @@ if uci:get_first('gluon-node-info', 'location', 'share_location', false) then
return { return {
latitude = tonumber(uci:get_first('gluon-node-info', 'location', 'latitude')), latitude = tonumber(uci:get_first('gluon-node-info', 'location', 'latitude')),
longitude = tonumber(uci:get_first('gluon-node-info', 'location', 'longitude')), longitude = tonumber(uci:get_first('gluon-node-info', 'location', 'longitude')),
altitude = tonumber(uci:get_first('gluon-node-info', 'location', 'altitude')),
} }
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment