improve calendar features
This commit is contained in:
125
README.md
125
README.md
@@ -447,8 +447,117 @@ If a slot has a CalDAV URL configured, the admin panel provides a sync button.
|
||||
Triggering sync downloads all calendar objects from the remote CalDAV collection
|
||||
and merges them into the slot's local `.ics` file.
|
||||
|
||||
Sync is admin-only and does not run automatically. For scheduled sync, set up
|
||||
a cron job that triggers the sync via the DokuWiki AJAX endpoint.
|
||||
Sync can also be triggered from any wiki page using the inline syntax:
|
||||
|
||||
```
|
||||
{{calendar_sync>}}
|
||||
```
|
||||
|
||||
The sync button is only visible to admins. Non-admin users see nothing.
|
||||
|
||||
Sync is admin-only and does not run automatically. For scheduled sync, see the
|
||||
automatic sync section below.
|
||||
|
||||
### 0.12) Event popup improvements
|
||||
|
||||
Clicking an event on a day page or in the calendar widget opens the event detail popup.
|
||||
When the popup is opened from a specific day context (e.g. clicking an event in a calendar
|
||||
day cell), the date is hidden and only the time is shown (since the day is already known).
|
||||
|
||||
Clicking empty space inside a calendar day cell opens a day popup listing all events for
|
||||
that day. If there are no events, a "No events" message is shown.
|
||||
|
||||
### 0.13) Event creation
|
||||
|
||||
Authenticated users can create new calendar events from the day popup.
|
||||
|
||||
1. Click empty space in a calendar day cell to open the day popup.
|
||||
2. Click "Create Event".
|
||||
3. Fill in the form: summary (required), date, all-day toggle, start/end time,
|
||||
location, description, and target calendar slot.
|
||||
4. Click "Save".
|
||||
|
||||
The event is written to the local `.ics` file immediately. If the slot has a
|
||||
CalDAV URL configured, the event is also uploaded to the remote server.
|
||||
|
||||
### 0.14) Event editing
|
||||
|
||||
Authenticated users can edit existing calendar events from the event popup.
|
||||
|
||||
1. Click an event to open the detail popup.
|
||||
2. Click "Edit".
|
||||
3. Modify the fields and click "Save".
|
||||
|
||||
For recurring events, editing creates or updates an occurrence override rather
|
||||
than modifying the master event.
|
||||
|
||||
Changes are written to the local `.ics` file first, then pushed to CalDAV if
|
||||
configured.
|
||||
|
||||
### 0.15) Event deletion
|
||||
|
||||
Authenticated users can delete events from the event popup.
|
||||
|
||||
1. Click an event to open the detail popup.
|
||||
2. Click "Delete".
|
||||
3. Confirm the deletion.
|
||||
|
||||
For recurring events, you are asked whether to delete:
|
||||
- **This occurrence**: Adds an EXDATE to the master event.
|
||||
- **This and future occurrences**: Sets an UNTIL date on the RRULE.
|
||||
- **All occurrences**: Removes all components with this UID.
|
||||
|
||||
Deletion is applied to the local `.ics` file first, then to CalDAV if configured.
|
||||
|
||||
### 0.16) Automatic sync proposal
|
||||
|
||||
Automatic calendar sync is not currently implemented. The recommended approach
|
||||
for a long-lived personal DokuWiki plugin:
|
||||
|
||||
**Option A: Cron calling the AJAX endpoint (simplest)**
|
||||
|
||||
```cron
|
||||
*/15 * * * * curl -s -X POST 'https://wiki.example.com/lib/exe/ajax.php' \
|
||||
-d 'call=luxtools_calendar_sync§ok=ADMIN_TOKEN' \
|
||||
--cookie 'DokuWikiCookie=SESSION_ID'
|
||||
```
|
||||
|
||||
Pros: Reuses the existing sync endpoint with no code changes.
|
||||
Cons: Requires a valid admin session cookie and security token, which expire and
|
||||
must be refreshed. Fragile for long-term unattended use.
|
||||
|
||||
**Option B: CLI script (recommended)**
|
||||
|
||||
Create `bin/calendar-sync.php` that boots DokuWiki from the command line,
|
||||
loads the plugin, and calls `CalendarSyncService::syncAll()` directly.
|
||||
|
||||
```cron
|
||||
*/15 * * * * php /path/to/dokuwiki/lib/plugins/luxtools/bin/calendar-sync.php
|
||||
```
|
||||
|
||||
Pros: No session management, no authentication needed, runs as the web server user.
|
||||
Cons: Requires a small CLI entry point script.
|
||||
|
||||
**Recommendation**: Option B is more robust and maintainable. A CLI script can
|
||||
be as simple as:
|
||||
|
||||
```php
|
||||
<?php
|
||||
// Boot DokuWiki
|
||||
define('DOKU_INC', '/path/to/dokuwiki/');
|
||||
require_once(DOKU_INC . 'inc/init.php');
|
||||
require_once(__DIR__ . '/../autoload.php');
|
||||
|
||||
use dokuwiki\plugin\luxtools\CalendarSlot;
|
||||
use dokuwiki\plugin\luxtools\CalendarSyncService;
|
||||
|
||||
$plugin = plugin_load('action', 'luxtools');
|
||||
if (!$plugin) { fwrite(STDERR, "Plugin not loaded\n"); exit(1); }
|
||||
|
||||
$slots = CalendarSlot::loadEnabled($plugin);
|
||||
$result = CalendarSyncService::syncAll($slots);
|
||||
echo $result['ok'] ? "Sync completed.\n" : "Sync completed with errors.\n";
|
||||
```
|
||||
|
||||
### Known limitations
|
||||
|
||||
@@ -460,10 +569,14 @@ a cron job that triggers the sync via the DokuWiki AJAX endpoint.
|
||||
overwrite it on next sync.
|
||||
|
||||
- **Sync direction**: Sync is currently one-directional (remote → local). Local
|
||||
changes made via task completion are written back to the remote individually,
|
||||
but a full remote-to-local sync may overwrite local changes if the remote
|
||||
still has stale data. The completion write-back updates the remote immediately
|
||||
to mitigate this.
|
||||
changes (event creation, editing, deletion, task completion) are written back
|
||||
to the remote immediately when CalDAV is configured. However, a full
|
||||
remote-to-local sync may overwrite local changes if the remote still has stale
|
||||
data. The immediate write-back mitigates this in most cases.
|
||||
|
||||
- **Event creation/editing permissions**: Event CRUD operations require an
|
||||
authenticated DokuWiki user. Admin access is not required for event management,
|
||||
only for calendar sync.
|
||||
|
||||
### 1) List files by glob pattern
|
||||
|
||||
|
||||
Reference in New Issue
Block a user