-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gluon-config-mode-geo-location-osm: add OSM-based location picker
gluon-config-mode-geo-location-osm extends the gluon-config-mode-geo-location with a location picker based on OpenStreetMaps. Based-on-patch-by: Jan-Tarek Butt <tarek@ring0.de>
- Loading branch information
Showing
10 changed files
with
130 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=gluon-config-mode-geo-location-osm | ||
PKG_VERSION:=1 | ||
|
||
include ../gluon.mk | ||
|
||
define Package/gluon-config-mode-geo-location-osm | ||
TITLE:=Set geographic location of a node (map support) | ||
DEPENDS:=+gluon-config-mode-geo-location +gluon-web-osm | ||
endef | ||
|
||
define Package/gluon-config-mode-geo-location-osm/install | ||
$(Gluon/Build/Install) | ||
|
||
$(INSTALL_DIR) $(1)/lib/gluon/config-mode/www/static/ | ||
$(LN) /lib/gluon/web/www/static/gluon-web-osm.js $(1)/lib/gluon/config-mode/www/static/ | ||
endef | ||
|
||
$(eval $(call BuildPackageGluon,gluon-config-mode-geo-location-osm)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
need_number(in_site({'config_mode', 'geo_location', 'osm', 'center', 'lon'})) | ||
need_number(in_site({'config_mode', 'geo_location', 'osm', 'center', 'lat'})) | ||
need_number(in_site({'config_mode', 'geo_location', 'osm', 'zoom'}), false) | ||
need_string(in_site({'config_mode', 'geo_location', 'osm', 'openlayers_url'}), false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
msgid "" | ||
msgstr "" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Project-Id-Version: gluon-config-mode-geo-location\n" | ||
"Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\n" | ||
"Language-Team: German\n" | ||
"Language: de\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
msgid "" | ||
"You may also select the position on the map displayed below if your computer " | ||
"is connected to the internet at the moment." | ||
msgstr "" | ||
"Wenn dein Computer aktuell mit dem Internet verbunden ist, kann die Position " | ||
"auch auf der hier angezeigten Karte ausgewählt werden." |
7 changes: 7 additions & 0 deletions
7
package/gluon-config-mode-geo-location-osm/i18n/gluon-config-mode-geo-location-osm.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
msgid "" | ||
msgstr "Content-Type: text/plain; charset=UTF-8" | ||
|
||
msgid "" | ||
"You may also select the position on the map displayed below if your computer " | ||
"is connected to the internet at the moment." | ||
msgstr "" |
34 changes: 34 additions & 0 deletions
34
...on-config-mode-geo-location-osm/luasrc/usr/lib/lua/gluon/config-mode/geo-location-osm.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
local osm = require 'gluon.web.model.osm' | ||
local site = require 'gluon.site' | ||
|
||
local tonumber = tonumber | ||
|
||
|
||
module 'gluon.config-mode.geo-location-osm' | ||
|
||
MapValue = osm.MapValue | ||
|
||
function help(i18n) | ||
local pkg_i18n = i18n 'gluon-config-mode-geo-location-osm' | ||
return pkg_i18n.translate( | ||
'You may also select the position on the map displayed below if your computer is connected to the internet at the moment.' | ||
) | ||
end | ||
|
||
function options(lon, lat) | ||
local config = site.config_mode.geo_location.osm | ||
|
||
local map_options = { | ||
openlayers_url = config.openlayers_url(), | ||
zoom = config.zoom(12), | ||
pos = config.center(), | ||
} | ||
|
||
if lon and lat then | ||
map_options.zoom = 18 | ||
map_options.pos = { lon = tonumber(lon), lat = tonumber(lat) } | ||
map_options.set = true | ||
end | ||
|
||
return map_options | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters