From: Chuck Scott Date: Mon, 20 Aug 2018 17:00:19 +0000 (-0400) Subject: Added Leaflet Loading feature, member detail maps, and updated map key code. X-Git-Tag: v2.10.37^2~3^2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=5f828b4cb7d2ee1376297beda2ee89b1e185afe7;p=WP-Plugins%2Fglm-member-db.git Added Leaflet Loading feature, member detail maps, and updated map key code. --- diff --git a/js/Leaflet.loading/.gitignore b/js/Leaflet.loading/.gitignore new file mode 100644 index 00000000..0e21c539 --- /dev/null +++ b/js/Leaflet.loading/.gitignore @@ -0,0 +1,2 @@ +*.swp +.DS_Store \ No newline at end of file diff --git a/js/Leaflet.loading/CONTRIBUTING.md b/js/Leaflet.loading/CONTRIBUTING.md new file mode 100644 index 00000000..ee0d40db --- /dev/null +++ b/js/Leaflet.loading/CONTRIBUTING.md @@ -0,0 +1,21 @@ +Contributing +============ + +Your pull requests are very welcome! Please follow these guidelines: + + * Keep code compatible with the same browsers Leaflet aims to be [compatible + with](http://leafletjs.com/features.html). + * Use four spaces rather than tabs. + + +## Contributors + + * [Eric Brelsford](https://github.com/ebrelsford) + * [Nick Iaconis](https://github.com/codefox421) + * [Matthias Althaus](https://github.com/althaus) + * [Yohan Boniface](https://github.com/yohanboniface) + * [kermit-the-frog](https://github.com/kermit-the-frog) + * [kcwu](https://github.com/kcwu) + * [Robbie Trencheny](https://github.com/robbiet480) + * [David Molineus](https://github.com/dmolineus) + * [Marwen Arfa](https://github.com/arfa) diff --git a/js/Leaflet.loading/LICENSE b/js/Leaflet.loading/LICENSE new file mode 100644 index 00000000..a6651f1b --- /dev/null +++ b/js/Leaflet.loading/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013 Eric Brelsford + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/js/Leaflet.loading/README.md b/js/Leaflet.loading/README.md new file mode 100644 index 00000000..1587b0c3 --- /dev/null +++ b/js/Leaflet.loading/README.md @@ -0,0 +1,95 @@ +Leaflet.loading +=============== + +Leaflet.loading is a simple loading control for [Leaflet][]. An unobtrusive +loading indicator is added below the zoom control if one exists. The indicator +is visible when tiles are loading or when other data is loading, as indicated by +firing custom events on a map. The indicator can be an image, or a [spin.js][] +spinner (image-less). + + +## Usage + +Leaflet.loading is only tested on Leaflet version 0.6 or greater. It will almost +certainly not work with older versions of Leaflet. Of course we intend to +support Leaflet 1.0, and we have tested against the latest release (beta 2). +Please create an issue if you find that any part of this project is not +compatible with Leaflet 1.0. + +Include `Control.Loading.js` and `Control.Loading.css`, then create a map with +`loadingControl: true` in its options. + +By default, Leaflet.loading includes a base64-encoded animagted loading image in +`Control.Loading.css`. You can customize this by changing `background-image` for +the selector `.leaflet-control-loading`. The simplest case would be adding a 16 +x 16 loading gif in `.leaflet-control-loading`. + +You can also set `spinjs: true` in the options, and load [spin.js][] to use that +instead of an image. A spin.js options object can be passed as the spin key when +initializing the control. + +Whichever method you use, make sure you only use one. + +Once the above is complete you will have a loading indicator that only appears +when tiles are loading. + +If you want to show the loading indicator while other AJAX requests or something +else is occurring, fire the `dataloading` event on your map when you begin +loading and `dataload` when you are finished loading. Please note that there is +[an issue](https://github.com/ebrelsford/Leaflet.loading/issues/26) with the +way this control tracks these events and that this will be re-worked in a +future version. + +### Options + + - **position**: (string) Where you want the control to show up on the map (standard + Leaflet control option). Optional, defaults to `topleft` + - **separate**: (boolean) Whether the control should be separate from the zoom + control or not, defaults to false. + - **zoomControl**: (L.Control.Zoom) The zoom control that the control should be + added to. This is only necessary when adding a loading control to a zoom + control that you added manually and do not want a separate loading control. + - **delayIndicator**: (float) The number of milliseconds to wait before + showing the loading indicator. Defaults to `null` (no delay). + - **spinjs**: (boolean) Enable the use of [spin.js][]. Optional, defaults to + `false` + - **spin**: (object) A [spin.js][] options object. Optional, defaults to + + ``` + { + lines: 7, + length: 3, + width: 3, + radius: 5, + rotate: 13, + top: "83%" + } + ``` + + +## Demos + +See Leaflet.loading in action (zoom or pan to make tiles load): + + - Using the [simplest setup][simple], with the loading indicator attached to + the zoom control. + - With the loading indicator [separate][] from the zoom control. + - With the loading indicator and zoom control on the [top right][topright] of + the map. + - The [simplest example using spin.js](http://ebrelsford.github.io/Leaflet.loading/spinjs.html) instead of an image + - Combined with a [fullscreen control][combined] (e.g. [leaflet.fullscreen][]). + + +## License + +Leaflet.loading is free software, and may be redistributed under the MIT +License. + + + [Leaflet]: https://github.com/Leaflet/Leaflet + [spin.js]: https://github.com/fgnass/spin.js/ + [simple]: http://ebrelsford.github.io/Leaflet.loading/simple.html + [separate]: http://ebrelsford.github.io/Leaflet.loading/separate.html + [topright]: http://ebrelsford.github.io/Leaflet.loading/topright.html + [combined]: http://ebrelsford.github.io/Leaflet.loading/combined.html + [leaflet.fullscreen]: https://github.com/brunob/leaflet.fullscreen diff --git a/js/Leaflet.loading/bower.json b/js/Leaflet.loading/bower.json new file mode 100644 index 00000000..edf9be0f --- /dev/null +++ b/js/Leaflet.loading/bower.json @@ -0,0 +1,30 @@ +{ + "name": "leaflet.loading", + "version": "0.1.24", + "homepage": "https://github.com/ebrelsford/leaflet.loading", + "authors": [ + "Eric Brelsford " + ], + "description": "A loading-indicator control for Leaflet", + "main": [ + "src/Control.Loading.css", + "src/Control.Loading.js" + ], + "keywords": [ + "leaflet", + "map", + "gis", + "loading" + ], + "dependencies": { + "leaflet": ">=0.6" + }, + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/js/Leaflet.loading/examples/combined.html b/js/Leaflet.loading/examples/combined.html new file mode 100644 index 00000000..85ed7976 --- /dev/null +++ b/js/Leaflet.loading/examples/combined.html @@ -0,0 +1,51 @@ + + + + Leaflet.loading example—simple + + + + + + + + + + + + + + + + +
+ + + + diff --git a/js/Leaflet.loading/examples/delayed.html b/js/Leaflet.loading/examples/delayed.html new file mode 100644 index 00000000..aaa55c44 --- /dev/null +++ b/js/Leaflet.loading/examples/delayed.html @@ -0,0 +1,36 @@ + + + + Leaflet.loading example—delayed + + + + + + + + + + + +
+ + + + diff --git a/js/Leaflet.loading/examples/layergroup.html b/js/Leaflet.loading/examples/layergroup.html new file mode 100644 index 00000000..d615a0ea --- /dev/null +++ b/js/Leaflet.loading/examples/layergroup.html @@ -0,0 +1,42 @@ + + + + Leaflet.loading example—L.LayerGroup + + + + + + + + + +
+ + + + diff --git a/js/Leaflet.loading/examples/leaflet-1.0/delayed.html b/js/Leaflet.loading/examples/leaflet-1.0/delayed.html new file mode 100644 index 00000000..f083cf05 --- /dev/null +++ b/js/Leaflet.loading/examples/leaflet-1.0/delayed.html @@ -0,0 +1,36 @@ + + + + Leaflet.loading example—delayed + + + + + + + + + + + +
+ + + + diff --git a/js/Leaflet.loading/examples/leaflet-1.0/twobaselayers-gridlayer.html b/js/Leaflet.loading/examples/leaflet-1.0/twobaselayers-gridlayer.html new file mode 100644 index 00000000..1cb730a1 --- /dev/null +++ b/js/Leaflet.loading/examples/leaflet-1.0/twobaselayers-gridlayer.html @@ -0,0 +1,47 @@ + + + + Leaflet.loading example—two base layers + + + + + + + + + + + +
+ + + + diff --git a/js/Leaflet.loading/examples/separate.html b/js/Leaflet.loading/examples/separate.html new file mode 100644 index 00000000..27f7b064 --- /dev/null +++ b/js/Leaflet.loading/examples/separate.html @@ -0,0 +1,35 @@ + + + + Leaflet.loading example—separate + + + + + + + + + + + +
+ + + + diff --git a/js/Leaflet.loading/examples/simple.html b/js/Leaflet.loading/examples/simple.html new file mode 100644 index 00000000..44e4c9c9 --- /dev/null +++ b/js/Leaflet.loading/examples/simple.html @@ -0,0 +1,33 @@ + + + + Leaflet.loading example—simple + + + + + + + + + + + +
+ + + + diff --git a/js/Leaflet.loading/examples/spinjs.html b/js/Leaflet.loading/examples/spinjs.html new file mode 100644 index 00000000..409c822b --- /dev/null +++ b/js/Leaflet.loading/examples/spinjs.html @@ -0,0 +1,38 @@ + + + + Leaflet.loading example—spinjs + + + + + + + + + + + + + + +
+ + + + diff --git a/js/Leaflet.loading/examples/topright.html b/js/Leaflet.loading/examples/topright.html new file mode 100644 index 00000000..e8ed4a34 --- /dev/null +++ b/js/Leaflet.loading/examples/topright.html @@ -0,0 +1,45 @@ + + + + Leaflet.loading example—topright + + + + + + + + + + + +
+ + + + diff --git a/js/Leaflet.loading/examples/twobaselayers-canvas.html b/js/Leaflet.loading/examples/twobaselayers-canvas.html new file mode 100644 index 00000000..a19cf1f5 --- /dev/null +++ b/js/Leaflet.loading/examples/twobaselayers-canvas.html @@ -0,0 +1,40 @@ + + + + Leaflet.loading example—two base layers + + + + + + + + + + + +
+ + + + diff --git a/js/Leaflet.loading/examples/twobaselayers.html b/js/Leaflet.loading/examples/twobaselayers.html new file mode 100644 index 00000000..3a40bcbf --- /dev/null +++ b/js/Leaflet.loading/examples/twobaselayers.html @@ -0,0 +1,42 @@ + + + + Leaflet.loading example—two base layers + + + + + + + + + + + +
+ + + + diff --git a/js/Leaflet.loading/package.json b/js/Leaflet.loading/package.json new file mode 100644 index 00000000..68adc00f --- /dev/null +++ b/js/Leaflet.loading/package.json @@ -0,0 +1,27 @@ +{ + "name": "leaflet-loading", + "version": "0.1.24", + "description": "A simple loading control for Leaflet", + "main": "src/Control.Loading.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/ebrelsford/Leaflet.loading.git" + }, + "keywords": [ + "leaflet", + "map", + "maps", + "gis", + "geoweb", + "loading" + ], + "author": "Eric Brelsford (http://ebrelsford.github.io/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/ebrelsford/Leaflet.loading/issues" + }, + "homepage": "https://github.com/ebrelsford/Leaflet.loading" +} diff --git a/js/Leaflet.loading/src/Control.Loading.css b/js/Leaflet.loading/src/Control.Loading.css new file mode 100644 index 00000000..f4157bc6 --- /dev/null +++ b/js/Leaflet.loading/src/Control.Loading.css @@ -0,0 +1,26 @@ +.leaflet-control-loading:empty { + /* Spinner via ajaxload.info, base64-encoded */ + background-image: url(data:image/gif;base64,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); + background-repeat: no-repeat; +} + +.leaflet-control-loading, +.leaflet-control-zoom a.leaflet-control-loading, +.leaflet-control-zoomslider a.leaflet-control-loading, +.leaflet-control-layer-container { + display: none; +} + +.leaflet-control-loading.is-loading, +.leaflet-control-zoom a.leaflet-control-loading.is-loading, +.leaflet-control-zoomslider a.leaflet-control-loading.is-loading, +.leaflet-control-layer-container.is-loading { + display: block; +} + +/* Necessary for display consistency in Leaflet >= 0.6 */ +.leaflet-bar-part-bottom { + border-bottom: medium none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; +} diff --git a/js/Leaflet.loading/src/Control.Loading.js b/js/Leaflet.loading/src/Control.Loading.js new file mode 100644 index 00000000..c09cd220 --- /dev/null +++ b/js/Leaflet.loading/src/Control.Loading.js @@ -0,0 +1,351 @@ +/* + * L.Control.Loading is a control that shows a loading indicator when tiles are + * loading or when map-related AJAX requests are taking place. + */ + +(function () { + + var console = window.console || { + error: function () {}, + warn: function () {} + }; + + function defineLeafletLoading(L) { + L.Control.Loading = L.Control.extend({ + options: { + delayIndicator: null, + position: 'topleft', + separate: false, + zoomControl: null, + spinjs: false, + spin: { + lines: 7, + length: 3, + width: 3, + radius: 5, + rotate: 13, + top: "83%" + } + }, + + initialize: function(options) { + L.setOptions(this, options); + this._dataLoaders = {}; + + // Try to set the zoom control this control is attached to from + // the options + if (this.options.zoomControl !== null) { + this.zoomControl = this.options.zoomControl; + } + }, + + onAdd: function(map) { + if (this.options.spinjs && (typeof Spinner !== 'function')) { + return console.error("Leaflet.loading cannot load because you didn't load spin.js (http://fgnass.github.io/spin.js/), even though you set it in options."); + } + this._addLayerListeners(map); + this._addMapListeners(map); + + // Try to set the zoom control this control is attached to from the map + // the control is being added to + if (!this.options.separate && !this.zoomControl) { + if (map.zoomControl) { + this.zoomControl = map.zoomControl; + } else if (map.zoomsliderControl) { + this.zoomControl = map.zoomsliderControl; + } + } + + // Create the loading indicator + var classes = 'leaflet-control-loading'; + var container; + if (this.zoomControl && !this.options.separate) { + // If there is a zoom control, hook into the bottom of it + container = this.zoomControl._container; + // These classes are no longer used as of Leaflet 0.6 + classes += ' leaflet-bar-part-bottom leaflet-bar-part last'; + + // Loading control will be added to the zoom control. So the visible last element is not the + // last dom element anymore. So add the part-bottom class. + L.DomUtil.addClass(this._getLastControlButton(), 'leaflet-bar-part-bottom'); + } + else { + // Otherwise, create a container for the indicator + container = L.DomUtil.create('div', 'leaflet-control-zoom leaflet-control-layer-container leaflet-bar'); + } + this._indicatorContainer = container; + this._indicator = L.DomUtil.create('a', classes, container); + if (this.options.spinjs) { + this._spinner = new Spinner(this.options.spin).spin(); + this._indicator.appendChild(this._spinner.el); + } + return container; + }, + + onRemove: function(map) { + this._removeLayerListeners(map); + this._removeMapListeners(map); + }, + + removeFrom: function (map) { + if (this.zoomControl && !this.options.separate) { + // Override Control.removeFrom() to avoid clobbering the entire + // _container, which is the same as zoomControl's + this._container.removeChild(this._indicator); + this._map = null; + this.onRemove(map); + return this; + } + else { + // If this control is separate from the zoomControl, call the + // parent method so we don't leave behind an empty container + return L.Control.prototype.removeFrom.call(this, map); + } + }, + + addLoader: function(id) { + this._dataLoaders[id] = true; + if (this.options.delayIndicator && !this.delayIndicatorTimeout) { + // If we are delaying showing the indicator and we're not + // already waiting for that delay, set up a timeout. + var that = this; + this.delayIndicatorTimeout = setTimeout(function () { + that.updateIndicator(); + that.delayIndicatorTimeout = null; + }, this.options.delayIndicator); + } + else { + // Otherwise show the indicator immediately + this.updateIndicator(); + } + }, + + removeLoader: function(id) { + delete this._dataLoaders[id]; + this.updateIndicator(); + + // If removing this loader means we're in no danger of loading, + // clear the timeout. This prevents old delays from instantly + // triggering the indicator. + if (this.options.delayIndicator && this.delayIndicatorTimeout && !this.isLoading()) { + clearTimeout(this.delayIndicatorTimeout); + this.delayIndicatorTimeout = null; + } + }, + + updateIndicator: function() { + if (this.isLoading()) { + this._showIndicator(); + } + else { + this._hideIndicator(); + } + }, + + isLoading: function() { + return this._countLoaders() > 0; + }, + + _countLoaders: function() { + var size = 0, key; + for (key in this._dataLoaders) { + if (this._dataLoaders.hasOwnProperty(key)) size++; + } + return size; + }, + + _showIndicator: function() { + // Show loading indicator + L.DomUtil.addClass(this._indicator, 'is-loading'); + L.DomUtil.addClass(this._indicatorContainer, 'is-loading'); + + // If zoomControl exists, make the zoom-out button not last + if (!this.options.separate) { + if (this.zoomControl instanceof L.Control.Zoom) { + L.DomUtil.removeClass(this._getLastControlButton(), 'leaflet-bar-part-bottom'); + } + else if (typeof L.Control.Zoomslider === 'function' && this.zoomControl instanceof L.Control.Zoomslider) { + L.DomUtil.removeClass(this.zoomControl._ui.zoomOut, 'leaflet-bar-part-bottom'); + } + } + }, + + _hideIndicator: function() { + // Hide loading indicator + L.DomUtil.removeClass(this._indicator, 'is-loading'); + L.DomUtil.removeClass(this._indicatorContainer, 'is-loading'); + + // If zoomControl exists, make the zoom-out button last + if (!this.options.separate) { + if (this.zoomControl instanceof L.Control.Zoom) { + L.DomUtil.addClass(this._getLastControlButton(), 'leaflet-bar-part-bottom'); + } + else if (typeof L.Control.Zoomslider === 'function' && this.zoomControl instanceof L.Control.Zoomslider) { + L.DomUtil.addClass(this.zoomControl._ui.zoomOut, 'leaflet-bar-part-bottom'); + } + } + }, + + _getLastControlButton: function() { + var container = this.zoomControl._container, + index = container.children.length - 1; + + // Find the last visible control button that is not our loading + // indicator + while (index > 0) { + var button = container.children[index]; + if (!(this._indicator === button || button.offsetWidth === 0 || button.offsetHeight === 0)) { + break; + } + index--; + } + + return container.children[index]; + }, + + _handleLoading: function(e) { + this.addLoader(this.getEventId(e)); + }, + + _handleBaseLayerChange: function (e) { + var that = this; + + // Check for a target 'layer' that contains multiple layers, such as + // L.LayerGroup. This will happen if you have an L.LayerGroup in an + // L.Control.Layers. + if (e.layer && e.layer.eachLayer && typeof e.layer.eachLayer === 'function') { + e.layer.eachLayer(function (layer) { + that._handleBaseLayerChange({ layer: layer }); + }); + } + else { + // If we're changing to a canvas layer, don't handle loading + // as canvas layers will not fire load events. + if (!(L.TileLayer.Canvas && e.layer instanceof L.TileLayer.Canvas)) { + that._handleLoading(e); + } + } + }, + + _handleLoad: function(e) { + this.removeLoader(this.getEventId(e)); + }, + + getEventId: function(e) { + if (e.id) { + return e.id; + } + else if (e.layer) { + return e.layer._leaflet_id; + } + return e.target._leaflet_id; + }, + + _layerAdd: function(e) { + if (!e.layer || !e.layer.on) return + try { + e.layer.on({ + loading: this._handleLoading, + load: this._handleLoad + }, this); + } + catch (exception) { + console.warn('L.Control.Loading: Tried and failed to add ' + + ' event handlers to layer', e.layer); + console.warn('L.Control.Loading: Full details', exception); + } + }, + + _layerRemove: function(e) { + if (!e.layer || !e.layer.off) return; + try { + e.layer.off({ + loading: this._handleLoading, + load: this._handleLoad + }, this); + } + catch (exception) { + console.warn('L.Control.Loading: Tried and failed to remove ' + + 'event handlers from layer', e.layer); + console.warn('L.Control.Loading: Full details', exception); + } + }, + + _addLayerListeners: function(map) { + // Add listeners for begin and end of load to any layers already + // on the map + map.eachLayer(function(layer) { + if (!layer.on) return; + layer.on({ + loading: this._handleLoading, + load: this._handleLoad + }, this); + }, this); + + // When a layer is added to the map, add listeners for begin and + // end of load + map.on('layeradd', this._layerAdd, this); + map.on('layerremove', this._layerRemove, this); + }, + + _removeLayerListeners: function(map) { + // Remove listeners for begin and end of load from all layers + map.eachLayer(function(layer) { + if (!layer.off) return; + layer.off({ + loading: this._handleLoading, + load: this._handleLoad + }, this); + }, this); + + // Remove layeradd/layerremove listener from map + map.off('layeradd', this._layerAdd, this); + map.off('layerremove', this._layerRemove, this); + }, + + _addMapListeners: function(map) { + // Add listeners to the map for (custom) dataloading and dataload + // events, eg, for AJAX calls that affect the map but will not be + // reflected in the above layer events. + map.on({ + baselayerchange: this._handleBaseLayerChange, + dataloading: this._handleLoading, + dataload: this._handleLoad, + layerremove: this._handleLoad + }, this); + }, + + _removeMapListeners: function(map) { + map.off({ + baselayerchange: this._handleBaseLayerChange, + dataloading: this._handleLoading, + dataload: this._handleLoad, + layerremove: this._handleLoad + }, this); + } + }); + + L.Map.addInitHook(function () { + if (this.options.loadingControl) { + this.loadingControl = new L.Control.Loading(); + this.addControl(this.loadingControl); + } + }); + + L.Control.loading = function(options) { + return new L.Control.Loading(options); + }; + } + + if (typeof define === 'function' && define.amd) { + // Try to add leaflet.loading to Leaflet using AMD + define(['leaflet'], function (L) { + defineLeafletLoading(L); + }); + } + else { + // Else use the global L + defineLeafletLoading(L); + } + +})(); diff --git a/views/admin/management/index.html b/views/admin/management/index.html index 21ef700a..d28cf28a 100755 --- a/views/admin/management/index.html +++ b/views/admin/management/index.html @@ -192,19 +192,18 @@ Leaflet Tile Server: - + {if $genSettings.fieldFail.leaflet_tile_server}

{$genSettings.fieldFail.leaflet_tile_server}

{/if} -
This is the base address of the server that will provide the map images and related data. A tile server is required to display Leaflet maps. -
Notes that the tile server may include a directory specification - +
This is the base URL of the server that will provide map tiles and related data. A tile server is required to display Leaflet maps. Leaflet Tile Server Key: - + {if $genSettings.fieldFail.leaflet_tile_server_key}

{$genSettings.fieldFail.leaflet_tile_server_key}

{/if} -
If the tile server set above requires a key to permit access, enter that key value here. +
If the tile server requires a key to permit access, enter that key value here. +
For some tile servers that do not require keys in the url, this should be the directory for selecting the desired map styles (i.e. "hot"). @@ -232,6 +231,7 @@ {if $genSettings.fieldData.selected_map_interface.value == 1} +

If the map does not load below, please check the Tile Server and Tile Server Key settings above.

{/if} @@ -661,7 +661,7 @@ */ var leafletMap = L.map('LeafletMap').setView([startLat, startLon], defZoom); - var leafletTileServer = '{$genSettings.fieldData.leaflet_tile_server}' + {literal}'{z}/{x}/{y}.png'{/literal}; + var leafletTileServer = '{$genSettings.fieldData.leaflet_tile_server}/{$genSettings.fieldData.leaflet_tile_server_key}/' + {literal}'{z}/{x}/{y}.png'{/literal}; var leafletMinZoom = 5; var leafletMaxZoom = 18; diff --git a/views/admin/member/memberInfo/editProfileAddress.html b/views/admin/member/memberInfo/editProfileAddress.html index 6f34e0f8..6ca6a21d 100755 --- a/views/admin/member/memberInfo/editProfileAddress.html +++ b/views/admin/member/memberInfo/editProfileAddress.html @@ -165,7 +165,8 @@ function initMap() { var leafletMap = L.map('LeafletMapContainer').setView([startLat, startLon], defZoom); - var leafletTileServer = '{$settings.leaflet_tile_server}' + {literal}'{z}/{x}/{y}.png'{/literal}; + //var leafletTileServer = '{$settings.leaflet_tile_server}' + {literal}'{z}/{x}/{y}.png'{/literal}; + var leafletTileServer = '{$settings.leaflet_tile_server}/{$settings.leaflet_tile_server_key}/' + {literal}'{z}/{x}/{y}.png'{/literal}; var leafletMinZoom = 5; var leafletMaxZoom = 18; var geocoder; diff --git a/views/front/members/detail.html b/views/front/members/detail.html old mode 100644 new mode 100755 index 98dda3e0..29e1e204 --- a/views/front/members/detail.html +++ b/views/front/members/detail.html @@ -3,7 +3,7 @@ {apply_filters('glm-member-db-front-members-detail-pageTop', '', $member.id)} {if $haveMember} - + {if $settings.detail_show_map}