From 5cd59148c63da6a7e73a88eb78f7dd4d83fd6943 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Mon, 5 Dec 2016 13:45:42 +0100 Subject: [PATCH] Added option to search or filter the media list by title --- wcfsetup/install/files/acp/templates/mediaList.tpl | 6 ++++-- .../files/lib/acp/page/MediaListPage.class.php | 14 +++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/mediaList.tpl b/wcfsetup/install/files/acp/templates/mediaList.tpl index ce64f7c863..381d8f8480 100644 --- a/wcfsetup/install/files/acp/templates/mediaList.tpl +++ b/wcfsetup/install/files/acp/templates/mediaList.tpl @@ -37,7 +37,7 @@
- +
@@ -63,7 +63,7 @@ {content} {assign var='linkParameters' value=''} {if $username}{capture append=linkParameters}&username={@$username|rawurlencode}{/capture}{/if} - {if $filename}{capture append=linkParameters}&filename={@$filename|rawurlencode}{/capture}{/if} + {if $q}{capture append=linkParameters}&q={@$q|rawurlencode}{/capture}{/if} {pages print=true assign=pagesLinks controller="MediaList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder$linkParameters"} {/content} @@ -78,6 +78,7 @@ {lang}wcf.global.objectID{/lang} {lang}wcf.media.filename{/lang} + {lang}wcf.global.title{/lang} {lang}wcf.media.uploadTime{/lang} {lang}wcf.media.filesize{/lang} @@ -106,6 +107,7 @@ + {$media->title|tableWordwrap} {@$media->uploadTime|time} {@$media->filesize|filesize} diff --git a/wcfsetup/install/files/lib/acp/page/MediaListPage.class.php b/wcfsetup/install/files/lib/acp/page/MediaListPage.class.php index 1ea6f830c3..fe8994be4b 100644 --- a/wcfsetup/install/files/lib/acp/page/MediaListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/MediaListPage.class.php @@ -35,10 +35,10 @@ class MediaListPage extends SortablePage { public $defaultSortOrder = 'DESC'; /** - * searched media filename + * searched media query * @var string */ - public $filename = ''; + public $query = ''; /** * @inheritDoc @@ -79,7 +79,7 @@ class MediaListPage extends SortablePage { parent::assignVariables(); WCF::getTPL()->assign([ - 'filename' => $this->filename, + 'q' => $this->query, 'hasMarkedItems' => ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.media')), 'username' => $this->username ]); @@ -91,8 +91,8 @@ class MediaListPage extends SortablePage { protected function initObjectList() { parent::initObjectList(); - if ($this->filename) { - $this->objectList->addSearchConditions($this->filename); + if ($this->query) { + $this->objectList->addSearchConditions($this->query); } if ($this->username) { $this->objectList->getConditionBuilder()->add('media.username LIKE ?', ['%'.addcslashes($this->username, '_%').'%']); @@ -105,13 +105,13 @@ class MediaListPage extends SortablePage { public function readParameters() { parent::readParameters(); - if (isset($_REQUEST['filename'])) $this->filename = StringUtil::trim($_REQUEST['filename']); + if (isset($_REQUEST['q'])) $this->query = StringUtil::trim($_REQUEST['q']); if (isset($_REQUEST['username'])) $this->username = StringUtil::trim($_REQUEST['username']); $parameters = []; if ($this->sortField) $parameters['sortField'] = $this->sortField; if ($this->sortOrder) $parameters['sortOrder'] = $this->sortOrder; - if ($this->filename) $parameters['filename'] = $this->filename; + if ($this->query) $parameters['q'] = $this->query; if ($this->username) $parameters['username'] = $this->username; $this->canonicalURL = LinkHandler::getInstance()->getLink('MediaList', $parameters); -- 2.20.1