Release: CalDAV sync bundle hardening and LMW sync

This commit is contained in:
Jürgen Mummert
2026-03-27 22:16:48 +01:00
commit c6f63a56a9
36 changed files with 2993 additions and 0 deletions
+76
View File
@@ -0,0 +1,76 @@
<?php
declare(strict_types=1);
use Contao\CoreBundle\DataContainer\PaletteManipulator;
use Mummert\CalDavSyncBundle\Contao\Dca\CalendarDcaCallbacks;
$GLOBALS['TL_DCA']['tl_calendar']['palettes']['__selector__'][] = 'caldavSyncEnabled';
foreach (array_keys($GLOBALS['TL_DCA']['tl_calendar']['palettes'] ?? []) as $paletteName) {
if ('__selector__' === $paletteName) {
continue;
}
PaletteManipulator::create()
->addLegend('caldav_legend', 'title_legend', PaletteManipulator::POSITION_AFTER)
->addField('caldavSyncEnabled', 'caldav_legend', PaletteManipulator::POSITION_APPEND)
->applyToPalette($paletteName, 'tl_calendar')
;
}
$GLOBALS['TL_DCA']['tl_calendar']['subpalettes']['caldavSyncEnabled'] = 'caldavUrl,caldavUsername,caldavPassword,caldavAuthorId,caldavTimezone,caldavCalendarHrefs';
$GLOBALS['TL_DCA']['tl_calendar']['fields']['caldavSyncEnabled'] = [
'exclude' => true,
'inputType' => 'checkbox',
'eval' => ['submitOnChange' => true],
'sql' => "char(1) NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_calendar']['fields']['caldavUrl'] = [
'exclude' => true,
'inputType' => 'text',
'eval' => ['mandatory' => true, 'maxlength' => 2048, 'rgxp' => 'url', 'decodeEntities' => true, 'tl_class' => 'w50'],
'sql' => "varchar(2048) NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_calendar']['fields']['caldavUsername'] = [
'exclude' => true,
'inputType' => 'text',
'eval' => ['mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'],
'sql' => "varchar(255) NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_calendar']['fields']['caldavPassword'] = [
'exclude' => true,
'inputType' => 'text',
'eval' => ['mandatory' => true, 'maxlength' => 255, 'preserveTags' => true, 'hideInput' => true, 'tl_class' => 'w50'],
'sql' => "varchar(255) NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_calendar']['fields']['caldavAuthorId'] = [
'exclude' => true,
'inputType' => 'select',
'foreignKey' => 'tl_user.name',
'eval' => ['mandatory' => true, 'chosen' => true, 'includeBlankOption' => true, 'tl_class' => 'w50'],
'relation' => ['type' => 'hasOne', 'load' => 'lazy', 'table' => 'tl_user'],
'sql' => "int(10) unsigned NOT NULL default 0",
];
$GLOBALS['TL_DCA']['tl_calendar']['fields']['caldavTimezone'] = [
'exclude' => true,
'inputType' => 'text',
'eval' => ['maxlength' => 64, 'placeholder' => 'Europe/Berlin', 'tl_class' => 'w50'],
'sql' => "varchar(64) NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_calendar']['fields']['caldavCalendarHrefs'] = [
'exclude' => true,
'inputType' => 'checkboxWizard',
'options_callback' => [CalendarDcaCallbacks::class, 'getAvailableRemoteCalendars'],
'save_callback' => [[CalendarDcaCallbacks::class, 'normalizeSelectedRemoteCalendars']],
'eval' => ['multiple' => true, 'tl_class' => 'clr'],
'sql' => 'blob NULL',
];
+80
View File
@@ -0,0 +1,80 @@
<?php
declare(strict_types=1);
use Contao\CoreBundle\DataContainer\PaletteManipulator;
foreach (array_keys($GLOBALS['TL_DCA']['tl_calendar_events']['palettes'] ?? []) as $paletteName) {
if ('__selector__' === $paletteName) {
continue;
}
PaletteManipulator::create()
->addLegend('caldav_legend', 'expert_legend', PaletteManipulator::POSITION_AFTER)
->addField('caldavCalendarHref', 'caldav_legend', PaletteManipulator::POSITION_APPEND)
->addField('caldavUid', 'caldav_legend', PaletteManipulator::POSITION_APPEND)
->addField('caldavHref', 'caldav_legend', PaletteManipulator::POSITION_APPEND)
->addField('caldavEtag', 'caldav_legend', PaletteManipulator::POSITION_APPEND)
->addField('caldavSyncHash', 'caldav_legend', PaletteManipulator::POSITION_APPEND)
->addField('caldavLastSync', 'caldav_legend', PaletteManipulator::POSITION_APPEND)
->addField('caldavOrigin', 'caldav_legend', PaletteManipulator::POSITION_APPEND)
->addField('caldavSyncState', 'caldav_legend', PaletteManipulator::POSITION_APPEND)
->applyToPalette($paletteName, 'tl_calendar_events')
;
}
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['caldavCalendarHref'] = [
'exclude' => true,
'inputType' => 'text',
'eval' => ['maxlength' => 2048, 'readonly' => true, 'doNotCopy' => true, 'tl_class' => 'clr'],
'sql' => "varchar(2048) NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['caldavUid'] = [
'exclude' => true,
'inputType' => 'text',
'eval' => ['maxlength' => 255, 'readonly' => true, 'doNotCopy' => true, 'tl_class' => 'clr'],
'sql' => "varchar(255) NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['caldavHref'] = [
'exclude' => true,
'inputType' => 'text',
'eval' => ['maxlength' => 2048, 'readonly' => true, 'doNotCopy' => true, 'tl_class' => 'clr'],
'sql' => "varchar(2048) NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['caldavEtag'] = [
'exclude' => true,
'inputType' => 'text',
'eval' => ['maxlength' => 255, 'readonly' => true, 'doNotCopy' => true, 'tl_class' => 'clr'],
'sql' => "varchar(255) NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['caldavSyncHash'] = [
'exclude' => true,
'inputType' => 'text',
'eval' => ['maxlength' => 64, 'readonly' => true, 'doNotCopy' => true, 'tl_class' => 'clr'],
'sql' => "varchar(64) NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['caldavLastSync'] = [
'exclude' => true,
'inputType' => 'text',
'eval' => ['readonly' => true, 'doNotCopy' => true, 'tl_class' => 'w50'],
'sql' => "int(10) unsigned NOT NULL default 0",
];
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['caldavOrigin'] = [
'exclude' => true,
'inputType' => 'text',
'eval' => ['maxlength' => 16, 'readonly' => true, 'doNotCopy' => true, 'tl_class' => 'w50'],
'sql' => "varchar(16) NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['caldavSyncState'] = [
'exclude' => true,
'inputType' => 'text',
'eval' => ['maxlength' => 32, 'readonly' => true, 'doNotCopy' => true, 'tl_class' => 'w50'],
'sql' => "varchar(32) NOT NULL default ''",
];