diff --git a/gluon_patches/0006-gluon-config-mode-geo-location-add-subpackages.patch b/gluon_patches/0006-gluon-config-mode-geo-location-add-subpackages.patch new file mode 100644 index 0000000000000000000000000000000000000000..93daa0d27de0e46067c66aa9274aee0c2833811a --- /dev/null +++ b/gluon_patches/0006-gluon-config-mode-geo-location-add-subpackages.patch @@ -0,0 +1,989 @@ +From 6df4101b27776f6013116853945e156e24bf4fa4 Mon Sep 17 00:00:00 2001 +From: Jan-Tarek Butt <tarek@ring0.de> +Date: Sat, 19 Aug 2017 17:25:15 +0200 +Subject: [PATCH] gluon-config-mode-geo-location: add subpackages + + - add gluon-config-mode-geo-location-with-map + - add gluon-config-mode-geo-location-with-geloc + - add gluon-config-mode-geo-location-with-geloc-map + * gluon-config-mode-geo-location: add js for map + * gluon-config-mode-geo-location: add cpp to generate lua file + * gluon-config-mode-geo-location: wizardgen.cpp add withspace + * gluon-config-mode-geo-location: add checkgen.cpp + * gluon-config-mode-geo-location: add i18ndefaultgen.cpp + * gluon-config-mode-geo-location: rm check_site.lua + * gluon-config-mode-geo-location: rm gluon-config-mode-geo-location.pot + * gluon-config-mode-geo-location: add i18ndegen.cpp + * gluon-config-mode-geo-location: rm i18n dir + * gluon-config-mode-geo-location: i18ndefaultgen.cpp fix typo + * gluon-config-mode-geo-location: add i18ndegen.cpp + * gluon-config-mode-geo-location: wizardgen.cpp fix typo + * gluon-config-mode-geo-location: add i18nfrgen.cpp + * gluon-config-mode-geo-location: add src/Makefile + * Add preprocessor prepared 0400-geo-location.lua.in file + * add preprocessor prepared check_site.lua.in file + * add preprocessor prepared de.po.in file + * add preprocessoer prepared fr.po.in file + * add preprocessor prepared gluon-config-mode-geo-location.pot.in file + * gluon-node-info: change default conf set sharelocation to 1 + * delete cpp files + * 0400-geo-location.lua: show last selected pos on map if router get reconfigured + * gluon-config-mode-geo-location: fix translation + * gluon-config-mode-geo-location: prepare Makefile to generate pkg + * gluon-config-mode-geo-location prepare Makefile to generate pkg files + * gluon-config-mode-geo-location: rm luasrc dir because of pkg generating + * Prepare Makefile for each subpackage + * gluon-config-mode-geo-location change Makefile: + - add gluon-geolocator to conflic for gluon-config-mode-geo-location + - add gluon-geolocator to conflic for gluon-config-mode-geo-location-with-map +--- + package/gluon-config-mode-geo-location/Makefile | 132 ++++++++++++- + .../gluon-config-mode-geo-location/check_site.lua | 3 - + package/gluon-config-mode-geo-location/i18n/de.po | 30 --- + package/gluon-config-mode-geo-location/i18n/fr.po | 30 --- + .../i18n/gluon-config-mode-geo-location.pot | 19 -- + .../gluon-config-mode-geo-location/jssrc/build.js | 6 + + .../jssrc/src/osm.js | 70 +++++++ + .../gluon/config-mode/wizard/0400-geo-location.lua | 64 ------ + .../src/0400-geo-location.lua.in | 218 +++++++++++++++++++++ + .../src/check_site.lua.in | 8 + + .../gluon-config-mode-geo-location/src/de.po.in | 86 ++++++++ + .../gluon-config-mode-geo-location/src/fr.po.in | 83 ++++++++ + .../src/gluon-config-mode-geo-location.pot.in | 53 +++++ + .../files/etc/config/gluon-node-info | 2 +- + 14 files changed, 651 insertions(+), 153 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 + create mode 100644 package/gluon-config-mode-geo-location/jssrc/build.js + create mode 100644 package/gluon-config-mode-geo-location/jssrc/src/osm.js + 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 af523f09..b47d2a86 100644 +--- a/package/gluon-config-mode-geo-location/Makefile ++++ b/package/gluon-config-mode-geo-location/Makefile +@@ -8,35 +8,155 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + include ../gluon.mk + + PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) ++PKG_BUILD_DEPENDS:=node/host + ++RJS_VERSION:=2.1.10 ++RJS:=r-$(RJS_VERSION).js ++define Download/rjs ++ FILE:=$(RJS) ++ URL:=http://requirejs.org/docs/release/$(RJS_VERSION) ++ URL_FILE:=r.js ++ HASH:=d0b7cfd962a7f8ac52a5d528df486341eed856609d9c75fa2566a32900f5b143 ++endef + + define Package/gluon-config-mode-geo-location + SECTION:=gluon + CATEGORY:=Gluon +- TITLE:=Set geographic location of a node +- DEPENDS:=gluon-config-mode-core-virtual +gluon-node-info ++ 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 +gluon-geolocator ++ DEPENDS:=+gluon-config-mode-core +gluon-node-info ++endef ++ ++define Package/gluon-config-mode-geo-location-with-map ++ SECTION:=gluon ++ CATEGORY:=Gluon ++ 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 +gluon-geolocator ++ DEPENDS:=+gluon-config-mode-core +gluon-node-info + endef + ++define Package/gluon-config-mode-geo-location-with-geloc ++ SECTION:=gluon ++ CATEGORY:=Gluon ++ 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 ++ SECTION:=gluon ++ CATEGORY:=Gluon ++ 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 ++endef ++ ++$(eval $(call Download,rjs)) ++ + define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) ++ $(CP) $(DL_DIR)/$(RJS) $(PKG_BUILD_DIR)/r.js + endef + + define Build/Configure ++ $(CP) ./src/* $(PKG_BUILD_DIR)/ ++ $(CP) ./jssrc/* $(PKG_BUILD_DIR)/ ++ ++ $(INSTALL_DIR) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location/luasrc/lib/gluon/config-mode/wizard/ ++ $(INSTALL_DIR) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location/i18n/ ++ ++ $(INSTALL_DIR) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/luasrc/lib/gluon/config-mode/wizard/ ++ $(INSTALL_DIR) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/i18n/ ++ ++ $(INSTALL_DIR) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc/luasrc/lib/gluon/config-mode/wizard/ ++ $(INSTALL_DIR) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc/i18n/ ++ ++ $(INSTALL_DIR) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc-map/luasrc/lib/gluon/config-mode/wizard/ ++ $(INSTALL_DIR) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-geloc-map/i18n/ + endef + + define Build/Compile +- $(call GluonBuildI18N,gluon-config-mode-geo-location,i18n) +- $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) ++ $(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/de.po ++ $(CC) -E -x c -P $(PKG_BUILD_DIR)/fr.po.in -o $(PKG_BUILD_DIR)/gluon-config-mode-geo-location/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/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/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/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/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/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/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/) ++ ++ cd $(PKG_BUILD_DIR) && \ ++ node r.js -o build.js + endef + + define Package/gluon-config-mode-geo-location/install +- $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ ++ $(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/web/www/static/gluon/ ++ $(INSTALL_DATA) $(PKG_BUILD_DIR)/osm.js $(1)/lib/gluon/web/www/static/gluon/ ++ $(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/web/www/static/gluon/ ++ $(INSTALL_DATA) $(PKG_BUILD_DIR)/osm.js $(1)/lib/gluon/web/www/static/gluon/ ++ $(call GluonInstallI18N,gluon-config-mode-geo-location-with-geloc-map,$(1)) ++endef ++ + define Package/gluon-config-mode-geo-location/postinst + #!/bin/sh +-$(call GluonCheckSite,check_site.lua) ++$(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 BuildPackage,gluon-config-mode-geo-location)) ++$(eval $(call BuildPackage,gluon-config-mode-geo-location-with-map)) ++$(eval $(call BuildPackage,gluon-config-mode-geo-location-with-geloc)) ++$(eval $(call BuildPackage,gluon-config-mode-geo-location-with-geloc-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 509226fe..00000000 +--- a/package/gluon-config-mode-geo-location/check_site.lua ++++ /dev/null +@@ -1,3 +0,0 @@ +-if need_table('config_mode', nil, false) and need_table('config_mode.geo_location', nil, false) then +- need_boolean('config_mode.geo_location.show_altitude', false) +-end +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 <martin@darmstadt.freifunk.net>\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 <tqbs@airmail.cc>\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/jssrc/build.js b/package/gluon-config-mode-geo-location/jssrc/build.js +new file mode 100644 +index 00000000..146bbd10 +--- /dev/null ++++ b/package/gluon-config-mode-geo-location/jssrc/build.js +@@ -0,0 +1,6 @@ ++({ ++ baseUrl: "src", ++ include: "osm.js", ++ optimize: "uglify2", ++ out: "osm.js", ++}) +diff --git a/package/gluon-config-mode-geo-location/jssrc/src/osm.js b/package/gluon-config-mode-geo-location/jssrc/src/osm.js +new file mode 100644 +index 00000000..978d859f +--- /dev/null ++++ b/package/gluon-config-mode-geo-location/jssrc/src/osm.js +@@ -0,0 +1,70 @@ ++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) ++} ++ +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 4d7fec01..00000000 +--- a/package/gluon-config-mode-geo-location/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua ++++ /dev/null +@@ -1,64 +0,0 @@ +-return function(form, uci) +- local site = require 'gluon.site_config' +- +- local location = uci:get_first("gluon-node-info", "location") +- +- local function show_altitude() +- if ((site.config_mode or {}).geo_location or {}).show_altitude ~= false then +- return true +- end +- +- return uci:get_bool("gluon-node-info", location, "altitude") +- end +- +- local text = 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 .. ' ' .. translate("gluon-config-mode:altitude-help") +- end +- +- local s = form:section(Section, nil, text) +- +- local o +- +- local share_location = s:option(Flag, "location", 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", translate("Latitude"), 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", translate("Longitude"), 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", translate("gluon-config-mode:altitude-label"), 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) +- if data then +- uci:set("gluon-node-info", location, "altitude", data) +- else +- uci:delete("gluon-node-info", location, "altitude") +- end +- 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..3215aa4e +--- /dev/null ++++ b/package/gluon-config-mode-geo-location/src/0400-geo-location.lua.in +@@ -0,0 +1,218 @@ ++return function(form, uci) ++ 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 = translate( ++ 'If you want the location of your node to be displayed on the map, you can ' .. ++#ifdef WITHGELOC ++ 'set an automatically localization of your router or ' .. ++#endif ++ '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 .. ' ' .. translate("gluon-config-mode:altitude-help") ++ end ++ ++#ifdef WITHMAP ++ ++ text = text .. [[ ++ <div id="locationPickerMap" style="width:100%; height:300px; display: none;"></div> ++ <script src="]] .. show_olurl() .. [["></script> ++ <script src="/static/gluon/osm.js"></script> ++ <script> ++ var latitude=]] .. show_lon() .. ",longitude=" .. show_lat() .. [[; ++ document.addEventListener("DOMContentLoaded", showMap, false); ++ setInterval(function() { ++ if(false !== findObj("longitude")) { ++ document.getElementById("locationPickerMap").style.display="block"; ++ }else{ ++ document.getElementById("locationPickerMap").style.display="none"; ++ } ++ }, 1000); ++ </script> ++ ]] ++ ++#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", translate("Geo-Location")) ++#ifdef WITHGELOC ++ geolocation:value("automatic", translate("Automatic (geolocator)")) ++ geolocation:value("auto_static", translate("Automatic & Static")) ++#endif ++ geolocation:value("static", translate("Static location")) ++ geolocation:value("none", translate("Disabled")) ++#ifdef WITHGELOC ++ local auto_location = uci:get_bool("geolocator", "settings", "auto_location") ++ local static_location = uci:get_bool("geolocator", "settings", "static_location") ++ if auto_location == false and static_location == false then ++#else ++ if uci_latitude == nil and uci_longitude == nil and uci_share_location == false then ++#endif ++ geolocation.default = "none" ++#ifndef WITHGELOC ++ else ++ geolocation.default = "static" ++#endif ++ end ++#ifdef WITHGELOC ++ if auto_location == true and static_location == true then ++ geolocation.default = "auto_static" ++ end ++ if auto_location == false and static_location == true then ++ geolocation.default = "static" ++ end ++#endif ++ ++ local share_location = s:option(Flag, "sharelocation", translate("Share your location to see your router on the map")) ++ share_location.default = uci_share_location ++#ifdef WITHGELOC ++ share_location:depends(geolocation, "automatic") ++ share_location:depends(geolocation, "auto_static") ++#endif ++ share_location:depends(geolocation, "static") ++ ++#ifdef WITHGELOC ++ --[[ -- Currently not available ++ o = s:option(DummyValue, "automatic_disc", " ", translatef("Automaticaly location service over wifi.")) ++ o:depends(geolocation, "automatic") ++ o.description = translatef("Automaticaly location service over wifi.") ++ --]] ++ ++ local interval = s:option(Value, "interval", translate("Interval in minutes"), translatef("Set refresh interval")) ++ interval.default = uci:get_first("geolocator", "settings", "refresh_interval") ++ interval:depends(geolocation, "automatic") ++ interval:depends(geolocation, "auto_static") ++ interval.datatype = "uinteger" ++#endif ++ ++ local latitude = s:option(Value, "latitude", translate("Latitude"), translatef("e.g. %s", "50.364931")) ++ latitude.default = uci_latitude ++ latitude:depends(geolocation, "static") ++#ifdef WITHGELOC ++ latitude:depends(geolocation, "auto_static") ++#endif ++ latitude.datatype = "float" ++ ++ local longitude = s:option(Value, "longitude", translate("Longitude"), translatef("e.g. %s", "7.606417")) ++ longitude.default = uci_longitude ++ longitude:depends(geolocation, "static") ++#ifdef WITHGELOC ++ longitude:depends(geolocation, "auto_static") ++#endif ++ longitude.datatype = "float" ++ ++ local altitude; ++ if show_altitude() then ++ altitude = s:option(Value, "altitude", translate("gluon-config-mode:altitude-label"), translatef("e.g. %s", "11.51")) ++ altitude.default = uci:get("gluon-node-info", location, "altitude") ++ altitude:depends(geolocation, "static") ++#ifdef WITHGELOC ++ altitude:depends(geolocation, "auto_static") ++#endif ++ altitude.datatype = "float" ++ altitude.optional = true ++ end ++ function geolocation:write(data) ++#ifdef WITHGELOC ++ if data == "automatic" or data == "auto_static" then ++ uci:set("geolocator", "settings", "auto_location", 1) ++ if interval.data ~= nil and tonumber(interval.data) >= 1 and tonumber(interval.data) <= 43200 then ++ uci:set("geolocator", "settings", "refresh_interval", interval.data) ++ elseif tonumber(interval.data) > 43200 then ++ uci:set("geolocator", "settings", "refresh_interval", 43200) ++ end ++ else ++ uci:set("geolocator", "settings", "auto_location", 0) ++ end ++ if data == "static" or data == "auto_static" then ++ uci:set("geolocator", "settings", "static_location", 1) ++#else ++ if data == "static" then ++#endif ++ 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 ++#ifdef WITHGELOC ++ else ++ uci:set("geolocator", "settings", "static_location", 0) ++#endif ++ 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) ++#ifdef WITHGELOC ++ uci:set("geolocator", "settings", "auto_location", 0) ++#endif ++ else ++ uci:set("gluon-node-info", location, "share_location", share_location.data) ++ end ++ end ++#ifdef WITHGELOC ++ return {'gluon-node-info', 'geolocator'} ++#else ++ return {'gluon-node-info'} ++#endif ++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..a378e58f +--- /dev/null ++++ b/package/gluon-config-mode-geo-location/src/check_site.lua.in +@@ -0,0 +1,8 @@ ++if need_table('config_mode', nil, false) and need_table('config_mode.geo_location', nil, false) then ++ need_boolean('config_mode.geo_location.show_altitude', false) ++#ifdef WITHMAP ++ need_string('config_mode.geo_location.olurl', false) ++ need_number('config_mode.geo_location.map_lon', false) ++ need_number('config_mode.geo_location.map_lat', false) ++#endif ++end +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..0393e3d9 +--- /dev/null ++++ b/package/gluon-config-mode-geo-location/src/de.po.in +@@ -0,0 +1,86 @@ ++msgid "" ++msgstr "" ++#ifdef WITHMAP ++#ifdef WITHGELOC ++"Project-Id-Version: gluon-config-mode-geo-location-with-geloc-map\n" ++#else ++"Project-Id-Version: gluon-config-mode-geo-location-with-map\n" ++#endif ++#else ++#ifdef WITHGELOC ++"Project-Id-Version: gluon-config-mode-geo-location-with-geloc\n" ++#else ++"Project-Id-Version: gluon-config-mode-geo-location\n" ++#endif ++#endif ++"PO-Revision-Date: 2017-08-22 12:14+0100\n" ++"Last-Translator: Jan-Tarek Butt <tarek@ring0.de>\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 " ++#ifdef WITHGELOC ++"set an automatically localization of your router or " ++#endif ++"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, " ++#ifdef WITHGELOC ++"das der Router seine Position automatisch bestimmt. Eine andere Option ist, " ++#endif ++"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" ++ ++#ifdef WITHGELOC ++msgid "Automatic (geolocator)" ++msgstr "Automatisch (geolocator)" ++#endif ++ ++msgid "Static location" ++msgstr "Manuelle Position" ++ ++#ifdef WITHGELOC ++msgid "Automatic & Static" ++msgstr "Automatisch & Manuell" ++#endif ++ ++msgid "Disabled" ++msgstr "Deaktiviert" ++ ++msgid "Share your location to see your router on the map" ++msgstr "Position für die Karte freigeben" ++ ++#ifdef WITHGELOC ++msgid "Interval in minutes" ++msgstr "Intervall in Minuten" ++ ++msgid "Set refresh interval" ++msgstr "Setze aktuallisierungs Intervall" ++#endif ++ ++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..25de07b6 +--- /dev/null ++++ b/package/gluon-config-mode-geo-location/src/fr.po.in +@@ -0,0 +1,83 @@ ++msgid "" ++msgstr "" ++#ifdef WITHMAP ++#ifdef WITHGELOC ++"Project-Id-Version: gluon-config-mode-geo-location-with-geloc-map\n" ++#else ++"Project-Id-Version: gluon-config-mode-geo-location-with-map\n" ++#endif ++#else ++#ifdef WITHGELOC ++"Project-Id-Version: gluon-config-mode-geo-location-with-geloc\n" ++#else ++"Project-Id-Version: gluon-config-mode-geo-location\n" ++#endif ++#endif ++"PO-Revision-Date: 2017-08-22 12:14+0100\n" ++"Last-Translator: Jan-Tarek Butt <tarek@ring0.de>\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 " ++#ifdef WITHGELOC ++"set an automatically localization of your router or " ++#endif ++"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 " ++#ifdef WITHGELOC ++"définir une localisation automatique de votre routeur ou " ++#endif ++"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" ++ ++#ifdef WITHGELOC ++msgid "Automatic (geolocator)" ++msgstr "Automatique (geolocator)" ++#endif ++ ++msgid "Static location" ++msgstr "position manuelle" ++ ++#ifdef WITHGELOC ++msgid "Automatic & Static" ++msgstr "Automatique et manuel" ++#endif ++ ++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" ++ ++#ifdef WITHGELOC ++msgid "Interval in minutes" ++msgstr "Intervalle en minutes" ++ ++msgid "Set refresh interval" ++msgstr "Définir l'intervalle" ++#endif ++ ++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..799afc9c +--- /dev/null ++++ b/package/gluon-config-mode-geo-location/src/gluon-config-mode-geo-location.pot.in +@@ -0,0 +1,53 @@ ++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 " ++#ifdef WITHGELOC ++"set an automatically localization of your router or " ++#endif ++"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 "" ++ ++#ifdef WITHGELOC ++msgid "Automatic (geolocator)" ++msgstr "" ++#endif ++ ++msgid "Static location" ++msgstr "" ++ ++#ifdef WITHGELOC ++msgid "Automatic & Static" ++msgstr "" ++#endif ++ ++msgid "Disabled" ++msgstr "" ++ ++msgid "Share your location to see your router on the map" ++msgstr "" ++ ++#ifdef WITHGELOC ++msgid "Interval in minutes" ++msgstr "" ++ ++msgid "Set refresh interval" ++msgstr "" ++#endif ++ ++msgid "Latitude" ++msgstr "" ++ ++msgid "Longitude" ++msgstr "" ++ ++msgid "e.g. %s" ++msgstr "" +diff --git a/package/gluon-node-info/files/etc/config/gluon-node-info b/package/gluon-node-info/files/etc/config/gluon-node-info +index 8f6f472f..70026b5c 100644 +--- a/package/gluon-node-info/files/etc/config/gluon-node-info ++++ b/package/gluon-node-info/files/etc/config/gluon-node-info +@@ -1,5 +1,5 @@ + config location +- option share_location '0' ++ option share_location '1' + + config owner + +-- +2.15.1 +