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

440 lines
17 KiB
PHP
Raw Normal View History

2014-12-27 22:58:58 +01:00
<?php
2015-01-12 19:03:29 +01:00
/**
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>
2016-10-11 10:40:15 +02:00
* @copyright 2014-2016 netzmacht David Molineus
2015-01-12 19:03:29 +01:00
* @license LGPL 3.0
* @filesource
*
*/
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\Dca\LeafletCallbacks::callback('clearCache'),
],
2014-12-27 22:58:58 +01:00
),
// List
'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\Dca\ControlCallbacks::callback('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',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"'
),
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\Callback\CallbackFactory::stateButton('tl_leaflet_control', '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
(
'sql' => "int(10) unsigned NOT NULL auto_increment"
),
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\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_control',
'alias',
['title'],
2016-10-06 12:16:42 +02:00
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::PARENT_ALIAS_GENERATOR
),
2016-10-06 09:42:41 +02:00
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
2015-01-09 17:43:38 +01:00
),
2016-10-06 12:16:42 +02:00
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'nullIfEmpty' => true),
'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\Dca\LeafletCallbacks::callback('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\Dca\ControlCallbacks::callback('loadLayerRelations'),
2015-01-09 22:33:57 +01:00
),
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('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',
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('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
),
),
)
),
'sql' => "mediumblob NULL"
),
'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),
'sql' => "mediumblob NULL"
),
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\Dca\ControlCallbacks::callback('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'
),
'sql' => "mediumtext NULL"
),
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
),
);