[BUGFIX] Rearrange DocHeader buttons for Web->List 29/44029/3
authorMathias Schreiber <mathias.schreiber@wmdb.de>
Tue, 13 Oct 2015 11:30:49 +0000 (13:30 +0200)
committerFrans Saris <franssaris@gmail.com>
Tue, 13 Oct 2015 14:55:31 +0000 (16:55 +0200)
With the introduction of Help- and Shortcut Buttons Web->List needed to
be adapted to make use of them.
Also CGL errors have been corrected.

Resolves: #70649
Releases: master
Change-Id: Iba0724256dbd2f9d31224ab0a3f779101366290f
Reviewed-on: http://review.typo3.org/44029
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
typo3/sysext/recordlist/Classes/RecordList.php
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index 9f1d762..5f61f4b 100644 (file)
@@ -18,6 +18,7 @@ use Psr\Http\Message\ResponseInterface;
 use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Clipboard\Clipboard;
 use TYPO3\CMS\Backend\Module\AbstractModule;
+use TYPO3\CMS\Backend\Template\Components\ButtonBar;
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
@@ -563,7 +564,7 @@ class RecordList extends AbstractModule
             ->setClasses('t3js-toggle-search-toolbox')
             ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.title.searchIcon', true))
             ->setIcon($this->iconFactory->getIcon('actions-search', Icon::SIZE_SMALL));
-        $this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->addButton($searchButton);
+        $this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->addButton($searchButton, ButtonBar::BUTTON_POSITION_LEFT, 90);
 
         $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
         // Build the <body> for the module
index 047ed42..359a2ee 100644 (file)
@@ -293,8 +293,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
             $buttons['cache'] = '<a href="' . htmlspecialchars(($this->listURL() . '&clear_cache=1')) . '" title="'
                 . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.clear_cache', true) . '">'
                 . $this->iconFactory->getIcon('actions-system-cache-clear', Icon::SIZE_SMALL)->render() . '</a>';
-            if (
-                $this->table && (!isset($module->modTSconfig['properties']['noExportRecordsLinks'])
+            if ($this->table && (!isset($module->modTSconfig['properties']['noExportRecordsLinks'])
                 || (isset($module->modTSconfig['properties']['noExportRecordsLinks'])
                     && !$module->modTSconfig['properties']['noExportRecordsLinks']))
             ) {
@@ -349,14 +348,16 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
         // Get users permissions for this page record:
         $localCalcPerms = $backendUser->calcPerms($this->pageRow);
         // CSH
-        $cshButton = $buttonBar->makeFullyRenderedButton();
         if ((string)$this->id === '') {
-            $cshButton->setHtmlSource(BackendUtility::cshItem('xMOD_csh_corebe', 'list_module_noId'));
+            $fieldName = 'list_module_noId';
         } elseif (!$this->id) {
-            $cshButton->setHtmlSource(BackendUtility::cshItem('xMOD_csh_corebe', 'list_module_root'));
+            $fieldName = 'list_module_root';
         } else {
-            $cshButton->setHtmlSource(BackendUtility::cshItem('xMOD_csh_corebe', 'list_module'));
+            $fieldName = 'list_module';
         }
+        $cshButton = $buttonBar->makeHelpButton()
+            ->setModuleName('xMOD_csh_corebe')
+            ->setFieldName($fieldName);
         $buttonBar->addButton($cshButton);
         if (isset($this->id)) {
             // View Exclude doktypes 254,255 Configuration:
@@ -378,7 +379,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                     ->setOnClick($onClick)
                     ->setTitle($lang->getLL('newRecordGeneral', true))
                     ->setIcon($this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL));
-                $buttonBar->addButton($newRecordButton);
+                $buttonBar->addButton($newRecordButton, ButtonBar::BUTTON_POSITION_LEFT, 10);
             }
             if (!in_array($this->pageRow['doktype'], $noViewDokTypes)) {
                 $onClick = BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id));
@@ -387,7 +388,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                     ->setOnClick($onClick)
                     ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true))
                     ->setIcon($this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL));
-                $buttonBar->addButton($viewButton);
+                $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 20);
             }
             // If edit permissions are set, see
             // \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
@@ -400,7 +401,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                     ->setOnClick($onClick)
                     ->setTitle($lang->getLL('editPage', true))
                     ->setIcon($this->iconFactory->getIcon('actions-page-open', Icon::SIZE_SMALL));
-                $buttonBar->addButton($editButton);
+                $buttonBar->addButton($editButton, ButtonBar::BUTTON_POSITION_LEFT, 20);
             }
             // Paste
             if (($localCalcPerms & Permission::PAGE_NEW || $localCalcPerms & Permission::CONTENT_EDIT) && $this->editLockPermissions()) {
@@ -412,7 +413,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                         ->setOnClick($onClick)
                         ->setTitle($lang->getLL('clip_paste', true))
                         ->setIcon($this->iconFactory->getIcon('actions-document-paste-after', Icon::SIZE_SMALL));
-                    $buttonBar->addButton($pasteButton);
+                    $buttonBar->addButton($pasteButton, ButtonBar::BUTTON_POSITION_LEFT, 40);
                 }
             }
             // Cache
@@ -421,8 +422,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                 ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.clear_cache', true))
                 ->setIcon($this->iconFactory->getIcon('actions-system-cache-clear', Icon::SIZE_SMALL));
             $buttonBar->addButton($clearCacheButton, ButtonBar::BUTTON_POSITION_RIGHT);
-            if (
-                $this->table && (!isset($module->modTSconfig['properties']['noExportRecordsLinks'])
+            if ($this->table && (!isset($module->modTSconfig['properties']['noExportRecordsLinks'])
                 || (isset($module->modTSconfig['properties']['noExportRecordsLinks'])
                     && !$module->modTSconfig['properties']['noExportRecordsLinks']))
             ) {
@@ -431,7 +431,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                     ->setHref($this->listURL() . '&csv=1')
                     ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.csv', true))
                     ->setIcon($this->iconFactory->getIcon('actions-document-export-csv', Icon::SIZE_SMALL));
-                $buttonBar->addButton($csvButton);
+                $buttonBar->addButton($csvButton, ButtonBar::BUTTON_POSITION_LEFT, 40);
                 // Export
                 if (ExtensionManagementUtility::isLoaded('impexp')) {
                     $url = BackendUtility::getModuleUrl('xMOD_tximpexp', array('tx_impexp[action]' => 'export'));
@@ -439,7 +439,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                         ->setHref($url . '&tx_impexp[list][]=' . rawurlencode($this->table . ':' . $this->id))
                         ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.export', true))
                         ->setIcon($this->iconFactory->getIcon('actions-document-export-t3d', Icon::SIZE_SMALL));
-                    $buttonBar->addButton($exportButton);
+                    $buttonBar->addButton($exportButton, ButtonBar::BUTTON_POSITION_LEFT, 40);
                 }
             }
             // Reload
@@ -450,12 +450,20 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
             $buttonBar->addButton($reloadButton, ButtonBar::BUTTON_POSITION_RIGHT);
             // Shortcut
             if ($backendUser->mayMakeShortcut()) {
-                $shortCutButton = $buttonBar->makeFullyRenderedButton()
-                    ->setHtmlSource($moduleTemplate->makeShortcutIcon(
-                        'id, imagemode, pointer, table, search_field, search_levels, showLimit, sortField, sortRev',
-                        implode(',', array_keys($this->MOD_MENU)),
-                        'web_list'
-                    ));
+                $shortCutButton = $buttonBar->makeShortcutButton()
+                    ->setModuleName('web_list')
+                    ->setGetVariables([
+                        'id',
+                        'imagemode',
+                        'pointer',
+                        'table',
+                        'search_field',
+                        'search_levels',
+                        'showLimit',
+                        'sortField',
+                        'sortRev'
+                    ])
+                    ->setSetVariables(array_keys($this->MOD_MENU));
                 $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT);
             }
             // Back
@@ -922,8 +930,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                 ) {
                     $theData[$fCol] .= '<br />' . $this->thumbCode($row, $table, $thumbsCol);
                 }
-                if (
-                    isset($GLOBALS['TCA'][$table]['ctrl']['languageField'])
+                if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField'])
                     && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] != 0
                     && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0
                 ) {
@@ -974,8 +981,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
         $this->addElement_tdCssClass['_LOCALIZATION_b'] = 'col-localizationb';
         // Create element in table cells:
         $theData['uid'] = $row['uid'];
-        if (
-            isset($GLOBALS['TCA'][$table]['ctrl']['languageField'])
+        if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField'])
             && isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'])
             && !isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])
         ) {