Add confirm message for media file deletion
authorMatthias Schmidt <gravatronics@live.com>
Sun, 21 Aug 2016 10:23:24 +0000 (12:23 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 21 Aug 2016 10:23:26 +0000 (12:23 +0200)
com.woltlab.wcf/templates/mediaJavaScript.tpl
com.woltlab.wcf/templates/mediaListItems.tpl
wcfsetup/install/files/acp/templates/mediaJavaScript.tpl
wcfsetup/install/files/acp/templates/mediaList.tpl
wcfsetup/install/files/acp/templates/mediaListItems.tpl
wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js
wcfsetup/install/lang/en.xml

index c929e711be5ba473cdc32d3bd57e4be2a0a7aaa3..79e1988353d9f882bdaccf3cdcb3c853cf106f80 100644 (file)
@@ -3,7 +3,7 @@
                Language.addObject({
                        'wcf.global.button.insert': '{lang}wcf.global.button.insert{/lang}',
                        
-                       'wcf.media.delete.confirmMessage': '{lang __encode=true}wcf.media.delete.confirmMessage{/lang}',
+                       'wcf.media.delete.confirmMessage': '{lang __encode=true __literal=true}wcf.media.delete.confirmMessage{/lang}',
                        'wcf.media.insert': '{lang}wcf.media.insert{/lang}',
                        'wcf.media.insert.imageSize': '{lang}wcf.media.insert.imageSize{/lang}',
                        'wcf.media.insert.imageSize.small': '{lang}wcf.media.insert.imageSize.small{/lang}',
index 70e06b7153a2ecfa6efb7663c361e0e91ad5dada..95fe0041b0eb27f1b4059ef980455779b58b72bc 100644 (file)
@@ -3,11 +3,15 @@
                <div class="mediaThumbnail">
                        {@$media->getElementTag(144)}
                </div>
-               
+
+               {assign var='__mediaTitle' value=$media->filename}
+               {if $media->title}
+                       {assign var='__mediaTitle' value=$media->title}
+               {/if}
                <div class="mediaInformation">
-                       <p class="mediaTitle">{if $media->title}{$media->title}{else}{$media->filename}{/if}</p>
+                       <p class="mediaTitle">{$__mediaTitle}</p>
                </div>
-               
+
                <nav class="jsMobileNavigation buttonGroupNavigation">
                        <ul class="buttonList iconList">
                                <li class="mediaCheckbox">
@@ -17,7 +21,7 @@
                                        <li class="jsMediaEditButton" data-object-id="{@$media->mediaID}">
                                                <a><span class="icon icon16 fa-pencil jsTooltip" title="{lang}wcf.global.button.edit{/lang}"></span> <span class="invisible">{lang}wcf.global.button.edit{/lang}</span></a>
                                        </li>
-                                       <li class="jsDeleteButton" data-object-id="{@$media->mediaID}" data-confirm-message-html="{lang __encode=true}wcf.media.delete.confirmMessage{/lang}">
+                                       <li class="jsDeleteButton" data-object-id="{@$media->mediaID}" data-confirm-message-html="{lang title=$__mediaTitle __encode=true}wcf.media.delete.confirmMessage{/lang}">
                                                <a><span class="icon icon16 fa-times jsTooltip" title="{lang}wcf.global.button.delete{/lang}"></span> <span class="invisible">{lang}wcf.global.button.delete{/lang}</span></a>
                                        </li>
                                {/if}
index c929e711be5ba473cdc32d3bd57e4be2a0a7aaa3..79e1988353d9f882bdaccf3cdcb3c853cf106f80 100644 (file)
@@ -3,7 +3,7 @@
                Language.addObject({
                        'wcf.global.button.insert': '{lang}wcf.global.button.insert{/lang}',
                        
-                       'wcf.media.delete.confirmMessage': '{lang __encode=true}wcf.media.delete.confirmMessage{/lang}',
+                       'wcf.media.delete.confirmMessage': '{lang __encode=true __literal=true}wcf.media.delete.confirmMessage{/lang}',
                        'wcf.media.insert': '{lang}wcf.media.insert{/lang}',
                        'wcf.media.insert.imageSize': '{lang}wcf.media.insert.imageSize{/lang}',
                        'wcf.media.insert.imageSize.small': '{lang}wcf.media.insert.imageSize.small{/lang}',
index 25c6bb2dd385d874dddc29ba2f079ddb56d01fc9..fc8d748f9b4eab1f7020f6fbea49014a90df106e 100644 (file)
                                                <td class="columnMark"><input type="checkbox" class="jsClipboardItem" data-object-id="{@$media->mediaID}"></td>
                                                <td class="columnIcon">
                                                        <a href="{link controller='MediaEdit' object=$media}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon24 fa-pencil"></span></a>
-                                                       <span class="icon icon24 fa-times jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$media->mediaID}" data-confirm-message="{lang}wcf.media.delete.confirmMessage{/lang}"></span>
+                                                       <span class="icon icon24 fa-times jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$media->mediaID}" data-confirm-message-html="{lang title=$media->filename __encode=true}wcf.media.delete.confirmMessage{/lang}"></span>
                                                        
                                                        {event name='rowButtons'}
                                                </td>
index 70e06b7153a2ecfa6efb7663c361e0e91ad5dada..95fe0041b0eb27f1b4059ef980455779b58b72bc 100644 (file)
@@ -3,11 +3,15 @@
                <div class="mediaThumbnail">
                        {@$media->getElementTag(144)}
                </div>
-               
+
+               {assign var='__mediaTitle' value=$media->filename}
+               {if $media->title}
+                       {assign var='__mediaTitle' value=$media->title}
+               {/if}
                <div class="mediaInformation">
-                       <p class="mediaTitle">{if $media->title}{$media->title}{else}{$media->filename}{/if}</p>
+                       <p class="mediaTitle">{$__mediaTitle}</p>
                </div>
-               
+
                <nav class="jsMobileNavigation buttonGroupNavigation">
                        <ul class="buttonList iconList">
                                <li class="mediaCheckbox">
@@ -17,7 +21,7 @@
                                        <li class="jsMediaEditButton" data-object-id="{@$media->mediaID}">
                                                <a><span class="icon icon16 fa-pencil jsTooltip" title="{lang}wcf.global.button.edit{/lang}"></span> <span class="invisible">{lang}wcf.global.button.edit{/lang}</span></a>
                                        </li>
-                                       <li class="jsDeleteButton" data-object-id="{@$media->mediaID}" data-confirm-message-html="{lang __encode=true}wcf.media.delete.confirmMessage{/lang}">
+                                       <li class="jsDeleteButton" data-object-id="{@$media->mediaID}" data-confirm-message-html="{lang title=$__mediaTitle __encode=true}wcf.media.delete.confirmMessage{/lang}">
                                                <a><span class="icon icon16 fa-times jsTooltip" title="{lang}wcf.global.button.delete{/lang}"></span> <span class="invisible">{lang}wcf.global.button.delete{/lang}</span></a>
                                        </li>
                                {/if}
index 995733bab389cbb702d33c8f5a6fb53e78f388ac..895fc727da512eb9202f55f119bb65660d4700a2 100644 (file)
@@ -11,13 +11,13 @@ define(
                'Core',                     'Dictionary',               'Dom/ChangeListener',              'Dom/Traverse',
                'Dom/Util',                 'EventHandler',             'Language',                        'List',
                'Permission',               'Ui/Dialog',                'Ui/Notification',                 'WoltLabSuite/Core/Controller/Clipboard',
-               'WoltLabSuite/Core/Media/Editor', 'WoltLabSuite/Core/Media/Upload', 'WoltLabSuite/Core/Media/Manager/Search'
+               'WoltLabSuite/Core/Media/Editor', 'WoltLabSuite/Core/Media/Upload', 'WoltLabSuite/Core/Media/Manager/Search', 'StringUtil'
        ],
        function(
                Core,                        Dictionary,                 DomChangeListener,                 DomTraverse,
                DomUtil,                     EventHandler,               Language,                          List,
                Permission,                  UiDialog,                   UiNotification,                    Clipboard,
-               MediaEditor,                 MediaUpload,                MediaManagerSearch
+               MediaEditor,                 MediaUpload,                MediaManagerSearch,                StringUtil
        )
 {
        "use strict";
@@ -440,7 +440,12 @@ define(
                                listItem = elCreate('li');
                                listItem.className = 'jsDeleteButton';
                                elData(listItem, 'object-id', media.mediaID);
-                               elData(listItem, 'confirm-message-html', Language.get('wcf.media.delete.confirmMessage'));
+                               
+                               // use temporary title to not unescape html in filename
+                               var uuid = Core.getUuid();
+                               elData(listItem, 'confirm-message-html', StringUtil.unescapeHTML(Language.get('wcf.media.delete.confirmMessage', {
+                                       title: uuid
+                               })).replace(uuid, StringUtil.escapeHTML(media.filename)));
                                buttons.appendChild(listItem);
                                
                                listItem.innerHTML = '<a><span class="icon icon16 fa-times jsTooltip" title="' + Language.get('wcf.global.button.delete') + '"></span> <span class="invisible">' + Language.get('wcf.global.button.delete') + '</span></a>';
index ae7bce186e48c4664e41d92583225cc52d08b752..eeccc7d101248b7a45c44717d8d7b1b27d9b29a2 100644 (file)
@@ -2472,6 +2472,7 @@ Errors are:
                <item name="wcf.media.altText"><![CDATA[Alternate Text]]></item>
                <item name="wcf.media.button.insert"><![CDATA[Insert]]></item>
                <item name="wcf.media.caption"><![CDATA[Caption]]></item>
+               <item name="wcf.media.delete.confirmMessage"><![CDATA[Do you really want to delete the media file <span class="confirmationObject">{$title}</span>?]]></item>
                <item name="wcf.media.edit"><![CDATA[Edit Media File]]></item>
                <item name="wcf.media.filename"><![CDATA[Filename]]></item>
                <item name="wcf.media.filesize"><![CDATA[Filesize]]></item>