From: Matthias Schmidt Date: Sun, 16 Sep 2018 16:32:36 +0000 (+0200) Subject: Add html support for media caption X-Git-Tag: 5.2.0_Alpha_1~364^2~28 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6c4046be8ae32649147232eec26d625f64acd8e6;p=GitHub%2FWoltLab%2FWCF.git Add html support for media caption Close #2722 --- diff --git a/com.woltlab.wcf/templates/mediaBBCodeTag.tpl b/com.woltlab.wcf/templates/mediaBBCodeTag.tpl index e80ee2c1ed..ac0fc85d24 100644 --- a/com.woltlab.wcf/templates/mediaBBCodeTag.tpl +++ b/com.woltlab.wcf/templates/mediaBBCodeTag.tpl @@ -1,4 +1,4 @@ - +
{if $thumbnailSize != 'original'} {$media->altText} {else} @@ -6,6 +6,12 @@ {/if} {if $media->caption} - {$media->caption} +
+ {if $media->captionEnableHtml} + {@$media->caption} + {else} + {$media->caption} + {/if} +
{/if} - +
diff --git a/com.woltlab.wcf/templates/mediaEditor.tpl b/com.woltlab.wcf/templates/mediaEditor.tpl index 490dba1730..e6ffc7cfcb 100644 --- a/com.woltlab.wcf/templates/mediaEditor.tpl +++ b/com.woltlab.wcf/templates/mediaEditor.tpl @@ -102,7 +102,17 @@ {if $availableLanguages|count > 1} {include file='multipleLanguageInputJavascript' elementIdentifier='caption'|concat:'_':$media->mediaID forceSelection=true} {/if} - + +
+
+
+ +
+
+
diff --git a/wcfsetup/install/files/acp/templates/mediaBBCodeTag.tpl b/wcfsetup/install/files/acp/templates/mediaBBCodeTag.tpl index e80ee2c1ed..ac0fc85d24 100644 --- a/wcfsetup/install/files/acp/templates/mediaBBCodeTag.tpl +++ b/wcfsetup/install/files/acp/templates/mediaBBCodeTag.tpl @@ -1,4 +1,4 @@ - +
{if $thumbnailSize != 'original'} {$media->altText} {else} @@ -6,6 +6,12 @@ {/if} {if $media->caption} - {$media->caption} +
+ {if $media->captionEnableHtml} + {@$media->caption} + {else} + {$media->caption} + {/if} +
{/if} - +
diff --git a/wcfsetup/install/files/acp/templates/mediaEditor.tpl b/wcfsetup/install/files/acp/templates/mediaEditor.tpl index e5ad67186f..e6ffc7cfcb 100644 --- a/wcfsetup/install/files/acp/templates/mediaEditor.tpl +++ b/wcfsetup/install/files/acp/templates/mediaEditor.tpl @@ -103,6 +103,16 @@ {include file='multipleLanguageInputJavascript' elementIdentifier='caption'|concat:'_':$media->mediaID forceSelection=true} {/if} +
+
+
+ +
+
+
diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Editor.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Editor.js index a68e567157..0d8d629b9b 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Editor.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Editor.js @@ -120,6 +120,7 @@ define( var categoryId = elBySel('select[name=categoryID]', content); var altText = elBySel('input[name=altText]', content); var caption = elBySel('textarea[name=caption]', content); + var captionEnableHtml = elBySel('input[name=captionEnableHtml]', content); var title = elBySel('input[name=title]', content); var hasError = false; @@ -190,6 +191,9 @@ define( this._media.title[this._media.languageID] = title.value; } + // captionEnableHtml + this._media.captionEnableHtml = ~~elBySel('input[name=captionEnableHtml]', content).checked; + var aclValues = { allowAll: ~~elById('mediaEditor_' + this._media.mediaID + '_aclAllowAll').checked, group: [], @@ -219,6 +223,7 @@ define( altText: this._media.altText, caption: this._media.caption, data: { + captionEnableHtml: this._media.captionEnableHtml, categoryID: this._media.categoryID, isMultilingual: this._media.isMultilingual, languageID: this._media.languageID diff --git a/wcfsetup/install/files/lib/data/media/Media.class.php b/wcfsetup/install/files/lib/data/media/Media.class.php index 9ba7c42083..a622c2444b 100644 --- a/wcfsetup/install/files/lib/data/media/Media.class.php +++ b/wcfsetup/install/files/lib/data/media/Media.class.php @@ -28,6 +28,7 @@ use wcf\system\WCF; * @property-read string $username name of the user who uploaded the media file * @property-read integer|null $languageID id of the language associated with the media file or null if the media file is multilingual or if the language has been deleted * @property-read integer $isMultilingual is `1` if the media file's title, description and altText is available in multiple languages, otherwise `0` + * @property-read integer $captionEnableHtml is `1` if html code in caption is supported, otherwise `0` * @property-read integer $isImage is `1` if the media file is an image, otherwise `0` * @property-read integer $width width of the media file if `$isImage` is `1`, otherwise `0` * @property-read integer $height height of the media file if `$isImage` is `1`, otherwise `0` diff --git a/wcfsetup/install/files/lib/data/media/MediaAction.class.php b/wcfsetup/install/files/lib/data/media/MediaAction.class.php index a0090eaed0..d8b63d9209 100644 --- a/wcfsetup/install/files/lib/data/media/MediaAction.class.php +++ b/wcfsetup/install/files/lib/data/media/MediaAction.class.php @@ -145,6 +145,7 @@ class MediaAction extends AbstractDatabaseObjectAction implements ISearchAction, return [ 'altText' => $media instanceof ViewableMedia ? $media->altText : [], 'caption' => $media instanceof ViewableMedia ? $media->caption : [], + 'captionEnableHtml' => $media->captionEnableHtml, 'categoryID' => $media->categoryID, 'fileHash' => $media->fileHash, 'filename' => $media->filename, diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 265cbff11a..864924ea3d 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -3189,6 +3189,7 @@ E-Mail-Adresse: {@$emailAddress} {* this line ends with a space *} + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index e61b8b15e5..8c2d28da68 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -3136,6 +3136,7 @@ Email: {@$emailAddress} {* this line ends with a space *} + diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index 37e19ac6a1..b8b6ed5786 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -667,6 +667,7 @@ CREATE TABLE wcf1_media ( username VARCHAR(255) NOT NULL, languageID INT(10), isMultilingual TINYINT(1) NOT NULL DEFAULT 0, + captionEnableHtml TINYINT(1) NOT NULL DEFAULT 0, isImage TINYINT(1) NOT NULL DEFAULT 0, width SMALLINT(5) NOT NULL DEFAULT 0,