17 use Psr\Http\Message\ResponseInterface;
18 use Psr\Http\Message\ServerRequestInterface;
59 'id' =>
'Using RecordListController::$id is deprecated and will not be possible anymore in TYPO3 v10.0.',
60 'pointer' =>
'Using RecordListController::$pointer is deprecated and will not be possible anymore in TYPO3 v10.0.',
61 'table' =>
'Using RecordListController::$table is deprecated and will not be possible anymore in TYPO3 v10.0.',
62 'search_field' =>
'Using RecordListController::$search_field is deprecated and will not be possible anymore in TYPO3 v10.0.',
63 'search_levels' =>
'Using RecordListController::$search_levels is deprecated and will not be possible anymore in TYPO3 v10.0.',
64 'showLimit' =>
'Using RecordListController::$showLimit is deprecated and will not be possible anymore in TYPO3 v10.0.',
65 'returnUrl' =>
'Using RecordListController::$returnUrl is deprecated and will not be possible anymore in TYPO3 v10.0.',
66 'clear_cache' =>
'Using RecordListController::$clear_cache is deprecated and will not be possible anymore in TYPO3 v10.0.',
67 'cmd' =>
'Using RecordListController::$cmd is deprecated and will not be possible anymore in TYPO3 v10.0.',
68 'cmd_table' =>
'Using RecordListController::$cmd_table is deprecated and will not be possible anymore in TYPO3 v10.0.',
69 'perms_clause' =>
'Using RecordListController::$perms_clause is deprecated and will not be possible anymore in TYPO3 v10.0.',
70 'pageinfo' =>
'Using RecordListController::$pageinfo is deprecated and will not be possible anymore in TYPO3 v10.0.',
71 'MOD_MENU' =>
'Using RecordListController::$MOD_MENU is deprecated and will not be possible anymore in TYPO3 v10.0.',
72 'content' =>
'Using RecordListController::$content is deprecated and will not be possible anymore in TYPO3 v10.0.',
73 'body' =>
'Using RecordListController::$body is deprecated and will not be possible anymore in TYPO3 v10.0.',
74 'imagemode' =>
'Using RecordListController::$imagemode is deprecated, property will be removed in TYPO3 v10.0.',
75 'doc' =>
'Using RecordListController::$doc is deprecated, property will be removed in TYPO3 v10.0.',
82 'init' =>
'Using RecordListController::init() is deprecated and will not be possible anymore in TYPO3 v10.0.',
83 'menuConfig' =>
'Using RecordListController::menuConfig() is deprecated and will not be possible anymore in TYPO3 v10.0.',
84 'clearCache' =>
'Using RecordListController::clearCache() is deprecated and will not be possible anymore in TYPO3 v10.0.',
85 'main' =>
'Using RecordListController::main() is deprecated and will not be possible anymore in TYPO3 v10.0.',
86 'getModuleTemplate' =>
'Using RecordListController::getModuleTemplate() is deprecated and will not be possible anymore in TYPO3 v10.0.',
256 $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
258 $this->moduleTemplate->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Recordlist/FieldSelectBox');
259 $this->moduleTemplate->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Recordlist/Recordlist');
265 protected function init()
267 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
271 $sessionData = $backendUser->getSessionData(__CLASS__);
272 $this->search_field = !empty($sessionData[
'search_field']) ? $sessionData[
'search_field'] :
'';
274 $this->
id = (int)GeneralUtility::_GP(
'id');
275 $this->pointer = GeneralUtility::_GP(
'pointer');
277 $this->imagemode = GeneralUtility::_GP(
'imagemode');
278 $this->table = GeneralUtility::_GP(
'table');
279 $this->search_field = GeneralUtility::_GP(
'search_field');
280 $this->search_levels = (int)GeneralUtility::_GP(
'search_levels');
281 $this->showLimit = GeneralUtility::_GP(
'showLimit');
282 $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP(
'returnUrl'));
283 $this->clear_cache = GeneralUtility::_GP(
'clear_cache');
284 $this->cmd = GeneralUtility::_GP(
'cmd');
285 $this->cmd_table = GeneralUtility::_GP(
'cmd_table');
290 $backendUser->setAndSaveSessionData(self::class, $sessionData);
301 'bigControlPanel' =>
'',
315 if ($this->clear_cache) {
316 $tce = GeneralUtility::makeInstance(DataHandler::class);
318 $tce->clear_cacheCmd($this->
id);
327 protected function main(ServerRequestInterface $request =
null)
329 if ($request ===
null) {
341 $access = is_array($this->pageinfo);
345 $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
348 $calcPerms = $backendUser->calcPerms($this->pageinfo);
349 $userCanEditPage = $calcPerms &
Permission::PAGE_EDIT && !empty($this->
id) && ($backendUser->isAdmin() || (int)$this->pageinfo[
'editlock'] === 0);
350 $pageActionsCallback =
null;
351 if ($userCanEditPage) {
352 $pageActionsCallback =
'function(PageActions) {
353 PageActions.setPageId(' . (int)$this->
id .
');
360 if ($this->modTSconfig[
'properties'][
'enableDisplayBigControlPanel'] ===
'activated') {
361 $this->MOD_SETTINGS[
'bigControlPanel'] =
true;
362 } elseif ($this->modTSconfig[
'properties'][
'enableDisplayBigControlPanel'] ===
'deactivated') {
363 $this->MOD_SETTINGS[
'bigControlPanel'] =
false;
366 if ($this->modTSconfig[
'properties'][
'enableClipBoard'] ===
'activated') {
367 $this->MOD_SETTINGS[
'clipBoard'] =
true;
368 } elseif ($this->modTSconfig[
'properties'][
'enableClipBoard'] ===
'deactivated') {
369 $this->MOD_SETTINGS[
'clipBoard'] =
false;
371 if ($this->MOD_SETTINGS[
'clipBoard'] ===
null) {
372 $this->MOD_SETTINGS[
'clipBoard'] =
true;
377 $dblist = GeneralUtility::makeInstance(DatabaseRecordList::class);
378 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
379 $dblist->script = (string)$uriBuilder->buildUriFromRoute(
'web_list');
380 $dblist->calcPerms = $calcPerms;
381 $dblist->thumbs = $backendUser->uc[
'thumbnailsByDefault'];
383 $dblist->allFields = $this->MOD_SETTINGS[
'bigControlPanel'] || $this->table ? 1 : 0;
384 $dblist->showClipboard = 1;
385 $dblist->disableSingleTableView = $this->modTSconfig[
'properties'][
'disableSingleTableView'];
386 $dblist->listOnlyInSingleTableMode = $this->modTSconfig[
'properties'][
'listOnlyInSingleTableView'];
387 $dblist->hideTables = $this->modTSconfig[
'properties'][
'hideTables'];
388 $dblist->hideTranslations = $this->modTSconfig[
'properties'][
'hideTranslations'];
389 $dblist->tableTSconfigOverTCA = $this->modTSconfig[
'properties'][
'table.'];
390 $dblist->allowedNewTables = GeneralUtility::trimExplode(
',', $this->modTSconfig[
'properties'][
'allowedNewTables'],
true);
391 $dblist->deniedNewTables = GeneralUtility::trimExplode(
',', $this->modTSconfig[
'properties'][
'deniedNewTables'],
true);
394 $dblist->MOD_MENU = [
'bigControlPanel' =>
'',
'clipBoard' =>
''];
396 $clickTitleMode = trim($this->modTSconfig[
'properties'][
'clickTitleMode']);
397 $dblist->clickTitleMode = $clickTitleMode ===
'' ?
'edit' : $clickTitleMode;
398 if (isset($this->modTSconfig[
'properties'][
'tableDisplayOrder.'])) {
399 $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
400 $dblist->setTableDisplayOrder($typoScriptService->convertTypoScriptArrayToPlainArray($this->modTSconfig[
'properties'][
'tableDisplayOrder.']));
404 $dblist->clipObj = GeneralUtility::makeInstance(Clipboard::class);
406 $dblist->clipObj->initializeClipboard();
409 $CB = GeneralUtility::_GET(
'CB');
410 if ($this->cmd ===
'setCB') {
414 $CB[
'el'] = $dblist->clipObj->cleanUpCBC(array_merge(GeneralUtility::_POST(
'CBH'), (array)GeneralUtility::_POST(
'CBC')), $this->cmd_table);
416 if (!$this->MOD_SETTINGS[
'clipBoard']) {
418 $CB[
'setP'] =
'normal';
421 $dblist->clipObj->setCmd($CB);
423 $dblist->clipObj->cleanCurrent();
425 $dblist->clipObj->endClipboard();
428 $dblist->dontShowClipControlPanels = ($dblist->clipObj->current ===
'normal' && !$this->modTSconfig[
'properties'][
'showClipControlPanelsDespiteOfCMlayers']);
430 if ($access || ($this->
id === 0 && $this->search_levels !== 0 && $this->search_field !==
'')) {
433 if ($this->cmd ===
'delete') {
434 $items = $dblist->clipObj->cleanUpCBC(GeneralUtility::_POST(
'CBC'),
$this->cmd_table, 1);
435 if (!empty($items)) {
437 foreach ($items as $iK => $value) {
438 $iKParts = explode(
'|', $iK);
439 $cmd[$iKParts[0]][$iKParts[1]][
'delete'] = 1;
441 $tce = GeneralUtility::makeInstance(DataHandler::class);
442 $tce->start([],
$cmd);
443 $tce->process_cmdmap();
444 if (isset(
$cmd[
'pages'])) {
447 $tce->printLogErrorMessages();
451 $this->pointer = max(0, (
int)$this->pointer);
452 $dblist->start($this->
id, $this->table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
453 $dblist->setDispFields();
455 $dblist->generateList();
456 $listUrl = $dblist->listURL();
459 $this->moduleTemplate->addJavaScriptCode(
460 'RecordListInlineJS',
462 function jumpExt(URL,anchor) {
463 var anc = anchor?anchor:"";
464 window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc;
467 function jumpSelf(URL) {
468 window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:"");
471 function jumpToUrl(URL) {
472 window.location.href = URL;
476 function setHighlight(id) {
477 top.fsMod.recentIds["web"] = id;
478 top.fsMod.navFrameHighlightedID["web"] = top.fsMod.currentBank + "_" + id; // For highlighting
480 if (top.nav_frame && top.nav_frame.refresh_nav) {
481 top.nav_frame.refresh_nav();
484 ' . $this->moduleTemplate->redirectUrls($listUrl) .
'
485 ' . $dblist->CBfunctions() .
'
486 function editRecords(table,idList,addParams,CBflag) {
487 window.location.href="' . (
string)$uriBuilder->buildUriFromRoute(
'record_edit', [
'returnUrl' => GeneralUtility::getIndpEnv(
'REQUEST_URI')]) .
'&edit["+table+"]["+idList+"]=edit"+addParams;
489 function editList(table,idList) {
492 // Checking how many is checked, how many is not
494 var pos = idList.indexOf(",");
496 if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) {
497 list+=idList.substr(pointer,pos-pointer)+",";
500 pos = idList.indexOf(",",pointer);
502 if (cbValue(table+"|"+idList.substr(pointer))) {
503 list+=idList.substr(pointer)+",";
506 return list ? list : idList;
509 if (top.fsMod) top.fsMod.recentIds["web"] = ' . (
int)$this->id .
';
514 $this->moduleTemplate->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Backend/ContextMenu');
519 $title =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'];
521 $title = $this->pageinfo[
'title'];
523 $this->body = $this->moduleTemplate->header($title);
526 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'recordlist/Modules/Recordlist/index.php'][
'drawHeaderHook'] ?? [] as $hook) {
528 'request' => $request,
531 $this->body .= GeneralUtility::callUserFunction($hook, $params, $this);
534 $this->moduleTemplate->setTitle($title);
539 if ($this->
id && !$dblist->csvOutput && !$this->search_field && !$this->cmd && !$this->table) {
541 $pageTranslationsDatabaseRecordList = clone $dblist;
542 $pageTranslationsDatabaseRecordList->listOnlyInSingleTableMode =
false;
543 $pageTranslationsDatabaseRecordList->disableSingleTableView =
true;
544 $pageTranslationsDatabaseRecordList->deniedNewTables = [
'pages'];
545 $pageTranslationsDatabaseRecordList->hideTranslations =
'';
546 $pageTranslationsDatabaseRecordList->iLimit = $pageTranslationsDatabaseRecordList->itemsLimitPerTable;
547 $pageTranslationsDatabaseRecordList->setLanguagesAllowedForUser($this->siteLanguages);
548 $pageTranslationsDatabaseRecordList->showOnlyTranslatedRecords(
true);
549 $output .= $pageTranslationsDatabaseRecordList->getTable(
'pages', $this->
id);
552 if (!empty($dblist->HTMLcode)) {
555 if (isset($this->table,
$GLOBALS[
'TCA'][$this->table][
'ctrl'][
'title'])) {
556 if (strpos(
$GLOBALS[
'TCA'][$this->table][
'ctrl'][
'title'],
'LLL:') === 0) {
557 $ll = sprintf($lang->getLL(
'noRecordsOfTypeOnThisPage'), $lang->sL(
$GLOBALS[
'TCA'][$this->table][
'ctrl'][
'title']));
559 $ll = sprintf($lang->getLL(
'noRecordsOfTypeOnThisPage'),
$GLOBALS[
'TCA'][$this->table][
'ctrl'][
'title']);
562 $ll = $lang->getLL(
'noRecordsOnThisPage');
564 $flashMessage = GeneralUtility::makeInstance(
572 $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
574 $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
575 $defaultFlashMessageQueue->enqueue($flashMessage);
578 $this->body .=
'<form action="' . htmlspecialchars($dblist->listURL()) .
'" method="post" name="dblistForm">';
580 $this->body .=
'<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>';
582 if ($dblist->HTMLcode) {
584 if ($dblist->table) {
585 $this->body .= $dblist->fieldSelectBox($dblist->table);
591 Listing options for extended view and clipboard view
593 <div class="typo3-listOptions">
594 <form action="" method="post">';
597 if ($this->modTSconfig[
'properties'][
'enableDisplayBigControlPanel'] ===
'selectable') {
598 $this->body .=
'<div class="checkbox">' .
599 '<label for="checkLargeControl">' .
600 BackendUtility::getFuncCheck($this->
id,
'SET[bigControlPanel]', $this->MOD_SETTINGS[
'bigControlPanel'],
'', $this->table ?
'&table=' . $this->table :
'',
'id="checkLargeControl"') .
607 if ($this->modTSconfig[
'properties'][
'enableClipBoard'] ===
'selectable') {
608 if ($dblist->showClipboard) {
609 $this->body .=
'<div class="checkbox">' .
610 '<label for="checkShowClipBoard">' .
611 BackendUtility::getFuncCheck($this->
id,
'SET[clipBoard]', $this->MOD_SETTINGS[
'clipBoard'],
'', $this->table ?
'&table=' . $this->table :
'',
'id="checkShowClipBoard"') .
623 if ($this->MOD_SETTINGS[
'clipBoard'] && $dblist->showClipboard && ($dblist->HTMLcode || $dblist->clipObj->hasElements())) {
624 $this->body .=
'<div class="db_list-dashboard">' . $dblist->clipObj->printClipboard() .
'</div>';
627 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'recordlist/Modules/Recordlist/index.php'][
'drawFooterHook'] ?? [] as $hook) {
629 'request' => $request,
632 $this->body .= GeneralUtility::callUserFunction($hook, $params, $this);
635 $dblist->getDocHeaderButtons($this->moduleTemplate);
637 if (!$this->modTSconfig[
'properties'][
'disableSearchBox'] && ($dblist->HTMLcode || !empty($dblist->searchString))) {
638 $this->content = $dblist->getSearchBox();
639 $this->moduleTemplate->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Backend/ToggleSearchToolbox');
641 $searchButton = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->makeLinkButton();
644 ->setClasses(
't3js-toggle-search-toolbox')
645 ->setTitle($lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.title.searchIcon'))
647 $this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->addButton(
654 if ($this->pageinfo) {
655 $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
669 public function mainAction(ServerRequestInterface $request): ResponseInterface
671 $this->site = $request->getAttribute(
'site');
678 $this->
main($request);
679 $this->moduleTemplate->setContent($this->content);
680 return new HtmlResponse($this->moduleTemplate->renderContent());
696 $availableTranslations = [];
697 foreach ($this->siteLanguages as $siteLanguage) {
698 if ($siteLanguage->getLanguageId() === 0) {
701 $availableTranslations[$siteLanguage->getLanguageId()] = $siteLanguage->getTitle();
704 $localizationParentField =
$GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'transOrigPointerField'];
705 $languageField =
$GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'languageField'];
706 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'pages');
707 $queryBuilder->getRestrictions()->removeAll()
708 ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
709 ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
710 $statement = $queryBuilder->select(
'uid', $languageField)
713 $queryBuilder->expr()->eq(
714 $localizationParentField,
715 $queryBuilder->createNamedParameter($this->id, \PDO::PARAM_INT)
719 while ($pageTranslation = $statement->fetch()) {
720 unset($availableTranslations[(
int)$pageTranslation[$languageField]]);
723 if (!empty($availableTranslations)) {
724 $output =
'<option value="">' . htmlspecialchars($this->
getLanguageService()->sL(
'LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:new_language')) .
'</option>';
725 foreach ($availableTranslations as $languageUid => $languageTitle) {
730 'justLocalized' =>
'pages:' .
$id .
':' . $languageUid,
731 'returnUrl' => GeneralUtility::getIndpEnv(
'REQUEST_URI')
733 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
734 $redirectUrl = (string)$uriBuilder->buildUriFromRoute(
'record_edit', $parameters);
736 '&cmd[pages][' .
$id .
'][localize]=' . $languageUid,
740 $output .=
'<option value="' . htmlspecialchars($targetUrl) .
'">' . htmlspecialchars($languageTitle) .
'</option>';
743 return '<div class="form-inline form-inline-spaced">'
744 .
'<div class="form-group">'
745 .
'<select class="form-control input-sm" name="createNewLanguage" onchange="window.location.href=this.options[this.selectedIndex].value">'
747 .
'</select></div></div>';
781 if ($this->pageRenderer ===
null) {
782 $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);