Files
contao-leaflet-maps/src/Resources/contao/dca/tl_leaflet_control.php

457 lines
18 KiB
PHP
Raw Normal View History

2014-12-27 22:58:58 +01:00
<?php
2015-01-12 19:03:29 +01:00
/**
2017-10-05 15:45:43 +02:00
* Leaflet maps for Contao CMS.
*
2016-10-11 10:40:15 +02:00
* @package contao-leaflet-maps
2015-01-12 19:03:29 +01:00
* @author David Molineus <david.molineus@netzmacht.de>
2017-10-05 15:45:43 +02:00
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
2015-01-12 19:03:29 +01:00
* @filesource
*/
2017-10-05 15:45:43 +02:00
2015-01-08 12:27:08 +01:00
\Controller::loadLanguageFile('leaflet');
2014-12-27 22:58:58 +01:00
$GLOBALS['TL_DCA']['tl_leaflet_control'] = array
(
'config' => array(
'dataContainer' => 'Table',
'enableVersioning' => true,
2015-01-05 12:25:46 +01:00
'ptable' => 'tl_leaflet_map',
2014-12-27 22:58:58 +01:00
'sql' => array
(
'keys' => array
(
2015-01-09 17:40:50 +01:00
'id' => 'primary',
'pid' => 'index',
2014-12-27 22:58:58 +01:00
)
),
'onsubmit_callback' => [
['netzmacht.contao_leaflet_maps.listeners.dca.leaflet', 'clearCache'],
],
2014-12-27 22:58:58 +01:00
),
2017-10-05 16:14:46 +02:00
// List configuration
2014-12-27 22:58:58 +01:00
'list' => array
(
'sorting' => array
(
2015-01-05 12:25:46 +01:00
'mode' => 4,
'fields' => array('sorting'),
'headerFields' => array('title'),
'flag' => 1,
2015-01-08 16:27:55 +01:00
'sorting' => 2,
'panelLayout' => 'filter,sort;search,limit',
'child_record_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.control', 'generateRow'],
2014-12-27 22:58:58 +01:00
),
'label' => array
(
'fields' => array('title'),
2015-01-05 12:25:46 +01:00
'format' => '%s',
2014-12-27 22:58:58 +01:00
),
'global_operations' => array
(
'all' => array
(
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
'href' => 'act=select',
'class' => 'header_edit_all',
'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"'
)
),
'operations' => array
(
'edit' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['edit'],
'href' => 'act=edit',
'icon' => 'header.gif'
),
'copy' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['copy'],
'href' => 'act=copy',
'icon' => 'copy.gif'
),
'delete' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
2017-10-05 16:14:46 +02:00
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm']
. '\'))return false;Backend.getScrollOffset()"'
2014-12-27 22:58:58 +01:00
),
2015-01-05 14:58:37 +01:00
'toggle' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => [
'netzmacht.contao_toolkit.dca.listeners.state_button_callback',
'handleButtonCallback'
],
'toolkit' => [
'state_button' => [
'stateColumn' => ['active']
]
],
2015-01-05 14:58:37 +01:00
),
2014-12-27 22:58:58 +01:00
'show' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['show'],
'href' => 'act=show',
'icon' => 'show.gif'
)
)
),
2015-01-05 12:25:46 +01:00
'palettes' => array(
'__selector__' => array('type')
),
2014-12-27 22:58:58 +01:00
'metapalettes' => array(
'default' => array(
2015-01-05 12:25:46 +01:00
'name' => array('title', 'alias', 'type', 'position'),
'config' => array(),
2015-01-06 14:55:53 +01:00
'active' => array('active'),
2014-12-27 22:58:58 +01:00
),
'zoom extends default' => array(
2015-01-05 12:25:46 +01:00
'config' => array('zoomInText', 'zoomOutText', 'zoomInTitle', 'zoomOutTitle'),
2014-12-27 22:58:58 +01:00
),
'layers extends default' => array(
2015-01-05 12:25:46 +01:00
'config' => array('layers', 'collapsed', 'autoZIndex')
2014-12-27 22:58:58 +01:00
),
'scale extends default' => array(
2015-01-05 12:25:46 +01:00
'config' => array('maxWidth', 'metric', 'imperial', 'updateWhenIdle')
2015-01-05 14:58:37 +01:00
),
'attribution extends default' => array(
'config' => array('attributions', 'prefix', 'disableDefault')
2015-01-08 11:01:22 +01:00
),
'loading extends default' => array(
'config' => array('separate', 'zoomControl', 'spinjs')
2015-01-20 17:36:19 +01:00
),
'fullscreen extends default' => array(
'config' => array('buttonTitle', 'separate', 'simulateFullScreen')
),
2014-12-27 22:58:58 +01:00
),
2015-01-08 11:01:22 +01:00
'metasubpalettes' => array(
'spinjs' => array('spin')
),
2014-12-27 22:58:58 +01:00
'fields' => array
(
'id' => array
(
2017-10-05 16:14:46 +02:00
'sql' => 'int(10) unsigned NOT NULL auto_increment'
2014-12-27 22:58:58 +01:00
),
2015-01-05 12:25:46 +01:00
'pid' => array
(
'sql' => "int(10) unsigned NOT NULL default '0'"
),
2014-12-27 22:58:58 +01:00
'tstamp' => array
(
'sql' => "int(10) unsigned NOT NULL default '0'"
),
2015-01-05 12:25:46 +01:00
'sorting' => array
(
2015-01-08 16:27:55 +01:00
'sql' => "int(10) unsigned NOT NULL default '0'",
'sorting' => true,
2015-01-05 12:25:46 +01:00
),
2014-12-27 22:58:58 +01:00
'title' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['title'],
'exclude' => true,
'inputType' => 'text',
2015-01-08 16:27:55 +01:00
'sorting' => true,
'search' => true,
'flag' => 1,
2015-01-05 12:25:46 +01:00
'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'),
2014-12-27 22:58:58 +01:00
'sql' => "varchar(255) NOT NULL default ''"
),
2015-01-05 12:25:46 +01:00
'alias' => array
(
2015-01-09 17:43:38 +01:00
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['alias'],
'exclude' => true,
'inputType' => 'text',
'search' => true,
'save_callback' => array(
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
['netzmacht.contao_leaflet_maps.listeners.dca.validator', 'validateAlias'],
2015-01-09 17:43:38 +01:00
),
2017-10-05 16:14:46 +02:00
'eval' => array(
'mandatory' => false,
'maxlength' => 255,
'tl_class' => 'w50',
'nullIfEmpty' => true,
),
'toolkit' => [
'alias_generator' => [
'factory' => 'netzmacht.contao_leaflet_maps.definition.alias_generator.factory_parent',
'fields' => ['title']
],
],
2017-10-05 16:14:46 +02:00
'sql' => 'varchar(255) NULL'
2015-01-05 12:25:46 +01:00
),
'type' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['type'],
'exclude' => true,
'inputType' => 'select',
2015-01-08 16:27:55 +01:00
'filter' => true,
'sorting' => true,
2015-01-05 12:25:46 +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,
2015-01-05 12:25:46 +01:00
),
'options' => $GLOBALS['LEAFLET_CONTROLS'],
2015-01-08 12:27:08 +01:00
'reference' => &$GLOBALS['TL_LANG']['leaflet_control'],
2015-01-05 12:25:46 +01:00
'sql' => "varchar(32) NOT NULL default ''"
),
2014-12-27 22:58:58 +01:00
'position' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['position'],
'exclude' => true,
'inputType' => 'select',
2015-01-08 16:27:55 +01:00
'filter' => true,
2015-01-09 11:53:58 +01:00
'sorting' => true,
2014-12-27 22:58:58 +01:00
'options' => array('topleft', 'topright', 'bottomleft', 'bottomright'),
2015-01-06 14:55:53 +01:00
'reference' => &$GLOBALS['TL_LANG']['tl_leaflet_control'],
'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50', 'helpwizard' => true),
2014-12-27 22:58:58 +01:00
'sql' => "varchar(255) NOT NULL default ''"
),
2015-01-05 12:25:46 +01:00
'active' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['active'],
'exclude' => true,
'inputType' => 'checkbox',
2015-01-08 16:27:55 +01:00
'filter' => true,
2015-01-05 12:25:46 +01:00
'eval' => array('tl_class' => 'w50'),
'sql' => "char(1) NOT NULL default ''",
'save_callback' => [
['netzmacht.contao_leaflet_maps.listeners.dca.leaflet', 'clearCache'],
],
2015-01-05 12:25:46 +01:00
),
2014-12-27 22:58:58 +01:00
'zoomInText' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomInText'],
'exclude' => true,
'inputType' => 'text',
2015-01-05 12:25:46 +01:00
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50'),
2014-12-27 22:58:58 +01:00
'sql' => "varchar(255) NOT NULL default ''"
),
'zoomOutText' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomInText'],
'exclude' => true,
'inputType' => 'text',
2015-01-05 12:25:46 +01:00
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50'),
2014-12-27 22:58:58 +01:00
'sql' => "varchar(255) NOT NULL default ''"
),
'zoomInTitle' => array
(
2015-01-06 14:55:53 +01:00
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomInTitle'],
2014-12-27 22:58:58 +01:00
'exclude' => true,
'inputType' => 'text',
2015-01-05 12:25:46 +01:00
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50'),
2014-12-27 22:58:58 +01:00
'sql' => "varchar(255) NOT NULL default ''"
),
'zoomOutTitle' => array
(
2015-01-06 14:55:53 +01:00
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomOutTitle'],
2014-12-27 22:58:58 +01:00
'exclude' => true,
'inputType' => 'text',
2015-01-05 12:25:46 +01:00
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50'),
2014-12-27 22:58:58 +01:00
'sql' => "varchar(255) NOT NULL default ''"
),
'collapsed' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['collapsed'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => '1',
2015-01-05 12:25:46 +01:00
'eval' => array('tl_class' => 'w50'),
2014-12-27 22:58:58 +01:00
'sql' => "char(1) NOT NULL default ''"
),
'autoZIndex' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['autoZIndex'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => '1',
2015-01-05 12:25:46 +01:00
'eval' => array('tl_class' => 'w50'),
'sql' => "char(1) NOT NULL default ''"
),
'layers' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['layers'],
'exclude' => true,
'inputType' => 'multiColumnWizard',
2015-01-09 22:33:57 +01:00
'load_callback' => array(
['netzmacht.contao_leaflet_maps.listeners.dca.control', 'loadLayerRelations'],
2015-01-09 22:33:57 +01:00
),
'save_callback' => array(
['netzmacht.contao_leaflet_maps.listeners.dca.control', 'saveLayerRelations'],
2015-01-09 22:33:57 +01:00
),
2015-01-05 12:25:46 +01:00
'eval' => array
(
'tl_class' => 'clr',
'columnFields' => array
(
'layer' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['layer'],
'exclude' => true,
'inputType' => 'select',
2017-10-06 13:21:06 +02:00
'options_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.control', 'getLayers'],
2015-01-05 12:25:46 +01:00
'eval' => array(
2015-01-05 14:58:37 +01:00
'style' => 'width: 300px',
2015-01-05 12:25:46 +01:00
'chosen' => true,
'includeBlankOption' => true
),
),
'mode' => array
(
2015-01-06 14:55:53 +01:00
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['layerMode'],
2015-01-05 12:25:46 +01:00
'exclude' => true,
'inputType' => 'select',
'options' => array('base', 'overlay'),
2015-01-06 14:55:53 +01:00
'reference' => &$GLOBALS['TL_LANG']['tl_leaflet_control'],
2015-01-05 12:25:46 +01:00
'eval' => array(
2015-01-06 14:55:53 +01:00
'style' => 'width: 200px',
'helpwizard' => true,
2015-01-05 12:25:46 +01:00
),
),
)
),
2017-10-05 16:14:46 +02:00
'sql' => 'mediumblob NULL'
2015-01-05 12:25:46 +01:00
),
'maxWidth' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['maxWidth'],
'exclude' => true,
'inputType' => 'text',
'default' => 100,
'eval' => array('tl_class' => 'w50', 'rgxp' => 'digit'),
'sql' => "int(5) NOT NULL default '100'"
),
'metric' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['metric'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => '1',
'eval' => array('tl_class' => 'w50 clr'),
'sql' => "char(1) NOT NULL default '1'"
),
'imperial' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['imperial'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => '1',
'eval' => array('tl_class' => 'w50'),
'sql' => "char(1) NOT NULL default '1'"
),
'updateWhenIdle' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['updateWhenIdle'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class' => 'w50'),
2014-12-27 22:58:58 +01:00
'sql' => "char(1) NOT NULL default ''"
),
2015-01-05 14:58:37 +01:00
'prefix' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['prefix'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
'attributions' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['attributions'],
'exclude' => true,
'inputType' => 'listWizard',
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'clr', 'allowHtml' => true),
2017-10-05 16:14:46 +02:00
'sql' => 'mediumblob NULL'
2015-01-05 14:58:37 +01:00
),
2015-01-08 11:01:22 +01:00
'separate' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['separate'],
'exclude' => true,
'inputType' => 'checkbox',
2015-01-08 12:27:08 +01:00
'eval' => array('tl_class' => 'w50 m12'),
2015-01-08 11:01:22 +01:00
'sql' => "char(1) NOT NULL default ''"
),
'zoomControl' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomControl'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.control', 'getZoomControls'],
2015-01-08 11:01:22 +01:00
'reference' => &$GLOBALS['TL_LANG']['tl_leaflet_control'],
'eval' => array(
'mandatory' => false,
'tl_class' => 'w50',
'chosen' => true,
'includeBlankOption' => true
),
'sql' => "varchar(255) NOT NULL default ''"
),
'spinjs' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['spinjs'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class' => 'w50', 'submitOnChange' => true),
'sql' => "char(1) NOT NULL default ''"
),
'spin' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['spin'],
'exclude' => true,
'inputType' => 'textarea',
'eval' => array(
'style' => 'height:60px',
'preserveTags' => true,
'decodeEntities' => true,
'allowHtml' => true,
'rte' => 'ace|json',
'tl_class' => 'clr'
),
2017-10-05 16:14:46 +02:00
'sql' => 'mediumtext NULL'
2015-01-08 11:01:22 +01:00
),
2015-01-20 17:36:19 +01:00
'simulateFullScreen' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['simulateFullScreen'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class' => 'w50 m12'),
'sql' => "char(1) NOT NULL default ''"
),
'buttonTitle' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['buttonTitle'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
'disableDefault' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['disableDefault'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => true,
'eval' => array('tl_class' => 'w50 m12'),
'sql' => "char(1) NOT NULL default ''"
),
2014-12-27 22:58:58 +01:00
),
);