diff --git a/Classes/Controller/BackendController.php b/Classes/Controller/BackendController.php index 059f328f917632314740b6211704651dd270517a..a2eda26202bad9025efc5139d431b6927d47a497 100644 --- a/Classes/Controller/BackendController.php +++ b/Classes/Controller/BackendController.php @@ -29,6 +29,7 @@ namespace SGalinski\SgNews\Controller; use SGalinski\SgNews\Service\LicensingService; use SGalinski\SgNews\Utility\BackendNewsUtility; use TYPO3\CMS\Backend\Clipboard\Clipboard; +use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Backend\Template\Components\ButtonBar; use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent; use TYPO3\CMS\Backend\Utility\BackendUtility; @@ -257,12 +258,13 @@ class BackendController extends ActionController { $languageMenu = $this->docHeaderComponent->getMenuRegistry()->makeMenu(); $languageMenu->setIdentifier('languageMenu'); $languages = BackendNewsUtility::getAvailableLanguages($this->pageUid); + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); foreach ($languages as $key => $language) { $menuItem = $languageMenu ->makeMenuItem() ->setTitle($language['title']) ->setHref( - BackendUtility::getModuleUrl('web_SgNewsNews') . '&id=' . $this->pageUid . '&SET[language]=' . $key + $uriBuilder->buildUriFromRoute('web_SgNewsNews', [ 'id' => $this->pageUid, 'SET' => ['language' => $key]]) ); if ((int) $this->language === (int) $key) { $menuItem->setActive(TRUE); diff --git a/Classes/Hooks/PageLayoutView/PluginRenderer.php b/Classes/Hooks/PageLayoutView/PluginRenderer.php new file mode 100644 index 0000000000000000000000000000000000000000..f0866bcd2203a84f72af039074ec707b8580679b --- /dev/null +++ b/Classes/Hooks/PageLayoutView/PluginRenderer.php @@ -0,0 +1,264 @@ +<?php + +namespace SGalinski\SgNews\Hooks\PageLayoutView; + +/*************************************************************** + * 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\Backend\Utility\BackendUtility; +use TYPO3\CMS\Backend\View\PageLayoutView; +use TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface; +use TYPO3\CMS\Core\Localization\LanguageService; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Fluid\View\StandaloneView; + +/** + * Class PluginRenderer + * + * @package SGalinski\SgNews\Hook\PagelayoutView\PluginRenderer + */ +class PluginRenderer implements PageLayoutViewDrawItemHookInterface { + + /** + * Preprocesses the preview rendering of an sg_news content element plugin. + * + * @param PageLayoutView $parentObject Calling parent object + * @param bool $drawItem Whether to draw the item using the default functionalities + * @param string $headerContent Header content + * @param string $itemContent Item content + * @param array $row Record row of tt_content + * @noinspection ReferencingObjectsInspection + */ + public function preProcess( + PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row + ): void { + switch ($row['list_type']) { + case 'sgnews_overview': + $drawItem = FALSE; + + $view = $this->createViewWithTemplate('Overview'); + $view->assign('uid', $row['uid']); + + $this->adaptPluginHeaderContent($headerContent, $row); + + // Get available plugin settings and their values from flexform + $pluginConfiguration = GeneralUtility::xml2array( + $row['pi_flexform'], 'T3DataStructure' + )['data']['main']['lDEF']; + + $templateData = [ + 'groupBy' => $pluginConfiguration['settings.groupBy']['vDEF'], + 'enableFilter' => $pluginConfiguration['settings.enableFilter']['vDEF'], + 'newsLimit' => $pluginConfiguration['settings.newsLimit']['vDEF'], + 'onlyNewsWithinThisPageSection' => $pluginConfiguration['settings.onlyNewsWithinThisPageSection']['vDEF'], + 'starttime' => $pluginConfiguration['settings.starttime']['vDEF'], + 'endtime' => $pluginConfiguration['settings.endtime']['vDEF'], + 'sortBy' => $pluginConfiguration['settings.sortBy']['vDEF'], + 'sortDirection' => $pluginConfiguration['settings.sortDirection']['vDEF'] + ]; + + $view->assign('data', $templateData); + + $itemContent .= $view->render(); + break; + + case 'sgnews_latest': + $drawItem = FALSE; + + $view = $this->createViewWithTemplate('Latest'); + $view->assign('uid', $row['uid']); + + $this->adaptPluginHeaderContent($headerContent, $row); + + // Get available plugin settings and their values from flexform + $pluginConfiguration = GeneralUtility::xml2array( + $row['pi_flexform'], 'T3DataStructure' + )['data']['main']['lDEF']; + + $templateData = [ + 'limit' => $pluginConfiguration['settings.limit']['vDEF'], + 'categories' => $this->addFieldContentsToRecordIdList( + 'pages', $pluginConfiguration['settings.categories']['vDEF'] ?? '' + ), + 'tags' => $this->addFieldContentsToRecordIdList( + 'sys_category', $pluginConfiguration['settings.tags']['vDEF'] ?? '' + ), + 'starttime' => $pluginConfiguration['settings.starttime']['vDEF'], + 'endtime' => $pluginConfiguration['settings.endtime']['vDEF'], + 'sortBy' => $pluginConfiguration['settings.sortBy']['vDEF'] + ]; + + $view->assign('data', $templateData); + + $itemContent .= $view->render(); + break; + + case 'sgnews_listbycategory': + $drawItem = FALSE; + + $view = $this->createViewWithTemplate('ListByCategory'); + $view->assign('uid', $row['uid']); + + $this->adaptPluginHeaderContent($headerContent, $row); + + // Get available plugin settings and their values from flexform + $pluginConfiguration = GeneralUtility::xml2array( + $row['pi_flexform'], 'T3DataStructure' + )['data']['main']['lDEF']; + + $templateData = [ + 'newsLimitPerPage' => $pluginConfiguration['settings.newsLimitPerPage']['vDEF'], + 'categories' => $this->addFieldContentsToRecordIdList( + 'pages', $pluginConfiguration['settings.categories']['vDEF'] + ), + 'tags' => $this->addFieldContentsToRecordIdList( + 'sys_category', $pluginConfiguration['settings.tags']['vDEF'] + ), + 'starttime' => $pluginConfiguration['settings.starttime']['vDEF'], + 'endtime' => $pluginConfiguration['settings.endtime']['vDEF'], + 'sortBy' => $pluginConfiguration['settings.sortBy']['vDEF'], + 'sortDirection' => $pluginConfiguration['settings.sortDirection']['vDEF'] + ]; + + $view->assign('data', $templateData); + + $itemContent .= $view->render(); + break; + + case 'sgnews_newsbyauthor': + $drawItem = FALSE; + + $view = $this->createViewWithTemplate('NewsByAuthor'); + $view->assign('uid', $row['uid']); + + $this->adaptPluginHeaderContent($headerContent, $row); + + // Get available plugin settings and their values from flexform + $pluginConfiguration = GeneralUtility::xml2array( + $row['pi_flexform'], 'T3DataStructure' + )['data']['main']['lDEF']; + + $templateData = [ + 'showDetails' => $pluginConfiguration['settings.showDetails']['vDEF'], + 'newsAuthors' => $this->addFieldContentsToRecordIdList( + 'tx_sgnews_domain_model_author', + $pluginConfiguration['settings.newsAuthors']['vDEF'], + 'name' + ) + ]; + + $backendUtility = GeneralUtility::makeInstance(BackendUtility::class); + $excludedNewsIds = GeneralUtility::intExplode( + ',', $pluginConfiguration['settings.excludedNews']['vDEF'], TRUE + ); + $excludedNewsListWithTitles = []; + foreach ($excludedNewsIds as $excludedNewsId) { + $excludedNewsListWithTitles[] = $backendUtility::getRecord( + 'pages', $excludedNewsId, 'title' + )['title'] . ' [' . $excludedNewsId . ']'; + } + $templateData['excludedNews'] = $excludedNewsListWithTitles; + + $view->assign('data', $templateData); + + $itemContent .= $view->render(); + break; + + default: + // No need to do anything + } + } + + /** + * Creates a new StandaloneView object with template and partial rot paths, + * attaches the template with the given name to it and returns it. + * + * @param string $templateName + * @return StandaloneView + */ + protected + function createViewWithTemplate(string $templateName): StandaloneView { + $view = GeneralUtility::makeInstance(StandaloneView::class); + $view->setTemplateRootPaths(['EXT:sg_news/Resources/Private/Templates/Backend']); + $view->setPartialRootPaths(['EXT:sg_news/Resources/Private/Partials/Backend']); + if (!str_ends_with($templateName, '.html')) { + $templateName .= '.html'; + } + $view->setTemplate($templateName); + return $view; + } + + /** + * Adapts the given $headerContent. + * To be used in all plugin previews so the Header Contents appear similarly. + * + * @param $headerContent + * @param $row + */ + protected + function adaptPluginHeaderContent(&$headerContent, $row): void { + $headerContent = '<h4>' . $this->getPluginNameForHeaderContent( + (int) $row['pid'], $row['list_type'] + ) . $headerContent . '</h4>'; + } + + /** + * Finds the label of the given $listType element on the page with the given $pid + * and returns it wrapped for use in the backend preview's header content. + * + * @param int $pid + * @param string $listType + * @return string + */ + protected + function getPluginNameForHeaderContent(int $pid, string $listType): string { + $languageService = GeneralUtility::makeInstance(LanguageService::class); + + $pluginName = $languageService->sL( + BackendUtility::getLabelFromItemListMerged( + $pid, 'tt_content', 'list_type', $listType + ) + ); + return '<span class="label label-info">' . $pluginName . '</span> '; + } + + /** + * Takes a comma-separated list of record IDs, the corresponding table and optionally the field to look up. + * Returns another comma-space-separated list of the same records with the content of the field added. + * The returned list should look nice enough to be rendered in the backend preview directly. + * + * @param string $table + * @param string $recordIdList + * @param string $field + * @return string + */ + protected function addFieldContentsToRecordIdList( + string $table, string $recordIdList, string $field = 'title' + ): string { + $backendUtility = GeneralUtility::makeInstance(BackendUtility::class); + $recordIdsArray = GeneralUtility::intExplode(',', $recordIdList, TRUE); + $recordsWithTitlesArray = []; + + foreach ($recordIdsArray as $recordId) { + $recordsWithTitlesArray[] = $backendUtility::getRecord( + $table, $recordId, $field + )[$field] . ' [' . $recordId . ']'; + } + return implode(', ', $recordsWithTitlesArray); + } +} diff --git a/Classes/ViewHelpers/Backend/EditOnClickViewHelper.php b/Classes/ViewHelpers/Backend/EditOnClickViewHelper.php deleted file mode 100644 index 2d3cbb0d57a1ebe15c913922a3c2f78fdc5257db..0000000000000000000000000000000000000000 --- a/Classes/ViewHelpers/Backend/EditOnClickViewHelper.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php - -namespace SGalinski\SgNews\ViewHelpers\Backend; - -/*************************************************************** - * 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\Utility\BackendNewsUtility; -use SGalinski\SgNews\ViewHelpers\AbstractViewHelper; -use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; -use TYPO3\CMS\Backend\Routing\UriBuilder; -use TYPO3\CMS\Core\Utility\ArrayUtility; -use TYPO3\CMS\Core\Utility\GeneralUtility; - -/** - * Class EditOnClickViewHelper - **/ -class EditOnClickViewHelper extends AbstractViewHelper { - - /** - * Register the ViewHelper arguments - */ - public function initializeArguments() { - parent::initializeArguments(); - $this->registerArgument('table', 'string', 'The table for the clickenlarge link', TRUE); - $this->registerArgument('uid', 'int', 'The uid of the record to clickenlarge', TRUE); - $this->registerArgument('new', 'bool', 'Open a new record in the popup', FALSE, FALSE); - $this->registerArgument('type', 'string', 'The type of the news', FALSE, ''); - } - - /** - * Renders the onclick script for editing a record - * - * @return string - */ - public function render(): string { - $additionalParameters = []; - if ($this->arguments['new'] && $this->arguments['table'] === 'pages' && in_array($this->arguments['type'], ['news', 'category'], TRUE)) { - $additionalParameters = [ - 'overrideVals' => - [ - 'pages' => - [ - 'doktype' => $this->arguments['type'] === 'news' ? BackendNewsUtility::NEWS_DOKTYPE : BackendNewsUtility::CATEGORY_DOKTYPE - ] - ] - ]; - } - $parameters = [ - 'edit' => [ - $this->arguments['table'] => [ - $this->arguments['uid'] => [ - $this->arguments['new'] ? 'new' : 'edit' - ] - ] - ], - 'returnUrl' => rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) - ]; - ArrayUtility::mergeRecursiveWithOverrule($parameters, $additionalParameters); - try { - return GeneralUtility::makeInstance(UriBuilder::class)->buildUriFromRoute( - 'record_edit', - $parameters - ); - } catch (RouteNotFoundException $exception) { - return ''; - } - } -} diff --git a/Classes/ViewHelpers/Backend/Link/NewRecordViewHelper.php b/Classes/ViewHelpers/Backend/Link/NewRecordViewHelper.php new file mode 100644 index 0000000000000000000000000000000000000000..6fce666ac733b9091d855fbfb781ee0d8ff3678e --- /dev/null +++ b/Classes/ViewHelpers/Backend/Link/NewRecordViewHelper.php @@ -0,0 +1,135 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ + +namespace SGalinski\SgNews\ViewHelpers\Backend\Link; + +use SGalinski\SgNews\Utility\BackendNewsUtility; +use TYPO3\CMS\Backend\Routing\UriBuilder; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper; + +/** + * Use this ViewHelper to provide 'create new record' links. + * The ViewHelper will pass the command to FormEngine. + * + * The table argument is mandatory, it decides what record is to be created. + * + * The pid argument will put the new record on this page, if ``0`` given it will + * be placed to the root page. + * + * The uid argument accepts only negative values. If this is given, the new + * record will be placed (by sorting field) behind the record with the uid. + * It will end up on the same pid as this given record, so the pid must not + * be given explicitly by pid argument. + * + * An exception will be thrown, if both uid and pid are given. + * An exception will be thrown, if the uid argument is not a negative integer. + * + * To edit records, use the :ref:`<be:link.editRecordViewHelper> <typo3-backend-link-editrecord>`. + * + * Examples + * ======== + * + * Link to create a new record of a_table after record 17 on the same pid:: + * + * <be:link.newRecord table="a_table" returnUrl="foo/bar" uid="-17"/> + * + * Output:: + * + * <a href="/typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar"> + * Edit record + * </a> + * + * Link to create a new record of a_table on root page:: + * + * <be:link.newRecord table="a_table" returnUrl="foo/bar""/> + * + * Output:: + * + * <a href="/typo3/index.php?route=/record/edit&edit[a_table][]=new&returnUrl=foo/bar"> + * Edit record + * </a> + * + * Link to create a new record of a_table on page 17:: + * + * <be:link.newRecord table="a_table" returnUrl="foo/bar" pid="17"/> + * + * Output:: + * + * <a href="/typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar"> + * Edit record + * </a> + * + * Link to create a new record then return back to the BE module "web_MyextensionList":: + * + * <be:link.newRecord table="a_table" returnUrl="{f:be.uri(route: 'web_MyextensionList')}" pid="17"> + */ +class NewRecordViewHelper extends AbstractTagBasedViewHelper +{ + /** + * @var string + */ + protected $tagName = 'a'; + + public function initializeArguments() + { + parent::initializeArguments(); + $this->registerUniversalTagAttributes(); + $this->registerArgument('uid', 'int', 'uid < 0 will insert the record after the given uid', false); + $this->registerArgument('pid', 'int', 'the page id where the record will be created', false); + $this->registerArgument('table', 'string', 'target database table', true); + $this->registerArgument('type', 'string', 'The type of the news', true); + $this->registerArgument('returnUrl', 'string', 'return to this URL after closing the edit dialog', false, ''); + } + + /** + * @return string + * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException + */ + public function render(): string + { + if ($this->arguments['uid'] && $this->arguments['pid']) { + throw new \InvalidArgumentException('Can\'t handle both uid and pid for new records', 1526129969); + } + if (isset($this->arguments['uid']) && $this->arguments['uid'] >= 0) { + throw new \InvalidArgumentException('Uid must be negative integer, ' . $this->arguments['uid'] . ' given', 1526134901); + } + + if (empty($this->arguments['returnUrl'])) { + $this->arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI'); + } + + $params = [ + 'edit' => [$this->arguments['table'] => [$this->arguments['uid'] ?? $this->arguments['pid'] ?? 0 => 'new']], + 'returnUrl' => $this->arguments['returnUrl'] + ]; + if ($this->arguments['table'] === 'pages' && in_array($this->arguments['type'], ['news', 'category'], TRUE)) { + $params['overrideVals'] = [ + 'pages' => [ + 'doktype' => $this->arguments['type'] === 'news' ? BackendNewsUtility::NEWS_DOKTYPE : BackendNewsUtility::CATEGORY_DOKTYPE + ] + ]; + } + + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $uri = (string)$uriBuilder->buildUriFromRoute('record_edit', $params); + $this->tag->addAttribute('href', $uri); + $this->tag->setContent($this->renderChildren()); + $this->tag->forceClosingTag(true); + return $this->tag->render(); + } +} diff --git a/Resources/Private/Language/de.locallang_backend.xlf b/Resources/Private/Language/de.locallang_backend.xlf index c2c227e1e34665033e4e16a00a80d2f3cade9379..84fb9572271fc163b3944f1f35845f63a5870ac6 100644 --- a/Resources/Private/Language/de.locallang_backend.xlf +++ b/Resources/Private/Language/de.locallang_backend.xlf @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <xliff version="1.0"> - <file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2014-03-18T12:47:57Z"> + <file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2020-07-17T15:32:34Z"> <header> <type>module</type> <description>Language labels for the backend module belonging to extension 'sg_news'</description> @@ -9,74 +9,90 @@ <authorEmail>stefan@sgalinski.de</authorEmail> </header> <body> + <trans-unit id="backend.plugin.preview.settings" approved="yes"> + <source><![CDATA[Settings]]></source> + <target><![CDATA[Einstellungen]]></target> + </trans-unit> + <trans-unit id="backend.plugin.preview.values" approved="yes"> + <source><![CDATA[Values]]></source> + <target><![CDATA[Werte]]></target> + </trans-unit> <trans-unit id="coordinatePicker.missingImage" approved="yes"> - <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> + <source><![CDATA[Please upload an image first and save the form!]]></source> + <target><![CDATA[Bitte lade zuerst ein Bild hoch und speichere anschließend das Formular!]]></target> + </trans-unit> + <trans-unit id="descriptionLatestPlugin" approved="yes"> + <source><![CDATA[Show latest news.]]></source> + <target><![CDATA[Zeige die neuesten News.]]></target> + </trans-unit> + <trans-unit id="descriptionListByCategoryPlugin" approved="yes"> + <source><![CDATA[List news by category/tag]]></source> + <target><![CDATA[Eine Liste der News aus Kategorien/Tags.]]></target> + </trans-unit> + <trans-unit id="descriptionOverviewPlugin" approved="yes"> + <source><![CDATA[Show an overview of all news.]]></source> + <target><![CDATA[Übersicht der News.]]></target> + </trans-unit> + <trans-unit id="descriptionSingleViewPlugin" approved="yes"> + <source><![CDATA[Show a single view of news.]]></source> + <target><![CDATA[Zeige eine Einzelansicht der News.]]></target> </trans-unit> <trans-unit id="newsFromAuthorPlugin" approved="yes"> - <source>[News] News from author</source> - <target>[News] News vom Author</target> + <source><![CDATA[[News] News from author]]></source> + <target><![CDATA[[News] News vom Author]]></target> </trans-unit> <trans-unit id="pageType.category" approved="yes"> - <source>Category</source> - <target>Kategorie</target> + <source><![CDATA[Category]]></source> + <target><![CDATA[Kategorie]]></target> </trans-unit> <trans-unit id="pageType.news" approved="yes"> - <source>News</source> - <target>News</target> - </trans-unit> - <trans-unit id="titleLatestPlugin" approved="yes"> - <source>Latest News</source> - <target>Neueste News</target> - </trans-unit> - <trans-unit id="titleListByCategoryPlugin" approved="yes"> - <source>List News by Category/Tag.</source> - <target>Liste News aus Kategorien/Tags</target> + <source><![CDATA[News]]></source> + <target><![CDATA[News]]></target> </trans-unit> - <trans-unit id="titleNewsByAuthorPlugin" approved="yes"> - <source>List News by Author.</source> - <target>Liste News vom Author</target> + <trans-unit id="pageTypeTitlePluginCategory.news" approved="yes"> + <source><![CDATA[[News] News by Category]]></source> + <target><![CDATA[[News] News aus Kategorien]]></target> </trans-unit> - <trans-unit id="titleOverviewPlugin" approved="yes"> - <source>News Overview</source> - <target>News Übersicht</target> + <trans-unit id="pageTypeTitlePluginLatest.news" approved="yes"> + <source><![CDATA[[News] News Latest]]></source> + <target><![CDATA[[News] Neueste News]]></target> </trans-unit> - <trans-unit id="titleSingleViewPlugin" approved="yes"> - <source>News Single View</source> - <target>News Einzelansicht</target> + <trans-unit id="pageTypeTitlePluginOverview.news" approved="yes"> + <source><![CDATA[[News] News Overview]]></source> + <target><![CDATA[[News] News Übersicht]]></target> </trans-unit> - <trans-unit id="descriptionLatestPlugin"> - <source>Show latest news.</source> - <target>Zeige die neuesten News.</target> + <trans-unit id="pageTypeTitlePluginSingle.news" approved="yes"> + <source><![CDATA[[News] News Single View]]></source> + <target><![CDATA[[News] News Einzelansicht]]></target> </trans-unit> - <trans-unit id="descriptionListByCategoryPlugin"> - <source>List news by category/tag.</source> - <target>Eine Liste der News aus Kategorien/Tags.</target> + <trans-unit id="plugin.preview.latest.categories" approved="yes"> + <source><![CDATA[Only show news from these categories]]></source> + <target><![CDATA[Zeige nur News dieser Kategorien]]></target> </trans-unit> - <trans-unit id="descriptionOverviewPlugin"> - <source>Show an overview of all news.</source> - <target>Übersicht der News.</target> + <trans-unit id="plugin.preview.latest.tags" approved="yes"> + <source><![CDATA[Only show news with these tags]]></source> + <target><![CDATA[Zeige nur News mit diesen Tags]]></target> </trans-unit> - <trans-unit id="descriptionSingleViewPlugin"> - <source>Show a single view of news.</source> - <target>Zeige eine Einzelansicht der News.</target> + <trans-unit id="titleLatestPlugin" approved="yes"> + <source><![CDATA[Latest News]]></source> + <target><![CDATA[Neueste News]]></target> </trans-unit> - <trans-unit id="pageTypeTitlePluginOverview.news"> - <source>[News] News Overview</source> - <target>[News] News Übersicht</target> + <trans-unit id="titleListByCategoryPlugin" approved="yes"> + <source><![CDATA[News by Category/Tag]]></source> + <target><![CDATA[Liste News aus Kategorien/Tags]]></target> </trans-unit> - <trans-unit id="pageTypeTitlePluginLatest.news"> - <source>[News] News Latest</source> - <target>[News] Neueste News</target> + <trans-unit id="titleNewsByAuthorPlugin" approved="yes"> + <source><![CDATA[List News by Author.]]></source> + <target><![CDATA[Liste News vom Author]]></target> </trans-unit> - <trans-unit id="pageTypeTitlePluginCategory.news"> - <source>[News] News by Category</source> - <target>[News] News aus Kategorien</target> + <trans-unit id="titleOverviewPlugin" approved="yes"> + <source><![CDATA[News Overview]]></source> + <target><![CDATA[News Übersicht]]></target> </trans-unit> - <trans-unit id="pageTypeTitlePluginSingle.news"> - <source>[News] News Single View</source> - <target>[News] News Einzelansicht</target> + <trans-unit id="titleSingleViewPlugin" approved="yes"> + <source><![CDATA[News Single View]]></source> + <target><![CDATA[News Einzelansicht]]></target> </trans-unit> </body> </file> -</xliff> +</xliff> \ No newline at end of file diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index dac5668978aca057ebfa3a33bf42ef3fc8406dc6..1e2734a9ce2c39fe53d5dc12b660421f4bf0c7e1 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <xliff version="1.0"> - <file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2019-06-21T20:03:43Z"> + <file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2020-07-17T15:31:49Z"> <header> <type>database</type> <description>Language labels for database tables/fields belonging to extension 'sg_news'</description> @@ -29,10 +29,6 @@ <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_news_author" approved="yes"> - <source><![CDATA[Author]]></source> - <target><![CDATA[Autor]]></target> - </trans-unit> <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> @@ -61,6 +57,10 @@ <source><![CDATA[Don't show in "Latest News"]]></source> <target><![CDATA[Nicht in "letzten News" anzeigen]]></target> </trans-unit> + <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_related_news" approved="yes"> <source><![CDATA[Related Elements]]></source> <target><![CDATA[Verwandte Elemente]]></target> @@ -235,4 +235,4 @@ </trans-unit> </body> </file> -</xliff> +</xliff> \ No newline at end of file diff --git a/Resources/Private/Language/locallang_backend.xlf b/Resources/Private/Language/locallang_backend.xlf index 999834fa84ee8abc3431bcbb3406b6a2233b78c4..fdcf2f9cd0c4d56ee87dbb70bc939300eb941c35 100644 --- a/Resources/Private/Language/locallang_backend.xlf +++ b/Resources/Private/Language/locallang_backend.xlf @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <xliff version="1.0"> - <file source-language="en" datatype="plaintext" original="messages" date="2014-03-18T12:47:57Z"> + <file source-language="en" datatype="plaintext" original="messages" date="2020-07-17T15:32:34Z"> <header> <type>module</type> <description>Language labels for the backend module belonging to extension 'sg_news'</description> @@ -9,63 +9,75 @@ <authorEmail>stefan@sgalinski.de</authorEmail> </header> <body> + <trans-unit id="backend.plugin.preview.settings"> + <source><![CDATA[Settings]]></source> + </trans-unit> + <trans-unit id="backend.plugin.preview.values"> + <source><![CDATA[Values]]></source> + </trans-unit> <trans-unit id="coordinatePicker.missingImage"> - <source>Please upload an image first and save the form!</source> + <source><![CDATA[Please upload an image first and save the form!]]></source> + </trans-unit> + <trans-unit id="descriptionLatestPlugin"> + <source><![CDATA[Show latest news.]]></source> + </trans-unit> + <trans-unit id="descriptionListByCategoryPlugin"> + <source><![CDATA[List news by category/tag]]></source> + </trans-unit> + <trans-unit id="descriptionOverviewPlugin"> + <source><![CDATA[Show an overview of all news.]]></source> + </trans-unit> + <trans-unit id="descriptionSingleViewPlugin"> + <source><![CDATA[Show a single view of news.]]></source> </trans-unit> <trans-unit id="newsFromAuthorPlugin"> - <source>[News] News from author</source> + <source><![CDATA[[News] News from author]]></source> + </trans-unit> + <trans-unit id="pageTitlePlugin.news"> + <source><![CDATA[News]]></source> + </trans-unit> + <trans-unit id="pageType.category"> + <source><![CDATA[Category]]></source> + </trans-unit> + <trans-unit id="pageType.news"> + <source><![CDATA[News]]></source> </trans-unit> <trans-unit id="pageTypeTitlePlugin.news"> - <source>[News] Plugins</source> + <source><![CDATA[[News] Plugins]]></source> </trans-unit> - <trans-unit id="pageTypeTitlePluginOverview.news"> - <source>[News] News Overview</source> + <trans-unit id="pageTypeTitlePluginCategory.news"> + <source><![CDATA[[News] News by Category]]></source> </trans-unit> <trans-unit id="pageTypeTitlePluginLatest.news"> - <source>[News] News Latest</source> + <source><![CDATA[[News] News Latest]]></source> </trans-unit> - <trans-unit id="pageTypeTitlePluginCategory.news"> - <source>[News] News by Category</source> + <trans-unit id="pageTypeTitlePluginOverview.news"> + <source><![CDATA[[News] News Overview]]></source> </trans-unit> <trans-unit id="pageTypeTitlePluginSingle.news"> - <source>[News] News Single View</source> + <source><![CDATA[[News] News Single View]]></source> </trans-unit> - <trans-unit id="pageType.category"> - <source>Category</source> + <trans-unit id="plugin.preview.latest.categories"> + <source><![CDATA[Only show news from these categories]]></source> </trans-unit> - <trans-unit id="pageType.news"> - <source>News</source> + <trans-unit id="plugin.preview.latest.tags"> + <source><![CDATA[Only show news with these tags]]></source> </trans-unit> <trans-unit id="titleLatestPlugin"> - <source>Latest News</source> - </trans-unit> - <trans-unit id="descriptionLatestPlugin"> - <source>Show latest news.</source> + <source><![CDATA[Latest News]]></source> </trans-unit> <trans-unit id="titleListByCategoryPlugin"> - <source>News by Category/Tag</source> + <source><![CDATA[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> + <source><![CDATA[List News by Author.]]></source> </trans-unit> <trans-unit id="titleOverviewPlugin"> - <source>News Overview</source> - </trans-unit> - <trans-unit id="descriptionOverviewPlugin"> - <source>Show an overview of all news.</source> + <source><![CDATA[News Overview]]></source> </trans-unit> <trans-unit id="titleSingleViewPlugin"> - <source>News Single View</source> - </trans-unit> - <trans-unit id="descriptionSingleViewPlugin"> - <source>Show a single view of news.</source> - </trans-unit> - <trans-unit id="pageTitlePlugin.news"> - <source>News</source> + <source><![CDATA[News Single View]]></source> </trans-unit> </body> </file> -</xliff> +</xliff> \ No newline at end of file diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 24f4f5492fd580c8d2e52c07c1efe4b96e5f17f6..2f7acd303af9660f6a31869670a0547170f71b6c 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <xliff version="1.0"> - <file source-language="en" datatype="plaintext" original="messages" date="2019-06-21T20:03:43Z"> + <file source-language="en" datatype="plaintext" original="messages" date="2020-07-17T15:31:49Z"> <header> <type>database</type> <description>Language labels for database tables/fields belonging to extension 'sg_news'</description> @@ -27,9 +27,6 @@ <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_news_author"> - <source><![CDATA[Author]]></source> - </trans-unit> <trans-unit id="pages.tx_sgnews_date_end"> <source><![CDATA[Date until]]></source> </trans-unit> @@ -48,6 +45,9 @@ <trans-unit id="pages.tx_sgnews_never_highlighted"> <source><![CDATA[Don't show in "Latest News"]]></source> </trans-unit> + <trans-unit id="pages.tx_sgnews_news_author"> + <source><![CDATA[Author]]></source> + </trans-unit> <trans-unit id="pages.tx_sgnews_related_news"> <source><![CDATA[Related Elements]]></source> </trans-unit> @@ -179,4 +179,4 @@ </trans-unit> </body> </file> -</xliff> +</xliff> \ No newline at end of file diff --git a/Resources/Private/Partials/Backend/PluginDataTableHeader.html b/Resources/Private/Partials/Backend/PluginDataTableHeader.html new file mode 100644 index 0000000000000000000000000000000000000000..f156291c37e4ab3851f10ee399390b155565ba78 --- /dev/null +++ b/Resources/Private/Partials/Backend/PluginDataTableHeader.html @@ -0,0 +1,10 @@ +<thead> + <tr> + <th scope="col" style="width: 50%"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_backend.xlf:backend.plugin.preview.settings"/> + </th> + <th scope="col" style="width: 50%"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_backend.xlf:backend.plugin.preview.values"/> + </th> + </tr> +</thead> diff --git a/Resources/Private/Partials/Backend/SelectPage.html b/Resources/Private/Partials/Backend/SelectPage.html index ebcf27a8b1ee3809362bfabac88f7782d0c4bc25..ca30fcef45bd49604b8707517d842bd98742cb98 100644 --- a/Resources/Private/Partials/Backend/SelectPage.html +++ b/Resources/Private/Partials/Backend/SelectPage.html @@ -3,10 +3,10 @@ <f:translate key="backend.selectPage" /><f:if condition="{pageUid}"><f:else>.</f:else></f:if> <f:if condition="{pageUid}"> <f:translate key="backend.selectPageOr" /> - <a href="#" class="btn btn-default" onclick="{sg:backend.editOnClick(table: 'pages', uid: pageUid, new: 1, type: 'category')}"> + <sg:backend.link.newRecord class="btn btn-default" type="category" table="pages" pid="{pageUid}"> <sg:backend.icon id="actions-document-new" size="small" /> <f:translate key="backend.button.createCategory" /> - </a> + </sg:backend.link.newRecord> </f:if> </p> <f:if condition="{pages}"> diff --git a/Resources/Private/Templates/Backend/Index.html b/Resources/Private/Templates/Backend/Index.html index 85528e985b0e8fc471bfa28d746d361c8b7b1185..25793dcfceba2699f395b63a23c4b9df3bae80df 100644 --- a/Resources/Private/Templates/Backend/Index.html +++ b/Resources/Private/Templates/Backend/Index.html @@ -1,4 +1,5 @@ {namespace sg=SGalinski\SgNews\ViewHelpers} +{namespace be=TYPO3\CMS\Backend\ViewHelpers} <f:layout name="Backend" /> @@ -23,20 +24,19 @@ </f:if> <f:render partial="Backend/Filter" arguments="{categories: categories, tags: tags, showCategoryFilter: showCategoryFilter, filters: filters}" /> - <div class="form-group"> <f:if condition="{showCategoryFilter}"> <f:then> - <a href="#" class="btn btn-default" onclick="{sg:backend.editOnClick(table: 'pages', uid: pageUid, new: 1, type: 'category')}"> + <sg:backend.link.newRecord class="btn btn-default" table="pages" pid="{pageUid}" type="category"> <sg:backend.icon id="actions-document-new" size="small" /> <f:translate key="backend.button.createCategory" /> - </a> + </sg:backend.link.newRecord> </f:then> <f:else> - <a href="#" class="btn btn-default" onclick="{sg:backend.editOnClick(table: 'pages', uid: pageUid, new: 1, type: 'news')}"> + <sg:backend.link.newRecord class="btn btn-default" table="pages" pid="{pageUid}" type="news"> <sg:backend.icon id="actions-document-new" size="small" /> <f:translate key="backend.button.createNews" /> - </a> + </sg:backend.link.newRecord> </f:else> </f:if> </div> @@ -58,7 +58,7 @@ <f:alias map="{newsItemTags: '{sg:backend.newsItemTags(uid: singleNews.uid, languageUid: language)}'}"> <f:if condition="{singleNews.translation_uid}"> <f:then> - <a href="#" onclick="{sg:backend.editOnClick(table: 'pages', uid: singleNews.translation_uid)}"> + <be:link.editRecord uid="{singleNews.translation_uid}" table="pages"> <span> <f:if condition="{singleNews.translation_title}"> <f:then> @@ -70,15 +70,15 @@ </f:if> <f:if condition="{newsItemTags}">({newsItemTags})</f:if> </span> - </a> + </be:link.editRecord> </f:then> <f:else> - <a href="#" onclick="{sg:backend.editOnClick(table: 'pages', uid: singleNews.uid)}"> + <be:link.editRecord uid="{singleNews.uid}" table="pages"> <span> {singleNews.title} <f:if condition="{newsItemTags}">({newsItemTags})</f:if> </span> - </a> + </be:link.editRecord> </f:else> </f:if> </f:alias> diff --git a/Resources/Private/Templates/Backend/Latest.html b/Resources/Private/Templates/Backend/Latest.html new file mode 100644 index 0000000000000000000000000000000000000000..61eee0077053f629385865a8d899b5a8291e0f59 --- /dev/null +++ b/Resources/Private/Templates/Backend/Latest.html @@ -0,0 +1,89 @@ +{namespace be=TYPO3\CMS\Backend\ViewHelpers} + +<be:link.editRecord table="tt_content" uid="{uid}"> + <br/> + + <table class="table table-striped table-bordered"> + <f:render partial="PluginDataTableHeader"/> + + <tbody> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.latest.flexForm.newsLimit"/> + </th> + <td> + {data.limit} + </td> + </tr> + + <f:if condition="{data.categories}"> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_backend.xlf:plugin.preview.latest.categories"/> + </th> + <td> + {data.categories} + </td> + </tr> + </f:if> + + <f:if condition="{data.tags}"> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_backend.xlf:plugin.preview.latest.tags"/> + </th> + <td> + {data.tags} + </td> + </tr> + </f:if> + + <f:if condition="{data.starttime}"> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.starttime"/> + </th> + <td> + <f:format.date format="d.m.Y">{data.starttime}</f:format.date> + </td> + </tr> + </f:if> + + <f:if condition="{data.endtime}"> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.endtime"/> + </th> + <td> + <f:format.date format="d.m.Y">{data.endtime}</f:format.date> + </td> + </tr> + </f:if> + + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.sortBy"/> + </th> + <td> + <f:switch expression="{data.sortBy}"> + <f:case value="typoscript"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.systemDefault"/> + </f:case> + <f:case value="date"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.dateOfPublication"/> + </f:case> + <f:case value="positionInTree"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.orderInPageTree"/> + </f:case> + </f:switch> + </td> + </tr> + </tbody> + </table> +</be:link.editRecord> diff --git a/Resources/Private/Templates/Backend/ListByCategory.html b/Resources/Private/Templates/Backend/ListByCategory.html new file mode 100644 index 0000000000000000000000000000000000000000..f706d5eec55d682d6a2e54d642b10dfddbf5129c --- /dev/null +++ b/Resources/Private/Templates/Backend/ListByCategory.html @@ -0,0 +1,108 @@ +{namespace be=TYPO3\CMS\Backend\ViewHelpers} + +<be:link.editRecord table="tt_content" uid="{uid}"> + <br/> + + <table class="table table-striped table-bordered"> + <f:render partial="PluginDataTableHeader"/> + + <tbody> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.latest.flexForm.newsLimit"/> + </th> + <td> + {data.newsLimitPerPage} + </td> + </tr> + + <f:comment><!-- Always rendered because having no categories means there is no frontend output. --></f:comment> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.listByCategory.flexForm.categories"/> + </th> + <td> + {data.categories} + </td> + </tr> + + <f:if condition="{data.tags}"> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_backend.xlf:plugin.preview.latest.tags"/> + </th> + <td> + {data.tags} + </td> + </tr> + </f:if> + + <f:if condition="{data.starttime}"> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.starttime"/> + </th> + <td> + <f:format.date format="d.m.Y">{data.starttime}</f:format.date> + </td> + </tr> + </f:if> + + <f:if condition="{data.endtime}"> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.endtime"/> + </th> + <td> + <f:format.date format="d.m.Y">{data.endtime}</f:format.date> + </td> + </tr> + </f:if> + + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.sortBy"/> + </th> + <td> + <f:switch expression="{data.sortBy}"> + <f:case value="typoscript"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.systemDefault"/> + </f:case> + <f:case value="date"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.dateOfPublication"/> + </f:case> + <f:case value="positionInTree"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.orderInPageTree"/> + </f:case> + </f:switch> + </td> + </tr> + + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.sortOrder"/> + </th> + <td> + <f:switch expression="{data.sortDirection}"> + <f:case value="typoscript"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.systemDefault"/> + </f:case> + <f:case value="DESC"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.desc"/> + </f:case> + <f:case value="ASC"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.asc"/> + </f:case> + </f:switch> + </td> + </tr> + </tbody> + </table> +</be:link.editRecord> diff --git a/Resources/Private/Templates/Backend/NewsByAuthor.html b/Resources/Private/Templates/Backend/NewsByAuthor.html new file mode 100644 index 0000000000000000000000000000000000000000..b7e02a6b964f312cc68c816c70f4f6fbee583cf8 --- /dev/null +++ b/Resources/Private/Templates/Backend/NewsByAuthor.html @@ -0,0 +1,55 @@ +{namespace be=TYPO3\CMS\Backend\ViewHelpers} +{namespace core=TYPO3\CMS\Core\ViewHelpers} + +<be:link.editRecord table="tt_content" uid="{uid}"> + <br/> + + <table class="table table-striped table-bordered"> + <f:render partial="PluginDataTableHeader"/> + + <tbody> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.showDetails"/> + </th> + <td> + <f:if condition="{data.showDetails}"> + <f:then> + <core:icon alternativeMarkupIdentifier="inline" identifier="actions-check"/> + </f:then> + <f:else> + <core:icon alternativeMarkupIdentifier="inline" identifier="actions-close"/> + </f:else> + </f:if> + </td> + </tr> + + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.newsAuthor"/> + </th> + <td> + {data.newsAuthors} + </td> + </tr> + + <f:if condition="{data.excludedNews}"> + <tr> + <th scope="row" rowspan="0"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.excludedNews"/> + </th> + </tr> + <f:for each="{data.excludedNews}" as="excludedNews"> + <tr> + <td> + {excludedNews} + </td> + </tr> + </f:for> + </f:if> + </tbody> + </table> +</be:link.editRecord> diff --git a/Resources/Private/Templates/Backend/Overview.html b/Resources/Private/Templates/Backend/Overview.html new file mode 100644 index 0000000000000000000000000000000000000000..8edd51cc5abfe8b7f31630c74705c871be04d15b --- /dev/null +++ b/Resources/Private/Templates/Backend/Overview.html @@ -0,0 +1,131 @@ +{namespace be=TYPO3\CMS\Backend\ViewHelpers} +{namespace core=TYPO3\CMS\Core\ViewHelpers} + +<be:link.editRecord table="tt_content" uid="{uid}"> + <br/> + + <table class="table table-striped table-bordered"> + <f:render partial="PluginDataTableHeader"/> + + <tbody> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.overview.flexForm.groupBy"/> + </th> + <td> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.overview.flexForm.groupBy.I.{data.groupBy}"/> + </td> + </tr> + + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.overview.flexForm.enableFilter"/> + </th> + <td> + <f:if condition="{data.enableFilter}"> + <f:then> + <core:icon alternativeMarkupIdentifier="inline" identifier="actions-check"/> + </f:then> + <f:else> + <core:icon alternativeMarkupIdentifier="inline" identifier="actions-close"/> + </f:else> + </f:if> + </td> + </tr> + + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.overview.flexForm.newsLimit"/> + </th> + <td> + {data.newsLimit} + </td> + </tr> + + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.overview.flexForm.onlyNewsWithinThisPageSection"/> + </th> + <td> + <f:if condition="{data.onlyNewsWithinThisPageSection}"> + <f:then> + <core:icon alternativeMarkupIdentifier="inline" identifier="actions-check"/> + </f:then> + <f:else> + <core:icon alternativeMarkupIdentifier="inline" identifier="actions-close"/> + </f:else> + </f:if> + </td> + </tr> + + <f:if condition="{data.starttime}"> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.starttime"/> + </th> + <td> + <f:format.date format="d.m.Y">{data.starttime}</f:format.date> + </td> + </tr> + </f:if> + + <f:if condition="{data.endtime}"> + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.endtime"/> + </th> + <td> + <f:format.date format="d.m.Y">{data.endtime}</f:format.date> + </td> + </tr> + </f:if> + + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.sortBy"/> + </th> + <td> + <f:switch expression="{data.sortBy}"> + <f:case value="typoscript"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.systemDefault"/> + </f:case> + <f:case value="date"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.dateOfPublication"/> + </f:case> + <f:case value="positionInTree"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.orderInPageTree"/> + </f:case> + </f:switch> + </td> + </tr> + + <tr> + <th scope="row"> + <f:translate + key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.sortOrder"/> + </th> + <td> + <f:switch expression="{data.sortDirection}"> + <f:case value="typoscript"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.systemDefault"/> + </f:case> + <f:case value="DESC"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.desc"/> + </f:case> + <f:case value="ASC"> + <f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.asc"/> + </f:case> + </f:switch> + </td> + </tr> + </tbody> + </table> +</be:link.editRecord> diff --git a/ext_localconf.php b/ext_localconf.php index 7b6020493a6d9a851bcea6696d1b064926442c06..b4e3c670cce82e9ab2b1ffa8dd149d14057ec5dc 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -99,6 +99,8 @@ call_user_func( // hook registration $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'SGalinski\SgNews\TCA\TcaProvider'; + $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['sg_news'] + = \SGalinski\SgNews\Hooks\PageLayoutView\PluginRenderer::class; // Xclasses $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\CMS\Core\Page\PageRenderer'] = @@ -139,5 +141,11 @@ call_user_func( \SGalinski\SgNews\Updates\UpdateAuthors::class; $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\SGalinski\SgNews\Updates\MigrateSchedulerTasks::IDENTIFIER] = \SGalinski\SgNews\Updates\MigrateSchedulerTasks::class; + + $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][] = [ + 'nodeName' => 'languageVisibility', + 'priority' => 40, + 'class' => \TYPO3\Languagevisibility\UserFunction\FieldVisibilityUserFunction::class, + ]; }, 'sg_news' );