Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion com.woltlab.wcf/objectTypeDefinition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
</definition>
<definition>
<name>com.woltlab.wcf.tagging.taggableObject</name>
<interfacename>wcf\system\tagging\ITaggable</interfacename>
</definition>
<definition>
<name>com.woltlab.wcf.deletedContent</name>
Expand Down
18 changes: 16 additions & 2 deletions com.woltlab.wcf/page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@
<page identifier="com.woltlab.wcf.Tagged">
<pageType>system</pageType>
<controller>wcf\page\TaggedPage</controller>
<name language="de">Inhalte mit bestimmtem Tag</name>
<name language="en">Content with Particular Tag</name>
<name language="de">Inhalte mit bestimmtem Tag (veraltet)</name>
<name language="en">Content with Particular Tag (deprecated)</name>
<permissions>user.tag.canViewTag</permissions>
<requireObjectID>1</requireObjectID>
<content language="en">
Expand All @@ -471,6 +471,20 @@
<page identifier="com.woltlab.wcf.CombinedTagged">
<pageType>system</pageType>
<controller>wcf\page\CombinedTaggedPage</controller>
<name language="de">Inhalte mit bestimmten Tags (veraltet)</name>
<name language="en">Content with Particular Tags (deprecated)</name>
<permissions>user.tag.canViewTag</permissions>
<requireObjectID>1</requireObjectID>
<content language="en">
<title>Content with Particular Tags</title>
</content>
<content language="de">
<title>Inhalte mit bestimmten Tags</title>
</content>
</page>
<page identifier="com.woltlab.wcf.TaggedListView">
<pageType>system</pageType>
<controller>wcf\page\TaggedListViewPage</controller>
<name language="de">Inhalte mit bestimmten Tags</name>
<name language="en">Content with Particular Tags</name>
<permissions>user.tag.canViewTag</permissions>
Expand Down
10 changes: 5 additions & 5 deletions com.woltlab.wcf/templates/combinedTagged.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@

<nav class="boxContent">
<ul class="boxMenu">
{foreach from=$availableObjectTypes item=availableObjectType}
<li{if $objectType == $availableObjectType->objectType} class="active"{/if}>
<a class="boxMenuLink" href="{link controller='CombinedTagged'}{@$linkParameters}&objectType={@$availableObjectType->objectType}{/link}">
<span class="boxMenuLinkTitle">{lang}wcf.tagging.objectType.{@$availableObjectType->objectType}{/lang}</span>
<span class="badge">{#$itemsPerType[$availableObjectType->objectType]}</span>
{foreach from=$objectTypeLinks item=objectTypeLink}
<li{if $objectType == $objectTypeLink[objectType]} class="active"{/if}>
<a class="boxMenuLink" href="{$objectTypeLink[link]}">
<span class="boxMenuLinkTitle">{$objectTypeLink[title]}</span>
<span class="badge">{$objectTypeLink[items]}</span>
</a>
</li>
{/foreach}
Expand Down
10 changes: 5 additions & 5 deletions com.woltlab.wcf/templates/tagged.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

<nav class="boxContent">
<ul class="boxMenu">
{foreach from=$availableObjectTypes item=availableObjectType}
<li{if $objectType == $availableObjectType->objectType} class="active"{/if}>
<a class="boxMenuLink" href="{link controller='Tagged' object=$tag}objectType={@$availableObjectType->objectType}{/link}">
<span class="boxMenuLinkTitle">{lang}wcf.tagging.objectType.{@$availableObjectType->objectType}{/lang}</span>
<span class="badge">{#$itemsPerType[$availableObjectType->objectType]}</span>
{foreach from=$objectTypeLinks item=objectTypeLink}
<li{if $objectType == $objectTypeLink[objectType]} class="active"{/if}>
<a class="boxMenuLink" href="{$objectTypeLink[link]}">
<span class="boxMenuLinkTitle">{$objectTypeLink[title]}</span>
<span class="badge">{$objectTypeLink[items]}</span>
</a>
</li>
{/foreach}
Expand Down
48 changes: 48 additions & 0 deletions com.woltlab.wcf/templates/taggedListView.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{capture assign='pageTitle'}{$contentTitle} {lang}wcf.tagging.combinedTaggedObjects{/lang}{/capture}

{capture assign='contentHeader'}
<header class="contentHeader">
<div class="contentHeaderTitle">
<h1 class="contentTitle">{$contentTitle} {lang}wcf.tagging.combinedTaggedObjects{/lang}</h1>
</div>
</header>
{/capture}

{capture assign='sidebarRight'}
<section class="box" data-static-box-identifier="com.woltlab.wcf.TaggedMenu">
<h2 class="boxTitle">{lang}wcf.tagging.objectTypes{/lang}</h2>

<nav class="boxContent">
<ul class="boxMenu">
{foreach from=$objectTypeLinks item=objectTypeLink}
<li{if $objectType == $objectTypeLink[objectType]} class="active"{/if}>
<a class="boxMenuLink" href="{$objectTypeLink[link]}">
<span class="boxMenuLinkTitle">{$objectTypeLink[title]}</span>
<span class="badge">{$objectTypeLink[items]}</span>
</a>
</li>
{/foreach}
</ul>
</nav>
</section>

<section class="box" data-static-box-identifier="com.woltlab.wcf.TaggedTagCloud">
<h2 class="boxTitle">{lang}wcf.tagging.tags{/lang}</h2>

<div class="boxContent">
{include file='tagCloudBox' taggableObjectType=$objectType}
</div>
</section>
{/capture}

{capture assign='contentInteractionButtons'}
<a href="{link controller='TagSearch'}{/link}" class="contentInteractionButton button small">{icon name='magnifying-glass'} <span>{lang}wcf.search.type.tags{/lang}</span></a>
{/capture}

{include file='header'}

<div class="section">
{unsafe:$listView->render()}
</div>

{include file='footer'}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* @copyright 2001-2019 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @since 3.0
* @deprecated 6.2
*/
class TaggedArticleList extends AccessibleArticleList
{
Expand Down
66 changes: 57 additions & 9 deletions wcfsetup/install/files/lib/page/CombinedTaggedPage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace wcf\page;

use Laminas\Diactoros\Response\RedirectResponse;
use wcf\data\DatabaseObject;
use wcf\data\DatabaseObjectList;
use wcf\data\object\type\ObjectType;
Expand All @@ -10,7 +11,9 @@
use wcf\data\tag\TagList;
use wcf\system\exception\IllegalLinkException;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\request\LinkHandler;
use wcf\system\tagging\ICombinedTaggable;
use wcf\system\tagging\ITaggedListViewProvider;
use wcf\system\tagging\TypedTagCloud;
use wcf\system\WCF;
use wcf\util\ArrayUtil;
Expand All @@ -23,6 +26,7 @@
* @copyright 2001-2019 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @since 5.2
* @deprecated 6.2 Use `TaggedListViewPage` instead.
*
* @extends MultipleLinkPage<DatabaseObjectList<DatabaseObject>>
*/
Expand Down Expand Up @@ -104,10 +108,6 @@ public function readParameters()
if (!$objectType->validateOptions() || !$objectType->validatePermissions()) {
unset($this->availableObjectTypes[$key]);
}

if (!($objectType->getProcessor() instanceof ICombinedTaggable)) {
unset($this->availableObjectTypes[$key]);
}
}

if (empty($this->availableObjectTypes)) {
Expand Down Expand Up @@ -135,7 +135,16 @@ public function readParameters()
}
}

$this->processor = $this->objectType->getProcessor();
if ($this->objectType->getProcessor() instanceof ITaggedListViewProvider) {
return new RedirectResponse(
LinkHandler::getInstance()->getControllerLink(TaggedListViewPage::class, [
'objectType' => $this->objectType->objectType,
'tagIDs' => $this->tagIDs,
]),
);
} else {
$this->processor = $this->objectType->getProcessor();
}
}

/**
Expand Down Expand Up @@ -171,19 +180,58 @@ public function assignVariables()
'resultListTemplateName' => $this->processor->getTemplateName(),
'resultListApplication' => $this->processor->getApplication(),
'itemsPerType' => $this->itemsPerType,
'objectTypeLinks' => $this->getObjectTypeLinks(),
]);

if (\count($this->objectList) === 0) {
@\header('HTTP/1.1 404 Not Found');
}
}

private function readItemsPerType(): void
protected function getObjectTypeLinks(): array
{
$links = [];
foreach ($this->availableObjectTypes as $objectType) {
if ($objectType->getProcessor() instanceof ITaggedListViewProvider) {
$processor = $objectType->getProcessor();
\assert($processor instanceof ITaggedListViewProvider);

$title = $processor->getObjectTypeTitle();
$controller = TaggedListViewPage::class;
} else {
$title = WCF::getLanguage()->get('wcf.tagging.objectType.' . $objectType->objectType);
$controller = CombinedTaggedPage::class;
}

$links[] = [
'objectType' => $objectType->objectType,
'title' => $title,
'link' => LinkHandler::getInstance()->getControllerLink(
$controller,
[
'objectType' => $objectType->objectType,
'tagIDs' => $this->tagIDs
]
),
'items' => $this->itemsPerType[$objectType->objectType] ?? 0,
];
}

return $links;
}

protected function readItemsPerType(): void
{
foreach ($this->availableObjectTypes as $key => $objectType) {
$objectList = $objectType->getProcessor()->getObjectListFor($this->tags);
\assert($objectList instanceof DatabaseObjectList);
$this->itemsPerType[$key] = $objectList->countObjects();
if ($objectType->getProcessor() instanceof ITaggedListViewProvider) {
$processor = $objectType->getProcessor();
\assert($processor instanceof ITaggedListViewProvider);
$this->itemsPerType[$key] = $processor->getListView($this->tagIDs)->countItems();
} else {
$objectList = $objectType->getProcessor()->getObjectListFor($this->tags);
\assert($objectList instanceof DatabaseObjectList);
$this->itemsPerType[$key] = $objectList->countObjects();
}
}
}
}
Loading