* Added API for configuring extra tables/fields for listing in Web > Page
authorKasper Skårhøj <kasper@typo3.org>
Fri, 23 Apr 2004 14:59:49 +0000 (14:59 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Fri, 23 Apr 2004 14:59:49 +0000 (14:59 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@224 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/stylesheet.css
typo3/sysext/cms/layout/class.tx_cms_layout.php
typo3/sysext/cms/layout/db_layout.php
typo3/sysext/cms/tslib/class.tslib_pagegen.php

index 4bc6156..45da238 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2004-04-23  Kasper Skårhøj,,,  <kasper@typo3.com>
 
+       * Added API for configuring extra tables/fields for listing in Web > Page
+
+2004-04-23  Kasper Skårhøj,,,  <kasper@typo3.com>
+
        * Added option "mod.web_list.clickTitleMode = edit/info/show" to determine alternative behaviours of title links in the Web > List module.
 
 2004-04-23  Kasper Skårhøj,,,  <kasper@typo3.com>
index a44de0f..45bd726 100755 (executable)
@@ -311,6 +311,7 @@ TABLE.typo3-page-columnsMode IMG.c-divider { margin: 10px 0px 5px 0px;}
 TABLE.typo3-page-columnsMode TR TD A { text-decoration: none; }
 TABLE.typo3-page-columnsMode TR TD A B { text-decoration: underline; }
 TABLE.typo3-page-cols TR TD SPAN.exampleContent A { text-decoration: none;}
+TABLE#typo3-page-stdlist TR TD.c-headLine { background-color: #ABBBB4; }
 
 /* Web > List */
 TABLE.typo3-dblist IMG { vertical-align: middle; }
index 0d9ecb9..946cc7e 100755 (executable)
@@ -124,6 +124,7 @@ class tx_cms_layout extends recordList {
        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.
 
                // External, static: Configuration of tt_content element display:
        var $tt_contentConfig = Array (
@@ -175,42 +176,51 @@ class tx_cms_layout extends recordList {
                        // Load full table definition:
                t3lib_div::loadTCA($table);
 
-                       // 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.
-               switch($table)  {
-                       case 'pages':
-                               return $this->getTable_pages($id);
-                       break;
-                       case 'tt_content':
-                               return $this->getTable_tt_content($id);
-                       break;
-                       case 'fe_users':
-                               return $this->getTable_fe_users($id);
-                       break;
-                       case 'sys_note':
-                               return $this->getTable_sys_note($id);
-                       break;
-                       case 'tt_board':
-                               return $this->getTable_tt_board($id);
-                       break;
-                       case 'tt_address':
-                               return $this->getTable_tt_address($id);
-                       break;
-                       case 'tt_links':
-                               return $this->getTable_tt_links($id);
-                       break;
-                       case 'tt_guest':
-                               return $this->getTable_tt_guest($id);
-                       break;
-                       case 'tt_news':
-                               return $this->getTable_tt_news($id);
-                       break;
-                       case 'tt_calender':
-                               return $this->getTable_tt_calender($id);
-                       break;
-                       case 'tt_products':
-                               return $this->getTable_tt_products($id);
-                       break;
+               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;
+               } 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.
+                       switch($table)  {
+                               case 'pages':
+                                       return $this->getTable_pages($id);
+                               break;
+                               case 'tt_content':
+                                       return $this->getTable_tt_content($id);
+                               break;
+                               case 'fe_users':
+                                       return $this->getTable_fe_users($id);
+                               break;
+                               case 'sys_note':
+                                       return $this->getTable_sys_note($id);
+                               break;
+                               case 'tt_board':
+                                       return $this->getTable_tt_board($id);
+                               break;
+                               case 'tt_address':
+                                       return $this->getTable_tt_address($id);
+                               break;
+                               case 'tt_links':
+                                       return $this->getTable_tt_links($id);
+                               break;
+                               case 'tt_guest':
+                                       return $this->getTable_tt_guest($id);
+                               break;
+                               case 'tt_news':
+                                       return $this->getTable_tt_news($id);
+                               break;
+                               case 'tt_calender':
+                                       return $this->getTable_tt_calender($id);
+                               break;
+                               case 'tt_products':
+                                       return $this->getTable_tt_products($id);
+                               break;
+                       }
                }
        }
 
@@ -2334,13 +2344,18 @@ class tx_cms_layout extends recordList {
 
                        // Initialize:
                $this->activeTables=array();
-               $theTables=explode(',','tt_content,fe_users,tt_address,tt_links,tt_board,tt_guest,tt_calender,tt_products,tt_news');            // NOTICE: This serves double function: Both being tables names (all) and for most others also being extension keys for the extensions they are related to!
+               $theTables = explode(',','tt_content,fe_users,tt_address,tt_links,tt_board,tt_guest,tt_calender,tt_products,tt_news');          // NOTICE: This serves double function: Both being tables names (all) and for most others also being extension keys for the extensions they are related to!
+
+                       // External tables:
+               if (is_array($this->externalTables))    {
+                       $theTables = array_unique(array_merge($theTables, array_keys($this->externalTables)));
+               }
 
                        // Traverse tables to check:
                foreach($theTables as $tName)   {
 
                                // Check access and whether the proper extensions are loaded:
-                       if ($GLOBALS['BE_USER']->check('tables_select',$tName) && (t3lib_extMgm::isLoaded($tName)||t3lib_div::inList('fe_users,tt_content',$tName)))    {
+                       if ($GLOBALS['BE_USER']->check('tables_select',$tName) && (t3lib_extMgm::isLoaded($tName)||t3lib_div::inList('fe_users,tt_content',$tName) || isset($this->externalTables[$tName])))    {
 
                                        // Make query to count records from page:
                                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $tName, 'pid='.intval($id).t3lib_BEfunc::deleteClause($tName));
index 3525b44..5612b99 100755 (executable)
@@ -871,9 +871,11 @@ class SC_db_layout {
                $dblist->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1;
                if (!$dblist->nextThree)        $dblist->nextThree = 1;
 
+               $dblist->externalTables = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables'];
+
 
                        // 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);
+               $h_menu = $dblist->getTableMenu($this->id);
 
                        // Initialize other variables:
                $h_func='';
@@ -889,66 +891,70 @@ class SC_db_layout {
                                // Load full table definitions:
                        t3lib_div::loadTCA($table);
 
-                               // Creating special conditions for each table:
-                       switch($table)  {
-                               case 'tt_board':
-                                       $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_board]',$this->MOD_SETTINGS['tt_board'],$this->MOD_MENU['tt_board'],'db_layout.php','');
-                               break;
-                               case 'tt_address':
-                                       $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_address]',$this->MOD_SETTINGS['tt_address'],$this->MOD_MENU['tt_address'],'db_layout.php','');
-                               break;
-                               case 'tt_links':
-                                       $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_links]',$this->MOD_SETTINGS['tt_links'],$this->MOD_MENU['tt_links'],'db_layout.php','');
-                               break;
-                               case 'tt_calender':
-                                       $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_calender]',$this->MOD_SETTINGS['tt_calender'],$this->MOD_MENU['tt_calender'],'db_layout.php','');
-                               break;
-                               case 'tt_products':
-                                       $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_products]',$this->MOD_SETTINGS['tt_products'],$this->MOD_MENU['tt_products'],'db_layout.php','');
-                               break;
-                               case 'tt_guest':
-                               case 'tt_news':
-                               case 'fe_users':
-                                       // Nothing
-                               break;
-                               case 'tt_content':
-                                       $q_count = $this->getNumberOfHiddenElements();
-                                       $h_func_b= t3lib_BEfunc::getFuncCheck($this->id,'SET[tt_content_showHidden]',$this->MOD_SETTINGS['tt_content_showHidden'],'db_layout.php','').(!$q_count?$GLOBALS['TBE_TEMPLATE']->dfw($LANG->getLL('hiddenCE')):$LANG->getLL('hiddenCE').' ('.$q_count.')');
-
-                                       $dblist->tt_contentConfig['showCommands'] = 1;  // Boolean: Display up/down arrows and edit icons for tt_content records
-                                       $dblist->tt_contentConfig['showInfo'] = 1;              // Boolean: Display info-marks or not
-                                       $dblist->tt_contentConfig['single'] =0;                 // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown in the total width of the page
-
-                                               // Setting up the tt_content columns to show:
-                                       if (is_array($TCA['tt_content']['columns']['colPos']['config']['items']))       {
-                                               $colList=array();
-                                               foreach($TCA['tt_content']['columns']['colPos']['config']['items'] as $temp)    {
-                                                       $colList[]=$temp[1];
+                       if (!isset($dblist->externalTables[$table]))    {
+                                       // Creating special conditions for each table:
+                               switch($table)  {
+                                       case 'tt_board':
+                                               $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_board]',$this->MOD_SETTINGS['tt_board'],$this->MOD_MENU['tt_board'],'db_layout.php','');
+                                       break;
+                                       case 'tt_address':
+                                               $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_address]',$this->MOD_SETTINGS['tt_address'],$this->MOD_MENU['tt_address'],'db_layout.php','');
+                                       break;
+                                       case 'tt_links':
+                                               $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_links]',$this->MOD_SETTINGS['tt_links'],$this->MOD_MENU['tt_links'],'db_layout.php','');
+                                       break;
+                                       case 'tt_calender':
+                                               $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_calender]',$this->MOD_SETTINGS['tt_calender'],$this->MOD_MENU['tt_calender'],'db_layout.php','');
+                                       break;
+                                       case 'tt_products':
+                                               $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_products]',$this->MOD_SETTINGS['tt_products'],$this->MOD_MENU['tt_products'],'db_layout.php','');
+                                       break;
+                                       case 'tt_guest':
+                                       case 'tt_news':
+                                       case 'fe_users':
+                                               // Nothing
+                                       break;
+                                       case 'tt_content':
+                                               $q_count = $this->getNumberOfHiddenElements();
+                                               $h_func_b= t3lib_BEfunc::getFuncCheck($this->id,'SET[tt_content_showHidden]',$this->MOD_SETTINGS['tt_content_showHidden'],'db_layout.php','').(!$q_count?$GLOBALS['TBE_TEMPLATE']->dfw($LANG->getLL('hiddenCE')):$LANG->getLL('hiddenCE').' ('.$q_count.')');
+
+                                               $dblist->tt_contentConfig['showCommands'] = 1;  // Boolean: Display up/down arrows and edit icons for tt_content records
+                                               $dblist->tt_contentConfig['showInfo'] = 1;              // Boolean: Display info-marks or not
+                                               $dblist->tt_contentConfig['single'] = 0;                // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown in the total width of the page
+
+                                                       // Setting up the tt_content columns to show:
+                                               if (is_array($TCA['tt_content']['columns']['colPos']['config']['items']))       {
+                                                       $colList = array();
+                                                       foreach($TCA['tt_content']['columns']['colPos']['config']['items'] as $temp)    {
+                                                               $colList[] = $temp[1];
+                                                       }
+                                               } else {        // ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
+                                                       $colList = array('1','0','2','3');
+                                               }
+                                               if (strcmp($this->colPosList,''))       {
+                                                       $colList = array_intersect(t3lib_div::intExplode(',',$this->colPosList),$colList);
                                                }
-                                       } else {        // ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
-                                               $colList=array('1','0','2','3');
-                                       }
-                                       if (strcmp($this->colPosList,''))       {
-                                               $colList=array_intersect(t3lib_div::intExplode(',',$this->colPosList),$colList);
-                                       }
 
-                                               // If only one column found, display the single-column view.
-                                       if (count($colList)==1) {
-                                               $dblist->tt_contentConfig['single'] =1; // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown in the total width of the page
-                                               $dblist->tt_contentConfig['showSingleCol']=current($colList);   // The column(s) to show if single mode (under each other)
-                                       }
-                                       $dblist->tt_contentConfig['cols'] = implode(',',$colList);              // The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
-                                       $dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
-                                       $dblist->tt_contentConfig['sys_language_uid'] = intval($this->current_sys_language);
-
-                                               // If the function menu is set to "Language":
-                                       if ($this->MOD_SETTINGS['function']==2) {
-                                               $dblist->tt_contentConfig['single'] = 0;
-                                               $dblist->tt_contentConfig['languageMode'] = 1;
-                                               $dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
-                                               $dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
-                                       }
-                               break;
+                                                       // If only one column found, display the single-column view.
+                                               if (count($colList)==1) {
+                                                       $dblist->tt_contentConfig['single'] = 1;        // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown in the total width of the page
+                                                       $dblist->tt_contentConfig['showSingleCol'] = current($colList); // The column(s) to show if single mode (under each other)
+                                               }
+                                               $dblist->tt_contentConfig['cols'] = implode(',',$colList);              // The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
+                                               $dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
+                                               $dblist->tt_contentConfig['sys_language_uid'] = intval($this->current_sys_language);
+
+                                                       // If the function menu is set to "Language":
+                                               if ($this->MOD_SETTINGS['function']==2) {
+                                                       $dblist->tt_contentConfig['single'] = 0;
+                                                       $dblist->tt_contentConfig['languageMode'] = 1;
+                                                       $dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
+                                                       $dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
+                                               }
+                                       break;
+                               }
+                       } else {
+                               $h_func = '';
                        }
 
                                // Start the dblist object:
index 7f809f8..b3fc9c6 100755 (executable)
@@ -293,7 +293,7 @@ function linkTo_UnCryptMailto(s)    {       //
 
                        // if 'disableAllHeaderCode' is set, all the header-code is discarded!
                if ($GLOBALS['TSFE']->config['config']['disableAllHeaderCode']) {
-                       $GLOBALS['TSFE']->content=$pageContent;
+                       $GLOBALS['TSFE']->content = $pageContent;
                } else {
                        TSpagegen::renderContentWithHeader($pageContent);
                }