From ca47f5ea0dc0107de6159c6f52cd3156c74ebed7 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Mon, 23 Mar 2015 00:12:39 +0100 Subject: [PATCH] gluon-config-mode-geo-location: add altitude field --- .../config-mode/wizard/0400-geo-location.lua | 20 +++++++++++++++++-- .../gluon-config-mode-geo-location/i18n/de.po | 18 +++++++++++------ .../gluon-config-mode-geo-location/i18n/en.po | 19 +++++++++++------- .../i18n/gluon-config-mode-geo-location.pot | 5 +++-- .../lib/gluon/announce/nodeinfo.d/location | 1 + 5 files changed, 46 insertions(+), 17 deletions(-) diff --git a/gluon/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua b/gluon/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua index ef60ae6..a3ac089 100644 --- a/gluon/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua +++ b/gluon/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua @@ -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") diff --git a/gluon/gluon-config-mode-geo-location/i18n/de.po b/gluon/gluon-config-mode-geo-location/i18n/de.po index 0857302..e83443d 100644 --- a/gluon/gluon-config-mode-geo-location/i18n/de.po +++ b/gluon/gluon-config-mode-geo-location/i18n/de.po @@ -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 \n" +"Project-Id-Version: gluon-config-mode-geo-location\n" +"PO-Revision-Date: 2015-03-23 02:18+0100\n" +"Last-Translator: Martin Weinelt \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" diff --git a/gluon/gluon-config-mode-geo-location/i18n/en.po b/gluon/gluon-config-mode-geo-location/i18n/en.po index aaed7e1..dbdd6fe 100644 --- a/gluon/gluon-config-mode-geo-location/i18n/en.po +++ b/gluon/gluon-config-mode-geo-location/i18n/en.po @@ -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 \n" +"Project-Id-Version: gluon-config-mode-geo-location\n" +"PO-Revision-Date: 2015-03-23 02:19+0100\n" +"Last-Translator: Martin Weinelt \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" diff --git a/gluon/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot b/gluon/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot index 6881b36..84800c8 100644 --- a/gluon/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot +++ b/gluon/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot @@ -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" diff --git a/gluon/gluon-node-info/files/lib/gluon/announce/nodeinfo.d/location b/gluon/gluon-node-info/files/lib/gluon/announce/nodeinfo.d/location index eb9b3a9..72bf887 100644 --- a/gluon/gluon-node-info/files/lib/gluon/announce/nodeinfo.d/location +++ b/gluon/gluon-node-info/files/lib/gluon/announce/nodeinfo.d/location @@ -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