[TASK] Form sysext entry script cleanup 47/27347/12
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Tue, 25 Feb 2014 15:18:48 +0000 (16:18 +0100)
committerMarkus Klein <klein.t3@mfc-linz.at>
Tue, 25 Feb 2014 17:51:26 +0000 (18:51 +0100)
The form sysext contains a wizard to provide help for form creation.
This script used the init.php entry script. This is no longer wanted,
but the API can be used to add wizards.

To do so, some files were moved around and follow the same schema
as shown in openid sysext.

Change-Id: I6b6c41de6c271c56404151b1ec95f45e6f7786af
Resolves: #55669
Releases: 6.2
Reviewed-on: https://review.typo3.org/27347
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/form/Classes/Controller/Wizard.php [deleted file]
typo3/sysext/form/Classes/View/Wizard/WizardView.php
typo3/sysext/form/Modules/Wizards/FormWizard/conf.php [new file with mode: 0644]
typo3/sysext/form/Modules/Wizards/FormWizard/index.php [new file with mode: 0644]
typo3/sysext/form/ext_tables.php

diff --git a/typo3/sysext/form/Classes/Controller/Wizard.php b/typo3/sysext/form/Classes/Controller/Wizard.php
deleted file mode 100644 (file)
index 713aae2..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013 Patrick Broens (patrick@patrickbroens.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.
- *
- *  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!
- ***************************************************************/
-define('TYPO3_MOD_PATH', 'sysext/form/Classes/Controller/');
-$BACK_PATH = '../../../../';
-require $BACK_PATH . 'init.php';
-/*
- * @deprecated since 6.0, the classname tx_form_Controller_Wizard and this file is obsolete
- * and will be removed with 6.2. The class was renamed and is now located at:
- * typo3/sysext/form/Classes/Controller/WizardController.php
- */
-require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('form') . 'Classes/Controller/WizardController.php';
-/**
- * @var $wizard \TYPO3\CMS\Form\Controller\WizardController
- */
-$wizard = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Controller\\WizardController');
-$wizard->dispatch();
index af28b3a..0ed444e 100644 (file)
@@ -43,6 +43,11 @@ class WizardView extends \TYPO3\CMS\Form\View\Wizard\AbstractWizardView {
        public $doc;
 
        /**
+        * @var \TYPO3\CMS\Core\Page\PageRenderer
+        */
+       protected $pageRenderer;
+
+       /**
         * Constructs this view
         *
         * Defines the global variable SOBE. Normally this is used by the wizards
@@ -106,6 +111,7 @@ class WizardView extends \TYPO3\CMS\Form\View\Wizard\AbstractWizardView {
                $content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markers);
                $content .= $this->doc->endPage();
                $content = $this->doc->insertStylesAndJS($content);
+
                echo $content;
                die;
        }
@@ -119,7 +125,6 @@ class WizardView extends \TYPO3\CMS\Form\View\Wizard\AbstractWizardView {
         */
        protected function loadJavascript() {
                $compress = TRUE;
-               $baseUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath('../../../../../' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('form') . 'Resources/Public/JavaScript/Wizard/');
                $javascriptFiles = array(
                        'Initialize.js',
                        'Ux/Ext.ux.merge.js',
@@ -222,6 +227,7 @@ class WizardView extends \TYPO3\CMS\Form\View\Wizard\AbstractWizardView {
                // Load ExtJS
                $this->pageRenderer->loadExtJS();
                // Load the wizards javascript
+               $baseUrl = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('form') . 'Resources/Public/JavaScript/Wizard/';
                foreach ($javascriptFiles as $javascriptFile) {
                        $this->pageRenderer->addJsFile($baseUrl . $javascriptFile, 'text/javascript', $compress, FALSE);
                }
@@ -237,11 +243,11 @@ class WizardView extends \TYPO3\CMS\Form\View\Wizard\AbstractWizardView {
        protected function loadCss() {
                // TODO Set to TRUE when finished
                $compress = FALSE;
-               $baseUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath('../../../../../' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('form') . 'Resources/Public/CSS/');
                $cssFiles = array(
                        'Wizard/Form.css',
                        'Wizard/Wizard.css'
                );
+               $baseUrl = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('form') . 'Resources/Public/CSS/';
                // Load the wizards css
                foreach ($cssFiles as $cssFile) {
                        $this->pageRenderer->addCssFile($baseUrl . $cssFile, 'stylesheet', 'all', '', $compress, FALSE);
diff --git a/typo3/sysext/form/Modules/Wizards/FormWizard/conf.php b/typo3/sysext/form/Modules/Wizards/FormWizard/conf.php
new file mode 100644 (file)
index 0000000..f5aa472
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+//required for mod.php
+$MCONF['name'] = 'wizard_form';
+$MCONF['script'] = '_DISPATCH';
+$MCONF['access'] = '';
\ No newline at end of file
diff --git a/typo3/sysext/form/Modules/Wizards/FormWizard/index.php b/typo3/sysext/form/Modules/Wizards/FormWizard/index.php
new file mode 100644 (file)
index 0000000..9289cf4
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010-2013 Patrick Broens (patrick@patrickbroens.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.
+ *
+ *  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!
+ ***************************************************************/
+
+/*
+ * @deprecated since 6.0, the classname tx_form_Controller_Wizard and this file is obsolete
+ * and will be removed with 6.2. The class was renamed and is now located at:
+ * typo3/sysext/form/Classes/Controller/WizardController.php
+ */
+/**
+ * @var $wizard \TYPO3\CMS\Form\Controller\WizardController
+ */
+$wizard = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Controller\\WizardController');
+$wizard->dispatch();
index dd09074..8a97fcc 100644 (file)
@@ -6,13 +6,23 @@ if (!defined('TYPO3_MODE')) {
 // Add Default TS to Include static (from extensions)
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript/', 'Default TS');
 
+if (TYPO3_MODE === 'BE') {
+       // Register wizard
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
+               'wizard_form',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Wizards/FormWizard/'
+       );
+}
+
 $GLOBALS['TCA']['tt_content']['columns']['bodytext']['config']['wizards']['forms'] = array(
        'notNewRecords' => 1,
        'enableByTypeConfig' => 1,
        'type' => 'script',
        'title' => 'Form wizard',
        'icon' => 'wizard_forms.gif',
-       'script' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('form') . 'Classes/Controller/Wizard.php',
+       'module' => array(
+               'name' => 'wizard_form'
+       ),
        'params' => array(
                'xmlOutput' => 0
        )