Follow-up to #16396: cleaned up code, fixed naming convention violations
authorIngo Renner <ingo.renner@typo3.org>
Fri, 3 Dec 2010 14:39:01 +0000 (14:39 +0000)
committerIngo Renner <ingo.renner@typo3.org>
Fri, 3 Dec 2010 14:39:01 +0000 (14:39 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9753 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/cms/class.tx_cms_be_layout.php [deleted file]
typo3/sysext/cms/ext_autoload.php
typo3/sysext/cms/layout/class.tx_cms_layout.php
typo3/sysext/cms/layout/db_layout.php
typo3/sysext/cms/tbl_tt_content.php

index 8bb3e15..d2c4322 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-12-03  Ingo Renner  <ingo@typo3.org>
+
+       * Follow-up to #16396: cleaned up code, fixed naming convention violations
+
 2010-12-03  Steffen Kamper  <steffen@typo3.org>
 
        * Follow-up to #16396: cleanup code, added phpDoc and XCLASS definition
diff --git a/typo3/sysext/cms/class.tx_cms_be_layout.php b/typo3/sysext/cms/class.tx_cms_be_layout.php
deleted file mode 100644 (file)
index a73b85e..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 GridView Team
- *  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!
- ***************************************************************/
-
-class tx_cms_be_layout {
-
-       /**
-        * ItemProcFunc for colpos items
-        *
-        * @param  array $params
-        * @return void
-        */
-       public function colPosListItemProcFunc(&$params) {
-               $params['items'] = $this->addColPosListLayoutItems($params['row']['pid'], $params['items']);
-       }
-
-       /**
-        * Adds items to a colpos list
-        *
-        * @param  int  $pageId
-        * @param  array  $items
-        * @return array
-        */
-       protected function addColPosListLayoutItems($pageId, $items) {
-               $layout = $this->getSelectedBackendLayout($pageId);
-               if ($layout && $layout['__items']) {
-                       $items = $layout['__items'];
-               }
-               return $items;
-       }
-
-       /**
-        * Gets the list of available columns for a given page id
-        *
-        * @param  int  $id
-        * @return  array  $tcaItems
-        */
-       public function getColPosListItemsParsed($id) {
-
-               $tsConfig = t3lib_BEfunc::getModTSconfig($id, 'TCEFORM.tt_content.colPos');
-               $tcaConfig = $GLOBALS['TCA']['tt_content']['columns']['colPos']['config'];
-
-               /** @var $tceForms  t3lib_TCEForms */
-               $tceForms = t3lib_div::makeInstance('t3lib_TCEForms');
-               $tcaItems = $tcaConfig['items'];
-               $tcaItems = $tceForms->addItems($tcaItems, $tsConfig['properties']['addItems.']);
-               if (isset($tcaConfig['itemsProcFunc']) && $tcaConfig['itemsProcFunc']) {
-                       $tcaItems = $this->addColPosListLayoutItems($id, $tcaItems);
-               }
-               foreach (t3lib_div::trimExplode(',', $tsConfig['properties']['removeItems'], 1) as $removeId) {
-                       unset($tcaItems[$removeId]);
-               }
-
-               return $tcaItems;
-       }
-
-       /**
-        * Gets the selected backend layout
-        *
-        * @param  int  $id
-        * @return array|null  $backendLayout
-        */
-       public function getSelectedBackendLayout($id) {
-               $rootline = t3lib_BEfunc::BEgetRootLine($id);
-               $backendLayoutUid = null;
-               for ($i = count($rootline); $i > 0; $i--) {
-                       $page = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
-                               'uid, be_layout, be_layout_next_level',
-                               'pages',
-                               'uid=' . intval($rootline[$i]['uid'])
-                       );
-                       if (intval($page['be_layout_next_level']) > 0 && $page['uid'] != $id) {
-                               $backendLayoutUid = intval($page['be_layout_next_level']);
-                               break;
-                       } else {
-                               if (intval($page['be_layout']) > 0) {
-                                       $backendLayoutUid = intval($page['be_layout']);
-                                       break;
-                               }
-                       }
-               }
-               $backendLayout = NULL;
-               if ($backendLayoutUid) {
-                       $backendLayout = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'be_layouts', 'uid=' . $backendLayoutUid);
-                       if ($backendLayout) {
-                               /** @var $parser  t3lib_TSparser */
-                               $parser = t3lib_div::makeInstance('t3lib_TSparser');
-                               $parser->parse($backendLayout['config']);
-                               $backendLayout['__config'] = $parser->setup;
-                               $backendLayout['__items'] = array();
-                               $backendLayout['__colPosList'] = array();
-
-                               // create items and colPosList
-                               if ($backendLayout['__config']['be_layout.'] && $backendLayout['__config']['be_layout.']['rows.']) {
-                                       foreach ($backendLayout['__config']['be_layout.']['rows.'] as $row) {
-                                               if (isset($row['columns.']) && is_array($row['columns.'])) {
-                                                       foreach ($row['columns.'] as $column) {
-                                                               $backendLayout['__items'][] = array(
-                                                                       $column['name'],
-                                                                       $column['colPos'],
-                                                                       NULL
-                                                               );
-                                                               $backendLayout['__colPosList'][] = $column['colPos'];
-                                                       }
-                                               }
-                                       }
-                               }
-
-                       }
-               }
-               return $backendLayout;
-       }
-
-}
-
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/class.tx_cms_be_layout.php']) {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/class.tx_cms_be_layout.php']);
-}
-
-?>
\ No newline at end of file
index 967f5af..8a7180b 100644 (file)
@@ -29,6 +29,7 @@ return array(
        'sc_tslib_showpic' => PATH_tslib . 'showpic.php',
        'tx_cms_mediaitems' => PATH_tslib . 'hooks/class.tx_cms_mediaitems.php',
        'tx_cms_treelistcacheupdate' => PATH_tslib . 'hooks/class.tx_cms_treelistcacheupdate.php',
+       'tx_cms_backendlayout' => PATH_tslib . 'classes/class.tx_cms_backendlayout.php',
        'tslib_content_cobjgetsinglehook' => PATH_tslib . 'interfaces/interface.tslib_content_cobjgetsinglehook.php',
        'tslib_menu_filterMenuPagesHook' => PATH_tslib . 'interfaces/interface.tslib_menu_filterMenuPagesHook.php',
        'tslib_content_getdatahook' => PATH_tslib . 'interfaces/interface.tslib_content_getdatahook.php',
index 257926f..56ddf38 100755 (executable)
@@ -524,7 +524,7 @@ class tx_cms_layout extends recordList {
                                        $newP = $this->newContentElementOnClick($id, $key, $lP);
                                        $colTitle = t3lib_BEfunc::getProcessedValue('tt_content', 'colPos', $key);
 
-                                       $tcaItems = t3lib_div::callUserFunction('EXT:cms/class.tx_cms_be_layout.php:tx_cms_be_layout->getColPosListItemsParsed', $id, $this);
+                                       $tcaItems = t3lib_div::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getColPosListItemsParsed', $id, $this);
                                        foreach ($tcaItems as $item) {
                                                if ($item[1] == $key) {
                                                        $colTitle = $GLOBALS['LANG']->sL($item[0]);
index 3ab1f8c..de23048 100755 (executable)
@@ -536,10 +536,11 @@ class SC_db_layout {
                                // Find columns
                        $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id,'mod.SHARED');             // SHARED page-TSconfig settings.
                        $this->colPosList = strcmp(trim($this->modTSconfig['properties']['tt_content.']['colPos_list']),'') ? trim($this->modTSconfig['properties']['tt_content.']['colPos_list']) : $modTSconfig_SHARED['properties']['colPos_list'];
-                       if( !strcmp($this->colPosList,'') ) {
-                               $beLayout = t3lib_div::callUserFunction( 'EXT:cms/class.tx_cms_be_layout.php:tx_cms_be_layout->getSelectedBackendLayout' , $this->id, $this );
-                               if(count($beLayout['__colPosList'])) {
-                                       $this->colPosList = implode(',', $beLayout['__colPosList']);
+                       if (!strcmp($this->colPosList,'')) {
+                               $backendLayout = t3lib_div::callUserFunction( 'EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getSelectedBackendLayout' , $this->id, $this );
+
+                               if(count($backendLayout['__colPosList'])) {
+                                       $this->colPosList = implode(',', $backendLayout['__colPosList']);
                                }
                        }
                        if( !strcmp($this->colPosList, '') ){
@@ -1068,7 +1069,7 @@ class SC_db_layout {
                                                        // Setting up the tt_content columns to show:
                                                if (is_array($TCA['tt_content']['columns']['colPos']['config']['items']))       {
                                                        $colList = array();
-                                                       $tcaItems = t3lib_div::callUserFunction( 'EXT:cms/class.tx_cms_be_layout.php:tx_cms_be_layout->getColPosListItemsParsed' , $this->id, $this );
+                                                       $tcaItems = t3lib_div::callUserFunction( 'EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getColPosListItemsParsed' , $this->id, $this );
                                                        foreach($tcaItems as $temp)     {
                                                                $colList[] = $temp[1];
                                                        }
index ba03973..c01c329 100755 (executable)
@@ -297,7 +297,7 @@ $TCA['tt_content'] = array(
                        'label' => 'LLL:EXT:cms/locallang_ttc.xml:colPos',
                        'config' => array(
                                'type' => 'select',
-                               'itemsProcFunc' => 'EXT:cms/class.tx_cms_be_layout.php:tx_cms_be_layout->colPosListItemProcFunc',
+                               'itemsProcFunc' => 'EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->colPosListItemProcFunc',
                                'items' => array(
                                        array(
                                                'LLL:EXT:cms/locallang_ttc.xml:colPos.I.0',