Added feature #7370: Remove page doktypes 2 & 5 (advanced & not in menu) and merge...
authorOliver Hader <oliver.hader@typo3.org>
Tue, 5 Feb 2008 18:36:07 +0000 (18:36 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 5 Feb 2008 18:36:07 +0000 (18:36 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3078 709f56b5-9817-0410-a4d7-c38de5d9e867

12 files changed:
ChangeLog
NEWS.txt
t3lib/class.t3lib_iconworks.php
typo3/class.webpagetree.php
typo3/sysext/cms/ext_tables.php
typo3/sysext/cms/tslib/class.tslib_menu.php
typo3/sysext/indexed_search/pi/class.tx_indexedsearch.php
typo3/sysext/install_old/ext_localconf.php
typo3/sysext/install_old/mod/class.tx_install.php
typo3/sysext/install_old/updates/class.tx_coreupdates_compatversion.php
typo3/sysext/install_old/updates/class.tx_coreupdates_mergeadvanced.php [new file with mode: 0644]
typo3/sysext/install_old/updates/class.tx_coreupdates_notinmenu.php

index 7ddbb06..ef98281 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@
 2008-02-05  Oliver Hader  <oh@inpublica.de>
 
        * (tweak) Followup to #6472: Some small changes to the new hooks
+       * !!! (feature) Added feature #7370: Remove page doktypes 2 & 5 (advanced & not in menu) and merge them with doktype 1 (normal)
 
 2008-02-04 Jeff Segars <jeff@webempoweredchurch.org>
 
index 763eb1b..d3aef33 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -39,12 +39,19 @@ Backend
 
        * TCEforms
                -> Notify and visualize user where required elements are nested in IRRE or Tabs
-               -> IRRE - Localization support for child records 
+               -> IRRE - Localization support for child records
 
 Compatibility
 =============
 
        * t3lib_div::cvsValues() now exports like Internet RFC 4180 (embedded line-breaks allowed)
+       * !!! Page doktypes "2" & "5" ("advanced" and "not in menu") were removed and merge with the "normal" doktype "1"
+               -> This behaviour can be disabled by setting the $TYPO3_CONF_VARS['SYS']['compat_version'] to '4.1'.
+               -> The update wizard allows one to perform the required database changes. 
+               -> For Developers: Check your extensions and TypoScripts
+                       -> doktypes '2' and '5' are deprecated!
+                       -> change conditions like "doktype=5" to "nav_hide=1"
+                       -> remove conditions like "doktype=2"
 
 Speed improvements
 ==================
index f121192..9ec2959 100755 (executable)
@@ -142,6 +142,7 @@ class t3lib_iconWorks       {
 
                        // First, find the icon file name. This can depend on configuration in TCA, field values and more:
                if ($table=='pages')    {
+                               // @TODO: RFC #7370: doktype 2&5 are deprecated since TYPO3 4.2-beta1
                        if ($row['nav_hide'] && ($row['doktype']==1||$row['doktype']==2))       $row['doktype']=5;      // Workaround to change the icon if "Hide in menu" was set
 
                        if (!$iconfile = $PAGES_TYPES[$row['doktype']]['icon']) {
index 2571629..d47c283 100755 (executable)
@@ -414,6 +414,7 @@ class webPageTree extends t3lib_browseTree {
                        $crazyRecursionLimiter--;
        
                                // Not in menu:
+                               // @TODO: RFC #7370: doktype 2&5 are deprecated since TYPO3 4.2-beta1
                        if ($this->ext_separateNotinmenuPages && (t3lib_div::inList('5,6',$row['doktype']) || $row['doktype']>=200 || $row['nav_hide']))        {
                                $outOfMenuPages[] = $row;
                                $outOfMenuPagesTextIndex[] = ($row['doktype']>=200 ? 'zzz'.$row['doktype'].'_' : '').$row['title'];
index 7f48cad..c613b4f 100755 (executable)
@@ -66,8 +66,6 @@ if (TYPO3_MODE=='BE') {
                1,
                0,
                array(
-                       array('LLL:EXT:cms/locallang_tca.xml:pages.doktype.I.0', '2', 'i/pages.gif'),
-                       array('LLL:EXT:cms/locallang_tca.xml:pages.doktype.I.3', '5', 'i/pages_notinmenu.gif'),
                        array('LLL:EXT:cms/locallang_tca.xml:pages.doktype.I.4', '6', 'i/be_users_section.gif'),
                        array('LLL:EXT:cms/locallang_tca.xml:pages.doktype.div.link', '--div--'),
                        array('LLL:EXT:cms/locallang_tca.xml:pages.doktype.I.2', '4', 'i/pages_shortcut.gif'),
@@ -484,17 +482,8 @@ if (TYPO3_MODE=='BE')      {
 
                // Totally overriding all type-settings:
        $TCA['pages']['types'] = array (
-                       // standard
+                       // normal
                '1' => array('showitem' =>
-                               'doktype;;2;button;1-1-1, hidden, nav_hide, title;;3;;2-2-2, subtitle,
-                       --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access,
-                               starttime, endtime, fe_group, extendToSubpages,
-                       --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.options,
-                               TSconfig;;6;nowrap;4-4-4, storage_pid;;7, l18n_cfg,
-                       --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.extended,
-               '),
-                       // advanced
-               '2' => array('showitem' =>
                                'doktype;;2;button;1-1-1, hidden, nav_hide, title;;3;;2-2-2, subtitle, nav_title,
                        --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.metadata,
                                abstract;;5;;3-3-3, keywords, description,
@@ -587,7 +576,45 @@ if (TYPO3_MODE=='BE')      {
        ));
 
 
-
+       // if the compat version is less than 4.2, pagetype 2 ("Advanced")
+       // and pagetype 5 ("Not in menu") are added to TCA.
+       if (!t3lib_div::compat_version('4.2')) {
+                       // Merging in CMS doktypes
+               array_splice(
+                       $TCA['pages']['columns']['doktype']['config']['items'],
+                       2,
+                       0,
+                       array(
+                               array('LLL:EXT:cms/locallang_tca.xml:pages.doktype.I.0', '2', 'i/pages.gif'),
+                               array('LLL:EXT:cms/locallang_tca.xml:pages.doktype.I.3', '5', 'i/pages_notinmenu.gif'),
+                       )
+               );
+                       // setting the doktype 1 ("Standard") to show less fields
+               $TCA['pages']['types'][1] = array(
+                               // standard
+                       'showitem' =>
+                                       'doktype;;2;button;1-1-1, hidden, nav_hide, title;;3;;2-2-2, subtitle,
+                               --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access,
+                                       starttime, endtime, fe_group, extendToSubpages,
+                               --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.options,
+                                       TSconfig;;6;nowrap;4-4-4, storage_pid;;7, l18n_cfg,
+                               --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.extended,
+               ');
+                       // adding doktype 2 ("Advanced")
+               $TCA['pages']['types'][2] = array(
+                       'showitem' =>
+                                       'doktype;;2;button;1-1-1, hidden, nav_hide, title;;3;;2-2-2, subtitle, nav_title,
+                               --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.metadata,
+                                       abstract;;5;;3-3-3, keywords, description,
+                               --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.files,
+                                       media,
+                               --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access,
+                                       starttime, endtime, fe_login_mode, fe_group, extendToSubpages,
+                               --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.options,
+                                       TSconfig;;6;nowrap;6-6-6, storage_pid;;7, l18n_cfg, module, content_from_pid,
+                               --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.extended,
+               ');
+       }
 
 // ******************************************************************
 // This is the standard TypoScript content table, tt_content
@@ -791,5 +818,4 @@ $TCA['static_template'] = array (
                'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tbl_cms.php'
        )
 );
-
 ?>
index 4e4641a..a5b852c 100755 (executable)
@@ -146,6 +146,7 @@ class tslib_menu {
        var $menuNumber = 1;                            // tells you which menu-number this is. This is important when getting data from the setup
        var $entryLevel = 0;                            // 0 = rootFolder
        var $spacerIDList = '199';                      // The doktype-number that defines a spacer
+               // @TODO: RFC #7370: doktype 2&5 are deprecated since TYPO3 4.2-beta1
        var $doktypeExcludeList = '5,6';                        // doktypes that define which should not be included in a menu
        var $alwaysActivePIDlist=array();
        var $imgNamePrefix = 'img';
@@ -242,6 +243,7 @@ class tslib_menu {
                        }
                        if($this->conf['includeNotInMenu']) {
                                $exclDoktypeArr = t3lib_div::trimExplode(',',$this->doktypeExcludeList,1);
+                                       // @TODO: RFC #7370: doktype 2&5 are deprecated since TYPO3 4.2-beta1
                                $exclDoktypeArr = t3lib_div::removeArrayEntryByValue($exclDoktypeArr,'5');
                                $this->doktypeExcludeList = implode(',',$exclDoktypeArr);
                        }
index fe25513..4819d06 100755 (executable)
@@ -349,12 +349,14 @@ class tx_indexedsearch extends tslib_pibase {
                if ($this->conf['show.']['L1sections']) {
                        $firstLevelMenu = $this->getMenu($this->wholeSiteIdList);
                        while(list($kk,$mR) = each($firstLevelMenu))    {
+                                       // @TODO: RFC #7370: doktype 2&5 are deprecated since TYPO3 4.2-beta1
                                if ($mR['doktype']!=5)  {
                                        $this->optValues['sections']['rl1_'.$mR['uid']] = trim($this->pi_getLL('opt_RL1').' '.$mR['title']);
                                        if ($this->conf['show.']['L2sections']) {
                                                $secondLevelMenu = $this->getMenu($mR['uid']);
                                                while(list($kk2,$mR2) = each($secondLevelMenu)) {
-                                                       if ($mR['doktype']!=5)  {
+                                                               // @TODO: RFC #7370: doktype 2&5 are deprecated since TYPO3 4.2-beta1
+                                                       if ($mR2['doktype']!=5) {
                                                                $this->optValues['sections']['rl2_'.$mR2['uid']] = trim($this->pi_getLL('opt_RL2').' '.$mR2['title']);
                                                        } else unset($secondLevelMenu[$kk2]);
                                                }
@@ -2332,6 +2334,7 @@ class tx_indexedsearch extends tslib_pibase {
                        while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
                                $output[$row['uid']] = $GLOBALS['TSFE']->sys_page->getPageOverlay($row);
                        }
+                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
                        return $output;
                } else {
                        return $GLOBALS['TSFE']->sys_page->getMenu($id);
index 15fea68..d6787e3 100644 (file)
@@ -1,11 +1,13 @@
 <?php
 if (!defined ('TYPO3_MODE'))   die ('Access denied.');
 
-require_once(t3lib_extMgm::extPath('install_old').'updates/class.tx_coreupdates_compatversion.php');
 $TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['changeCompatibilityVersion'] = 'tx_coreupdates_compatversion';
 
-       // not used yet
-//require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_notinmenu.php');
-//$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['notInMenu_doctype_conversion'] = 'tx_coreupdates_notinmenu';
+       // remove pagetype "not in menu" since TYPO3 4.2
+       // as there is an option in every pagetype
+$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['removeNotInMenuDoktypeConversion'] = 'tx_coreupdates_notinmenu';
 
+       // remove pagetype "advanced" since TYPO3 4.2
+       // this is merged with doctype "standard" with tab view to edit
+$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['mergeAdvancedDoktypeConversion'] = 'tx_coreupdates_mergeadvanced';
 ?>
\ No newline at end of file
index 4658ca0..9d4ad6f 100755 (executable)
 require_once (PATH_t3lib.'class.t3lib_install.php');
 require_once (PATH_t3lib.'class.t3lib_stdgraphic.php');
 
+// include update classes
+require_once(t3lib_extMgm::extPath('install_old').'updates/class.tx_coreupdates_compatversion.php');
+require_once(t3lib_extMgm::extPath('install_old').'updates/class.tx_coreupdates_notinmenu.php');
+require_once(t3lib_extMgm::extPath('install_old').'updates/class.tx_coreupdates_mergeadvanced.php');
+
+    
 /**
  * Install Tool module
  *
index 2a45a85..4e3aaa1 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2006 Sebastian Kurfuerst (sebastian@garbage-group.de)
+*  (c) 1999-2008 Sebastian Kurfuerst <sebastian@garbage-group.de>
 *  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!
 ***************************************************************/
+
 /**
  * Contains the update class for the compatibility version. Used by the update wizard in the install tool.
- *
- * @author     Sebastian Kurfuerst <sebastian@garbage-group.de
+ * 
+ * @author Sebastian Kurfuerst <sebastian@garbage-group.de
+ * @version $Id$
  */
 class tx_coreupdates_compatversion {
        var $versionNumber;     // version number coming from t3lib_div::int_from_ver()
@@ -82,7 +84,8 @@ class tx_coreupdates_compatversion {
                        $content = '<strong>You updated from an older version of TYPO3</strong>:<br />
                        <label for="'.$inputPrefix.'[version]">Select the version where you have upgraded from:</label> <select name="'.$inputPrefix.'[version]" id="'.$inputPrefix.'[version]">';
                        $versions = array(
-                               '3.8' => '<= 3.8'
+                               '3.8' => '<= 3.8',
+                               '4.1' => '<= 4.1',
                        );
                        foreach ($versions as $singleVersion => $caption)       {
                                $content .= '<option value="'.$singleVersion.'">'.$caption.'</option>';
diff --git a/typo3/sysext/install_old/updates/class.tx_coreupdates_mergeadvanced.php b/typo3/sysext/install_old/updates/class.tx_coreupdates_mergeadvanced.php
new file mode 100644 (file)
index 0000000..9760068
--- /dev/null
@@ -0,0 +1,93 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Steffen Kamper <info@sk-typo3.de>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Contains the update class for merging advanced and normal pagetype.
+ * 
+ * @author Steffen Kamper <info@sk-typo3.de>
+ * @version $Id$
+ */
+class tx_coreupdates_mergeadvanced {
+       var $versionNumber;     // version number coming from t3lib_div::int_from_ver()
+
+       /**
+        * parent object
+        *
+        * @var tx_install
+        */
+       var $pObj;
+       var $userInput; // user input
+
+
+       /**
+        * Checks if an update is needed
+        *
+        * @param       string          &$description: The description for the update
+        * @return      boolean         whether an update is needed (true) or not (false)
+        */
+       public function checkForUpdate(&$description) {
+               $result = false;
+               $description = 'Merges the "Advanced" pagetype (doktype 2) to "Standard" (doktype 1) because "Standard" now has the same features, and "Advanced" is not needed anymore.';
+
+               if ($this->versionNumber >= 4002000) {
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'doktype=2', '', '', '1');
+                       if($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
+                               $result = true;
+                       }
+                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
+               }
+               return $result;
+       }
+
+
+       /**
+        * Performs the database update. Changes the doktype from 2 (advanced) to 1 (standard)
+        *
+        * @param       array           &$dbQueries: queries done in this update
+        * @param       mixed           &$customMessages: custom messages
+        * @return      boolean         whether it worked (true) or not (false)
+        */
+       public function performUpdate(&$dbQueries, &$customMessages) {
+               $result = false;
+               if($this->versionNumber >= 4002000)     {
+                       $updateArray = array(
+                               'doktype' => 1,
+                       );
+
+                       $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'doktype=2', $updateArray);
+                       $dbQueries[] = str_replace(chr(10), ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
+                       
+                       if ($GLOBALS['TYPO3_DB']->sql_error()) {
+                               $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
+                       } else {
+                               $result = true;
+                       }
+               }
+               return $result;
+       }
+}
+?>
\ No newline at end of file
index 13df5fe..02dcc95 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2006 Sebastian Kurfuerst (sebastian@garbage-group.de)
+*  (c) 1999-2008 Sebastian Kurfuerst <sebastian@garbage-group.de>
 *  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!
 ***************************************************************/
+
 /**
  * Contains the update class for not in menu pages. Used by the update wizard in the install tool.
- *
- * @author     Sebastian Kurfuerst <sebastian@garbage-group.de
+ * 
+ * @author Sebastian Kurfuerst <sebastian@garbage-group.de>
+ * @author Steffen Kamper <info@sk-typo3.de>
+ * @version $Id$
  */
 class tx_coreupdates_notinmenu {
        var $versionNumber;     // version number coming from t3lib_div::int_from_ver()
@@ -40,27 +43,38 @@ class tx_coreupdates_notinmenu {
        var $pObj;
        var $userInput; // user input
 
-       function checkForUpdate(&$description)  {
-               $description = 'Removes the doctype "Not in menu" which is deprecated and sets the successing page flag "Not in menu" instead.';
 
-               if ($this->versionNumber >= 3009000)    {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid','pages','doktype=5');
-                       if($GLOBALS['TYPO3_DB']->sql_num_rows($res))    {
-                               return 1;
+       /**
+        * Checks if an update is needed
+        *
+        * @param       string          &$description: The description for the update
+        * @return      boolean         whether an update is needed (true) or not (false)
+        */
+       public function checkForUpdate(&$description) {
+               $result = false;
+               $description = 'Removes the deprecated pages doktype "Not in menu". It sets the successing flag "Not in menu" for the corresponding pages instead.';
+
+               if ($this->versionNumber >= 4002000) {
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'doktype=5', '', '', '1');
+                       if($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
+                               $result = true;
                        }
+                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
                }
-               return 0;
+               return $result;
        }
 
+
        /**
-        * [Describe function...]
+        * Performs the database update. Changes the doktype from 5 ("not in menu") to 1 (standard) and sets the "nav_hide" flag to 1
         *
-        * @param       [type]          $$dbQueries: ...
-        * @param       [type]          $customMessages: ...
-        * @return      [type]          ...
+        * @param       array           &$dbQueries: queries done in this update
+        * @param       mixed           &$customMessages: custom messages
+        * @return      boolean         whether it worked (true) or not (false)
         */
-       function performUpdate(&$dbQueries, &$customMessages)   {
-               if($this->versionNumber >= 3009000)     {
+       public function performUpdate(&$dbQueries, &$customMessages) {
+               $result = false;
+               if($this->versionNumber >= 4002000)     {
                        $updateArray = array(
                                'doktype' => 1,
                                'nav_hide' => 1
@@ -68,12 +82,14 @@ class tx_coreupdates_notinmenu {
 
                        $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'doktype=5', $updateArray);
                        $dbQueries[] = str_replace(chr(10), ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
-
-                       if ($GLOBALS['TYPO3_DB']->sql_error())  {
-                               return 0;       // something went wrong
+                       
+                       if ($GLOBALS['TYPO3_DB']->sql_error()) {
+                               $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
+                       } else {
+                               $result = true;
                        }
-                       return 1;
                }
+               return $result;
        }
 }
 ?>
\ No newline at end of file