* Added a checkbox for be-users to disable IP locking. This is useful if you have...
[Packages/TYPO3.CMS.git] / typo3 / db_new.php
index fc13e4f..51b0c34 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 
  *
  *
  *  128: class SC_db_new 
- *  158:     function init()   
- *  218:     function main()   
- *  275:     function pagesOnly()      
- *  290:     function regularNew()     
- *  428:     function printContent()   
- *  442:     function linkWrap($code,$table,$pid,$addContentTable=0)   
- *  462:     function isTableAllowedForThisPage($pid_row, $checkTable) 
- *  492:     function showNewRecLink($table,$allowedNewTables='')      
+ *  157:     function init()   
+ *  217:     function main()   
+ *  274:     function pagesOnly()      
+ *  289:     function regularNew()     
+ *  432:     function printContent()   
+ *  446:     function linkWrap($code,$table,$pid,$addContentTable=0)   
+ *  466:     function isTableAllowedForThisPage($pid_row, $checkTable) 
+ *  496:     function showNewRecLink($table,$allowedNewTables='')      
  *
  * TOTAL FUNCTIONS: 10
  * (This index is automatically created/updated by the extension "extdeveval")
@@ -82,7 +82,7 @@ require_once (PATH_t3lib.'class.t3lib_pagetree.php');
 
 /**
  * Extension for the tree class that generates the tree of pages in the page-wizard mode
- * 
+ *
  * @author     Kasper Skaarhoj <kasper@typo3.com>
  * @package TYPO3
  * @subpackage core
@@ -91,7 +91,7 @@ class localPageTree extends t3lib_pageTree {
 
        /**
         * Inserting uid-information in title-text for an icon
-        * 
+        *
         * @param       string          Icon image
         * @param       array           Item row
         * @return      string          Wrapping icon image.
@@ -103,7 +103,7 @@ class localPageTree extends t3lib_pageTree {
        /**
         * Determines whether to expand a branch or not.
         * Here the branch is expanded if the current id matches the global id for the listing/new
-        * 
+        *
         * @param       integer         The ID (page id) of the element
         * @return      boolean         Returns true if the IDs matches
         */
@@ -120,7 +120,7 @@ class localPageTree extends t3lib_pageTree {
 
 /**
  * Script class for 'db_new'
- * 
+ *
  * @author     Kasper Skaarhoj <kasper@typo3.com>
  * @package TYPO3
  * @subpackage core
@@ -137,7 +137,6 @@ class SC_db_new {
        var $allowedNewTables_pid;
        var $code;
        var $R_URI;
-       var $code;      
        
                // Internal, static: GPvar
        var $id;                        // see init()
@@ -152,8 +151,8 @@ class SC_db_new {
        
        /**
         * Constructor function for the class
-        * 
-        * @return      void            
+        *
+        * @return      void
         */
        function init() {
                global $BE_USER,$LANG,$BACK_PATH;
@@ -162,9 +161,9 @@ class SC_db_new {
                $this->perms_clause = $BE_USER->getPagePermsClause(1);
 
                        // Setting GPvars:
-               $this->id = intval(t3lib_div::GPvar('id'));     // The page id to operate from
-               $this->returnUrl = t3lib_div::GPvar('returnUrl');
-               $this->pagesOnly = t3lib_div::GPvar('pagesOnly');
+               $this->id = intval(t3lib_div::_GP('id'));       // The page id to operate from
+               $this->returnUrl = t3lib_div::_GP('returnUrl');
+               $this->pagesOnly = t3lib_div::_GP('pagesOnly');
                
                        // Create instance of template class for output
                $this->doc = t3lib_div::makeInstance('smallDoc');
@@ -212,8 +211,8 @@ class SC_db_new {
 
        /**
         * Main processing, creating the list of new record tables to select from
-        * 
-        * @return      void            
+        *
+        * @return      void
         */
        function main() {
                global $BE_USER,$LANG;
@@ -269,8 +268,8 @@ class SC_db_new {
 
        /**
         * Creates the position map for pages wizard
-        * 
-        * @return      void            
+        *
+        * @return      void
         */
        function pagesOnly()    {
                global $LANG;
@@ -284,8 +283,8 @@ class SC_db_new {
 
        /**
         * Create a regular new element (pages and records)
-        * 
-        * @return      void            
+        *
+        * @return      void
         */
        function regularNew()   {
                global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA;
@@ -299,9 +298,9 @@ class SC_db_new {
                                // Create link to new page inside:
                        $t='pages';
                        $v=$TCA[$t];
-                       $this->code.=$this->linkWrap(
-                                               '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join.gif','width="18" height="16"').' alt="" />'.
-                                                       '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/'.($v['ctrl']['iconfile'] ? $v['ctrl']['iconfile'] : $t.'.gif'),'width="18" height="16"').' alt="" /> '.
+                       $this->code.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join.gif','width="18" height="16"').' alt="" />'.
+                                                       $this->linkWrap(
+                                                       '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/'.($v['ctrl']['iconfile'] ? $v['ctrl']['iconfile'] : $t.'.gif'),'width="18" height="16"').' alt="" />'.
                                                        $LANG->sL($v['ctrl']['title'],1).' ('.$LANG->sL('LLL:EXT:lang/locallang_core.php:db_new.php.inside',1).')',
                                                $t,
                                                $this->id);
@@ -310,7 +309,7 @@ class SC_db_new {
                        if (isset($TCA_DESCR[$t]['columns']['']))       {
                                $onClick = 'vHWin=window.open(\'view_help.php?tfID='.$t.'.\',\'viewFieldHelp\',\'height=300,width=250,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;';
                                $this->code.='<a href="#" onclick="'.htmlspecialchars($onClick).'">'.
-                                                       '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/helpbubble.gif','width="14" height="14"').' align="right"'.$this->doc->helpStyle().' alt="" />'.
+                                                       '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/helpbubble.gif','width="14" height="14"').' class="c-helpImg" align="right"'.$this->doc->helpStyle().' alt="" />'.
                                                        '</a>';
                        }
                        $this->code.='<br />
@@ -339,8 +338,8 @@ class SC_db_new {
                                                        )       {
 
                                                        // Create new link for record:
-                                               $this->code.=$this->linkWrap(
-                                                       '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join.gif','width="18" height="16"').' alt="" />'.
+                                               $this->code.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join.gif','width="18" height="16"').' alt="" />'.
+                                                               $this->linkWrap(
                                                                t3lib_iconWorks::getIconImage($t,array(),$BACK_PATH,'').
                                                                $LANG->sL($v['ctrl']['title'],1)
                                                        ,$t
@@ -352,7 +351,7 @@ class SC_db_new {
                                                        if (isset($TCA_DESCR[$t]['columns']['']))       {
                                                                $onClick = 'vHWin=window.open(\'view_help.php?tfID='.$t.'.\',\'viewFieldHelp\',\'height=300,width=250,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;';
                                                                $this->code.='<a href="#" onclick="'.htmlspecialchars($onClick).'">'.
-                                                                       '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/helpbubble.gif','width="14" height="14"').' align="right"'.$this->doc->helpStyle().' alt="" />'.
+                                                                       '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/helpbubble.gif','width="14" height="14"').' class="c-helpImg" align="right"'.$this->doc->helpStyle().' alt="" />'.
                                                                        '</a>';
                                                        }
                                                }
@@ -361,15 +360,20 @@ class SC_db_new {
 
                                                        // If the table is 'tt_content' (from "cms" extension), create link to wizard
                                                if ($t=='tt_content')   {
-                                                       $href = 'sysext/cms/layout/db_new_content_el.php?id='.$this->id.'&returnUrl='.rawurlencode($this->R_URI);
+
+                                                               // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's wizard instead:
+                                                       $overrideExt = $this->web_list_modTSconfig['properties']['newContentWiz.']['overrideWithExtension'];
+                                                       $pathToWizard = (t3lib_extMgm::isLoaded($overrideExt)) ? (t3lib_extMgm::extRelPath($overrideExt).'mod1/db_new_content_el.php') : 'sysext/cms/layout/db_new_content_el.php';
+                                                       
+                                                       $href = $pathToWizard.'?id='.$this->id.'&returnUrl='.rawurlencode($this->R_URI);
                                                        $this->code.='<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/ol/line.gif','width="18" height="16"').' alt="" />'.
                                                                                '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/ol/joinbottom.gif','width="18" height="16"').' alt="" />'.
                                                                                '<a href="'.htmlspecialchars($href).'"><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/new_record.gif','width="16" height="12"').' alt="" /> '.
                                                                                htmlspecialchars($LANG->getLL('clickForWizard')).
                                                                                '</a><br />
                                                                                ';
-                                                       $this->code.='<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/ol/halfline.gif','width="18" height="8"').' align="top" alt="" /><br />
-                                                       ';
+                                                       $this->code.='<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/ol/halfline.gif','width="18" height="8"').' alt="" /><br />
+                                                                               ';
                                                }
                                        }
                                }
@@ -383,8 +387,8 @@ class SC_db_new {
                        $t='pages';
                        $v=$TCA[$t];
                        $this->code.=$this->linkWrap(
-                                       t3lib_iconWorks::getIconImage($t,array(),$BACK_PATH,''),
-                                       $LANG->sL($v['ctrl']['title'],1).' ('.$LANG->sL('LLL:EXT:lang/locallang_core.php:db_new.php.after',1).')',
+                                       t3lib_iconWorks::getIconImage($t,array(),$BACK_PATH,'').
+                                               $LANG->sL($v['ctrl']['title'],1).' ('.$LANG->sL('LLL:EXT:lang/locallang_core.php:db_new.php.after',1).')',
                                        'pages',
                                        -$this->id
                                );
@@ -393,7 +397,7 @@ class SC_db_new {
                        if (isset($TCA_DESCR[$t]['columns']['']))       {
                                $onClick = 'vHWin=window.open(\'view_help.php?tfID='.$t.'.\',\'viewFieldHelp\',\'height=300,width=250,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;';
                                $this->code.='<a href="#" onclick="'.htmlspecialchars($onCLick).'">'.
-                                                       '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/helpbubble.gif','width="14" height="14"').' align="right"'.$this->doc->helpStyle().' alt="" />'.
+                                                       '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/helpbubble.gif','width="14" height="14"').' class="c-helpImg" align="right"'.$this->doc->helpStyle().' alt="" />'.
                                                        '</a>';
                        }
                        $this->code.='<br />
@@ -422,8 +426,8 @@ class SC_db_new {
 
        /**
         * Ending page output and echo'ing content to browser.
-        * 
-        * @return      void            
+        *
+        * @return      void
         */
        function printContent() {
                $this->content.= $this->doc->endPage();
@@ -432,7 +436,7 @@ class SC_db_new {
 
        /**
         * Links the string $code to a create-new form for a record in $table created on page $pid
-        * 
+        *
         * @param       string          Link string
         * @param       string          Table name (in which to create new record)
         * @param       integer         PID value for the "&edit['.$table.']['.$pid.']=new" command (positive/negative)
@@ -454,7 +458,7 @@ class SC_db_new {
 
        /**
         * Returns true if the tablename $checkTable is allowed to be created on the page with record $pid_row
-        * 
+        *
         * @param       array           Record for parent page.
         * @param       string          Table name to check
         * @return      boolean         Returns true if the tablename $checkTable is allowed to be created on the page with record $pid_row
@@ -484,7 +488,7 @@ class SC_db_new {
 
        /**
         * Returns true if the $table tablename is found in $allowedNewTables (or if $allowedNewTables is empty)
-        * 
+        *
         * @param       string          Table name to test if in allowedTables
         * @param       array           Array of new tables that are allowed.
         * @return      boolean         Returns true if the $table tablename is found in $allowedNewTables (or if $allowedNewTables is empty)
@@ -509,4 +513,4 @@ $SOBE = t3lib_div::makeInstance('SC_db_new');
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
-?>
+?>
\ No newline at end of file