From a5a4f02d546886aaec7e31b03918f46deb341f4d Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Mon, 6 Jun 2016 17:02:45 +0200 Subject: [PATCH] Added article system --- com.woltlab.wcf/aclOption.xml | 4 + com.woltlab.wcf/acpMenu.xml | 41 +- com.woltlab.wcf/menuItem.xml | 6 + com.woltlab.wcf/objectType.xml | 29 ++ com.woltlab.wcf/option.xml | 57 ++- com.woltlab.wcf/page.xml | 34 ++ com.woltlab.wcf/templates/article.tpl | 276 ++++++++++++ com.woltlab.wcf/templates/articleList.tpl | 54 +++ .../templates/articleListItems.tpl | 46 ++ .../templates/categoryArticleList.tpl | 58 +++ com.woltlab.wcf/templates/header.tpl | 4 + com.woltlab.wcf/templates/membersList.tpl | 2 +- com.woltlab.wcf/userGroupOption.xml | 67 +++ constants.php | 7 + .../files/acp/templates/articleAdd.tpl | 380 +++++++++++++++++ .../files/acp/templates/articleAddDialog.tpl | 28 ++ .../files/acp/templates/articleList.tpl | 188 +++++++++ .../install/files/acp/templates/boxAdd.tpl | 2 +- .../install/files/acp/templates/pageList.tpl | 2 + .../install/files/images/placeholderTiny.png | Bin 0 -> 521 bytes .../js/WoltLab/WCF/Acp/Ui/Article/Add.js | 63 +++ .../files/js/WoltLab/WCF/Ui/Like/Handler.js | 14 +- .../lib/acp/form/ArticleAddForm.class.php | 396 ++++++++++++++++++ .../acp/form/ArticleCategoryAddForm.class.php | 30 ++ .../form/ArticleCategoryEditForm.class.php | 30 ++ .../lib/acp/form/ArticleEditForm.class.php | 170 ++++++++ .../page/ArticleCategoryListPage.class.php | 30 ++ .../lib/acp/page/ArticleListPage.class.php | 142 +++++++ .../article/AccessibleArticleList.class.php | 33 ++ .../files/lib/data/article/Article.class.php | 220 ++++++++++ .../lib/data/article/ArticleAction.class.php | 125 ++++++ .../lib/data/article/ArticleEditor.class.php | 24 ++ .../lib/data/article/ArticleList.class.php | 26 ++ .../article/CategoryArticleList.class.php | 45 ++ .../lib/data/article/FeedArticle.class.php | 95 +++++ .../data/article/FeedArticleList.class.php | 38 ++ .../data/article/LikeableArticle.class.php | 85 ++++ .../article/LikeableArticleProvider.class.php | 85 ++++ .../data/article/TaggedArticleList.class.php | 28 ++ .../data/article/ViewableArticle.class.php | 82 ++++ .../article/ViewableArticleList.class.php | 66 +++ .../category/ArticleCategory.class.php | 120 ++++++ .../article/content/ArticleContent.class.php | 115 +++++ .../content/ArticleContentAction.class.php | 24 ++ .../content/ArticleContentEditor.class.php | 24 ++ .../content/ArticleContentList.class.php | 26 ++ .../content/ViewableArticleContent.class.php | 70 ++++ .../ViewableArticleContentList.class.php | 49 +++ .../lib/data/category/CategoryNode.class.php | 17 + .../lib/data/media/ViewableMedia.class.php | 8 +- .../data/media/ViewableMediaList.class.php | 2 +- .../files/lib/data/page/Page.class.php | 2 +- .../files/lib/page/AbstractPage.class.php | 3 +- .../files/lib/page/ArticleFeedPage.class.php | 70 ++++ .../files/lib/page/ArticleListPage.class.php | 46 ++ .../files/lib/page/ArticlePage.class.php | 277 ++++++++++++ .../page/CategoryArticleListPage.class.php | 95 +++++ .../lib/page/UsersOnlineListPage.class.php | 10 +- .../ViewableArticleRuntimeCache.class.php | 26 ++ .../category/ArticleCategoryType.class.php | 55 +++ .../manager/ArticleCommentManager.class.php | 98 +++++ .../page/handler/ArticlePageHandler.class.php | 76 ++++ .../CategoryArticleListPageHandler.class.php | 71 ++++ .../system/tagging/TaggableArticle.class.php | 31 ++ wcfsetup/install/files/style/ui/article.scss | 271 ++++++++++++ wcfsetup/setup/db/install.sql | 39 ++ 66 files changed, 4710 insertions(+), 27 deletions(-) create mode 100644 com.woltlab.wcf/templates/article.tpl create mode 100644 com.woltlab.wcf/templates/articleList.tpl create mode 100644 com.woltlab.wcf/templates/articleListItems.tpl create mode 100644 com.woltlab.wcf/templates/categoryArticleList.tpl create mode 100644 wcfsetup/install/files/acp/templates/articleAdd.tpl create mode 100644 wcfsetup/install/files/acp/templates/articleAddDialog.tpl create mode 100644 wcfsetup/install/files/acp/templates/articleList.tpl create mode 100644 wcfsetup/install/files/images/placeholderTiny.png create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Article/Add.js create mode 100644 wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php create mode 100644 wcfsetup/install/files/lib/acp/form/ArticleCategoryAddForm.class.php create mode 100644 wcfsetup/install/files/lib/acp/form/ArticleCategoryEditForm.class.php create mode 100644 wcfsetup/install/files/lib/acp/form/ArticleEditForm.class.php create mode 100644 wcfsetup/install/files/lib/acp/page/ArticleCategoryListPage.class.php create mode 100644 wcfsetup/install/files/lib/acp/page/ArticleListPage.class.php create mode 100644 wcfsetup/install/files/lib/data/article/AccessibleArticleList.class.php create mode 100644 wcfsetup/install/files/lib/data/article/Article.class.php create mode 100644 wcfsetup/install/files/lib/data/article/ArticleAction.class.php create mode 100644 wcfsetup/install/files/lib/data/article/ArticleEditor.class.php create mode 100644 wcfsetup/install/files/lib/data/article/ArticleList.class.php create mode 100644 wcfsetup/install/files/lib/data/article/CategoryArticleList.class.php create mode 100644 wcfsetup/install/files/lib/data/article/FeedArticle.class.php create mode 100644 wcfsetup/install/files/lib/data/article/FeedArticleList.class.php create mode 100644 wcfsetup/install/files/lib/data/article/LikeableArticle.class.php create mode 100644 wcfsetup/install/files/lib/data/article/LikeableArticleProvider.class.php create mode 100644 wcfsetup/install/files/lib/data/article/TaggedArticleList.class.php create mode 100644 wcfsetup/install/files/lib/data/article/ViewableArticle.class.php create mode 100644 wcfsetup/install/files/lib/data/article/ViewableArticleList.class.php create mode 100644 wcfsetup/install/files/lib/data/article/category/ArticleCategory.class.php create mode 100644 wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php create mode 100644 wcfsetup/install/files/lib/data/article/content/ArticleContentAction.class.php create mode 100644 wcfsetup/install/files/lib/data/article/content/ArticleContentEditor.class.php create mode 100644 wcfsetup/install/files/lib/data/article/content/ArticleContentList.class.php create mode 100644 wcfsetup/install/files/lib/data/article/content/ViewableArticleContent.class.php create mode 100644 wcfsetup/install/files/lib/data/article/content/ViewableArticleContentList.class.php create mode 100644 wcfsetup/install/files/lib/page/ArticleFeedPage.class.php create mode 100644 wcfsetup/install/files/lib/page/ArticleListPage.class.php create mode 100644 wcfsetup/install/files/lib/page/ArticlePage.class.php create mode 100644 wcfsetup/install/files/lib/page/CategoryArticleListPage.class.php create mode 100644 wcfsetup/install/files/lib/system/cache/runtime/ViewableArticleRuntimeCache.class.php create mode 100644 wcfsetup/install/files/lib/system/category/ArticleCategoryType.class.php create mode 100644 wcfsetup/install/files/lib/system/comment/manager/ArticleCommentManager.class.php create mode 100644 wcfsetup/install/files/lib/system/page/handler/ArticlePageHandler.class.php create mode 100644 wcfsetup/install/files/lib/system/page/handler/CategoryArticleListPageHandler.class.php create mode 100644 wcfsetup/install/files/lib/system/tagging/TaggableArticle.class.php create mode 100644 wcfsetup/install/files/style/ui/article.scss diff --git a/com.woltlab.wcf/aclOption.xml b/com.woltlab.wcf/aclOption.xml index a608f243f6..2091a61b8d 100644 --- a/com.woltlab.wcf/aclOption.xml +++ b/com.woltlab.wcf/aclOption.xml @@ -8,6 +8,10 @@ + + \ No newline at end of file diff --git a/com.woltlab.wcf/acpMenu.xml b/com.woltlab.wcf/acpMenu.xml index 94d96a8f89..7137571540 100644 --- a/com.woltlab.wcf/acpMenu.xml +++ b/com.woltlab.wcf/acpMenu.xml @@ -322,11 +322,44 @@ fa-plus + + + + wcf.acp.menu.link.content + module_article + 2 + + + + wcf.acp.menu.link.article + admin.content.article.canManageArticle + + + + wcf.acp.menu.link.article.list + admin.content.article.canManageArticle + fa-plus + + + + + wcf.acp.menu.link.article + admin.content.article.canManageCategory + + + + + wcf.acp.menu.link.article.category.list + admin.content.article.canManageCategory + fa-plus + + + wcf.acp.menu.link.content - 2 + 3 @@ -356,7 +389,7 @@ wcf.acp.menu.link.content - 3 + 4 @@ -386,7 +419,7 @@ wcf.acp.menu.link.content module_tagging - 4 + 5 @@ -405,7 +438,7 @@ wcf.acp.menu.link.content - 5 + 6 diff --git a/com.woltlab.wcf/menuItem.xml b/com.woltlab.wcf/menuItem.xml index 2edf305506..379242d721 100644 --- a/com.woltlab.wcf/menuItem.xml +++ b/com.woltlab.wcf/menuItem.xml @@ -7,6 +7,12 @@ <![CDATA[Dashboard]]> com.woltlab.wcf.Dashboard + + com.woltlab.wcf.MainMenu + <![CDATA[Artikel]]> + <![CDATA[Articles]]> + com.woltlab.wcf.ArticleList + com.woltlab.wcf.MainMenu diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index a5203a3771..d058b18728 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -24,6 +24,29 @@ com.woltlab.wcf.collapsibleContent + + + com.woltlab.wcf.article.category + com.woltlab.wcf.category + wcf\system\category\ArticleCategoryType + + + com.woltlab.wcf.article.category + com.woltlab.wcf.acl + + + com.woltlab.wcf.article + com.woltlab.wcf.tagging.taggableObject + wcf\system\tagging\TaggableArticle + + + com.woltlab.wcf.likeableArticle + com.woltlab.wcf.like.likeableObject + wcf\data\article\LikeableArticleProvider + + + + com.woltlab.wcf.bbcode.smiley com.woltlab.wcf.category @@ -157,6 +180,12 @@ com.woltlab.wcf.comment.commentableContent + + + com.woltlab.wcf.article + com.woltlab.wcf.comment.commentableContent + + diff --git a/com.woltlab.wcf/option.xml b/com.woltlab.wcf/option.xml index 75cc0ca064..bb046a9e28 100644 --- a/com.woltlab.wcf/option.xml +++ b/com.woltlab.wcf/option.xml @@ -247,6 +247,9 @@ cms.media + + cms + @@ -316,6 +319,12 @@ 1 + + - + - + + + + + + + + + + diff --git a/com.woltlab.wcf/page.xml b/com.woltlab.wcf/page.xml index de65cf06ad..b727d692b8 100644 --- a/com.woltlab.wcf/page.xml +++ b/com.woltlab.wcf/page.xml @@ -473,6 +473,40 @@ com.woltlab.wcf.MembersList 1 + + system + wcf\page\ArticleListPage + + + module_article + + + Articles + + + Artikel + + + + system + wcf\page\CategoryArticleListPage + wcf\system\page\handler\CategoryArticleListPageHandler + + + module_article + com.woltlab.wcf.ArticleList + 1 + + + system + wcf\page\ArticlePage + wcf\system\page\handler\ArticlePageHandler + + + module_article + com.woltlab.wcf.CategoryArticleList + 1 + diff --git a/com.woltlab.wcf/templates/article.tpl b/com.woltlab.wcf/templates/article.tpl new file mode 100644 index 0000000000..df85e5a4f6 --- /dev/null +++ b/com.woltlab.wcf/templates/article.tpl @@ -0,0 +1,276 @@ +{capture assign='pageTitle'}{$articleContent->title}{/capture} + +{capture assign='contentHeader'} +
+
+

{$articleContent->title}

+
+ {$articleContent->getArticle()->getCategory()->getTitle()} +
+ +
+ + {hascontent} + + {/hascontent} +
+{/capture} + +{include file='header'} + +{if $articleContent->getImage()} +
+
+
{@$articleContent->getImage()->getThumbnailTag('large')}
+ {if $articleContent->getImage()->caption} +
{$articleContent->getImage()->caption}
+ {/if} +
+
+{/if} + +
+
+ {if $articleContent->teaser} + + {/if} + + {@$articleContent->getFormattedContent()} +
+ + {if !$tags|empty} + + {/if} + +
+ +
    + + {if ENABLE_SHARE_BUTTONS} +
    +

    {lang}wcf.message.share{/lang}

    + + {include file='shareButtons'} +
    + {/if} +
    + +{if ARTICLE_SHOW_ABOUT_AUTHOR} +
    +

    {lang}wcf.article.aboutAuthor{/lang}

    + +
    + {@$article->getUserProfile()->getAvatar()->getImageTag(128)} + +
    +
    {$article->getUserProfile()->aboutMe}
    + +
    + + + {if MODULE_USER_RANK} + {if $article->getUserProfile()->getUserTitle()} + {$article->getUserProfile()->getUserTitle()} + {/if} + {if $article->getUserProfile()->getRank() && $article->getUserProfile()->getRank()->rankImage} + {@$article->getUserProfile()->getRank()->getImage()} + {/if} + {/if} +
    +
    +
    +
    +{/if} + +
    + {hascontent} + + {/hascontent} +
    + +{if $previousArticle || $nextArticle} + +{/if} + +{if $relatedArticles|count} + +{/if} + +{if $article->enableComments} + {if $commentList|count || $commentCanAdd} +
    +

    {lang}wcf.article.comments{/lang}{if $article->comments} {#$article->comments}{/if}

    + + {include file='__commentJavaScript' commentContainerID='articleCommentList'} + +
      + {include file='commentList'} +
    +
    + {/if} +{/if} + +{if MODULE_LIKE && ARTICLE_ENABLE_LIKE} + +{/if} + +{include file='footer'} diff --git a/com.woltlab.wcf/templates/articleList.tpl b/com.woltlab.wcf/templates/articleList.tpl new file mode 100644 index 0000000000..a4313f597a --- /dev/null +++ b/com.woltlab.wcf/templates/articleList.tpl @@ -0,0 +1,54 @@ +{capture assign='headContent'} + {if $pageNo < $pages} + + {/if} + {if $pageNo > 1} + + {/if} + + {if $__wcf->getUser()->userID} + + {else} + + {/if} +{/capture} + +{capture assign='headerNavigation'} +
  • +{/capture} + +{include file='header'} + +{hascontent} +
    + {content} + {pages print=true assign='pagesLinks' controller='ArticleList' link="pageNo=%d"} + {/content} +
    +{/hascontent} + +{if $objects|count} +
    + {include file='articleListItems'} +
    +{else} +

    {lang}wcf.global.noItems{/lang}

    +{/if} + +
    + {hascontent} +
    + {content}{@$pagesLinks}{/content} +
    + {/hascontent} + + {hascontent} + + {/hascontent} +
    + +{include file='footer'} diff --git a/com.woltlab.wcf/templates/articleListItems.tpl b/com.woltlab.wcf/templates/articleListItems.tpl new file mode 100644 index 0000000000..17915318d6 --- /dev/null +++ b/com.woltlab.wcf/templates/articleListItems.tpl @@ -0,0 +1,46 @@ + \ No newline at end of file diff --git a/com.woltlab.wcf/templates/categoryArticleList.tpl b/com.woltlab.wcf/templates/categoryArticleList.tpl new file mode 100644 index 0000000000..a70db0d721 --- /dev/null +++ b/com.woltlab.wcf/templates/categoryArticleList.tpl @@ -0,0 +1,58 @@ +{capture assign='pageTitle'}{$category->getTitle()}{/capture} + +{capture assign='contentTitle'}{$category->getTitle()}{/capture} + +{capture assign='headContent'} + {if $pageNo < $pages} + + {/if} + {if $pageNo > 1} + + {/if} + + {if $__wcf->getUser()->userID} + + {else} + + {/if} +{/capture} + +{capture assign='headerNavigation'} +
  • +{/capture} + +{include file='header'} + +{hascontent} +
    + {content} + {pages print=true assign='pagesLinks' controller='CategoryArticleList' object=$category link="pageNo=%d"} + {/content} +
    +{/hascontent} + +{if $objects|count} +
    + {include file='articleListItems'} +
    +{else} +

    {lang}wcf.global.noItems{/lang}

    +{/if} + +
    + {hascontent} +
    + {content}{@$pagesLinks}{/content} +
    + {/hascontent} + + {hascontent} + + {/hascontent} +
    + +{include file='footer'} diff --git a/com.woltlab.wcf/templates/header.tpl b/com.woltlab.wcf/templates/header.tpl index 0f4ab999aa..1acf6bf1da 100644 --- a/com.woltlab.wcf/templates/header.tpl +++ b/com.woltlab.wcf/templates/header.tpl @@ -12,6 +12,10 @@ {include file='headInclude'} + {if !$canonicalURL|empty} + + {/if} + {if !$headContent|empty} {@$headContent} {/if} diff --git a/com.woltlab.wcf/templates/membersList.tpl b/com.woltlab.wcf/templates/membersList.tpl index a4867ed2e3..8380bedae1 100644 --- a/com.woltlab.wcf/templates/membersList.tpl +++ b/com.woltlab.wcf/templates/membersList.tpl @@ -12,7 +12,7 @@ {/if} -{/capture} +{/capture} {capture assign='sidebarRight'} {assign var=encodedLetter value=$letter|rawurlencode} diff --git a/com.woltlab.wcf/userGroupOption.xml b/com.woltlab.wcf/userGroupOption.xml index fdb84aa4a4..292309df29 100644 --- a/com.woltlab.wcf/userGroupOption.xml +++ b/com.woltlab.wcf/userGroupOption.xml @@ -32,6 +32,9 @@ user + + user + @@ -43,6 +46,9 @@ mod.general + + mod.general + @@ -362,6 +368,21 @@ 1 + + + + + + + + + + + +