mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-11-28 19:13:55 +01:00
Add credits page
This commit is contained in:
80
module/assets/css/credits.css
Normal file
80
module/assets/css/credits.css
Normal file
@@ -0,0 +1,80 @@
|
||||
|
||||
.netzmacht-leaflet-credits .tl_box {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
|
||||
.netzmacht-leaflet-credits a {
|
||||
color: #669A00;
|
||||
}
|
||||
|
||||
.netzmacht-leaflet-credits .header {
|
||||
background: #82cb00;
|
||||
background-image: -webkit-linear-gradient(top, #b0de5c, #82cb00);
|
||||
padding: 20px 15px 5px;
|
||||
}
|
||||
|
||||
.netzmacht-leaflet-credits h1 {
|
||||
color: #fff;
|
||||
font-size: 1.4em;
|
||||
text-shadow: 0 -1px 1px rgba(0,0,0,0.35);
|
||||
}
|
||||
|
||||
.netzmacht-leaflet-credits .row:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
clear: both;
|
||||
font-size: 0;
|
||||
height: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.netzmacht-leaflet-credits .row > .left {
|
||||
width: 55%;
|
||||
float: left;
|
||||
padding-right: 5%;
|
||||
}
|
||||
|
||||
.netzmacht-leaflet-credits .row > .right {
|
||||
width: 40%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.netzmacht-leaflet-credits .row > .col {
|
||||
width: 30%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.netzmacht-leaflet-credits .row > .col + .col {
|
||||
margin-left: 4%;
|
||||
}
|
||||
|
||||
.netzmacht-leaflet-credits th {
|
||||
background: #ddd;
|
||||
border-top: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding: 5px 3px 3px;
|
||||
}
|
||||
|
||||
.netzmacht-leaflet-credits td {
|
||||
padding: 2px 3px;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
}
|
||||
|
||||
.netzmacht-leaflet-credits th.subtitle {
|
||||
background: #f6f6f6;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.netzmacht-leaflet-credits .btn {
|
||||
background: #619A00;
|
||||
color: #fff;
|
||||
padding: 5px 8px;
|
||||
border-radius: 3px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.netzmacht-leaflet-credits .btn:hover {
|
||||
background: #82cb00;
|
||||
color: #333;
|
||||
}
|
||||
@@ -4,5 +4,6 @@ TemplateLoader::addFiles(
|
||||
array(
|
||||
'ce_leaflet_map' => 'system/modules/leaflet/templates',
|
||||
'be_leaflet_geocode' => 'system/modules/leaflet/templates',
|
||||
'be_leaflet_credits' => 'system/modules/leaflet/templates',
|
||||
)
|
||||
);
|
||||
|
||||
@@ -31,6 +31,12 @@ array_insert(
|
||||
),
|
||||
'icon' => 'system/modules/leaflet/assets/img/layers.png',
|
||||
'stylesheet' => 'system/modules/leaflet/assets/css/backend.css',
|
||||
),
|
||||
'leaflet_credits' => array
|
||||
(
|
||||
'callback' => 'Netzmacht\Contao\Leaflet\Backend\Credits',
|
||||
'icon' => 'system/modules/leaflet/assets/img/info.png',
|
||||
'stylesheet' => 'system/modules/leaflet/assets/css/credits.css',
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -39,7 +45,7 @@ array_insert(
|
||||
/*
|
||||
* Content elements.
|
||||
*/
|
||||
$GLOBALS['TL_CTE']['includes']['leaflet'] = 'Netzmacht\Contao\Leaflet\LeafletMapElement';
|
||||
$GLOBALS['TL_CTE']['includes']['leaflet'] = 'Netzmacht\Contao\Leaflet\Frontend\MapElement';
|
||||
|
||||
|
||||
/*
|
||||
@@ -250,28 +256,48 @@ require_once TL_ROOT . '/system/modules/leaflet/config/leaflet_providers.php';
|
||||
* You don't have to define it as array if you simply add a file. Do not add |static and or media type flag to it.
|
||||
* It's getting added by default if not being in debug mode.
|
||||
*/
|
||||
$GLOBALS['LEAFLET_ASSETS'] = array
|
||||
$GLOBALS['LEAFLET_LIBRARIES'] = array
|
||||
(
|
||||
'leaflet' => array
|
||||
(
|
||||
'name' => 'Leaflet',
|
||||
'version' => '0.7.3',
|
||||
'license' => '<a href="https://github.com/Leaflet/Leaflet/blob/master/LICENSE" target="_blank">BSD-2-Clause</a>',
|
||||
'homepage' => 'http://leafletjs.com',
|
||||
'css' => 'assets/leaflet/libs/leaflet/leaflet.css',
|
||||
'javascript' => 'assets/leaflet/libs/leaflet/leaflet.js'
|
||||
),
|
||||
'leaflet-providers' => array
|
||||
(
|
||||
'name' => 'Leaflet-providers',
|
||||
'version' => '1.0.12',
|
||||
'license' => '<a href="https://github.com/leaflet-extras/leaflet-providers/blob/master/license.md" target="_blank">BSD-2-Clause</a>',
|
||||
'homepage' => 'http://leaflet-extras.github.io/leaflet-providers',
|
||||
'javascript' => 'assets/leaflet/libs/leaflet-providers/leaflet-providers.js'
|
||||
),
|
||||
'leaflet-ajax' => array
|
||||
(
|
||||
'name' => 'Leaflet-ajax',
|
||||
'version' => '1.1.0',
|
||||
'license' => '<a href="https://github.com/calvinmetcalf/leaflet-ajax/blob/master/license.md" target="_blank">MIT</a>',
|
||||
'homepage' => 'https://github.com/calvinmetcalf/leaflet-ajax',
|
||||
'javascript' => 'assets/leaflet/libs/leaflet-ajax/leaflet.ajax.min.js'
|
||||
),
|
||||
'leaflet-loading' => array
|
||||
(
|
||||
'name' => 'Leaflet.loading',
|
||||
'version' => '0.1.13 ',
|
||||
'license' => '<a href="https://github.com/ebrelsford/Leaflet.loading/blob/master/LICENSE" target="_blank">MIT</a>',
|
||||
'homepage' => 'https://github.com/ebrelsford/Leaflet.loading',
|
||||
'css' => 'assets/leaflet/libs/leaflet-loading/Control.Loading.css',
|
||||
'javascript' => 'assets/leaflet/libs/leaflet-loading/Control.Loading.js'
|
||||
),
|
||||
'spin.js' => array
|
||||
(
|
||||
'name' => 'spin.js',
|
||||
'version' => '2.0.2',
|
||||
'license' => '<a href="https://github.com/fgnass/spin.js/blob/master/LICENSE.txt" target="_blank">MIT</a>',
|
||||
'homepage' => 'http://fgnass.github.io/spin.js',
|
||||
'javascript' => 'assets/leaflet/libs/spin-js/spin.min.js'
|
||||
)
|
||||
);
|
||||
|
||||
@@ -6,6 +6,8 @@ $GLOBALS['TL_LANG']['MOD']['leaflet_map'][0] = 'Leaflet Maps';
|
||||
$GLOBALS['TL_LANG']['MOD']['leaflet_map'][1] = 'Manage Leaflet maps';
|
||||
$GLOBALS['TL_LANG']['MOD']['leaflet_layer'][0] = 'Map Layers';
|
||||
$GLOBALS['TL_LANG']['MOD']['leaflet_layer'][1] = 'Manage map layers';
|
||||
$GLOBALS['TL_LANG']['MOD']['leaflet_credits'][0] = 'Support it';
|
||||
$GLOBALS['TL_LANG']['MOD']['leaflet_credits'][1] = 'Contao leaflet integration credits';
|
||||
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_map'] = 'Maps';
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_layer'] = 'Layers';
|
||||
|
||||
104
module/templates/be_leaflet_credits.html5
Normal file
104
module/templates/be_leaflet_credits.html5
Normal file
@@ -0,0 +1,104 @@
|
||||
<div class="netzmacht-leaflet-credits">
|
||||
<div class="header">
|
||||
<h1 class="sub_headline"><?php echo $this->headline; ?> <small><?php echo $this->version; ?></small></h1>
|
||||
</div>
|
||||
|
||||
<div class="tl_box block row">
|
||||
<h2>About</h2>
|
||||
<div class="left">
|
||||
<p>
|
||||
The Leaflet maps integration for Contao CMS is an Open Source Software license under the LGPL 3.0.
|
||||
This extension is only exists because of great other Open Source Software which it heavenly depends on.
|
||||
</p>
|
||||
<p>
|
||||
This software ships with an visible attribution to <em>netzmacht creative</em> in the map attribution control.
|
||||
If you want to remove this attribution, you have to purchase a commercial license.
|
||||
For more details see the <a href="http://contao-leaflet.netzmacht.de" target="_blank">project website</a>.
|
||||
</p>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a href="http://www.netzmacht.de" <?php echo LINK_NEW_WINDOW; ?>>
|
||||
<img src="system/modules/leaflet/assets/img/logo.png"></a>
|
||||
<p>
|
||||
<strong class="company">netzmacht <em>creative</em></strong><br>
|
||||
David Molineus<br>
|
||||
</p>
|
||||
<p>
|
||||
DAB Bank München<br>
|
||||
IBAN: DE52701204008354237003<br>
|
||||
BIC: DABBDEMMXXX
|
||||
</p>
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
||||
<input type="hidden" name="cmd" value="_s-xclick">
|
||||
<input type="hidden" name="hosted_button_id" value="TEL6L9MHSBD32">
|
||||
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tl_box">
|
||||
<h2>Support Contao Leaflet</h2>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h3>Fund a feature</h3>
|
||||
<p>Contao Leaflet is not feature complete. Have a look at the list of planned feature and support them.</p>
|
||||
<p><a href="http://contao-leaflet.netzmacht.de/panned-features.html" class="btn" target="_blank">Planned features</a> </p>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h3>Individual development</h3>
|
||||
<p>If you have special requirements you can hire me for an individual development.</p>
|
||||
<p><a href="http://contao-leaflet.netzmacht.de/contact.html" class="btn" target="_blank">Contact</a> </p>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h3>Commercial license</h3>
|
||||
<p>If you want to remove the attribution in the attribution control, you can purchase a commercial license.</p>
|
||||
<p><a href="http://contao-leaflet.netzmacht.de/commercial-license.html" class="btn" target="_blank">Purchase license</a> </p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tl_box">
|
||||
<h2>Credits</h2>
|
||||
<table class="tl_listing">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Version</th>
|
||||
<th>License</th>
|
||||
<th>Homepage</th>
|
||||
</tr>
|
||||
<?php if ($this->libraries): ?>
|
||||
<tr><th colspan="4" class="subtitle">Libraries</th> </tr>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($this->libraries as $library): ?>
|
||||
<tr>
|
||||
<td><?php echo $library['name']; ?></td>
|
||||
<td><?php echo $library['version']; ?></td>
|
||||
<td><?php echo $library['license']; ?></td>
|
||||
<td><?php echo $library['homepage']; ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
<th class="subtitle" colspan="4">Graphics</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Farm Fresh-Web Icons</td>
|
||||
<td>3.9.2</td>
|
||||
<td><a href="http://creativecommons.org/licenses/by/3.0/us/" target="_blank">CC BY 3.0 US</a></td>
|
||||
<td><a href="http://www.fatcow.com/free-icons" target="_blank">fatcow.com/free-icons</a></td>
|
||||
</tr>
|
||||
<?php if ($this->dependencies): ?>
|
||||
<tr><th colspan="4" class="subtitle">Dependencies</th> </tr>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($this->dependencies as $dep): ?>
|
||||
<tr>
|
||||
<td><?php echo $dep['name']; ?></td>
|
||||
<td><?php echo $dep['version']; ?></td>
|
||||
<td><?php echo $dep['license']; ?></td>
|
||||
<td><?php echo $dep['homepage']; ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
93
src/Netzmacht/Contao/Leaflet/Backend/Credits.php
Normal file
93
src/Netzmacht/Contao/Leaflet/Backend/Credits.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package dev
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2015 netzmacht creative David Molineus
|
||||
* @license LGPL 3.0
|
||||
* @filesource
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Backend;
|
||||
|
||||
|
||||
class Credits
|
||||
{
|
||||
public function generate()
|
||||
{
|
||||
$template = new \BackendTemplate('be_leaflet_credits');
|
||||
|
||||
$template->headline = 'Leaftlet maps integration for Contao CMS';
|
||||
$template->libraries = $this->getLibraries();
|
||||
|
||||
list($template->version, $template->dependencies) = $this->extractFromComposer();
|
||||
|
||||
return $template->parse();
|
||||
}
|
||||
|
||||
private function getLibraries()
|
||||
{
|
||||
return array_map(
|
||||
function ($library) {
|
||||
$library = array_merge(
|
||||
array(
|
||||
'homepage' => null,
|
||||
'version' => null,
|
||||
),
|
||||
$library
|
||||
);
|
||||
|
||||
if ($library['homepage']) {
|
||||
$library['homepage'] = sprintf(
|
||||
'<a href="%s" %s>%s</a>',
|
||||
$library['homepage'],
|
||||
LINK_NEW_WINDOW,
|
||||
preg_replace('#^(https?://(www)?)#i', '', $library['homepage'])
|
||||
);
|
||||
}
|
||||
|
||||
return $library;
|
||||
},
|
||||
array_filter(
|
||||
$GLOBALS['LEAFLET_LIBRARIES'],
|
||||
function ($library) {
|
||||
return isset($library['name']) && isset($library['license']);
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private function extractFromComposer()
|
||||
{
|
||||
$local = TL_ROOT . '/composer/vendor/netzmacht/contao-leaflet-maps/composer.json';
|
||||
$composer = TL_ROOT . '/composer/composer.lock';
|
||||
|
||||
if (!file_exists($local)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$local = json_decode(file_get_contents($local), true);
|
||||
$installed = json_decode(file_get_contents($composer), true);
|
||||
$deps = array();
|
||||
$version = null;
|
||||
|
||||
foreach ($installed['packages'] as $package) {
|
||||
if ($package['name'] === 'netzmacht/contao-leaflet-maps') {
|
||||
$version = $package['version'];
|
||||
} elseif (isset($local['require'][$package['name']])) {
|
||||
$deps[] = array(
|
||||
'name' => $package['name'],
|
||||
'version' => $package['version'],
|
||||
'license' => !empty($package['license']) ? implode(', ', $package['license']) : '',
|
||||
'homepage' => sprintf(
|
||||
'<a href="https://packagist.org/packages/%s" target="_blank">Visit packagist</a>',
|
||||
$package['name']
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return array($version, $deps);
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class BootSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
$builder = $event->getBuilder();
|
||||
|
||||
foreach ($GLOBALS['LEAFLET_ASSETS'] as $name => $assets) {
|
||||
foreach ($GLOBALS['LEAFLET_LIBRARIES'] as $name => $assets) {
|
||||
if (!empty($assets['css'])) {
|
||||
list ($source, $type) = (array) $assets['css'];
|
||||
$builder->registerStylesheet($name, $source, $type ?: Assets::TYPE_FILE);
|
||||
|
||||
Reference in New Issue
Block a user