Admin.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\ShareByMail\Settings;
  7. use OCP\AppFramework\Http\TemplateResponse;
  8. use OCP\AppFramework\Services\IInitialState;
  9. use OCP\IL10N;
  10. use OCP\Settings\IDelegatedSettings;
  11. class Admin implements IDelegatedSettings {
  12. private SettingsManager $settingsManager;
  13. private IL10N $l;
  14. private IInitialState $initialState;
  15. public function __construct(SettingsManager $settingsManager, IL10N $l, IInitialState $initialState) {
  16. $this->settingsManager = $settingsManager;
  17. $this->l = $l;
  18. $this->initialState = $initialState;
  19. }
  20. /**
  21. * @return TemplateResponse
  22. */
  23. public function getForm() {
  24. $this->initialState->provideInitialState('sendPasswordMail', $this->settingsManager->sendPasswordByMail());
  25. $this->initialState->provideInitialState('replyToInitiator', $this->settingsManager->replyToInitiator());
  26. return new TemplateResponse('sharebymail', 'settings-admin', [], '');
  27. }
  28. /**
  29. * @return string the section ID, e.g. 'sharing'
  30. */
  31. public function getSection() {
  32. return 'sharing';
  33. }
  34. /**
  35. * @return int whether the form should be rather on the top or bottom of
  36. * the admin section. The forms are arranged in ascending order of the
  37. * priority values. It is required to return a value between 0 and 100.
  38. *
  39. * E.g.: 70
  40. */
  41. public function getPriority() {
  42. return 40;
  43. }
  44. public function getName(): ?string {
  45. return $this->l->t('Share by mail');
  46. }
  47. public function getAuthorizedAppConfig(): array {
  48. return [
  49. 'sharebymail' => ['s/(sendpasswordmail|replyToInitiator)/'],
  50. ];
  51. }
  52. }