Support for random order in article list boxes
authorAlexander Ebert <ebert@woltlab.com>
Mon, 9 Jul 2018 15:52:43 +0000 (17:52 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 9 Jul 2018 15:52:43 +0000 (17:52 +0200)
See #2592

wcfsetup/install/files/lib/system/box/ArticleListBoxController.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 86c7c8a45a12e44b77f47d918cc392ca2477f400..5816a6b4a73c2399e4fe987c1fbf4d4c28bd2c3e 100644 (file)
@@ -40,7 +40,8 @@ class ArticleListBoxController extends AbstractDatabaseObjectListBoxController {
        public $validSortFields = [
                'time',
                'comments',
-               'views'
+               'views',
+               'random'
        ];
        
        /**
@@ -69,6 +70,10 @@ class ArticleListBoxController extends AbstractDatabaseObjectListBoxController {
                                break;
                }
                
+               if ($this->sortField === 'random') {
+                       $this->sortField = 'RAND()';
+               }
+               
                return $objectList;
        }
        
index 2374b15c71cb72860fc50e6e37dc00fb1cfbbfe4..0cc4b527b83a3707f1dc298062b16c7d0e221ca6 100644 (file)
@@ -2342,6 +2342,7 @@ Benutzerkontos nun in vollem Umfang nutzen.]]></item>
                <item name="wcf.article.commentResponse"><![CDATA[Antwort auf Artikel-Kommentar]]></item>
                <item name="wcf.article.sortField.comments"><![CDATA[Kommentare]]></item>
                <item name="wcf.article.sortField.cumulativeLikes"><![CDATA[Likes]]></item>
+               <item name="wcf.article.sortField.random"><![CDATA[Zufällig]]></item>
                <item name="wcf.article.sortField.time"><![CDATA[Datum]]></item>
                <item name="wcf.article.sortField.views"><![CDATA[Zugriffe]]></item>
                <item name="wcf.article.markAllAsRead"><![CDATA[Alle Artikel als gelesen markieren]]></item>
index 577a961cc3e51441550e457b7c81d186bf685523..6c66d6e6f4f5cca99d20a1e30a16902e4e048af0 100644 (file)
@@ -2278,6 +2278,7 @@ full extend.]]></item>
                <item name="wcf.article.commentResponse"><![CDATA[Reply to Article Comment]]></item>
                <item name="wcf.article.sortField.comments"><![CDATA[Comments]]></item>
                <item name="wcf.article.sortField.cumulativeLikes"><![CDATA[Likes]]></item>
+               <item name="wcf.article.sortField.random"><![CDATA[Random]]></item>
                <item name="wcf.article.sortField.time"><![CDATA[Date]]></item>
                <item name="wcf.article.sortField.views"><![CDATA[Views]]></item>
                <item name="wcf.article.markAllAsRead"><![CDATA[Mark All Articles as Read]]></item>