diff --git a/Classes/Controller/NewsByAuthorController.php b/Classes/Controller/NewsByAuthorController.php new file mode 100644 index 0000000000000000000000000000000000000000..24e0f563502c0ecd2868c52deadcc06adaace3e9 --- /dev/null +++ b/Classes/Controller/NewsByAuthorController.php @@ -0,0 +1,99 @@ +<?php + +namespace SGalinski\SgNews\Controller; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use SGalinski\SgNews\Domain\Model\News; +use SGalinski\SgNews\Domain\Repository\AuthorRepository; +use SGalinski\SgNews\Domain\Repository\CategoryRepository; +use SGalinski\SgNews\Domain\Repository\NewsRepository; +use SGalinski\SgNews\Service\HeaderMetaDataService; +use TYPO3\CMS\Core\Utility\GeneralUtility; + +/** + * Controller that handles the news single view page + */ +class NewsByAuthorController extends AbstractController { + /** + * Renders the news author list. + * + * @return void + * @throws \InvalidArgumentException + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException + */ + public function listAction() { + $newsAuthorsIds = GeneralUtility::intExplode(',', $this->settings['newsAuthors']); + if (\count($newsAuthorsIds) <= 0) { + return; + } + + $authors = []; + $authorRepository = $this->objectManager->get(AuthorRepository::class); + foreach ($newsAuthorsIds as $newsAuthorsId) { + $author = $authorRepository->findByUid($newsAuthorsId); + if (!$author) { + continue; + } + + $authors[] = $author; + } + + if (\count($authors) <= 0) { + return; + } + + $newsRepository = $this->objectManager->get(NewsRepository::class); + $news = $newsRepository->findAllByNewsAuthor($newsAuthorsIds); + if (\count($news) <= 0) { + return; + } + + $categories = $newsMetaData = []; + $categoryRepository = $this->objectManager->get(CategoryRepository::class); + $excludedNewsIds = GeneralUtility::intExplode(',', $this->settings['excludedNews']); + foreach ($news as $newsEntry) { + /** @var News $newsEntry */ + if (in_array($newsEntry->getUid(), $excludedNewsIds, TRUE)) { + continue; + } + + $categoryId = $newsEntry->getPid(); + if (!isset($categories[$categoryId])) { + $category = $categoryRepository->findByUid($categoryId); + if (!$category) { + continue; + } + + $categories[$categoryId] = $category; + } + + $newsMetaData[] = $this->getMetaDataForNews($newsEntry, $categories[$categoryId]); + } + + $this->view->assign('newsMetaData', $newsMetaData); + $this->view->assign('authors', $authors); + } +} diff --git a/Classes/Controller/SingleViewController.php b/Classes/Controller/SingleViewController.php index 62cb187c862270636fb2ec43d443896265aeba9f..b17507a156d559f794b7f95cb6131cc11b88909f 100644 --- a/Classes/Controller/SingleViewController.php +++ b/Classes/Controller/SingleViewController.php @@ -91,7 +91,7 @@ class SingleViewController extends AbstractController { // $similarNewsMetaData[] = $this->getMetaDataForNews($similarNewsEntry, $category); // } - $newsAuthor = $news->getAuthorFrontendUser(); + $newsAuthor = $news->getNewsAuthor(); $newsMetaData = $this->getMetaDataForNews($news, $newsCategory); if ($newsMetaData['image']) { HeaderMetaDataService::addOgImageToHeader($newsMetaData['image']); diff --git a/Classes/Domain/Model/Author.php b/Classes/Domain/Model/Author.php new file mode 100644 index 0000000000000000000000000000000000000000..20389424ec8bdcdb767ab716960045d749dd45bd --- /dev/null +++ b/Classes/Domain/Model/Author.php @@ -0,0 +1,191 @@ +<?php + +namespace SGalinski\SgNews\Domain\Model; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Extbase\Domain\Model\FrontendUser; +use TYPO3\CMS\Extbase\Domain\Model\FileReference; +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy; + +/** + * Author + */ +class Author extends AbstractEntity { + /** + * @var string + */ + protected $name = ''; + + /** + * @var string + */ + protected $email = ''; + + /** + * @var string + */ + protected $description = ''; + + /** + * @lazy + * @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUser + */ + protected $frontendUser; + + /** + * @lazy + * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference + */ + protected $image; + + /** + * @return string + */ + public function getName(): string { + return $this->name; + } + + /** + * @param string $name + */ + public function setName(string $name): void { + $this->name = $name; + } + + /** + * @return string + */ + public function getNameAndRespectFrontendUser(): string { + $frontendUser = $this->getFrontendUser(); + if ($frontendUser) { + $name = $frontendUser->getName(); + if (!empty($name)) { + return $name; + } + } + + return $this->name; + } + + /** + * @return string + */ + public function getEmail(): string { + return $this->email; + } + + /** + * @param string $email + */ + public function setEmail(string $email): void { + $this->email = $email; + } + + /** + * @return string + */ + public function getEmailAndRespectFrontendUser(): string { + $frontendUser = $this->getFrontendUser(); + if ($frontendUser) { + $email = $frontendUser->getEmail(); + if (!empty($email)) { + return $email; + } + } + + return $this->email; + } + + /** + * @return string + */ + public function getDescription(): string { + return $this->description; + } + + /** + * @param string $description + */ + public function setDescription(string $description): void { + $this->description = $description; + } + + /** + * @return FrontendUser + */ + public function getFrontendUser(): ?FrontendUser { + if ($this->frontendUser instanceof LazyLoadingProxy) { + $this->frontendUser->_loadRealInstance(); + } + + return $this->frontendUser; + } + + /** + * @param FrontendUser $frontendUser + */ + public function setFrontendUser(FrontendUser $frontendUser): void { + $this->frontendUser = $frontendUser; + } + + /** + * @return FileReference + */ + public function getImage(): ?FileReference { + if ($this->image instanceof LazyLoadingProxy) { + $this->image->_loadRealInstance(); + } + + return $this->image; + } + + /** + * @param FileReference $image + */ + public function setImage(FileReference $image): void { + $this->image = $image; + } + + /** + * @return string + */ + public function getImageAndRespectFrontendUser(): string { + $frontendUser = $this->getFrontendUser(); + if ($frontendUser) { + $images = $frontendUser->getImage(); + if ($images->count() > 0) { + return $images->current(); + } + } + + if ($this->image instanceof LazyLoadingProxy) { + $this->image->_loadRealInstance(); + } + + return $this->image; + } +} diff --git a/Classes/Domain/Model/News.php b/Classes/Domain/Model/News.php index 38ae88a755db598228c2b101e2af1cc9b1bf9588..a9f43b730b87a7bf78f08bb6b890522017dae7de 100644 --- a/Classes/Domain/Model/News.php +++ b/Classes/Domain/Model/News.php @@ -26,7 +26,6 @@ namespace SGalinski\SgNews\Domain\Model; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -use TYPO3\CMS\Extbase\Domain\Model\FrontendUser; use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; @@ -39,11 +38,6 @@ class News extends CategoryAndNews { */ protected $description = ''; - /** - * @var string - */ - protected $author = ''; - /** * @var boolean */ @@ -82,9 +76,9 @@ class News extends CategoryAndNews { /** * @lazy - * @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUser + * @var \SGalinski\SgNews\Domain\Model\Author */ - protected $authorFrontendUser; + protected $newsAuthor; /** * @var int @@ -96,6 +90,11 @@ class News extends CategoryAndNews { */ protected $location; + /** + * @var int + */ + protected $contentFromAnotherPage = 0; + /** * Constructor */ @@ -105,21 +104,6 @@ class News extends CategoryAndNews { $this->tags = new ObjectStorage(); } - /** - * @param string $author - * @return void - */ - public function setAuthor($author) { - $this->author = $author; - } - - /** - * @return string - */ - public function getAuthor() { - return $this->author; - } - /** * @param string $description * @return void @@ -283,22 +267,21 @@ class News extends CategoryAndNews { } /** - * @param FrontendUser $authorFrontendUser - * @return void + * @return Author */ - public function setAuthorFrontendUser(FrontendUser $authorFrontendUser) { - $this->authorFrontendUser = $authorFrontendUser; + public function getNewsAuthor(): ?Author { + if ($this->newsAuthor instanceof LazyLoadingProxy) { + $this->newsAuthor->_loadRealInstance(); + } + + return $this->newsAuthor; } /** - * @return FrontendUser + * @param Author $newsAuthor */ - public function getAuthorFrontendUser() { - if ($this->authorFrontendUser instanceof LazyLoadingProxy) { - $this->authorFrontendUser->_loadRealInstance(); - } - - return $this->authorFrontendUser; + public function setNewsAuthor(Author $newsAuthor): void { + $this->newsAuthor = $newsAuthor; } /** @@ -329,4 +312,17 @@ class News extends CategoryAndNews { $this->location = $location; } + /** + * @return int + */ + public function getContentFromAnotherPage(): int { + return $this->contentFromAnotherPage; + } + + /** + * @param int $contentFromAnotherPage + */ + public function setContentFromAnotherPage(int $contentFromAnotherPage): void { + $this->contentFromAnotherPage = $contentFromAnotherPage; + } } diff --git a/Classes/Domain/Repository/AuthorRepository.php b/Classes/Domain/Repository/AuthorRepository.php new file mode 100644 index 0000000000000000000000000000000000000000..f1ac33f72aec678de1133119d79b55c42dd8d2be --- /dev/null +++ b/Classes/Domain/Repository/AuthorRepository.php @@ -0,0 +1,36 @@ +<?php + +namespace SGalinski\SgNews\Domain\Repository; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use SGalinski\SgNews\Domain\Repository\AbstractRepository; + +/** + * Repository for the Author model. + */ +class AuthorRepository extends AbstractRepository { + +} diff --git a/Classes/Domain/Repository/NewsRepository.php b/Classes/Domain/Repository/NewsRepository.php index f931fea680c847d7b584c47d6da4f5079ed81697..62379d44c2e265518b8e4017eca363c2059bcd82 100644 --- a/Classes/Domain/Repository/NewsRepository.php +++ b/Classes/Domain/Repository/NewsRepository.php @@ -26,6 +26,7 @@ namespace SGalinski\SgNews\Domain\Repository; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ +use SGalinski\SgNews\Domain\Model\Author; use SGalinski\SgNews\Domain\Model\News; use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult; use TYPO3\CMS\Extbase\Persistence\QueryInterface; @@ -35,6 +36,24 @@ use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; * News Repository */ class NewsRepository extends AbstractRepository { + /** + * Finds all news by the given authors. + * + * @param array $authorIds + * + * @return QueryResultInterface|NULL + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException + */ + public function findAllByNewsAuthor(array $authorIds): ?QueryResultInterface { + if (count($authorIds) <= 0) { + return NULL; + } + + $query = $this->createQuery(); + $query->matching($query->in('newsAuthor', $authorIds)); + return $query->execute(); + } + /** * Method returns all news by category id sorted by the field lastUpdated. * diff --git a/Classes/UserFunction/AddAdditionalMailRecipients.php b/Classes/UserFunction/AddAdditionalMailRecipients.php index 1aa83e0669c2c8c863a44ae6aeb34def0b81cf70..64510722add3fdeb3e0913a08d84a28622df4826 100644 --- a/Classes/UserFunction/AddAdditionalMailRecipients.php +++ b/Classes/UserFunction/AddAdditionalMailRecipients.php @@ -25,10 +25,10 @@ namespace SGalinski\SgNews\UserFunction; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ +use SGalinski\SgNews\Domain\Model\Author; +use SGalinski\SgNews\Domain\Repository\AuthorRepository; use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Domain\Model\FrontendUser; -use TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository; use TYPO3\CMS\Extbase\Object\ObjectManager; /** @@ -47,16 +47,15 @@ class AddAdditionalMailRecipients implements SingletonInterface { * @throws \InvalidArgumentException */ public function addAdditionalMailRecipients(): string { - $newsAuthorUid = (int) $this->cObj->data['tx_sgnews_author']; + $newsAuthorUid = (int) $this->cObj->data['tx_sgnews_news_author']; if ($newsAuthorUid > 0) { - /** @var ObjectManager $objectManager */ $objectManager = GeneralUtility::makeInstance(ObjectManager::class); - /** @var FrontendUserRepository $frontendUserRepository */ - $frontendUserRepository = $objectManager->get(FrontendUserRepository::class); - /** @var FrontendUser $frontendUser */ - $frontendUser = $frontendUserRepository->findByUid($newsAuthorUid); - if ($frontendUser) { - $email = $frontendUser->getEmail(); + $authorRepository = $objectManager->get(AuthorRepository::class); + + /** @var Author $author */ + $author = $authorRepository->findByUid($newsAuthorUid); + if ($author) { + $email = $author->getEmailAndRespectFrontendUser(); if (!empty($email)) { return $email; } diff --git a/Classes/Utility/BackendNewsUtility.php b/Classes/Utility/BackendNewsUtility.php index 26692db39235900117f84adbebf5dd4c6052427e..8a60e5309d3ee98659c68f2a3e03d227bea001ae 100644 --- a/Classes/Utility/BackendNewsUtility.php +++ b/Classes/Utility/BackendNewsUtility.php @@ -389,6 +389,7 @@ class BackendNewsUtility { ); } + // @todo adapt author if (isset($filters['search']) && trim($filters['search'])) { $expressions = [ $queryBuilder->expr()->like('p.title', $queryBuilder->createNamedParameter('%' . trim($filters['search']) . '%')), diff --git a/Classes/ViewHelpers/RenderAuthorNewsViewHelper.php b/Classes/ViewHelpers/RenderAuthorNewsViewHelper.php new file mode 100644 index 0000000000000000000000000000000000000000..d5980cc749bb0149745631557c49b4c7b4e83016 --- /dev/null +++ b/Classes/ViewHelpers/RenderAuthorNewsViewHelper.php @@ -0,0 +1,97 @@ +<?php + +namespace SGalinski\SgNews\ViewHelpers; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (http://www.sgalinski.de) + * + * All rights reserved + * + * This script is part of the AY project. The AY project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Extbase\Core\Bootstrap; +use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; + +/** + * Example: + * {namespace sgnews=SGalinski\SgNews\ViewHelpers} + * <sgnews:renderAuthorNews newsAuthors="123,321" excludedNews="123,423" /> + */ +class RenderAuthorNewsViewHelper extends AbstractViewHelper { + /** + * Extbase Bootstrap + * + * @var Bootstrap + */ + protected $bootstrap; + + /** + * @param Bootstrap $bootstrap + * @return void + */ + public function injectBootstrap(Bootstrap $bootstrap) { + $this->bootstrap = $bootstrap; + } + + /** + * CommentThreadViewHelper constructor. + */ + public function __construct() { + $this->escapeOutput = FALSE; + $this->escapeChildren = FALSE; + } + + /** + * Initialize arguments. + * + * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception + * @return void + * @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception + */ + public function initializeArguments() { + $this->registerArgument('newsAuthors', 'string', 'A list with author uids', TRUE); + $this->registerArgument('excludedNews', 'string', 'A list with excluded news uids'); + } + + /** + * Renders the Comment plugin. The view helper arguments configures the behavior. + * + * @return mixed + */ + public function render() { + $configuration = [ + 'extensionName' => 'SgNews', + 'vendorName' => 'SGalinski', + 'pluginName' => 'NewsByAuthor', + 'controllerName' => 'NewsByAuthor', + 'action' => 'list' + ]; + + if ($this->arguments['newsAuthors']) { + $configuration['settings']['newsAuthors'] = $this->arguments['newsAuthors']; + } + + if ($this->arguments['excludedNews']) { + $configuration['settings']['excludedNews'] = $this->arguments['excludedNews']; + } + + return $this->bootstrap->run('', $configuration); + } +} diff --git a/Configuration/FlexForms/NewsByAuthor.xml b/Configuration/FlexForms/NewsByAuthor.xml new file mode 100644 index 0000000000000000000000000000000000000000..14a87ebdae9740d11373b9c7d508ab32c4f98b69 --- /dev/null +++ b/Configuration/FlexForms/NewsByAuthor.xml @@ -0,0 +1,49 @@ +<T3DataStructure> + <meta> + <langDisable>1</langDisable> + </meta> + <sheets> + <main> + <ROOT> + <TCEforms> + <sheetTitle>LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm</sheetTitle> + </TCEforms> + <type>array</type> + <el> + <settings.newsAuthors> + <TCEforms> + <label>LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.newsAuthor</label> + <config> + <type>group</type> + <internal_type>db</internal_type> + <allowed>tx_sgnews_domain_model_author</allowed> + <size>5</size> + <minitems>1</minitems> + <maxitems>99</maxitems> + <wizards> + <suggest> + <type>suggest</type> + </suggest> + </wizards> + </config> + </TCEforms> + </settings.newsAuthors> + + <settings.excludedNews> + <TCEforms> + <label>LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.excludedNews</label> + <config> + <type>select</type> + <renderType>selectMultipleSideBySide</renderType> + <size>5</size> + <maxitems>99</maxitems> + <foreign_table>pages</foreign_table> + <foreign_table_where>AND pages.sys_language_uid IN (-1, 0) AND pages.doktype = 116 ORDER BY pages.title</foreign_table_where> + </config> + </TCEforms> + </settings.excludedNews> + </el> + </ROOT> + </main> + </sheets> +</T3DataStructure> diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php index 071d453a5abbc6bbb36a246225b2a7d7c9951cdc..33a3be90b3272ddc72cb688ba8b5129f63783582 100644 --- a/Configuration/TCA/Overrides/pages.php +++ b/Configuration/TCA/Overrides/pages.php @@ -69,7 +69,7 @@ call_user_func( --palette--;;standard, --palette--;;titleDescriptionAndHighlightFlag, --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.editorial;editorialWithNewsAuthor, - tx_sgnews_related_news, tx_sgnews_tags, + tx_sgnews_content_from_another_page, tx_sgnews_related_news, tx_sgnews_tags, --div--;' . $localLangDbPath . $table . '.tabs.images, tx_sgnews_teaser2_image, tx_sgnews_teaser1_image, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.tabs.metadata, @@ -212,14 +212,40 @@ call_user_func( $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] ), ], - 'tx_sgnews_author' => [ + 'tx_sgnews_news_author' => [ 'exclude' => TRUE, 'l10n_exclude' => TRUE, - 'label' => $localLangDbPath . $table . '.tx_sgnews_author', + 'label' => $localLangDbPath . $table . '.tx_sgnews_news_author', 'config' => [ 'type' => 'group', 'internal_type' => 'db', - 'allowed' => 'fe_users', + 'allowed' => 'tx_sgnews_domain_model_author', + 'size' => 1, + 'minitems' => 0, + 'maxitems' => 1, + 'items' => [ + ['', ''], + ], + 'wizards' => [ + 'suggest' => [ + 'type' => 'suggest', + ], + ], + 'fieldControl' => [ + 'addRecord' => [ + 'disabled' => FALSE, + ], + ], + ], + ], + 'tx_sgnews_content_from_another_page' => [ + 'exclude' => TRUE, + 'l10n_exclude' => TRUE, + 'label' => $localLangDbPath . $table . '.tx_sgnews_content_from_another_page', + 'config' => [ + 'type' => 'group', + 'internal_type' => 'db', + 'allowed' => 'pages', 'size' => 1, 'minitems' => 0, 'maxitems' => 1, @@ -360,10 +386,7 @@ call_user_func( ]; $GLOBALS['TCA'][$table]['palettes']['editorialWithNewsAuthor'] = [ - 'showitem' => 'tx_sgnews_author;' . $localLangDbPath . $table . '.tx_sgnews_author.inPalette, - --linebreak--, - author;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.author_formlabel, - author_email;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.author_email_formlabel, + 'showitem' => 'tx_sgnews_news_author, --linebreak--, lastUpdated;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.lastUpdated_formlabel, tx_sgnews_date_end, --linebreak--,tx_sgnews_likes,--linebreak--,tx_sgnews_location', @@ -407,6 +430,7 @@ call_user_func( 'tx_languagevisibility_visibility', 'lastUpdated', 'tx_sgnews_date_end', + 'tx_sgnews_content_from_another_page', ]) ) { $GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides'][$languageExcludeField]['l10n_mode'] = 'exclude'; diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index 324ce830397d469e462cf4a21600fc51f8544dd1..83565d6f7dd44cc0d04078a9f4f380d3c4d86d31 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -44,11 +44,18 @@ call_user_func( 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_backend.xlf:pageTypeTitlePluginCategory.news' ); + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( + $extKey, + 'NewsByAuthor', + 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_backend.xlf:newsFromAuthorPlugin' + ); + // Removal of the unused plugin setting fields $GLOBALS['TCA'][$table]['types']['list']['subtypes_excludelist']['sgnews_overview'] = 'select_key,pages,recursive'; $GLOBALS['TCA'][$table]['types']['list']['subtypes_excludelist']['sgnews_listbycategory'] = 'select_key,pages,recursive'; $GLOBALS['TCA'][$table]['types']['list']['subtypes_excludelist']['sgnews_latest'] = 'select_key,pages,recursive'; $GLOBALS['TCA'][$table]['types']['list']['subtypes_excludelist']['sgnews_singleview'] = 'select_key,pages,recursive'; + $GLOBALS['TCA'][$table]['types']['list']['subtypes_excludelist']['sgnews_newsbyauthor'] = 'select_key,pages,recursive'; // Flex form assignment $pluginSignature = str_replace('_', '', $extKey) . '_overview'; @@ -68,5 +75,11 @@ call_user_func( \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( $pluginSignature, 'FILE:EXT:' . $extKey . '/Configuration/FlexForms/Latest.xml' ); + + $pluginSignature = str_replace('_', '', $extKey) . '_newsbyauthor'; + $GLOBALS['TCA'][$table]['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform'; + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( + $pluginSignature, 'FILE:EXT:' . $extKey . '/Configuration/FlexForms/NewsByAuthor.xml' + ); }, 'sg_news', 'tt_content' ); diff --git a/Configuration/TCA/tx_sgnews_domain_model_author.php b/Configuration/TCA/tx_sgnews_domain_model_author.php new file mode 100644 index 0000000000000000000000000000000000000000..09488e350f3f032a7d2e49cabfd6f2936a47a6cb --- /dev/null +++ b/Configuration/TCA/tx_sgnews_domain_model_author.php @@ -0,0 +1,144 @@ +<?php +/** + * + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + */ + +return [ + 'ctrl' => [ + 'title' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:tx_sgnews_domain_model_author', + 'label' => 'frontend_user', + 'label_alt' => 'name, email', + 'label_alt_force' => TRUE, + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'cruser_id' => 'cruser_id', + 'searchFields' => 'name, email, frontend_user, description', + 'dividers2tabs' => TRUE, + 'delete' => 'deleted', + 'enablecolumns' => [ + 'disabled' => 'hidden', + ], + 'default_sortby' => 'crdate DESC', + 'iconfile' => 'EXT:sg_news/Resources/Public/Icons/module-sgnews.svg' + ], + 'interface' => [ + 'showRecordFieldList' => 'hidden, crdate, name, email, description, frontend_user, image', + ], + 'types' => [ + '1' => [ + 'showitem' => 'hidden;;1, frontend_user, --palette--;;authorInfos, description' + ], + ], + 'palettes' => [ + 'authorInfos' => [ + 'showitem' => 'name, email, --linebreak--, image', + 'canNotCollapse' => TRUE, + ], + ], + 'columns' => [ + 'pid' => [ + 'exclude' => FALSE, + 'label' => 'PID', + 'config' => [ + 'type' => 'none', + ] + ], + 'crdate' => [ + 'exclude' => FALSE, + 'label' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:tx_sgnews_domain_model_author.crdate', + 'config' => [ + 'type' => 'input', + 'max' => '20', + 'eval' => 'datetime', + 'default' => $GLOBALS['EXEC_TIME'], + ] + ], + 'hidden' => [ + 'exclude' => TRUE, + 'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:hidden.I.0', + 'config' => [ + 'type' => 'check', + ], + ], + 'frontend_user' => [ + 'exclude' => TRUE, + 'label' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:tx_sgnews_domain_model_author.frontend_user', + 'config' => [ + 'type' => 'group', + 'internal_type' => 'db', + 'maxitems' => 1, + 'size' => 1, + 'allowed' => 'fe_users', + 'wizards' => [ + 'suggest' => [ + 'type' => 'suggest', + ], + ], + ] + ], + 'name' => [ + 'displayCond' => 'FIELD:frontend_user:<=:0', + 'exclude' => FALSE, + 'label' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:tx_sgnews_domain_model_author.name', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ] + ], + 'email' => [ + 'displayCond' => 'FIELD:frontend_user:<=:0', + 'exclude' => FALSE, + 'label' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:tx_sgnews_domain_model_author.email', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ] + ], + 'description' => [ + 'exclude' => FALSE, + 'label' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:tx_sgnews_domain_model_author.description', + 'config' => [ + 'type' => 'text', + 'cols' => 30, + 'rows' => 10 + ] + ], + 'image' => [ + 'displayCond' => 'FIELD:frontend_user:<=:0', + 'exclude' => TRUE, + 'label' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:tx_sgnews_domain_model_author.image', + 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( + 'files', [ + 'appearance' => [ + 'useSortable' => TRUE, + ], + 'minitems' => 0, + 'maxitems' => 1, + ] + ), + ], + ] +]; diff --git a/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig b/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig index 03d1198f7e89038a21ea8cf8f46a355d2ea82206..33b27e6a07563038bdf364563777ef91bbee6976 100644 --- a/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig +++ b/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig @@ -31,6 +31,16 @@ mod { list_type = sgnews_listbycategory } } + + author { + iconIdentifier = sg_news-module + title = LLL:EXT:sg_news/Resources/Private/Language/locallang_backend.xlf:titleNewsByAuthorPlugin + description = LLL:EXT:sg_news/Resources/Private/Language/locallang_backend.xlf:titleNewsByAuthorPlugin + tt_content_defValues { + CType = list + list_type = sgnews_newsbyauthor + } + } } show = * } diff --git a/Configuration/TypoScript/Common/setup.typoscript b/Configuration/TypoScript/Common/setup.typoscript index 4b35b59e307ddc2e01989c09f4cd6571907ac046..5c5bbd5e8856d78a0652ddd92b6229e69143687a 100644 --- a/Configuration/TypoScript/Common/setup.typoscript +++ b/Configuration/TypoScript/Common/setup.typoscript @@ -9,13 +9,14 @@ config.tx_extbase { tx_sgnews_highlighted.mapOnProperty = highlighted tx_sgnews_never_highlighted.mapOnProperty = neverHighlighted tx_sgnews_related_news.mapOnProperty = relatedNews - tx_sgnews_author.mapOnProperty = authorFrontendUser + tx_sgnews_news_author.mapOnProperty = newsAuthor lastUpdated.mapOnProperty = lastUpdated crdate.mapOnProperty = creationDate tx_sgnews_teaser1_image.mapOnProperty = teaser1Image tx_sgnews_teaser2_image.mapOnProperty = teaser2Image tx_sgnews_tags.mapOnProperty = tags tx_sgnews_likes.mapOnProperty = likes + tx_sgnews_content_from_another_page.mapOnProperty = contentFromAnotherPage tx_sgnews_location.mapOnProperty = location tx_sgnews_date_end.mapOnProperty = dateEnd } diff --git a/Configuration/TypoScript/Frontend/setup.typoscript b/Configuration/TypoScript/Frontend/setup.typoscript index 30ea0cc19ef7b20203f005df01a25118960adfbd..4afb4dd8daea70e6f6cd7353704ed1d67fc3c76e 100644 --- a/Configuration/TypoScript/Frontend/setup.typoscript +++ b/Configuration/TypoScript/Frontend/setup.typoscript @@ -42,6 +42,16 @@ page.headerData { lib.mainContent < styles.content.get lib.mainContent.select.where = colPos=1 +lib.contentFromAnotherPage = CONTENT +lib.contentFromAnotherPage { + table = tt_content + select { + where = colPos=1 + pidInList = TEXT + pidInList.data = FIELD:tx_sgnews_content_from_another_page + } +} + plugin.tx_sgnews { view { templateRootPaths { diff --git a/Resources/Private/Language/de.locallang_backend.xlf b/Resources/Private/Language/de.locallang_backend.xlf index 547e8c36acdc49f4b764011c8e453351a6406503..c2c227e1e34665033e4e16a00a80d2f3cade9379 100644 --- a/Resources/Private/Language/de.locallang_backend.xlf +++ b/Resources/Private/Language/de.locallang_backend.xlf @@ -13,6 +13,10 @@ <source>Please upload an image first and save the form!</source> <target>Bitte lade zuerst ein Bild hoch und speichere anschließend das Formular!</target> </trans-unit> + <trans-unit id="newsFromAuthorPlugin" approved="yes"> + <source>[News] News from author</source> + <target>[News] News vom Author</target> + </trans-unit> <trans-unit id="pageType.category" approved="yes"> <source>Category</source> <target>Kategorie</target> @@ -29,6 +33,10 @@ <source>List News by Category/Tag.</source> <target>Liste News aus Kategorien/Tags</target> </trans-unit> + <trans-unit id="titleNewsByAuthorPlugin" approved="yes"> + <source>List News by Author.</source> + <target>Liste News vom Author</target> + </trans-unit> <trans-unit id="titleOverviewPlugin" approved="yes"> <source>News Overview</source> <target>News Übersicht</target> diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index 32d84d688e534dc014f0189b74d7883bddff90b1..afd03d0df98cd7a224e61e3351200b2f645ab449 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -29,13 +29,13 @@ <source><![CDATA[Pagetitle (automatically generated from Last Update + Headline)]]></source> <target><![CDATA[Seitentitel (automatisch generiert aus Letzte Aktualisierung + Schlagzeile)]]></target> </trans-unit> - <trans-unit id="pages.tx_sgnews_author" approved="yes"> + <trans-unit id="pages.tx_sgnews_news_author" approved="yes"> <source><![CDATA[Author]]></source> <target><![CDATA[Autor]]></target> </trans-unit> - <trans-unit id="pages.tx_sgnews_author.inPalette" approved="yes"> - <source><![CDATA[Author (use the free text field if the author not in the list)]]></source> - <target><![CDATA[Autor (benutze das Freitextfeld, falls der Autor nicht in der Liste ist)]]></target> + <trans-unit id="pages.tx_sgnews_content_from_another_page" approved="yes"> + <source><![CDATA[Show the content from another page]]></source> + <target><![CDATA[Zeige den Inhalt einer anderen Seite an]]></target> </trans-unit> <trans-unit id="pages.tx_sgnews_date_end" approved="yes"> <source><![CDATA[Date until]]></source> @@ -101,6 +101,14 @@ <source><![CDATA[Only show news published before]]></source> <target><![CDATA[Zeige nur News veröffentlicht vor]]></target> </trans-unit> + <trans-unit id="plugin.flexForm.excludedNews" approved="yes"> + <source><![CDATA[News which are excluded from the list]]></source> + <target><![CDATA[News, welche nicht in der Liste dargestellt werden]]></target> + </trans-unit> + <trans-unit id="plugin.flexForm.newsAuthor" approved="yes"> + <source><![CDATA[News Author]]></source> + <target><![CDATA[News Autor]]></target> + </trans-unit> <trans-unit id="plugin.flexForm.orderInPageTree" approved="yes"> <source><![CDATA[Order in pagetree]]></source> <target><![CDATA[Reihenfolge im Seitenbaum]]></target> @@ -189,6 +197,34 @@ <source><![CDATA[Include only news subpages of the page containing this overview]]></source> <target><![CDATA[Beachte nur News-Unterseiten der Seite, die diese Übersicht beinhaltet]]></target> </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author" approved="yes"> + <source><![CDATA[Author]]></source> + <target><![CDATA[Autor]]></target> + </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author.crdate" approved="yes"> + <source><![CDATA[Creation Date]]></source> + <target><![CDATA[Erstellungsdatum]]></target> + </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author.description" approved="yes"> + <source><![CDATA[Description]]></source> + <target><![CDATA[Beschreibung]]></target> + </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author.email" approved="yes"> + <source><![CDATA[Email]]></source> + <target><![CDATA[E-Mail]]></target> + </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author.frontend_user" approved="yes"> + <source><![CDATA[Frontend User (The other fields will be hidden, after selecting one)]]></source> + <target><![CDATA[Frontend-Benutzer (Die anderen Felder werden versteckt, wenn einer selektiert ist)]]></target> + </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author.image" approved="yes"> + <source><![CDATA[Image]]></source> + <target><![CDATA[Bild]]></target> + </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author.name" approved="yes"> + <source><![CDATA[Name]]></source> + <target><![CDATA[Name]]></target> + </trans-unit> </body> </file> -</xliff> \ No newline at end of file +</xliff> diff --git a/Resources/Private/Language/locallang_backend.xlf b/Resources/Private/Language/locallang_backend.xlf index 5591f890d5ed5eb997c44ed3f0387feff38e367b..999834fa84ee8abc3431bcbb3406b6a2233b78c4 100644 --- a/Resources/Private/Language/locallang_backend.xlf +++ b/Resources/Private/Language/locallang_backend.xlf @@ -12,6 +12,9 @@ <trans-unit id="coordinatePicker.missingImage"> <source>Please upload an image first and save the form!</source> </trans-unit> + <trans-unit id="newsFromAuthorPlugin"> + <source>[News] News from author</source> + </trans-unit> <trans-unit id="pageTypeTitlePlugin.news"> <source>[News] Plugins</source> </trans-unit> @@ -42,6 +45,9 @@ <trans-unit id="titleListByCategoryPlugin"> <source>News by Category/Tag</source> </trans-unit> + <trans-unit id="titleNewsByAuthorPlugin"> + <source>List News by Author.</source> + </trans-unit> <trans-unit id="descriptionListByCategoryPlugin"> <source>List news by category/tag</source> </trans-unit> diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 3a4b39ff0f0912d48b3ed1d707109823ed955845..71c34dcd8da4476c4ff6b322cf3b6b1c7eb1f9cd 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -24,11 +24,11 @@ <trans-unit id="pages.title"> <source><![CDATA[Pagetitle (automatically generated from Last Update + Headline)]]></source> </trans-unit> - <trans-unit id="pages.tx_sgnews_author"> - <source><![CDATA[Author]]></source> + <trans-unit id="pages.tx_sgnews_content_from_another_page"> + <source><![CDATA[Show the content from another page]]></source> </trans-unit> - <trans-unit id="pages.tx_sgnews_author.inPalette"> - <source><![CDATA[Author (use the free text field if the author not in the list)]]></source> + <trans-unit id="pages.tx_sgnews_news_author"> + <source><![CDATA[Author]]></source> </trans-unit> <trans-unit id="pages.tx_sgnews_date_end"> <source><![CDATA[Date until]]></source> @@ -78,6 +78,12 @@ <trans-unit id="plugin.flexForm.endtime"> <source><![CDATA[Only show news published before]]></source> </trans-unit> + <trans-unit id="plugin.flexForm.excludedNews"> + <source><![CDATA[News which are excluded from the list]]></source> + </trans-unit> + <trans-unit id="plugin.flexForm.newsAuthor"> + <source><![CDATA[News Author]]></source> + </trans-unit> <trans-unit id="plugin.flexForm.orderInPageTree"> <source><![CDATA[Order in pagetree]]></source> </trans-unit> @@ -144,6 +150,27 @@ <trans-unit id="plugin.overview.flexForm.onlyNewsWithinThisPageSection"> <source><![CDATA[Include only news subpages of the page containing this overview]]></source> </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author"> + <source><![CDATA[Author]]></source> + </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author.crdate"> + <source><![CDATA[Creation Date]]></source> + </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author.description"> + <source><![CDATA[Description]]></source> + </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author.email"> + <source><![CDATA[Email]]></source> + </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author.frontend_user"> + <source><![CDATA[Frontend User (The other fields will be hidden, after selecting one)]]></source> + </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author.image"> + <source><![CDATA[Image]]></source> + </trans-unit> + <trans-unit id="tx_sgnews_domain_model_author.name"> + <source><![CDATA[Name]]></source> + </trans-unit> </body> </file> -</xliff> \ No newline at end of file +</xliff> diff --git a/Resources/Private/Partials/SingleViewSchema.html b/Resources/Private/Partials/SingleViewSchema.html index 610362eae70f74088f8e8950c6d559d7cd5af1e5..e2e8276c19212170c95ae24855fa3c97195feff6 100644 --- a/Resources/Private/Partials/SingleViewSchema.html +++ b/Resources/Private/Partials/SingleViewSchema.html @@ -7,7 +7,7 @@ "@type": "WebPage", "@id": "<f:uri.page absolute="TRUE"/>" {rightBrace}, - "author": "{newsMetaData.news.author}", + "author": "{newsMetaData.news.newsAuthor.nameAndRespectFrontendUser}", "publisher": {leftBrace} "@type": "Organization", <f:if condition="{settings.publisher}"> diff --git a/Resources/Private/Partials/Teaser.html b/Resources/Private/Partials/Teaser.html index 9039a9c3389b360fe69b70138564c5ce4e3200d0..4b5f32cd3b35c404f15d9acbcc2788cb9fd363eb 100644 --- a/Resources/Private/Partials/Teaser.html +++ b/Resources/Private/Partials/Teaser.html @@ -44,14 +44,7 @@ <div class="tx-sgnews-teaser-meta"> <span class="author"> - <f:if condition="{newsMetaData.news.authorFrontendUser}"> - <f:then> - {newsMetaData.news.authorFrontendUser.name} - </f:then> - <f:else> - {newsMetaData.news.author} - </f:else> - </f:if> + {newsMetaData.news.newsAuthor.nameAndRespectFrontendUser} </span> <f:if condition="{newsMetaData.news.location}"> diff --git a/Resources/Private/Partials/TeaserOverview.html b/Resources/Private/Partials/TeaserOverview.html index 5b4c20cc517733922e8250357e8df3fc7fea409d..34e05e92513223463f06f469a8f4e1411db08ad1 100644 --- a/Resources/Private/Partials/TeaserOverview.html +++ b/Resources/Private/Partials/TeaserOverview.html @@ -37,21 +37,21 @@ <p class="text-center tx-sgnews-teaser-meta"> <span class="author"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="#FFF" d="M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"/></svg> - <f:if condition="{newsMetaData.news.authorFrontendUser}"> + <f:if condition="{newsMetaData.news.newsAuthor.frontendUser}"> <f:then> - <f:if condition="{newsMetaData.news.authorFrontendUser.www}"> + <f:if condition="{newsMetaData.news.newsAuthor.frontendUser.www}"> <f:then> - <f:link.page pageUid="{newsMetaData.news.authorFrontendUser.www}"> - {newsMetaData.news.authorFrontendUser.name} + <f:link.page pageUid="{newsMetaData.news.newsAuthor.frontendUser.www}"> + {newsMetaData.news.newsAuthor.frontendUser.name} </f:link.page> </f:then> <f:else> - {newsMetaData.news.authorFrontendUser.name} + {newsMetaData.news.newsAuthor.frontendUser.name} </f:else> </f:if> </f:then> <f:else> - {newsMetaData.news.author} + {newsMetaData.news.newsAuthor.nameAndRespectFrontendUser} </f:else> </f:if> </span> diff --git a/Resources/Private/Templates/NewsByAuthor/List.html b/Resources/Private/Templates/NewsByAuthor/List.html new file mode 100644 index 0000000000000000000000000000000000000000..f13993ffbda8013216364e9ba209174d4bb86dd8 --- /dev/null +++ b/Resources/Private/Templates/NewsByAuthor/List.html @@ -0,0 +1,34 @@ +<f:layout name="Default" /> + +{namespace sg=SGalinski\SgNews\ViewHelpers} +<f:section name="main"> + <f:render partial="ListByCategorySchema" arguments="{_all}" /> + <section class="content"> + <div class="container"> + <f:for each="{authors}" as="author"> + <div class="tx-sgnews-category-wrapper"> + <h2 class="tx-sgnews-category-title">{author.nameAndRespectFrontendUser}</h2> + + <section class="content"> + <div class="container tx-sgnews-categories"> + <ul class="tx-sgnews-list tx-sgnews-list-0 row" data-record="0"> + <f:for each="{newsMetaData}" as="newsMetaDataEntry"> + <f:if condition="{newsMetaDataEntry.news.newsAuthor} === {author}"> + <li class="col-md-4 col-sm-6 col-xs-12"> + <f:render partial="Teaser" arguments="{ + newsMetaData: newsMetaDataEntry, + headerTag: '<h2>', + closingHeaderTag: '</h2>', + showCategory: 1 + }" /> + </li> + </f:if> + </f:for> + </ul> + </div> + </section> + </div> + </f:for> + </div> + </section> +</f:section> diff --git a/Resources/Private/Templates/SingleView/SingleView.html b/Resources/Private/Templates/SingleView/SingleView.html index 961fbb8226e8f08945fbb1ad8d4b8d444f40c013..8749276fa3a12b2e06387e95ddff4206fc26ff29 100644 --- a/Resources/Private/Templates/SingleView/SingleView.html +++ b/Resources/Private/Templates/SingleView/SingleView.html @@ -26,26 +26,26 @@ <div class="tx-sgnews-teaser"> <div class="tx-sgnews-teaser-inner"> <div class="tx-sgnews-teaser-meta"> - <f:if condition="{newsMetaData.news.authorFrontendUser}"> + <f:if condition="{newsMetaData.news.newsAuthor.frontendUser}"> <f:then> <span class="author"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="#FFF" d="M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z" /></svg> - <f:if condition="{newsMetaData.news.authorFrontendUser.www}"> + <f:if condition="{newsMetaData.news.newsAuthor.frontendUser.www}"> <f:then> - <f:link.page pageUid="{newsMetaData.news.authorFrontendUser.www}"> - {newsMetaData.news.authorFrontendUser.name} + <f:link.page pageUid="{newsMetaData.news.newsAuthor.frontendUser.www}"> + {newsMetaData.news.newsAuthor.frontendUser.name} </f:link.page> </f:then> <f:else> - {newsMetaData.news.authorFrontendUser.name} + {newsMetaData.news.newsAuthor.frontendUser.name} </f:else> </f:if> </span> </f:then> - <f:else if="{newsMetaData.news.author}"> + <f:else if="{newsMetaData.news.newsAuthor.nameAndRespectFrontendUser}"> <span class="author"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="#FFF" d="M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z" /></svg> - {newsMetaData.news.author} + {newsMetaData.news.newsAuthor.nameAndRespectFrontendUser} </span> </f:else> </f:if> @@ -88,7 +88,7 @@ <div class="container"> <div class="tx-sgnews-single"> <div class="tx-sgnews-single-container"> - <f:alias map="{content: '{f:cObject(typoscriptObjectPath: \'lib.mainContent\')}'}"> + <f:alias map="{content: '{f:cObject(typoscriptObjectPath: \'{f:if(condition: \\\'{newsMetaData.news.contentFromAnotherPage}\\\', then: \\\'lib.contentFromAnotherPage\\\', else: \\\'lib.mainContent\\\')}\')}'}"> <div class="tx-sgnews-single-content"> <p> <a href="#comments">{f:cObject(typoscriptObjectPath: "lib.sgCommentsGetCountWithLabel")}</a> diff --git a/composer.json b/composer.json index 4a632d219778efd68419df2bceb4002d63467103..6a51c9ae97fd3a328b667928394b7bcca2154e89 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "license": [ "GPL-2.0-or-later" ], - "version": "7.0.8", + "version": "8.1.0", "support": { }, "repositories": [ diff --git a/ext_emconf.php b/ext_emconf.php index 3b6ce4d2165b1ce91448acca6d3a91d67d0701d5..aed3789609604b68667f90db25ae61f8b2a25a14 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -19,7 +19,7 @@ $EM_CONF[$_EXTKEY] = [ 'modify_tables' => '', 'clearCacheOnLoad' => 0, 'lockType' => '', - 'version' => '7.0.8', + 'version' => '8.1.0', 'constraints' => [ 'depends' => [ 'typo3' => '8.7.0-9.5.99', diff --git a/ext_localconf.php b/ext_localconf.php index e28cc8f162ba3be0fe15cf947f61d3e2e85496f7..e6a6b470783b81fa03876e2d5f11b6a5a18f8a24 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -81,6 +81,13 @@ call_user_func( ['PageBrowser' => '',] ); + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'SGalinski.' . $extKey, + 'NewsByAuthor', + ['NewsByAuthor' => 'list',], + ['NewsByAuthor' => '',] + ); + if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('sg_ajax')) { \SGalinski\SgAjax\Service\AjaxRegistration::configureAjaxFrontendPlugin( $extKey, [ diff --git a/ext_tables.php b/ext_tables.php index 8437913b05fb14d4529473be8c6966d04e8bcdc1..0d7d12fd1292fc0084b3e626821d56129b77281e 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -26,6 +26,10 @@ call_user_func( function ($extKey) { + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages( + 'tx_sgnews_domain_model_author' + ); + if (TYPO3_MODE === 'BE') { $navigationComponentId = 'TYPO3/CMS/Backend/PageTree/PageTreeElement'; if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) { diff --git a/ext_tables.sql b/ext_tables.sql index 0570ef3596fe795755dff0af240de3b760dd0ea4..281c1ba3ab8db93e8df5929ac45d5fc8229bd243 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -1,5 +1,5 @@ CREATE TABLE pages ( - tx_sgnews_author int(11) unsigned DEFAULT '0' NOT NULL, + tx_sgnews_news_author int(11) unsigned DEFAULT '0' NOT NULL, tx_sgnews_related_news varchar(255) DEFAULT '' NOT NULL, tx_sgnews_highlighted tinyint(4) unsigned DEFAULT '0' NOT NULL, tx_sgnews_never_highlighted tinyint(4) unsigned DEFAULT '0' NOT NULL, @@ -8,9 +8,10 @@ CREATE TABLE pages ( tx_sgnews_tags int(11) unsigned DEFAULT '0' NOT NULL, tx_sgnews_likes int(11) unsigned DEFAULT '0' NOT NULL, tx_sgnews_location mediumtext, - tx_sgnews_date_end int(10) unsigned DEFAULT '0' NOT NULL, + tx_sgnews_date_end int(10) unsigned DEFAULT '0' NOT NULL, + tx_sgnews_content_from_another_page int(11) unsigned DEFAULT '0' NOT NULL, - KEY author (tx_sgnews_author) + KEY news_author (tx_sgnews_news_author) ); CREATE TABLE pages_language_overlay ( @@ -18,3 +19,26 @@ CREATE TABLE pages_language_overlay ( tx_sgnews_teaser2_image int(11) unsigned DEFAULT '0' NOT NULL, tx_sgnews_location mediumtext ); + +CREATE TABLE tx_sgnews_domain_model_author ( + uid int(11) NOT NULL auto_increment, + pid int(11) DEFAULT '0' NOT NULL, + + -- Custom fields + name varchar(255) DEFAULT '' NOT NULL, + email varchar(255) DEFAULT '' NOT NULL, + description text, + frontend_user int(11) unsigned DEFAULT '0' NOT NULL, + image int(11) unsigned DEFAULT '0', + + -- TYPO3 fields + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + cruser_id int(11) unsigned DEFAULT '0' NOT NULL, + deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, + hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, + + PRIMARY KEY (uid), + KEY parent (pid), + KEY frontend_user (frontend_user) +);