diff --git a/README.md b/README.md index c4896a4..450cd70 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,7 @@ Key settings: - **Username**: CalDAV authentication username - **Password**: CalDAV authentication password - **Color**: CSS color for calendar widget indicators + - **Display**: Where to show that slot's calendar indicator (`None`, `Top Left`, `Top Right`, `Bottom Left`, `Bottom Right`) A slot is enabled if it has a local file path or a CalDAV URL configured. The old `calendar_ics_files` setting has been replaced by the `general` slot's file path. @@ -300,9 +301,8 @@ Notes: - Month switches fetch server-rendered widget HTML via AJAX and replace only the widget node. - Calendar output is marked as non-cacheable to keep missing/existing link styling and current-day highlighting up to date. -- Each day cell shows colored corner indicators for calendar slots that have events on that day. - Indicator positions (clockwise): general = top-left, maintenance = top-right, - slot3 = bottom-right, slot4 = bottom-left. +- Each day cell can show colored corner triangles for slots that have events on that day. + Indicator placement is configured per slot via the `Display` setting. Indicator colors are taken from the slot's configured color. ### 0.4) Virtual chronological day pages diff --git a/action.php b/action.php index a0d7c4c..5c7d462 100644 --- a/action.php +++ b/action.php @@ -168,14 +168,16 @@ class action_plugin_luxtools extends ActionPlugin $slots = CalendarSlot::loadEnabled($this); $indicators = CalendarService::monthIndicators($slots, $year, $month); $slotColors = []; + $slotDisplays = []; foreach ($slots as $slot) { $color = $slot->getColor(); if ($color !== '') { $slotColors[$slot->getKey()] = $color; } + $slotDisplays[$slot->getKey()] = $slot->getDisplay(); } - $html = ChronologicalCalendarWidget::render($year, $month, $baseNs, $indicators, $slotColors); + $html = ChronologicalCalendarWidget::render($year, $month, $baseNs, $indicators, $slotColors, $slotDisplays); if ($html === '') { http_status(500); echo 'Calendar rendering failed'; @@ -741,7 +743,7 @@ class action_plugin_luxtools extends ActionPlugin $remoteError = ''; if ($maintenanceSlot->hasRemoteSource()) { try { - $caldavOk = CalDavClient::updateEventStatus( + $caldavResult = CalDavClient::updateEventStatus( $maintenanceSlot->getCaldavUrl(), $maintenanceSlot->getUsername(), $maintenanceSlot->getPassword(), @@ -750,13 +752,13 @@ class action_plugin_luxtools extends ActionPlugin $newStatus, $dateIso ); - if (!$caldavOk) { + if ($caldavResult !== '') { $remoteOk = false; - $remoteError = $this->getLang('maintenance_remote_write_failed'); + $remoteError = $this->getLang('maintenance_remote_write_failed') . ': ' . $caldavResult; } } catch (Throwable $e) { $remoteOk = false; - $remoteError = $this->getLang('maintenance_remote_write_failed'); + $remoteError = $this->getLang('maintenance_remote_write_failed') . ': ' . $e->getMessage(); } } diff --git a/admin/main.php b/admin/main.php index 695b88c..5b8a0a3 100644 --- a/admin/main.php +++ b/admin/main.php @@ -37,21 +37,25 @@ class admin_plugin_luxtools_main extends DokuWiki_Admin_Plugin 'calendar_general_username', 'calendar_general_password', 'calendar_general_color', + 'calendar_general_display', 'calendar_maintenance_file', 'calendar_maintenance_caldav_url', 'calendar_maintenance_username', 'calendar_maintenance_password', 'calendar_maintenance_color', + 'calendar_maintenance_display', 'calendar_slot3_file', 'calendar_slot3_caldav_url', 'calendar_slot3_username', 'calendar_slot3_password', 'calendar_slot3_color', + 'calendar_slot3_display', 'calendar_slot4_file', 'calendar_slot4_caldav_url', 'calendar_slot4_username', 'calendar_slot4_password', 'calendar_slot4_color', + 'calendar_slot4_display', 'pagelink_search_depth', ]; @@ -119,6 +123,7 @@ class admin_plugin_luxtools_main extends DokuWiki_Admin_Plugin $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')); + $newConf['calendar_' . $slot . '_display'] = trim($INPUT->str('calendar_' . $slot . '_display')); } $depth = (int)$INPUT->int('pagelink_search_depth'); @@ -274,6 +279,13 @@ class admin_plugin_luxtools_main extends DokuWiki_Admin_Plugin 'slot3' => 'Slot 3', 'slot4' => 'Slot 4', ]; + $displayOptions = [ + 'none' => (string)$this->getLang('calendar_slot_display_none'), + 'top-left' => (string)$this->getLang('calendar_slot_display_top_left'), + 'top-right' => (string)$this->getLang('calendar_slot_display_top_right'), + 'bottom-left' => (string)$this->getLang('calendar_slot_display_bottom_left'), + 'bottom-right' => (string)$this->getLang('calendar_slot_display_bottom_right'), + ]; foreach ($this->calendarSlotKeys as $slot) { echo '