Calendar Sync V1

This commit is contained in:
2026-03-11 11:44:32 +01:00
parent 87f6839b0d
commit 2d5e9541c2
17 changed files with 3011 additions and 64 deletions

View File

@@ -8,6 +8,9 @@ if (!defined('DOKU_INC')) die();
class admin_plugin_luxtools_main extends DokuWiki_Admin_Plugin
{
/** @var string[] Calendar slot keys */
protected $calendarSlotKeys = ['general', 'maintenance', 'slot3', 'slot4'];
/** @var string[] */
protected $configKeys = [
'paths',
@@ -29,7 +32,26 @@ class admin_plugin_luxtools_main extends DokuWiki_Admin_Plugin
'gallery_thumb_scale',
'open_service_url',
'image_base_path',
'calendar_ics_files',
'calendar_general_file',
'calendar_general_caldav_url',
'calendar_general_username',
'calendar_general_password',
'calendar_general_color',
'calendar_maintenance_file',
'calendar_maintenance_caldav_url',
'calendar_maintenance_username',
'calendar_maintenance_password',
'calendar_maintenance_color',
'calendar_slot3_file',
'calendar_slot3_caldav_url',
'calendar_slot3_username',
'calendar_slot3_password',
'calendar_slot3_color',
'calendar_slot4_file',
'calendar_slot4_caldav_url',
'calendar_slot4_username',
'calendar_slot4_password',
'calendar_slot4_color',
'pagelink_search_depth',
];
@@ -90,9 +112,14 @@ class admin_plugin_luxtools_main extends DokuWiki_Admin_Plugin
$newConf['open_service_url'] = $INPUT->str('open_service_url');
$newConf['image_base_path'] = $INPUT->str('image_base_path');
$icsFiles = $INPUT->str('calendar_ics_files');
$icsFiles = str_replace(["\r\n", "\r"], "\n", $icsFiles);
$newConf['calendar_ics_files'] = $icsFiles;
// Calendar slot settings
foreach ($this->calendarSlotKeys as $slot) {
$newConf['calendar_' . $slot . '_file'] = trim($INPUT->str('calendar_' . $slot . '_file'));
$newConf['calendar_' . $slot . '_caldav_url'] = trim($INPUT->str('calendar_' . $slot . '_caldav_url'));
$newConf['calendar_' . $slot . '_username'] = trim($INPUT->str('calendar_' . $slot . '_username'));
$newConf['calendar_' . $slot . '_password'] = trim($INPUT->str('calendar_' . $slot . '_password'));
$newConf['calendar_' . $slot . '_color'] = trim($INPUT->str('calendar_' . $slot . '_color'));
}
$depth = (int)$INPUT->int('pagelink_search_depth');
if ($depth < 0) $depth = 0;
@@ -240,11 +267,38 @@ class admin_plugin_luxtools_main extends DokuWiki_Admin_Plugin
echo '<input type="text" class="edit" name="image_base_path" value="' . hsc((string)$this->getConf('image_base_path')) . '" />';
echo '</label><br />';
// calendar_ics_files
$icsFiles = $this->normalizeMultilineDisplay((string)$this->getConf('calendar_ics_files'), 'calendar_ics_files');
echo '<label class="block"><span>' . hsc($this->getLang('calendar_ics_files')) . '</span><br />';
echo '<textarea name="calendar_ics_files" rows="4" cols="80" class="edit">' . hsc($icsFiles) . '</textarea>';
echo '</label><br />';
// Calendar slot settings
$slotLabels = [
'general' => 'General',
'maintenance' => 'Maintenance',
'slot3' => 'Slot 3',
'slot4' => 'Slot 4',
];
foreach ($this->calendarSlotKeys as $slot) {
echo '<h2>' . hsc($this->getLang('calendar_slot_heading') . ': ' . $slotLabels[$slot]) . '</h2>';
$prefix = 'calendar_' . $slot . '_';
echo '<label class="block"><span>' . hsc($this->getLang('calendar_slot_file')) . '</span> ';
echo '<input type="text" class="edit" name="' . hsc($prefix . 'file') . '" value="' . hsc((string)$this->getConf($prefix . 'file')) . '" />';
echo '</label><br />';
echo '<label class="block"><span>' . hsc($this->getLang('calendar_slot_caldav_url')) . '</span> ';
echo '<input type="text" class="edit" name="' . hsc($prefix . 'caldav_url') . '" value="' . hsc((string)$this->getConf($prefix . 'caldav_url')) . '" />';
echo '</label><br />';
echo '<label class="block"><span>' . hsc($this->getLang('calendar_slot_username')) . '</span> ';
echo '<input type="text" class="edit" name="' . hsc($prefix . 'username') . '" value="' . hsc((string)$this->getConf($prefix . 'username')) . '" />';
echo '</label><br />';
echo '<label class="block"><span>' . hsc($this->getLang('calendar_slot_password')) . '</span> ';
echo '<input type="password" class="edit" name="' . hsc($prefix . 'password') . '" value="' . hsc((string)$this->getConf($prefix . 'password')) . '" />';
echo '</label><br />';
echo '<label class="block"><span>' . hsc($this->getLang('calendar_slot_color')) . '</span> ';
echo '<input type="color" name="' . hsc($prefix . 'color') . '" value="' . hsc((string)$this->getConf($prefix . 'color') ?: '#999999') . '" />';
echo '</label><br />';
}
// pagelink_search_depth
echo '<label class="block"><span>' . hsc($this->getLang('pagelink_search_depth')) . '</span> ';