Skip to content

Commit

Permalink
Add attachments to events
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Sazanov <m@sazanof.ru>
  • Loading branch information
Mikhail Sazanov committed Feb 15, 2023
1 parent 5cedb44 commit 9d96445
Show file tree
Hide file tree
Showing 17 changed files with 1,258 additions and 59 deletions.
23 changes: 23 additions & 0 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public function setConfig(string $key,
return $this->setDefaultReminder($value);
case 'showTasks':
return $this->setShowTasks($value);
case 'attachmentsFolder':
return $this->setAttachmentsFolder($value);
default:
return new JSONResponse([], Http::STATUS_BAD_REQUEST);
}
Expand Down Expand Up @@ -171,6 +173,27 @@ private function setShowTasks(string $value):JSONResponse {
return new JSONResponse();
}

/**
* Set config for attachments folder
*
* @param string $value
* @return JSONResponse
*/
private function setAttachmentsFolder(string $value):JSONResponse {
try {
$this->config->setUserValue(
$this->userId,
'dav',
'attachmentsFolder',
$value
);
} catch (\Exception $e) {
return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
}

return new JSONResponse();
}

/**
* set config value for showing week numbers
*
Expand Down
2 changes: 2 additions & 0 deletions lib/Controller/ViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public function index():TemplateResponse {
$showWeekNumbers = $this->config->getUserValue($this->userId, $this->appName, 'showWeekNr', $defaultWeekNumbers) === 'yes';
$skipPopover = $this->config->getUserValue($this->userId, $this->appName, 'skipPopover', $defaultSkipPopover) === 'yes';
$timezone = $this->config->getUserValue($this->userId, $this->appName, 'timezone', $defaultTimezone);
$attachmentsFolder = $this->config->getUserValue($this->userId, 'dav', 'attachmentsFolder', '/Calendar');
$slotDuration = $this->config->getUserValue($this->userId, $this->appName, 'slotDuration', $defaultSlotDuration);
$defaultReminder = $this->config->getUserValue($this->userId, $this->appName, 'defaultReminder', $defaultDefaultReminder);
$showTasks = $this->config->getUserValue($this->userId, $this->appName, 'showTasks', $defaultShowTasks) === 'yes';
Expand All @@ -124,6 +125,7 @@ public function index():TemplateResponse {
$this->initialStateService->provideInitialState('talk_enabled', $talkEnabled);
$this->initialStateService->provideInitialState('talk_api_version', $talkApiVersion);
$this->initialStateService->provideInitialState('timezone', $timezone);
$this->initialStateService->provideInitialState('attachments_folder', $attachmentsFolder);
$this->initialStateService->provideInitialState('slot_duration', $slotDuration);
$this->initialStateService->provideInitialState('default_reminder', $defaultReminder);
$this->initialStateService->provideInitialState('show_tasks', $showTasks);
Expand Down
177 changes: 159 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9d96445

Please sign in to comment.