Skip to content
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

Closed
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4d2a17e
gluon-config-mode-geo-location-with-map: integrate a location picker …
2tata Jul 18, 2018
dfeafcd
gluon-config-mode-geo-location: refactor lua code
2tata Jul 18, 2018
ad18721
gluon-config-mode-geo-location: load only on internet conection and d…
2tata Jul 18, 2018
d22d44c
package/gluon-config-mode-geo-location/Makefil: manualy -> manually
2tata Jul 19, 2018
aae2b77
package/gluon-config-mode-geo-location/Makefile: and is to 'internet…
2tata Jul 19, 2018
db6cf7a
package/gluon-config-mode-geo-location/src/de.po.in: fix spelling
2tata Jul 19, 2018
0218bb6
gluon-config-mode-geo-location-with-map: add package doc
2tata Jul 20, 2018
cfa68a4
gluon-config-mode-geo-location-with-map: fix spelling and indentation
2tata Jul 20, 2018
70052f2
gluon-config-mode-geo-location-with-map: fix spelling and grammar
2tata Jul 21, 2018
3357316
gluon-config-mode-geo-location-with-map: apply spell change requests
2tata Jul 22, 2018
6729624
gluon-config-mode-geo-location-with-map: add site.conf zoom parameter
2tata Jul 22, 2018
097a8ac
0400-geo-location.lua.in: fix 0.0 GluonSrcDiet issue
2tata Jul 22, 2018
1f576ae
fix i18n translation
2tata Jul 23, 2018
1ebdfbb
gluon-config-mode-geo-location-with-map: doc Example fix indention
2tata Jul 24, 2018
7abfeaa
gluon-config-mode-geo-location: put map outside of section div
rubo77 Jul 25, 2018
cc5e447
gluon-config-mode-geo-location-with-map: map max zoom fi position pre…
2tata Jul 26, 2018
f1dd0c5
gluon-config-mode-geo-location-with-map: load map asyncron to don't b…
2tata Jul 27, 2018
3066c0c
gluon-config-mode-geo-location-with-map: refactor if condition to one…
2tata Jul 28, 2018
1b07343
gluon-config-mode-geo-location-with-map: add copyright link and use S…
2tata Aug 4, 2018
28267af
gluon-config-mode-geo-location-with-map: add border around map
2tata Aug 4, 2018
94dd1da
luon-config-mode-geo-location/src/0400-geo-location.lua.in: refactor …
2tata Aug 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
72 changes: 72 additions & 0 deletions docs/package/gluon-config-mode-geo-location.rst
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``.

Copy link
Contributor

@rubo77 rubo77 Jul 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

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

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
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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``
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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,
},
},
76 changes: 75 additions & 1 deletion package/gluon-config-mode-geo-location/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The 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.
please check this yourself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation missing, or is the shebang preventing that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the shebang prevents indentation here, like in /gluon/package/gluon-config-mode-geo-location/Makefile

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

Copy link
Contributor

Choose a reason for hiding this comment

The 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))
1 change: 0 additions & 1 deletion package/gluon-config-mode-geo-location/check_site.lua

This file was deleted.

30 changes: 0 additions & 30 deletions package/gluon-config-mode-geo-location/i18n/de.po

This file was deleted.

30 changes: 0 additions & 30 deletions package/gluon-config-mode-geo-location/i18n/fr.po

This file was deleted.

This file was deleted.

This file was deleted.

Loading