commit c1385699ab8c3c5a9c1656dffefd81f10db88d3c Author: Udo Waechter Date: Wed Nov 26 18:08:49 2025 +0100 init diff --git a/caldav.php b/caldav.php new file mode 100644 index 0000000..ac30748 --- /dev/null +++ b/caldav.php @@ -0,0 +1,61 @@ + new TextboxField(array( + 'label' => 'Calendar URL', + 'configuration' => array( + 'size' => 60, + 'length' => 255 + ), + 'required' => true + )), + 'app_token' => new TextboxField(array( + 'label' => 'App Token', + 'configuration' => array( + 'size' => 60, + 'length' => 255 + ), + 'required' => true, + 'widget' => 'Password' + )), + ); + } + + public function getAgentActions() { + return array( + 'create_calendar_entry' => array( + 'label' => 'Create Calendar Entry', + 'action' => 'createCalendarEntry' + ) + ); + } + + public function createCalendarEntry($ticket) { + // Implementation will go here + } +} + +class CaldavConfig extends PluginConfig { + public function getOptions() { + return array( + 'calendar_url' => $this->getConfig('calendar_url'), + 'app_token' => $this->getConfig('app_token') + ); + } + + public function pre_save($config, &$errors) { + if (!$config['calendar_url']) { + $errors['calendar_url'] = 'Calendar URL is required'; + } + if (!$config['app_token']) { + $errors['app_token'] = 'App Token is required'; + } + return true; + } +} +?> diff --git a/hooks.php b/hooks.php new file mode 100644 index 0000000..2eada5c --- /dev/null +++ b/hooks.php @@ -0,0 +1,61 @@ += 200 && $httpCode < 300) { + // Success + } else { + // Log error + error_log("CalDAV Error: " . $response); + } + } + + static function generateIcalEvent($ticket) { + $summary = 'Ticket #' . $ticket->getNumber(); + $description = $ticket->getSubject(); + + return "BEGIN:VCALENDAR\n" . + "VERSION:2.0\n" . + "PRODID:-//osTicket CalDAV Plugin\n" . + "BEGIN:VEVENT\n" . + "UID:" . uniqid() . "@osticket.com\n" . + "DTSTAMP:" . date('Ymd\THis\Z') . "\n" . + "DTSTART:" . date('Ymd\THis\Z') . "\n" . + "SUMMARY:" . $summary . "\n" . + "DESCRIPTION:" . $description . "\n" . + "END:VEVENT\n" . + "END:VCALENDAR"; + } +} +?> diff --git a/plugin.php.disabled b/plugin.php.disabled new file mode 100644 index 0000000..1a834ef --- /dev/null +++ b/plugin.php.disabled @@ -0,0 +1,11 @@ + 'caldav', + 'name' => 'CalDAV Integration', + 'version' => '1.0', + 'author' => 'Your Name', + 'description' => 'Integrate with external CalDAV servers for creating calendar entries', + 'url' => 'https://yourdomain.com', + 'plugin' => 'caldav.php:CaldavPlugin' +); +?>