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
+3
View File
@@ -0,0 +1,3 @@
<?php
declare(strict_types=1);
+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 ''",
];
+12
View File
@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
$GLOBALS['TL_LANG']['tl_calendar']['caldav_legend'] = 'CalDAV-Synchronisation';
$GLOBALS['TL_LANG']['tl_calendar']['caldavSyncEnabled'] = ['CalDAV-Sync aktivieren', 'Aktiviert den 2-Way-Sync mit einem CalDAV-Kalender.'];
$GLOBALS['TL_LANG']['tl_calendar']['caldavUrl'] = ['CalDAV-URL', 'Vollstaendige URL zum CalDAV-Kalender.'];
$GLOBALS['TL_LANG']['tl_calendar']['caldavUsername'] = ['CalDAV-Benutzername', 'Benutzername fuer den CalDAV-Zugriff.'];
$GLOBALS['TL_LANG']['tl_calendar']['caldavPassword'] = ['CalDAV-Passwort', 'Passwort oder App-Passwort fuer den CalDAV-Zugriff.'];
$GLOBALS['TL_LANG']['tl_calendar']['caldavAuthorId'] = ['CalDAV-Author', 'Pflichtauswahl des Contao-Benutzers fuer neu importierte CalDAV-Events.'];
$GLOBALS['TL_LANG']['tl_calendar']['caldavTimezone'] = ['CalDAV-Zeitzone', 'IANA-Zeitzone wie Europe/Berlin. Optional, faellt auf UTC zurueck.'];
$GLOBALS['TL_LANG']['tl_calendar']['caldavCalendarHrefs'] = ['Remote-Kalender', 'Vom Server geladene CalDAV-Kalender. Mehrfachauswahl ist moeglich.'];
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
$GLOBALS['TL_LANG']['tl_calendar_events']['caldav_legend'] = 'CalDAV-Metadaten';
$GLOBALS['TL_LANG']['tl_calendar_events']['caldavCalendarHref'] = ['CalDAV Kalender-URL', 'Technische Zuordnung zum Remote-Kalender.'];
$GLOBALS['TL_LANG']['tl_calendar_events']['caldavUid'] = ['CalDAV UID', 'Technische UID aus der VEVENT-Struktur.'];
$GLOBALS['TL_LANG']['tl_calendar_events']['caldavHref'] = ['CalDAV Href', 'Technischer Remote-Pfad der Ressource.'];
$GLOBALS['TL_LANG']['tl_calendar_events']['caldavEtag'] = ['CalDAV ETag', 'Remote-ETag zur Aenderungserkennung.'];
$GLOBALS['TL_LANG']['tl_calendar_events']['caldavSyncHash'] = ['Sync-Hash', 'SHA-256 ueber bidirektionale Sync-Felder.'];
$GLOBALS['TL_LANG']['tl_calendar_events']['caldavLastSync'] = ['Letzter Sync', 'Unix-Zeitstempel des letzten erfolgreichen Sync.'];
$GLOBALS['TL_LANG']['tl_calendar_events']['caldavOrigin'] = ['Sync-Ursprung', 'Markiert, ob Event lokal oder remote angelegt wurde.'];
$GLOBALS['TL_LANG']['tl_calendar_events']['caldavSyncState'] = ['Sync-Status', 'Technischer Status fuer den Sync-Prozess.'];