[TASK] Use new way to register edit wizard 42/27842/2
authorHelmut Hummel <helmut.hummel@typo3.org>
Tue, 25 Feb 2014 14:31:43 +0000 (15:31 +0100)
committerMarkus Klein <klein.t3@mfc-linz.at>
Tue, 25 Feb 2014 15:41:19 +0000 (16:41 +0100)
Resolves: #56272
Releases: 6.2
Change-Id: Idfcb04fac9f1c4e6637b7df929694b193266c825
Reviewed-on: https://review.typo3.org/27842
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/backend/Classes/Controller/Wizard/EditController.php
typo3/sysext/backend/Modules/Wizards/EditWizard/conf.php [new file with mode: 0644]
typo3/sysext/backend/Modules/Wizards/EditWizard/index.php [new file with mode: 0644]
typo3/sysext/backend/ext_tables.php [new file with mode: 0644]
typo3/sysext/core/Configuration/TCA/be_groups.php
typo3/sysext/core/Configuration/TCA/be_users.php
typo3/sysext/frontend/Configuration/TCA/sys_template.php
typo3/wizard_edit.php

index 8b0dada..f236eb2 100644 (file)
@@ -27,6 +27,7 @@ namespace TYPO3\CMS\Backend\Controller\Wizard;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\HttpUtility;
 
@@ -89,7 +90,7 @@ class EditController {
                        // Detecting the various allowed field type setups and acting accordingly.
                        if (is_array($config) && $config['type'] == 'select' && !$config['MM'] && $config['maxitems'] <= 1 && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->P['currentValue']) && $this->P['currentValue'] && $fTable) {
                                // SINGLE value:
-                               $redirectUrl = 'alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . '&edit[' . $fTable . '][' . $this->P['currentValue'] . ']=edit';
+                               $redirectUrl = 'alt_doc.php?returnUrl=' . rawurlencode(BackendUtility::getModuleUrl('wizard_edit', array('doClose' => 1))) . '&edit[' . $fTable . '][' . $this->P['currentValue'] . ']=edit';
                                HttpUtility::redirect($redirectUrl);
                        } elseif (is_array($config) && $this->P['currentSelectedValues'] && ($config['type'] == 'select' && $config['foreign_table'] || $config['type'] == 'group' && $config['internal_type'] == 'db')) {
                                // MULTIPLE VALUES:
@@ -107,7 +108,7 @@ class EditController {
                                        $params .= '&edit[' . $recTableUidParts[0] . '][' . $recTableUidParts[1] . ']=edit';
                                }
                                // Redirect to alt_doc.php:
-                               HttpUtility::redirect('alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . $params);
+                               HttpUtility::redirect('alt_doc.php?returnUrl=' . rawurlencode(BackendUtility::getModuleUrl('wizard_edit', array('doClose' => 1))) . $params);
                        } else {
                                $this->closeWindow();
                        }
diff --git a/typo3/sysext/backend/Modules/Wizards/EditWizard/conf.php b/typo3/sysext/backend/Modules/Wizards/EditWizard/conf.php
new file mode 100644 (file)
index 0000000..510ee3b
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+//required for mod.php
+$MCONF['name'] = 'wizard_edit';
+$MCONF['script'] = '_DISPATCH';
+$MCONF['access'] = '';
+?>
diff --git a/typo3/sysext/backend/Modules/Wizards/EditWizard/index.php b/typo3/sysext/backend/Modules/Wizards/EditWizard/index.php
new file mode 100644 (file)
index 0000000..dd6b4a0
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2014 Helmut Hummel (helmut.hummel@typo3.org)
+ *  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!
+ ***************************************************************/
+
+/**
+ * Wizard to edit records from group/select lists in TCEforms
+ */
+$editController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\Wizard\\EditController');
+$editController->main();
diff --git a/typo3/sysext/backend/ext_tables.php b/typo3/sysext/backend/ext_tables.php
new file mode 100644 (file)
index 0000000..1499c03
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+if (!defined('TYPO3_MODE')) {
+       die('Access denied.');
+}
+
+if (TYPO3_MODE === 'BE') {
+       // Register edit wizard
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
+               'wizard_edit',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Wizards/EditWizard/'
+       );
+}
index 380f46c..f4c8b46 100644 (file)
@@ -73,7 +73,9 @@ return array(
                                        'edit' => array(
                                                'type' => 'popup',
                                                'title' => 'LLL:EXT:lang/locallang_tca.xlf:file_mountpoints_edit_title',
-                                               'script' => 'wizard_edit.php',
+                                               'module' => array(
+                                                       'name' => 'wizard_edit',
+                                               ),
                                                'popup_onlyOpenIfSelected' => 1,
                                                'icon' => 'edit2.gif',
                                                'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1'
index 56dea89..ab0a047 100644 (file)
@@ -69,7 +69,9 @@ return array(
                                        'edit' => array(
                                                'type' => 'popup',
                                                'title' => 'LLL:EXT:lang/locallang_tca.xlf:be_users.usergroup_edit_title',
-                                               'script' => 'wizard_edit.php',
+                                               'module' => array(
+                                                       'name' => 'wizard_edit',
+                                               ),
                                                'popup_onlyOpenIfSelected' => 1,
                                                'icon' => 'edit2.gif',
                                                'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1'
@@ -141,7 +143,9 @@ return array(
                                        'edit' => array(
                                                'type' => 'popup',
                                                'title' => 'LLL:EXT:lang/locallang_tca.xlf:file_mountpoints_edit_title',
-                                               'script' => 'wizard_edit.php',
+                                               'module' => array(
+                                                       'name' => 'wizard_edit',
+                                               ),
                                                'icon' => 'edit2.gif',
                                                'popup_onlyOpenIfSelected' => 1,
                                                'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1'
index 94defa8..7ddb5bf 100644 (file)
@@ -161,7 +161,9 @@ return array(
                                        'edit' => array(
                                                'type' => 'popup',
                                                'title' => 'Edit template',
-                                               'script' => 'wizard_edit.php',
+                                               'module' => array(
+                                                       'name' => 'wizard_edit',
+                                               ),
                                                'popup_onlyOpenIfSelected' => 1,
                                                'icon' => 'edit2.gif',
                                                'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1'
index 7768aa2..fddcba3 100644 (file)
@@ -32,5 +32,6 @@
  */
 require __DIR__ . '/init.php';
 
+\TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('The way registering a wizard in TCA has changed in 6.2. Please set module[name]=wizard_edit instead of script=wizard_edit.php in your TCA. This script will be removed in two versions.');
 $editController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\Wizard\\EditController');
 $editController->main();