{include file='header' pageTitle='wcf.acp.media.list'}
+<script data-relocate="true">
+ require(['EventHandler', 'WoltLab/WCF/Controller/Clipboard'], function(EventHandler, Clipboard) {
+ Clipboard.setup({
+ hasMarkedItems: {if $hasMarkedItems}true{else}false{/if},
+ pageClassName: 'wcf\\acp\\page\\MediaListPage'
+ });
+
+ EventHandler.add('com.woltlab.wcf.clipboard', 'com.woltlab.wcf.media', function(actionData) {
+ // only consider events if the action has been executed
+ if (actionData.responseData === null) {
+ return;
+ }
+
+ if (actionData.data.actionName === 'com.woltlab.wcf.media.delete') {
+ var mediaIds = actionData.responseData.objectIDs;
+
+ var mediaRows = elByClass('jsMediaRow');
+ for (var i = 0; i < mediaRows.length; i++) {
+ var media = mediaRows[i];
+ var mediaID = ~~elData(elByClass('jsClipboardItem', media)[0], 'object-id');
+
+ if (mediaIds.indexOf(mediaID) !== -1) {
+ elRemove(media);
+ i--;
+ }
+ }
+
+ if (!mediaRows.length) {
+ window.location.reload();
+ }
+ }
+ });
+
+ new WCF.Action.Delete('wcf\\data\\media\\MediaAction', '.jsMediaRow');
+ });
+</script>
+
<header class="boxHeadline">
<h1>{lang}wcf.acp.media.list{/lang}</h1>
<p>{lang}wcf.acp.media.stats{/lang}</p>
<h2>{lang}wcf.acp.media.list{/lang} <span class="badge badgeInverse">{#$items}</span></h2>
</header>
- <table class="table">
+ <table class="table jsClipboardContainer" data-type="com.woltlab.wcf.media">
<thead>
<tr>
+ <th class="columnMark"><label><input type="checkbox" class="jsClipboardMarkAll" /></label></th>
<th class="columnID columnMediaID{if $sortField == 'mediaID'} active {@$sortOrder}{/if}" colspan="2"><a href="{link controller='MediaList'}pageNo={@$pageNo}&sortField=mediaID&sortOrder={if $sortField == 'mediaID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
<th class="columnTitle columnFilename{if $sortField == 'filename'} active {@$sortOrder}{/if}"><a href="{link controller='MediaList'}pageNo={@$pageNo}&sortField=filename&sortOrder={if $sortField == 'filename' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.media.filename{/lang}</a></th>
<th class="columnDate columnUploadTime{if $sortField == 'uploadTime'} active {@$sortOrder}{/if}"><a href="{link controller='MediaList'}pageNo={@$pageNo}&sortField=uploadTime&sortOrder={if $sortField == 'uploadTime' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.media.uploadTime{/lang}</a></th>
<tbody>
{foreach from=$objects item=media}
- <tr class="jsMediaRow">
+ <tr class="jsMediaRow jsClipboardObject">
+ <td class="columnMark"><input type="checkbox" class="jsClipboardItem" data-object-id="{@$media->mediaID}" /></td>
<td class="columnIcon">
- <span class="icon icon16 fa-times jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$media->media}" data-confirm-message="{lang}wcf.media.delete.confirmMessage{/lang}"></span>
+ <span class="icon icon16 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>
{event name='rowButtons'}
</td>
{event name='contentNavigationButtonsBottom'}
</ul>
</nav>
+
+ <nav class="jsClipboardEditor" data-types="[ 'com.woltlab.wcf.media' ]"></nav>
</div>
{else}
<p class="info">{lang}wcf.global.noItems{/lang}</p>
namespace wcf\acp\page;
use wcf\data\media\ViewableMediaList;
use wcf\page\SortablePage;
+use wcf\system\clipboard\ClipboardHandler;
+use wcf\system\WCF;
/**
* Shows the list of media entries.
*/
class MediaListPage extends SortablePage {
/**
- * @inheritdoc
+ * @inheritDoc
*/
public $activeMenuItem = 'wcf.acp.menu.link.media.list';
/**
- * @inheritdoc
+ * @inheritDoc
*/
public $defaultSortField = 'uploadTime';
/**
- * @inheritdoc
+ * @inheritDoc
*/
public $defaultSortOrder = 'DESC';
/**
- * @inheritdoc
+ * @inheritDoc
*/
public $neededPermissions = ['admin.content.cms.canManageMedia'];
/**
- * @inheritdoc
+ * @inheritDoc
*/
public $objectListClassName = ViewableMediaList::class;
/**
- * @inheritdoc
+ * @inheritDoc
*/
public $validSortFields = [
'filename',
];
/**
- * @inheritdoc
+ * @inheritDoc
+ */
+ public function assignVariables() {
+ parent::assignVariables();
+
+ WCF::getTPL()->assign('hasMarkedItems', ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.media')));
+ }
+
+ /**
+ * @inheritDoc
*/
protected function readObjects() {
if ($this->sqlOrderBy && $this->sortField == 'mediaID') {