Commit 41a79d60 authored by Michael Oehlhof's avatar Michael Oehlhof Committed by Benjamin Kott
Browse files

[TASK] Use ModuleTemplate API for ext:recycler

Resolves: #70367
Releases: master
Change-Id: I5861cd2de035e2b730aca2f40adf74ff913a7d95
Reviewed-on: http://review.typo3.org/43803


Reviewed-by: default avatarDaniel Goerz <ervaude@gmail.com>
Tested-by: default avatarDaniel Goerz <ervaude@gmail.com>
Reviewed-by: Benjamin Kott's avatarBenjamin Kott <info@bk2k.info>
Tested-by: Benjamin Kott's avatarBenjamin Kott <info@bk2k.info>
parent a805a62b
......@@ -35,9 +35,6 @@
height: 100%;
width: 100%;
background-color: @module-bg;
form {
margin: 0;
}
}
......
......@@ -250,8 +250,10 @@ class ModuleTemplate {
*/
protected function setupPage() {
// Yes, hardcoded on purpose
$this->pageRenderer->setXmlPrologAndDocType('<!DOCTYPE html>');
$this->pageRenderer->setCharSet('utf-8');
$this->pageRenderer->setLanguage('default');
$this->pageRenderer->addMetaTag('<meta name="viewport" content="width=device-width, initial-scale=1">');
}
/**
......
......@@ -14,13 +14,18 @@ namespace TYPO3\CMS\Recycler\Controller;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
use TYPO3\CMS\Backend\View\BackendTemplateView;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
/**
* Module 'Recycler' for the 'recycler' extension.
*/
class RecyclerModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
class RecyclerModuleController extends ActionController {
/**
* @var string
......@@ -57,6 +62,18 @@ class RecyclerModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionC
*/
protected $id;
/**
* @var BackendTemplateView
*/
protected $view;
/**
* BackendTemplateView Container
*
* @var BackendTemplateView
*/
protected $defaultViewObjectName = BackendTemplateView::class;
/**
* Initializes the Module
*
......@@ -87,6 +104,18 @@ class RecyclerModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionC
}
}
/**
* Initialize the view
*
* @param ViewInterface $view The view
* @return void
*/
public function initializeView(ViewInterface $view) {
/** @var BackendTemplateView $view */
parent::initializeView($view);
$this->registerDocheaderButtons();
}
/**
* Renders the content of the module.
*
......@@ -95,13 +124,48 @@ class RecyclerModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionC
public function indexAction() {
// Integrate dynamic JavaScript such as configuration or lables:
$jsConfiguration = $this->getJavaScriptConfiguration();
$this->getPageRenderer()->addInlineSettingArray('Recycler', $jsConfiguration);
$this->getPageRenderer()->addInlineLanguageLabelFile('EXT:recycler/Resources/Private/Language/locallang.xlf');
$this->view->getModuleTemplate()->getPageRenderer()->addInlineSettingArray('Recycler', $jsConfiguration);
$this->view->getModuleTemplate()->getPageRenderer()->addInlineLanguageLabelFile('EXT:recycler/Resources/Private/Language/locallang.xlf');
$this->view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation($this->pageRecord);
$this->view->assign('title', $this->getLanguageService()->getLL('title'));
$this->view->assign('allowDelete', $this->allowDelete);
}
/**
* Registers the Icons into the docheader
*
* @return void
* @throws \InvalidArgumentException
*/
protected function registerDocheaderButtons() {
/** @var ButtonBar $buttonBar */
$buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
$currentRequest = $this->request;
$moduleName = $currentRequest->getPluginName();
$getVars = $this->request->getArguments();
$mayMakeShortcut = $this->getBackendUser()->mayMakeShortcut();
if ($mayMakeShortcut) {
$extensionName = $currentRequest->getControllerExtensionName();
if (count($getVars) === 0) {
$modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
$getVars = array('id', 'M', $modulePrefix);
}
$getList = implode(',', $getVars);
$shortcutButton = $buttonBar->makeFullyRenderedButton()
->setHtmlSource($this->view->getModuleTemplate()->makeShortcutIcon($getList, '', $moduleName));
$buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT);
}
$reloadButton = $buttonBar->makeLinkButton()
->setHref('#')
->setDataAttributes(['action' => 'reload'])
->setTitle($this->getLanguageService()->sL('LLL:EXT:recycler/Resources/Private/Language/locallang.xlf:button.reload', TRUE))
->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-refresh', Icon::SIZE_SMALL));
$buttonBar->addButton($reloadButton, ButtonBar::BUTTON_POSITION_LEFT);
}
/**
* Determines whether the current user is admin.
*
......@@ -173,13 +237,4 @@ class RecyclerModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionC
protected function getLanguageService() {
return $GLOBALS['LANG'];
}
/**
* Returns current PageRenderer
*
* @return PageRenderer
*/
protected function getPageRenderer() {
return GeneralUtility::makeInstance(PageRenderer::class);
}
}
<f:be.container
includeRequireJsModules="{
0:'TYPO3/CMS/Recycler/Recycler'
}"
>
<div class="typo3-fullDoc">
<div id="typo3-docheader">
<div class="typo3-docheader-functions">
<div class="left">
<f:be.buttons.csh />
</div>
<div class="right">
</div>
</div>
<div class="typo3-docheader-buttons">
<div class="left">
<f:render section="iconButtons" />
</div>
<div class="right">
<f:be.buttons.shortcut />
</div>
</div>
</div>
<div id="typo3-docbody">
<div id="typo3-inner-docbody">
<h1><f:translate key="title" /></h1>
<f:flashMessages />
<f:render section="content" />
</div>
</div>
</div>
</f:be.container>
\ No newline at end of file
<f:be.pageRenderer includeRequireJsModules="{0:'TYPO3/CMS/Recycler/Recycler'}" />
<h1><f:translate key="title" /></h1>
<f:flashMessages />
<f:render section="content" />
{namespace core=TYPO3\CMS\Core\ViewHelpers}
<f:layout name="Default" />
<f:section name="iconButtons">
<a data-action="reload" title="{f:translate(key:'button.reload')}"><core:icon identifier="actions-refresh" /></a>
</f:section>
<f:section name="content">
<div id="recycler-index" class="tx_recycler_recycler">
<form id="recycler-form" class="form-inline">
<div class="input-group">
<input type="text" name="search-text" class="form-control">
<span class="input-group-btn">
<button type="submit" class="btn btn-default disabled"><core:icon identifier="actions-search" /></button>
</span>
<form id="recycler-form" class="form-inline form-inline-spaced">
<div class="form-group">
<div class="input-group">
<input type="text" name="search-text" class="form-control">
<span class="input-group-btn">
<button type="submit" class="btn btn-default disabled"><core:icon identifier="actions-search" /></button>
</span>
</div>
</div>
<div class="form-group">
<select name="depth" class="form-control">
<option value="0"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.depth_0" /></option>
<option value="1"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.depth_1" /></option>
<option value="2"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.depth_2" /></option>
<option value="3"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.depth_3" /></option>
<option value="4"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.depth_4" /></option>
<option value="999"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.depth_infi" /></option>
</select>
</div>
<div class="form-group">
<select name="pages" class="form-control"></select>
</div>
<select name="depth" class="form-control">
<option value="0"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.depth_0" /></option>
<option value="1"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.depth_1" /></option>
<option value="2"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.depth_2" /></option>
<option value="3"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.depth_3" /></option>
<option value="4"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.depth_4" /></option>
<option value="999"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.depth_infi" /></option>
</select>
<select name="pages" class="form-control"></select>
</form>
<table class="table table-hover" id="itemsInRecycler">
<thead>
......
......@@ -187,7 +187,7 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/jquery.clearable'], function($
* Initialize the recycler module
*/
Recycler.initialize = function() {
NProgress.configure({parent: '#typo3-docheader', showSpinner: false});
NProgress.configure({parent: 'body', showSpinner: false});
Recycler.getElements();
Recycler.registerEvents();
......
......@@ -7859,9 +7859,6 @@ button.close {
width: 100%;
background-color: #ffffff;
}
.module form {
margin: 0;
}
.module-docheader {
position: fixed;
width: 100%;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment