Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/Files
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-11-22 16:00:02 +0300
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-12-03 17:48:41 +0300
commit432e1b0aa44c783d01169f32fe75b90640c2d4ac (patch)
tree72ebfd4c07b3ac8cc3a5cb096144fec87f9491e3 /lib/Files
parent7277141a1ee34477655549af2904855e001343b6 (diff)
Show Talk sidebar in Files app
This commit introduces a DetailTabView plugin to show a chat view in the sidebar of the Files app. The tab makes possible to chat in a Talk room associated to the current file; due to this, the tab is visible only on files that can be associated to a room, that is, files shared with the current user or by the current user to another user (as a user, group, circle...). Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'lib/Files')
-rw-r--r--lib/Files/TemplateLoader.php82
1 files changed, 82 insertions, 0 deletions
diff --git a/lib/Files/TemplateLoader.php b/lib/Files/TemplateLoader.php
new file mode 100644
index 000000000..70418d048
--- /dev/null
+++ b/lib/Files/TemplateLoader.php
@@ -0,0 +1,82 @@
+<?php
+declare(strict_types=1);
+
+/**
+ *
+ * @copyright Copyright (c) 2018, Daniel Calviño Sánchez (danxuliu@gmail.com)
+ *
+ * @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\Spreed\Files;
+
+use OCP\Util;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\EventDispatcher\GenericEvent;
+
+/**
+ * Helper class to add the Talk UI to the sidebar of the Files app.
+ */
+class TemplateLoader {
+
+ /** @var EventDispatcherInterface */
+ protected $dispatcher;
+
+ public function __construct(EventDispatcherInterface $dispatcher) {
+ $this->dispatcher = $dispatcher;
+ }
+
+ public function register() {
+ $listener = function() {
+ $this->loadTalkSidebarForFilesApp();
+ };
+ $this->dispatcher->addListener('OCA\Files::loadAdditionalScripts', $listener);
+ }
+
+ /**
+ * Loads the Talk UI in the sidebar of the Files app.
+ *
+ * This method should be called when loading additional scripts for the
+ * Files app.
+ */
+ public function loadTalkSidebarForFilesApp() {
+ Util::addStyle('spreed', 'files');
+ Util::addStyle('spreed', 'chatview');
+ Util::addStyle('spreed', 'autocomplete');
+
+ Util::addScript('spreed', 'vendor/backbone/backbone-min');
+ Util::addScript('spreed', 'vendor/backbone.radio/build/backbone.radio.min');
+ Util::addScript('spreed', 'vendor/backbone.marionette/lib/backbone.marionette.min');
+ Util::addScript('spreed', 'vendor/jshashes/hashes.min');
+ Util::addScript('spreed', 'vendor/Caret.js/dist/jquery.caret.min');
+ Util::addScript('spreed', 'vendor/At.js/dist/js/jquery.atwho.min');
+ Util::addScript('spreed', 'models/chatmessage');
+ Util::addScript('spreed', 'models/chatmessagecollection');
+ Util::addScript('spreed', 'models/room');
+ Util::addScript('spreed', 'models/roomcollection');
+ Util::addScript('spreed', 'views/chatview');
+ Util::addScript('spreed', 'views/editabletextlabel');
+ Util::addScript('spreed', 'views/richobjectstringparser');
+ Util::addScript('spreed', 'views/templates');
+ Util::addScript('spreed', 'views/virtuallist');
+ Util::addScript('spreed', 'signaling');
+ Util::addScript('spreed', 'connection');
+ Util::addScript('spreed', 'embedded');
+ Util::addScript('spreed', 'filesplugin');
+ }
+
+}