Added publication status filter
authorMarcel Werk <burntime@woltlab.com>
Fri, 14 Oct 2016 14:59:41 +0000 (16:59 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 14 Oct 2016 14:59:41 +0000 (16:59 +0200)
wcfsetup/install/files/acp/templates/articleList.tpl
wcfsetup/install/files/lib/acp/page/ArticleListPage.class.php

index 64bb36f548b3f8d527cb11d7bad379f552c99f78..a846d58d232286c22bbff80acad3281d0fb12800 100644 (file)
                                </dd>
                        </dl>
                        
+                       <dl class="col-xs-12 col-md-4">
+                               <dt></dt>
+                               <dd>
+                                       <select name="publicationStatus" id="publicationStatus">
+                                               <option value="-1">{lang}wcf.acp.article.publicationStatus{/lang}</option>
+                                               
+                                               <option value="0"{if $publicationStatus == 0} selected{/if}>{lang}wcf.acp.article.publicationStatus.unpublished{/lang}</option>
+                                               <option value="1"{if $publicationStatus == 1} selected{/if}>{lang}wcf.acp.article.publicationStatus.published{/lang}</option>
+                                               <option value="2"{if $publicationStatus == 2} selected{/if}>{lang}wcf.acp.article.publicationStatus.delayed{/lang}</option>
+                                       </select>
+                               </dd>
+                       </dl>
+                       
                        {event name='filterFields'}
                </div>
                
                        {if $title}{capture append=linkParameters}&title={@$title|rawurlencode}{/capture}{/if}
                        {if $content}{capture append=linkParameters}&content={@$content|rawurlencode}{/capture}{/if}
                        {if $username}{capture append=linkParameters}&username={@$username|rawurlencode}{/capture}{/if}
+                       {if $publicationStatus != -1}{capture append=linkParameters}&publicationStatus={@$publicationStatus}{/capture}{/if}
                        
                        {pages print=true assign=pagesLinks controller="ArticleList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder$linkParameters"}
                {/content}
                                                                </span>
                                                                
                                                                <div class="containerHeadline">
-                                                                       <h3><a href="{link controller='ArticleEdit' id=$article->articleID}{/link}" title="{lang}wcf.acp.article.edit{/lang}" class="jsTooltip">{$article->title}</a></h3>
+                                                                       <h3>
+                                                                               {if $article->publicationStatus == 0}<span class="badge">{lang}wcf.acp.article.publicationStatus.unpublished{/lang}</span>{/if}
+                                                                               {if $article->publicationStatus == 2}<span class="badge" title="{$article->publicationDate|plainTime}">{lang}wcf.acp.article.publicationStatus.delayed{/lang}</span>{/if}
+                                                                               <a href="{link controller='ArticleEdit' id=$article->articleID}{/link}" title="{lang}wcf.acp.article.edit{/lang}" class="jsTooltip">{$article->title}</a>
+                                                                       </h3>
                                                                        <ul class="inlineList dotSeparated">
                                                                                {if $article->categoryID}
                                                                                        <li>{$article->getCategory()->getTitle()}</li>
index 244caa1ec5edd9a49fac5af7343e7cc572f295ee..e8977e34384d3b455410e1dea57f08f0372bf597 100644 (file)
@@ -92,6 +92,12 @@ class ArticleListPage extends SortablePage {
         */
        public $showArticleAddDialog = 0;
        
+       /**
+        * publication status filter
+        * @var integer
+        */
+       public $publicationStatus = -1;
+       
        /**
         * @inheritDoc
         */
@@ -103,6 +109,7 @@ class ArticleListPage extends SortablePage {
                if (!empty($_REQUEST['title'])) $this->title = StringUtil::trim($_REQUEST['title']);
                if (!empty($_REQUEST['content'])) $this->content = StringUtil::trim($_REQUEST['content']);
                if (!empty($_REQUEST['showArticleAddDialog'])) $this->showArticleAddDialog = 1;
+               if (isset($_REQUEST['publicationStatus'])) $this->publicationStatus = intval($_REQUEST['publicationStatus']);
        }
        
        /**
@@ -132,6 +139,10 @@ class ArticleListPage extends SortablePage {
                }
                
                $this->objectList->sqlSelects = "(SELECT title FROM wcf".WCF_N."_article_content WHERE articleID = article.articleID AND (languageID IS NULL OR languageID = ".WCF::getLanguage()->languageID.") LIMIT 1) AS title";
+               
+               if ($this->publicationStatus != -1) {
+                       $this->objectList->getConditionBuilder()->add('article.publicationStatus = ?', [$this->publicationStatus]);
+               }
        }
        
        /**
@@ -147,7 +158,8 @@ class ArticleListPage extends SortablePage {
                        'content' => $this->content,
                        'showArticleAddDialog' => $this->showArticleAddDialog,
                        'availableLanguages' => LanguageFactory::getInstance()->getLanguages(),
-                       'categoryNodeList' => (new CategoryNodeTree('com.woltlab.wcf.article.category'))->getIterator()
+                       'categoryNodeList' => (new CategoryNodeTree('com.woltlab.wcf.article.category'))->getIterator(),
+                       'publicationStatus' => $this->publicationStatus
                ]);
        }
 }