Merge pull request #109 from freifunk-darmstadt/master

gluon-config-mode-geo-location: add altitude field
This commit is contained in:
Nils Schneider 2015-03-23 16:26:59 +01:00
commit 3bed2acb20
5 changed files with 46 additions and 17 deletions

View File

@ -5,8 +5,11 @@ local uci = luci.model.uci.cursor()
local M = {}
function M.section(form)
local s = form:section(cbi.SimpleSection, nil,
i18n.translate("If you want your node to be displayed on the map, you can enter its coodinates here."))
local s = form:section(cbi.SimpleSection, nil, i18n.translate(
'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
@ -27,6 +30,14 @@ function M.section(form)
o.rmempty = false
o.datatype = "float"
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
function M.handle(data)
@ -36,6 +47,11 @@ function M.handle(data)
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, "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
uci:save("gluon-node-info")
uci:commit("gluon-node-info")

View File

@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-03-19 01:05+0100\n"
"Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\n"
"Project-Id-Version: gluon-config-mode-geo-location\n"
"PO-Revision-Date: 2015-03-23 02:18+0100\n"
"Last-Translator: Martin Weinelt <martin@darmstadt.freifunk.net>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
@ -11,11 +11,14 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid ""
"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."
msgstr ""
"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"
msgstr "Breitengrad"
@ -23,6 +26,9 @@ msgstr "Breitengrad"
msgid "Longitude"
msgstr "Längengrad"
msgid "Altitude"
msgstr "Höhenmeter über Normalnull"
msgid "Show node on the map"
msgstr "Knoten auf der Karte anzeigen"

View File

@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-03-19 01:04+0100\n"
"Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\n"
"Project-Id-Version: gluon-config-mode-geo-location\n"
"PO-Revision-Date: 2015-03-23 02:19+0100\n"
"Last-Translator: Martin Weinelt <martin@darmstadt.freifunk.net>\n"
"Language-Team: English\n"
"Language: en\n"
"MIME-Version: 1.0\n"
@ -11,11 +11,13 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid ""
"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."
msgstr ""
"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."
msgid "Latitude"
msgstr "Latitude"
@ -23,6 +25,9 @@ msgstr "Latitude"
msgid "Longitude"
msgstr "Longitude"
msgid "Altitude"
msgstr "Altitude"
msgid "Show node on the map"
msgstr "Show node on the map"

View File

@ -2,8 +2,9 @@ msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid ""
"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."
msgstr ""
msgid "Latitude"

View File

@ -2,5 +2,6 @@ if uci:get_first('gluon-node-info', 'location', 'share_location', false) then
return {
latitude = tonumber(uci:get_first('gluon-node-info', 'location', 'latitude')),
longitude = tonumber(uci:get_first('gluon-node-info', 'location', 'longitude')),
altitude = tonumber(uci:get_first('gluon-node-info', 'location', 'altitude')),
}
end