From f8726a64650e32c6cb225e2b21b407564cd7a714 Mon Sep 17 00:00:00 2001 From: Ingo Renner Date: Fri, 3 Dec 2010 14:39:01 +0000 Subject: [PATCH] Follow-up to #16396: cleaned up code, fixed naming convention violations git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9753 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 4 + typo3/sysext/cms/class.tx_cms_be_layout.php | 143 ------------------ typo3/sysext/cms/ext_autoload.php | 1 + .../sysext/cms/layout/class.tx_cms_layout.php | 2 +- typo3/sysext/cms/layout/db_layout.php | 11 +- typo3/sysext/cms/tbl_tt_content.php | 2 +- 6 files changed, 13 insertions(+), 150 deletions(-) delete mode 100644 typo3/sysext/cms/class.tx_cms_be_layout.php diff --git a/ChangeLog b/ChangeLog index 8bb3e158120d..d2c4322466c1 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-12-03 Ingo Renner + + * Follow-up to #16396: cleaned up code, fixed naming convention violations + 2010-12-03 Steffen Kamper * 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 index a73b85ef7644..000000000000 --- a/typo3/sysext/cms/class.tx_cms_be_layout.php +++ /dev/null @@ -1,143 +0,0 @@ -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 diff --git a/typo3/sysext/cms/ext_autoload.php b/typo3/sysext/cms/ext_autoload.php index 967f5afc0e30..8a7180bb2c6a 100644 --- a/typo3/sysext/cms/ext_autoload.php +++ b/typo3/sysext/cms/ext_autoload.php @@ -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', diff --git a/typo3/sysext/cms/layout/class.tx_cms_layout.php b/typo3/sysext/cms/layout/class.tx_cms_layout.php index 257926f335d5..56ddf388764e 100755 --- a/typo3/sysext/cms/layout/class.tx_cms_layout.php +++ b/typo3/sysext/cms/layout/class.tx_cms_layout.php @@ -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]); diff --git a/typo3/sysext/cms/layout/db_layout.php b/typo3/sysext/cms/layout/db_layout.php index 3ab1f8ce4c46..de23048d720a 100755 --- a/typo3/sysext/cms/layout/db_layout.php +++ b/typo3/sysext/cms/layout/db_layout.php @@ -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]; } diff --git a/typo3/sysext/cms/tbl_tt_content.php b/typo3/sysext/cms/tbl_tt_content.php index ba039736b1c7..c01c329d90f1 100755 --- a/typo3/sysext/cms/tbl_tt_content.php +++ b/typo3/sysext/cms/tbl_tt_content.php @@ -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', -- 2.20.1