Skip to content
Snippets Groups Projects
Commit 93556a0b authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[BUGFIX] Update ViewHelpers and deprecated calls

parent ade20f16
No related branches found
No related tags found
2 merge requests!13Feature remove sg news ajax plugin,!8Feature upgrade to9 lts
Showing
with 284 additions and 171 deletions
...@@ -121,11 +121,7 @@ class BackendController extends ActionController { ...@@ -121,11 +121,7 @@ class BackendController extends ActionController {
* @api * @api
*/ */
protected function initializeView(ViewInterface $view) { protected function initializeView(ViewInterface $view) {
if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 8000000) { $GLOBALS['LANG']->includeLLFile('EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf');
$GLOBALS['LANG']->includeLLFile('EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf');
} else {
$GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_mod_web_list.xlf');
}
// create doc header component // create doc header component
$this->pageUid = (int) GeneralUtility::_GP('id'); $this->pageUid = (int) GeneralUtility::_GP('id');
/** @var BackendUserAuthentication $backendUser */ /** @var BackendUserAuthentication $backendUser */
...@@ -226,8 +222,12 @@ class BackendController extends ActionController { ...@@ -226,8 +222,12 @@ class BackendController extends ActionController {
// Refresh // Refresh
$refreshButton = $buttonBar->makeLinkButton() $refreshButton = $buttonBar->makeLinkButton()
->setHref(GeneralUtility::getIndpEnv('REQUEST_URI')) ->setHref(GeneralUtility::getIndpEnv('REQUEST_URI'))
->setTitle(LocalizationUtility::translate('LLL:EXT:lang/locallang_core.xlf:labels.reload', '')) ->setTitle(
->setIcon($iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL)); LocalizationUtility::translate(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.reload'
)
)
->setIcon($iconFactory->getIcon('actions-edit-undo', Icon::SIZE_SMALL));
$buttonBar->addButton($refreshButton, ButtonBar::BUTTON_POSITION_RIGHT); $buttonBar->addButton($refreshButton, ButtonBar::BUTTON_POSITION_RIGHT);
// shortcut button // shortcut button
......
...@@ -84,7 +84,9 @@ class BackendNewsUtility { ...@@ -84,7 +84,9 @@ class BackendNewsUtility {
public static function getAlternativePageOptions(): array { public static function getAlternativePageOptions(): array {
$options = []; $options = [];
/** @var array $rootOptionRows */ /** @var array $rootOptionRows */
$rootOptionRows = self::getRecordsByField('pages', 'is_siteroot', 1, '', '', 'sorting'); $rootOptionRows = self::getRecordsByField(
'pages', 'is_siteroot', 1, ' AND sys_language_uid IN (0,-1)', '', 'sorting'
);
if ($rootOptionRows) { if ($rootOptionRows) {
foreach ($rootOptionRows as $row) { foreach ($rootOptionRows as $row) {
$pageInfo = BackendUtility::readPageAccess($row['uid'], $GLOBALS['BE_USER']->getPagePermsClause(1)); $pageInfo = BackendUtility::readPageAccess($row['uid'], $GLOBALS['BE_USER']->getPagePermsClause(1));
......
...@@ -30,7 +30,6 @@ use SGalinski\SgNews\Service\LicensingService; ...@@ -30,7 +30,6 @@ use SGalinski\SgNews\Service\LicensingService;
use SGalinski\SgNews\ViewHelpers\AbstractViewHelper; use SGalinski\SgNews\ViewHelpers\AbstractViewHelper;
use TYPO3\CMS\Backend\Clipboard\Clipboard; use TYPO3\CMS\Backend\Clipboard\Clipboard;
use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
...@@ -41,24 +40,35 @@ use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList; ...@@ -41,24 +40,35 @@ use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList;
* Class ControlViewHelper * Class ControlViewHelper
**/ **/
class ControlViewHelper extends AbstractViewHelper { class ControlViewHelper extends AbstractViewHelper {
/**
* Initialize the ViewHelper arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('table', 'string', 'The table to control', TRUE);
$this->registerArgument('row', 'mixed', 'The row of the record', TRUE);
$this->registerArgument('sortingData', 'array', 'The sorting data', FALSE, []);
$this->registerArgument('clipboard', 'bool', 'Use the clipboard', FALSE, FALSE);
}
/** /**
* Renders the control buttons for the specified record * Renders the control buttons for the specified record
* *
* @param string $table
* @param mixed $row
* @param array $sortingData
* @param boolean $clipboard
* @return string * @return string
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
*/ */
public function render($table, $row, array $sortingData = [], $clipboard = FALSE): string { public function render(): string {
$table = $this->arguments['table'];
$row = $this->arguments['row'];
$sortingData = $this->arguments['sortingData'];
$clipboard = $this->arguments['clipboard'];
if (!is_array($row)) { if (!is_array($row)) {
$row = BackendUtility::getRecord($table, $row->getUid()); $row = BackendUtility::getRecord($table, $row->getUid());
} }
/** @var DatabaseRecordList $databaseRecordList */
$databaseRecordList = GeneralUtility::makeInstance(DatabaseRecordList::class); $databaseRecordList = GeneralUtility::makeInstance(DatabaseRecordList::class);
/** @var BackendUserAuthentication $backendUser */
$backendUser = $GLOBALS['BE_USER']; $backendUser = $GLOBALS['BE_USER'];
$pageInfo = BackendUtility::readPageAccess($row['pid'], $backendUser->getPagePermsClause(1)); $pageInfo = BackendUtility::readPageAccess($row['pid'], $backendUser->getPagePermsClause(1));
$databaseRecordList->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageInfo); $databaseRecordList->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageInfo);
...@@ -66,6 +76,7 @@ class ControlViewHelper extends AbstractViewHelper { ...@@ -66,6 +76,7 @@ class ControlViewHelper extends AbstractViewHelper {
if ($table === 'pages') { if ($table === 'pages') {
$databaseRecordList->searchLevels = 1; $databaseRecordList->searchLevels = 1;
} }
$out = $databaseRecordList->makeControl($table, $row); $out = $databaseRecordList->makeControl($table, $row);
if ($clipboard) { if ($clipboard) {
$databaseRecordList->MOD_SETTINGS['clipBoard'] = TRUE; $databaseRecordList->MOD_SETTINGS['clipBoard'] = TRUE;
...@@ -74,6 +85,7 @@ class ControlViewHelper extends AbstractViewHelper { ...@@ -74,6 +85,7 @@ class ControlViewHelper extends AbstractViewHelper {
$GLOBALS['SOBE'] = $databaseRecordList; $GLOBALS['SOBE'] = $databaseRecordList;
$out .= $databaseRecordList->makeClip($table, $row); $out .= $databaseRecordList->makeClip($table, $row);
} }
if ($table === 'pages' && LicensingService::checkKey()) { if ($table === 'pages' && LicensingService::checkKey()) {
$rootline = BackendUtility::BEgetRootLine($row['uid'], '', TRUE); $rootline = BackendUtility::BEgetRootLine($row['uid'], '', TRUE);
ksort($rootline); ksort($rootline);
...@@ -82,7 +94,6 @@ class ControlViewHelper extends AbstractViewHelper { ...@@ -82,7 +94,6 @@ class ControlViewHelper extends AbstractViewHelper {
$path .= '/p' . dechex($page['uid']); $path .= '/p' . dechex($page['uid']);
} }
/** @var IconFactory $iconFactory */
$iconFactory = GeneralUtility::makeInstance(IconFactory::class); $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$buttonLabel = LocalizationUtility::translate('backend.button.editPageContent', 'SgNews'); $buttonLabel = LocalizationUtility::translate('backend.button.editPageContent', 'SgNews');
$onclick = 'return sgNewsGoToPageModule(' . $row['uid'] . ', \'' . $path . '\');'; $onclick = 'return sgNewsGoToPageModule(' . $row['uid'] . ', \'' . $path . '\');';
...@@ -92,6 +103,7 @@ class ControlViewHelper extends AbstractViewHelper { ...@@ -92,6 +103,7 @@ class ControlViewHelper extends AbstractViewHelper {
$link = sprintf($link, $icon . ' ' . $buttonLabel); $link = sprintf($link, $icon . ' ' . $buttonLabel);
$out .= sprintf($wrap, $link); $out .= sprintf($wrap, $link);
} }
return $out; return $out;
} }
} }
...@@ -34,21 +34,34 @@ use TYPO3\CMS\Backend\Utility\BackendUtility; ...@@ -34,21 +34,34 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
* Class EditOnClickViewHelper * Class EditOnClickViewHelper
**/ **/
class EditOnClickViewHelper extends AbstractViewHelper { 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 * Renders the onclick script for editing a record
* *
* @param string $table
* @param int $uid
* @param boolean $new
* @param string $type
* @return string * @return string
*/ */
public function render($table, $uid, $new = FALSE, $type = ''): string { public function render(): string {
$table = $this->arguments['table'];
$uid = $this->arguments['uid'];
$new = $this->arguments['news'];
$type = $this->arguments['type'];
$additionalParameters = ''; $additionalParameters = '';
if ($new && $table === 'pages' && in_array($type, ['news', 'category'], TRUE)) { if ($new && $table === 'pages' && in_array($type, ['news', 'category'], TRUE)) {
$additionalParameters = '&overrideVals[pages][doktype]=' . $additionalParameters = '&overrideVals[pages][doktype]=' .
($type === 'news' ? BackendNewsUtility::NEWS_DOKTYPE : BackendNewsUtility::CATEGORY_DOKTYPE); ($type === 'news' ? BackendNewsUtility::NEWS_DOKTYPE : BackendNewsUtility::CATEGORY_DOKTYPE);
} }
return BackendUtility::editOnClick( return BackendUtility::editOnClick(
'&edit[' . $table . '][' . $uid . ']=' . ($new ? 'new' : 'edit') . $additionalParameters, '', -1 '&edit[' . $table . '][' . $uid . ']=' . ($new ? 'new' : 'edit') . $additionalParameters, '', -1
); );
......
...@@ -35,19 +35,28 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; ...@@ -35,19 +35,28 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
* Class IconViewHelper * Class IconViewHelper
**/ **/
class IconViewHelper extends AbstractViewHelper { class IconViewHelper extends AbstractViewHelper {
/**
* Initialize the ViewHelper arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('id', 'string', 'The id of the record', TRUE);
$this->registerArgument('size', 'string', 'The size of the icon', FALSE, '');
$this->registerArgument('overlayId', 'string', 'The overlay of the icon', FALSE);
}
/** /**
* Renders the icon for the specified identifier * Renders the icon for the specified identifier
* with the requested size option and overlay. * with the requested size option and overlay.
* *
* @param string $id
* @param string $size
* @param string $overlayId
* @return string * @return string
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function render($id, $size = '', $overlayId = NULL): string { public function render(): string {
$id = trim($id); $id = trim($this->arguments['id']);
$size = trim($size); $size = trim($this->arguments['size']);
$overlayId = $this->arguments['overlayId'];
switch ($size) { switch ($size) {
case 'small' : case 'small' :
$size = Icon::SIZE_SMALL; $size = Icon::SIZE_SMALL;
...@@ -59,7 +68,7 @@ class IconViewHelper extends AbstractViewHelper { ...@@ -59,7 +68,7 @@ class IconViewHelper extends AbstractViewHelper {
$size = Icon::SIZE_DEFAULT; $size = Icon::SIZE_DEFAULT;
break; break;
} }
/** @var IconFactory $iconFactory */
$iconFactory = GeneralUtility::makeInstance(IconFactory::class); $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
return $iconFactory->getIcon($id, $size, $overlayId)->render(); return $iconFactory->getIcon($id, $size, $overlayId)->render();
} }
......
...@@ -33,23 +33,32 @@ use SGalinski\SgNews\ViewHelpers\AbstractViewHelper; ...@@ -33,23 +33,32 @@ use SGalinski\SgNews\ViewHelpers\AbstractViewHelper;
* Class EditOnClickViewHelper * Class EditOnClickViewHelper
**/ **/
class NewsItemTagsViewHelper extends AbstractViewHelper { class NewsItemTagsViewHelper extends AbstractViewHelper {
/**
* Initialize the ViewHelper arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('uid', 'int', 'The uid of the news', FALSE, 0);
$this->registerArgument('languageUid', 'int', 'The language uid', FALSE, 0);
}
/** /**
* Renders the tags for the specified news uid * Renders the tags for the specified news uid
* *
* @param int $uid
* @param int $languageUid
* @return string * @return string
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function render($uid = 0, $languageUid = 0): string { public function render(): string {
$out = ''; $out = '';
$uid = (int) $uid; $uid = $this->arguments['uid'];
$languageUid = (int) $languageUid; $languageUid = $this->arguments['languageUid'];
if ($uid) { if ($uid) {
$tags = BackendNewsUtility::getTagsForNewsItem($uid, $languageUid); $tags = BackendNewsUtility::getTagsForNewsItem($uid, $languageUid);
$out = implode(', ', $tags); $out = implode(', ', $tags);
} }
return $out; return $out;
} }
} }
...@@ -36,17 +36,27 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; ...@@ -36,17 +36,27 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
* Class IconViewHelper * Class IconViewHelper
**/ **/
class RecordIconViewHelper extends AbstractViewHelper { class RecordIconViewHelper extends AbstractViewHelper {
/**
* Initialize the ViewHelper arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('table', 'string', 'The table of the record', TRUE);
$this->registerArgument('row', 'array', 'The row of the record icon', TRUE);
$this->registerArgument('clickMenu', 'bool', 'Render the click menu', FALSE, TRUE);
}
/** /**
* Renders the icon for the specified record * Renders the icon for the specified record
* *
* @param string $table
* @param mixed $row
* @param boolean $clickMenu
* @return string * @return string
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function render($table, $row, $clickMenu = TRUE): string { public function render(): string {
/** @var IconFactory $iconFactory */ $table = $this->arguments['table'];
$row = $this->arguments['row'];
$clickMenu = $this->arguments['clickMenu'];
$iconFactory = GeneralUtility::makeInstance(IconFactory::class); $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$toolTip = BackendUtility::getRecordToolTip($row, $table); $toolTip = BackendUtility::getRecordToolTip($row, $table);
$iconImg = '<span ' . $toolTip . '>' $iconImg = '<span ' . $toolTip . '>'
...@@ -55,6 +65,7 @@ class RecordIconViewHelper extends AbstractViewHelper { ...@@ -55,6 +65,7 @@ class RecordIconViewHelper extends AbstractViewHelper {
if ($clickMenu) { if ($clickMenu) {
return BackendUtility::wrapClickMenuOnIcon($iconImg, $table, $row['uid']); return BackendUtility::wrapClickMenuOnIcon($iconImg, $table, $row['uid']);
} }
return $iconImg; return $iconImg;
} }
} }
...@@ -40,16 +40,27 @@ use TYPO3\CMS\Extbase\Utility\LocalizationUtility; ...@@ -40,16 +40,27 @@ use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
* Class EditOnClickViewHelper * Class EditOnClickViewHelper
**/ **/
class TranslationLinksViewHelper extends AbstractViewHelper { class TranslationLinksViewHelper extends AbstractViewHelper {
/**
* Register the ViewHelp0er arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('uid', 'int', 'The uid of the record', TRUE);
$this->registerArgument('table', 'string', 'The table of the record', TRUE);
$this->registerArgument('pageUid', 'int', 'The uid of the page', FALSE, 0);
}
/** /**
* Renders the translation links for the specified record * Renders the translation links for the specified record
* *
* @param int $pageUid
* @param string $table
* @param int $uid
* @return string * @return string
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function render($pageUid = 0, $table, $uid): string { public function render(): string {
$uid = $this->arguments['uid'];
$table = $this->arguments['table'];
$pageUid = $this->arguments['pageUid'];
$out = ''; $out = '';
if (!LicensingService::checkKey()) { if (!LicensingService::checkKey()) {
return $out; return $out;
...@@ -62,7 +73,6 @@ class TranslationLinksViewHelper extends AbstractViewHelper { ...@@ -62,7 +73,6 @@ class TranslationLinksViewHelper extends AbstractViewHelper {
$pageUid = (int) $pageUid; $pageUid = (int) $pageUid;
$row = BackendUtility::getRecord($table, $uid); $row = BackendUtility::getRecord($table, $uid);
if ($row) { if ($row) {
/** @var IconFactory $iconFactory */
$iconFactory = GeneralUtility::makeInstance(IconFactory::class); $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$lanuageField = $GLOBALS['TCA'][$table]['ctrl']['languageField']; $lanuageField = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
$currentLanguageUid = $table === 'pages' ? 0 : $row[$lanuageField]; $currentLanguageUid = $table === 'pages' ? 0 : $row[$lanuageField];
...@@ -115,7 +125,9 @@ class TranslationLinksViewHelper extends AbstractViewHelper { ...@@ -115,7 +125,9 @@ class TranslationLinksViewHelper extends AbstractViewHelper {
} }
$out .= ' <a href="#" onclick="' . $onClick . '" title="' . $language['title'] . ' [' . $newLabel . ']" >' . $out .= ' <a href="#" onclick="' . $onClick . '" title="' . $language['title'] . ' [' . $newLabel . ']" >' .
$iconFactory->getIcon( $iconFactory->getIcon(
$language['flag'], Icon::SIZE_SMALL, 'overlay-new', $language['flag'],
Icon::SIZE_SMALL,
'overlay-new',
IconState::cast(IconState::STATE_DISABLED) IconState::cast(IconState::STATE_DISABLED)
)->render() . )->render() .
'</a>'; '</a>';
......
...@@ -33,7 +33,7 @@ use TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetViewHelper; ...@@ -33,7 +33,7 @@ use TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetViewHelper;
*/ */
class PaginateViewHelper extends AbstractWidgetViewHelper { class PaginateViewHelper extends AbstractWidgetViewHelper {
/** /**
* @var \SGalinski\SgNews\ViewHelpers\Backend\Widget\Controller\PaginateController * @var PaginateController
*/ */
protected $controller; protected $controller;
...@@ -42,25 +42,38 @@ class PaginateViewHelper extends AbstractWidgetViewHelper { ...@@ -42,25 +42,38 @@ class PaginateViewHelper extends AbstractWidgetViewHelper {
* *
* @param PaginateController $controller * @param PaginateController $controller
*/ */
public function injectPaginateController( public function injectPaginateController(PaginateController $controller) {
PaginateController $controller
) {
$this->controller = $controller; $this->controller = $controller;
} }
/**
* Initialize the ViewHelper arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('objects', 'mixed', 'The objects to paginate', TRUE);
$this->registerArgument('as', 'string', 'The name of the variable inside the pagination', TRUE);
$this->registerArgument(
'configuration',
'array',
'The configuration of the pagination',
FALSE,
[
'itemsPerPage' => 10,
'insertAbove' => FALSE,
'insertBelow' => TRUE,
'recordsLabel' => ''
]
);
}
/** /**
* Renders the paginator * Renders the paginator
* *
* @param mixed $objects
* @param string $as
* @param array $configuration
* @return string * @return string
* @throws \TYPO3\CMS\Fluid\Core\Widget\Exception\MissingControllerException * @throws \TYPO3\CMS\Fluid\Core\Widget\Exception\MissingControllerException
*/ */
public function render( public function render(): string {
$objects, $as,
array $configuration = ['itemsPerPage' => 10, 'insertAbove' => FALSE, 'insertBelow' => TRUE, 'recordsLabel' => '']
): string {
return $this->initiateSubRequest(); return $this->initiateSubRequest();
} }
} }
...@@ -26,7 +26,7 @@ namespace SGalinski\SgNews\ViewHelpers; ...@@ -26,7 +26,7 @@ namespace SGalinski\SgNews\ViewHelpers;
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/** /**
* View helper that returns the estimates reading time of a given content * View helper that returns the estimates reading time of a given content
...@@ -36,13 +36,22 @@ use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper; ...@@ -36,13 +36,22 @@ use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
* <sg:getReadingTime content="" /> * <sg:getReadingTime content="" />
*/ */
class GetReadingTimeViewHelper extends AbstractViewHelper { class GetReadingTimeViewHelper extends AbstractViewHelper {
/**
* Register the ViewHelper arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('content', 'string', 'The content to read', TRUE);
}
/** /**
* Returns the estimated reading time of the given content * Returns the estimated reading time of the given content
* *
* @param string $content
* @return string * @return string
*/ */
public function render($content): string { public function render(): string {
$content = $this->arguments['content'];
$word = str_word_count(strip_tags($content)); $word = str_word_count(strip_tags($content));
$minutes = floor($word / 200); $minutes = floor($word / 200);
$seconds = floor($word % 200 / (200 / 60)); $seconds = floor($word % 200 / (200 / 60));
......
# include the endless scrolling javascript code # include the endless scrolling javascript code
page.includeJSFooterlibs { page.includeJSFooterlibs {
sg_news_scrollbrowser = EXT:sg_news/Resources/Public/Scripts/ScrollBrowser.js sg_news_scrollbrowser = EXT:sg_news/Resources/Public/JavaScript/ScrollBrowser.js
sg_news_tabs = EXT:sg_news/Resources/Public/Scripts/Tabs.js sg_news_tabs = EXT:sg_news/Resources/Public/JavaScript/Tabs.js
sg_news_likes = EXT:sg_news/Resources/Public/Scripts/Likes.js sg_news_likes = EXT:sg_news/Resources/Public/JavaScript/Likes.js
} }
# news feed as own page type # news feed as own page type
......
{namespace core = TYPO3\CMS\Core\ViewHelpers} {namespace core = TYPO3\CMS\Core\ViewHelpers}
{namespace sg=SGalinski\SgNews\ViewHelpers} {namespace sg=SGalinski\SgNews\ViewHelpers}
<f:be.container enableClickMenu="FALSE" loadExtJs="FALSE" <f:be.container
includeRequireJsModules="{ includeRequireJsModules="{
0: 'TYPO3/CMS/Backend/AjaxDataHandler', 0: 'TYPO3/CMS/Backend/AjaxDataHandler',
1: '{f:if(condition: \'{typo3Version} < 8000000 \', then: \'TYPO3/CMS/Backend/ClickMenu\', else: \'TYPO3/CMS/Backend/ContextMenu\')}', 1: 'TYPO3/CMS/Backend/ContextMenu',
2: 'TYPO3/CMS/Backend/Tooltip', 2: 'TYPO3/CMS/Backend/Tooltip',
2: 'TYPO3/CMS/Recordlist/Tooltip'}" 3: 'TYPO3/CMS/Recordlist/Tooltip',
4: 'TYPO3/CMS/SgNews/Backend'}"
includeJsFiles="{0: '{f:uri.resource(path: \'Scripts/Backend.js\')}'}"> includeJsFiles="{0: '{f:uri.resource(path: \'Scripts/Backend.js\')}'}">
<div class="module" data-module-id="" data-module-name=""> <div class="module" data-module-id="" data-module-name="">
<div class="module-docheader t3js-module-docheader"> <div class="module-docheader t3js-module-docheader">
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
</f:for> </f:for>
</div> </div>
<div class="module-docheader-bar-column-right"> <div class="module-docheader-bar-column-right">
<span class="typo3-docheader-pagePath"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw></span> <span class="typo3-docheader-pagePath"><f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw></span>
<f:format.raw>{docHeader.metaInformation.recordInformation}</f:format.raw> <f:format.raw>{docHeader.metaInformation.recordInformation}</f:format.raw>
</div> </div>
</div> </div>
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
<f:for each="{pages}" as="page"> <f:for each="{pages}" as="page">
<tr data-uid="{page.uid}"> <tr data-uid="{page.uid}">
<td nowrap="nowrap" class="col-title"> <td nowrap="nowrap" class="col-title">
<a href="#" onclick="sgNewsGoToPage({page.uid}, '{page.path}'); return false;"> <f:link.action action="index" additionalParams="{id: page.uid, returnUrl: returnUrl}">
<sg:backend.recordIcon table="pages" row="{page}" clickMenu="0" /> {page._thePathFull} <sg:backend.recordIcon table="pages" row="{page}" clickMenu="0" /> {page._thePathFull}
</a> </f:link.action>
</td> </td>
</tr> </tr>
</f:for> </f:for>
...@@ -27,4 +27,4 @@ ...@@ -27,4 +27,4 @@
</table> </table>
</div> </div>
</div> </div>
</f:if> </f:if>
\ No newline at end of file
/***************************************************************
* 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!
***************************************************************/
define(['jquery'], function($) {
'use strict';
var SgNewsModule = {
init: function() {
$.get(TYPO3.settings.ajaxUrls['sg_news::ajaxPing']);
$('#filter-reset-btn').on('click', function(event) {
event.preventDefault();
this.form.reset();
$(this).closest('form').find('select').val('');
$('#filter-search').val('');
this.form.submit();
});
},
// functions for backend docheader functionality
jumpExt: function(URL, anchor) {
var anc = anchor ? anchor : "";
window.location.href = URL + (T3_THIS_LOCATION ? "&returnUrl=" + T3_THIS_LOCATION : "") + anc;
return false;
},
jumpSelf: function(URL) {
window.location.href = URL + (T3_RETURN_URL ? "&returnUrl=" + T3_RETURN_URL : "");
return false;
},
jumpToUrl: function(URL) {
window.location.href = URL;
return false;
},
setHighlight: function(id) {
top.fsMod.recentIds["web"] = id;
top.fsMod.navFrameHighlightedID["web"] = "pages" + id + "_" + top.fsMod.currentBank; // For highlighting
if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
top.content.nav_frame.refresh_nav();
}
},
/**
* Switches to the spefied page in the BE
*
* @param {number} uid
* @param {string} path
*/
sgNewsGoToPage: function(uid, path, selectOnly) {
parent.fsMod.recentIds['web'] = uid;
if (typeof selectOnly === 'undefined') {
selectOnly = false;
}
selectOnly = Boolean(selectOnly);
if (top.nav) {
if (selectOnly) {
top.nav.invokePageId(uid, SgNewsModule.gotToPageCallbackNoFollow);
} else {
top.nav.invokePageId(uid, SgNewsModule.gotToPageCallback);
}
} else {
var tree = top.Ext.getCmp('typo3-pagetree');
if (tree) {
tree.activeTree.selectPath(path);
}
if (selectOnly) {
return;
}
var separator = '?';
if (top.currentSubScript.indexOf('?') !== -1) {
separator = '&';
}
top.TYPO3.Backend.ContentContainer.setUrl(
top.currentSubScript + separator + 'id=' + uid
);
}
},
/**
* Callback for page selection in the pagetree without follow
*/
gotToPageCallbackNoFollow: function(path) {
var callback = top.Ext.createDelegate(top.nav.mainTree.selectPath, top.nav.mainTree);
callback.apply(this, arguments);
},
/**
* Callback for page selection in the pagetree
*/
gotToPageCallback: function(path) {
var callback = top.Ext.createDelegate(top.nav.mainTree.selectPath, top.nav.mainTree);
callback.apply(this, arguments);
var node = top.nav.getSelected();
if (node) {
top.TYPO3.Components.PageTree.Actions.singleClick(node, top.TYPO3.Components.PageTree.Tree);
}
},
sgNewsGoToPageModule: function(uid, path) {
SgNewsModule.sgNewsGoToPage(uid, path, true);
parent.TYPO3.ModuleMenu.App.showModule('web_layout');
return false;
}
};
TYPO3.SgNewsModule = SgNewsModule;
SgNewsModule.init();
return SgNewsModule;
});
(function($) {
$(document).ready(function() {
$.get(TYPO3.settings.ajaxUrls['sg_news::ajaxPing']);
$('#filter-reset-btn').on('click', function(event) {
event.preventDefault();
this.form.reset();
$(this).closest('form').find('select').val('');
$('#filter-search').val('');
this.form.submit();
});
});
})(TYPO3.jQuery);
// functions for backend docheader functionality
function jumpExt(URL, anchor) { //
var anc = anchor ? anchor : "";
window.location.href = URL + (T3_THIS_LOCATION ? "&returnUrl=" + T3_THIS_LOCATION : "") + anc;
return false;
}
function jumpSelf(URL) { //
window.location.href = URL + (T3_RETURN_URL ? "&returnUrl=" + T3_RETURN_URL : "");
return false;
}
function jumpToUrl(URL) {
window.location.href = URL;
return false;
}
function setHighlight(id) { //
top.fsMod.recentIds["web"] = id;
top.fsMod.navFrameHighlightedID["web"] = "pages" + id + "_" + top.fsMod.currentBank; // For highlighting
if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
top.content.nav_frame.refresh_nav();
}
}
/**
* Switches to the spefied page in the BE
*
* @param {number} uid
* @param {string} path
*/
function sgNewsGoToPage(uid, path, selectOnly) {
parent.fsMod.recentIds['web'] = uid;
if(typeof selectOnly === 'undefined') {
selectOnly = false;
}
selectOnly = Boolean(selectOnly);
if (top.nav) {
if (selectOnly) {
top.nav.invokePageId(uid, gotToPageCallbackNoFollow);
} else {
top.nav.invokePageId(uid, gotToPageCallback);
}
} else {
var tree = top.Ext.getCmp('typo3-pagetree');
if (tree) {
tree.activeTree.selectPath(path);
}
if (selectOnly) {
return;
}
var separator = '?';
if (top.currentSubScript.indexOf('?') !== -1) {
separator = '&';
}
top.TYPO3.Backend.ContentContainer.setUrl(
top.currentSubScript + separator + 'id=' + uid
);
}
}
/**
* Callback for page selection in the pagetree without follow
*/
function gotToPageCallbackNoFollow(path){
var callback = top.Ext.createDelegate(top.nav.mainTree.selectPath, top.nav.mainTree);
callback.apply(this, arguments);
}
/**
* Callback for page selection in the pagetree
*/
function gotToPageCallback(path){
var callback = top.Ext.createDelegate(top.nav.mainTree.selectPath, top.nav.mainTree);
callback.apply(this, arguments);
var node = top.nav.getSelected();
if (node) {
top.TYPO3.Components.PageTree.Actions.singleClick(node, top.TYPO3.Components.PageTree.Tree);
}
}
function sgNewsGoToPageModule(uid, path) {
sgNewsGoToPage(uid, path, true);
parent.TYPO3.ModuleMenu.App.showModule('web_layout');
return false;
}
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
} }
], ],
"require": { "require": {
"typo3/cms-core": "^7.6.0 || ^8.7.0 || ^9.5.1", "typo3/cms-core": "^8.7.0 || ^9.5.1",
"stefanfroemken/repair_translation": "^1.0" "stefanfroemken/repair_translation": "^1.0"
}, },
"require-dev": { "require-dev": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment