-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gluon-config-mode-geo-location-with-map: integrate a location picker map #1484
Changes from 20 commits
4d2a17e
dfeafcd
ad18721
d22d44c
aae2b77
db6cf7a
0218bb6
cfa68a4
70052f2
3357316
6729624
097a8ac
1f576ae
1ebdfbb
7abfeaa
cc5e447
f1dd0c5
3066c0c
1b07343
28267af
94dd1da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
gluon-config-mode-geo-location | ||
============================== | ||
|
||
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 **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 | ||
--------------------------------------- | ||
|
||
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 ``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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. show altitude field in config mode |
||
- ``false`` the altitude section in config mode is hidden | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hide altitude field in config mode |
||
- defaults to ``false`` | ||
|
||
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 value to use for the center of the map. | ||
- defaults to ``0.0`` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. set the default to the center of europe instead of the Golf of Guinea. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's the center of the wold because this project ins not only designed for Germany or Europe. I think some people form US use Gluon as well. So 0.0/0.0 is the best in my opinion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another approach: treat missing value as nil and don't show the map. |
||
|
||
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 **lat** and **lon**, unless a | ||
location was already defined. The new defined location will become the | ||
new center. | ||
|
||
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 ``https://openlayers.org/api/OpenLayers.js`` | ||
|
||
Example:: | ||
|
||
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, | ||
}, | ||
}, |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,82 @@ 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 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 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 | ||
|
||
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 GluonBuildI18N | ||
mkdir -p $(1) | ||
for lang in $$(GLUON_ENABLED_LANGS); do \ | ||
if [ -e $(1)/$$$$lang.po ]; then \ | ||
rm -f $(1)/$$$$lang.lmo; \ | ||
po2lmo $(1)/$$$$lang.po $(1)/$$$$lang.lmo; \ | ||
fi; \ | ||
done | ||
endef | ||
|
||
define GluonInstallI18N | ||
$(INSTALL_DIR) $(1)/lib/gluon/web/i18n | ||
for lang in $$(GLUON_ENABLED_LANGS); do \ | ||
if [ -e $(2)/i18n/$$$$lang.lmo ]; then \ | ||
$(INSTALL_DATA) $(2)/i18n/$$$$lang.lmo $(1)/lib/gluon/web/i18n/$(PKG_NAME).$$$$lang.lmo; \ | ||
fi; \ | ||
done | ||
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 GluonSrcDiet,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location/luasrc,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location/luadest/) | ||
$(call GluonBuildI18N,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location/i18n) | ||
|
||
$(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 GluonSrcDiet,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/luasrc,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/luadest/) | ||
$(call GluonBuildI18N,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map/i18n) | ||
endef | ||
|
||
define Package/gluon-config-mode-geo-location/install | ||
$(CP) $(PKG_BUILD_DIR)/gluon-config-mode-geo-location/luadest/* $(1)/ | ||
$(call GluonInstallI18N,$(1),$(PKG_BUILD_DIR)/gluon-config-mode-geo-location) | ||
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,$(1),$(PKG_BUILD_DIR)/gluon-config-mode-geo-location-with-map) | ||
endef | ||
|
||
define Package/gluon-config-mode-geo-location/postinst | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. some parts of your Makefile could be obsolete because of the treewide changes to package makefiles which were made in March&April. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have already check that. It is necessary to create thous defines in the Makefile because of the changing directories. |
||
#!/bin/sh | ||
$(call GluonCheckSite,$(PKG_BUILD_DIR)/gluon-config-mode-geo-location/check_site.lua) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation missing, or is the shebang preventing that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the shebang prevents indentation here, like in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems necessary. I just took that from an older gluon make file. Also it is defined similar in gluon.mk. I think it has something to do wether it will interpreted as Makefile command (with Indentation) or not. |
||
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is obsolete then |
||
endef | ||
|
||
$(eval $(call BuildPackageGluon,gluon-config-mode-geo-location)) | ||
$(eval $(call BuildPackageGluon,gluon-config-mode-geo-location-with-map)) |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I Think this is redundancy in the gluon doc ... but I'll include it anyway.
applied