Upload media to selected category on media list page in ACP
authorMatthias Schmidt <gravatronics@live.com>
Tue, 29 Aug 2017 14:43:42 +0000 (16:43 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 29 Aug 2017 14:43:42 +0000 (16:43 +0200)
See #2191

wcfsetup/install/files/acp/templates/mediaList.tpl
wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Media/List.js
wcfsetup/install/files/js/WoltLabSuite/Core/Media/List/Upload.js

index b5c1a00ecf8f31539a2ca75a60e0dea033c0513b..570749b7997c5346776c6901fbf89c5705f3bef9 100644 (file)
@@ -6,6 +6,9 @@
        require(['Language', 'WoltLabSuite/Core/Controller/Media/List'], function (Language, ControllerMediaList) {
                Language.add('wcf.media.delete.confirmMessage', '{lang __literal=true}wcf.media.delete.confirmMessage{/lang}')
                ControllerMediaList.init({
+                       {if $categoryID}
+                               categoryId: {@$categoryID},
+                       {/if}
                        hasMarkedItems: {if $hasMarkedItems}true{else}false{/if}
                });
        });
index cbf5a0aea516276d14d38d1e0982b2c329a707eb..f425bc7c6d315a58776901bcb66fda602dc4983c 100644 (file)
@@ -42,6 +42,7 @@ define([
                init: function(options) {
                        options = options || {};
                        new MediaListUpload('uploadButton', 'mediaListTableBody', {
+                               categoryId: options.categoryId,
                                multiple: true
                        });
                        
index 79412dbe69db325f4959fb59833f33a4d3fa6554..eb48dd6a2ad3ca87f5a9ad03e2ea58faab0d4908 100644 (file)
@@ -50,6 +50,19 @@ define(
                        var icon = elCreate('span');
                        icon.classList = 'icon icon16 fa-upload';
                        DomUtil.prepend(icon, elBySel('span', this._button));
+               },
+               
+               /**
+                * @see WoltLabSuite/Core/Upload#_getParameters
+                */
+               _getParameters: function() {
+                       if (this._options.categoryId) {
+                               return Core.extend(MediaListUpload._super.prototype._getParameters.call(this), {
+                                       categoryID: this._options.categoryId
+                               });
+                       }
+                       
+                       return MediaListUpload._super.prototype._getParameters.call(this);
                }
        });