Overhauled media-bbcode
authorMarcel Werk <burntime@woltlab.com>
Sun, 27 Nov 2016 13:05:18 +0000 (14:05 +0100)
committerMarcel Werk <burntime@woltlab.com>
Sun, 27 Nov 2016 13:05:18 +0000 (14:05 +0100)
com.woltlab.wcf/templates/mediaBBCodeTag.tpl
wcfsetup/install/files/lib/system/cache/runtime/ViewableMediaRuntimeCache.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/message/embedded/object/MediaMessageEmbeddedObjectHandler.class.php
wcfsetup/install/files/style/bbcode/media.scss [new file with mode: 0644]

index 448dcfedd15d00c9df19c0b0b7d8e5451c61ba47..b4f206b367377cedd577e54b65cea71838240d94 100644 (file)
@@ -1 +1,11 @@
-<img src="{if $thumbnailSize == 'original'}{$media->getLink()}{else}{$media->getThumbnailLink($thumbnailSize)}{/if}" alt="{$media->getTitle()}"{if $float != 'none'} class="messageFloatObject{$float|ucfirst}"{/if}> 
\ No newline at end of file
+<figure class="mediaBBCode{if $float != 'none'} messageFloatObject{$float|ucfirst}{/if}">
+       {if $thumbnailSize != 'original'}
+               <a href="{$media->getLink()}" class="embeddedAttachmentLink jsImageViewer"><img src="{$media->getThumbnailLink($thumbnailSize)}" alt="{$media->altText}" title="{$media->title}"></a>
+       {else}
+               <img src="{$media->getLink()}" alt="{$media->altText}" title="{$media->title}">
+       {/if}
+               
+       {if $media->caption}
+               <figcaption>{$media->caption}</figcaption>
+       {/if}
+</figure>
diff --git a/wcfsetup/install/files/lib/system/cache/runtime/ViewableMediaRuntimeCache.class.php b/wcfsetup/install/files/lib/system/cache/runtime/ViewableMediaRuntimeCache.class.php
new file mode 100644 (file)
index 0000000..2803d3d
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+namespace wcf\system\cache\runtime;
+use wcf\data\media\ViewableMedia;
+use wcf\data\media\ViewableMediaList;
+
+/**
+ * Runtime cache implementation for viewable media.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2016 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\System\Cache\Runtime
+ * @since      3.0
+ * 
+ * @method     ViewableMedia[]         getCachedObjects()
+ * @method     ViewableMedia           getObject($objectID)
+ * @method     ViewableMedia[]         getObjects(array $objectIDs)
+ */
+class ViewableMediaRuntimeCache extends AbstractRuntimeCache {
+       /**
+        * @inheritDoc
+        */
+       protected $listClassName = ViewableMediaList::class;
+}
index fd11d4ad9af045a1398de381b5920216e3ce27e8..aad97f6699f58ab45215047304f31be3e9dde722 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\system\message\embedded\object;
 use wcf\data\media\Media;
 use wcf\data\media\MediaList;
-use wcf\system\cache\runtime\MediaRuntimeCache;
+use wcf\system\cache\runtime\ViewableMediaRuntimeCache;
 use wcf\system\html\input\HtmlInputProcessor;
 use wcf\util\ArrayUtil;
 
@@ -39,7 +39,7 @@ class MediaMessageEmbeddedObjectHandler extends AbstractSimpleMessageEmbeddedObj
         * @inheritDoc
         */
        public function loadObjects(array $objectIDs) {
-               return MediaRuntimeCache::getInstance()->getObjects($objectIDs);
+               return ViewableMediaRuntimeCache::getInstance()->getObjects($objectIDs);
        }
        
        /**
diff --git a/wcfsetup/install/files/style/bbcode/media.scss b/wcfsetup/install/files/style/bbcode/media.scss
new file mode 100644 (file)
index 0000000..b8613ae
--- /dev/null
@@ -0,0 +1,11 @@
+.mediaBBCode {
+       display: inline-block;
+       
+       figcaption {
+               color: $wcfContentDimmedText;
+               margin-top: 5px;
+               text-align: center;
+               
+               @include wcfFontSmall;
+       }
+}