* Fixed issue 7052: Permission problem of RTE images
[Packages/TYPO3.CMS.git] / typo3 / file_edit.php
index 2dd35d4..3f7478d 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 2/2003 by Kasper Skaarhoj
  * XHTML compliant (except textarea field)
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
  *
  *
  *   74: class SC_file_edit
- *   92:     function init()
- *  141:     function main()
- *  201:     function printContent()
+ *   93:     function init()
+ *  143:     function main()
+ *  205:     function printContent()
  *
  * TOTAL FUNCTIONS: 3
  * (This index is automatically created/updated by the extension "extdeveval")
  *
  */
 
-$BACK_PATH='';
-require ('init.php');
-require ('template.php');
-require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
+$BACK_PATH = '';
+require('init.php');
+require('template.php');
+require_once(PATH_t3lib.'class.t3lib_basicfilefunc.php');
 
 
 
@@ -67,21 +67,34 @@ require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
 /**
  * Script Class for rendering the file editing screen
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
 class SC_file_edit {
        var $content;           // Module content accumulated.
-       var $basicff;           // File processing object loaded here.
+
+       /**
+        * File processing object
+        *
+        * @var t3lib_basicFileFunctions
+        */
+       var $basicff;
        var $shortPath;
        var $title;
        var $icon;
-       var $doc;                       // Document template object
+
+       /**
+        * Document template object
+        *
+        * @var template
+        */
+       var $doc;
 
                // Internal, static: GPvar
        var $origTarget;                // Original input target
        var $target;                    // The original target, but validated.
+       var $returnUrl;         // Return URL of list module.
 
 
        /**
@@ -94,6 +107,7 @@ class SC_file_edit {
 
                        // Setting target, which must be a file reference to a file within the mounts.
                $this->target = $this->origTarget = t3lib_div::_GP('target');
+               $this->returnUrl = t3lib_div::_GP('returnUrl');
 
                        // Creating file management object:
                $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
@@ -156,13 +170,13 @@ class SC_file_edit {
                        $fileContent = t3lib_div::getUrl($this->target);
 
                                // making the formfields
-                       $hValue = 'file_edit.php?target='.rawurlencode($this->origTarget);
-                       $code='';
+                       $hValue = 'file_edit.php?target='.rawurlencode($this->origTarget).'&returnUrl='.rawurlencode($this->returnUrl);
+                       $code = '';
                        $code.='
                                <div id="c-submit">
                                        <input type="hidden" name="redirect" value="'.htmlspecialchars($hValue).'" />
                                        <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.submit',1).'" />
-                                       <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.saveAndClose',1).'" onclick="document.editform.redirect.value=\'\';" />
+                                       <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.saveAndClose',1).'" onclick="document.editform.redirect.value=\''.htmlspecialchars($this->returnUrl).'\';" />
                                        <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.cancel',1).'" onclick="backToList(); return false;" />
                                </div>
                                ';
@@ -170,13 +184,16 @@ class SC_file_edit {
                                // Edit textarea:
                        $code.='
                                <div id="c-edit">
-                                       <textarea rows="30" name="file[editfile][0][data]" wrap="off"'.$this->doc->formWidthText(48,'width:98%;height:80%','off').'>'.
+                                       <textarea rows="30" name="file[editfile][0][data]" wrap="off"'.$this->doc->formWidthText(48,'width:98%;height:80%','off').' class="fixed-font enable-tab">'.
                                        t3lib_div::formatForTextarea($fileContent).
                                        '</textarea>
                                        <input type="hidden" name="file[editfile][0][target]" value="'.$this->target.'" />
                                </div>
                                <br />';
 
+                               // CSH:
+                       $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_edit', $GLOBALS['BACK_PATH'],'|<br/>');
+
                                // Make shortcut:
                        if ($BE_USER->mayMakeShortcut())        {
                                $this->MCONF['name']='xMOD_file_edit.php';
@@ -190,7 +207,6 @@ class SC_file_edit {
                $this->content.= $this->doc->sectionEnd();
                $this->content.=$code;
 
-               $this->content.=$this->doc->endPage();
        }
 
        /**
@@ -199,6 +215,8 @@ class SC_file_edit {
         * @return      void
         */
        function printContent() {
+               $this->content.= $this->doc->endPage();
+               $this->content = $this->doc->insertStylesAndJS($this->content);
                echo $this->content;
        }
 }