Added feature #7150: Add pageUnavailable_handling for system problems and maintenance
[Packages/TYPO3.CMS.git] / typo3 / wizard_forms.php
index 555c989..9e39b73 100755 (executable)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
+*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -31,7 +31,7 @@
  * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
  * XHTML compliant
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
  *
  *
  *  175: class SC_wizard_forms
- *  202:     function init()
- *  238:     function main()
- *  254:     function printContent()
- *  263:     function formsWizard()
+ *  203:     function init()
+ *  242:     function main()
+ *  257:     function printContent()
+ *  268:     function formsWizard()
  *
  *              SECTION: Helper functions
- *  306:     function getConfigCode(&$row)
- *  378:     function getFormHTML($formCfgArray,$row)
- *  631:     function changeFunc()
- *  690:     function cfgArray2CfgString($cfgArr)
- *  765:     function cfgString2CfgArray($cfgStr)
- *  854:     function cleanT($tArr)
- *  872:     function formatCells($fArr)
+ *  311:     function getConfigCode(&$row)
+ *  382:     function getFormHTML($formCfgArray,$row)
+ *  662:     function changeFunc()
+ *  721:     function cfgArray2CfgString($cfgArr)
+ *  803:     function cfgString2CfgArray($cfgStr)
+ *  902:     function cleanT($tArr)
+ *  920:     function formatCells($fArr)
  *
  * TOTAL FUNCTIONS: 11
  * (This index is automatically created/updated by the extension "extdeveval")
@@ -63,7 +63,7 @@
 $BACK_PATH='';
 require ('init.php');
 require ('template.php');
-include ('sysext/lang/locallang_wizards.php');
+$LANG->includeLLFile('EXT:lang/locallang_wizards.xml');
 
 
 
@@ -168,14 +168,19 @@ include ('sysext/lang/locallang_wizards.php');
 /**
  * Script Class for rendering the Form Wizard
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
 class SC_wizard_forms {
 
                // Internal, dynamic:
-       var $doc;                                       // Document template object
+       /**
+        * document template object
+        *
+        * @var mediumDoc
+        */
+       var $doc;
        var $content;                           // Content accumulation for the module.
        var $include_once=array();      // List of files to include.
        var $attachmentCounter = 0;     // Used to numerate attachments automatically.
@@ -201,7 +206,7 @@ class SC_wizard_forms {
         * @return      void
         */
        function init() {
-               global $BACK_PATH,$HTTP_POST_VARS;
+               global $BACK_PATH;
 
                        // GPvars:
                $this->P = t3lib_div::_GP('P');
@@ -217,7 +222,7 @@ class SC_wizard_forms {
                $this->doc->backPath = $BACK_PATH;
                $this->doc->JScode=$this->doc->wrapScriptTags('
                        function jumpToUrl(URL,formEl)  {       //
-                               document.location = URL;
+                               window.location.href = URL;
                        }
                ');
 
@@ -229,7 +234,7 @@ class SC_wizard_forms {
                $this->content=$this->doc->startPage('Form Wizard');
 
                        // If save command found, include tcemain:
-               if ($HTTP_POST_VARS['savedok_x'] || $HTTP_POST_VARS['saveandclosedok_x'])       {
+               if ($_POST['savedok_x'] || $_POST['saveandclosedok_x']) {
                        $this->include_once[]=PATH_t3lib.'class.t3lib_tcemain.php';
                }
        }
@@ -247,7 +252,6 @@ class SC_wizard_forms {
                } else {
                        $this->content.=$this->doc->section($LANG->getLL('forms_title'),'<span class="typo3-red">'.$LANG->getLL('table_noData',1).'</span>',0,1);
                }
-               $this->content.=$this->doc->endPage();
        }
 
        /**
@@ -256,6 +260,8 @@ class SC_wizard_forms {
         * @return      void
         */
        function printContent() {
+               $this->content.= $this->doc->endPage();
+               $this->content = $this->doc->insertStylesAndJS($this->content);
                echo $this->content;
        }
 
@@ -267,7 +273,7 @@ class SC_wizard_forms {
        function formsWizard()  {
 
                        // First, check the references by selecting the record:
-               $row=t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
+               $row = t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
                if (!is_array($row))    {
                        t3lib_BEfunc::typo3PrintError ('Wizard Error','No reference to record',0);
                        exit;
@@ -308,7 +314,6 @@ class SC_wizard_forms {
         * @access private
         */
        function getConfigCode(&$row)   {
-               global $HTTP_POST_VARS;
 
                        // If some data has been submitted, then construct
                if (isset($this->FORMCFG['c'])) {
@@ -319,7 +324,7 @@ class SC_wizard_forms {
                                // Convert to string (either line based or XML):
                        if ($this->xmlStorage)  {
                                        // Convert the input array to XML:
-                               $bodyText = t3lib_div::array2xml($this->FORMCFG['c'],'',0,'T3FormWizard');
+                               $bodyText = t3lib_div::array2xml_cs($this->FORMCFG['c'],'T3FormWizard');
 
                                        // Setting cfgArr directly from the input:
                                $cfgArr = $this->FORMCFG['c'];
@@ -332,7 +337,7 @@ class SC_wizard_forms {
                        }
 
                                // If a save button has been pressed, then save the new field content:
-                       if ($HTTP_POST_VARS['savedok_x'] || $HTTP_POST_VARS['saveandclosedok_x'])       {
+                       if ($_POST['savedok_x'] || $_POST['saveandclosedok_x']) {
 
                                        // Make TCEmain object:
                                $tce = t3lib_div::makeInstance('t3lib_TCEmain');
@@ -353,7 +358,7 @@ class SC_wizard_forms {
                                $row = t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
 
                                        // If the save/close button was pressed, then redirect the screen:
-                               if ($HTTP_POST_VARS['saveandclosedok_x'])       {
+                               if ($_POST['saveandclosedok_x'])        {
                                        header('Location: '.t3lib_div::locationHeaderUrl($this->P['returnUrl']));
                                        exit;
                                }
@@ -508,7 +513,7 @@ class SC_wizard_forms {
                                        $ctrl='';
                                        $onClick="document.wizardForm.action+='#ANC_".(($k+1)*2-2)."';";
                                        $onClick=' onclick="'.htmlspecialchars($onClick).'"';
-
+// FIXME $inputStyle undefined
                                        $brTag=$inputStyle?'':'<br />';
                                        if ($k!=0)      {
                                                $ctrl.='<input type="image" name="FORMCFG[row_up]['.(($k+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/pil2up.gif','').$onClick.' title="'.$LANG->getLL('table_up',1).'" />'.$brTag;
@@ -516,6 +521,7 @@ class SC_wizard_forms {
                                                $ctrl.='<input type="image" name="FORMCFG[row_bottom]['.(($k+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/turn_up.gif','').$onClick.' title="'.$LANG->getLL('table_bottom',1).'" />'.$brTag;
                                        }
                                        $ctrl.='<input type="image" name="FORMCFG[row_remove]['.(($k+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/garbage.gif','').$onClick.' title="'.$LANG->getLL('table_removeRow',1).'" />'.$brTag;
+// FIXME $tLines undefined
                                        if (($k+1)!=count($tLines))     {
                                                $ctrl.='<input type="image" name="FORMCFG[row_down]['.(($k+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/pil2down.gif','').$onClick.' title="'.$LANG->getLL('table_down',1).'" />'.$brTag;
                                        } else {
@@ -555,7 +561,9 @@ class SC_wizard_forms {
                        $tRows[]='
                                <tr>
                                        <td colspan="2" class="bgColor2">&nbsp;</td>
-                                       <td colspan="2" class="bgColor2"><strong>'.$LANG->getLL('forms_special_eform',1).':</strong></td>
+                                       <td colspan="2" class="bgColor2"><strong>'.$LANG->getLL('forms_special_eform',1).':</strong>'.
+                                               t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'wizard_forms_wiz_formmail_info', $GLOBALS['BACK_PATH'],'').
+                                               '</td>
                                </tr>';
 
                                // "FORM type":
@@ -609,8 +617,13 @@ class SC_wizard_forms {
                                </tr>';
                }
 
+               $content = '';
+
+                       // Add CSH:
+               $content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'wizard_forms_wiz', $GLOBALS['BACK_PATH'],'');
+
                        // Implode all table rows into a string, wrapped in table tags.
-               $content = '
+               $content.= '
 
                        <!--
                                Form wizard
@@ -631,7 +644,10 @@ class SC_wizard_forms {
                $content.= '<a href="#" onclick="'.htmlspecialchars('jumpToUrl(unescape(\''.rawurlencode($this->P['returnUrl']).'\')); return false;').'">'.
                                        '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/closedok.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc',1).'" alt="" />'.
                                        '</a>';
-               $content.= '<input type="image" class="c-inputButton" name="_refresh"'.t3lib_iconWorks::skinImg('','gfx/refresh_n.gif','').' title="'.$LANG->getLL('forms_refresh',1).'" />
+               $content.= '<input type="image" class="c-inputButton" name="_refresh"'.t3lib_iconWorks::skinImg('','gfx/refresh_n.gif','').' title="'.$LANG->getLL('forms_refresh',1).'" />';
+                       // Add CSH:
+               $content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'wizard_forms_wiz_buttons', $GLOBALS['BACK_PATH'],'');
+               $content.= '
                        </div>
                ';