This commit is contained in:
2025-11-26 18:08:49 +01:00
commit c1385699ab
3 changed files with 133 additions and 0 deletions

61
caldav.php Normal file
View File

@@ -0,0 +1,61 @@
<?php
if (!defined('INCLUDE_DIR')) die('Fatal error');
class CaldavPlugin extends Plugin {
public $config_class = 'CaldavConfig';
public function getConfigurationForm() {
return array(
'calendar_url' => 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;
}
}
?>