From 4d2a17e0dce1085115e638e2719a00dcdf09daf8 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Wed, 18 Jul 2018 06:38:25 +0200 Subject: [PATCH 01/21] gluon-config-mode-geo-location-with-map: integrate a location picker map into the config-mode. Signed-off-by: Jan-Tarek Butt --- .../gluon-config-mode-geo-location/Makefile | 56 ++++++- .../check_site.lua | 1 - .../gluon-config-mode-geo-location/i18n/de.po | 30 ---- .../gluon-config-mode-geo-location/i18n/fr.po | 30 ---- .../i18n/gluon-config-mode-geo-location.pot | 19 --- .../config-mode/wizard/0400-geo-location.lua | 63 -------- .../src/0400-geo-location.lua.in | 145 ++++++++++++++++++ .../src/check_site.lua.in | 6 + .../src/de.po.in | 54 +++++++ .../src/fr.po.in | 51 ++++++ .../src/gluon-config-mode-geo-location.pot.in | 32 ++++ 11 files changed, 343 insertions(+), 144 deletions(-) delete mode 100644 package/gluon-config-mode-geo-location/check_site.lua delete mode 100644 package/gluon-config-mode-geo-location/i18n/de.po delete mode 100644 package/gluon-config-mode-geo-location/i18n/fr.po delete mode 100644 package/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot delete mode 100644 package/gluon-config-mode-geo-location/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua create mode 100644 package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in create mode 100644 package/gluon-config-mode-geo-location/src/check_site.lua.in create mode 100644 package/gluon-config-mode-geo-location/src/de.po.in create mode 100644 package/gluon-config-mode-geo-location/src/fr.po.in create mode 100644 package/gluon-config-mode-geo-location/src/gluon-config-mode-geo-location.pot.in diff --git a/package/gluon-config-mode-geo-location/Makefile b/package/gluon-config-mode-geo-location/Makefile index a020feb9..81137815 100644 --- a/package/gluon-config-mode-geo-location/Makefile +++ b/package/gluon-config-mode-geo-location/Makefile @@ -6,8 +6,62 @@ PKG_VERSION:=1 include ../gluon.mk 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-map DEPENDS:=+gluon-config-mode-core +gluon-node-info 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 + DEPENDS:=+gluon-config-mode-core +gluon-node-info +gluon-web-osm +endef + +define Build/Configure + $(CP) ./src/* $(PKG_BUILD_DIR)/ + + $(INSTALL_DIR) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location{,-with-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/) +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/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 + $(eval $(call BuildPackageGluon,gluon-config-mode-geo-location)) +$(eval $(call BuildPackageGluon,gluon-config-mode-geo-location-with-map)) diff --git a/package/gluon-config-mode-geo-location/check_site.lua b/package/gluon-config-mode-geo-location/check_site.lua deleted file mode 100644 index 9d7c26cb..00000000 --- a/package/gluon-config-mode-geo-location/check_site.lua +++ /dev/null @@ -1 +0,0 @@ -need_boolean(in_site({'config_mode', 'geo_location', 'show_altitude'}), false) diff --git a/package/gluon-config-mode-geo-location/i18n/de.po b/package/gluon-config-mode-geo-location/i18n/de.po deleted file mode 100644 index c8bc906a..00000000 --- a/package/gluon-config-mode-geo-location/i18n/de.po +++ /dev/null @@ -1,30 +0,0 @@ -msgid "" -msgstr "" -"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" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -msgid "" -"If you want the location of your node to be displayed on the map, you can " -"enter its coordinates here." -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." - -msgid "Latitude" -msgstr "Breitengrad" - -msgid "Longitude" -msgstr "Längengrad" - -msgid "Show node on the map" -msgstr "Knoten auf der Karte anzeigen" - -msgid "e.g. %s" -msgstr "z.B. %s" diff --git a/package/gluon-config-mode-geo-location/i18n/fr.po b/package/gluon-config-mode-geo-location/i18n/fr.po deleted file mode 100644 index d3d7c6e8..00000000 --- a/package/gluon-config-mode-geo-location/i18n/fr.po +++ /dev/null @@ -1,30 +0,0 @@ -msgid "" -msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" -"Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2015-08-12 23:30+0100\n" -"Last-Translator:Tobias Bernot \n" -"Language-Team: French\n" -"Language: fr\n" -"MIME-Version: 1.0\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -msgid "" -"If you want the location of your node to be displayed on the map, you can " -"enter its coordinates here." -msgstr "" -"Pour Afficher votre nœud sur la Carte nous avons besoin de ses coordonnées. " -"Ici vous pouvez entrer sa position." - -msgid "Latitude" -msgstr "Latitude" - -msgid "Longitude" -msgstr "Longitude" - -msgid "Show node on the map" -msgstr "Afficher le nœud sur la carte" - -msgid "e.g. %s" -msgstr "Ex: %s" diff --git a/package/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot b/package/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot deleted file mode 100644 index 7acf7f28..00000000 --- a/package/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot +++ /dev/null @@ -1,19 +0,0 @@ -msgid "" -msgstr "Content-Type: text/plain; charset=UTF-8" - -msgid "" -"If you want the location of your node to be displayed on the map, you can " -"enter its coordinates here." -msgstr "" - -msgid "Latitude" -msgstr "" - -msgid "Longitude" -msgstr "" - -msgid "Show node on the map" -msgstr "" - -msgid "e.g. %s" -msgstr "" diff --git a/package/gluon-config-mode-geo-location/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua b/package/gluon-config-mode-geo-location/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua deleted file mode 100644 index 718e59ee..00000000 --- a/package/gluon-config-mode-geo-location/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua +++ /dev/null @@ -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 diff --git a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in new file mode 100644 index 00000000..1e3eae24 --- /dev/null +++ b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in @@ -0,0 +1,145 @@ +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 uci_latitude = uci:get("gluon-node-info", location, "latitude") + local uci_longitude = uci:get("gluon-node-info", location, "longitude") + +#ifdef WITHMAP + + local function show_lon() + if uci_longitude ~= nil then + return uci_longitude + end + if site.config_mode.geo_location.map_lon(false) then + return site.config_mode.geo_location.map_lon() + end + return 0.0 + end + + local function show_lat() + if uci_latitude ~= nil then + return uci_latitude + end + if site.config_mode.geo_location.map_lat(false) then + return site.config_mode.geo_location.map_lat() + end + return 0.0 + end + + local function show_olurl() + if site.config_mode.geo_location.olurl(false) then + return site.config_mode.geo_location.olurl() + end + return 'http://dev.openlayers.org/OpenLayers.js' + end + +#endif + + 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. ' .. + +#ifdef WITHMAP + + 'If your PC is connected to the internet you can also click on the map displayed below. ' .. + +#endif + + 'Please keep in mind setting a location can also enhance the network quality.' + ) + + if show_altitude() then + text = text .. ' ' .. site_i18n.translate("gluon-config-mode:altitude-help") + end + +#ifdef WITHMAP + + text = text .. [[ + + + + + ]] + +#endif + + local s = form:section(Section, nil, text) + + + local uci_share_location = uci:get_bool("gluon-node-info", location, "share_location") + + local geolocation = s:option(ListValue, "geolocation", pkg_i18n.translate("Geo-Location")) + geolocation:value("static", pkg_i18n.translate("Static location")) + geolocation:value("none", pkg_i18n.translate("Disabled")) + if uci_latitude == nil and uci_longitude == nil and uci_share_location == false then + geolocation.default = "none" + else + geolocation.default = "static" + end + + 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:depends(geolocation, "static") + + local latitude = s:option(Value, "latitude", pkg_i18n.translate("Latitude"), pkg_i18n.translatef("e.g. %s", "50.364931")) + latitude.default = uci_latitude + latitude:depends(geolocation, "static") + latitude.datatype = "float" + + local longitude = s:option(Value, "longitude", pkg_i18n.translate("Longitude"), pkg_i18n.translatef("e.g. %s", "7.606417")) + longitude.default = uci_longitude + longitude:depends(geolocation, "static") + longitude.datatype = "float" + + local altitude; + if show_altitude() then + 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:depends(geolocation, "static") + altitude.datatype = "float" + altitude.optional = true + end + function geolocation:write(data) + if data == "static" then + uci:set("gluon-node-info", location, "latitude", latitude.data) + uci:set("gluon-node-info", location, "longitude", longitude.data) + if show_altitude() then + if altitude.data then + uci:set("gluon-node-info", location, "altitude", altitude.data) + else + uci:delete("gluon-node-info", location, "altitude") + end + end + end + if data == "none" then + uci:delete("gluon-node-info", location, "altitude") + uci:delete("gluon-node-info", location, "latitude") + uci:delete("gluon-node-info", location, "longitude") + uci:set("gluon-node-info", location, "share_location", 0) + else + uci:set("gluon-node-info", location, "share_location", share_location.data) + end + end + return {'gluon-node-info'} +end diff --git a/package/gluon-config-mode-geo-location/src/check_site.lua.in b/package/gluon-config-mode-geo-location/src/check_site.lua.in new file mode 100644 index 00000000..fdab8963 --- /dev/null +++ b/package/gluon-config-mode-geo-location/src/check_site.lua.in @@ -0,0 +1,6 @@ +need_boolean(in_site({'config_mode', 'geo_location', 'show_altitude'}), false) +#ifdef WITHMAP +need_string(in_site({'config_mode', 'geo_location', 'olurl'}), false) +need_number(in_site({'config_mode', 'geo_location', 'map_lon'}), false) +need_number(in_site({'config_mode', 'geo_location', 'map_lat'}), false) +#endif diff --git a/package/gluon-config-mode-geo-location/src/de.po.in b/package/gluon-config-mode-geo-location/src/de.po.in new file mode 100644 index 00000000..09c8613d --- /dev/null +++ b/package/gluon-config-mode-geo-location/src/de.po.in @@ -0,0 +1,54 @@ +msgid "" +msgstr "" +#ifdef WITHMAP +"Project-Id-Version: gluon-config-mode-geo-location-with-map\n" +#else +"Project-Id-Version: gluon-config-mode-geo-location\n" +#endif +"PO-Revision-Date: 2017-08-22 12:14+0100\n" +"Last-Translator: Jan-Tarek Butt \n" +"Language-Team: German\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgid "" +"If you want the location of your node to be displayed on the map, you can " +"enter its coordinates here. " +#ifdef WITHMAP +"If your PC is connected to the internet you can also click on the map displayed below. " +#endif +"Please keep in mind setting a location can also enhance the network quality." +msgstr "" +"Um Deinen Router auf der Karte anzeigen zu können, benötigen wir seine " +"Koordinaten. Hier hast Du die Möglichkeit, " +"die Koordinaten händisch zu hinterlegen." +#ifdef WITHMAP +"Wenn dein Computer mit dem du den Router einrichtes am Internet angeschlossen ist, " +"hast du die Möglichkeit auf der unten angezeigten Karte an die stelle zu klicken wo " +"der Router Stehen wird." +#endif +"Bitte berücksichtige das, das setzen einer Position die Netzwerk Qualität verbessern kann." + +msgid "Geo-Location" +msgstr "Geo-Position" + +msgid "Static location" +msgstr "Manuelle Position" + +msgid "Disabled" +msgstr "Deaktiviert" + +msgid "Share your location to see your router on the map" +msgstr "Position für die Karte freigeben" + +msgid "Latitude" +msgstr "Breitengrad" + +msgid "Longitude" +msgstr "Längengrad" + +msgid "e.g. %s" +msgstr "z.B. %s" diff --git a/package/gluon-config-mode-geo-location/src/fr.po.in b/package/gluon-config-mode-geo-location/src/fr.po.in new file mode 100644 index 00000000..dfe3af83 --- /dev/null +++ b/package/gluon-config-mode-geo-location/src/fr.po.in @@ -0,0 +1,51 @@ +msgid "" +msgstr "" +#ifdef WITHMAP +"Project-Id-Version: gluon-config-mode-geo-location-with-map\n" +#else +"Project-Id-Version: gluon-config-mode-geo-location\n" +#endif +"PO-Revision-Date: 2017-08-22 12:14+0100\n" +"Last-Translator: Jan-Tarek Butt \n" +"Language-Team: French\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgid "" +"If you want the location of your node to be displayed on the map, you can " +"enter its coordinates here. " +#ifdef WITHMAP +"If your PC is connected to the internet you can also click on the map displayed below. " +#endif +"Please keep in mind setting a location can also enhance the network quality." +msgstr "" +"Si vous souhaitez que l'emplacement de votre nœud soit affiché sur la carte, vous pouvez " +"entrer ses coordonnées ici." +#ifdef WITHMAP +"Si votre PC est connecté à Internet, vous pouvez également cliquer sur la carte ci-dessous." +#endif +"Gardez à l'esprit que la définition d'un emplacement peut également améliorer la qualité du réseau." + +msgid "Geo-Location" +msgstr "Géolocalisation" + +msgid "Static location" +msgstr "position manuelle" + +msgid "Disabled" +msgstr "Désactivé" + +msgid "Share your location to see your router on the map" +msgstr "Partagez votre emplacement pour voir votre routeur sur la carte" + +msgid "Latitude" +msgstr "Latitude" + +msgid "Longitude" +msgstr "Longitude" + +msgid "e.g. %s" +msgstr "Ex: %s" diff --git a/package/gluon-config-mode-geo-location/src/gluon-config-mode-geo-location.pot.in b/package/gluon-config-mode-geo-location/src/gluon-config-mode-geo-location.pot.in new file mode 100644 index 00000000..c7854807 --- /dev/null +++ b/package/gluon-config-mode-geo-location/src/gluon-config-mode-geo-location.pot.in @@ -0,0 +1,32 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "" +"If you want the location of your node to be displayed on the map, you can " +"enter its coordinates here. " +#ifdef WITHMAP +"If your PC is connected to the internet you can also click on the map displayed below. " +#endif +"Please keep in mind setting a location can also enhance the network quality." +msgstr "" + +msgid "Geo-Location" +msgstr "" + +msgid "Static location" +msgstr "" + +msgid "Disabled" +msgstr "" + +msgid "Share your location to see your router on the map" +msgstr "" + +msgid "Latitude" +msgstr "" + +msgid "Longitude" +msgstr "" + +msgid "e.g. %s" +msgstr "" From dfeafcd58ee12d53fa90cedac7294901701c0b49 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Wed, 18 Jul 2018 20:28:29 +0200 Subject: [PATCH 02/21] gluon-config-mode-geo-location: refactor lua code * redruce lua code * set async="true" for js osm layers --- .../src/0400-geo-location.lua.in | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in index 1e3eae24..d420d204 100644 --- a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in +++ b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in @@ -14,36 +14,25 @@ return function(form, uci) if uci_longitude ~= nil then return uci_longitude end - if site.config_mode.geo_location.map_lon(false) then - return site.config_mode.geo_location.map_lon() - end - return 0.0 + return site.config_mode.geo_location.map_lon(0.0) end local function show_lat() if uci_latitude ~= nil then return uci_latitude end - if site.config_mode.geo_location.map_lat(false) then - return site.config_mode.geo_location.map_lat() - end - return 0.0 + return site.config_mode.geo_location.map_lat(0.0) end local function show_olurl() - if site.config_mode.geo_location.olurl(false) then - return site.config_mode.geo_location.olurl() - end - return 'http://dev.openlayers.org/OpenLayers.js' + return site.config_mode.geo_location.olurl('http://dev.openlayers.org/OpenLayers.js') end #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() - if site.config_mode.geo_location.show_altitude(true) then - return true - end - return uci:get_bool("gluon-node-info", location, "altitude") + return site.config_mode.geo_location.show_altitude(uci:get("gluon-node-info", location, "altitude") ~= nil) end local text = site_i18n._translate("gluon-config-mode:geo-location-help") or pkg_i18n.translate( @@ -67,7 +56,7 @@ return function(form, uci) text = text .. [[ - + + ]] #endif From d22d44c2f0516a95cf1018cd686006687bc22da7 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Thu, 19 Jul 2018 04:01:31 +0200 Subject: [PATCH 04/21] package/gluon-config-mode-geo-location/Makefil: manualy -> manually --- package/gluon-config-mode-geo-location/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-config-mode-geo-location/Makefile b/package/gluon-config-mode-geo-location/Makefile index 81137815..be45716b 100644 --- a/package/gluon-config-mode-geo-location/Makefile +++ b/package/gluon-config-mode-geo-location/Makefile @@ -6,13 +6,13 @@ PKG_VERSION:=1 include ../gluon.mk define Package/gluon-config-mode-geo-location - TITLE:=Set geographic location of a node manualy and share it. + TITLE:=Set geographic location of a node manually and share it. CONFLICTS:=+gluon-config-mode-geo-location-with-map DEPENDS:=+gluon-config-mode-core +gluon-node-info 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. + TITLE:=Set geographic location of a node manually and share it, optionally show a map if internet available. CONFLICTS:=+gluon-config-mode-geo-location DEPENDS:=+gluon-config-mode-core +gluon-node-info +gluon-web-osm endef From aae2b77c5050855d825a47530cdfd93ae34aeb59 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Thu, 19 Jul 2018 04:07:15 +0200 Subject: [PATCH 05/21] package/gluon-config-mode-geo-location/Makefile: and is to 'internet is available.' --- package/gluon-config-mode-geo-location/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-config-mode-geo-location/Makefile b/package/gluon-config-mode-geo-location/Makefile index be45716b..81b1056d 100644 --- a/package/gluon-config-mode-geo-location/Makefile +++ b/package/gluon-config-mode-geo-location/Makefile @@ -12,7 +12,7 @@ define Package/gluon-config-mode-geo-location endef define Package/gluon-config-mode-geo-location-with-map - TITLE:=Set geographic location of a node manually and share it, optionally show a map if internet available. + TITLE:=Set geographic location of a node manually and share it, optionally show a map if internet is available. CONFLICTS:=+gluon-config-mode-geo-location DEPENDS:=+gluon-config-mode-core +gluon-node-info +gluon-web-osm endef From db6cf7a56067796b702451d4ae2883c15578034b Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Thu, 19 Jul 2018 04:13:48 +0200 Subject: [PATCH 06/21] package/gluon-config-mode-geo-location/src/de.po.in: fix spelling --- package/gluon-config-mode-geo-location/src/de.po.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/gluon-config-mode-geo-location/src/de.po.in b/package/gluon-config-mode-geo-location/src/de.po.in index 09c8613d..ae18d2f9 100644 --- a/package/gluon-config-mode-geo-location/src/de.po.in +++ b/package/gluon-config-mode-geo-location/src/de.po.in @@ -26,11 +26,11 @@ msgstr "" "Koordinaten. Hier hast Du die Möglichkeit, " "die Koordinaten händisch zu hinterlegen." #ifdef WITHMAP -"Wenn dein Computer mit dem du den Router einrichtes am Internet angeschlossen ist, " -"hast du die Möglichkeit auf der unten angezeigten Karte an die stelle zu klicken wo " -"der Router Stehen wird." +"Wenn dein Computer mit dem du den Router einrichtest eine Internetverbindung hat, " +"hast du die Möglichkeit auf der unten angezeigten Karte an die Stelle zu klicken, an der " +"der Router stehen wird." #endif -"Bitte berücksichtige das, das setzen einer Position die Netzwerk Qualität verbessern kann." +"Bitte berücksichtige, dass das Setzen einer Position die Netzwerk Qualität verbessern kann." msgid "Geo-Location" msgstr "Geo-Position" From 0218bb6ceea8bb03b2510cc719c166dd5438b367 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Fri, 20 Jul 2018 21:00:42 +0200 Subject: [PATCH 07/21] gluon-config-mode-geo-location-with-map: add package doc --- docs/index.rst | 1 + .../gluon-config-mode-geo-location.rst | 55 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 docs/package/gluon-config-mode-geo-location.rst diff --git a/docs/index.rst b/docs/index.rst index 41a64ad7..3865b07c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -58,6 +58,7 @@ Several Freifunk communities in Germany use Gluon as the foundation of their Fre package/gluon-client-bridge package/gluon-config-mode-domain-select + package/gluon-config-mode-geo-location package/gluon-ebtables-filter-multicast package/gluon-ebtables-filter-ra-dhcp package/gluon-ebtables-limit-arp diff --git a/docs/package/gluon-config-mode-geo-location.rst b/docs/package/gluon-config-mode-geo-location.rst new file mode 100644 index 00000000..ad5fd8b3 --- /dev/null +++ b/docs/package/gluon-config-mode-geo-location.rst @@ -0,0 +1,55 @@ +gluon-config-mode-geo-location +============================== + +This package allows the user to set latitude, longitude and optionally altitude +within config mode. There are 2 types of this package. + +It is possible to include ``gluon-config-mode-geo-location`` or +``gluon-config-mode-geo-location-with-map`` in the ``site.mk``. + +gluon-config-mode-geo-location-with-map +--------------------------------------- + +The package ``gluon-config-mode-geo-location-with-map`` will additionally and a +map where users can pick a position. This map will only shown if the users +computer will have an internet connection. + +site.conf +^^^^^^^^^ + +This option is valid for both typ of package. + +config_mode.geo_location.show_altitude \: optional + - ``true`` the altitude section in config mode is shown + - ``false`` the altitude section in config mode is hidden + - defaults to ``false`` + +All following options are only valid for the package +``gluon-config-mode-geo-location-with-map``. + +config_mode.geo_location.map_lon \: optional + - represents the default longitude center of the location picker map. + - defaults to ``0.0`` + +config_mode.geo_location.map_lat \: optional + - represents the default latitude center of the location picker map. + - defaults to ``0.0`` + +The above 2 options will usually shown on a factory flashed Router. If a node +is reenter the config mode the maps center will be on the last defined +position. + +config_mode.geo_location.olurl \: optional + - ``url`` set an url for OpenStreetMap layers. + - defaults to ``http://dev.openlayers.org/OpenLayers.js`` + +Example:: + + config_mode = { + geo_location = { + map_lon = 52.951947558, + map_lat = 7.844238281, + olurl = 'http://osm.ffnw.de/.static/ol/OpenLayers.js', + show_altitude = true, + }, + }, From cfa68a4fd9124876d9b83842a016e9b826589dad Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Sat, 21 Jul 2018 00:51:16 +0200 Subject: [PATCH 08/21] gluon-config-mode-geo-location-with-map: fix spelling and indentation --- docs/package/gluon-config-mode-geo-location.rst | 12 ++++++------ .../src/0400-geo-location.lua.in | 10 +++++----- package/gluon-config-mode-geo-location/src/de.po.in | 6 +++--- package/gluon-config-mode-geo-location/src/fr.po.in | 2 +- .../src/gluon-config-mode-geo-location.pot.in | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/package/gluon-config-mode-geo-location.rst b/docs/package/gluon-config-mode-geo-location.rst index ad5fd8b3..bde7b7bf 100644 --- a/docs/package/gluon-config-mode-geo-location.rst +++ b/docs/package/gluon-config-mode-geo-location.rst @@ -10,14 +10,14 @@ It is possible to include ``gluon-config-mode-geo-location`` or gluon-config-mode-geo-location-with-map --------------------------------------- -The package ``gluon-config-mode-geo-location-with-map`` will additionally and a -map where users can pick a position. This map will only shown if the users -computer will have an internet connection. +The package ``gluon-config-mode-geo-location-with-map`` will additionally add a +map where users can pick a position. This map will only be shown if the users +computer has an internet connection. site.conf ^^^^^^^^^ -This option is valid for both typ of package. +This option is valid for both package variants. config_mode.geo_location.show_altitude \: optional - ``true`` the altitude section in config mode is shown @@ -35,8 +35,8 @@ config_mode.geo_location.map_lat \: optional - represents the default latitude center of the location picker map. - defaults to ``0.0`` -The above 2 options will usually shown on a factory flashed Router. If a node -is reenter the config mode the maps center will be on the last defined +The above 2 options will usually be shown on a factory flashed Router. If a node +is reentered the config mode the map's center will be on the last defined position. config_mode.geo_location.olurl \: optional diff --git a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in index 6c87253b..fafbcb26 100644 --- a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in +++ b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in @@ -1,8 +1,8 @@ return function(form, uci) - local pkg_i18n = i18n 'gluon-config-mode-geo-location' - local site_i18n = i18n 'gluon-site' + 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 uci_latitude = uci:get("gluon-node-info", location, "latitude") @@ -30,7 +30,7 @@ return function(form, uci) #endif - -- show altitude if site.json retruns true or nil and uci an value. Dont show if site.json retruns false or uci nil! + -- show altitude if site.json returns true or nil and uci an value. Don't show if site.json returns false or uci nil! local function show_altitude() return site.config_mode.geo_location.show_altitude(uci:get("gluon-node-info", location, "altitude") ~= nil) end @@ -41,7 +41,7 @@ return function(form, uci) #ifdef WITHMAP - 'If your PC is connected to the internet you can also click on the map displayed below. ' .. + 'If your PC is connected to the internet you may also click on the map displayed below. ' .. #endif diff --git a/package/gluon-config-mode-geo-location/src/de.po.in b/package/gluon-config-mode-geo-location/src/de.po.in index ae18d2f9..6c9a4cef 100644 --- a/package/gluon-config-mode-geo-location/src/de.po.in +++ b/package/gluon-config-mode-geo-location/src/de.po.in @@ -18,12 +18,12 @@ msgid "" "If you want the location of your node to be displayed on the map, you can " "enter its coordinates here. " #ifdef WITHMAP -"If your PC is connected to the internet you can also click on the map displayed below. " +"If your PC is connected to the internet you may also click on the map displayed below. " #endif "Please keep in mind setting a location can also enhance the network quality." msgstr "" -"Um Deinen Router auf der Karte anzeigen zu können, benötigen wir seine " -"Koordinaten. Hier hast Du die Möglichkeit, " +"Um deinen Router auf der Karte anzeigen zu können, benötigen wir seine " +"Koordinaten. Hier hast du die Möglichkeit, " "die Koordinaten händisch zu hinterlegen." #ifdef WITHMAP "Wenn dein Computer mit dem du den Router einrichtest eine Internetverbindung hat, " diff --git a/package/gluon-config-mode-geo-location/src/fr.po.in b/package/gluon-config-mode-geo-location/src/fr.po.in index dfe3af83..02c9fa47 100644 --- a/package/gluon-config-mode-geo-location/src/fr.po.in +++ b/package/gluon-config-mode-geo-location/src/fr.po.in @@ -18,7 +18,7 @@ msgid "" "If you want the location of your node to be displayed on the map, you can " "enter its coordinates here. " #ifdef WITHMAP -"If your PC is connected to the internet you can also click on the map displayed below. " +"If your PC is connected to the internet you may also click on the map displayed below. " #endif "Please keep in mind setting a location can also enhance the network quality." msgstr "" diff --git a/package/gluon-config-mode-geo-location/src/gluon-config-mode-geo-location.pot.in b/package/gluon-config-mode-geo-location/src/gluon-config-mode-geo-location.pot.in index c7854807..fa850916 100644 --- a/package/gluon-config-mode-geo-location/src/gluon-config-mode-geo-location.pot.in +++ b/package/gluon-config-mode-geo-location/src/gluon-config-mode-geo-location.pot.in @@ -5,7 +5,7 @@ msgid "" "If you want the location of your node to be displayed on the map, you can " "enter its coordinates here. " #ifdef WITHMAP -"If your PC is connected to the internet you can also click on the map displayed below. " +"If your PC is connected to the internet you may also click on the map displayed below. " #endif "Please keep in mind setting a location can also enhance the network quality." msgstr "" From 70052f2617bcf2c8ff68859f033716e3d7bf18b8 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Sat, 21 Jul 2018 12:06:48 +0200 Subject: [PATCH 09/21] gluon-config-mode-geo-location-with-map: fix spelling and grammar --- .../package/gluon-config-mode-geo-location.rst | 18 ++++++++++-------- .../src/de.po.in | 3 +-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/package/gluon-config-mode-geo-location.rst b/docs/package/gluon-config-mode-geo-location.rst index bde7b7bf..920a1aa8 100644 --- a/docs/package/gluon-config-mode-geo-location.rst +++ b/docs/package/gluon-config-mode-geo-location.rst @@ -2,7 +2,8 @@ gluon-config-mode-geo-location ============================== This package allows the user to set latitude, longitude and optionally altitude -within config mode. There are 2 types of this package. +to be advertised from within the config mode. There are two types of this +package: It is possible to include ``gluon-config-mode-geo-location`` or ``gluon-config-mode-geo-location-with-map`` in the ``site.mk``. @@ -10,14 +11,15 @@ It is possible to include ``gluon-config-mode-geo-location`` or gluon-config-mode-geo-location-with-map --------------------------------------- -The package ``gluon-config-mode-geo-location-with-map`` will additionally add a -map where users can pick a position. This map will only be shown if the users -computer has an internet connection. +This package enhances the config mode by providing users a map that can be used +to pick a position. The map requires an internet connection on the users +computer and will be hidden if there is none. site.conf ^^^^^^^^^ -This option is valid for both package variants. +This option is valid for both ``gluon-config-mode-geo-location`` and +``gluon-config-mode-geo-location-with-map``: config_mode.geo_location.show_altitude \: optional - ``true`` the altitude section in config mode is shown @@ -35,9 +37,9 @@ config_mode.geo_location.map_lat \: optional - represents the default latitude center of the location picker map. - defaults to ``0.0`` -The above 2 options will usually be shown on a factory flashed Router. If a node -is reentered the config mode the map's center will be on the last defined -position. +The map will center to the position defined in map_lat and map_lon, unless a ++location was already defined. The new defined location will become the +new center. config_mode.geo_location.olurl \: optional - ``url`` set an url for OpenStreetMap layers. diff --git a/package/gluon-config-mode-geo-location/src/de.po.in b/package/gluon-config-mode-geo-location/src/de.po.in index 6c9a4cef..d8fee7fe 100644 --- a/package/gluon-config-mode-geo-location/src/de.po.in +++ b/package/gluon-config-mode-geo-location/src/de.po.in @@ -27,8 +27,7 @@ msgstr "" "die Koordinaten händisch zu hinterlegen." #ifdef WITHMAP "Wenn dein Computer mit dem du den Router einrichtest eine Internetverbindung hat, " -"hast du die Möglichkeit auf der unten angezeigten Karte an die Stelle zu klicken, an der " -"der Router stehen wird." +"hast du die Möglichkeit die Position des Routers auf der Karte auszuwählen." #endif "Bitte berücksichtige, dass das Setzen einer Position die Netzwerk Qualität verbessern kann." From 33573168fa7f3757612fdd4e84ee77a095f30232 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Sun, 22 Jul 2018 09:09:23 +0200 Subject: [PATCH 10/21] gluon-config-mode-geo-location-with-map: apply spell change requests --- .../gluon-config-mode-geo-location.rst | 26 ++++++++++++------- .../gluon-config-mode-geo-location/Makefile | 4 +-- .../src/0400-geo-location.lua.in | 7 +++-- .../src/check_site.lua.in | 2 +- .../src/de.po.in | 8 +++--- .../src/fr.po.in | 4 +-- .../src/gluon-config-mode-geo-location.pot.in | 4 +-- 7 files changed, 31 insertions(+), 24 deletions(-) diff --git a/docs/package/gluon-config-mode-geo-location.rst b/docs/package/gluon-config-mode-geo-location.rst index 920a1aa8..8bb86134 100644 --- a/docs/package/gluon-config-mode-geo-location.rst +++ b/docs/package/gluon-config-mode-geo-location.rst @@ -5,9 +5,17 @@ This package allows the user to set latitude, longitude and optionally altitude to be advertised from within the config mode. There are two types of this package: -It is possible to include ``gluon-config-mode-geo-location`` or +It is possible to include **either** ``gluon-config-mode-geo-location`` **or** ``gluon-config-mode-geo-location-with-map`` in the ``site.mk``. +If you want to use ``gluon-config-mode-geo-location-with-map`` together with +the GLUON_FEATURE ``web-wizard`` then you have to exclude +``gluon-config-mode-geo-location``, i.e.: + + GLUON_SITE_PACKAGES += \ + -gluon-config-mode-geo-location \ + gluon-config-mode-geo-location-with-map + gluon-config-mode-geo-location-with-map --------------------------------------- @@ -26,23 +34,23 @@ config_mode.geo_location.show_altitude \: optional - ``false`` the altitude section in config mode is hidden - defaults to ``false`` -All following options are only valid for the package -``gluon-config-mode-geo-location-with-map``. +The remaining options are only valid for the +``gluon-config-mode-geo-location-with-map`` package: config_mode.geo_location.map_lon \: optional - - represents the default longitude center of the location picker map. + - represents the default longitude value to use for the center of the map. - defaults to ``0.0`` config_mode.geo_location.map_lat \: optional - - represents the default latitude center of the location picker map. + - represents the default latitude value to use for the center of the map. - defaults to ``0.0`` The map will center to the position defined in map_lat and map_lon, unless a -+location was already defined. The new defined location will become the +location was already defined. The new defined location will become the new center. -config_mode.geo_location.olurl \: optional - - ``url`` set an url for OpenStreetMap layers. +config_mode.geo_location.openlayers_js_url \: optional + - ``url`` set an URL for OpenStreetMap layers. - defaults to ``http://dev.openlayers.org/OpenLayers.js`` Example:: @@ -51,7 +59,7 @@ Example:: geo_location = { map_lon = 52.951947558, map_lat = 7.844238281, - olurl = 'http://osm.ffnw.de/.static/ol/OpenLayers.js', + openlayers_js_url = 'http://osm.ffnw.de/.static/ol/OpenLayers.js', show_altitude = true, }, }, diff --git a/package/gluon-config-mode-geo-location/Makefile b/package/gluon-config-mode-geo-location/Makefile index 81b1056d..f7840b7e 100644 --- a/package/gluon-config-mode-geo-location/Makefile +++ b/package/gluon-config-mode-geo-location/Makefile @@ -6,13 +6,13 @@ PKG_VERSION:=1 include ../gluon.mk define Package/gluon-config-mode-geo-location - TITLE:=Set geographic location of a node manually and share it. + TITLE:=Set geographic location of a node and share it. CONFLICTS:=+gluon-config-mode-geo-location-with-map DEPENDS:=+gluon-config-mode-core +gluon-node-info endef define Package/gluon-config-mode-geo-location-with-map - TITLE:=Set geographic location of a node manually and share it, optionally show a map if internet is available. + TITLE:=Set geographic location of a node and share it, additionally show a map if internet is available. CONFLICTS:=+gluon-config-mode-geo-location DEPENDS:=+gluon-config-mode-core +gluon-node-info +gluon-web-osm endef diff --git a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in index fafbcb26..9b011f10 100644 --- a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in +++ b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in @@ -25,7 +25,7 @@ return function(form, uci) end local function show_olurl() - return site.config_mode.geo_location.olurl('http://dev.openlayers.org/OpenLayers.js') + return site.config_mode.geo_location.openlayers_js_url('http://dev.openlayers.org/OpenLayers.js') end #endif @@ -36,12 +36,12 @@ return function(form, uci) 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 ' .. + 'If you want the location of your node to be displayed on the map, you may ' .. 'enter its coordinates here. ' .. #ifdef WITHMAP - 'If your PC is connected to the internet you may also click on the map displayed below. ' .. + 'If your PC is connected to the internet you may also select your position on the map displayed below. ' .. #endif @@ -77,7 +77,6 @@ return function(form, uci) local s = form:section(Section, nil, text) - local uci_share_location = uci:get_bool("gluon-node-info", location, "share_location") local geolocation = s:option(ListValue, "geolocation", pkg_i18n.translate("Geo-Location")) diff --git a/package/gluon-config-mode-geo-location/src/check_site.lua.in b/package/gluon-config-mode-geo-location/src/check_site.lua.in index fdab8963..6a64bb22 100644 --- a/package/gluon-config-mode-geo-location/src/check_site.lua.in +++ b/package/gluon-config-mode-geo-location/src/check_site.lua.in @@ -1,6 +1,6 @@ need_boolean(in_site({'config_mode', 'geo_location', 'show_altitude'}), false) #ifdef WITHMAP -need_string(in_site({'config_mode', 'geo_location', 'olurl'}), false) +need_string(in_site({'config_mode', 'geo_location', 'openlayers_js_url'}), false) need_number(in_site({'config_mode', 'geo_location', 'map_lon'}), false) need_number(in_site({'config_mode', 'geo_location', 'map_lat'}), false) #endif diff --git a/package/gluon-config-mode-geo-location/src/de.po.in b/package/gluon-config-mode-geo-location/src/de.po.in index d8fee7fe..441e1f3f 100644 --- a/package/gluon-config-mode-geo-location/src/de.po.in +++ b/package/gluon-config-mode-geo-location/src/de.po.in @@ -15,21 +15,21 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "" -"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 may " "enter its coordinates here. " #ifdef WITHMAP -"If your PC is connected to the internet you may also click on the map displayed below. " +"If your PC is connected to the internet you may also select your position on the map displayed below. " #endif "Please keep in mind setting a location can also enhance the network quality." msgstr "" "Um deinen Router auf der Karte anzeigen zu können, benötigen wir seine " "Koordinaten. Hier hast du die Möglichkeit, " -"die Koordinaten händisch zu hinterlegen." +"die Koordinaten von Hand einzutragen." #ifdef WITHMAP "Wenn dein Computer mit dem du den Router einrichtest eine Internetverbindung hat, " "hast du die Möglichkeit die Position des Routers auf der Karte auszuwählen." #endif -"Bitte berücksichtige, dass das Setzen einer Position die Netzwerk Qualität verbessern kann." +"Bitte berücksichtige, dass das Setzen einer Position die Netzwerkqualität verbessern kann." msgid "Geo-Location" msgstr "Geo-Position" diff --git a/package/gluon-config-mode-geo-location/src/fr.po.in b/package/gluon-config-mode-geo-location/src/fr.po.in index 02c9fa47..91726dae 100644 --- a/package/gluon-config-mode-geo-location/src/fr.po.in +++ b/package/gluon-config-mode-geo-location/src/fr.po.in @@ -15,10 +15,10 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "" -"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 may " "enter its coordinates here. " #ifdef WITHMAP -"If your PC is connected to the internet you may also click on the map displayed below. " +"If your PC is connected to the internet you may also select your position on the map displayed below. " #endif "Please keep in mind setting a location can also enhance the network quality." msgstr "" diff --git a/package/gluon-config-mode-geo-location/src/gluon-config-mode-geo-location.pot.in b/package/gluon-config-mode-geo-location/src/gluon-config-mode-geo-location.pot.in index fa850916..abdab55d 100644 --- a/package/gluon-config-mode-geo-location/src/gluon-config-mode-geo-location.pot.in +++ b/package/gluon-config-mode-geo-location/src/gluon-config-mode-geo-location.pot.in @@ -2,10 +2,10 @@ msgid "" msgstr "Content-Type: text/plain; charset=UTF-8" msgid "" -"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 may " "enter its coordinates here. " #ifdef WITHMAP -"If your PC is connected to the internet you may also click on the map displayed below. " +"If your PC is connected to the internet you may also select your position on the map displayed below. " #endif "Please keep in mind setting a location can also enhance the network quality." msgstr "" From 6729624b685a670491f4c79e943910f462c22561 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Sun, 22 Jul 2018 15:11:27 +0200 Subject: [PATCH 11/21] gluon-config-mode-geo-location-with-map: add site.conf zoom parameter --- .../gluon-config-mode-geo-location.rst | 31 ++++++++++++------- .../src/0400-geo-location.lua.in | 12 ++++--- .../src/check_site.lua.in | 7 +++-- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/docs/package/gluon-config-mode-geo-location.rst b/docs/package/gluon-config-mode-geo-location.rst index 8bb86134..2015bbcd 100644 --- a/docs/package/gluon-config-mode-geo-location.rst +++ b/docs/package/gluon-config-mode-geo-location.rst @@ -37,29 +37,36 @@ config_mode.geo_location.show_altitude \: optional The remaining options are only valid for the ``gluon-config-mode-geo-location-with-map`` package: -config_mode.geo_location.map_lon \: optional +config_mode.geo_location.map.lon \: optional - represents the default longitude value to use for the center of the map. - defaults to ``0.0`` -config_mode.geo_location.map_lat \: optional +config_mode.geo_location.map.lat \: optional - represents the default latitude value to use for the center of the map. - defaults to ``0.0`` -The map will center to the position defined in map_lat and map_lon, unless a +The map will center to the position defined in **lat** and **lon**, unless a location was already defined. The new defined location will become the new center. -config_mode.geo_location.openlayers_js_url \: optional +config_mode.geo_location.map.zoom \: optional + - Natural number between ``0-17`` for the zoom level of the map. + - defaults to ``12`` + +config_mode.geo_location.map.openlayers_js_url \: optional - ``url`` set an URL for OpenStreetMap layers. - defaults to ``http://dev.openlayers.org/OpenLayers.js`` Example:: - config_mode = { - geo_location = { - map_lon = 52.951947558, - map_lat = 7.844238281, - openlayers_js_url = 'http://osm.ffnw.de/.static/ol/OpenLayers.js', - show_altitude = true, - }, - }, + config_mode = { + geo_location = { + map = { + lon = 52.951947558, + lat = 7.844238281, + zoom = 12, + openlayers_js_url = 'http://osm.ffnw.de/.static/ol/OpenLayers.js', + }, + show_altitude = true, + }, + }, diff --git a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in index 9b011f10..25d3ffbc 100644 --- a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in +++ b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in @@ -14,18 +14,22 @@ return function(form, uci) if uci_longitude ~= nil then return uci_longitude end - return site.config_mode.geo_location.map_lon(0.0) + return site.config_mode.geo_location.map.lon(0.0) end local function show_lat() if uci_latitude ~= nil then return uci_latitude end - return site.config_mode.geo_location.map_lat(0.0) + return site.config_mode.geo_location.map.lat(0.0) + end + + local function site_zoom() + return site.config_mode.geo_location.map.zoom(12) end local function show_olurl() - return site.config_mode.geo_location.openlayers_js_url('http://dev.openlayers.org/OpenLayers.js') + return site.config_mode.geo_location.map.openlayers_js_url('http://dev.openlayers.org/OpenLayers.js') end #endif @@ -58,7 +62,7 @@ return function(form, uci) +
]] #endif From cc5e447c036191d120899009f63add08c30bab4c Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Thu, 26 Jul 2018 07:37:31 +0200 Subject: [PATCH 16/21] gluon-config-mode-geo-location-with-map: map max zoom fi position present --- .../src/0400-geo-location.lua.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in index 9fc3ef57..b5b985a9 100644 --- a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in +++ b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in @@ -25,6 +25,9 @@ return function(form, uci) end local function site_zoom() + if uci_longitude ~= nil and uci_latitude ~= nil then + return 18 + end return site.config_mode.geo_location.map.zoom(12) end From f1dd0c5f713b76f086ad62e27cea98c5bd9ba125 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Fri, 27 Jul 2018 21:38:55 +0200 Subject: [PATCH 17/21] gluon-config-mode-geo-location-with-map: load map asyncron to don't block the formular --- .../src/0400-geo-location.lua.in | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in index b5b985a9..66bcd482 100644 --- a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in +++ b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in @@ -67,18 +67,22 @@ return function(form, uci) -
]] From 3066c0c7ad03b88fc7c39d8a734f2b07df0a862b Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Sat, 28 Jul 2018 10:33:05 +0200 Subject: [PATCH 18/21] gluon-config-mode-geo-location-with-map: refactor if condition to oneliner --- .../src/0400-geo-location.lua.in | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in index 66bcd482..9163a77c 100644 --- a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in +++ b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in @@ -74,11 +74,7 @@ return function(form, uci) window.addEventListener("load", showMap, false); var lpm=document.getElementById("locationPickerMap"); setInterval(function() { - if(false !== findObj("longitude")) { - lpm.style.display="block"; - }else{ - lpm.style.display="none"; - } + !1 !== findObj("longitude") ? lpm.style.display = "block" : lpm.style.display = "none"; }, 100); }; document.head.appendChild(openLayerSrc); From 1b0734382a946dd91bd3dbfd2c4b42beab77a96c Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Sat, 4 Aug 2018 21:53:19 +0200 Subject: [PATCH 19/21] gluon-config-mode-geo-location-with-map: add copyright link and use SSL links --- docs/package/gluon-config-mode-geo-location.rst | 2 +- .../src/0400-geo-location.lua.in | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/package/gluon-config-mode-geo-location.rst b/docs/package/gluon-config-mode-geo-location.rst index 6ca99850..ea55e1f7 100644 --- a/docs/package/gluon-config-mode-geo-location.rst +++ b/docs/package/gluon-config-mode-geo-location.rst @@ -55,7 +55,7 @@ config_mode.geo_location.map.zoom \: optional config_mode.geo_location.map.openlayers_js_url \: optional - ``url`` set an URL for OpenStreetMap layers. - - defaults to ``http://dev.openlayers.org/OpenLayers.js`` + - defaults to ``https://openlayers.org/api/OpenLayers.js`` Example:: diff --git a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in index 9163a77c..65e1c41c 100644 --- a/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in +++ b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in @@ -32,7 +32,7 @@ return function(form, uci) end local function show_olurl() - return site.config_mode.geo_location.map.openlayers_js_url('http://dev.openlayers.org/OpenLayers.js') + return site.config_mode.geo_location.map.openlayers_js_url('https://openlayers.org/api/OpenLayers.js') end #endif @@ -63,7 +63,11 @@ return function(form, uci) text = text .. [[
- +