Files
contao-leaflet-maps/module/dca/tl_leaflet_layer.php

375 lines
15 KiB
PHP
Raw Normal View History

2014-12-29 16:22:16 +01:00
<?php
2015-01-12 19:03:29 +01:00
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
2015-01-08 12:27:08 +01:00
\Controller::loadLanguageFile('leaflet');
2014-12-29 16:22:16 +01:00
$GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
(
'config' => array(
2015-01-09 23:02:09 +01:00
'dataContainer' => 'Table',
'enableVersioning' => true,
'ctable' => array('tl_leaflet_vector', 'tl_leaflet_marker'),
'ondelete_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Layer', 'deleteRelations'),
),
2014-12-29 16:22:16 +01:00
'sql' => array
(
'keys' => array
(
2015-01-09 17:40:50 +01:00
'id' => 'primary',
'pid' => 'index',
'alias' => 'unique',
2014-12-29 16:22:16 +01:00
)
2015-01-09 23:02:09 +01:00
),
2014-12-29 16:22:16 +01:00
),
'list' => array
(
'sorting' => array
(
'mode' => 5,
'fields' => array('title'),
2014-12-29 19:13:55 +01:00
'flag' => 1,
2015-01-05 12:25:46 +01:00
'icon' => 'system/modules/leaflet/assets/img/layers.png',
2015-01-08 16:27:55 +01:00
'panelLayout' => 'filter;search,limit',
2015-01-05 12:25:46 +01:00
'paste_button_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getPasteButtons'),
2014-12-29 16:22:16 +01:00
),
'label' => array
(
'fields' => array('title'),
2015-01-06 14:55:53 +01:00
'format' => '%s',
'label_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'generateRow')
2014-12-29 16:22:16 +01:00
),
'global_operations' => array
(
2015-01-09 11:53:58 +01:00
'styles' => array
2015-01-05 12:25:46 +01:00
(
2015-01-09 11:53:58 +01:00
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['styles'],
'href' => 'table=tl_leaflet_style',
'icon' => 'system/modules/leaflet/assets/img/style.png',
'attributes' => 'onclick="Backend.getScrollOffset();"'
2015-01-05 12:25:46 +01:00
),
2015-01-06 21:52:36 +01:00
'icons' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['icons'],
'href' => 'table=tl_leaflet_icon',
'icon' => 'system/modules/leaflet/assets/img/icons.png',
2015-01-09 11:53:58 +01:00
'attributes' => 'onclick="Backend.getScrollOffset();"'
2015-01-06 21:52:36 +01:00
),
2014-12-29 16:22:16 +01:00
'all' => array
(
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
'href' => 'act=select',
'class' => 'header_edit_all',
2015-01-09 11:53:58 +01:00
'attributes' => 'onclick="Backend.getScrollOffset();"'
2014-12-29 16:22:16 +01:00
)
),
'operations' => array
(
2015-01-06 14:55:53 +01:00
'markers' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['markers'],
'href' => 'table=tl_leaflet_marker',
'icon' => 'edit.gif',
'button_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'generateMarkersButton'),
),
2015-01-06 18:49:22 +01:00
'vectors' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['vectors'],
'href' => 'table=tl_leaflet_vector',
'icon' => 'edit.gif',
'button_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'generateVectorsButton'),
),
2014-12-29 16:22:16 +01:00
'edit' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['edit'],
'href' => 'act=edit',
'icon' => 'header.gif'
),
'copy' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['copy'],
'href' => 'act=copy',
'icon' => 'copy.gif'
),
2015-01-05 12:25:46 +01:00
'cut' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['cut'],
'href' => 'act=paste&amp;mode=cut',
'icon' => 'cut.gif',
'attributes' => 'onclick="Backend.getScrollOffset()"',
),
2014-12-29 16:22:16 +01:00
'delete' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"'
),
2015-01-06 14:55:53 +01:00
'toggle' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\DevTools\Dca::createToggleIconCallback(
'tl_leaflet_layer',
'active'
)
),
2014-12-29 16:22:16 +01:00
'show' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['show'],
'href' => 'act=show',
'icon' => 'show.gif'
)
)
),
2015-01-06 14:55:53 +01:00
'palettes' => array(
'__selector__' => array('type'),
),
2014-12-29 16:22:16 +01:00
'metapalettes' => array(
'default' => array(
2015-01-06 14:55:53 +01:00
'title' => array('title', 'alias', 'type'),
2015-01-12 09:20:01 +01:00
'config' => array(),
'expert' => array(':hide'),
2015-01-06 14:55:53 +01:00
'active' => array('active'),
),
'markers extends default' => array(
2015-01-06 18:49:22 +01:00
'+title' => array('markerCluster'),
'+expert' => array('pointToLayer'),
2015-01-06 18:49:22 +01:00
'+active' => array('deferred')
2014-12-29 16:22:16 +01:00
),
2015-01-07 12:13:26 +01:00
'group extends default' => array(
'+title' => array('groupType'),
2015-01-07 17:59:56 +01:00
),
'vectors extends default' => array(
'+expert' => array('onEachFeature', 'pointToLayer'),
2015-01-07 17:59:56 +01:00
'+active' => array('deferred'),
),
2015-01-09 15:24:34 +01:00
'reference extends default' => array(
'+title' => array('reference', 'standalone')
2015-01-09 15:24:34 +01:00
)
2014-12-29 16:22:16 +01:00
),
'metasubselectpalettes' => array(
'type' => array(
'provider' => array('tile_provider', 'tile_provider_variant')
),
'tile_provider' => array(
'MapBox' => array('tile_provider_key'),
'HERE' => array('tile_provider_key', 'tile_provider_code'),
),
),
'fields' => array
(
2015-01-06 14:55:53 +01:00
'id' => array
2014-12-29 16:22:16 +01:00
(
2015-01-06 14:55:53 +01:00
'sql' => "int(10) unsigned NOT NULL auto_increment"
2014-12-29 16:22:16 +01:00
),
2015-01-06 14:55:53 +01:00
'pid' => array
2014-12-29 16:22:16 +01:00
(
2015-01-06 14:55:53 +01:00
'sql' => "int(10) unsigned NOT NULL default '0'"
2014-12-29 16:22:16 +01:00
),
2015-01-06 14:55:53 +01:00
'sorting' => array
2014-12-29 16:22:16 +01:00
(
2015-01-08 16:27:55 +01:00
'sql' => "int(10) unsigned NOT NULL default '0'",
2014-12-29 16:22:16 +01:00
),
2015-01-06 14:55:53 +01:00
'tstamp' => array
2014-12-29 16:22:16 +01:00
(
2015-01-06 14:55:53 +01:00
'sql' => "int(10) unsigned NOT NULL default '0'"
2014-12-29 16:22:16 +01:00
),
2015-01-06 14:55:53 +01:00
'title' => array
2014-12-29 16:22:16 +01:00
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['title'],
'exclude' => true,
'inputType' => 'text',
2015-01-08 16:27:55 +01:00
'search' => true,
2014-12-29 16:22:16 +01:00
'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
2015-01-06 14:55:53 +01:00
'alias' => array
2014-12-29 16:22:16 +01:00
(
2015-01-09 17:43:38 +01:00
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['alias'],
'exclude' => true,
'inputType' => 'text',
'search' => true,
'save_callback' => array(
2015-01-10 14:55:44 +01:00
\Netzmacht\Contao\DevTools\Dca::createGenerateAliasCallback('tl_leaflet_layer', 'title'),
2015-01-09 17:43:38 +01:00
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
2014-12-29 16:22:16 +01:00
),
2015-01-06 14:55:53 +01:00
'type' => array
2014-12-29 16:22:16 +01:00
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['type'],
'exclude' => true,
'inputType' => 'select',
2015-01-08 16:27:55 +01:00
'filter' => true,
2014-12-29 16:22:16 +01:00
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50',
'includeBlankOption' => true,
'submitOnChange' => true,
'chosen' => true,
2015-01-08 12:27:08 +01:00
'helpwizard' => true,
2014-12-29 16:22:16 +01:00
),
2015-01-05 12:25:46 +01:00
'options' => array_keys($GLOBALS['LEAFLET_LAYERS']),
2015-01-06 14:55:53 +01:00
'reference' => &$GLOBALS['TL_LANG']['leaflet_layer'],
2014-12-29 16:22:16 +01:00
'sql' => "varchar(32) NOT NULL default ''"
),
2015-01-06 14:55:53 +01:00
'active' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['active'],
'exclude' => true,
'inputType' => 'checkbox',
2015-01-08 16:27:55 +01:00
'filter' => true,
2015-01-06 14:55:53 +01:00
'eval' => array('tl_class' => 'w50'),
'sql' => "char(1) NOT NULL default ''"
),
'tile_provider' => array(
2014-12-29 16:22:16 +01:00
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider'],
'exclude' => true,
'inputType' => 'select',
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50 clr',
'includeBlankOption' => true,
'submitOnChange' => true,
'chosen' => true,
),
'options' => array_keys($GLOBALS['LEAFLET_TILE_PROVIDERS']),
'sql' => "varchar(32) NOT NULL default ''"
),
'tile_provider_variant' => array(
2015-01-06 14:55:53 +01:00
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider_variant'],
'exclude' => true,
'inputType' => 'select',
'eval' => array(
'mandatory' => false,
'tl_class' => 'w50',
'submitOnChange' => true,
'chosen' => false,
2014-12-29 16:22:16 +01:00
),
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getVariants'),
2015-01-06 14:55:53 +01:00
'sql' => "varchar(32) NOT NULL default ''"
2014-12-29 16:22:16 +01:00
),
2015-01-06 14:55:53 +01:00
'tile_provider_key' => array
2014-12-29 16:22:16 +01:00
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider_key'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'clr w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
2015-01-06 14:55:53 +01:00
'tile_provider_code' => array
2014-12-29 16:22:16 +01:00
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider_code'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
2015-01-06 14:55:53 +01:00
'markerCluster' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['markerCluster'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getMarkerClusterLayers'),
'reference' => &$GLOBALS['TL_LANG']['leaflet_layer'],
'eval' => array(
'mandatory' => false,
'maxlength' => 255,
'tl_class' => 'w50',
'chosen' => true,
'includeBlankOption' => true
),
'sql' => "varchar(255) NOT NULL default ''"
),
2015-01-06 15:43:57 +01:00
'deferred' => array
(
2015-01-06 18:49:22 +01:00
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['deferred'],
2015-01-06 15:43:57 +01:00
'exclude' => true,
'inputType' => 'checkbox',
2015-01-07 17:59:56 +01:00
'default' => true,
'eval' => array('tl_class' => 'w50', 'submitOnChange' => false, 'isBoolean' => true),
'sql' => "char(1) NOT NULL default '1'"
2015-01-06 15:43:57 +01:00
),
2015-01-07 12:13:26 +01:00
'groupType' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['groupType'],
'exclude' => true,
'inputType' => 'select',
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50',
'submitOnChange' => true,
'helpwizard' => true,
),
'default' => 'layer',
'options' => array('layer', 'feature'),
'reference' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes'],
'sql' => "varchar(32) NOT NULL default ''"
),
2015-01-09 15:24:34 +01:00
'reference' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['reference'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getLayers'),
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50',
'chosen' => true,
'includeBlankOption' => true,
),
'sql' => "int(10) unsigned NOT NULL default '0'",
),
'standalone' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['standalone'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => false,
'eval' => array('tl_class' => 'w50', 'submitOnChange' => false, 'isBoolean' => true),
'sql' => "char(1) NOT NULL default ''"
),
'onEachFeature' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['onEachFeature'],
'exclude' => true,
'inputType' => 'textarea',
'eval' => array(
'preserveTags' => true,
'decodeEntities' => true,
'allowHtml' => true,
'rte' => 'ace|javascript',
'tl_class' => 'clr'
),
'sql' => "mediumtext NULL"
),
'pointToLayer' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['pointToLayer'],
'exclude' => true,
'inputType' => 'textarea',
'eval' => array(
'preserveTags' => true,
'decodeEntities' => true,
'allowHtml' => true,
'rte' => 'ace|javascript',
'tl_class' => 'clr'
),
'sql' => "mediumtext NULL"
),
2014-12-29 16:22:16 +01:00
)
);