Commit 5044fe4d authored by Benni Mack's avatar Benni Mack

[TASK] Split up RecordList table rendering

The DatabaseRecordList class has a few larger methods
to compile HTML ready to be rendered.

This change cleans up several parts of DatabaseRecordList
in order to extract further functionality (such as CSV Export)
into an own class:

* Remove unused / overridden styling properties
* Clean up "More records" button at the bottom of the page list
* Rename internal variable $iLimit to $itemsPerPage
* Separate the order of tables to list into a separate method
  "getTablesToRender()" out of the main method "generateList()"
* Explicitly state the $table parameter for "listUrl()"
  methods where applicable
* Move processing of columns-to-render per table to "getColumnsToRender()"
* Move processing of SQL select fields to query to "getFieldsToSelect()"
* Further cleanups regarding types (bool / int)

Resolves: #93847
Releases: master
Change-Id: Ib2eef99aa534a49c7799f320cd700f150335c36c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/68666Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent fca4b6d1
......@@ -14,20 +14,6 @@ div.recordlist {
}
}
table.typo3-dblist-overview {
margin-top: 10px;
margin-left: 1px;
width: 410px;
td.c-tableDescription {
padding-left: 10px;
img {
margin-right: 10px;
}
}
}
div#typo3-newRecordLink,
div.typo3-newRecordLink,
div.typo3-localizationLink,
......
......@@ -102,7 +102,7 @@ class TranslationConfigurationProvider
* @param int $uid Record uid
* @param int $languageUid Language uid. If 0, then all languages are selected.
* @param array $row The record to be translated
* @param string $selFieldList Select fields for the query which fetches the translations of the current record
* @param array|string $selFieldList Select fields for the query which fetches the translations of the current record
* @return mixed Array with information or error message as a string.
*/
public function translationInfo($table, $uid, $languageUid = 0, array $row = null, $selFieldList = '')
......@@ -126,8 +126,14 @@ class TranslationConfigurationProvider
return 'Record "' . $table . '_' . $uid . '" seems to be a translation already (has a relation to record "' . $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] . '")';
}
// Look for translations of this record, index by language field value:
if (!$selFieldList) {
$selFieldList = 'uid,' . $GLOBALS['TCA'][$table]['ctrl']['languageField'];
if (!empty($selFieldList)) {
if (is_array($selFieldList)) {
$selectFields = $selFieldList;
} else {
$selectFields = GeneralUtility::trimExplode(',', $selFieldList);
}
} else {
$selectFields = ['uid', $GLOBALS['TCA'][$table]['ctrl']['languageField']];
}
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
$queryBuilder->getRestrictions()
......@@ -135,7 +141,7 @@ class TranslationConfigurationProvider
->add(GeneralUtility::makeInstance(DeletedRestriction::class))
->add(GeneralUtility::makeInstance(WorkspaceRestriction::class, $this->getBackendUserAuthentication()->workspace));
$queryBuilder
->select(...GeneralUtility::trimExplode(',', $selFieldList))
->select(...$selectFields)
->from($table)
->where(
$queryBuilder->expr()->eq(
......
......@@ -162,7 +162,7 @@ class RecordListController
$dblist->setModuleData($MOD_SETTINGS ?? []);
$dblist->calcPerms = $calcPerms;
$dblist->returnUrl = $returnUrl;
$dblist->allFields = $MOD_SETTINGS['bigControlPanel'] || $table ? 1 : 0;
$dblist->allFields = (bool)($MOD_SETTINGS['bigControlPanel'] || $table);
$dblist->showClipboard = true;
$dblist->disableSingleTableView = $modTSconfig['properties']['disableSingleTableView'];
$dblist->listOnlyInSingleTableMode = $modTSconfig['properties']['listOnlyInSingleTableView'];
......@@ -363,7 +363,7 @@ class RecordListController
}
// Printing clipboard if enabled
if ($MOD_SETTINGS['clipBoard'] && $dblist->showClipboard && ($tableOutput || $dblist->clipObj->hasElements())) {
$body .= '<div class="db_list-dashboard">' . $dblist->clipObj->printClipboard() . '</div>';
$body .= $dblist->clipObj->printClipboard();
}
// Additional footer content
$body .= $additionalRecordListEvent->getAdditionalContentBelow();
......
Markdown is supported
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