summaryrefslogtreecommitdiffstats
path: root/apps/files/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-09-01 20:09:33 +0200
committerJulius Härtl <jus@bitgrid.net>2023-03-02 21:01:44 +0100
commit6130f1a78ea4f7fba3e3690528f2b53a0d9f5b82 (patch)
tree404bcf6ad7790b7ecda2eed0efb3a9d4618fddbb /apps/files/lib
parentb6d8fc97afe28bc1b017026447264ba37ed37caa (diff)
downloadnextcloud-server-6130f1a78ea4f7fba3e3690528f2b53a0d9f5b82.tar.gz
nextcloud-server-6130f1a78ea4f7fba3e3690528f2b53a0d9f5b82.zip
Implement file reference wiget
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/files/lib')
-rw-r--r--apps/files/lib/AppInfo/Application.php3
-rw-r--r--apps/files/lib/Listener/RenderReferenceEventListener.php39
2 files changed, 42 insertions, 0 deletions
diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php
index 01fe46bb877..e3152c77abc 100644
--- a/apps/files/lib/AppInfo/Application.php
+++ b/apps/files/lib/AppInfo/Application.php
@@ -44,6 +44,7 @@ use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCA\Files\Event\LoadSidebar;
use OCA\Files\Listener\LegacyLoadAdditionalScriptsAdapter;
use OCA\Files\Listener\LoadSidebarListener;
+use OCA\Files\Listener\RenderReferenceEventListener;
use OCA\Files\Notification\Notifier;
use OCA\Files\Search\FilesSearchProvider;
use OCA\Files\Service\TagService;
@@ -53,6 +54,7 @@ use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
+use OCP\Collaboration\Reference\RenderReferenceEvent;
use OCP\Collaboration\Resources\IProviderManager;
use OCP\IConfig;
use OCP\IL10N;
@@ -118,6 +120,7 @@ class Application extends App implements IBootstrap {
$context->registerEventListener(LoadAdditionalScriptsEvent::class, LegacyLoadAdditionalScriptsAdapter::class);
$context->registerEventListener(LoadSidebar::class, LoadSidebarListener::class);
+ $context->registerEventListener(RenderReferenceEvent::class, RenderReferenceEventListener::class);
$context->registerSearchProvider(FilesSearchProvider::class);
diff --git a/apps/files/lib/Listener/RenderReferenceEventListener.php b/apps/files/lib/Listener/RenderReferenceEventListener.php
new file mode 100644
index 00000000000..121ff745065
--- /dev/null
+++ b/apps/files/lib/Listener/RenderReferenceEventListener.php
@@ -0,0 +1,39 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2022 Julius Härtl <jus@bitgrid.net>
+ *
+ * @author Julius Härtl <jus@bitgrid.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace OCA\Files\Listener;
+
+use OCP\Collaboration\Reference\RenderReferenceEvent;
+use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IEventListener;
+
+class RenderReferenceEventListener implements IEventListener {
+ public function handle(Event $event): void {
+ if (!$event instanceof RenderReferenceEvent) {
+ return;
+ }
+
+ \OCP\Util::addScript('files', 'reference-files');
+ }
+}