db_layout.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Module: Web>Page
00029  *
00030  * This module lets you view a page in a more Content Management like style than the ordinary record-list
00031  *
00032  * $Id: db_layout.php 4433 2008-11-07 04:13:12Z flyguide $
00033  * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
00034  * XHTML compliant
00035  *
00036  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00037  */
00038 /**
00039  * [CLASS/FUNCTION INDEX of SCRIPT]
00040  *
00041  *
00042  *
00043  *  106: class ext_posMap extends t3lib_positionMap
00044  *  117:     function wrapRecordTitle($str,$row)
00045  *  130:     function wrapColumnHeader($str,$vv)
00046  *  144:     function onClickInsertRecord($row,$vv,$moveUid,$pid)
00047  *  160:     function wrapRecordHeader($str,$row)
00048  *
00049  *
00050  *  181: class SC_db_layout
00051  *  230:     function init()
00052  *  283:     function menuConfig()
00053  *  372:     function clearCache()
00054  *  387:     function main()
00055  *  489:     function renderQuickEdit()
00056  *  886:     function renderListContent()
00057  * 1165:     function printContent()
00058  *
00059  *              SECTION: Other functions
00060  * 1192:     function getNumberOfHiddenElements()
00061  * 1205:     function local_linkThisScript($params)
00062  * 1217:     function exec_languageQuery($id)
00063  *
00064  * TOTAL FUNCTIONS: 14
00065  * (This index is automatically created/updated by the extension "extdeveval")
00066  *
00067  */
00068 
00069 
00070 unset($MCONF);
00071 require('conf.php');
00072 require($BACK_PATH.'init.php');
00073 require($BACK_PATH.'template.php');
00074 $LANG->includeLLFile('EXT:cms/layout/locallang.xml');
00075 require_once(PATH_t3lib.'class.t3lib_pagetree.php');
00076 require_once(PATH_t3lib.'class.t3lib_page.php');
00077 require_once(PATH_t3lib.'class.t3lib_recordlist.php');
00078 require_once(PATH_t3lib.'class.t3lib_parsehtml.php');
00079 require_once(PATH_typo3.'class.db_list.inc');
00080 require_once('class.tx_cms_layout.php');
00081 require_once(PATH_t3lib.'class.t3lib_positionmap.php');
00082 $BE_USER->modAccess($MCONF,1);
00083 
00084 // Will open up records locked by current user. It's assumed that the locking should end if this script is hit.
00085 t3lib_BEfunc::lockRecords();
00086 
00087 // Exits if 'cms' extension is not loaded:
00088 t3lib_extMgm::isLoaded('cms',1);
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 /**
00101  * Local extension of position map class
00102  *
00103  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00104  * @package TYPO3
00105  * @subpackage core
00106  */
00107 class ext_posMap extends t3lib_positionMap {
00108     var $dontPrintPageInsertIcons = 1;
00109     var $l_insertNewRecordHere='newContentElement';
00110 
00111     /**
00112      * Wrapping the title of the record.
00113      *
00114      * @param   string      The title value.
00115      * @param   array       The record row.
00116      * @return  string      Wrapped title string.
00117      */
00118     function wrapRecordTitle($str,$row) {
00119         $aOnClick = 'jumpToUrl(\''.$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:'.$row['uid'])).'\');return false;';
00120         return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>';
00121     }
00122 
00123     /**
00124      * Wrapping the column header
00125      *
00126      * @param   string      Header value
00127      * @param   string      Column info.
00128      * @return  string
00129      * @see printRecordMap()
00130      */
00131     function wrapColumnHeader($str,$vv) {
00132         $aOnClick = 'jumpToUrl(\''.$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'_EDIT_COL:'.$vv)).'\');return false;';
00133         return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>';
00134     }
00135 
00136     /**
00137      * Create on-click event value.
00138      *
00139      * @param   array       The record.
00140      * @param   string      Column position value.
00141      * @param   integer     Move uid
00142      * @param   integer     PID value.
00143      * @return  string
00144      */
00145     function onClickInsertRecord($row,$vv,$moveUid,$pid) {
00146         if (is_array($row)) {
00147             $location=$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:new/-'.$row['uid'].'/'.$row['colPos']));
00148         } else {
00149             $location=$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:new/'.$pid.'/'.$vv));
00150         }
00151         return 'jumpToUrl(\''.$location.'\');return false;';
00152     }
00153 
00154     /**
00155      * Wrapping the record header  (from getRecordHeader())
00156      *
00157      * @param   string      HTML content
00158      * @param   array       Record array.
00159      * @return  string      HTML content
00160      */
00161     function wrapRecordHeader($str,$row)    {
00162         if ($row['uid']==$this->moveUid)    {
00163             return '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/content_client.gif','width="7" height="10"').' alt="" />'.$str;
00164         } else return $str;
00165     }
00166 }
00167 
00168 
00169 
00170 
00171 
00172 
00173 
00174 
00175 /**
00176  * Script Class for Web > Layout module
00177  *
00178  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00179  * @package TYPO3
00180  * @subpackage core
00181  */
00182 class SC_db_layout {
00183 
00184         // Internal, GPvars:
00185     var $id;                    // Page Id for which to make the listing
00186     var $pointer;               // Pointer - for browsing list of records.
00187     var $imagemode;             // Thumbnails or not
00188 
00189     var $search_field;          // Search-fields
00190     var $search_levels;         // Search-levels
00191     var $showLimit;             // Show-limit
00192     var $returnUrl;             // Return URL
00193 
00194     var $clear_cache;           // Clear-cache flag - if set, clears page cache for current id.
00195     var $popView;               // PopView id - for opening a window with the page
00196     var $edit_record;           // QuickEdit: Variable, that tells quick edit what to show/edit etc. Format is [tablename]:[uid] with some exceptional values for both parameters (with special meanings).
00197     var $new_unique_uid;        // QuickEdit: If set, this variable tells quick edit that the last edited record had this value as UID and we should look up the new, real uid value in sys_log.
00198 
00199         // Internal, static:
00200     var $perms_clause;          // Page select perms clause
00201     var $modTSconfig;           // Module TSconfig
00202     var $pageinfo;              // Current ids page record
00203 
00204     /**
00205      * Document template object
00206      *
00207      * @var mediumDoc
00208      */
00209     var $doc;
00210     var $backPath;              // Back path of the module
00211 
00212     var $descrTable;            // "Pseudo" Description -table name
00213     var $colPosList;            // List of column-integers to edit. Is set from TSconfig, default is "1,0,2,3"
00214     var $EDIT_CONTENT;          // Flag: If content can be edited or not.
00215     var $CALC_PERMS;            // Users permissions integer for this page.
00216     var $current_sys_language;  // Currently selected language for editing content elements
00217 
00218     var $MCONF=array();         // Module configuration
00219     var $MOD_MENU=array();      // Menu configuration
00220     var $MOD_SETTINGS=array();  // Module settings (session variable)
00221     var $include_once=array();  // Array, where files to include is accumulated in the init() function
00222 
00223         // Internal, dynamic:
00224     var $content;               // Module output accumulation
00225     var $topFuncMenu;           // Function menu temporary storage
00226     var $editIcon;              // Temporary storage for page edit icon
00227 
00228 
00229 
00230 
00231 
00232     /**
00233      * Initializing the module
00234      *
00235      * @return  void
00236      */
00237     function init() {
00238         global $BE_USER;
00239 
00240             // Setting module configuration / page select clause
00241         $this->MCONF = $GLOBALS['MCONF'];
00242         $this->perms_clause = $BE_USER->getPagePermsClause(1);
00243         $this->backPath = $GLOBALS['BACK_PATH'];
00244 
00245             // GPvars:
00246         $this->id = intval(t3lib_div::_GP('id'));
00247         $this->pointer = t3lib_div::_GP('pointer');
00248         $this->imagemode = t3lib_div::_GP('imagemode');
00249 
00250         $this->clear_cache = t3lib_div::_GP('clear_cache');
00251         $this->popView = t3lib_div::_GP('popView');
00252         $this->edit_record = t3lib_div::_GP('edit_record');
00253         $this->new_unique_uid = t3lib_div::_GP('new_unique_uid');
00254         $this->search_field = t3lib_div::_GP('search_field');
00255         $this->search_levels = t3lib_div::_GP('search_levels');
00256         $this->showLimit = t3lib_div::_GP('showLimit');
00257         $this->returnUrl = t3lib_div::_GP('returnUrl');
00258 
00259             // Load page info array:
00260         $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
00261 
00262             // Initialize menu
00263         $this->menuConfig();
00264 
00265             // Setting sys language from session var:
00266         $this->current_sys_language=intval($this->MOD_SETTINGS['language']);
00267 
00268             // Include scripts: QuickEdit
00269         if ($this->MOD_SETTINGS['function']==0) {
00270             $this->include_once[]=PATH_t3lib.'class.t3lib_tceforms.php';
00271             $this->include_once[]=PATH_t3lib.'class.t3lib_clipboard.php';
00272             $this->include_once[]=PATH_t3lib.'class.t3lib_loaddbgroup.php';
00273             $this->include_once[]=PATH_t3lib.'class.t3lib_transferdata.php';
00274         }
00275 
00276             // Include scripts: Clear-cache cmd.
00277         if ($this->clear_cache) {
00278             $this->include_once[]=PATH_t3lib.'class.t3lib_tcemain.php';
00279         }
00280 
00281             // CSH / Descriptions:
00282         $this->descrTable = '_MOD_'.$this->MCONF['name'];
00283     }
00284 
00285     /**
00286      * Initialize menu array
00287      *
00288      * @return  void
00289      */
00290     function menuConfig()   {
00291         global $BE_USER,$LANG,$TYPO3_CONF_VARS;
00292 
00293             // MENU-ITEMS:
00294         $this->MOD_MENU = array(
00295             'tt_board' => array(
00296                 0 => $LANG->getLL('m_tt_board_0'),
00297                 'expand' => $LANG->getLL('m_tt_board_expand')
00298             ),
00299             'tt_address' => array(
00300                 0 => $LANG->getLL('m_tt_address_0'),
00301                 1 => $LANG->getLL('m_tt_address_1'),
00302                 2 => $LANG->getLL('m_tt_address_2')
00303             ),
00304             'tt_links' => array(
00305                 0 => $LANG->getLL('m_default'),
00306                 1 => $LANG->getLL('m_tt_links_1'),
00307                 2 => $LANG->getLL('m_tt_links_2')
00308             ),
00309             'tt_calender' => array (
00310                 0 => $LANG->getLL('m_default'),
00311                 'date' => $LANG->getLL('m_tt_calender_date'),
00312                 'date_ext' => $LANG->getLL('m_tt_calender_date_ext'),
00313                 'todo' => $LANG->getLL('m_tt_calender_todo'),
00314                 'todo_ext' => $LANG->getLL('m_tt_calender_todo_ext')
00315             ),
00316             'tt_products' => array (
00317                 0 => $LANG->getLL('m_default'),
00318                 'ext' => $LANG->getLL('m_tt_products_ext')
00319             ),
00320             'tt_content_showHidden' => '',
00321             'showPalettes' => '',
00322             'showDescriptions' => '',
00323             'disableRTE' => '',
00324             'function' => array(
00325                 1 => $LANG->getLL('m_function_1'),
00326                 0 => $LANG->getLL('m_function_0'),
00327                 2 => $LANG->getLL('m_function_2'),
00328                 3 => $LANG->getLL('pageInformation')
00329             ),
00330             'language' => array(
00331                 0 => $LANG->getLL('m_default')
00332             )
00333         );
00334 
00335              // 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.
00336         $res = $this->exec_languageQuery($this->id);
00337         while($lrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
00338             if ($GLOBALS['BE_USER']->checkLanguageAccess($lrow['uid'])) {
00339                 $this->MOD_MENU['language'][$lrow['uid']]=($lrow['hidden']?'('.$lrow['title'].')':$lrow['title']);
00340             }
00341         }
00342 
00343             // Find if there are ANY languages at all (and if not, remove the language option from function menu).
00344         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'sys_language', ($BE_USER->isAdmin()?'':'hidden=0'));
00345         if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res))  {
00346             unset($this->MOD_MENU['function']['2']);
00347         }
00348 
00349             // page/be_user TSconfig settings and blinding of menu-items
00350         $this->modSharedTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED');
00351         $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']);
00352         if ($this->modTSconfig['properties']['QEisDefault'])    ksort($this->MOD_MENU['function']);
00353         $this->MOD_MENU['function'] = t3lib_BEfunc::unsetMenuItems($this->modTSconfig['properties'],$this->MOD_MENU['function'],'menu.function');
00354 
00355             // Remove QuickEdit as option if page type is not...
00356         if (!t3lib_div::inList($TYPO3_CONF_VARS['FE']['content_doktypes'].',6',$this->pageinfo['doktype'])) {
00357             unset($this->MOD_MENU['function'][0]);
00358         }
00359 
00360             // Setting alternative default label:
00361         if (($this->modSharedTSconfig['properties']['defaultLanguageLabel'] || $this->modTSconfig['properties']['defaultLanguageLabel']) && isset($this->MOD_MENU['language'][0]))  {
00362             $this->MOD_MENU['language'][0] = $this->modTSconfig['properties']['defaultLanguageLabel'] ? $this->modSharedTSconfig['properties']['defaultLanguageLabel'] : $this->modSharedTSconfig['properties']['defaultLanguageLabel'];
00363         }
00364 
00365             // Clean up settings
00366         $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
00367 
00368             // For all elements to be shown in draft workspaces:
00369         if ($GLOBALS['BE_USER']->workspace!=0)  {
00370             $this->MOD_SETTINGS['tt_content_showHidden'] = 1;
00371         }
00372     }
00373 
00374     /**
00375      * Clears page cache for the current id, $this->id
00376      *
00377      * @return  void
00378      */
00379     function clearCache()   {
00380         if ($this->clear_cache) {
00381             $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00382             $tce->stripslashes_values=0;
00383             $tce->start(Array(),Array());
00384             $tce->clear_cacheCmd($this->id);
00385         }
00386     }
00387 
00388     /**
00389      * Main function.
00390      * Creates some general objects and calls other functions for the main rendering of module content.
00391      *
00392      * @return  void
00393      */
00394     function main() {
00395         global $BE_USER,$LANG,$BACK_PATH;
00396 
00397         // Access check...
00398         // The page will show only if there is a valid page and if this page may be viewed by the user
00399         $access = is_array($this->pageinfo) ? 1 : 0;
00400         if ($this->id && $access)   {
00401 
00402                 // Initialize permission settings:
00403             $this->CALC_PERMS = $BE_USER->calcPerms($this->pageinfo);
00404             $this->EDIT_CONTENT = ($this->CALC_PERMS&16) ? 1 : 0;
00405 
00406                 // Start document template object:
00407             $this->doc = t3lib_div::makeInstance('template');
00408             $this->doc->backPath = $BACK_PATH;
00409             $this->doc->setModuleTemplate('templates/db_layout.html');
00410 
00411                 // JavaScript:
00412             $this->doc->JScode = '<script type="text/javascript" src="'.$BACK_PATH.'../t3lib/jsfunc.updateform.js"></script>';
00413             $this->doc->JScode.= $this->doc->wrapScriptTags('
00414                 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';
00415                 if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages'.intval($this->id).'_"+top.fsMod.currentBank; '.intval($this->id).';
00416                 function jumpToUrl(URL,formEl)  {   //
00417                     if (document.editform && TBE_EDITOR.isFormChanged)  {   // Check if the function exists... (works in all browsers?)
00418                         if (!TBE_EDITOR.isFormChanged())    {   //
00419                             window.location.href = URL;
00420                         } else if (formEl) {
00421                             if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
00422                         }
00423                     } else window.location.href = URL;
00424                 }
00425             '.($this->popView ? t3lib_BEfunc::viewOnClick($this->id,$BACK_PATH,t3lib_BEfunc::BEgetRootLine($this->id)) : '').'
00426 
00427                 function deleteRecord(table,id,url) {   //
00428                     if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).'))  {
00429                         window.location.href = "'.$BACK_PATH.'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC='.$BE_USER->veriCode().'&prErr=1&uPT=1";
00430                     }
00431                     return false;
00432                 }
00433             ');
00434             $this->doc->JScode.= $this->doc->wrapScriptTags('
00435                 var DTM_array = new Array();
00436                 var DTM_origClass = new String();
00437 
00438                     // if tabs are used in a popup window the array might not exists
00439                 if(!top.DTM_currentTabs) {
00440                     top.DTM_currentTabs = new Array();
00441                 }
00442 
00443                 function DTM_activate(idBase,index,doToogle)    {   //
00444                         // Hiding all:
00445                     if (DTM_array[idBase])  {
00446                         for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++)    {
00447                             if (DTM_array[idBase][cnt] != idBase+"-"+index) {
00448                                 document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none";
00449                                 document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
00450                             }
00451                         }
00452                     }
00453 
00454                         // Showing one:
00455                     if (document.getElementById(idBase+"-"+index+"-DIV"))   {
00456                         if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block")  {
00457                             document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
00458                             if(DTM_origClass=="") {
00459                                 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
00460                             } else {
00461                                 DTM_origClass = "tab";
00462                             }
00463                             top.DTM_currentTabs[idBase] = -1;
00464                         } else {
00465                             document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
00466                             if(DTM_origClass=="") {
00467                                 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
00468                             } else {
00469                                 DTM_origClass = "tabact";
00470                             }
00471                             top.DTM_currentTabs[idBase] = index;
00472                         }
00473                     }
00474                 }
00475                 function DTM_toggle(idBase,index,isInit)    {   //
00476                         // Showing one:
00477                     if (document.getElementById(idBase+"-"+index+"-DIV"))   {
00478                         if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block")  {
00479                             document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
00480                             if(isInit) {
00481                                 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
00482                             } else {
00483                                 DTM_origClass = "tab";
00484                             }
00485                             top.DTM_currentTabs[idBase+"-"+index] = 0;
00486                         } else {
00487                             document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
00488                             if(isInit) {
00489                                 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
00490                             } else {
00491                                 DTM_origClass = "tabact";
00492                             }
00493                             top.DTM_currentTabs[idBase+"-"+index] = 1;
00494                         }
00495                     }
00496                 }
00497 
00498                 function DTM_mouseOver(obj) {   //
00499                         DTM_origClass = obj.attributes.getNamedItem(\'class\').nodeValue;
00500                         obj.attributes.getNamedItem(\'class\').nodeValue += "_over";
00501                 }
00502 
00503                 function DTM_mouseOut(obj) {    //
00504                         obj.attributes.getNamedItem(\'class\').nodeValue = DTM_origClass;
00505                         DTM_origClass = "";
00506                 }
00507             ');
00508 
00509                 // Setting doc-header
00510             $this->doc->form='<form action="'.htmlspecialchars('db_layout.php?id='.$this->id.'&imagemode='.$this->imagemode).'" method="post">';
00511 
00512                 // Creating the top function menu:
00513             $this->topFuncMenu = t3lib_BEfunc::getFuncMenu($this->id,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function'],'db_layout.php','');
00514             $this->languageMenu = (count($this->MOD_MENU['language'])>1 ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.language',1) . t3lib_BEfunc::getFuncMenu($this->id,'SET[language]',$this->current_sys_language,$this->MOD_MENU['language'],'db_layout.php','') : '');
00515 
00516                 // Find columns
00517             $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id,'mod.SHARED');     // SHARED page-TSconfig settings.
00518             $this->colPosList = strcmp(trim($this->modTSconfig['properties']['tt_content.']['colPos_list']),'') ? trim($this->modTSconfig['properties']['tt_content.']['colPos_list']) : $modTSconfig_SHARED['properties']['colPos_list'];
00519             $this->colPosList = strcmp($this->colPosList,'')?$this->colPosList:'1,0,2,3';
00520             $this->colPosList = implode(',',array_unique(t3lib_div::intExplode(',',$this->colPosList)));        // Removing duplicates, if any
00521 
00522 
00523                 // Render the primary module content:
00524             if ($this->MOD_SETTINGS['function']==0) {
00525                 $body = $this->renderQuickEdit();   // QuickEdit
00526             } else {
00527                 $body = $this->renderListContent(); // All other listings
00528             }
00529 
00530                 // Setting up the buttons and markers for docheader
00531             $docHeaderButtons = $this->getButtons($this->MOD_SETTINGS['function']==0 ? 'quickEdit' : '');
00532             $markers = array(
00533                 'CSH' => $docHeaderButtons['csh'],
00534                 'TOP_FUNCTION_MENU' => $this->editSelect . $this->topFuncMenu,
00535                 'LANGSELECTOR' => $this->languageMenu,
00536                 'CONTENT' => $body
00537             );
00538 
00539                 // Build the <body> for the module
00540             $this->content = $this->doc->startPage($LANG->getLL('title'));
00541             $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
00542             $this->content.= $this->doc->endPage();
00543             $this->content = $this->doc->insertStylesAndJS($this->content);
00544 
00545         } else {
00546 
00547                 // If no access or id value, create empty document:
00548             $this->doc = t3lib_div::makeInstance('template');
00549             $this->doc->backPath = $BACK_PATH;
00550             $this->doc->setModuleTemplate('templates/db_layout.html');
00551 
00552             $this->doc->JScode = $this->doc->wrapScriptTags('
00553                 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';
00554             ');
00555 
00556             $body = $this->doc->section($LANG->getLL('clickAPage_header'), $LANG->getLL('clickAPage_content'), 0, 1);
00557 
00558                 // Setting up the buttons and markers for docheader
00559             $docHeaderButtons = array(
00560                 'view' => '',
00561                 'history_page' => '',
00562                 'new_content' => '',
00563                 'move_page' => '',
00564                 'move_record' => '',
00565                 'new_page' => '',
00566                 'edit_page' => '',
00567                 'record_list' => '',
00568                 'csh' => '',
00569                 'shortcut' => '',
00570                 'cache' => '',
00571                 'savedok' => '',
00572                 'savedokshow' => '',
00573                 'closedok' => '',
00574                 'deletedok' => '',
00575                 'undo' => '',
00576                 'history_record' => ''
00577             );
00578 
00579             $markers = array(
00580                 'CSH' => t3lib_BEfunc::cshItem($this->descrTable, '', $BACK_PATH, '', TRUE),
00581                 'TOP_FUNCTION_MENU' => '',
00582                 'LANGSELECTOR' => '',
00583                 'CONTENT' => $body
00584             );
00585 
00586             $this->content=$this->doc->startPage($LANG->getLL('title'));
00587             $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
00588             $this->content.=$this->doc->endPage();
00589             $this->content = $this->doc->insertStylesAndJS($this->content);
00590         }
00591     }
00592 
00593     /**
00594      * Rendering the quick-edit view.
00595      *
00596      * @return  void
00597      */
00598     function renderQuickEdit()  {
00599         global $LANG,$BE_USER,$BACK_PATH;
00600             // Alternative template
00601         $this->doc->setModuleTemplate('templates/db_layout_quickedit.html');
00602 
00603             // Alternative form tag; Quick Edit submits its content to tce_db.php.
00604         $this->doc->form='<form action="'.htmlspecialchars($BACK_PATH.'tce_db.php?&prErr=1&uPT=1').'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
00605 
00606             // Setting up the context sensitive menu:
00607         $this->doc->getContextMenuCode();
00608 
00609             // Set the edit_record value for internal use in this function:
00610         $edit_record = $this->edit_record;
00611 
00612             // If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php:
00613         if (substr($edit_record,0,9)=='_EDIT_COL')  {
00614             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00615                         '*',
00616                         'tt_content',
00617                         'pid='.intval($this->id).' AND colPos='.intval(substr($edit_record,10)).' AND sys_language_uid='.intval($this->current_sys_language).
00618                                 ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')).
00619                                 t3lib_BEfunc::deleteClause('tt_content').
00620                                 t3lib_BEfunc::versioningPlaceholderClause('tt_content'),
00621                         '',
00622                         'sorting'
00623                     );
00624             $idListA = array();
00625             while($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
00626                 $idListA[] = $cRow['uid'];
00627             }
00628 
00629             $url = $BACK_PATH.'alt_doc.php?edit[tt_content]['.implode(',',$idListA).']=edit&returnUrl='.rawurlencode($this->local_linkThisScript(array('edit_record'=>'')));
00630             header('Location: '.t3lib_div::locationHeaderUrl($url));
00631             exit;
00632         }
00633 
00634             // If the former record edited was the creation of a NEW record, this will look up the created records uid:
00635         if ($this->new_unique_uid)  {
00636             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', 'userid='.intval($BE_USER->user['uid']).' AND NEWid='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->new_unique_uid, 'sys_log'));
00637             $sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00638             if (is_array($sys_log_row)) {
00639                 $edit_record=$sys_log_row['tablename'].':'.$sys_log_row['recuid'];
00640             }
00641         }
00642 
00643 
00644             // Creating the selector box, allowing the user to select which element to edit:
00645         $opt=array();
00646         $is_selected=0;
00647         $languageOverlayRecord='';
00648         if ($this->current_sys_language)    {
00649             list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$this->id,'AND sys_language_uid='.intval($this->current_sys_language));
00650         }
00651         if (is_array($languageOverlayRecord))   {
00652             $inValue = 'pages_language_overlay:'.$languageOverlayRecord['uid'];
00653             $is_selected+=intval($edit_record==$inValue);
00654             $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('editLanguageHeader',1).' ]</option>';
00655         } else {
00656             $inValue = 'pages:'.$this->id;
00657             $is_selected+=intval($edit_record==$inValue);
00658             $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('editPageProperties',1).' ]</option>';
00659         }
00660 
00661             // Selecting all content elements from this language and allowed colPos:
00662         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00663                     '*',
00664                     'tt_content',
00665                     'pid='.intval($this->id).' AND sys_language_uid='.intval($this->current_sys_language).' AND colPos IN ('.$this->colPosList.')'.
00666                             ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')).
00667                             t3lib_Befunc::deleteClause('tt_content').
00668                             t3lib_BEfunc::versioningPlaceholderClause('tt_content'),
00669                     '',
00670                     'colPos,sorting'
00671                 );
00672         $colPos='';
00673         $first=1;
00674         $prev=$this->id;    // Page is the pid if no record to put this after.
00675         while($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
00676             t3lib_BEfunc::workspaceOL('tt_content', $cRow);
00677 
00678             if (is_array($cRow))    {
00679                 if ($first) {
00680                     if (!$edit_record)  {
00681                         $edit_record='tt_content:'.$cRow['uid'];
00682                     }
00683                     $first = 0;
00684                 }
00685                 if (strcmp($cRow['colPos'],$colPos))    {
00686                     $colPos=$cRow['colPos'];
00687                     $opt[]='<option value=""></option>';
00688                     $opt[]='<option value="_EDIT_COL:'.$colPos.'">__'.$LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','colPos',$colPos),1).':__</option>';
00689                 }
00690                 $inValue = 'tt_content:'.$cRow['uid'];
00691                 $is_selected+=intval($edit_record==$inValue);
00692                 $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($cRow['header']?$cRow['header']:'['.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.no_title').'] '.strip_tags($cRow['bodytext']),$BE_USER->uc['titleLen'])).'</option>';
00693                 $prev=-$cRow['uid'];
00694             }
00695         }
00696 
00697             // If edit_record is not set (meaning, no content elements was found for this language) we simply set it to create a new element:
00698         if (!$edit_record)  {
00699             $edit_record='tt_content:new/'.$prev.'/'.$colPos;
00700 
00701             $inValue = 'tt_content:new/'.$prev.'/'.$colPos;
00702             $is_selected+=intval($edit_record==$inValue);
00703             $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('newLabel',1).' ]</option>';
00704         }
00705 
00706             // If none is yet selected...
00707         if (!$is_selected)  {
00708             $opt[]='<option value=""></option>';
00709             $opt[]='<option value="'.$edit_record.'"  selected="selected">[ '.$LANG->getLL('newLabel',1).' ]</option>';
00710         }
00711 
00712 
00713             // Splitting the edit-record cmd value into table/uid:
00714         $this->eRParts = explode(':',$edit_record);
00715 
00716 
00717 
00718             // Delete-button flag?
00719         $this->deleteButton = (t3lib_div::testInt($this->eRParts[1]) && $edit_record && (($this->eRParts[0]!='pages'&&$this->EDIT_CONTENT) || ($this->eRParts[0]=='pages'&&($this->CALC_PERMS&4))));
00720 
00721             // If undo-button should be rendered (depends on available items in sys_history)
00722         $this->undoButton=0;
00723         $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->eRParts[0], 'sys_history').' AND recuid='.intval($this->eRParts[1]), '', 'tstamp DESC', '1');
00724         if ($this->undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes))   {
00725             $this->undoButton=1;
00726         }
00727 
00728             // Setting up the Return URL for coming back to THIS script (if links take the user to another script)
00729         $R_URL_parts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
00730         $R_URL_getvars = t3lib_div::_GET();
00731 
00732         unset($R_URL_getvars['popView']);
00733         unset($R_URL_getvars['new_unique_uid']);
00734         $R_URL_getvars['edit_record']=$edit_record;
00735         $this->R_URI = $R_URL_parts['path'].'?'.t3lib_div::implodeArrayForUrl('',$R_URL_getvars);
00736 
00737             // Setting close url/return url for exiting this script:
00738         $this->closeUrl = $this->local_linkThisScript(array('SET'=>array('function'=>1)));  // Goes to 'Columns' view if close is pressed (default)
00739 
00740         if ($BE_USER->uc['condensedMode'])  {
00741             $this->closeUrl = $BACK_PATH.'alt_db_navframe.php';
00742         }
00743         if ($this->returnUrl)   {
00744             $this->closeUrl = $this->returnUrl;
00745         }
00746             // Return-url for JavaScript:
00747         $retUrlStr = $this->returnUrl?"+'&returnUrl='+'".rawurlencode($this->returnUrl)."'":'';
00748 
00749             // Drawing the edit record selectbox
00750         $this->editSelect = '<select name="edit_record" onchange="' . htmlspecialchars('jumpToUrl(\'db_layout.php?id=' . $this->id . '&edit_record=\'+escape(this.options[this.selectedIndex].value)' . $retUrlStr . ',this);') . '">' . implode('', $opt) . '</select>';
00751 
00752             // Creating editing form:
00753         if ($BE_USER->check('tables_modify',$this->eRParts[0]) && $edit_record && (($this->eRParts[0]!='pages'&&$this->EDIT_CONTENT) || ($this->eRParts[0]=='pages'&&($this->CALC_PERMS&1))))   {
00754 
00755                 // Splitting uid parts for special features, if new:
00756             list($uidVal,$ex_pid,$ex_colPos) = explode('/',$this->eRParts[1]);
00757 
00758                 // Convert $uidVal to workspace version if any:
00759             if ($uidVal!='new') {
00760                 if ($draftRecord = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->eRParts[0], $uidVal, 'uid'))    {
00761                     $uidVal = $draftRecord['uid'];
00762                 }
00763             }
00764 
00765                 // Initializing transfer-data object:
00766             $trData = t3lib_div::makeInstance('t3lib_transferData');
00767             $trData->addRawData = TRUE;
00768             $trData->defVals[$this->eRParts[0]] = array (
00769                 'colPos' => intval($ex_colPos),
00770                 'sys_language_uid' => intval($this->current_sys_language)
00771             );
00772             $trData->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00773             $trData->lockRecords=1;
00774             $trData->fetchRecord($this->eRParts[0],($uidVal=='new'?$this->id:$uidVal),$uidVal); // 'new'
00775 
00776                 // Getting/Making the record:
00777             reset($trData->regTableItems_data);
00778             $rec = current($trData->regTableItems_data);
00779             if ($uidVal=='new') {
00780                 $new_unique_uid = uniqid('NEW');
00781                 $rec['uid'] = $new_unique_uid;
00782                 $rec['pid'] = intval($ex_pid)?intval($ex_pid):$this->id;
00783                 $recordAccess = TRUE;
00784             } else {
00785                 $rec['uid'] = $uidVal;
00786 
00787                     // Checking internals access:
00788                 $recordAccess = $BE_USER->recordEditAccessInternals($this->eRParts[0],$uidVal);
00789             }
00790 
00791             if (!$recordAccess) {
00792                     // If no edit access, print error message:
00793                 $content.=$this->doc->section($LANG->getLL('noAccess'),$LANG->getLL('noAccess_msg').'<br /><br />'.
00794                             ($BE_USER->errorMsg ? 'Reason: '.$BE_USER->errorMsg.'<br/><br/>' : ''),0,1);
00795             } elseif (is_array($rec))   {   // If the record is an array (which it will always be... :-)
00796 
00797                     // Create instance of TCEforms, setting defaults:
00798                 $tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
00799                 $tceforms->backPath = $BACK_PATH;
00800                 $tceforms->initDefaultBEMode();
00801                 $tceforms->fieldOrder = $this->modTSconfig['properties']['tt_content.']['fieldOrder'];
00802                 $tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
00803                 $tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00804                 $tceforms->enableClickMenu = TRUE;
00805 
00806                     // Clipboard is initialized:
00807                 $tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard');        // Start clipboard
00808                 $tceforms->clipObj->initializeClipboard();  // Initialize - reads the clipboard content from the user session
00809 
00810 
00811                 if ($BE_USER->uc['edit_showFieldHelp']!='text' && $this->MOD_SETTINGS['showDescriptions'])  $tceforms->edit_showFieldHelp='text';
00812 
00813                     // Render form, wrap it:
00814                 $panel='';
00815                 $panel.=$tceforms->getMainFields($this->eRParts[0],$rec);
00816                 $panel=$tceforms->wrapTotal($panel,$rec,$this->eRParts[0]);
00817 
00818                     // Add hidden fields:
00819                 $theCode=$panel;
00820                 if ($uidVal=='new') {
00821                     $theCode.='<input type="hidden" name="data['.$this->eRParts[0].']['.$rec['uid'].'][pid]" value="'.$rec['pid'].'" />';
00822                 }
00823                 $theCode.='
00824                     <input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />
00825                     <input type="hidden" name="_disableRTE" value="'.$tceforms->disableRTE.'" />
00826                     <input type="hidden" name="edit_record" value="'.$edit_record.'" />
00827                     <input type="hidden" name="redirect" value="'.htmlspecialchars($uidVal=='new' ? t3lib_extMgm::extRelPath('cms').'layout/db_layout.php?id='.$this->id.'&new_unique_uid='.$new_unique_uid.'&returnUrl='.rawurlencode($this->returnUrl) : $this->R_URI ).'" />
00828                     ';
00829 
00830                     // Add JavaScript as needed around the form:
00831                 $theCode=$tceforms->printNeededJSFunctions_top().$theCode.$tceforms->printNeededJSFunctions();
00832 
00833                     // Add warning sign if record was "locked":
00834                 if ($lockInfo=t3lib_BEfunc::isRecordLocked($this->eRParts[0],$rec['uid']))  {
00835                     $lockIcon='
00836 
00837                         <!--
00838                             Warning box:
00839                         -->
00840                         <table border="0" cellpadding="0" cellspacing="0" class="warningbox">
00841                             <tr>
00842                                 <td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/recordlock_warning3.gif','width="17" height="12"').' alt="" /></td>
00843                                 <td>'.htmlspecialchars($lockInfo['msg']).'</td>
00844                             </tr>
00845                         </table>
00846                         ';
00847                 } else $lockIcon='';
00848 
00849                     // Add whole form as a document section:
00850                 $content.=$this->doc->section('',$lockIcon.$theCode);
00851             }
00852         } else {
00853                 // If no edit access, print error message:
00854             $content.=$this->doc->section($LANG->getLL('noAccess'),$LANG->getLL('noAccess_msg').'<br /><br />',0,1);
00855         }
00856 
00857 
00858             // Bottom controls (function menus):
00859         $q_count = $this->getNumberOfHiddenElements();
00860         $h_func_b= t3lib_BEfunc::getFuncCheck($this->id,'SET[tt_content_showHidden]',$this->MOD_SETTINGS['tt_content_showHidden'],'db_layout.php','','id="checkTt_content_showHidden"').
00861                     '<label for="checkTt_content_showHidden">'.(!$q_count?$GLOBALS['TBE_TEMPLATE']->dfw($LANG->getLL('hiddenCE',1)):$LANG->getLL('hiddenCE',1).' ('.$q_count.')').'</label>';
00862 
00863         $h_func_b.= '<br />'.
00864                     t3lib_BEfunc::getFuncCheck($this->id,'SET[showPalettes]',$this->MOD_SETTINGS['showPalettes'],'db_layout.php','','id="checkShowPalettes"').
00865                     '<label for="checkShowPalettes">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPalettes',1).'</label>';
00866 
00867         if (t3lib_extMgm::isLoaded('context_help') && $BE_USER->uc['edit_showFieldHelp']!='text') {
00868             $h_func_b.= '<br />'.
00869                         t3lib_BEfunc::getFuncCheck($this->id,'SET[showDescriptions]',$this->MOD_SETTINGS['showDescriptions'],'db_layout.php','','id="checkShowDescriptions"').
00870                         '<label for="checkShowDescriptions">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showDescriptions',1).'</label>';
00871         }
00872 
00873         if ($BE_USER->isRTE())  {
00874             $h_func_b.= '<br />'.
00875                         t3lib_BEfunc::getFuncCheck($this->id,'SET[disableRTE]',$this->MOD_SETTINGS['disableRTE'],'db_layout.php','','id="checkDisableRTE"').
00876                         '<label for="checkDisableRTE">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.disableRTE',1).'</label>';
00877         }
00878 
00879             // Add the function menus to bottom:
00880         $content.=$this->doc->section('',$h_func_b,0,0);
00881         $content.=$this->doc->spacer(10);
00882 
00883 
00884             // Select element matrix:
00885         if ($this->eRParts[0]=='tt_content' && t3lib_div::testInt($this->eRParts[1]))   {
00886             $posMap = t3lib_div::makeInstance('ext_posMap');
00887             $posMap->backPath = $BACK_PATH;
00888             $posMap->cur_sys_language=$this->current_sys_language;
00889 
00890             $HTMLcode = '';
00891 
00892                 // CSH:
00893             $HTMLcode.= t3lib_BEfunc::cshItem($this->descrTable,'quickEdit_selElement',$BACK_PATH,'|<br/>');
00894 
00895             $HTMLcode.=$posMap->printContentElementColumns($this->id,$this->eRParts[1],$this->colPosList,$this->MOD_SETTINGS['tt_content_showHidden'],$this->R_URI);
00896 
00897             $content.=$this->doc->spacer(20);
00898             $content.=$this->doc->section($LANG->getLL('CEonThisPage'),$HTMLcode,0,1);
00899             $content.=$this->doc->spacer(20);
00900         }
00901 
00902             // Finally, if comments were generated in TCEforms object, print these as a HTML comment:
00903         if (count($tceforms->commentMessages))  {
00904             $content.='
00905     <!-- TCEFORM messages
00906     '.htmlspecialchars(implode(chr(10),$tceforms->commentMessages)).'
00907     -->
00908     ';
00909         }
00910         return $content;
00911     }
00912 
00913     /**
00914      * Rendering all other listings than QuickEdit
00915      *
00916      * @return  void
00917      */
00918     function renderListContent()    {
00919         global $LANG,$BACK_PATH,$TCA;
00920 
00921             // Initialize list object (see "class.db_layout.inc"):
00922         $dblist = t3lib_div::makeInstance('tx_cms_layout');
00923         $dblist->backPath = $BACK_PATH;
00924         $dblist->thumbs = $this->imagemode;
00925         $dblist->no_noWrap = 1;
00926         $dblist->descrTable = $this->descrTable;
00927 
00928         $this->pointer = t3lib_div::intInRange($this->pointer,0,100000);
00929         $dblist->script = 'db_layout.php';
00930         $dblist->showIcon = 0;
00931         $dblist->setLMargin=0;
00932         $dblist->doEdit = $this->EDIT_CONTENT;
00933         $dblist->ext_CALC_PERMS = $this->CALC_PERMS;
00934 
00935         $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
00936         $dblist->id = $this->id;
00937         $dblist->nextThree = t3lib_div::intInRange($this->modTSconfig['properties']['editFieldsAtATime'],0,10);
00938         $dblist->option_showBigButtons = $this->modTSconfig['properties']['disableBigButtons'] ? 0 : 1;
00939         $dblist->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1;
00940         $dblist->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0;
00941         if (!$dblist->nextThree)    $dblist->nextThree = 1;
00942 
00943         $dblist->externalTables = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables'];
00944 
00945 
00946             // Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!)
00947         $h_menu = $dblist->getTableMenu($this->id);
00948 
00949             // Initialize other variables:
00950         $h_func='';
00951         $tableOutput=array();
00952         $tableJSOutput=array();
00953         $CMcounter = 0;
00954 
00955             // Traverse the list of table names which has records on this page (that array is populated by the $dblist object during the function getTableMenu()):
00956         reset($dblist->activeTables);
00957         while(list($table)=each($dblist->activeTables)) {
00958 
00959                 // Load full table definitions:
00960             t3lib_div::loadTCA($table);
00961 
00962             if (!isset($dblist->externalTables[$table]))    {
00963                     // Creating special conditions for each table:
00964                 switch($table)  {
00965                     case 'tt_board':
00966                         $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_board]',$this->MOD_SETTINGS['tt_board'],$this->MOD_MENU['tt_board'],'db_layout.php','');
00967                     break;
00968                     case 'tt_address':
00969                         $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_address]',$this->MOD_SETTINGS['tt_address'],$this->MOD_MENU['tt_address'],'db_layout.php','');
00970                     break;
00971                     case 'tt_links':
00972                         $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_links]',$this->MOD_SETTINGS['tt_links'],$this->MOD_MENU['tt_links'],'db_layout.php','');
00973                     break;
00974                     case 'tt_calender':
00975                         $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_calender]',$this->MOD_SETTINGS['tt_calender'],$this->MOD_MENU['tt_calender'],'db_layout.php','');
00976                     break;
00977                     case 'tt_products':
00978                         $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_products]',$this->MOD_SETTINGS['tt_products'],$this->MOD_MENU['tt_products'],'db_layout.php','');
00979                     break;
00980                     case 'tt_guest':
00981                     case 'tt_news':
00982                     case 'fe_users':
00983                         // Nothing
00984                     break;
00985                     case 'tt_content':
00986                         $q_count = $this->getNumberOfHiddenElements();
00987                         $h_func_b= t3lib_BEfunc::getFuncCheck($this->id,'SET[tt_content_showHidden]',$this->MOD_SETTINGS['tt_content_showHidden'],'db_layout.php','','id="checkTt_content_showHidden"').'<label for="checkTt_content_showHidden">'.(!$q_count?$GLOBALS['TBE_TEMPLATE']->dfw($LANG->getLL('hiddenCE')):$LANG->getLL('hiddenCE').' ('.$q_count.')').'</label>';
00988 
00989                         $dblist->tt_contentConfig['showCommands'] = 1;  // Boolean: Display up/down arrows and edit icons for tt_content records
00990                         $dblist->tt_contentConfig['showInfo'] = 1;      // Boolean: Display info-marks or not
00991                         $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
00992 
00993                             // Setting up the tt_content columns to show:
00994                         if (is_array($TCA['tt_content']['columns']['colPos']['config']['items']))   {
00995                             $colList = array();
00996                             foreach($TCA['tt_content']['columns']['colPos']['config']['items'] as $temp)    {
00997                                 $colList[] = $temp[1];
00998                             }
00999                         } else {    // ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
01000                             $colList = array('1','0','2','3');
01001                         }
01002                         if (strcmp($this->colPosList,''))   {
01003                             $colList = array_intersect(t3lib_div::intExplode(',',$this->colPosList),$colList);
01004                         }
01005 
01006                             // If only one column found, display the single-column view.
01007                         if (count($colList)==1) {
01008                             $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
01009                             $dblist->tt_contentConfig['showSingleCol'] = current($colList); // The column(s) to show if single mode (under each other)
01010                         }
01011                         $dblist->tt_contentConfig['cols'] = implode(',',$colList);      // The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
01012                         $dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
01013                         $dblist->tt_contentConfig['sys_language_uid'] = intval($this->current_sys_language);
01014 
01015                             // If the function menu is set to "Language":
01016                         if ($this->MOD_SETTINGS['function']==2) {
01017                             $dblist->tt_contentConfig['single'] = 0;
01018                             $dblist->tt_contentConfig['languageMode'] = 1;
01019                             $dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
01020                             $dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
01021                         }
01022                     break;
01023                 }
01024             } else {
01025                 $h_func = '';
01026             }
01027 
01028                 // Start the dblist object:
01029             $dblist->itemsLimitSingleTable = 1000;
01030             $dblist->start($this->id,$table,$this->pointer,$this->search_field,$this->search_levels,$this->showLimit);
01031             $dblist->counter = $CMcounter;
01032             $dblist->ext_function = $this->MOD_SETTINGS['function'];
01033 
01034                 // Render versioning selector:
01035             $dblist->HTMLcode.= $this->doc->getVersionSelector($this->id);
01036 
01037                 // Generate the list of elements here:
01038             $dblist->generateList();
01039 
01040                 // Adding the list content to the tableOutput variable:
01041             $tableOutput[$table]=
01042                             ($h_func?$h_func.'<br /><img src="clear.gif" width="1" height="4" alt="" /><br />':'').
01043                             $dblist->HTMLcode.
01044                             ($h_func_b?'<img src="clear.gif" width="1" height="10" alt="" /><br />'.$h_func_b:'');
01045 
01046                 // ... and any accumulated JavaScript goes the same way!
01047             $tableJSOutput[$table] = $dblist->JScode;
01048 
01049                 // Increase global counter:
01050