Add tagging to system
This commit is contained in:
parent
decfe03cda
commit
82e1fe563e
16 changed files with 238 additions and 83 deletions
|
@ -5,7 +5,7 @@ mod.web_layout.BackendLayouts {
|
|||
config {
|
||||
backend_layout {
|
||||
colCount = 1
|
||||
rowCount = 2
|
||||
rowCount = 4
|
||||
rows {
|
||||
1 {
|
||||
columns {
|
||||
|
@ -26,11 +26,19 @@ mod.web_layout.BackendLayouts {
|
|||
3 {
|
||||
columns {
|
||||
1 {
|
||||
name = Footer
|
||||
name = Acknowledgements
|
||||
colPos = 100
|
||||
}
|
||||
}
|
||||
}
|
||||
4 {
|
||||
columns {
|
||||
1 {
|
||||
name = Further reading
|
||||
colPos = 200
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,16 @@ TCEFORM.tt_content {
|
|||
|
||||
layout {
|
||||
disabled = 1
|
||||
keepItems := addToList(0)
|
||||
|
||||
types {
|
||||
menu_abstract {
|
||||
disabled = 0
|
||||
addItems {
|
||||
100 = Filtered
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
frame_class {
|
||||
disabled = 1
|
||||
|
|
32
Configuration/TCA/Overrides/sys_category.php
Normal file
32
Configuration/TCA/Overrides/sys_category.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
(function (string $tableName) {
|
||||
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA'][$tableName], [
|
||||
'columns' => [
|
||||
'slug' => [
|
||||
'label' => '<path-to-locallang-file>.slug',
|
||||
'exclude' => 1,
|
||||
'config' => [
|
||||
'type' => 'slug',
|
||||
'generatorOptions' => [
|
||||
'fields' => ['title'],
|
||||
'prefixParentPageSlug' => true,
|
||||
'replacements' => [
|
||||
'/' => '',
|
||||
],
|
||||
],
|
||||
'fallbackCharacter' => '-',
|
||||
'eval' => 'uniqueInSite',
|
||||
'default' => ''
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
|
||||
$tableName,
|
||||
'slug',
|
||||
'',
|
||||
'after:title'
|
||||
);
|
||||
})('sys_category');
|
|
@ -4,8 +4,54 @@ tt_content.menu_abstract {
|
|||
dataProcessing {
|
||||
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
|
||||
10 {
|
||||
if {
|
||||
value = 0
|
||||
equals.field = layout
|
||||
}
|
||||
special = directory
|
||||
special.value.field = pages
|
||||
dataProcessing {
|
||||
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
|
||||
10 {
|
||||
selectFields = sys_category.*
|
||||
table = sys_category
|
||||
pidInList = 2
|
||||
where = sys_category_record_mm.uid_foreign = {field:uid} AND sys_category.parent = 2
|
||||
where.insertData = 1
|
||||
leftjoin = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
|
||||
orderBy = sorting
|
||||
as = compatibleWith
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
100 < .10
|
||||
100 {
|
||||
if.value = 100
|
||||
special >
|
||||
special = categories
|
||||
special.value {
|
||||
data = GP:tag_id
|
||||
intval = 1
|
||||
}
|
||||
}
|
||||
|
||||
500 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
|
||||
500 {
|
||||
if {
|
||||
value = 100
|
||||
equals.field = layout
|
||||
}
|
||||
table = sys_category
|
||||
pidInList = 2
|
||||
where = uid = ###UID###
|
||||
markers {
|
||||
UID {
|
||||
data = GP:tag_id
|
||||
intval = 1
|
||||
}
|
||||
}
|
||||
as = tagForFilter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,15 +38,17 @@ page {
|
|||
pidInList = 2
|
||||
where = sys_category_record_mm.uid_foreign = {page:uid} AND sys_category.parent = 1
|
||||
where.insertData = 1
|
||||
join = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
|
||||
orderBy = sorting
|
||||
as = tags
|
||||
leftjoin = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
|
||||
orderBy = count DESC, sys_category.title ASC
|
||||
as = assignedTags
|
||||
}
|
||||
11 < .10
|
||||
11 {
|
||||
where = sys_category_record_mm.uid_foreign = {page:uid} AND sys_category.parent = 2
|
||||
as = compatible
|
||||
orderBy = sorting
|
||||
as = compatibleWith
|
||||
}
|
||||
|
||||
50 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
|
||||
50 {
|
||||
special = list
|
||||
|
@ -63,6 +65,20 @@ page {
|
|||
}
|
||||
as = pageSections
|
||||
}
|
||||
|
||||
100 < .10
|
||||
100 {
|
||||
selectFields = sys_category.*, count(sys_category_record_mm.uid_foreign) as count
|
||||
where = sys_category.parent = 1 AND sys_category_record_mm.uid_foreign IS NOT NULL
|
||||
groupBy = sys_category.uid
|
||||
as = allTags
|
||||
}
|
||||
101 < .100
|
||||
101 {
|
||||
where = sys_category.parent = 2 AND sys_category_record_mm.uid_foreign IS NOT NULL
|
||||
orderBy = sorting
|
||||
as = allTypo3Compatible
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
|
@ -77,12 +93,18 @@ page {
|
|||
}
|
||||
}
|
||||
contentMain =< styles.content.get
|
||||
footer =< styles.content.get
|
||||
footer {
|
||||
acknowledgements =< styles.content.get
|
||||
acknowledgements {
|
||||
select {
|
||||
where = {#colPos}=100
|
||||
}
|
||||
}
|
||||
furtherReading =< styles.content.get
|
||||
furtherReading {
|
||||
select {
|
||||
where = {#colPos}=200
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
data-namespace-typo3-fluid="true">
|
||||
|
||||
<f:render section="Header" arguments="{_all}" optional="1">
|
||||
<a name="c{data.uid}"></a>
|
||||
<f:if condition="{data.header_layout} != 100">
|
||||
<!-- TODO: Map header_layout and use mapped value -->
|
||||
<h2>{data.header} <small><a href="#c{data.uid}">¶</a></small></h2>
|
||||
</f:if>
|
||||
{f:render(partial: 'Header', arguments: {
|
||||
uid: data.uid,
|
||||
layout: data.header_layout,
|
||||
header: data.header
|
||||
})}
|
||||
</f:render>
|
||||
|
||||
{f:render(section: 'Content', arguments: _all)}
|
||||
|
|
20
Resources/Private/Partials/BlogPostHeader.html
Normal file
20
Resources/Private/Partials/BlogPostHeader.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
<html xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
|
||||
data-namespace-typo3-fluid="true">
|
||||
|
||||
<header>
|
||||
<h1>{f:if(
|
||||
condition: link,
|
||||
then: '<a href="{link}">{title}</a>',
|
||||
else: title
|
||||
)}</h1>
|
||||
<p>
|
||||
Published: <time>{blogPost.lastUpdated -> f:format.date(format: 'Y-m-d')}</time>,
|
||||
Updated: <time>{blogPost.SYS_LASTCHANGED -> f:format.date(format: 'Y-m-d')}</time>
|
||||
</p>
|
||||
<p>Tested with TYPO3:
|
||||
<f:for each="{compatibleWith}" as="version" iteration="i">
|
||||
{version.data.title}{f:if(condition: '!{i.isLast}', then: ',')}
|
||||
</f:for>
|
||||
</p>
|
||||
</header>
|
||||
</html>
|
8
Resources/Private/Partials/ContentElements/Header.html
Normal file
8
Resources/Private/Partials/ContentElements/Header.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<html xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
|
||||
data-namespace-typo3-fluid="true">
|
||||
<a name="c{uid}"></a>
|
||||
<f:if condition="{layout} != 100">
|
||||
<!-- TODO: Map header_layout and use mapped value -->
|
||||
<h2>{header} <small><a href="#c{uid}">¶</a></small></h2>
|
||||
</f:if>
|
||||
</html>
|
|
@ -1,11 +1,11 @@
|
|||
<html xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
|
||||
<article>
|
||||
<header>
|
||||
<h1><a href="{page.link}">{page.title}</a></h1>
|
||||
<p>
|
||||
<time>{page.data.lastUpdated -> f:format.date(format: 'Y-m-d')}</time>
|
||||
</p>
|
||||
</header>
|
||||
{f:render(partial: 'BlogPostHeader', arguments: {
|
||||
link: page.link,
|
||||
title: page.title,
|
||||
blogPost : page.data,
|
||||
compatibleWith: page.compatibleWith
|
||||
})}
|
||||
|
||||
{page.data.abstract -> f:format.html()}
|
||||
|
||||
|
|
16
Resources/Private/Partials/TagList.html
Normal file
16
Resources/Private/Partials/TagList.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
<html xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
|
||||
data-namespace-typo3-fluid="true">
|
||||
<nav>
|
||||
<h1>{headline}</h1>
|
||||
<ul>
|
||||
<f:for each="{tags}" as="tag">
|
||||
<li>
|
||||
<a href="{f:uri.page(pageUid: 11, additionalParams: {tag: tag.data.uid})}">
|
||||
{tag.data.title}
|
||||
{f:if(condition: tag.data.count, then: '({tag.data.count})')}
|
||||
</a>
|
||||
</li>
|
||||
</f:for>
|
||||
</ul>
|
||||
</nav>
|
||||
</html>
|
|
@ -1,5 +1,10 @@
|
|||
article.single-blog-post {
|
||||
padding-top: 0;
|
||||
|
||||
> header {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
padding-top: $spacer * 2;
|
||||
}
|
||||
|
|
|
@ -3,14 +3,17 @@
|
|||
|
||||
{f:layout(name: 'Default')}
|
||||
|
||||
<f:section name="Header">
|
||||
{f:render(partial: 'Header', arguments: {
|
||||
uid: data.uid,
|
||||
layout: data.header_layout,
|
||||
header: '{data.header} {tagForFilter.0.data.title}'
|
||||
})}
|
||||
</f:section>
|
||||
|
||||
<f:section name="Content">
|
||||
<f:for each="{menu}" as="page">
|
||||
{f:render(partial: 'Menu/Page', arguments: {page: page})}
|
||||
</f:for>
|
||||
|
||||
<!-- <nav class="blog-pagination"> -->
|
||||
<!-- <a class="btn btn-outline-primary" href="#">Older</a> -->
|
||||
<!-- <a class="btn btn-outline-secondary disabled" href="#" tabindex="-1" aria-disabled="true">Newer</a> -->
|
||||
<!-- </nav> -->
|
||||
</f:section>
|
||||
</html>
|
||||
|
|
|
@ -8,18 +8,11 @@
|
|||
<h1>Blog Post</h1>
|
||||
</header>
|
||||
<article class="single-blog-post">
|
||||
<header>
|
||||
<h1>{data.title}</h1>
|
||||
<p>
|
||||
Published: <time>{data.lastUpdated -> f:format.date(format: 'Y-m-d')}</time>,
|
||||
Updated: <time>{data.SYS_LASTCHANGED -> f:format.date(format: 'Y-m-d')}</time>
|
||||
</p>
|
||||
<p>Tested with TYPO3:
|
||||
<f:for each="{compatible}" as="version" iteration="i">
|
||||
{version.data.title}{f:if(condition: '!{i.isLast}', then: ',')}
|
||||
</f:for>
|
||||
</p>
|
||||
</header>
|
||||
{f:render(partial: 'BlogPostHeader', arguments: {
|
||||
title: data.title,
|
||||
blogPost : data,
|
||||
compatibleWith: compatibleWith
|
||||
})}
|
||||
|
||||
<a name="introduction"></a>
|
||||
<h2>Introduction <small><a href="#introduction">¶</a></small></h2>
|
||||
|
@ -28,26 +21,27 @@
|
|||
|
||||
{contentMain -> f:format.raw()}
|
||||
|
||||
{footer -> f:format.raw()}
|
||||
<f:if condition="{acknowledgements}">
|
||||
<a name="acknowledgements"></a>
|
||||
<h2>Acknowledgements <small><a href="#acknowledgements">¶</a></small></h2>
|
||||
{acknowledgements -> f:format.raw()}
|
||||
</f:if>
|
||||
|
||||
<f:if condition="{furtherReading}">
|
||||
<a name="furtherReading"></a>
|
||||
<h2>Further reading <small><a href="#furtherReading">¶</a></small></h2>
|
||||
{furtherReading -> f:format.raw()}
|
||||
</f:if>
|
||||
</article>
|
||||
</f:section>
|
||||
|
||||
<f:section name="Aside">
|
||||
{f:render(section: 'TOC', arguments: _all)}
|
||||
|
||||
<nav>
|
||||
<h1>Related Tags</h1>
|
||||
<ul>
|
||||
<f:for each="{tags}" as="tag">
|
||||
<li><a href="#">{tag.data.title}</a></li>
|
||||
</f:for>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<!-- <nav> -->
|
||||
<!-- <h1>Further reading</h1> -->
|
||||
<!-- TODO: Move content element from main content to here -->
|
||||
<!-- </nav> -->
|
||||
{f:render(partial: 'TagList', arguments: {
|
||||
headline: 'Related Tags',
|
||||
tags: assignedTags
|
||||
})}
|
||||
</f:section>
|
||||
|
||||
<f:section name="TOC">
|
||||
|
@ -65,6 +59,16 @@
|
|||
</li>
|
||||
</f:for>
|
||||
</f:alias>
|
||||
<f:if condition="{acknowledgements}">
|
||||
<li>
|
||||
<a href="#acknowledgements">Acknowledgements</a>
|
||||
</li>
|
||||
</f:if>
|
||||
<f:if condition="{furtherReading}">
|
||||
<li>
|
||||
<a href="#furtherReading">Further reading</a>
|
||||
</li>
|
||||
</f:if>
|
||||
</ul>
|
||||
</nav>
|
||||
</f:section>
|
||||
|
|
|
@ -12,36 +12,14 @@
|
|||
</f:section>
|
||||
|
||||
<f:section name="Aside">
|
||||
<div class="p-4 mb-3 bg-light rounded">
|
||||
<h4 class="font-italic">About</h4>
|
||||
<p class="mb-0">Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.</p>
|
||||
</div>
|
||||
{f:render(partial: 'TagList', arguments: {
|
||||
headline: 'Compatible with TYPO3',
|
||||
tags: allTypo3Compatible
|
||||
})}
|
||||
|
||||
<div class="p-4">
|
||||
<h4 class="font-italic">Archives</h4>
|
||||
<ol class="list-unstyled mb-0">
|
||||
<li><a href="#">March 2014</a></li>
|
||||
<li><a href="#">February 2014</a></li>
|
||||
<li><a href="#">January 2014</a></li>
|
||||
<li><a href="#">December 2013</a></li>
|
||||
<li><a href="#">November 2013</a></li>
|
||||
<li><a href="#">October 2013</a></li>
|
||||
<li><a href="#">September 2013</a></li>
|
||||
<li><a href="#">August 2013</a></li>
|
||||
<li><a href="#">July 2013</a></li>
|
||||
<li><a href="#">June 2013</a></li>
|
||||
<li><a href="#">May 2013</a></li>
|
||||
<li><a href="#">April 2013</a></li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div class="p-4">
|
||||
<h4 class="font-italic">Elsewhere</h4>
|
||||
<ol class="list-unstyled">
|
||||
<li><a href="#">GitHub</a></li>
|
||||
<li><a href="#">Twitter</a></li>
|
||||
<li><a href="#">Facebook</a></li>
|
||||
</ol>
|
||||
</div>
|
||||
{f:render(partial: 'TagList', arguments: {
|
||||
headline: 'Tags',
|
||||
tags: allTags
|
||||
})}
|
||||
</f:section>
|
||||
</html>
|
||||
|
|
File diff suppressed because one or more lines are too long
3
ext_tables.sql
Normal file
3
ext_tables.sql
Normal file
|
@ -0,0 +1,3 @@
|
|||
CREATE TABLE sys_category (
|
||||
slug varchar(2048),
|
||||
);
|
Loading…
Reference in a new issue