Index: typo3/sysext/cms/layout/class.tx_cms_layout.php =================================================================== --- typo3/sysext/cms/layout/class.tx_cms_layout.php (revision 6849) +++ typo3/sysext/cms/layout/class.tx_cms_layout.php (working copy) @@ -128,7 +128,7 @@ var $ext_function=0; // If set to "1", will link a big button to content element wizard. var $doEdit=1; // If true, elements will have edit icons (probably this is whethere the user has permission to edit the page content). Set externally. var $agePrefixes = ' min| hrs| days| yrs'; // Age prefixes for displaying times. May be set externally to localized values. - var $externalTables = array(); // Array of tables which is configured to be listed by the Web > Page module in addition to the default tables. + var $externalTables = array(); // Array of tables to be listed by the Web > Page module in addition to the default tables. var $descrTable; // "Pseudo" Description -table name var $defLangBinding=FALSE; // If set true, the language mode of tt_content elements will be rendered with hard binding between default language content elements and their translations! @@ -183,12 +183,7 @@ t3lib_div::loadTCA($table); if (isset($this->externalTables[$table])) { - $fList = $this->externalTables[$table][0]['fList']; // eg. "name;title;email;company,image" - $icon = $this->externalTables[$table][0]['icon']; // Boolean, - - // Create listing - $out = $this->makeOrdinaryList($table, $id, $fList, $icon); - return $out; + return $this->getExternalTables($id, $table); } else { // Branch out based on table name: // Notice: Most of these tables belongs to other extensions than 'cms'. Each of these tables can be rendered only if the extensions they belong to is loaded. @@ -230,7 +225,34 @@ } } + /** + * Renders an external table from page id + * + * @param integer Page id + * @param string name of the table + * @return string HTML for the listing + */ + function getExternalTables($id, $table) { + + $type = $GLOBALS['SOBE']->MOD_SETTINGS[$table]; + if (!isset($type)) { + $type = 0; + } + + $fList = $this->externalTables[$table][$type]['fList']; // eg. "name;title;email;company,image" + // The columns are separeted by comma ','. + // Values separated by semicolon ';' are shown in the same column. + $icon = $this->externalTables[$table][$type]['icon']; + $addWhere = $this->externalTables[$table][$type]['addWhere']; + + // Create listing + $out = $this->makeOrdinaryList($table, $id, $fList, $icon, $addWhere); + return $out; + } + + + /** * Renders records from the pages table from page id * (Used to get information about the page tree content by "Web>Info"!) * Index: typo3/sysext/cms/layout/db_layout.php =================================================================== --- typo3/sysext/cms/layout/db_layout.php (revision 6849) +++ typo3/sysext/cms/layout/db_layout.php (working copy) @@ -214,6 +214,7 @@ var $MOD_MENU=array(); // Menu configuration var $MOD_SETTINGS=array(); // Module settings (session variable) var $include_once=array(); // Array, where files to include is accumulated in the init() function + var $externalTables = array(); // Array of tables to be listed by the Web > Page module in addition to the default tables // Internal, dynamic: var $content; // Module output accumulation @@ -250,6 +251,7 @@ $this->search_levels = t3lib_div::_GP('search_levels'); $this->showLimit = t3lib_div::_GP('showLimit'); $this->returnUrl = t3lib_div::_GP('returnUrl'); + $this->externalTables = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables']; // Load page info array: $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause); @@ -317,8 +319,8 @@ 'showDescriptions' => '', 'disableRTE' => '', 'function' => array( + 0 => $LANG->getLL('m_function_0'), 1 => $LANG->getLL('m_function_1'), - 0 => $LANG->getLL('m_function_0'), 2 => $LANG->getLL('m_function_2'), 3 => $LANG->getLL('pageInformation') ), @@ -327,6 +329,26 @@ ) ); + // example settings: + // $TYPO3_CONF_VARS['EXTCONF']['cms']['db_layout']['addTables']['tx_myext'] = + // array ('default' => array( + // 'MENU' => 'LLL:EXT:tx_myext/locallang_db.xml:menuDefault', + // 'fList' => 'title,description,image', + // 'icon' => TRUE), + if (is_array($this->externalTables)) { + foreach ($this->externalTables as $table => $tableSettings) { + // delete the default settings from above + if (is_array($this->MOD_MENU[$table])) { + unset ($this->MOD_MENU[$table]); + } + if (is_array($tableSettings)) { + foreach ($tableSettings as $key => $settings) { + $this->MOD_MENU[$table][$key] = $LANG->sL($settings['MENU']); + } + } + } + } + // First, select all pages_language_overlay records on the current page. Each represents a possibility for a language on the page. Add these to language selector. $res = $this->exec_languageQuery($this->id); while($lrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { @@ -950,9 +972,8 @@ $dblist->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0; if (!$dblist->nextThree) $dblist->nextThree = 1; - $dblist->externalTables = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables']; + $dblist->externalTables = $this->externalTables; - // Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!) $h_menu = $dblist->getTableMenu($this->id); @@ -1032,8 +1053,12 @@ break; } } else { + if (isset($this->MOD_SETTINGS) && isset($this->MOD_MENU)) { + $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET['.$table.']',$this->MOD_SETTINGS[$table],$this->MOD_MENU[$table],'db_layout.php',''); + } else { $h_func = ''; } + } // Start the dblist object: $dblist->itemsLimitSingleTable = 1000;