Follow-up to #10327: [felogin] redirecting to referer does not work
[Packages/TYPO3.CMS.git] / typo3 / move_el.php
old mode 100755 (executable)
new mode 100644 (file)
index eb320c4..61a2849
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -72,11 +72,6 @@ require('template.php');
        // Include local language labels:
 $LANG->includeLLFile('EXT:lang/locallang_misc.xml');
 
        // Include local language labels:
 $LANG->includeLLFile('EXT:lang/locallang_misc.xml');
 
-       // Include libraries:
-require_once(PATH_t3lib.'class.t3lib_page.php');
-require_once(PATH_t3lib.'class.t3lib_positionmap.php');
-require_once(PATH_t3lib.'class.t3lib_pagetree.php');
-
 
 
 
 
 
 
@@ -269,14 +264,13 @@ class SC_move_el {
                $this->perms_clause = $BE_USER->getPagePermsClause(1);
 
                        // Starting the document template object:
                $this->perms_clause = $BE_USER->getPagePermsClause(1);
 
                        // Starting the document template object:
-               $this->doc = t3lib_div::makeInstance('mediumDoc');
-               $this->doc->docType= 'xhtml_trans';
+               $this->doc = t3lib_div::makeInstance('template');
                $this->doc->backPath = $BACK_PATH;
                $this->doc->backPath = $BACK_PATH;
+               $this->doc->setModuleTemplate('templates/move_el.html');
                $this->doc->JScode='';
 
                        // Starting document content (header):
                $this->content='';
                $this->doc->JScode='';
 
                        // Starting document content (header):
                $this->content='';
-               $this->content.=$this->doc->startPage($LANG->getLL('movingElement'));
                $this->content.=$this->doc->header($LANG->getLL('movingElement'));
                $this->content.=$this->doc->spacer(5);
        }
                $this->content.=$this->doc->header($LANG->getLL('movingElement'));
                $this->content.=$this->doc->spacer(5);
        }
@@ -339,9 +333,6 @@ class SC_move_el {
 
                                                // Create the position tree:
                                        $code.= $posMap->positionTree($this->page_id,$pageinfo,$this->perms_clause,$this->R_URI);
 
                                                // Create the position tree:
                                        $code.= $posMap->positionTree($this->page_id,$pageinfo,$this->perms_clause,$this->R_URI);
-
-                                               // CSH for move-pages:
-                                       $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'move_el_pages', $GLOBALS['BACK_PATH'],'<br/>|');
                                }
                        }
 
                                }
                        }
 
@@ -397,20 +388,23 @@ class SC_move_el {
 
                                                // Create the position tree (for pages):
                                        $code.= $posMap->positionTree($this->page_id,$pageinfo,$this->perms_clause,$this->R_URI);
 
                                                // Create the position tree (for pages):
                                        $code.= $posMap->positionTree($this->page_id,$pageinfo,$this->perms_clause,$this->R_URI);
-
-                                               // CSH for move-content-elements:
-                                       $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'move_el_cs', $GLOBALS['BACK_PATH'],'<br/>|');
                                }
                        }
 
                                }
                        }
 
-                               // IF a return-url is given, print the go-back link:
-                       if ($this->R_URI)       {
-                               $code.='<br /><br /><a href="'.htmlspecialchars($this->R_URI).'" class="typo3-goBack"><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/goback.gif','width="14" height="14"').' alt="" />'.$LANG->getLL('goBack',1).'</a>';
-                       }
-
                                // Add the $code content as a new section to the module:
                        $this->content.=$this->doc->section($LANG->getLL('selectPositionOfElement').':',$code,0,1);
                }
                                // Add the $code content as a new section to the module:
                        $this->content.=$this->doc->section($LANG->getLL('selectPositionOfElement').':',$code,0,1);
                }
+
+                       // Setting up the buttons and markers for docheader
+               $docHeaderButtons = $this->getButtons();
+               $markers['CSH'] = $docHeaderButtons['csh'];
+               $markers['CONTENT'] = $this->content;
+
+                       // Build the <body> for the module
+               $this->content = $this->doc->startPage($LANG->getLL('movingElement'));
+               $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
+               $this->content.= $this->doc->endPage();
+               $this->content = $this->doc->insertStylesAndJS($this->content);
        }
 
        /**
        }
 
        /**
@@ -419,25 +413,45 @@ class SC_move_el {
         * @return      void
         */
        function printContent() {
         * @return      void
         */
        function printContent() {
-               $this->content.= $this->doc->endPage();
-               $this->content = $this->doc->insertStylesAndJS($this->content);
                echo $this->content;
        }
                echo $this->content;
        }
-}
-
-// Include extension?
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/move_el.php'])      {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/move_el.php']);
-}
-
-
 
 
+       /**
+        * Create the panel of buttons for submitting the form or otherwise perform operations.
+        *
+        * @return      array   all available buttons as an assoc. array
+        */
+       protected function getButtons() {
+               global $LANG, $BACK_PATH;
 
 
+               $buttons = array(
+                       'csh' => '',
+                       'back' => ''
+               );
 
 
+               if ($this->page_id)     {
+                       if ((string)$this->table == 'pages') {
+                                       // CSH
+                               $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'move_el_pages', $GLOBALS['BACK_PATH'], '', TRUE);
+                       } elseif((string)$this->table == 'tt_content') {
+                                       // CSH
+                               $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'move_el_cs', $GLOBALS['BACK_PATH'], '', TRUE);
+                       }
 
 
+                       if ($this->R_URI) {
+                                       // Back
+                               $buttons['back'] ='<a href="' . htmlspecialchars($this->R_URI) . '" class="typo3-goBack"><img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/goback.gif') . ' alt="" title="' . $LANG->getLL('goBack', 1) .'" /></a>';
+                       }
+               }
 
 
+               return $buttons;
+       }
+}
 
 
 
 
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/move_el.php'])      {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/move_el.php']);
+}
 
 
 
 
 
 
@@ -446,4 +460,5 @@ $SOBE = t3lib_div::makeInstance('SC_move_el');
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
+
 ?>
\ No newline at end of file
 ?>
\ No newline at end of file