Support filtering media list in ACP for media with no category
authorMatthias Schmidt <gravatronics@live.com>
Fri, 18 Jun 2021 06:29:29 +0000 (08:29 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Fri, 18 Jun 2021 06:29:29 +0000 (08:29 +0200)
wcfsetup/install/files/acp/templates/mediaList.tpl
wcfsetup/install/files/lib/acp/page/MediaListPage.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index ea0e64ee3b24680a187da355d2781cf3ec634164..d00149abb98640b73d9d867346a4e142fc192ee8 100644 (file)
@@ -45,6 +45,9 @@
                                        <dd>
                                                <select id="categoryID" name="categoryID">
                                                        <option value="0">{lang}wcf.media.category.choose{/lang}</option>
+                                                       <option value="-1"{if $categoryID == -1} selected="selected"{/if}>
+                                                               {lang}wcf.media.category.choose.noCategory{/lang}
+                                                       </option>
                                                        
                                                        {content}
                                                                {foreach from=$categoryList item=categoryItem}
index b6de85bda1619ac1f6a39ea6d4065f75b7f9ec44..5343be813a52c9548f05fd229380d4afaa58ed46 100644 (file)
@@ -118,7 +118,11 @@ class MediaListPage extends SortablePage
         }
 
         if ($this->categoryID) {
-            $this->objectList->getConditionBuilder()->add('media.categoryID = ?', [$this->categoryID]);
+            if ($this->categoryID === -1) {
+                $this->objectList->getConditionBuilder()->add('media.categoryID IS NULL');
+            } else {
+                $this->objectList->getConditionBuilder()->add('media.categoryID = ?', [$this->categoryID]);
+            }
         }
         if ($this->query) {
             $this->objectList->addSearchConditions($this->query);
index 1b7d833acd514d6a9e5dd49e85b070081353cb4f..8f4e8bf9f49a74794da8e26c26bd95ed3436479b 100644 (file)
@@ -4141,6 +4141,7 @@ Dateianhänge:
                <item name="wcf.media.caption"><![CDATA[Bildunterschrift]]></item>
                <item name="wcf.media.caption.enableHtml"><![CDATA[HTML in der Bildunterschrift verwenden]]></item>
                <item name="wcf.media.category.choose"><![CDATA[Kategorien]]></item>
+               <item name="wcf.media.category.choose.noCategory"><![CDATA[(keine Kategorie)]]></item>
                <item name="wcf.media.categoryID"><![CDATA[Kategorie]]></item>
                <item name="wcf.media.chooseFile"><![CDATA[Datei auswählen]]></item>
                <item name="wcf.media.chooseImage"><![CDATA[Bild auswählen]]></item>
index e12750951c48da9aa421d36d655d81136ba92a37..0eaa25bc1cda650502c2f184013592cc3d092123 100644 (file)
@@ -4088,6 +4088,7 @@ Attachments:
                <item name="wcf.media.caption"><![CDATA[Caption]]></item>
                <item name="wcf.media.caption.enableHtml"><![CDATA[Enable HTML code in caption]]></item>
                <item name="wcf.media.category.choose"><![CDATA[Categories]]></item>
+               <item name="wcf.media.category.choose.noCategory"><![CDATA[(no category)]]></item>
                <item name="wcf.media.categoryID"><![CDATA[Category]]></item>
                <item name="wcf.media.chooseFile"><![CDATA[Select File]]></item>
                <item name="wcf.media.chooseImage"><![CDATA[Select Image]]></item>