Skip to content
This repository was archived by the owner on May 4, 2021. It is now read-only.
4 changes: 3 additions & 1 deletion Classes/Hooks/DrawItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use TYPO3\CMS\Backend\View\PageLayoutViewDrawFooterHookInterface;
use TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder;
Expand Down Expand Up @@ -109,7 +110,8 @@ class DrawItem implements PageLayoutViewDrawItemHookInterface, SingletonInterfac

public function __construct()
{
$this->extentensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['gridelements']);
$extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class);
$this->extentensionConfiguration = $extConf->get('gridelements');
$this->setLanguageService($GLOBALS['LANG']);
$this->helper = Helper::getInstance();
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
Expand Down
8 changes: 4 additions & 4 deletions Classes/Hooks/PageRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Recordlist\RecordList;
use TYPO3\CMS\Recordlist\Controller\RecordListController;

/**
* Class/Function which adds the necessary ExtJS and pure JS stuff for the grid elements.
Expand All @@ -57,8 +57,8 @@ class PageRenderer implements SingletonInterface
*/
public function addJSCSS(array $parameters, \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer)
{
if (!empty($GLOBALS['SOBE']) && (get_class($GLOBALS['SOBE']) === RecordList::class || is_subclass_of($GLOBALS['SOBE'],
RecordList::class))) {
if (!empty($GLOBALS['SOBE']) && (get_class($GLOBALS['SOBE']) === RecordListController::class || is_subclass_of($GLOBALS['SOBE'],
RecordListController::class))) {
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsOnReady');
return;
}
Expand All @@ -76,7 +76,7 @@ public function addJSCSS(array $parameters, \TYPO3\CMS\Core\Page\PageRenderer $p
$clipObj->lockToNormal();
$clipBoard = $clipObj->clipData['normal'];
if (!$pageRenderer->getCharSet()) {
$pageRenderer->setCharSet($GLOBALS['LANG']->charSet ? $GLOBALS['LANG']->charSet : 'utf-8');
$pageRenderer->setCharSet('utf-8');
}

// pull locallang_db.xml to JS side - only the tx_gridelements_js-prefixed keys
Expand Down
71 changes: 46 additions & 25 deletions Classes/Xclass/DatabaseRecordList.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

use TYPO3\CMS\Backend\Module\BaseScriptClass;
use TYPO3\CMS\Backend\RecordList\RecordListGetTableHookInterface;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Template\ModuleTemplate;
Expand All @@ -37,6 +38,7 @@
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\HttpUtility;
use TYPO3\CMS\Extbase\Persistence\Generic\Query;
use TYPO3\CMS\Frontend\Page\PageRepository;
use TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface;

Expand Down Expand Up @@ -303,8 +305,9 @@ public function getButtons()
}
// New record on pages that are not locked by editlock
if (!$module->modTSconfig['properties']['noCreateRecordsLink'] && $this->editLockPermissions()) {
$onClick = htmlspecialchars('return jumpExt(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('db_new',
['id' => $this->id])) . ');');
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$onClick = htmlspecialchars('return jumpExt(' . GeneralUtility::quoteJSvalue(
$uriBuilder->buildUriFromRoute('db_new', ['id' => $this->id])) . ');');
$buttons['new_record'] = '<a href="#" onclick="' . $onClick . '" title="'
. htmlspecialchars($lang->getLL('newRecordGeneral')) . '">'
. $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL)->render() . '</a>';
Expand Down Expand Up @@ -350,7 +353,8 @@ public function getButtons()
. $this->iconFactory->getIcon('actions-document-export-csv', Icon::SIZE_SMALL)->render() . '</a>';
// Export
if (ExtensionManagementUtility::isLoaded('impexp')) {
$url = BackendUtility::getModuleUrl('xMOD_tximpexp', ['tx_impexp[action]' => 'export']);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$url = $uriBuilder->buildUriFromRoute('xMOD_tximpexp', ['tx_impexp[action]' => 'export']);
$buttons['export'] = '<a href="' . htmlspecialchars($url . '&tx_impexp[list][]='
. rawurlencode($this->table . ':' . $this->id)) . '" title="'
. htmlspecialchars($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:rm.export')) . '">'
Expand Down Expand Up @@ -449,8 +453,9 @@ public function getDocHeaderButtons(ModuleTemplate $moduleTemplate)
}
// New record on pages that are not locked by editlock
if (!$module->modTSconfig['properties']['noCreateRecordsLink'] && $this->editLockPermissions()) {
$onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('db_new',
['id' => $this->id])) . ');';
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue(
$uriBuilder->buildUriFromRoute('db_new', ['id' => $this->id])) . ');';
$newRecordButton = $buttonBar->makeLinkButton()
->setHref('#')
->setOnClick($onClick)
Expand Down Expand Up @@ -516,7 +521,8 @@ public function getDocHeaderButtons(ModuleTemplate $moduleTemplate)
$buttonBar->addButton($csvButton, ButtonBar::BUTTON_POSITION_LEFT, 40);
// Export
if (ExtensionManagementUtility::isLoaded('impexp')) {
$url = BackendUtility::getModuleUrl('xMOD_tximpexp', ['tx_impexp[action]' => 'export']);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$url = $uriBuilder->buildUriFromRoute('xMOD_tximpexp', ['tx_impexp[action]' => 'export']);
$exportButton = $buttonBar->makeLinkButton()
->setHref($url . '&tx_impexp[list][]=' . rawurlencode($this->table . ':' . $this->id))
->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:rm.export'))
Expand Down Expand Up @@ -712,7 +718,7 @@ public function getTable($table, $id, $rowList = '')
$this->selFieldList = $selFieldList;
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'] as $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
$hookObject = GeneralUtility::makeInstance($classData);
if (!$hookObject instanceof RecordListGetTableHookInterface) {
throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListGetTableHookInterface::class,
1195114460);
Expand Down Expand Up @@ -1279,7 +1285,7 @@ public function renderListRow($table, $row, $cc, $titleCol, $thumbsCol, $indent
*/
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
$hookObject = GeneralUtility::makeInstance($classData);
if (is_object($hookObject) && method_exists($hookObject, 'checkChildren')) {
$hookObject->checkChildren($table, $row, $level, $theData, $this);
}
Expand Down Expand Up @@ -1319,9 +1325,16 @@ function ($attributeValue) {
// $lRow isn't always what we want - if record was moved we've to work with the
// placeholder records otherwise the list is messed up a bit
if ($row['_MOVE_PLH_uid'] && $row['_MOVE_PLH_pid']) {
$where = 't3ver_move_id="' . (int)$lRow['uid'] . '" AND pid="' . $row['_MOVE_PLH_pid']
. '" AND t3ver_wsid=' . $row['t3ver_wsid'] . BackendUtility::deleteClause($table);
$tmpRow = BackendUtility::getRecordRaw($table, $where, $this->selFieldList);
/** @var QueryBuilder $qbuilder */
$qBuilder = GeneralUtility::makeInstance( QueryBuilder::class );
$qBuilder->select($this->selFieldList)
->from($table)
->where([
't3ver_move_id' => (int)$lRow['uid'],
'pid' => $row['_MOVE_PLH_pid'],
't3ver_wsid' => $row['t3ver_wsid'] . BackendUtility::deleteClause($table)
]);
$tmpRow = $qBuilder->execute()->fetchAll();
$lRow = is_array($tmpRow) ? $tmpRow : $lRow;
}
// In offline workspace, look for alternative record:
Expand Down Expand Up @@ -1513,7 +1526,9 @@ public function makeControl($table, $row)
$this->addActionToCellGroup($cells, $viewBigAction, 'viewBig');
// "Move" wizard link for pages/tt_content elements:
if ($permsEdit && ($table === 'tt_content' || $table === 'pages')) {
$onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('move_element') . '&table=' . $table . '&uid=' . $row['uid']) . ');';
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue(
$uriBuilder->buildUriFromRoute('move_element' ) . '&table=' . $table . '&uid=' . $row['uid']) . ');';
$linkTitleLL = htmlspecialchars($this->getLanguageService()->getLL('move_' . ($table === 'tt_content' ? 'record' : 'page')));
$icon = ($table === 'pages' ? $this->iconFactory->getIcon('actions-page-move',
Icon::SIZE_SMALL) : $this->iconFactory->getIcon('actions-document-move', Icon::SIZE_SMALL));
Expand All @@ -1523,7 +1538,8 @@ public function makeControl($table, $row)
// If the table is NOT a read-only table, then show these links:
if ($this->isEditable($table)) {
// "Revert" link (history/undo)
$moduleUrl = BackendUtility::getModuleUrl('record_history', ['element' => $table . ':' . $row['uid']]);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$moduleUrl = $uriBuilder->buildUriFromRoute('record_history', ['element' => $table . ':' . $row['uid']]);
$onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue($moduleUrl) . ',\'#latest\');';
$historyAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="'
. htmlspecialchars($this->getLanguageService()->getLL('history')) . '">'
Expand All @@ -1535,7 +1551,8 @@ public function makeControl($table, $row)
$this->getBackendUserAuthentication()->workspace, false, $row);
// If table can be versionized.
if (is_array($vers)) {
$href = BackendUtility::getModuleUrl('web_txversionM1', [
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$href = $uriBuilder->buildUriFromRoute('web_txversionM1', [
'table' => $table,
'uid' => $row['uid'],
]);
Expand All @@ -1548,7 +1565,8 @@ public function makeControl($table, $row)
// "Edit Perms" link:
if ($table === 'pages' && $this->getBackendUserAuthentication()->check('modules',
'system_BeuserTxPermission') && ExtensionManagementUtility::isLoaded('beuser')) {
$href = BackendUtility::getModuleUrl('system_BeuserTxPermission') . '&id=' . $row['uid'] . '&returnId=' . $row['uid'] . '&tx_beuser_system_beusertxpermission[action]=edit';
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$href = $uriBuilder->buildUriFromRoute('system_BeuserTxPermission') . '&id=' . $row['uid'] . '&returnId=' . $row['uid'] . '&tx_beuser_system_beusertxpermission[action]=edit';
$permsAction = '<a class="btn btn-default" href="' . htmlspecialchars($href) . '" title="'
. htmlspecialchars($this->getLanguageService()->getLL('permissions')) . '">'
. $this->iconFactory->getIcon('actions-lock', Icon::SIZE_SMALL)->render() . '</a>';
Expand Down Expand Up @@ -1731,7 +1749,7 @@ public function makeControl($table, $row)
}
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
$hookObject = GeneralUtility::makeInstance($classData);
if (!$hookObject instanceof RecordListHookInterface) {
throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListHookInterface::class,
1195567840);
Expand Down Expand Up @@ -2033,7 +2051,7 @@ public function makeClip($table, $row)
*/
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
$hookObject = GeneralUtility::makeInstance($classData);
if (!$hookObject instanceof RecordListHookInterface) {
throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListHookInterface::class,
1195567845);
Expand Down Expand Up @@ -2150,7 +2168,7 @@ public function addElement($h, $icon, $data, $rowParams = '', $_ = '', $_2 = '',
*/
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
$hookObject = GeneralUtility::makeInstance($classData);
if (is_object($hookObject) && method_exists($hookObject, 'contentCollapseIcon')) {
$hookObject->contentCollapseIcon($data, $sortField, $level, $contentCollapseIcon, $this);
}
Expand Down Expand Up @@ -2466,7 +2484,7 @@ public function renderListHeader($table, $currentIdList)
*/
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
$hookObject = GeneralUtility::makeInstance($classData);
if (!$hookObject instanceof RecordListHookInterface) {
throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListHookInterface::class,
1195567850);
Expand Down Expand Up @@ -2509,7 +2527,8 @@ class="btn btn-default t3js-toggle-gridelements-all" href="#t3-gridelements-expa
$newContentElementWizard = isset($tmpTSc['properties']['newContentElementWizard.']['override'])
? $tmpTSc['properties']['newContentElementWizard.']['override']
: 'new_content_element';
$newContentWizScriptPath = BackendUtility::getModuleUrl($newContentElementWizard,
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$newContentWizScriptPath = $uriBuilder->buildUriFromRoute($newContentElementWizard,
['id' => $this->id]);

$onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue($newContentWizScriptPath) . ');';
Expand All @@ -2521,7 +2540,8 @@ class="btn btn-default t3js-toggle-gridelements-all" href="#t3-gridelements-expa
'pagesOnly' => 1,
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI'),
];
$href = BackendUtility::getModuleUrl('db_new', $parameters);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$href = $uriBuilder->buildUriFromRoute('db_new', $parameters);
$icon = '<a class="btn btn-default" href="' . htmlspecialchars($href) . '" title="' . htmlspecialchars($lang->getLL('new')) . '">'
. $spriteIcon->render() . '</a>';
} else {
Expand Down Expand Up @@ -2628,7 +2648,7 @@ class="btn btn-default t3js-toggle-gridelements-all" href="#t3-gridelements-expa
*/
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
$hookObject = GeneralUtility::makeInstance($classData);
if (!$hookObject instanceof RecordListHookInterface) {
throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListHookInterface::class,
1195567855);
Expand Down Expand Up @@ -2760,10 +2780,11 @@ public function outputCSV($prefix)
public function pasteUrl($table, $uid, $setRedirect = true, array $update = null)
{
$formProtection = FormProtectionFactory::get();
return ($table === '_FILE' ? BackendUtility::getModuleUrl('tce_file',
[]) : BackendUtility::getModuleUrl('tce_db', []))
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
return ($table === '_FILE' ? $uriBuilder->buildUriFromRoute('tce_file', [])
: $uriBuilder->buildUriFromRoute('tce_db', []))
. ($setRedirect ? '&redirect=' . rawurlencode(GeneralUtility::linkThisScript(['CB' => ''])) : '')
. '&vC=' . $this->getBackendUserAuthentication()->veriCode() . '&prErr=1&uPT=1' . '&CB[paste]='
. '&prErr=1&uPT=1' . '&CB[paste]='
. rawurlencode($table . '|' . $uid) . '&CB[pad]=' . $this->clipObj->current
. (is_array($update) ? GeneralUtility::implodeArrayForUrl('CB[update]', $update) : '')
. '&formToken=' . $formProtection->generateToken('tceAction');
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"issues": "https://forge.typo3.org/projects/extension-gridelements2/issues"
},
"require": {
"typo3/cms-core": "^9.3 || dev-master",
"typo3/cms-backend": "^9.3 || dev-master",
"typo3/cms-recordlist": "^9.3 || dev-master",
"typo3/cms-frontend": "^9.3 || dev-master"
"typo3/cms-core": "^9.5 || dev-master",
"typo3/cms-backend": "^9.5 || dev-master",
"typo3/cms-recordlist": "^9.5 || dev-master",
"typo3/cms-frontend": "^9.5 || dev-master"
},
"conflict": {
"templavoila": "*",
Expand Down
Loading