* Modified typo3/sysext/cms/tslib/class.tslib_content.php:
[Packages/TYPO3.CMS.git] / typo3 / wizard_list.php
index 575e963..12bd2d3 100755 (executable)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *  
-*  (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
+*  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is 
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
 /** 
- * Wizard to list records
+ * Wizard to list records from a page id.
  * 
  * $Id$
+ * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
+ * XHTML compliant
  * 
  * @author     Kasper Skaarhoj <kasper@typo3.com>
  */
@@ -36,9 +38,9 @@
  *
  *
  *
- *   72: class SC_wizard_list 
- *   80:     function init()   
- *   89:     function main()   
+ *   74: class SC_wizard_list 
+ *   93:     function init()   
+ *  105:     function main()   
  *
  * TOTAL FUNCTIONS: 2
  * (This index is automatically created/updated by the extension "extdeveval")
@@ -63,48 +65,61 @@ include ('sysext/lang/locallang_wizards.php');
 
 
 /**
- * Script Class
- * 
+ * Script Class for redirecting the user to the Web > List module if a wizard-link has been clicked in TCEforms
+ *
  * @author     Kasper Skaarhoj <kasper@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
 class SC_wizard_list {
-       var $P;
-       var $pid;
-       var $table;
+
+               // Internal, static:
+       var $pid;                                       // PID
        
+               // Internal, static: GPvars
+       var $P;                                         // Wizard parameters, coming from TCEforms linking to the wizard.
+       var $table;                                     // Table to show, if none, then all tables are listed in list module.
+       var $id;                                        // Page id to list.
+
+
+
+
+
        /**
-        * @return      [type]          ...
+        * Initialization of the class, setting GPvars.
+        *
+        * @return      void
         */
        function init() {
-               $this->P = t3lib_div::GPvar('P',1);
+               $this->P = t3lib_div::_GP('P');
+               $this->table = t3lib_div::_GP('table');
+               $this->id = t3lib_div::_GP('id');
        }
 
        /**
-        * [Describe function...]
-        * 
-        * @return      [type]          ...
+        * Main function
+        * Will issue a location-header, redirecting either BACK or to a new alt_doc.php instance...
+        *
+        * @return      void
         */
        function main() {
-               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$HTTP_GET_VARS,$HTTP_POST_VARS,$CLIENT,$TYPO3_CONF_VARS;
-               
-               $this->table = t3lib_div::GPvar("table");
 
-               // Get this record
-               $origRow = t3lib_BEfunc::getRecord($this->P["table"],$this->P["uid"]);
+                       // Get this record
+               $origRow = t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
                
-               // Get TSconfig for it.
-               $TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig($this->table,is_array($origRow)?$origRow:array("pid"=>$this->P["pid"]));
-               // Set [params][pid]
-               if (substr($this->P["params"]["pid"],0,3)=="###" && substr($this->P["params"]["pid"],-3)=="###")        {
-                       $this->pid = intval($TSconfig["_".substr($this->P["params"]["pid"],3,-3)]);
-               } else $this->pid = intval($this->P["params"]["pid"]);
+                       // Get TSconfig for it.
+               $TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig($this->table,is_array($origRow)?$origRow:array('pid'=>$this->P['pid']));
+                       
+                       // Set [params][pid]
+               if (substr($this->P['params']['pid'],0,3)=='###' && substr($this->P['params']['pid'],-3)=='###')        {
+                       $this->pid = intval($TSconfig['_'.substr($this->P['params']['pid'],3,-3)]);
+               } else $this->pid = intval($this->P['params']['pid']);
                
-               if (!strcmp($this->pid,"") || strcmp(t3lib_div::GPvar("id"),""))        {
-                       header("Location: ".t3lib_div::locationHeaderUrl($this->P["returnUrl"]));
-               } else {
-                       header("Location: ".t3lib_div::locationHeaderUrl("db_list.php?id=".$this->pid."&table=".$this->P["params"]["table"]."&returnUrl=".rawurlencode(t3lib_div::getIndpEnv("REQUEST_URI"))));
+                       // Make redirect:
+               if (!strcmp($this->pid,'') || strcmp($this->id,''))     {       // If pid is blank OR if id is set, then return...
+                       header('Location: '.t3lib_div::locationHeaderUrl($this->P['returnUrl']));
+               } else {        // Otherwise, show the list:
+                       header('Location: '.t3lib_div::locationHeaderUrl('db_list.php?id='.$this->pid.'&table='.$this->P['params']['table'].'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))));
                }
        }
 }