From f6298605068faf5efd101740dd121a773498f292 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Fri, 18 Jan 2019 18:15:22 +0100 Subject: [PATCH] Use video player for video attachments Close #2802 --- .../templates/__videoAttachmentBBCode.tpl | 19 +++++++++++++++++++ .../system/bbcode/AttachmentBBCode.class.php | 7 +++++++ 2 files changed, 26 insertions(+) create mode 100644 com.woltlab.wcf/templates/__videoAttachmentBBCode.tpl diff --git a/com.woltlab.wcf/templates/__videoAttachmentBBCode.tpl b/com.woltlab.wcf/templates/__videoAttachmentBBCode.tpl new file mode 100644 index 0000000000..da69480dbb --- /dev/null +++ b/com.woltlab.wcf/templates/__videoAttachmentBBCode.tpl @@ -0,0 +1,19 @@ + + +{$attachment->filename} + + diff --git a/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php index d4a6c6e65d..89713b829e 100644 --- a/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php @@ -3,6 +3,7 @@ namespace wcf\system\bbcode; use wcf\data\attachment\GroupedAttachmentList; use wcf\system\message\embedded\object\MessageEmbeddedObjectManager; use wcf\system\request\LinkHandler; +use wcf\system\WCF; use wcf\util\StringUtil; /** @@ -152,6 +153,12 @@ class AttachmentBBCode extends AbstractBBCode { return $result; } + else if (substr($attachment->fileType, 0, 6) === 'video/') { + return WCF::getTPL()->fetch('__videoAttachmentBBCode', 'wcf', [ + 'attachment' => $attachment, + 'attachmentIdentifier' => StringUtil::getRandomID() + ]); + } else { // file return StringUtil::getAnchorTag(LinkHandler::getInstance()->getLink('Attachment', [ -- 2.20.1