[TASK] Use new way to register backend_layout wizard 77/27977/7
authorWouter Wolters <typo3@wouterwolters.nl>
Sun, 2 Mar 2014 15:33:11 +0000 (16:33 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Tue, 4 Mar 2014 17:39:02 +0000 (18:39 +0100)
Resolves: #56471
Releases: 6.2
Change-Id: I8bd844326566715201ab3ae82811c945566b5b88
Reviewed-on: https://review.typo3.org/27977
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/backend/Classes/Controller/BackendLayoutWizardController.php
typo3/sysext/backend/Modules/Wizards/BackendLayoutWizard/conf.php [new file with mode: 0644]
typo3/sysext/backend/Modules/Wizards/BackendLayoutWizard/index.php [new file with mode: 0644]
typo3/sysext/backend/ext_tables.php
typo3/sysext/frontend/Configuration/TCA/backend_layout.php

index cb0a5e0..5c952ff 100644 (file)
@@ -62,9 +62,11 @@ class BackendLayoutWizardController {
         * Initialises the Class
         *
         * @return void
-        * @todo Define visibility
+        * @throws \InvalidArgumentException
         */
        public function init() {
+               $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_wizards.xlf');
+
                // Setting GET vars (used in frameset script):
                $this->P = GeneralUtility::_GP('P');
                $this->formName = $this->P['formName'];
@@ -79,7 +81,7 @@ class BackendLayoutWizardController {
                $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $pageRenderer = $this->doc->getPageRenderer();
-               $pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . TYPO3_MOD_PATH . 'res/grideditor.js');
+               $pageRenderer->addJsFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cms') . 'layout/res/grideditor.js');
                $pageRenderer->addJsInlineCode('storeData', '
                        function storeData(data) {
                                if (parent.opener && parent.opener.document && parent.opener.document.' . $this->formName . ' && parent.opener.document.' . $this->formName . '[' . GeneralUtility::quoteJSvalue($this->fieldName) . ']) {
@@ -178,7 +180,9 @@ class BackendLayoutWizardController {
                                        $rowString .= ']';
                                }
                                $rows[] = $rowString;
-                               ksort($spannedMatrix[$i]);
+                               if (!empty($spannedMatrix[$i]) && is_array($spannedMatrix[$i])) {
+                                       ksort($spannedMatrix[$i]);
+                               }
                        }
                        $t3GridData .= implode(',', $rows) . ']';
                }
@@ -192,17 +196,17 @@ class BackendLayoutWizardController {
                        });
                        t3Grid.drawTable();
                        ');
-               $this->doc->styleSheetFile_post = TYPO3_MOD_PATH . 'res/grideditor.css';
+               $this->doc->styleSheetFile_post = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cms') . 'layout/res/grideditor.css';
        }
 
        /**
         * Main Method, rendering either colorpicker or frameset depending on ->showPicker
         *
         * @return void
-        * @todo Define visibility
         */
        public function main() {
-               $content .= '<a href="#" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" onclick="storeData(t3Grid.export2LayoutRecord());return true;">' . IconUtility::getSpriteIcon('actions-document-save') . '</a>';
+               $resourcePath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cms') . 'layout/';
+               $content = '<a href="#" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" onclick="storeData(t3Grid.export2LayoutRecord());return true;">' . IconUtility::getSpriteIcon('actions-document-save') . '</a>';
                $content .= '<a href="#" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" onclick="storeData(t3Grid.export2LayoutRecord());window.close();return true;">' . IconUtility::getSpriteIcon('actions-document-save-close') . '</a>';
                $content .= '<a href="#" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '" onclick="window.close();return true;">' . IconUtility::getSpriteIcon('actions-document-close') . '</a>';
                $content .= $this->doc->spacer(10);
@@ -215,20 +219,20 @@ class BackendLayoutWizardController {
                                </td>
                                <td width="20" valign="center">
                                        <a class="addCol" href="#" title="' . $GLOBALS['LANG']->getLL('grid_addColumn') . '" onclick="t3Grid.addColumn(); t3Grid.drawTable(\'editor\');">
-                                               <img src="res/t3grid-tableright.png" border="0" />
+                                               <img src="' . $resourcePath . 'res/t3grid-tableright.png" border="0" />
                                        </a><br />
                                        <a class="removeCol" href="#" title="' . $GLOBALS['LANG']->getLL('grid_removeColumn') . '" onclick="t3Grid.removeColumn(); t3Grid.drawTable(\'editor\');">
-                                               <img src="res/t3grid-tableleft.png" border="0" />
+                                               <img src="' . $resourcePath . 'res/t3grid-tableleft.png" border="0" />
                                        </a>
                                </td>
                        </tr>
                        <tr>
                                <td colspan="2" height="20" align="center">
                                        <a class="addCol" href="#" title="' . $GLOBALS['LANG']->getLL('grid_addRow') . '" onclick="t3Grid.addRow(); t3Grid.drawTable(\'editor\');">
-                                               <img src="res/t3grid-tabledown.png" border="0" />
+                                               <img src="' . $resourcePath . 'res/t3grid-tabledown.png" border="0" />
                                        </a>
                                        <a class="removeCol" href="#" title="' . $GLOBALS['LANG']->getLL('grid_removeRow') . '" onclick="t3Grid.removeRow(); t3Grid.drawTable(\'editor\');">
-                                               <img src="res/t3grid-tableup.png" border="0" />
+                                               <img src="' . $resourcePath . 'res/t3grid-tableup.png" border="0" />
                                        </a>
                                </td>
                        </tr>
@@ -241,7 +245,6 @@ class BackendLayoutWizardController {
         * Returns the sourcecode to the browser
         *
         * @return void
-        * @todo Define visibility
         */
        public function printContent() {
                echo $this->doc->render('Grid wizard', $this->content);
diff --git a/typo3/sysext/backend/Modules/Wizards/BackendLayoutWizard/conf.php b/typo3/sysext/backend/Modules/Wizards/BackendLayoutWizard/conf.php
new file mode 100644 (file)
index 0000000..05d7b2c
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+//required for mod.php
+$MCONF['name'] = 'wizard_backend_layout';
+$MCONF['script'] = '_DISPATCH';
+$MCONF['access'] = 'user,group';
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/Wizards/BackendLayoutWizard/index.php b/typo3/sysext/backend/Modules/Wizards/BackendLayoutWizard/index.php
new file mode 100644 (file)
index 0000000..a832d50
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2014 Wouter Wolters (typo3@wouterwolters.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the text file GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Grid wizard
+ */
+$backendLayoutWizardController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\BackendLayoutWizardController');
+$backendLayoutWizardController->init();
+$backendLayoutWizardController->main();
+$backendLayoutWizardController->printContent();
\ No newline at end of file
index 9287c16..c5fcbec 100644 (file)
@@ -45,4 +45,10 @@ if (TYPO3_MODE === 'BE') {
                'wizard_colorpicker',
                \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Wizards/ColorpickerWizard/'
        );
+
+       // Register backend_layout wizard
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
+               'wizard_backend_layout',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Wizards/BackendLayoutWizard/'
+       );
 }
\ No newline at end of file
index ba59785..1d5cb2e 100644 (file)
@@ -51,7 +51,9 @@ return array(
                                                'title' => 'LLL:EXT:cms/locallang_tca.xlf:backend_layout.wizard',
                                                'type' => 'popup',
                                                'icon' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cms') . 'layout/wizard_backend_layout.png',
-                                               'script' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cms') . 'layout/wizard_backend_layout.php',
+                                               'module' => array(
+                                                       'name' => 'wizard_backend_layout'
+                                               ),
                                                'JSopenParams' => 'height=800,width=800,status=0,menubar=0,scrollbars=0'
                                        )
                                )