mirror of
https://github.com/netzmacht/contao-leaflet-geocode-widget.git
synced 2025-12-02 21:53:39 +01:00
Update git config files and apply coding standard.
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Geocode backend widget based on Leaflet.
|
||||
*
|
||||
* @package netzmacht
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2017 netzmacht David Molineus. All rights reserved.
|
||||
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
|
||||
* @filesource
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\GeocodeWidget\ContaoManager;
|
||||
@@ -17,7 +19,7 @@ use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
|
||||
use Netzmacht\Contao\Leaflet\GeocodeWidget\LeafletGeocodeWidgetBundle;
|
||||
|
||||
/**
|
||||
* Class Plugin
|
||||
* Contao Manager plugin.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\GeocodeWidget\ContaoManager
|
||||
*/
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Geocode backend widget based on Leaflet.
|
||||
*
|
||||
* @package netzmacht
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2017 netzmacht David Molineus. All rights reserved.
|
||||
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
|
||||
* @filesource
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\GeocodeWidget;
|
||||
@@ -51,6 +53,8 @@ class GeocodeWidget extends \Widget
|
||||
* @param mixed $value Given value.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.Superglobals)
|
||||
*/
|
||||
protected function validator($value)
|
||||
{
|
||||
@@ -60,13 +64,11 @@ class GeocodeWidget extends \Widget
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (
|
||||
// See: http://stackoverflow.com/a/18690202
|
||||
!preg_match(
|
||||
'#^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)(,[-+]?\d+)?$#',
|
||||
$value
|
||||
)
|
||||
) {
|
||||
// See: http://stackoverflow.com/a/18690202
|
||||
if (!preg_match(
|
||||
'#^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)(,[-+]?\d+)?$#',
|
||||
$value
|
||||
)) {
|
||||
$this->addError(
|
||||
sprintf(
|
||||
$GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'],
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Geocode backend widget based on Leaflet.
|
||||
*
|
||||
* @package netzmacht
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2017 netzmacht David Molineus. All rights reserved.
|
||||
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
|
||||
* @filesource
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\GeocodeWidget;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Geocode backend widget based on Leaflet.
|
||||
*
|
||||
* @package netzmacht
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2017 netzmacht David Molineus. All rights reserved.
|
||||
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
|
||||
* @filesource
|
||||
*
|
||||
*/
|
||||
|
||||
$GLOBALS['BE_FFL']['leaflet_geocode'] = 'Netzmacht\Contao\Leaflet\GeocodeWidget\GeocodeWidget';
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Geocode backend widget based on Leaflet.
|
||||
*
|
||||
* @package netzmacht
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2017 netzmacht David Molineus. All rights reserved.
|
||||
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
|
||||
* @filesource
|
||||
*
|
||||
*/
|
||||
|
||||
$GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'] = 'Die angegebenen Koordinaten sind ungültig.';
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Geocode backend widget based on Leaflet.
|
||||
*
|
||||
* @package netzmacht
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2017 netzmacht David Molineus. All rights reserved.
|
||||
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
|
||||
* @filesource
|
||||
*
|
||||
*/
|
||||
|
||||
$GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'] = 'Invalid coordinates given.';
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/**
|
||||
* Geocode backend widget based on Leaflet.
|
||||
*
|
||||
* @package netzmacht
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
var LeafletGeocodeWidget = L.Class.extend({
|
||||
options: {
|
||||
mapTemplate: '<div id="leaflet_geocode_widget_map_{id}" class="" style="width 100%; height: 50vh; min-height: 400px"></div>',
|
||||
@@ -31,8 +41,12 @@ var LeafletGeocodeWidget = L.Class.extend({
|
||||
'hideFooter': true,
|
||||
'draggable': false,
|
||||
'overlayOpacity': .5,
|
||||
'onShow': function() { document.body.setStyle('overflow', 'hidden'); },
|
||||
'onHide': function() { document.body.setStyle('overflow', 'auto'); }
|
||||
'onShow': function () {
|
||||
document.body.setStyle('overflow', 'hidden');
|
||||
},
|
||||
'onHide': function () {
|
||||
document.body.setStyle('overflow', 'auto');
|
||||
}
|
||||
});
|
||||
},
|
||||
_createMap: function (modal) {
|
||||
@@ -69,7 +83,7 @@ var LeafletGeocodeWidget = L.Class.extend({
|
||||
|
||||
link.set('style', 'margin-left: 10px;');
|
||||
link.appendText(this.options.applyPositionLabel);
|
||||
link.addEvent('click', function(e) {
|
||||
link.addEvent('click', function (e) {
|
||||
e.stop();
|
||||
|
||||
this.element.set('value', result.center.lat + ',' + result.center.lng);
|
||||
|
||||
Reference in New Issue
Block a user