@@ -39,83 +39,83 @@ |
||
| 39 | 39 | |
| 40 | 40 | class ServerDevNotice implements ISettings { |
| 41 | 41 | |
| 42 | - /** @var IRegistry */ |
|
| 43 | - private $registry; |
|
| 44 | - |
|
| 45 | - /** @var IEventDispatcher */ |
|
| 46 | - private $eventDispatcher; |
|
| 47 | - |
|
| 48 | - /** @var IRootFolder */ |
|
| 49 | - private $rootFolder; |
|
| 50 | - |
|
| 51 | - /** @var IUserSession */ |
|
| 52 | - private $userSession; |
|
| 53 | - |
|
| 54 | - /** @var IInitialState */ |
|
| 55 | - private $initialState; |
|
| 56 | - |
|
| 57 | - /** @var IURLGenerator */ |
|
| 58 | - private $urlGenerator; |
|
| 59 | - |
|
| 60 | - public function __construct(IRegistry $registry, |
|
| 61 | - IEventDispatcher $eventDispatcher, |
|
| 62 | - IRootFolder $rootFolder, |
|
| 63 | - IUserSession $userSession, |
|
| 64 | - IInitialState $initialState, |
|
| 65 | - IURLGenerator $urlGenerator) { |
|
| 66 | - $this->registry = $registry; |
|
| 67 | - $this->eventDispatcher = $eventDispatcher; |
|
| 68 | - $this->rootFolder = $rootFolder; |
|
| 69 | - $this->userSession = $userSession; |
|
| 70 | - $this->initialState = $initialState; |
|
| 71 | - $this->urlGenerator = $urlGenerator; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * @return TemplateResponse |
|
| 76 | - */ |
|
| 77 | - public function getForm(): TemplateResponse { |
|
| 78 | - $userFolder = $this->rootFolder->getUserFolder($this->userSession->getUser()->getUID()); |
|
| 79 | - |
|
| 80 | - $hasInitialState = false; |
|
| 81 | - |
|
| 82 | - // viewer is default enabled and this makes a zero-cost assertion for Psalm |
|
| 83 | - assert(class_exists(LoadViewer::class)); |
|
| 84 | - |
|
| 85 | - // If the Reasons to use Nextcloud.pdf file is here, let's init Viewer |
|
| 86 | - if ($userFolder->nodeExists('Reasons to use Nextcloud.pdf')) { |
|
| 87 | - $this->eventDispatcher->dispatch(LoadViewer::class, new LoadViewer()); |
|
| 88 | - $hasInitialState = true; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - // Always load the script |
|
| 92 | - Util::addScript('settings', 'vue-settings-nextcloud-pdf'); |
|
| 93 | - $this->initialState->provideInitialState('has-reasons-use-nextcloud-pdf', $hasInitialState); |
|
| 94 | - |
|
| 95 | - return new TemplateResponse('settings', 'settings/personal/development.notice', [ |
|
| 96 | - 'reasons-use-nextcloud-pdf-link' => $this->urlGenerator->linkToRoute('settings.Reasons.getPdf') |
|
| 97 | - ]); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * @return string|null the section ID, e.g. 'sharing' |
|
| 102 | - */ |
|
| 103 | - public function getSection(): ?string { |
|
| 104 | - if ($this->registry->delegateHasValidSubscription()) { |
|
| 105 | - return null; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - return 'personal-info'; |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * @return int whether the form should be rather on the top or bottom of |
|
| 113 | - * the admin section. The forms are arranged in ascending order of the |
|
| 114 | - * priority values. It is required to return a value between 0 and 100. |
|
| 115 | - * |
|
| 116 | - * E.g.: 70 |
|
| 117 | - */ |
|
| 118 | - public function getPriority(): int { |
|
| 119 | - return 1000; |
|
| 120 | - } |
|
| 42 | + /** @var IRegistry */ |
|
| 43 | + private $registry; |
|
| 44 | + |
|
| 45 | + /** @var IEventDispatcher */ |
|
| 46 | + private $eventDispatcher; |
|
| 47 | + |
|
| 48 | + /** @var IRootFolder */ |
|
| 49 | + private $rootFolder; |
|
| 50 | + |
|
| 51 | + /** @var IUserSession */ |
|
| 52 | + private $userSession; |
|
| 53 | + |
|
| 54 | + /** @var IInitialState */ |
|
| 55 | + private $initialState; |
|
| 56 | + |
|
| 57 | + /** @var IURLGenerator */ |
|
| 58 | + private $urlGenerator; |
|
| 59 | + |
|
| 60 | + public function __construct(IRegistry $registry, |
|
| 61 | + IEventDispatcher $eventDispatcher, |
|
| 62 | + IRootFolder $rootFolder, |
|
| 63 | + IUserSession $userSession, |
|
| 64 | + IInitialState $initialState, |
|
| 65 | + IURLGenerator $urlGenerator) { |
|
| 66 | + $this->registry = $registry; |
|
| 67 | + $this->eventDispatcher = $eventDispatcher; |
|
| 68 | + $this->rootFolder = $rootFolder; |
|
| 69 | + $this->userSession = $userSession; |
|
| 70 | + $this->initialState = $initialState; |
|
| 71 | + $this->urlGenerator = $urlGenerator; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * @return TemplateResponse |
|
| 76 | + */ |
|
| 77 | + public function getForm(): TemplateResponse { |
|
| 78 | + $userFolder = $this->rootFolder->getUserFolder($this->userSession->getUser()->getUID()); |
|
| 79 | + |
|
| 80 | + $hasInitialState = false; |
|
| 81 | + |
|
| 82 | + // viewer is default enabled and this makes a zero-cost assertion for Psalm |
|
| 83 | + assert(class_exists(LoadViewer::class)); |
|
| 84 | + |
|
| 85 | + // If the Reasons to use Nextcloud.pdf file is here, let's init Viewer |
|
| 86 | + if ($userFolder->nodeExists('Reasons to use Nextcloud.pdf')) { |
|
| 87 | + $this->eventDispatcher->dispatch(LoadViewer::class, new LoadViewer()); |
|
| 88 | + $hasInitialState = true; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + // Always load the script |
|
| 92 | + Util::addScript('settings', 'vue-settings-nextcloud-pdf'); |
|
| 93 | + $this->initialState->provideInitialState('has-reasons-use-nextcloud-pdf', $hasInitialState); |
|
| 94 | + |
|
| 95 | + return new TemplateResponse('settings', 'settings/personal/development.notice', [ |
|
| 96 | + 'reasons-use-nextcloud-pdf-link' => $this->urlGenerator->linkToRoute('settings.Reasons.getPdf') |
|
| 97 | + ]); |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * @return string|null the section ID, e.g. 'sharing' |
|
| 102 | + */ |
|
| 103 | + public function getSection(): ?string { |
|
| 104 | + if ($this->registry->delegateHasValidSubscription()) { |
|
| 105 | + return null; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + return 'personal-info'; |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * @return int whether the form should be rather on the top or bottom of |
|
| 113 | + * the admin section. The forms are arranged in ascending order of the |
|
| 114 | + * priority values. It is required to return a value between 0 and 100. |
|
| 115 | + * |
|
| 116 | + * E.g.: 70 |
|
| 117 | + */ |
|
| 118 | + public function getPriority(): int { |
|
| 119 | + return 1000; |
|
| 120 | + } |
|
| 121 | 121 | } |
@@ -29,31 +29,31 @@ |
||
| 29 | 29 | |
| 30 | 30 | class Additional implements ISettings { |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @return TemplateResponse returns the instance with all parameters set, ready to be rendered |
|
| 34 | - * @since 9.1 |
|
| 35 | - */ |
|
| 36 | - public function getForm(): TemplateResponse { |
|
| 37 | - return new TemplateResponse('settings', 'settings/empty'); |
|
| 38 | - } |
|
| 32 | + /** |
|
| 33 | + * @return TemplateResponse returns the instance with all parameters set, ready to be rendered |
|
| 34 | + * @since 9.1 |
|
| 35 | + */ |
|
| 36 | + public function getForm(): TemplateResponse { |
|
| 37 | + return new TemplateResponse('settings', 'settings/empty'); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @return string the section ID, e.g. 'sharing' |
|
| 42 | - * @since 9.1 |
|
| 43 | - */ |
|
| 44 | - public function getSection(): string { |
|
| 45 | - return 'additional'; |
|
| 46 | - } |
|
| 40 | + /** |
|
| 41 | + * @return string the section ID, e.g. 'sharing' |
|
| 42 | + * @since 9.1 |
|
| 43 | + */ |
|
| 44 | + public function getSection(): string { |
|
| 45 | + return 'additional'; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @return int whether the form should be rather on the top or bottom of |
|
| 50 | - * the admin section. The forms are arranged in ascending order of the |
|
| 51 | - * priority values. It is required to return a value between 0 and 100. |
|
| 52 | - * |
|
| 53 | - * E.g.: 70 |
|
| 54 | - * @since 9.1 |
|
| 55 | - */ |
|
| 56 | - public function getPriority(): int { |
|
| 57 | - return 5; |
|
| 58 | - } |
|
| 48 | + /** |
|
| 49 | + * @return int whether the form should be rather on the top or bottom of |
|
| 50 | + * the admin section. The forms are arranged in ascending order of the |
|
| 51 | + * priority values. It is required to return a value between 0 and 100. |
|
| 52 | + * |
|
| 53 | + * E.g.: 70 |
|
| 54 | + * @since 9.1 |
|
| 55 | + */ |
|
| 56 | + public function getPriority(): int { |
|
| 57 | + return 5; |
|
| 58 | + } |
|
| 59 | 59 | } |