mirror of
https://github.com/netzmacht/contao-leaflet-geocode-widget.git
synced 2025-11-30 20:53:41 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7192d0972 | ||
|
|
5a56204a22 | ||
|
|
32e2c7578d | ||
|
|
e933eb0126 | ||
|
|
f4fc8c9fe5 | ||
|
|
1964dab9e8 |
10
.gitattributes
vendored
Normal file
10
.gitattributes
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
.check-author.yml export-ignore
|
||||||
|
.gitattributes export-ignore
|
||||||
|
.github export-ignore
|
||||||
|
.gitignore export-ignore
|
||||||
|
.travis.yml export-ignore
|
||||||
|
build.default.properties export-ignore
|
||||||
|
build.xml export-ignore
|
||||||
|
phpunit.xml.dist export-ignore
|
||||||
|
/tests export-ignore
|
||||||
|
/specs export-ignore
|
||||||
30
.gitignore
vendored
30
.gitignore
vendored
@@ -1,10 +1,24 @@
|
|||||||
/vendor/
|
# OS
|
||||||
/bin/
|
.DS_Store
|
||||||
/demo/
|
Thumbs.db
|
||||||
/assets/js/*.js
|
.directory
|
||||||
/node_modules/
|
|
||||||
/.tx/
|
|
||||||
|
|
||||||
coverage.xml
|
# IDEs
|
||||||
|
.buildpath
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
|
.build/
|
||||||
|
.external*/
|
||||||
|
.idea/
|
||||||
|
nbproject/
|
||||||
|
|
||||||
|
# composer related
|
||||||
|
vendor/
|
||||||
composer.lock
|
composer.lock
|
||||||
npm-debug.log
|
|
||||||
|
# build
|
||||||
|
build/
|
||||||
|
build.properties
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
.tx
|
||||||
|
|||||||
28
.travis.yml
Normal file
28
.travis.yml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
language: php
|
||||||
|
|
||||||
|
php:
|
||||||
|
- "5.6"
|
||||||
|
- "7.0"
|
||||||
|
- "7.1"
|
||||||
|
|
||||||
|
env:
|
||||||
|
- CONTAO_VERSION=contao/core-bundle ^4.4.2
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
exclude:
|
||||||
|
|
||||||
|
sudo: false
|
||||||
|
|
||||||
|
install:
|
||||||
|
- travis_retry composer self-update && composer --version
|
||||||
|
- travis_retry composer require $CONTAO_VERSION --no-update
|
||||||
|
- travis_retry composer update --prefer-dist --no-interaction
|
||||||
|
|
||||||
|
script: ant -keep-going
|
||||||
|
|
||||||
|
git:
|
||||||
|
depth: 2147483647
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- vendor
|
||||||
12
CHANGELOG.md
Normal file
12
CHANGELOG.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
Changelog
|
||||||
|
=========
|
||||||
|
|
||||||
|
Version 1.1.0
|
||||||
|
-------------
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/netzmacht/contao-leaflet-geocode-widget/compare/1.0.0...1.1.0)
|
||||||
|
|
||||||
|
- Add wizard class using an extra div wrapper
|
||||||
|
- Require Contao 4.4.2 (BC break in Contao see #1)
|
||||||
|
- Apply coding standards
|
||||||
165
LICENSE
Normal file
165
LICENSE
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
14
README.md
14
README.md
@@ -1,13 +1,23 @@
|
|||||||
Leaflet geocode widget
|
Leaflet geocode widget
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
[](https://travis-ci.org/netzmacht/contao-leaflet-geocode-widget)
|
||||||
|
[](http://packagist.org/packages/netzmacht/contao-leaflet-geocode-widget)
|
||||||
|
[](http://packagist.org/packages/netzmacht/contao-leaflet-geocode-widget)
|
||||||
|
[](http://packagist.org/packages/netzmacht/contao-leaflet-geocode-widget)
|
||||||
|
[](https://github.com/contao-community-alliance/coding-standard)
|
||||||
|
|
||||||
This extension provides an widget to pick coordinates from a map. It uses the leaflet framework.
|
This extension provides an widget to pick coordinates from a map. It uses the leaflet framework.
|
||||||
|
|
||||||
|
Changlog
|
||||||
|
--------
|
||||||
|
|
||||||
|
See [CHANGELOG](CHANGELOG.md).
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Contao 4.3
|
- Contao ~4.4
|
||||||
|
|
||||||
|
|
||||||
Install
|
Install
|
||||||
@@ -46,7 +56,7 @@ $GLOBALS['TL_DCA']['tl_example']['fields']['coordinates'] = [
|
|||||||
'label' => ['Koordinaten', 'Geben Sie die Koordinaten ein'],
|
'label' => ['Koordinaten', 'Geben Sie die Koordinaten ein'],
|
||||||
'inputType' => 'leaflet_geocode',
|
'inputType' => 'leaflet_geocode',
|
||||||
'eval' => [
|
'eval' => [
|
||||||
'tl_class' => 'w50 wizard',
|
'tl_class' => 'w50',
|
||||||
],
|
],
|
||||||
'sql' => 'varchar(255) NOT NULL default \'\''
|
'sql' => 'varchar(255) NOT NULL default \'\''
|
||||||
];
|
];
|
||||||
|
|||||||
4
build.default.properties
Normal file
4
build.default.properties
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
phpcs.standard=${basedir}/vendor/phpcq/coding-standard/phpcs/PhpCodeQuality/ruleset.xml
|
||||||
|
phpmd.ruleset=${basedir}/vendor/phpcq/coding-standard/phpmd/ruleset.xml
|
||||||
|
phpcs.excluded = src/Resources/contao/languages
|
||||||
|
phpcpd.excluded = contao
|
||||||
5
build.xml
Normal file
5
build.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project name="netzmacht/contao-leaflet-geocode-widget" default="build">
|
||||||
|
<!-- import the main build system -->
|
||||||
|
<import file="vendor/phpcq/phpcq/phpcq.main.xml" />
|
||||||
|
</project>
|
||||||
@@ -24,17 +24,13 @@
|
|||||||
"source": "https://github.com/contao-bootstrap/core"
|
"source": "https://github.com/contao-bootstrap/core"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.5.0",
|
"php": ">=5.6.0",
|
||||||
"contao/core-bundle": "~4.3",
|
"contao/core-bundle": "~4.4.0",
|
||||||
"contao-community-alliance/composer-plugin": "~2.4 || ~3.0",
|
|
||||||
"netzmacht/contao-leaflet-libraries": "~1.0"
|
"netzmacht/contao-leaflet-libraries": "~1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"netzmacht/contao-build-tools": "~1.1",
|
"contao/manager-plugin": "^2.0",
|
||||||
"contao/manager-plugin": "^2.0"
|
"phpcq/all-tasks": "^1.2"
|
||||||
},
|
|
||||||
"conflict": {
|
|
||||||
"contao/manager-plugin": "<2.0 || >=3.0"
|
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"netzmacht/contao-leaflet-maps": "Leaflet Maps for Contao"
|
"netzmacht/contao-leaflet-maps": "Leaflet Maps for Contao"
|
||||||
@@ -50,7 +46,5 @@
|
|||||||
"dev-develop": "1.1.x-dev"
|
"dev-develop": "1.1.x-dev"
|
||||||
},
|
},
|
||||||
"contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\GeocodeWidget\\ContaoManager\\Plugin"
|
"contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\GeocodeWidget\\ContaoManager\\Plugin"
|
||||||
},
|
}
|
||||||
"minimum-stability": "dev",
|
|
||||||
"prefer-stable": true
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Geocode backend widget based on Leaflet.
|
||||||
|
*
|
||||||
* @package netzmacht
|
* @package netzmacht
|
||||||
* @author David Molineus <david.molineus@netzmacht.de>
|
* @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
|
* @filesource
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\GeocodeWidget\ContaoManager;
|
namespace Netzmacht\Contao\Leaflet\GeocodeWidget\ContaoManager;
|
||||||
@@ -17,7 +19,7 @@ use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
|
|||||||
use Netzmacht\Contao\Leaflet\GeocodeWidget\LeafletGeocodeWidgetBundle;
|
use Netzmacht\Contao\Leaflet\GeocodeWidget\LeafletGeocodeWidgetBundle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Plugin
|
* Contao Manager plugin.
|
||||||
*
|
*
|
||||||
* @package Netzmacht\Contao\Leaflet\GeocodeWidget\ContaoManager
|
* @package Netzmacht\Contao\Leaflet\GeocodeWidget\ContaoManager
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Geocode backend widget based on Leaflet.
|
||||||
|
*
|
||||||
* @package netzmacht
|
* @package netzmacht
|
||||||
* @author David Molineus <david.molineus@netzmacht.de>
|
* @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
|
* @filesource
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\GeocodeWidget;
|
namespace Netzmacht\Contao\Leaflet\GeocodeWidget;
|
||||||
@@ -51,6 +53,8 @@ class GeocodeWidget extends \Widget
|
|||||||
* @param mixed $value Given value.
|
* @param mixed $value Given value.
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD.Superglobals)
|
||||||
*/
|
*/
|
||||||
protected function validator($value)
|
protected function validator($value)
|
||||||
{
|
{
|
||||||
@@ -60,13 +64,11 @@ class GeocodeWidget extends \Widget
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
// See: http://stackoverflow.com/a/18690202
|
||||||
// See: http://stackoverflow.com/a/18690202
|
if (!preg_match(
|
||||||
!preg_match(
|
'#^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)(,[-+]?\d+)?$#',
|
||||||
'#^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)(,[-+]?\d+)?$#',
|
$value
|
||||||
$value
|
)) {
|
||||||
)
|
|
||||||
) {
|
|
||||||
$this->addError(
|
$this->addError(
|
||||||
sprintf(
|
sprintf(
|
||||||
$GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'],
|
$GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'],
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Geocode backend widget based on Leaflet.
|
||||||
|
*
|
||||||
* @package netzmacht
|
* @package netzmacht
|
||||||
* @author David Molineus <david.molineus@netzmacht.de>
|
* @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
|
* @filesource
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\GeocodeWidget;
|
namespace Netzmacht\Contao\Leaflet\GeocodeWidget;
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Geocode backend widget based on Leaflet.
|
||||||
|
*
|
||||||
* @package netzmacht
|
* @package netzmacht
|
||||||
* @author David Molineus <david.molineus@netzmacht.de>
|
* @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
|
* @filesource
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$GLOBALS['BE_FFL']['leaflet_geocode'] = 'Netzmacht\Contao\Leaflet\GeocodeWidget\GeocodeWidget';
|
$GLOBALS['BE_FFL']['leaflet_geocode'] = 'Netzmacht\Contao\Leaflet\GeocodeWidget\GeocodeWidget';
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Geocode backend widget based on Leaflet.
|
||||||
|
*
|
||||||
* @package netzmacht
|
* @package netzmacht
|
||||||
* @author David Molineus <david.molineus@netzmacht.de>
|
* @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
|
* @filesource
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'] = 'Die angegebenen Koordinaten sind ungültig.';
|
$GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'] = 'Die angegebenen Koordinaten sind ungültig.';
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Geocode backend widget based on Leaflet.
|
||||||
|
*
|
||||||
* @package netzmacht
|
* @package netzmacht
|
||||||
* @author David Molineus <david.molineus@netzmacht.de>
|
* @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
|
* @filesource
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'] = 'Invalid coordinates given.';
|
$GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'] = 'Invalid coordinates given.';
|
||||||
|
|||||||
@@ -9,15 +9,17 @@ $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/leafletgeocodewidget/js/geocode.widget.js
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<input type="text"
|
<div class="wizard">
|
||||||
name="<?= $this->name ?>"
|
<input type="text"
|
||||||
id="ctrl_<?= $this->id ?>"
|
name="<?= $this->name ?>"
|
||||||
class="tl_text tl_leaflet_geocode<?= $this->class ?>"
|
id="ctrl_<?= $this->id ?>"
|
||||||
value="<?= $this->value ?>"<?= $this->attributes ?>
|
class="tl_text tl_leaflet_geocode<?= $this->class ?>"
|
||||||
onfocus="Backend.getScrollOffset()"
|
value="<?= $this->value ?>"<?= $this->attributes ?>
|
||||||
>
|
onfocus="Backend.getScrollOffset()"
|
||||||
|
>
|
||||||
|
|
||||||
<img src="bundles/leafletgeocodewidget/img/map.png" id="ctrl_<?= $this->id ?>_toggle">
|
<img src="bundles/leafletgeocodewidget/img/map.png" id="ctrl_<?= $this->id ?>_toggle">
|
||||||
|
</div>
|
||||||
|
|
||||||
<?= $this->wizard ?>
|
<?= $this->wizard ?>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -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({
|
var LeafletGeocodeWidget = L.Class.extend({
|
||||||
options: {
|
options: {
|
||||||
mapTemplate: '<div id="leaflet_geocode_widget_map_{id}" class="" style="width 100%; height: 50vh; min-height: 400px"></div>',
|
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,
|
'hideFooter': true,
|
||||||
'draggable': false,
|
'draggable': false,
|
||||||
'overlayOpacity': .5,
|
'overlayOpacity': .5,
|
||||||
'onShow': function() { document.body.setStyle('overflow', 'hidden'); },
|
'onShow': function () {
|
||||||
'onHide': function() { document.body.setStyle('overflow', 'auto'); }
|
document.body.setStyle('overflow', 'hidden');
|
||||||
|
},
|
||||||
|
'onHide': function () {
|
||||||
|
document.body.setStyle('overflow', 'auto');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_createMap: function (modal) {
|
_createMap: function (modal) {
|
||||||
@@ -69,7 +83,7 @@ var LeafletGeocodeWidget = L.Class.extend({
|
|||||||
|
|
||||||
link.set('style', 'margin-left: 10px;');
|
link.set('style', 'margin-left: 10px;');
|
||||||
link.appendText(this.options.applyPositionLabel);
|
link.appendText(this.options.applyPositionLabel);
|
||||||
link.addEvent('click', function(e) {
|
link.addEvent('click', function (e) {
|
||||||
e.stop();
|
e.stop();
|
||||||
|
|
||||||
this.element.set('value', result.center.lat + ',' + result.center.lng);
|
this.element.set('value', result.center.lat + ',' + result.center.lng);
|
||||||
|
|||||||
Reference in New Issue
Block a user