@@ -57,124 +57,124 @@ |
||
57 | 57 | use OCP\Util; |
58 | 58 | |
59 | 59 | class Application extends App implements IBootstrap { |
60 | - public const APP_ID = 'files'; |
|
61 | - |
|
62 | - public function __construct(array $urlParams=[]) { |
|
63 | - parent::__construct(self::APP_ID, $urlParams); |
|
64 | - } |
|
65 | - |
|
66 | - public function register(IRegistrationContext $context): void { |
|
67 | - /** |
|
68 | - * Controllers |
|
69 | - */ |
|
70 | - $context->registerService('APIController', function (IContainer $c) { |
|
71 | - /** @var IServerContainer $server */ |
|
72 | - $server = $c->query(IServerContainer::class); |
|
73 | - |
|
74 | - return new ApiController( |
|
75 | - $c->query('AppName'), |
|
76 | - $c->query('Request'), |
|
77 | - $server->getUserSession(), |
|
78 | - $c->query('TagService'), |
|
79 | - $server->getPreviewManager(), |
|
80 | - $server->getShareManager(), |
|
81 | - $server->getConfig(), |
|
82 | - $server->getUserFolder() |
|
83 | - ); |
|
84 | - }); |
|
85 | - |
|
86 | - /** |
|
87 | - * Services |
|
88 | - */ |
|
89 | - $context->registerService('TagService', function (IContainer $c) { |
|
90 | - /** @var IServerContainer $server */ |
|
91 | - $server = $c->query(IServerContainer::class); |
|
92 | - |
|
93 | - return new TagService( |
|
94 | - $server->getUserSession(), |
|
95 | - $server->getActivityManager(), |
|
96 | - $server->getTagManager()->load(self::APP_ID), |
|
97 | - $server->getUserFolder(), |
|
98 | - $server->getEventDispatcher() |
|
99 | - ); |
|
100 | - }); |
|
101 | - |
|
102 | - /* |
|
60 | + public const APP_ID = 'files'; |
|
61 | + |
|
62 | + public function __construct(array $urlParams=[]) { |
|
63 | + parent::__construct(self::APP_ID, $urlParams); |
|
64 | + } |
|
65 | + |
|
66 | + public function register(IRegistrationContext $context): void { |
|
67 | + /** |
|
68 | + * Controllers |
|
69 | + */ |
|
70 | + $context->registerService('APIController', function (IContainer $c) { |
|
71 | + /** @var IServerContainer $server */ |
|
72 | + $server = $c->query(IServerContainer::class); |
|
73 | + |
|
74 | + return new ApiController( |
|
75 | + $c->query('AppName'), |
|
76 | + $c->query('Request'), |
|
77 | + $server->getUserSession(), |
|
78 | + $c->query('TagService'), |
|
79 | + $server->getPreviewManager(), |
|
80 | + $server->getShareManager(), |
|
81 | + $server->getConfig(), |
|
82 | + $server->getUserFolder() |
|
83 | + ); |
|
84 | + }); |
|
85 | + |
|
86 | + /** |
|
87 | + * Services |
|
88 | + */ |
|
89 | + $context->registerService('TagService', function (IContainer $c) { |
|
90 | + /** @var IServerContainer $server */ |
|
91 | + $server = $c->query(IServerContainer::class); |
|
92 | + |
|
93 | + return new TagService( |
|
94 | + $server->getUserSession(), |
|
95 | + $server->getActivityManager(), |
|
96 | + $server->getTagManager()->load(self::APP_ID), |
|
97 | + $server->getUserFolder(), |
|
98 | + $server->getEventDispatcher() |
|
99 | + ); |
|
100 | + }); |
|
101 | + |
|
102 | + /* |
|
103 | 103 | * Register capabilities |
104 | 104 | */ |
105 | - $context->registerCapability(Capabilities::class); |
|
106 | - |
|
107 | - $context->registerEventListener(LoadAdditionalScriptsEvent::class, LegacyLoadAdditionalScriptsAdapter::class); |
|
108 | - $context->registerEventListener(LoadSidebar::class, LoadSidebarListener::class); |
|
109 | - } |
|
110 | - |
|
111 | - public function boot(IBootContext $context): void { |
|
112 | - $this->registerCollaboration($context); |
|
113 | - Listener::register($context->getServerContainer()->getEventDispatcher()); |
|
114 | - $this->registerNotification($context); |
|
115 | - $this->registerSearchProvider($context); |
|
116 | - $this->registerTemplates(); |
|
117 | - $this->registerNavigation($context); |
|
118 | - $this->registerHooks(); |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * Register Collaboration ResourceProvider |
|
123 | - */ |
|
124 | - private function registerCollaboration(IBootContext $context): void { |
|
125 | - /** @var IProviderManager $providerManager */ |
|
126 | - $providerManager = $context->getAppContainer()->query(IProviderManager::class); |
|
127 | - $providerManager->registerResourceProvider(ResourceProvider::class); |
|
128 | - } |
|
129 | - |
|
130 | - private function registerNotification(IBootContext $context): void { |
|
131 | - /** @var IManager $notifications */ |
|
132 | - $notifications = $context->getAppContainer()->query(IManager::class); |
|
133 | - $notifications->registerNotifierService(Notifier::class); |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * @param IBootContext $context |
|
138 | - */ |
|
139 | - private function registerSearchProvider(IBootContext $context): void { |
|
140 | - $context->getServerContainer()->getSearch()->registerProvider(File::class, ['apps' => ['files']]); |
|
141 | - } |
|
142 | - |
|
143 | - private function registerTemplates(): void { |
|
144 | - $templateManager = \OC_Helper::getFileTemplateManager(); |
|
145 | - $templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp'); |
|
146 | - $templateManager->registerTemplate('application/vnd.oasis.opendocument.text', 'core/templates/filetemplates/template.odt'); |
|
147 | - $templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods'); |
|
148 | - } |
|
149 | - |
|
150 | - private function registerNavigation(IBootContext $context): void { |
|
151 | - /** @var IL10N $l10n */ |
|
152 | - $l10n = $context->getAppContainer()->query(IL10N::class); |
|
153 | - \OCA\Files\App::getNavigationManager()->add([ |
|
154 | - 'id' => 'files', |
|
155 | - 'appname' => 'files', |
|
156 | - 'script' => 'list.php', |
|
157 | - 'order' => 0, |
|
158 | - 'name' => $l10n->t('All files') |
|
159 | - ]); |
|
160 | - \OCA\Files\App::getNavigationManager()->add([ |
|
161 | - 'id' => 'recent', |
|
162 | - 'appname' => 'files', |
|
163 | - 'script' => 'recentlist.php', |
|
164 | - 'order' => 2, |
|
165 | - 'name' => $l10n->t('Recent') |
|
166 | - ]); |
|
167 | - \OCA\Files\App::getNavigationManager()->add([ |
|
168 | - 'id' => 'favorites', |
|
169 | - 'appname' => 'files', |
|
170 | - 'script' => 'simplelist.php', |
|
171 | - 'order' => 5, |
|
172 | - 'name' => $l10n->t('Favorites'), |
|
173 | - 'expandedState' => 'show_Quick_Access' |
|
174 | - ]); |
|
175 | - } |
|
176 | - |
|
177 | - private function registerHooks(): void { |
|
178 | - Util::connectHook('\OCP\Config', 'js', '\OCA\Files\App', 'extendJsConfig'); |
|
179 | - } |
|
105 | + $context->registerCapability(Capabilities::class); |
|
106 | + |
|
107 | + $context->registerEventListener(LoadAdditionalScriptsEvent::class, LegacyLoadAdditionalScriptsAdapter::class); |
|
108 | + $context->registerEventListener(LoadSidebar::class, LoadSidebarListener::class); |
|
109 | + } |
|
110 | + |
|
111 | + public function boot(IBootContext $context): void { |
|
112 | + $this->registerCollaboration($context); |
|
113 | + Listener::register($context->getServerContainer()->getEventDispatcher()); |
|
114 | + $this->registerNotification($context); |
|
115 | + $this->registerSearchProvider($context); |
|
116 | + $this->registerTemplates(); |
|
117 | + $this->registerNavigation($context); |
|
118 | + $this->registerHooks(); |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * Register Collaboration ResourceProvider |
|
123 | + */ |
|
124 | + private function registerCollaboration(IBootContext $context): void { |
|
125 | + /** @var IProviderManager $providerManager */ |
|
126 | + $providerManager = $context->getAppContainer()->query(IProviderManager::class); |
|
127 | + $providerManager->registerResourceProvider(ResourceProvider::class); |
|
128 | + } |
|
129 | + |
|
130 | + private function registerNotification(IBootContext $context): void { |
|
131 | + /** @var IManager $notifications */ |
|
132 | + $notifications = $context->getAppContainer()->query(IManager::class); |
|
133 | + $notifications->registerNotifierService(Notifier::class); |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * @param IBootContext $context |
|
138 | + */ |
|
139 | + private function registerSearchProvider(IBootContext $context): void { |
|
140 | + $context->getServerContainer()->getSearch()->registerProvider(File::class, ['apps' => ['files']]); |
|
141 | + } |
|
142 | + |
|
143 | + private function registerTemplates(): void { |
|
144 | + $templateManager = \OC_Helper::getFileTemplateManager(); |
|
145 | + $templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp'); |
|
146 | + $templateManager->registerTemplate('application/vnd.oasis.opendocument.text', 'core/templates/filetemplates/template.odt'); |
|
147 | + $templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods'); |
|
148 | + } |
|
149 | + |
|
150 | + private function registerNavigation(IBootContext $context): void { |
|
151 | + /** @var IL10N $l10n */ |
|
152 | + $l10n = $context->getAppContainer()->query(IL10N::class); |
|
153 | + \OCA\Files\App::getNavigationManager()->add([ |
|
154 | + 'id' => 'files', |
|
155 | + 'appname' => 'files', |
|
156 | + 'script' => 'list.php', |
|
157 | + 'order' => 0, |
|
158 | + 'name' => $l10n->t('All files') |
|
159 | + ]); |
|
160 | + \OCA\Files\App::getNavigationManager()->add([ |
|
161 | + 'id' => 'recent', |
|
162 | + 'appname' => 'files', |
|
163 | + 'script' => 'recentlist.php', |
|
164 | + 'order' => 2, |
|
165 | + 'name' => $l10n->t('Recent') |
|
166 | + ]); |
|
167 | + \OCA\Files\App::getNavigationManager()->add([ |
|
168 | + 'id' => 'favorites', |
|
169 | + 'appname' => 'files', |
|
170 | + 'script' => 'simplelist.php', |
|
171 | + 'order' => 5, |
|
172 | + 'name' => $l10n->t('Favorites'), |
|
173 | + 'expandedState' => 'show_Quick_Access' |
|
174 | + ]); |
|
175 | + } |
|
176 | + |
|
177 | + private function registerHooks(): void { |
|
178 | + Util::connectHook('\OCP\Config', 'js', '\OCA\Files\App', 'extendJsConfig'); |
|
179 | + } |
|
180 | 180 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | class Application extends App implements IBootstrap { |
60 | 60 | public const APP_ID = 'files'; |
61 | 61 | |
62 | - public function __construct(array $urlParams=[]) { |
|
62 | + public function __construct(array $urlParams = []) { |
|
63 | 63 | parent::__construct(self::APP_ID, $urlParams); |
64 | 64 | } |
65 | 65 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * Controllers |
69 | 69 | */ |
70 | - $context->registerService('APIController', function (IContainer $c) { |
|
70 | + $context->registerService('APIController', function(IContainer $c) { |
|
71 | 71 | /** @var IServerContainer $server */ |
72 | 72 | $server = $c->query(IServerContainer::class); |
73 | 73 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | /** |
87 | 87 | * Services |
88 | 88 | */ |
89 | - $context->registerService('TagService', function (IContainer $c) { |
|
89 | + $context->registerService('TagService', function(IContainer $c) { |
|
90 | 90 | /** @var IServerContainer $server */ |
91 | 91 | $server = $c->query(IServerContainer::class); |
92 | 92 |