Added extra teaser image for article listings
authorMarcel Werk <burntime@woltlab.com>
Sun, 5 Mar 2017 13:19:36 +0000 (14:19 +0100)
committerMarcel Werk <burntime@woltlab.com>
Sun, 5 Mar 2017 13:19:44 +0000 (14:19 +0100)
Closes #2210

17 files changed:
com.woltlab.wcf/templates/ampArticle.tpl
com.woltlab.wcf/templates/article.tpl
com.woltlab.wcf/templates/articleListItems.tpl
wcfsetup/install/files/acp/templates/articleAdd.tpl
wcfsetup/install/files/acp/templates/articleList.tpl
wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php
wcfsetup/install/files/lib/acp/form/ArticleEditForm.class.php
wcfsetup/install/files/lib/data/article/ArticleAction.class.php
wcfsetup/install/files/lib/data/article/ViewableArticle.class.php
wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php
wcfsetup/install/files/lib/data/article/content/SearchResultArticleContent.class.php
wcfsetup/install/files/lib/data/article/content/ViewableArticleContent.class.php
wcfsetup/install/files/lib/data/article/content/ViewableArticleContentList.class.php
wcfsetup/install/files/lib/page/ArticlePage.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml
wcfsetup/setup/db/install.sql

index 32ed4066cc68eb24049a79acdb157e872a83dff7..783579964edd55b8010612f5edb11e8895dd0fb9 100644 (file)
                <amp-carousel width="400" height="300" layout="responsive" type="slides" autoplay delay="5000">
                        {content}
                                {foreach from=$additionalArticles item='additionalArticle'}
-                                       {if $additionalArticle->getImage()}
+                                       {if $additionalArticle->getTeaserImage()}
                                                <a href="{link controller='ArticleAmp' object=$additionalArticle->getArticleContent()}{/link}">
                                                        <figure>
-                                                               <amp-img src="{$additionalArticle->getImage()->getThumbnailLink('large')}" layout="fill"></amp-img>
+                                                               <amp-img src="{$additionalArticle->getTeaserImage()->getThumbnailLink('large')}" layout="fill"></amp-img>
                                                                <figcaption>{$additionalArticle->getTitle()}</figcaption>
                                                        </figure>
                                                </a>
                        <amp-carousel width="400" height="300" layout="responsive" type="slides" autoplay delay="5000">
                                {content}
                                        {foreach from=$relatedArticles item='relatedArticle'}
-                                               {if $relatedArticle->getImage()}
+                                               {if $relatedArticle->getTeaserImage()}
                                                        <a href="{link controller='ArticleAmp' object=$relatedArticle->getArticleContent()}{/link}">
                                                                <figure>
-                                                                       <amp-img src="{$relatedArticle->getImage()->getThumbnailLink('large')}" layout="fill"></amp-img>
+                                                                       <amp-img src="{$relatedArticle->getTeaserImage()->getThumbnailLink('large')}" layout="fill"></amp-img>
                                                                        <figcaption>{$relatedArticle->getTitle()}</figcaption>
                                                                </figure>
                                                        </a>
index 72fed566b1281a76b58e21df147e86721fe8b7c0..cdbc8fee4b47557c2c745d3826534ba206b3b9d5 100644 (file)
                                {if $previousArticle}
                                        <li class="previousArticleButton">
                                                <a href="{$previousArticle->getLink()}" rel="prev">
-                                                       {if $previousArticle->getImage()}
+                                                       {if $previousArticle->getTeaserImage()}
                                                                <div class="box96">
-                                                                       <span class="articleNavigationArticleImage">{@$previousArticle->getImage()->getElementTag(96)}</span>
+                                                                       <span class="articleNavigationArticleImage">{@$previousArticle->getTeaserImage()->getElementTag(96)}</span>
                                                                        
                                                                        <div>
                                                                                <span class="articleNavigationEntityName">{lang}wcf.article.previousArticle{/lang}</span>
                                {if $nextArticle}
                                        <li class="nextArticleButton">
                                                <a href="{$nextArticle->getLink()}" rel="next">
-                                                       {if $nextArticle->getImage()}
+                                                       {if $nextArticle->getTeaserImage()}
                                                                <div class="box96">
-                                                                       <span class="articleNavigationArticleImage">{@$nextArticle->getImage()->getElementTag(96)}</span>
+                                                                       <span class="articleNavigationArticleImage">{@$nextArticle->getTeaserImage()->getElementTag(96)}</span>
                                                                        
                                                                        <div>
                                                                                <span class="articleNavigationEntityName">{lang}wcf.article.nextArticle{/lang}</span>
                        {foreach from=$relatedArticles item='relatedArticle'}
                                <li>
                                        <a href="{$relatedArticle->getLink()}">
-                                               {if $relatedArticle->getImage() && $relatedArticle->getImage()->hasThumbnail('tiny')}
+                                               {if $relatedArticle->getTeaserImage() && $relatedArticle->getTeaserImage()->hasThumbnail('tiny')}
                                                        <div class="box128">
-                                                               <div class="articleListImage">{@$relatedArticle->getImage()->getThumbnailTag('tiny')}</div>
+                                                               <div class="articleListImage">{@$relatedArticle->getTeaserImage()->getThumbnailTag('tiny')}</div>
                                                {/if}
                                                
                                                <div>
                                                        </div>
                                                </div>
                                                                
-                                               {if $relatedArticle->getImage() && $relatedArticle->getImage()->hasThumbnail('tiny')}
+                                               {if $relatedArticle->getTeaserImage() && $relatedArticle->getTeaserImage()->hasThumbnail('tiny')}
                                                        </div>
                                                {/if}
                                        </a>
index 8c5cd741b449afc7bbb96f9ff22c03f267c425a6..56ce16e6521770535918edf2b6313115bab0c6a5 100644 (file)
@@ -2,9 +2,9 @@
        {foreach from=$objects item='article'}
                <li>
                        <a href="{$article->getLink()}">
-                               {if $article->getImage() && $article->getImage()->hasThumbnail('tiny')}
+                               {if $article->getTeaserImage() && $article->getTeaserImage()->hasThumbnail('tiny')}
                                        <div class="box128">
-                                               <div class="articleListImage">{@$article->getImage()->getThumbnailTag('tiny')}</div>
+                                               <div class="articleListImage">{@$article->getTeaserImage()->getThumbnailTag('tiny')}</div>
                                {/if}
                                        
                                        <div>
@@ -38,7 +38,7 @@
                                                </div>
                                        </div>
                                                
-                               {if $article->getImage() && $article->getImage()->hasThumbnail('tiny')}
+                               {if $article->getTeaserImage() && $article->getTeaserImage()->hasThumbnail('tiny')}
                                        </div>
                                {/if}
                        </a>
index e02e959a331043d615c5143b183e1e05805d7625..73a053bba27f54c3d2c2609735c08b7764690c0e 100644 (file)
                                </dl>
                        {/if}
                        
+                       {if $__wcf->session->getPermission('admin.content.cms.canUseMedia')}
+                               <dl{if $errorField == 'teaserImage'} class="formError"{/if}>
+                                       <dt><label for="teaserImage">{lang}wcf.acp.article.teaserImage{/lang}</label></dt>
+                                       <dd>
+                                               <div id="teaserImageDisplay" class="selectedImagePreview">
+                                                       {if $teaserImages[0]|isset && $teaserImages[0]->hasThumbnail('small')}
+                                                               {@$teaserImages[0]->getThumbnailTag('small')}
+                                                       {/if}
+                                               </div>
+                                               <p class="button jsMediaSelectButton" data-store="teaserImageID0" data-display="teaserImageDisplay">{lang}wcf.media.chooseImage{/lang}</p>
+                                               <input type="hidden" name="teaserImageID[0]" id="teaserImageID0"{if $teaserImageID[0]|isset} value="{@$teaserImageID[0]}"{/if}>
+                                               {if $errorField == 'teaserImage'}
+                                                       <small class="innerError">{lang}wcf.acp.article.image.error.{@$errorType}{/lang}</small>
+                                               {/if}
+                                       </dd>
+                               </dl>
+                       {elseif $action == 'edit' && $teaserImages[0]|isset && $teaserImages[0]->hasThumbnail('small')}
+                               <dl>
+                                       <dt>{lang}wcf.acp.article.teaserImage{/lang}</dt>
+                                       <dd>
+                                               <div id="teaserImageDisplay">{@$teaserImages[0]->getThumbnailTag('small')}</div>
+                                       </dd>
+                               </dl>
+                       {/if}
+                       
                        <dl{if $errorField == 'title'} class="formError"{/if}>
                                <dt><label for="title0">{lang}wcf.global.title{/lang}</label></dt>
                                <dd>
                                                        </dl>
                                                {/if}
                                                
+                                               {if $__wcf->session->getPermission('admin.content.cms.canUseMedia')}
+                                                       <dl{if $errorField == 'image'|concat:$availableLanguage->languageID} class="formError"{/if}>
+                                                               <dt><label for="teaserImage{@$availableLanguage->languageID}">{lang}wcf.acp.article.teaserImage{/lang}</label></dt>
+                                                               <dd>
+                                                                       <div id="teaserImageDisplay{@$availableLanguage->languageID}">
+                                                                               {if $teaserImages[$availableLanguage->languageID]|isset && $teaserImages[$availableLanguage->languageID]->hasThumbnail('small')}
+                                                                                       {@$teaserImages[$availableLanguage->languageID]->getThumbnailTag('small')}
+                                                                               {/if}
+                                                                       </div>
+                                                                       <p class="button jsMediaSelectButton" data-store="teaserImageID{@$availableLanguage->languageID}" data-display="teaserImageDisplay{@$availableLanguage->languageID}">{lang}wcf.media.chooseImage{/lang}</p>
+                                                                       <input type="hidden" name="teaserImageID[{@$availableLanguage->languageID}]" id="teaserImageID{@$availableLanguage->languageID}"{if $teaserImageID[$availableLanguage->languageID]|isset} value="{@$teaserImageID[$availableLanguage->languageID]}"{/if}>
+                                                                       {if $errorField == 'teaserImage'|concat:$availableLanguage->languageID}
+                                                                               <small class="innerError">{lang}wcf.acp.article.image.error.{@$errorType}{/lang}</small>
+                                                                       {/if}
+                                                               </dd>
+                                                       </dl>
+                                               {elseif $action == 'edit' && $teaserImages[$availableLanguage->languageID]|isset && $teaserImages[$availableLanguage->languageID]->hasThumbnail('small')}
+                                                       <dl>
+                                                               <dt>{lang}wcf.acp.article.teaserImage{/lang}</dt>
+                                                               <dd>
+                                                                       <div id="imageDisplay">{@$teaserImages[$availableLanguage->languageID]->getThumbnailTag('small')}</div>
+                                                               </dd>
+                                                       </dl>
+                                               {/if}
+                                               
                                                <dl{if $errorField == 'title'|concat:$availableLanguage->languageID} class="formError"{/if}>
                                                        <dt><label for="title{@$availableLanguage->languageID}">{lang}wcf.global.title{/lang}</label></dt>
                                                        <dd>
index a846d58d232286c22bbff80acad3281d0fb12800..9fd558451103d174862f40702d5cc450d74a79ed 100644 (file)
                                                <td class="columnText columnArticleTitle">
                                                        <div class="box48">
                                                                <span>
-                                                                       {if $article->getImage()}
-                                                                               {@$article->getImage()->getElementTag(48)}
+                                                                       {if $article->getTeaserImage()}
+                                                                               {@$article->getTeaserImage()->getElementTag(48)}
                                                                        {else}
                                                                                <img src="{@$__wcf->getPath()}images/placeholderTiny.png" style="width: 48px; height: 48px" alt="">
                                                                        {/if}
index c1e8c708ccd009f836b6251bb6cc54fe73f87fa4..09dceba408f1a8330f33a0b73c07adcee6b5daa7 100644 (file)
@@ -139,12 +139,24 @@ class ArticleAddForm extends AbstractForm {
         */
        public $imageID = [];
        
+       /**
+        * thumbnail image ids
+        * @var integer[]
+        */
+       public $teaserImageID = [];
+       
        /**
         * images
         * @var Media[]
         */
        public $images = [];
        
+       /**
+        * thumbnail images
+        * @var Media[]
+        */
+       public $teaserImages = [];
+       
        /**
         * list of available languages
         * @var Language[]
@@ -212,6 +224,7 @@ class ArticleAddForm extends AbstractForm {
                
                if (WCF::getSession()->getPermission('admin.content.cms.canUseMedia')) {
                        if (isset($_POST['imageID']) && is_array($_POST['imageID'])) $this->imageID = ArrayUtil::toIntegerArray($_POST['imageID']);
+                       if (isset($_POST['teaserImageID']) && is_array($_POST['teaserImageID'])) $this->teaserImageID = ArrayUtil::toIntegerArray($_POST['teaserImageID']);
                        
                        $this->readImages();
                }
@@ -221,9 +234,9 @@ class ArticleAddForm extends AbstractForm {
         * Reads the box images.
         */
        protected function readImages() {
-               if (!empty($this->imageID)) {
+               if (!empty($this->imageID) || !empty($this->teaserImageID)) {
                        $mediaList = new ViewableMediaList();
-                       $mediaList->setObjectIDs($this->imageID);
+                       $mediaList->setObjectIDs(array_merge($this->imageID, $this->teaserImageID));
                        $mediaList->readObjects();
                        
                        foreach ($this->imageID as $languageID => $imageID) {
@@ -232,6 +245,12 @@ class ArticleAddForm extends AbstractForm {
                                        $this->images[$languageID] = $image;
                                }
                        }
+                       foreach ($this->teaserImageID as $languageID => $imageID) {
+                               $image = $mediaList->search($imageID);
+                               if ($image !== null && $image->isImage) {
+                                       $this->teaserImages[$languageID] = $image;
+                               }
+                       }
                }
        }
        
@@ -326,7 +345,8 @@ class ArticleAddForm extends AbstractForm {
                                        'teaser' => !empty($this->teaser[$language->languageID]) ? $this->teaser[$language->languageID] : '',
                                        'content' => !empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : '',
                                        'htmlInputProcessor' => isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null,
-                                       'imageID' => !empty($this->imageID[$language->languageID]) ? $this->imageID[$language->languageID] : null
+                                       'imageID' => !empty($this->imageID[$language->languageID]) ? $this->imageID[$language->languageID] : null,
+                                       'teaserImageID' => !empty($this->teaserImageID[$language->languageID]) ? $this->teaserImageID[$language->languageID] : null
                                ];
                        }
                }
@@ -337,7 +357,8 @@ class ArticleAddForm extends AbstractForm {
                                'teaser' => !empty($this->teaser[0]) ? $this->teaser[0] : '',
                                'content' => !empty($this->content[0]) ? $this->content[0] : '',
                                'htmlInputProcessor' => isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null,
-                               'imageID' => !empty($this->imageID[0]) ? $this->imageID[0] : null
+                               'imageID' => !empty($this->imageID[0]) ? $this->imageID[0] : null,
+                               'teaserImageID' => !empty($this->teaserImageID[0]) ? $this->teaserImageID[0] : null
                        ];
                }
                
@@ -366,7 +387,7 @@ class ArticleAddForm extends AbstractForm {
                $this->categoryID = 0;
                $this->publicationStatus = Article::PUBLISHED;
                $this->enableComments = ARTICLE_ENABLE_COMMENTS_DEFAULT_VALUE;
-               $this->title = $this->teaser = $this->content = $this->images = $this->imageID = $this->tags = [];
+               $this->title = $this->teaser = $this->content = $this->images = $this->imageID = $this->teaserImages = $this->teaserImageID == $this->tags = [];
                
                $this->setDefaultValues();
        }
@@ -413,6 +434,8 @@ class ArticleAddForm extends AbstractForm {
                        'publicationDate' => $this->publicationDate,
                        'imageID' => $this->imageID,
                        'images' => $this->images,
+                       'teaserImageID' => $this->teaserImageID,
+                       'teaserImages' => $this->teaserImages,
                        'tags' => $this->tags,
                        'title' => $this->title,
                        'teaser' => $this->teaser,
index 9d53c89e0c4a2ead92c58c43596656d79dada1fa..4b8a2975c5c76daa423f822473433f55982f2141 100644 (file)
@@ -79,7 +79,8 @@ class ArticleEditForm extends ArticleAddForm {
                                        'teaser' => !empty($this->teaser[$language->languageID]) ? $this->teaser[$language->languageID] : '',
                                        'content' => !empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : '',
                                        'htmlInputProcessor' => isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null,
-                                       'imageID' => !empty($this->imageID[$language->languageID]) ? $this->imageID[$language->languageID] : null
+                                       'imageID' => !empty($this->imageID[$language->languageID]) ? $this->imageID[$language->languageID] : null,
+                                       'teaserImageID' => !empty($this->teaserImageID[$language->languageID]) ? $this->teaserImageID[$language->languageID] : null
                                ];
                        }
                }
@@ -90,7 +91,8 @@ class ArticleEditForm extends ArticleAddForm {
                                'teaser' => !empty($this->teaser[0]) ? $this->teaser[0] : '',
                                'content' => !empty($this->content[0]) ? $this->content[0] : '',
                                'htmlInputProcessor' => isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null,
-                               'imageID' => !empty($this->imageID[0]) ? $this->imageID[0] : null
+                               'imageID' => !empty($this->imageID[0]) ? $this->imageID[0] : null,
+                               'teaserImageID' => !empty($this->teaserImageID[0]) ? $this->teaserImageID[0] : null
                        ];
                }
                
@@ -121,6 +123,7 @@ class ArticleEditForm extends ArticleAddForm {
                if (!empty($_POST) && !WCF::getSession()->getPermission('admin.content.cms.canUseMedia')) {
                        foreach ($this->article->getArticleContents() as $languageID => $content) {
                                $this->imageID[$languageID] = $content->imageID;
+                               $this->teaserImageID[$languageID] = $content->teaserImageID;
                        }
                        
                        $this->readImages();
@@ -147,6 +150,7 @@ class ArticleEditForm extends ArticleAddForm {
                                $this->teaser[$languageID] = $content->teaser;
                                $this->content[$languageID] = $content->content;
                                $this->imageID[$languageID] = $content->imageID;
+                               $this->teaserImageID[$languageID] = $content->teaserImageID;
                                
                                // get tags
                                if (MODULE_TAGGING) {
index 224a8399b0742e907163ff7609d335911cb4a6f5..fe2ecefe24fd6fc2f904b8a712ac51dfb94114e5 100644 (file)
@@ -71,7 +71,8 @@ class ArticleAction extends AbstractDatabaseObjectAction {
                                        'title' => $content['title'],
                                        'teaser' => $content['teaser'],
                                        'content' => $content['content'],
-                                       'imageID' => $content['imageID']
+                                       'imageID' => $content['imageID'],
+                                       'teaserImageID' => $content['teaserImageID']
                                ]);
                                $articleContentEditor = new ArticleContentEditor($articleContent);
                                
@@ -131,8 +132,8 @@ class ArticleAction extends AbstractDatabaseObjectAction {
                                                        'title' => $content['title'],
                                                        'teaser' => $content['teaser'],
                                                        'content' => $content['content'],
-                                                       'imageID' => $content['imageID']
-                                               
+                                                       'imageID' => $content['imageID'],
+                                                       'teaserImageID' => $content['teaserImageID']
                                                ]);
                                                
                                                // delete tags
@@ -148,7 +149,8 @@ class ArticleAction extends AbstractDatabaseObjectAction {
                                                        'title' => $content['title'],
                                                        'teaser' => $content['teaser'],
                                                        'content' => $content['content'],
-                                                       'imageID' => $content['imageID']
+                                                       'imageID' => $content['imageID'],
+                                                       'teaserImageID' => $content['teaserImageID']
                                                ]);
                                                $articleContentEditor = new ArticleContentEditor($articleContent);
                                        }
index 8a265b40b5ae6f166c0d72a7ed7e13e66841cac6..38ed5098a447955f80e2e6935d76be75b14b1bff 100644 (file)
@@ -95,4 +95,17 @@ class ViewableArticle extends DatabaseObjectDecorator {
                
                return null;
        }
+       
+       /**
+        * Returns the article's teaser image.
+        *
+        * @return      ViewableMedia|null
+        */
+       public function getTeaserImage() {
+               if ($this->getArticleContent() !== null) {
+                       return $this->getArticleContent()->getTeaserImage();
+               }
+               
+               return null;
+       }
 }
index 9a0dfc68d7944a11560a4288595862d75bcea295..3ac06205ce52ee7fc36e84acf6852144d757c2b7 100644 (file)
@@ -29,6 +29,7 @@ use wcf\util\StringUtil;
  * @property-read      string          $content                actual content of the article in the associated language
  * @property-read      string          $teaser                 teaser of the article in the associated language or empty if no teaser exists
  * @property-read      integer|null    $imageID                id of the (image) media object used as article image for the associated language or `null` if no image is used
+ * @property-read      integer|null    $teaserImageID          id of the (image) media object used as article teaser image for the associated language or `null` if no image is used                                      
  * @property-read      integer         $hasEmbeddedObjects     is `1` if there are embedded objects in the article content, otherwise `0`
  */
 class ArticleContent extends DatabaseObject implements ILinkableObject, IRouteController {
index 813d934187983358151581feef0d2246af3b2158..efa4e2dbdd79d5f5882c95e41ed69aebb57936b4 100644 (file)
@@ -64,8 +64,8 @@ class SearchResultArticleContent extends ViewableArticleContent implements ISear
        public function getFormattedMessage() {
                $message = SearchResultTextParser::getInstance()->parse($this->getDecoratedObject()->getFormattedContent());
                
-               if ($this->getImage()) {
-                       return '<div class="box96">'.$this->getImage()->getElementTag(96).'<div>'.$message.'</div></div>';
+               if ($this->getTeaserImage()) {
+                       return '<div class="box96">'.$this->getTeaserImage()->getElementTag(96).'<div>'.$message.'</div></div>';
                }
                
                return $message;
index 8fc6f2303689f3d4d5d19307e3958535ba35fa40..05dfce0abe1653f0230d1cb0906804dfec4f2318 100644 (file)
@@ -28,6 +28,12 @@ class ViewableArticleContent extends DatabaseObjectDecorator {
         */
        protected $image;
        
+       /**
+        * article thumbnail image
+        * @var ViewableMedia
+        */
+       protected $teaserImage;
+       
        /**
         * article object
         * @var ViewableArticle
@@ -84,6 +90,36 @@ class ViewableArticleContent extends DatabaseObjectDecorator {
                $this->image = $image;
        }
        
+       /**
+        * Returns the article's teaser image if the active user can access it or `null`.
+        *
+        * @return      ViewableMedia|null
+        */
+       public function getTeaserImage() {
+               if (!$this->teaserImageID) {
+                       return $this->getImage();
+               }
+               
+               if ($this->teaserImage === null) {
+                       $this->teaserImage = ViewableMedia::getMedia($this->teaserImageID);
+               }
+               
+               if ($this->teaserImage === null || !$this->teaserImage->isAccessible()) {
+                       return null;
+               }
+               
+               return $this->teaserImage;
+       }
+       
+       /**
+        * Sets the article's teaser image.
+        *
+        * @param       ViewableMedia   $image
+        */
+       public function setTeaserImage(ViewableMedia $image) {
+               $this->teaserImage = $image;
+       }
+       
        /**
         * Returns a specific article content decorated as viewable article content.
         * 
index 53ec886d033cf9582556c795b8f4ab83fe28ab79..70ad0a081eb972ac068f1d12e4d06e938215aaf8 100644 (file)
@@ -34,6 +34,9 @@ class ViewableArticleContentList extends ArticleContentList {
                        if ($articleContent->imageID) {
                                $imageIDs[] = $articleContent->imageID;
                        }
+                       if ($articleContent->thumbnailImageID) {
+                               $imageIDs[] = $articleContent->thumbnailImageID;
+                       }
                        if ($articleContent->hasEmbeddedObjects) {
                                $embeddedObjectPostIDs[] = $articleContent->articleContentID;
                        }
@@ -50,6 +53,9 @@ class ViewableArticleContentList extends ArticleContentList {
                                if ($articleContent->imageID && isset($images[$articleContent->imageID])) {
                                        $articleContent->setImage($images[$articleContent->imageID]);
                                }
+                               if ($articleContent->thumbnailImageID && isset($images[$articleContent->thumbnailImageID])) {
+                                       $articleContent->setThumbnailImage($images[$articleContent->thumbnailImageID]);
+                               }
                        }
                }
                
index ed3cb96c3685eaef8c5ac677e60f2bfd9cc2fcba..aa1e21bacf1435cbfcb2f103d39d0fe7fa26949a 100644 (file)
@@ -109,8 +109,8 @@ class ArticlePage extends AbstractArticlePage {
                MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'article', true);
                MetaTagHandler::getInstance()->addTag('og:description', 'og:description', ($this->articleContent->teaser ?: StringUtil::decodeHTML(StringUtil::stripHTML($this->articleContent->getFormattedTeaser()))), true);
                
-               if ($this->articleContent->getImage()) {
-                       MetaTagHandler::getInstance()->addTag('og:image', 'og:image', $this->articleContent->getImage()->getLink(), true);
+               if ($this->articleContent->getTeaserImage()) {
+                       MetaTagHandler::getInstance()->addTag('og:image', 'og:image', $this->articleContent->getTeaserImage()->getLink(), true);
                        MetaTagHandler::getInstance()->addTag('og:image:width', 'og:image:width', $this->articleContent->getImage()->width, true);
                        MetaTagHandler::getInstance()->addTag('og:image:height', 'og:image:height', $this->articleContent->getImage()->height, true);
                }
index a2b02e4ab2cc366f9376a7d44b95607fa1b20987..e23eba5b76410e39f67c53eae853e4783b15a2e3 100644 (file)
@@ -84,6 +84,7 @@
                <item name="wcf.acp.article.i18n.i18n"><![CDATA[Mehrsprachiger Artikel]]></item>
                <item name="wcf.acp.article.i18n.i18n.description"><![CDATA[Inhalt wird individuell pro Sprache festgelegt.]]></item>
                <item name="wcf.acp.article.image"><![CDATA[Artikel-Bild]]></item>
+               <item name="wcf.acp.article.teaserImage"><![CDATA[Teaser-Bild]]></item>
                <item name="wcf.acp.article.publicationDate"><![CDATA[Veröffentlichungsdatum]]></item>
                <item name="wcf.acp.article.publicationDate.error.invalid"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} ein ungültiges Veröffentlichungsdatum angegeben.]]></item>
                <item name="wcf.acp.article.publicationStatus"><![CDATA[Status]]></item>
index 02a10dd96696ec3091592c3d4c7b86ea874d1589..fcb4cba915df8a65c9ac2d032c058487c44b9aac 100644 (file)
@@ -84,6 +84,7 @@
                <item name="wcf.acp.article.i18n.i18n"><![CDATA[Multilingual article]]></item>
                <item name="wcf.acp.article.i18n.i18n.description"><![CDATA[The content will be provided for each language separately.]]></item>
                <item name="wcf.acp.article.image"><![CDATA[Article Image]]></item>
+               <item name="wcf.acp.article.teaserImage"><![CDATA[Teaser Image]]></item>
                <item name="wcf.acp.article.publicationDate"><![CDATA[Publication Date]]></item>
                <item name="wcf.acp.article.publicationDate.error.invalid"><![CDATA[The publication date is invalid.]]></item>
                <item name="wcf.acp.article.publicationStatus"><![CDATA[Status]]></item>
index 958f3950e1be5d929b2fb481b1a217314f09ae72..14679f2c773f2acddfe5f89ada7040ac78cfeecf 100644 (file)
@@ -180,6 +180,7 @@ CREATE TABLE wcf1_article_content (
        teaser TEXT,
        content MEDIUMTEXT,
        imageID INT(10),
+       teaserImageID INT(10),
        hasEmbeddedObjects TINYINT(1) NOT NULL DEFAULT 0,
        
        UNIQUE KEY (articleID, languageID)
@@ -1690,6 +1691,7 @@ ALTER TABLE wcf1_article ADD FOREIGN KEY (categoryID) REFERENCES wcf1_category (
 ALTER TABLE wcf1_article_content ADD FOREIGN KEY (articleID) REFERENCES wcf1_article (articleID) ON DELETE CASCADE;
 ALTER TABLE wcf1_article_content ADD FOREIGN KEY (languageID) REFERENCES wcf1_language (languageID) ON DELETE SET NULL;
 ALTER TABLE wcf1_article_content ADD FOREIGN KEY (imageID) REFERENCES wcf1_media (mediaID) ON DELETE SET NULL;
+ALTER TABLE wcf1_article_content ADD FOREIGN KEY (teaserImageID) REFERENCES wcf1_media (mediaID) ON DELETE SET NULL;
 
 ALTER TABLE wcf1_attachment ADD FOREIGN KEY (objectTypeID) REFERENCES wcf1_object_type (objectTypeID) ON DELETE CASCADE;
 ALTER TABLE wcf1_attachment ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE SET NULL;