Added frontend links to article management
authorMarcel Werk <burntime@woltlab.com>
Thu, 9 Jun 2016 11:03:27 +0000 (13:03 +0200)
committerMarcel Werk <burntime@woltlab.com>
Thu, 9 Jun 2016 11:03:27 +0000 (13:03 +0200)
com.woltlab.wcf/templates/article.tpl
com.woltlab.wcf/templates/articleList.tpl
com.woltlab.wcf/templates/categoryArticleList.tpl
wcfsetup/install/files/acp/templates/articleAddDialog.tpl
wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php
wcfsetup/install/files/lib/acp/page/ArticleListPage.class.php

index 87a693b3568dc92e9ccc6e46dd35fecc0c4e89e3..3690468e939764d418a68aa63ee25b67eef5920d 100644 (file)
@@ -40,6 +40,7 @@
                        <nav class="contentHeaderNavigation">
                                <ul>
                                        {content}
+                                               {if $__wcf->getSession()->getPermission('admin.content.article.canManageArticle')}<li><a href="{link controller='ArticleEdit' id=$article->articleID isACP=true}{/link}" class="button"><span class="icon icon16 fa-pencil"></span> <span>{lang}wcf.acp.article.edit{/lang}</span></a></li>{/if}
                                                {event name='contentHeaderNavigation'}
                                        {/content}
                                </ul>
index a4313f597af4d7a7fe611926d4638cd3c723ca37..8f0a4a3ad9127ae9348b643a68e24a9082d23f5a 100644 (file)
        <li><a rel="alternate" href="{if $__wcf->getUser()->userID}{link controller='ArticleFeed' appendSession=false}at={@$__wcf->getUser()->userID}-{@$__wcf->getUser()->accessToken}{/link}{else}{link controller='ArticleFeed' appendSession=false}{/link}{/if}" title="{lang}wcf.global.button.rss{/lang}" class="jsTooltip"><span class="icon icon16 fa-rss"></span> <span class="invisible">{lang}wcf.global.button.rss{/lang}</span></a></li>
 {/capture}
 
+{if $__wcf->getSession()->getPermission('admin.content.article.canManageArticle')}
+       {capture assign='contentHeaderNavigation'}
+               <li><a href="{link controller='ArticleAdd' isACP=true}{/link}" class="button"><span class="icon icon16 fa-pencil"></span> <span>{lang}wcf.acp.article.add{/lang}</span></a></li>
+       {/capture}
+{/if}
+
 {include file='header'}
 
 {hascontent}
index a70db0d7217318eb25d62198b13542baffba76a7..822e49faffb18a5527450e3eb5df9d0aec52122e 100644 (file)
        <li><a rel="alternate" href="{if $__wcf->getUser()->userID}{link controller='ArticleFeed' id=$categoryID appendSession=false}at={@$__wcf->getUser()->userID}-{@$__wcf->getUser()->accessToken}{/link}{else}{link controller='ArticleFeed' id=$categoryID appendSession=false}{/link}{/if}" title="{lang}wcf.global.button.rss{/lang}" class="jsTooltip"><span class="icon icon16 fa-rss"></span> <span class="invisible">{lang}wcf.global.button.rss{/lang}</span></a></li>
 {/capture}
 
+{if $__wcf->getSession()->getPermission('admin.content.article.canManageArticle')}
+       {capture assign='contentHeaderNavigation'}
+               <li><a href="{link controller='ArticleAdd' isACP=true}categoryID={@$category->categoryID}{/link}" class="button"><span class="icon icon16 fa-pencil"></span> <span>{lang}wcf.acp.article.add{/lang}</span></a></li>
+       {/capture}
+{/if}
+
 {include file='header'}
 
 {hascontent}
index f8f8e61be0b18561fcafd46dccb415a612ad58dc..20d7d181835a51b13343a787404e76d4b6bc74ee 100644 (file)
@@ -17,7 +17,7 @@
 </div>
 <script data-relocate="true">
        require(['WoltLab/WCF/Acp/Ui/Article/Add'], function(AcpUiArticleAdd) {
-               AcpUiArticleAdd.init('{link controller='ArticleAdd' encode=false}{literal}isMultilingual={$isMultilingual}{/literal}{/link}');
+               AcpUiArticleAdd.init('{link controller='ArticleAdd' encode=false}{literal}isMultilingual={$isMultilingual}{/literal}{if $categoryID}&categoryID={@$categoryID}{/if}{/link}');
                
                {if $showArticleAddDialog}
                        window.setTimeout(function() {
index 604e471b0ef355374a10b2edb8fa5ba629511c79..383eea327734f94e67bf1801fc4e5db5a0a278f4 100644 (file)
@@ -152,6 +152,8 @@ class ArticleAddForm extends AbstractForm {
        public function readParameters() {
                parent::readParameters();
                
+               if (isset($_REQUEST['categoryID'])) $this->categoryID = intval($_REQUEST['categoryID']);
+               
                $this->readMultilingualSetting();
                
                // get available languages
@@ -166,7 +168,9 @@ class ArticleAddForm extends AbstractForm {
                
                // work-around to force adding article via dialog overlay
                if (empty($_POST) && !isset($_REQUEST['isMultilingual'])) {
-                       HeaderUtil::redirect(LinkHandler::getInstance()->getLink('ArticleList', ['showArticleAddDialog' => 1]));
+                       $parameters = ['showArticleAddDialog' => 1];
+                       if ($this->categoryID) $parameters['categoryID'] = $this->categoryID;
+                       HeaderUtil::redirect(LinkHandler::getInstance()->getLink('ArticleList', $parameters));
                        exit;
                }
        }
@@ -178,7 +182,6 @@ class ArticleAddForm extends AbstractForm {
                parent::readFormParameters();
                
                $this->enableComments = 0;
-               if (isset($_POST['categoryID'])) $this->categoryID = intval($_POST['categoryID']);
                if (isset($_POST['username'])) $this->username = StringUtil::trim($_POST['username']);
                if (isset($_POST['time'])) {
                        $this->time = $_POST['time'];
index 933be5b8454eb24669e17b450c09be4664fd246f..0508f34250d6e32519d85d794e07222e74242bec 100644 (file)
@@ -93,7 +93,7 @@ class ArticleListPage extends SortablePage {
        public function readParameters() {
                parent::readParameters();
                
-               if (isset($_POST['categoryID'])) $this->categoryID = intval($_POST['categoryID']);
+               if (isset($_REQUEST['categoryID'])) $this->categoryID = intval($_REQUEST['categoryID']);
                if (!empty($_REQUEST['username'])) $this->username = StringUtil::trim($_REQUEST['username']);
                if (!empty($_REQUEST['title'])) $this->title = StringUtil::trim($_REQUEST['title']);
                if (!empty($_REQUEST['content'])) $this->content = StringUtil::trim($_REQUEST['content']);