Skip to content

Commit 8a8c2da

Browse files
committed
Let administrators choose the background map
A settings page now offers every provider documented in README.tiles.md, plus one's own address, attribution, maximum zoom and subdomains. Settings live in Galette preferences under pref_maps_tiles_*, so the plugin needs no table of its own and no database version bump. The address is stored as a string rather than a URL. Galette's URL validation rejects a host starting with a brace, which would turn away the {s} subdomain form the OSM-FR and Humanitarian providers rely on.
1 parent 0f0dbf2 commit 8a8c2da

13 files changed

Lines changed: 930 additions & 141 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ A [Galette](https://galette.eu) plugin to geolocalize members.
88

99
Map display uses [Leaflet project](https://leafletjs.com/) while search is provided by [Nominatim](https://nominatim.openstreetmap.org/) API.
1010
Background tiles are the [OpenFreeMap](https://openfreemap.org/) vector tiles, rendered with [MapLibre GL](https://maplibre.org/): no API key, no registration, and the whole thing can be self-hosted.
11+
That is only the default: an administrator picks another provider, or enters their own address, from Configuration.
1112

1213
* website: https://galette.eu - https://doc.galette.eu/en/master/plugins/maps.html
1314
* bugs and features: https://bugs.galette.eu/projects/galette-plugin-maps
@@ -27,6 +28,7 @@ Un plugin [Galette](https://galette.eu) pour gérer paiments de cotisation et de
2728

2829
Les cartes sont affichées par le biais du [projet Leaflet](https://leafletjs.com/) tandis que la recherche est assurée par l'API [Nominatim](https://nominatim.openstreetmap.org/).
2930
Le fond de carte provient des tuiles vectorielles [OpenFreeMap](https://openfreemap.org/), rendues par [MapLibre GL](https://maplibre.org/) : sans clé d'API, sans inscription, et auto-hébergeable.
31+
Ce n'est que le défaut : un administrateur choisit un autre fournisseur, ou saisit sa propre adresse, depuis la Configuration.
3032

3133
* site web : https://galette.eu - https://doc.galette.eu/fr/master/plugins/maps.html
3234
* bogues et fonctionnalités : https://bugs.galette.eu/projects/galette-plugin-maps

‎README.tiles.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,10 @@ That is possible, but it now means opening an account on
143143
<https://carto.com/basemaps> and adding the key to the URL. The exact form of
144144
the URL with a key is given by their interface — we do not reproduce it here, it
145145
is specific to each account.
146+
147+
## Newer versions
148+
149+
From the next release the background map is a setting: Configuration holds every
150+
provider listed above as a ready-made choice, plus your own address, attribution
151+
and maximum zoom. Editing a template by hand, as described here, is only needed
152+
on the releases that came before it.

‎_define.php‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
route: 'maps', //routing name and translation domain
1919
date: '2025-12-08', //Release date
2020
acls: [ //Permissions needed
21-
'maps_localize_member' => 'member',
22-
'maps_mymap' => 'member',
23-
'maps_ilivehere' => 'member'
21+
'maps_localize_member' => 'member',
22+
'maps_mymap' => 'member',
23+
'maps_ilivehere' => 'member',
24+
'maps_preferences' => 'admin',
25+
'maps_store_preferences' => 'admin'
2426
],
2527
dbver: 1.00
2628
);

‎_routes.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@
5353
[MapsController::class, 'map']
5454
)->setName('maps_map')->add($check_js_middleware)->add(\Galette\Middleware\PublicPages::class);
5555

56+
$app->get(
57+
'/preferences',
58+
[MapsController::class, 'preferences']
59+
)->setName('maps_preferences')->add(Authenticate::class);
60+
61+
$app->post(
62+
'/preferences',
63+
[MapsController::class, 'storePreferences']
64+
)->setName('maps_store_preferences')->add(Authenticate::class);
65+
5666
$app->post(
5767
'/i-live-here[/{id:\d+}]',
5868
[MapsController::class, 'ILiveHere']

‎lang/maps.pot‎

Lines changed: 143 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2025-12-07 10:22+0100\n"
11+
"POT-Creation-Date: 2026-09-02 12:49+0200\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,166 +17,250 @@ msgstr ""
1717
"Content-Type: text/plain; charset=CHARSET\n"
1818
"Content-Transfer-Encoding: 8bit\n"
1919

20-
#: ../_routes.php:34
20+
#: ../_routes.php:22
2121
msgid "Javascript libraries has not been built!"
2222
msgstr ""
2323

24-
#: ../lib/GaletteMaps/PluginGaletteMaps.php:53
25-
#: ../lib/GaletteMaps/PluginGaletteMaps.php:99
26-
msgid "My localization"
24+
#: ../lib/GaletteMaps/Controllers/MapsController.php:50
25+
#: ../lib/GaletteMaps/Controllers/MapsController.php:130
26+
#: ../lib/GaletteMaps/PluginGaletteMaps.php:94
27+
msgid "Maps"
2728
msgstr ""
2829

29-
#: ../lib/GaletteMaps/PluginGaletteMaps.php:74
30-
#: ../lib/GaletteMaps/Controllers/MapsController.php:64
31-
#: ../lib/GaletteMaps/Controllers/MapsController.php:145
32-
msgid "Maps"
30+
#: ../lib/GaletteMaps/Controllers/MapsController.php:60
31+
msgid ""
32+
"Coordinates has not been loaded. Maybe plugin tables does not exists in the "
33+
"database?"
3334
msgstr ""
3435

35-
#: ../lib/GaletteMaps/PluginGaletteMaps.php:130
36-
msgid "Geolocalize"
36+
#: ../lib/GaletteMaps/Controllers/MapsController.php:133
37+
msgid "%member geographic position"
3738
msgstr ""
3839

39-
#: ../lib/GaletteMaps/PluginGaletteMaps.php:134
40-
msgid "Geolocalize %membername"
40+
#: ../lib/GaletteMaps/Controllers/MapsController.php:170
41+
#: ../lib/GaletteMaps/PluginGaletteMaps.php:60
42+
msgid "Maps settings"
4143
msgstr ""
4244

43-
#: ../lib/GaletteMaps/Controllers/MapsController.php:73
44-
msgid ""
45-
"Coordinates has not been loaded. Maybe plugin tables does not exists in the "
46-
"database?"
45+
#: ../lib/GaletteMaps/Controllers/MapsController.php:216
46+
msgid "An address is required to use your own background map."
4747
msgstr ""
4848

49-
#: ../lib/GaletteMaps/Controllers/MapsController.php:148
50-
msgid "%member geographic position"
49+
#: ../lib/GaletteMaps/Controllers/MapsController.php:232
50+
msgid "Maps settings have been saved."
5151
msgstr ""
5252

53-
#: ../lib/GaletteMaps/Controllers/MapsController.php:194
53+
#: ../lib/GaletteMaps/Controllers/MapsController.php:262
5454
msgid "Superadmin cannot be localized."
5555
msgstr ""
5656

57-
#: ../lib/GaletteMaps/Controllers/MapsController.php:221
58-
#: ../lib/GaletteMaps/Controllers/MapsController.php:233
57+
#: ../lib/GaletteMaps/Controllers/MapsController.php:289
58+
#: ../lib/GaletteMaps/Controllers/MapsController.php:301
5959
msgid "Coordinates has not been removed :("
6060
msgstr ""
6161

62-
#: ../lib/GaletteMaps/Controllers/MapsController.php:231
62+
#: ../lib/GaletteMaps/Controllers/MapsController.php:299
6363
msgid "Coordinates has been removed!"
6464
msgstr ""
6565

66-
#: ../lib/GaletteMaps/Controllers/MapsController.php:246
66+
#: ../lib/GaletteMaps/Controllers/MapsController.php:314
6767
msgid "New coordinates has been stored!"
6868
msgstr ""
6969

70-
#: ../lib/GaletteMaps/Controllers/MapsController.php:248
70+
#: ../lib/GaletteMaps/Controllers/MapsController.php:316
7171
msgid "Coordinates has not been stored :("
7272
msgstr ""
7373

74-
#: ../lib/GaletteMaps/Controllers/MapsController.php:251
74+
#: ../lib/GaletteMaps/Controllers/MapsController.php:319
7575
msgid "Something went wrong :("
7676
msgstr ""
7777

78-
#: ../tempcache/common_html.html.twig:66 ../tempcache/common_html.html.twig:72
79-
msgid "Member (company)"
78+
#: ../lib/GaletteMaps/TileProviders.php:123
79+
msgid "OpenFreeMap, light grey"
8080
msgstr ""
8181

82-
#: ../tempcache/common_html.html.twig:82 ../tempcache/common_html.html.twig:88
83-
msgid "Search result"
82+
#: ../lib/GaletteMaps/TileProviders.php:124
83+
msgid "OpenFreeMap, colours"
84+
msgstr ""
85+
86+
#: ../lib/GaletteMaps/TileProviders.php:125
87+
msgid "OpenStreetMap"
8488
msgstr ""
8589

86-
#: ../tempcache/maps.html.twig:114
90+
#: ../lib/GaletteMaps/TileProviders.php:126
91+
msgid "OpenStreetMap France"
92+
msgstr ""
93+
94+
#: ../lib/GaletteMaps/TileProviders.php:127
95+
msgid "Humanitarian OSM Team"
96+
msgstr ""
97+
98+
#: ../lib/GaletteMaps/TileProviders.php:128
99+
msgid "OpenStreetMap Germany"
100+
msgstr ""
101+
102+
#: ../lib/GaletteMaps/TileProviders.php:129
103+
msgid "Esri, light grey"
104+
msgstr ""
105+
106+
#: ../lib/GaletteMaps/TileProviders.php:130
107+
#: ../tempcache/maps_preferences.html.twig:85
108+
msgid "Own values"
109+
msgstr ""
110+
111+
#: ../lib/GaletteMaps/PluginGaletteMaps.php:73
112+
#: ../lib/GaletteMaps/PluginGaletteMaps.php:119
113+
msgid "My localization"
114+
msgstr ""
115+
116+
#: ../lib/GaletteMaps/PluginGaletteMaps.php:150
117+
msgid "Geolocalize"
118+
msgstr ""
119+
120+
#: ../lib/GaletteMaps/PluginGaletteMaps.php:154
121+
msgid "Geolocalize %membername"
122+
msgstr ""
123+
124+
#: ../tempcache/maps.html.twig:115
87125
msgid "aka"
88126
msgstr ""
89127

90-
#: ../tempcache/common_scripts.html.twig:134
128+
#: ../tempcache/common_scripts.html.twig:166
91129
msgid "An error occurred during 'I live here' process :("
92130
msgstr ""
93131

94-
#: ../tempcache/common_scripts.html.twig:179
132+
#: ../tempcache/common_scripts.html.twig:215
95133
msgid "Display map in full screen"
96134
msgstr ""
97135

98-
#: ../tempcache/common_scripts.html.twig:183
136+
#: ../tempcache/common_scripts.html.twig:219
99137
msgid "Exit full screen"
100138
msgstr ""
101139

102-
#: ../tempcache/common_scripts.html.twig:195
140+
#: ../tempcache/common_scripts.html.twig:231
103141
msgid "Search your town..."
104142
msgstr ""
105143

106-
#: ../tempcache/common_scripts.html.twig:201
144+
#: ../tempcache/common_scripts.html.twig:237
107145
msgid "Search a town..."
108146
msgstr ""
109147

110-
#: ../tempcache/common_scripts.html.twig:207
148+
#: ../tempcache/common_scripts.html.twig:243
111149
msgid "Sorry, that town could not be found."
112150
msgstr ""
113151

114-
#: ../tempcache/common_scripts.html.twig:211
152+
#: ../tempcache/common_scripts.html.twig:247
115153
msgid "Search"
116154
msgstr ""
117155

118-
#: ../tempcache/common_scripts.html.twig:235
156+
#: ../tempcache/common_scripts.html.twig:271
119157
msgid "Show me where I am"
120158
msgstr ""
121159

122-
#: ../tempcache/common_scripts.html.twig:240
160+
#: ../tempcache/common_scripts.html.twig:276
123161
msgid "You seem located outside the boundaries of the map"
124162
msgstr ""
125163

126-
#: ../tempcache/common_scripts.html.twig:252
127-
msgid "Map data (c)"
164+
#: ../tempcache/maps_preferences.html.twig:66
165+
msgid ""
166+
"Background maps come from an outside provider. Should it change its terms, "
167+
"pick another one here rather than waiting for a new release."
168+
msgstr ""
169+
170+
#: ../tempcache/maps_preferences.html.twig:73
171+
msgid "Background map"
172+
msgstr ""
173+
174+
#: ../tempcache/maps_preferences.html.twig:91
175+
msgid "Vector tiles"
176+
msgstr ""
177+
178+
#: ../tempcache/maps_preferences.html.twig:91
179+
msgid "Tick for a MapLibre style, leave unticked for classic raster tiles."
128180
msgstr ""
129181

130-
#: ../tempcache/common_scripts.html.twig:254
131-
msgid "OpenStreetMap contributors"
182+
#: ../tempcache/maps_preferences.html.twig:98
183+
msgid "Address"
132184
msgstr ""
133185

134-
#: ../tempcache/common_scripts.html.twig:256
135-
msgid "Imagery (c)"
186+
#: ../tempcache/maps_preferences.html.twig:98
187+
msgid "Style address for vector tiles, tiles address for raster ones, such as:"
136188
msgstr ""
137189

138-
#: ../tempcache/mymap.html.twig:72
190+
#: ../tempcache/maps_preferences.html.twig:104
191+
msgid "Attribution"
192+
msgstr ""
193+
194+
#: ../tempcache/maps_preferences.html.twig:104
195+
msgid ""
196+
"Credit the provider requires, HTML allowed. Data licences make it mandatory. "
197+
"A vector style usually carries its own, and this can then be left empty."
198+
msgstr ""
199+
200+
#: ../tempcache/maps_preferences.html.twig:110
201+
msgid "Maximum zoom"
202+
msgstr ""
203+
204+
#: ../tempcache/maps_preferences.html.twig:116
205+
msgid "Subdomains"
206+
msgstr ""
207+
208+
#: ../tempcache/maps_preferences.html.twig:116
209+
msgid ""
210+
"Letters the {s} token in the address is replaced with, such as abc. Raster "
211+
"tiles only."
212+
msgstr ""
213+
214+
#: ../tempcache/mymap.html.twig:73
139215
msgid "Choose your location"
140216
msgstr ""
141217

142-
#: ../tempcache/mymap.html.twig:78
218+
#: ../tempcache/mymap.html.twig:79
143219
msgid "Choose %member location"
144220
msgstr ""
145221

146-
#: ../tempcache/mymap.html.twig:88
222+
#: ../tempcache/mymap.html.twig:89
147223
msgid "Select your town."
148224
msgstr ""
149225

150-
#: ../tempcache/mymap.html.twig:92
226+
#: ../tempcache/mymap.html.twig:93
151227
msgid "In the database, town is set to: '%town'"
152228
msgstr ""
153229

154-
#: ../tempcache/mymap.html.twig:186
230+
#: ../tempcache/mymap.html.twig:188
155231
msgid "You clicked at %p"
156232
msgstr ""
157233

158-
#: ../tempcache/mymap.html.twig:189 ../tempcache/mymap.html.twig:310
159-
#: ../tempcache/mymap.html.twig:339
234+
#: ../tempcache/mymap.html.twig:191 ../tempcache/mymap.html.twig:312
235+
#: ../tempcache/mymap.html.twig:341
160236
msgid "I live here!"
161237
msgstr ""
162238

163-
#: ../tempcache/mymap.html.twig:191 ../tempcache/mymap.html.twig:312
164-
#: ../tempcache/mymap.html.twig:341
239+
#: ../tempcache/mymap.html.twig:193 ../tempcache/mymap.html.twig:314
240+
#: ../tempcache/mymap.html.twig:343
165241
msgid "Member lives here!"
166242
msgstr ""
167243

168-
#: ../tempcache/mymap.html.twig:223
244+
#: ../tempcache/mymap.html.twig:225
169245
msgid "Remove my coordinates"
170246
msgstr ""
171247

172-
#: ../tempcache/mymap.html.twig:225
248+
#: ../tempcache/mymap.html.twig:227
173249
msgid "Remove member coordinates"
174250
msgstr ""
175251

176-
#: ../tempcache/mymap.html.twig:231
252+
#: ../tempcache/mymap.html.twig:233
177253
msgid "Are you sure you want to remove coordinates from the database?"
178254
msgstr ""
179255

180-
#: ../tempcache/mymap.html.twig:284
256+
#: ../tempcache/mymap.html.twig:286
181257
msgid "An error occurred removing coordinates :("
182258
msgstr ""
259+
260+
#: ../tempcache/common_html.html.twig:68 ../tempcache/common_html.html.twig:74
261+
msgid "Member (company)"
262+
msgstr ""
263+
264+
#: ../tempcache/common_html.html.twig:84 ../tempcache/common_html.html.twig:90
265+
msgid "Search result"
266+
msgstr ""

0 commit comments

Comments
 (0)