@@ -15,39 +15,39 @@ |
||
| 15 | 15 | |
| 16 | 16 | class Admin implements ISettings { |
| 17 | 17 | |
| 18 | - public function __construct( |
|
| 19 | - private IAppConfig $appConfig, |
|
| 20 | - private IInitialState $initialStateService, |
|
| 21 | - ) { |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * @return TemplateResponse |
|
| 26 | - */ |
|
| 27 | - public function getForm() { |
|
| 28 | - $restrictSystemTagsCreationToAdmin = $this->appConfig->getValueBool(Application::APP_ID, 'restrict_creation_to_admin', false); |
|
| 29 | - $this->initialStateService->provideInitialState('restrictSystemTagsCreationToAdmin', $restrictSystemTagsCreationToAdmin); |
|
| 30 | - |
|
| 31 | - Util::addStyle(Application::APP_ID, 'admin'); |
|
| 32 | - Util::addScript(Application::APP_ID, 'admin'); |
|
| 33 | - return new TemplateResponse(Application::APP_ID, 'admin', [], ''); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @return string the section ID, e.g. 'sharing' |
|
| 38 | - */ |
|
| 39 | - public function getSection() { |
|
| 40 | - return 'server'; |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * @return int whether the form should be rather on the top or bottom of |
|
| 45 | - * the admin section. The forms are arranged in ascending order of the |
|
| 46 | - * priority values. It is required to return a value between 0 and 100. |
|
| 47 | - * |
|
| 48 | - * E.g.: 70 |
|
| 49 | - */ |
|
| 50 | - public function getPriority() { |
|
| 51 | - return 70; |
|
| 52 | - } |
|
| 18 | + public function __construct( |
|
| 19 | + private IAppConfig $appConfig, |
|
| 20 | + private IInitialState $initialStateService, |
|
| 21 | + ) { |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @return TemplateResponse |
|
| 26 | + */ |
|
| 27 | + public function getForm() { |
|
| 28 | + $restrictSystemTagsCreationToAdmin = $this->appConfig->getValueBool(Application::APP_ID, 'restrict_creation_to_admin', false); |
|
| 29 | + $this->initialStateService->provideInitialState('restrictSystemTagsCreationToAdmin', $restrictSystemTagsCreationToAdmin); |
|
| 30 | + |
|
| 31 | + Util::addStyle(Application::APP_ID, 'admin'); |
|
| 32 | + Util::addScript(Application::APP_ID, 'admin'); |
|
| 33 | + return new TemplateResponse(Application::APP_ID, 'admin', [], ''); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @return string the section ID, e.g. 'sharing' |
|
| 38 | + */ |
|
| 39 | + public function getSection() { |
|
| 40 | + return 'server'; |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @return int whether the form should be rather on the top or bottom of |
|
| 45 | + * the admin section. The forms are arranged in ascending order of the |
|
| 46 | + * priority values. It is required to return a value between 0 and 100. |
|
| 47 | + * |
|
| 48 | + * E.g.: 70 |
|
| 49 | + */ |
|
| 50 | + public function getPriority() { |
|
| 51 | + return 70; |
|
| 52 | + } |
|
| 53 | 53 | } |
@@ -26,38 +26,38 @@ |
||
| 26 | 26 | use OCP\SystemTag\MapperEvent; |
| 27 | 27 | |
| 28 | 28 | class Application extends App implements IBootstrap { |
| 29 | - public const APP_ID = 'systemtags'; |
|
| 30 | - |
|
| 31 | - public function __construct() { |
|
| 32 | - parent::__construct(self::APP_ID); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - public function register(IRegistrationContext $context): void { |
|
| 36 | - $context->registerSearchProvider(TagSearchProvider::class); |
|
| 37 | - $context->registerCapability(Capabilities::class); |
|
| 38 | - $context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class); |
|
| 39 | - $context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); |
|
| 40 | - $context->registerEventListener(BeforeSabrePubliclyLoadedEvent::class, BeforeSabrePubliclyLoadedListener::class); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - public function boot(IBootContext $context): void { |
|
| 44 | - $context->injectFn(function (IEventDispatcher $dispatcher) use ($context): void { |
|
| 45 | - $managerListener = function (ManagerEvent $event) use ($context): void { |
|
| 46 | - /** @var Listener $listener */ |
|
| 47 | - $listener = $context->getServerContainer()->query(Listener::class); |
|
| 48 | - $listener->event($event); |
|
| 49 | - }; |
|
| 50 | - $dispatcher->addListener(ManagerEvent::EVENT_CREATE, $managerListener); |
|
| 51 | - $dispatcher->addListener(ManagerEvent::EVENT_DELETE, $managerListener); |
|
| 52 | - $dispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener); |
|
| 53 | - |
|
| 54 | - $mapperListener = function (MapperEvent $event) use ($context): void { |
|
| 55 | - /** @var Listener $listener */ |
|
| 56 | - $listener = $context->getServerContainer()->query(Listener::class); |
|
| 57 | - $listener->mapperEvent($event); |
|
| 58 | - }; |
|
| 59 | - $dispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener); |
|
| 60 | - $dispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener); |
|
| 61 | - }); |
|
| 62 | - } |
|
| 29 | + public const APP_ID = 'systemtags'; |
|
| 30 | + |
|
| 31 | + public function __construct() { |
|
| 32 | + parent::__construct(self::APP_ID); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + public function register(IRegistrationContext $context): void { |
|
| 36 | + $context->registerSearchProvider(TagSearchProvider::class); |
|
| 37 | + $context->registerCapability(Capabilities::class); |
|
| 38 | + $context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class); |
|
| 39 | + $context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); |
|
| 40 | + $context->registerEventListener(BeforeSabrePubliclyLoadedEvent::class, BeforeSabrePubliclyLoadedListener::class); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + public function boot(IBootContext $context): void { |
|
| 44 | + $context->injectFn(function (IEventDispatcher $dispatcher) use ($context): void { |
|
| 45 | + $managerListener = function (ManagerEvent $event) use ($context): void { |
|
| 46 | + /** @var Listener $listener */ |
|
| 47 | + $listener = $context->getServerContainer()->query(Listener::class); |
|
| 48 | + $listener->event($event); |
|
| 49 | + }; |
|
| 50 | + $dispatcher->addListener(ManagerEvent::EVENT_CREATE, $managerListener); |
|
| 51 | + $dispatcher->addListener(ManagerEvent::EVENT_DELETE, $managerListener); |
|
| 52 | + $dispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener); |
|
| 53 | + |
|
| 54 | + $mapperListener = function (MapperEvent $event) use ($context): void { |
|
| 55 | + /** @var Listener $listener */ |
|
| 56 | + $listener = $context->getServerContainer()->query(Listener::class); |
|
| 57 | + $listener->mapperEvent($event); |
|
| 58 | + }; |
|
| 59 | + $dispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener); |
|
| 60 | + $dispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener); |
|
| 61 | + }); |
|
| 62 | + } |
|
| 63 | 63 | } |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function boot(IBootContext $context): void { |
| 44 | - $context->injectFn(function (IEventDispatcher $dispatcher) use ($context): void { |
|
| 45 | - $managerListener = function (ManagerEvent $event) use ($context): void { |
|
| 44 | + $context->injectFn(function(IEventDispatcher $dispatcher) use ($context): void { |
|
| 45 | + $managerListener = function(ManagerEvent $event) use ($context): void { |
|
| 46 | 46 | /** @var Listener $listener */ |
| 47 | 47 | $listener = $context->getServerContainer()->query(Listener::class); |
| 48 | 48 | $listener->event($event); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $dispatcher->addListener(ManagerEvent::EVENT_DELETE, $managerListener); |
| 52 | 52 | $dispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener); |
| 53 | 53 | |
| 54 | - $mapperListener = function (MapperEvent $event) use ($context): void { |
|
| 54 | + $mapperListener = function(MapperEvent $event) use ($context): void { |
|
| 55 | 55 | /** @var Listener $listener */ |
| 56 | 56 | $listener = $context->getServerContainer()->query(Listener::class); |
| 57 | 57 | $listener->mapperEvent($event); |
@@ -19,20 +19,20 @@ |
||
| 19 | 19 | * @template-implements IEventListener<BeforeTemplateRenderedEvent> |
| 20 | 20 | */ |
| 21 | 21 | class BeforeTemplateRenderedListener implements IEventListener { |
| 22 | - public function __construct( |
|
| 23 | - private IAppConfig $appConfig, |
|
| 24 | - private IInitialState $initialState, |
|
| 25 | - ) { |
|
| 26 | - } |
|
| 22 | + public function __construct( |
|
| 23 | + private IAppConfig $appConfig, |
|
| 24 | + private IInitialState $initialState, |
|
| 25 | + ) { |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public function handle(Event $event): void { |
|
| 29 | - if (!$event instanceof BeforeTemplateRenderedEvent) { |
|
| 30 | - return; |
|
| 31 | - } |
|
| 32 | - Util::addInitScript(Application::APP_ID, 'init'); |
|
| 33 | - Util::addStyle(Application::APP_ID, 'init'); |
|
| 28 | + public function handle(Event $event): void { |
|
| 29 | + if (!$event instanceof BeforeTemplateRenderedEvent) { |
|
| 30 | + return; |
|
| 31 | + } |
|
| 32 | + Util::addInitScript(Application::APP_ID, 'init'); |
|
| 33 | + Util::addStyle(Application::APP_ID, 'init'); |
|
| 34 | 34 | |
| 35 | - $restrictSystemTagsCreationToAdmin = $this->appConfig->getValueBool(Application::APP_ID, 'restrict_creation_to_admin', false); |
|
| 36 | - $this->initialState->provideInitialState('restrictSystemTagsCreationToAdmin', $restrictSystemTagsCreationToAdmin); |
|
| 37 | - } |
|
| 35 | + $restrictSystemTagsCreationToAdmin = $this->appConfig->getValueBool(Application::APP_ID, 'restrict_creation_to_admin', false); |
|
| 36 | + $this->initialState->provideInitialState('restrictSystemTagsCreationToAdmin', $restrictSystemTagsCreationToAdmin); |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -19,20 +19,20 @@ |
||
| 19 | 19 | * @template-implements IEventListener<LoadAdditionalScriptsEvent> |
| 20 | 20 | */ |
| 21 | 21 | class LoadAdditionalScriptsListener implements IEventListener { |
| 22 | - public function __construct( |
|
| 23 | - private IAppConfig $appConfig, |
|
| 24 | - private IInitialState $initialState, |
|
| 25 | - ) { |
|
| 26 | - } |
|
| 22 | + public function __construct( |
|
| 23 | + private IAppConfig $appConfig, |
|
| 24 | + private IInitialState $initialState, |
|
| 25 | + ) { |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public function handle(Event $event): void { |
|
| 29 | - if (!$event instanceof LoadAdditionalScriptsEvent) { |
|
| 30 | - return; |
|
| 31 | - } |
|
| 32 | - Util::addInitScript(Application::APP_ID, 'init'); |
|
| 33 | - Util::addStyle(Application::APP_ID, 'init'); |
|
| 28 | + public function handle(Event $event): void { |
|
| 29 | + if (!$event instanceof LoadAdditionalScriptsEvent) { |
|
| 30 | + return; |
|
| 31 | + } |
|
| 32 | + Util::addInitScript(Application::APP_ID, 'init'); |
|
| 33 | + Util::addStyle(Application::APP_ID, 'init'); |
|
| 34 | 34 | |
| 35 | - $restrictSystemTagsCreationToAdmin = $this->appConfig->getValueBool(Application::APP_ID, 'restrict_creation_to_admin', false); |
|
| 36 | - $this->initialState->provideInitialState('restrictSystemTagsCreationToAdmin', $restrictSystemTagsCreationToAdmin); |
|
| 37 | - } |
|
| 35 | + $restrictSystemTagsCreationToAdmin = $this->appConfig->getValueBool(Application::APP_ID, 'restrict_creation_to_admin', false); |
|
| 36 | + $this->initialState->provideInitialState('restrictSystemTagsCreationToAdmin', $restrictSystemTagsCreationToAdmin); |
|
| 37 | + } |
|
| 38 | 38 | } |