Documentation TYPO3 par Ameos

db_layout.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 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 ***************************************************************/
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_typo3.'class.db_list.inc');
00079 require_once('class.tx_cms_layout.php');
00080 require_once(PATH_t3lib.'class.t3lib_positionmap.php');
00081 $BE_USER->modAccess($MCONF,1);
00082 
00083 // Will open up records locked by current user. It's assumed that the locking should end if this script is hit.
00084 t3lib_BEfunc::lockRecords();
00085 
00086 // Exits if 'cms' extension is not loaded:
00087 t3lib_extMgm::isLoaded('cms',1);
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00106 class ext_posMap extends t3lib_positionMap {
00107         var $dontPrintPageInsertIcons = 1;
00108         var $l_insertNewRecordHere='newContentElement';
00109 
00117         function wrapRecordTitle($str,$row)     {
00118                 $aOnClick = 'jumpToUrl(\''.$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:'.$row['uid'])).'\');return false;';
00119                 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>';
00120         }
00121 
00130         function wrapColumnHeader($str,$vv)     {
00131                 $aOnClick = 'jumpToUrl(\''.$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'_EDIT_COL:'.$vv)).'\');return false;';
00132                 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>';
00133         }
00134 
00144         function onClickInsertRecord($row,$vv,$moveUid,$pid) {
00145                 if (is_array($row))     {
00146                         $location=$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:new/-'.$row['uid'].'/'.$row['colPos']));
00147                 } else {
00148                         $location=$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:new/'.$pid.'/'.$vv));
00149                 }
00150                 return 'jumpToUrl(\''.$location.'\');return false;';
00151         }
00152 
00160         function wrapRecordHeader($str,$row)    {
00161                 if ($row['uid']==$this->moveUid)        {
00162                         return '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/content_client.gif','width="7" height="10"').' alt="" />'.$str;
00163                 } else return $str;
00164         }
00165 }
00166 
00167 
00168 
00169 
00170 
00171 
00172 
00173 
00181 class SC_db_layout {
00182 
00183                 // Internal, GPvars:
00184         var $id;                                        // Page Id for which to make the listing
00185         var $pointer;                           // Pointer - for browsing list of records.
00186         var $imagemode;                         // Thumbnails or not
00187 
00188         var $search_field;                      // Search-fields
00189         var $search_levels;                     // Search-levels
00190         var $showLimit;                         // Show-limit
00191         var $returnUrl;                         // Return URL
00192 
00193         var $clear_cache;                       // Clear-cache flag - if set, clears page cache for current id.
00194         var $popView;                           // PopView id - for opening a window with the page
00195         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).
00196         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.
00197 
00198                 // Internal, static:
00199         var $perms_clause;                      // Page select perms clause
00200         var $modTSconfig;                       // Module TSconfig
00201         var $pageinfo;                          // Current ids page record
00202         var $doc;                                       // Document template object
00203         var $backPath;                          // Back path of the module
00204 
00205         var $descrTable;                        // "Pseudo" Description -table name
00206         var $colPosList;                        // List of column-integers to edit. Is set from TSconfig, default is "1,0,2,3"
00207         var $EDIT_CONTENT;                      // Flag: If content can be edited or not.
00208         var $CALC_PERMS;                        // Users permissions integer for this page.
00209         var $current_sys_language;      // Currently selected language for editing content elements
00210 
00211         var $MCONF=array();                     // Module configuration
00212         var $MOD_MENU=array();          // Menu configuration
00213         var $MOD_SETTINGS=array();      // Module settings (session variable)
00214         var $include_once=array();      // Array, where files to include is accumulated in the init() function
00215 
00216                 // Internal, dynamic:
00217         var $content;                           // Module output accumulation
00218         var $topFuncMenu;                       // Function menu temporary storage
00219         var $editIcon;                          // Temporary storage for page edit icon
00220 
00221 
00222 
00223 
00224 
00230         function init() {
00231                 global $BE_USER;
00232 
00233                         // Setting module configuration / page select clause
00234                 $this->MCONF = $GLOBALS['MCONF'];
00235                 $this->perms_clause = $BE_USER->getPagePermsClause(1);
00236                 $this->backPath = $GLOBALS['BACK_PATH'];
00237 
00238                         // GPvars:
00239                 $this->id = intval(t3lib_div::_GP('id'));
00240                 $this->pointer = t3lib_div::_GP('pointer');
00241                 $this->imagemode = t3lib_div::_GP('imagemode');
00242 
00243                 $this->clear_cache = t3lib_div::_GP('clear_cache');
00244                 $this->popView = t3lib_div::_GP('popView');
00245                 $this->edit_record = t3lib_div::_GP('edit_record');
00246                 $this->new_unique_uid = t3lib_div::_GP('new_unique_uid');
00247                 $this->search_field = t3lib_div::_GP('search_field');
00248                 $this->search_levels = t3lib_div::_GP('search_levels');
00249                 $this->showLimit = t3lib_div::_GP('showLimit');
00250                 $this->returnUrl = t3lib_div::_GP('returnUrl');
00251 
00252                         // Load page info array:
00253                 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
00254 
00255                         // Initialize menu
00256                 $this->menuConfig();
00257 
00258                         // Setting sys language from session var:
00259                 $this->current_sys_language=intval($this->MOD_SETTINGS['language']);
00260 
00261                         // Include scripts: QuickEdit
00262                 if ($this->MOD_SETTINGS['function']==0) {
00263                         $this->include_once[]=PATH_t3lib.'class.t3lib_tceforms.php';
00264                         $this->include_once[]=PATH_t3lib.'class.t3lib_clipboard.php';
00265                         $this->include_once[]=PATH_t3lib.'class.t3lib_loaddbgroup.php';
00266                         $this->include_once[]=PATH_t3lib.'class.t3lib_transferdata.php';
00267                 }
00268 
00269                         // Include scripts: Clear-cache cmd.
00270                 if ($this->clear_cache) {
00271                         $this->include_once[]=PATH_t3lib.'class.t3lib_tcemain.php';
00272                 }
00273 
00274                         // CSH / Descriptions:
00275                 $this->descrTable = '_MOD_'.$this->MCONF['name'];
00276         }
00277 
00283         function menuConfig()   {
00284                 global $BE_USER,$LANG,$TYPO3_CONF_VARS;
00285 
00286                         // MENU-ITEMS:
00287                 $this->MOD_MENU = array(
00288                         'tt_board' => array(
00289                                 0 => $LANG->getLL('m_tt_board_0'),
00290                                 'expand' => $LANG->getLL('m_tt_board_expand')
00291                         ),
00292                         'tt_address' => array(
00293                                 0 => $LANG->getLL('m_tt_address_0'),
00294                                 1 => $LANG->getLL('m_tt_address_1'),
00295                                 2 => $LANG->getLL('m_tt_address_2')
00296                         ),
00297                         'tt_links' => array(
00298                                 0 => $LANG->getLL('m_default'),
00299                                 1 => $LANG->getLL('m_tt_links_1'),
00300                                 2 => $LANG->getLL('m_tt_links_2')
00301                         ),
00302                         'tt_calender' => array (
00303                                 0 => $LANG->getLL('m_default'),
00304                                 'date' => $LANG->getLL('m_tt_calender_date'),
00305                                 'date_ext' => $LANG->getLL('m_tt_calender_date_ext'),
00306                                 'todo' => $LANG->getLL('m_tt_calender_todo'),
00307                                 'todo_ext' => $LANG->getLL('m_tt_calender_todo_ext')
00308                         ),
00309                         'tt_products' => array (
00310                                 0 => $LANG->getLL('m_default'),
00311                                 'ext' => $LANG->getLL('m_tt_products_ext')
00312                         ),
00313                         'tt_content_showHidden' => '',
00314                         'showPalettes' => '',
00315                         'showDescriptions' => '',
00316                         'disableRTE' => '',
00317                         'function' => array(
00318                                 1 => $LANG->getLL('m_function_1'),
00319                                 0 => $LANG->getLL('m_function_0'),
00320                                 2 => $LANG->getLL('m_function_2'),
00321                                 3 => $LANG->getLL('pageInformation')
00322                         ),
00323                         'language' => array(
00324                                 0 => $LANG->getLL('m_default')
00325                         )
00326                 );
00327 
00328                          // 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.
00329                 $res = $this->exec_languageQuery($this->id);
00330                 while($lrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))      {
00331                         $this->MOD_MENU['language'][$lrow['uid']]=($lrow['hidden']?'('.$lrow['title'].')':$lrow['title']);
00332                 }
00333 
00334                         // Find if there are ANY languages at all (and if not, remove the language option from function menu).
00335                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'sys_language', ($BE_USER->isAdmin()?'':'hidden=0'));
00336                 if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res))  {
00337                         unset($this->MOD_MENU['function']['2']);
00338                 }
00339 
00340                         // page/be_user TSconfig settings and blinding of menu-items
00341                 $this->modSharedTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED');
00342                 $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']);
00343                 if ($this->modTSconfig['properties']['QEisDefault'])    ksort($this->MOD_MENU['function']);
00344                 $this->MOD_MENU['function'] = t3lib_BEfunc::unsetMenuItems($this->modTSconfig['properties'],$this->MOD_MENU['function'],'menu.function');
00345 
00346                         // Remove QuickEdit as option if page type is not...
00347                 if (!t3lib_div::inList($TYPO3_CONF_VARS['FE']['content_doktypes'].',6',$this->pageinfo['doktype']))     {
00348                         unset($this->MOD_MENU['function'][0]);
00349                 }
00350 
00351                         // Setting alternative default label:
00352                 if (($this->modSharedTSconfig['properties']['defaultLanguageLabel'] || $this->modTSconfig['properties']['defaultLanguageLabel']) && isset($this->MOD_MENU['language'][0]))      {
00353                         $this->MOD_MENU['language'][0] = $this->modTSconfig['properties']['defaultLanguageLabel'] ? $this->modSharedTSconfig['properties']['defaultLanguageLabel'] : $this->modSharedTSconfig['properties']['defaultLanguageLabel'];
00354                 }
00355 
00356                         // Clean up settings
00357                 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
00358         }
00359 
00365         function clearCache()   {
00366                 if ($this->clear_cache) {
00367                         $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00368                         $tce->stripslashes_values=0;
00369                         $tce->start(Array(),Array());
00370                         $tce->clear_cacheCmd($this->id);
00371                 }
00372         }
00373 
00380         function main() {
00381                 global $BE_USER,$LANG,$BACK_PATH;
00382 
00383                 // Access check...
00384                 // The page will show only if there is a valid page and if this page may be viewed by the user
00385                 $access = is_array($this->pageinfo) ? 1 : 0;
00386                 if ($this->id && $access)       {
00387 
00388                                 // Initialize permission settings:
00389                         $this->CALC_PERMS = $BE_USER->calcPerms($this->pageinfo);
00390                         $this->EDIT_CONTENT = ($this->CALC_PERMS&16) ? 1 : 0;
00391 
00392                                 // Start document template object:
00393                         $this->doc = t3lib_div::makeInstance('mediumDoc');
00394                         $this->doc->backPath = $BACK_PATH;
00395                         $this->doc->docType='xhtml_trans';
00396 
00397                                 // JavaScript:
00398                         $this->doc->JScode = '<script type="text/javascript" src="'.$BACK_PATH.'t3lib/jsfunc.updateform.js"></script>';
00399                         $this->doc->JScode.= $this->doc->wrapScriptTags('
00400                                 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';
00401                                 function jumpToUrl(URL,formEl)  {       //
00402                                         if (document.editform && document.TBE_EDITOR_isFormChanged)     {       // Check if the function exists... (works in all browsers?)
00403                                                 if (!TBE_EDITOR_isFormChanged())        {       //
00404                                                         document.location = URL;
00405                                                 } else if (formEl) {
00406                                                         if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
00407                                                 }
00408                                         } else document.location = URL;
00409                                 }
00410                         '.($this->popView ? t3lib_BEfunc::viewOnClick($this->id,$BACK_PATH,t3lib_BEfunc::BEgetRootLine($this->id)) : '').'
00411 
00412                                 function deleteRecord(table,id,url)     {       //
00413                                         if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).'))      {
00414                                                 document.location = "'.$BACK_PATH.'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC='.$BE_USER->veriCode().'&prErr=1&uPT=1";
00415                                         }
00416                                         return false;
00417                                 }
00418                         ');
00419 
00420                                 // Setting doc-header
00421                         $this->doc->form='<form action="'.htmlspecialchars('db_layout.php?id='.$this->id.'&imagemode='.$this->imagemode).'" method="post">';
00422 
00423                                 // Creating the top function menu:
00424                         $this->topFuncMenu = t3lib_BEfunc::getFuncMenu($this->id,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function'],'db_layout.php','').
00425                                                 (count($this->MOD_MENU['language'])>1 ? '<br />'.t3lib_BEfunc::getFuncMenu($this->id,'SET[language]',$this->current_sys_language,$this->MOD_MENU['language'],'db_layout.php','') : '');
00426 
00427                                 // Creating the top edit page icon:
00428                         if ($this->CALC_PERMS&2)        {
00429                                 $params='&edit[pages]['.$this->id.']=edit';
00430                                 $this->editIcon='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$BACK_PATH)).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/edit2.gif','width="11" height="12"').' vspace="2" align="top" title="'.$LANG->getLL('editPageTitle',1).'" alt="" /></a>';
00431                         } else {
00432                                 $this->editIcon='';
00433                         }
00434 
00435                                 // Find columns
00436                         $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id,'mod.SHARED');             // SHARED page-TSconfig settings.
00437                         $this->colPosList = strcmp(trim($this->modTSconfig['properties']['tt_content.']['colPos_list']),'') ? trim($this->modTSconfig['properties']['tt_content.']['colPos_list']) : $modTSconfig_SHARED['properties']['colPos_list'];
00438                         $this->colPosList = strcmp($this->colPosList,'')?$this->colPosList:'1,0,2,3';
00439                         $this->colPosList = implode(',',array_unique(t3lib_div::intExplode(',',$this->colPosList)));            // Removing duplicates, if any
00440 
00441 
00442                                 // Render the primary module content:
00443                         if ($this->MOD_SETTINGS['function']==0) {
00444                                 $this->renderQuickEdit();       // QuickEdit
00445                         } else {
00446                                 $this->renderListContent();     // All other listings
00447                         }
00448 
00449 
00450                                 // ShortCut
00451                         if ($BE_USER->mayMakeShortcut())        {
00452                                 $this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon('id,edit_record,pointer,new_unique_uid,search_field,search_levels,showLimit',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name']));
00453                         }
00454 
00455                                 // Ending page:
00456                         $this->content.=$this->doc->spacer(10);
00457                         $this->content.=$this->doc->endPage();
00458                 } else {
00459 
00460                                 // If no access or id value, create empty document:
00461                         $this->doc = t3lib_div::makeInstance('mediumDoc');
00462                         $this->doc->docType='xhtml_trans';
00463                         $this->doc->backPath = $BACK_PATH;
00464                         $this->doc->JScode = $this->doc->wrapScriptTags('
00465                                 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';
00466                         ');
00467                         $this->content=$this->doc->startPage($LANG->getLL('title'));
00468                         $this->content.=$this->doc->section($LANG->getLL('clickAPage_header'),$LANG->getLL('clickAPage_content'),0,1);
00469 
00470                         $this->content.= t3lib_BEfunc::cshItem($this->descrTable,'',$BACK_PATH,'<br/><br/>');
00471 
00472                         $this->content.=$this->doc->endPage();
00473                 }
00474         }
00475 
00481         function renderQuickEdit()      {
00482                 global $LANG,$BE_USER,$BACK_PATH;
00483 
00484                         // Alternative form tag; Quick Edit submits its content to tce_db.php.
00485                 $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);">';
00486 
00487                         // Setting up the context sensitive menu:
00488                 $CMparts = $this->doc->getContextMenuCode();
00489                 $this->doc->JScode.= $CMparts[0];
00490                 $this->doc->bodyTagAdditions = $CMparts[1];
00491                 $this->doc->postCode.= $CMparts[2];
00492 
00493                         // Set the edit_record value for internal use in this function:
00494                 $edit_record = $this->edit_record;
00495 
00496                         // If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php:
00497                 if (substr($edit_record,0,9)=='_EDIT_COL')      {
00498                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00499                                                 '*',
00500                                                 'tt_content',
00501                                                 'pid='.intval($this->id).' AND colPos='.intval(substr($edit_record,10)).' AND sys_language_uid='.intval($this->current_sys_language).
00502                                                                 ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')).
00503                                                                 t3lib_BEfunc::deleteClause('tt_content'),
00504                                                 '',
00505                                                 'sorting'
00506                                         );
00507                         $idListA = array();
00508                         while($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))      {
00509                                 $idListA[] = $cRow['uid'];
00510                         }
00511 
00512                         $jumpUrl = $BACK_PATH.'alt_doc.php?edit[tt_content]['.implode(',',$idListA).']=edit&returnUrl='.rawurlencode($this->local_linkThisScript(array('edit_record'=>'')));
00513                         header('Location: '.t3lib_div::locationHeaderUrl($jumpUrl));
00514                         exit;
00515                 }
00516 
00517                         // If the former record edited was the creation of a NEW record, this will look up the created records uid:
00518                 if ($this->new_unique_uid)      {
00519                         $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'));
00520                         $sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00521                         if (is_array($sys_log_row))     {
00522                                 $edit_record=$sys_log_row['tablename'].':'.$sys_log_row['recuid'];
00523                         }
00524                 }
00525 
00526 
00527                         // Creating the selector box, allowing the user to select which element to edit:
00528                 $opt=array();
00529                 $is_selected=0;
00530                 $languageOverlayRecord='';
00531                 if ($this->current_sys_language)        {
00532                         list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$this->id,'AND sys_language_uid='.intval($this->current_sys_language));
00533                 }
00534                 if (is_array($languageOverlayRecord))   {
00535                         $inValue = 'pages_language_overlay:'.$languageOverlayRecord['uid'];
00536                         $is_selected+=intval($edit_record==$inValue);
00537                         $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('editLanguageHeader',1).' ]</option>';
00538                 } else {
00539                         $inValue = 'pages:'.$this->id;
00540                         $is_selected+=intval($edit_record==$inValue);
00541                         $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('editPageHeader',1).' ]</option>';
00542                 }
00543 
00544                         // Selecting all content elements from this language:
00545                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00546                                         '*',
00547                                         'tt_content',
00548                                         'pid='.intval($this->id).' AND sys_language_uid='.intval($this->current_sys_language).
00549                                                         ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')).
00550                                                         t3lib_Befunc::deleteClause('tt_content'),
00551                                         '',
00552                                         'colPos,sorting'
00553                                 );
00554                 $colPos='';
00555                 $first=1;
00556                 $prev=$this->id;        // Page is the pid if no record to put this after.
00557                 while($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))      {
00558                         if ($first)     {
00559                                 if (!$edit_record)      {
00560                                         $edit_record='tt_content:'.$cRow['uid'];
00561                                 }
00562                                 $first = 0;
00563                         }
00564                         if (strcmp($cRow['colPos'],$colPos))    {
00565                                 $colPos=$cRow['colPos'];
00566                                 $opt[]='<option value=""></option>';
00567                                 $opt[]='<option value="_EDIT_COL:'.$colPos.'">__'.$LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','colPos',$colPos),1).':__</option>';
00568                         }
00569                         $inValue = 'tt_content:'.$cRow['uid'];
00570                         $is_selected+=intval($edit_record==$inValue);
00571                         $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>';
00572                         $prev=-$cRow['uid'];
00573                 }
00574 
00575                         // If edit_record is not set (meaning, no content elements was found for this language) we simply set it to create a new element:
00576                 if (!$edit_record)      {
00577                         $edit_record='tt_content:new/'.$prev.'/'.$colPos;
00578 
00579                         $inValue = 'tt_content:new/'.$prev.'/'.$colPos;
00580                         $is_selected+=intval($edit_record==$inValue);
00581                         $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('newLabel',1).' ]</option>';
00582                 }
00583 
00584                         // If none is yet selected...
00585                 if (!$is_selected)      {
00586                         $opt[]='<option value=""></option>';
00587                         $opt[]='<option value="'.$edit_record.'"  selected="selected">[ '.$LANG->getLL('newLabel',1).' ]</option>';
00588                 }
00589 
00590 
00591                         // Splitting the edit-record cmd value into table/uid:
00592                 $eRParts = explode(':',$edit_record);
00593 
00594                         // Delete-button flag?
00595                 $deleteButton = (t3lib_div::testInt($eRParts[1]) && $edit_record && (($eRParts[0]!='pages'&&$this->EDIT_CONTENT) || ($eRParts[0]=='pages'&&($this->CALC_PERMS&4))));
00596 
00597                         // If undo-button should be rendered (depends on available items in sys_history)
00598                 $undoButton=0;
00599                 $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename='.$GLOBALS['TYPO3_DB']->fullQuoteStr($eRParts[0], 'sys_history').' AND recuid='.intval($eRParts[1]), '', 'tstamp DESC', '1');
00600                 if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes))     {
00601                         $undoButton=1;
00602                 }
00603 
00604                         // Setting up the Return URL for coming back to THIS script (if links take the user to another script)
00605                 $R_URL_parts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
00606                 $R_URL_getvars = t3lib_div::_GET();
00607 
00608                 unset($R_URL_getvars['popView']);
00609                 unset($R_URL_getvars['new_unique_uid']);
00610                 $R_URL_getvars['edit_record']=$edit_record;
00611                 $R_URI = $R_URL_parts['path'].'?'.t3lib_div::implodeArrayForUrl('',$R_URL_getvars);
00612 
00613                         // Setting close url/return url for exiting this script:
00614                 $closeUrl = $this->local_linkThisScript(array('SET'=>array('function'=>1)));    // Goes to 'Columns' view if close is pressed (default)
00615 
00616                 if ($BE_USER->uc['condensedMode'])      {
00617                         $closeUrl=$BACK_PATH.'alt_db_navframe.php';
00618                 }
00619                 if ($this->returnUrl)   {
00620                         $closeUrl = $this->returnUrl;
00621                 }
00622                         // Return-url for JavaScript:
00623                 $retUrlStr = $this->returnUrl?"+'&returnUrl='+'".rawurlencode($this->returnUrl)."'":'';
00624 
00625                         // Drawing tool bar:
00626                 $toolBar=
00627                         '<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>'.
00628 
00629                         '<input class="c-inputButton" type="image" name="savedok"'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/savedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'" alt="" />'.
00630 
00631                         '<a href="#" onclick="'.htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR_checkAndDoSubmit(1); return false;').'">'.
00632                                 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/savedokshow.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow',1).'" alt="" />'.
00633                                 '</a>'.
00634 
00635                         '<a href="#" onclick="'.htmlspecialchars('jumpToUrl(unescape(\''.rawurlencode($closeUrl).'\')); return false;').'">'.
00636                                 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/closedok.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc',1).'" alt="" />'.
00637                                 '</a>'.
00638 
00639                         ($deleteButton ? '<a href="#" onclick="'.htmlspecialchars('return deleteRecord(\''.$eRParts[0].'\',\''.$eRParts[1].'\',\''.t3lib_div::getIndpEnv('SCRIPT_NAME').'?id='.$this->id.'\');').'">'.
00640                                                         '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/deletedok.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->getLL('deleteItem',1).'" alt="" />'.
00641                                                         '</a>' : '').
00642 
00643                         ($undoButton ? '<a href="#" onclick="'.htmlspecialchars('document.location=\''.$BACK_PATH.'show_rechis.php?element='.rawurlencode($eRParts[0].':'.$eRParts[1]).'&revert=ALL_FIELDS&sumUp=-1&returnUrl='.rawurlencode($R_URI).'\'; return false;').'">'.
00644                                                         '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/undo.gif','width="21" height="16"').' class="c-inputButton" title="'.htmlspecialchars(sprintf($LANG->getLL('undoLastChange'),t3lib_BEfunc::calcAge(time()-$undoButtonR['tstamp'],$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))).'" alt="" />'.
00645                                                         '</a>' : '');
00646 
00647                 $toolBar.='<img src="clear.gif" width="15" height="1" align="top" alt="" />';
00648 
00649                 $toolBar.=$undoButton?'<a href="#" onclick="'.htmlspecialchars('jumpToUrl(\''.$BACK_PATH.'show_rechis.php?element='.rawurlencode($eRParts[0].':'.$eRParts[1]).'&returnUrl='.rawurlencode($R_URI).'#latest\');return false;').'">'.
00650                                         '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/history2.gif','width="13" height="12"').' class="c-inputButton" title="'.$LANG->getLL('recordHistory',1).'" alt="" />'.
00651                                         '</a>':'';
00652 
00653                 $toolBar.='<a href="'.htmlspecialchars('db_new_content_el.php?id='.$this->id.'&sys_language_uid='.$this->current_sys_language.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00654                                         '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/new_record.gif','width="16" height="12"').' class="c-inputButton" title="'.$LANG->getLL('newContentElement',1).'" alt="" />'.
00655                                         '</a>';
00656 
00657                 if (t3lib_div::testInt($eRParts[1])) $toolBar.='<a href="'.htmlspecialchars($BACK_PATH.'move_el.php?table='.$eRParts[0].'&uid='.$eRParts[1].'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/move_'.($eRParts[0]=='tt_content'?'record':'page').'.gif','width="11" height="12"').' class="c-inputButton" title="'.$LANG->getLL('move_'.($eRParts[0]=='tt_content'?'record':'page'),1).'" alt="" /></a>';
00658 
00659                 $toolBar.='<a href="#" onclick="'.htmlspecialchars('jumpToUrl(\''.$BACK_PATH.'db_new.php?id='.$this->id.'&pagesOnly=1&returnUrl='.rawurlencode($R_URI).'\');return false;').'">'.
00660                                 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/new_page.gif','width="13" height="12"').' class="c-inputButton" title="'.$LANG->getLL('newPage',1).'" alt="" />'.
00661                                 '</a>';
00662 
00663                 $toolBar.='<a href="'.htmlspecialchars($this->local_linkThisScript(array('edit_record'=>'pages:'.$this->id))).'">'.
00664                                 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/edit2.gif','width="11" height="12"').' class="c-inputButton" title="'.$LANG->getLL('editPageHeader',1).'" alt="" />'.
00665                                 '</a>';
00666                 $toolBar.='<img src="clear.gif" width="15" height="1" align="top" alt="" />';
00667 
00668                         // CSH:
00669                 $toolBar.= t3lib_BEfunc::cshItem($this->descrTable,'quickEdit',$BACK_PATH,'',FALSE,'margin-top: 0px; margin-bottom: 0px;');
00670 
00671                         // Setting page header:
00672                 $hS2 = '
00673                         <table border="0" cellpadding="0" cellspacing="0" width="460">
00674                                 <tr>
00675                                         <td valign="top" width="99%">'.$this->doc->getHeader('pages',$this->pageinfo,$this->pageinfo['_thePath'],0,explode('|','<a href="'.htmlspecialchars($this->local_linkThisScript(array('edit_record'=>'pages:'.$this->id))).'">|</a>')).'</td>
00676                                         <td valign="top" width="1%">'.$this->topFuncMenu.'</td>
00677                                         <td valign="top" width="1%"><img src="clear.gif" width="1" height="3" alt="" /><br />'.$this->editIcon.'</td>
00678                                 </tr>
00679                                 <tr>
00680                                         <td><img src="clear.gif" width="300" height="1" alt="" /></td>
00681                                         <td></td>
00682                                         <td></td>
00683                                 </tr>
00684                                 <tr>
00685                                         <td colspan="3" class="bgColor4">'.$toolBar.'</td>
00686                                 </tr>
00687                         </table>';
00688 
00689                 $content.=$this->doc->startPage($LANG->getLL('title'));
00690                 $content.=$this->doc->section('',$hS2);
00691                 $content.=$this->doc->spacer(7);
00692 
00693                         // Creating editing form:
00694                 if ($BE_USER->check('tables_modify',$eRParts[0]) && $edit_record && (($eRParts[0]!='pages'&&$this->EDIT_CONTENT) || ($eRParts[0]=='pages'&&($this->CALC_PERMS&1))))     {
00695 
00696                                 // Splitting uid parts for special features, if new:
00697                         list($uidVal,$ex_pid,$ex_colPos) = explode('/',$eRParts[1]);
00698 
00699                                 // Initializing transfer-data object:
00700                         $trData = t3lib_div::makeInstance('t3lib_transferData');
00701                         $trData->addRawData = TRUE;
00702                         $trData->defVals[$eRParts[0]] = array (
00703                                 'colPos' => intval($ex_colPos),
00704                                 'sys_language_uid' => intval($this->current_sys_language)
00705                         );
00706                         $trData->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00707                         $trData->lockRecords=1;
00708                         $trData->fetchRecord($eRParts[0],($uidVal=='new'?$this->id:$uidVal),$uidVal);   // 'new'
00709 
00710                                 // Getting/Making the record:
00711                         reset($trData->regTableItems_data);
00712                         $rec = current($trData->regTableItems_data);
00713                         if ($uidVal=='new')     {
00714                                 $new_unique_uid = uniqid('NEW');
00715                                 $rec['uid'] = $new_unique_uid;
00716                                 $rec['pid'] = intval($ex_pid)?intval($ex_pid):$this->id;
00717                                 $recordAccess = TRUE;
00718                         } else {
00719                                 $rec['uid'] = $uidVal;
00720 
00721                                         // Checking internals access:
00722                                 $recordAccess = $BE_USER->recordEditAccessInternals($eRParts[0],$uidVal);
00723                         }
00724 
00725                         if (!$recordAccess)     {
00726                                         // If no edit access, print error message:
00727                                 $content.=$this->doc->section($LANG->getLL('noAccess'),$LANG->getLL('noAccess_msg').'<br /><br />'.
00728                                                         ($BE_USER->errorMsg ? 'Reason: '.$BE_USER->errorMsg.'<br/><br/>' : ''),0,1);
00729                         } elseif (is_array($rec))       {       // If the record is an array (which it will always be... :-)
00730 
00731                                         // Create instance of TCEforms, setting defaults:
00732                                 $tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
00733                                 $tceforms->backPath = $BACK_PATH;
00734                                 $tceforms->initDefaultBEMode();
00735                                 $tceforms->fieldOrder = $this->modTSconfig['properties']['tt_content.']['fieldOrder'];
00736                                 $tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
00737                                 $tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00738                                 $tceforms->enableClickMenu = TRUE;
00739 
00740                                         // Clipboard is initialized:
00741                                 $tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard');                // Start clipboard
00742                                 $tceforms->clipObj->initializeClipboard();      // Initialize - reads the clipboard content from the user session
00743 
00744 
00745                                 if ($BE_USER->uc['edit_showFieldHelp']!='text' && $this->MOD_SETTINGS['showDescriptions'])      $tceforms->edit_showFieldHelp='text';
00746 
00747                                         // Render form, wrap it:
00748                                 $panel='';
00749                                 $panel.=$tceforms->getMainFields($eRParts[0],$rec);
00750                                 $panel=$tceforms->wrapTotal($panel,$rec,$eRParts[0]);
00751 
00752                                         // Add hidden fields:
00753                                 $theCode=$panel;
00754                                 if ($uidVal=='new')     {
00755                                         $theCode.='<input type="hidden" name="data['.$eRParts[0].']['.$rec['uid'].'][pid]" value="'.$rec['pid'].'" />';
00756                                 }
00757                                 $theCode.='
00758                                         <input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />
00759                                         <input type="hidden" name="_disableRTE" value="'.$tceforms->disableRTE.'" />
00760                                         <input type="hidden" name="edit_record" value="'.$edit_record.'" />
00761                                         <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) : $R_URI ).'" />
00762                                         ';
00763 
00764                                         // Add JavaScript as needed around the form:
00765                                 $theCode=$tceforms->printNeededJSFunctions_top().$theCode.$tceforms->printNeededJSFunctions();
00766 
00767                                         // Add warning sign if record was "locked":
00768                                 if ($lockInfo=t3lib_BEfunc::isRecordLocked($eRParts[0],$rec['uid']))    {
00769                                         $lockIcon='
00770 
00771                                                 <!--
00772                                                         Warning box:
00773                                                 -->
00774                                                 <table border="0" cellpadding="0" cellspacing="0" class="warningbox">
00775                                                         <tr>
00776                                                                 <td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/recordlock_warning3.gif','width="17" height="12"').' alt="" /></td>
00777                                                                 <td>'.htmlspecialchars($lockInfo['msg']).'</td>
00778                                                         </tr>
00779                                                 </table>
00780                                                 ';
00781                                 } else $lockIcon='';
00782 
00783                                         // Add whole form as a document section:
00784                                 $content.=$this->doc->section('',$lockIcon.$theCode);
00785                         }
00786                 } else {
00787                                 // If no edit access, print error message:
00788                         $content.=$this->doc->section($LANG->getLL('noAccess'),$LANG->getLL('noAccess_msg').'<br /><br />',0,1);
00789                 }
00790 
00791 
00792                         // Bottom controls (function menus):
00793                 $q_count = $this->getNumberOfHiddenElements();
00794                 $h_func_b= t3lib_BEfunc::getFuncCheck($this->id,'SET[tt_content_showHidden]',$this->MOD_SETTINGS['tt_content_showHidden'],'db_layout.php','').
00795                                         (!$q_count?$GLOBALS['TBE_TEMPLATE']->dfw($LANG->getLL('hiddenCE',1)):$LANG->getLL('hiddenCE',1).' ('.$q_count.')');
00796 
00797                 $h_func_b.= '<br />'.
00798                                         t3lib_BEfunc::getFuncCheck($this->id,'SET[showPalettes]',$this->MOD_SETTINGS['showPalettes'],'db_layout.php','').
00799                                         $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPalettes',1);
00800 
00801                 if (t3lib_extMgm::isLoaded('context_help') && $BE_USER->uc['edit_showFieldHelp']!='text') {
00802                         $h_func_b.= '<br />'.
00803                                                 t3lib_BEfunc::getFuncCheck($this->id,'SET[showDescriptions]',$this->MOD_SETTINGS['showDescriptions'],'db_layout.php','').
00804                                                 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showDescriptions',1);
00805                 }
00806 
00807                 if ($BE_USER->isRTE())  {
00808                         $h_func_b.= '<br />'.
00809                                                 t3lib_BEfunc::getFuncCheck($this->id,'SET[disableRTE]',$this->MOD_SETTINGS['disableRTE'],'db_layout.php','').
00810                                                 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.disableRTE',1);
00811                 }
00812 
00813                         // Add the function menus to bottom:
00814                 $content.=$this->doc->section('',$h_func_b,0,0);
00815                 $content.=$this->doc->spacer(10);
00816 
00817 
00818                         // Select element matrix:
00819                 if ($eRParts[0]=='tt_content' && t3lib_div::testInt($eRParts[1]))       {
00820                         $posMap = t3lib_div::makeInstance('ext_posMap');
00821                         $posMap->backPath = $BACK_PATH;
00822                         $posMap->cur_sys_language=$this->current_sys_language;
00823 
00824                         $HTMLcode = '';
00825 
00826                                 // CSH:
00827                         $HTMLcode.= t3lib_BEfunc::cshItem($this->descrTable,'quickEdit_selElement',$BACK_PATH,'|<br/>');
00828 
00829                         $HTMLcode.=$posMap->printContentElementColumns($this->id,$eRParts[1],$this->colPosList,$this->MOD_SETTINGS['tt_content_showHidden'],$R_URI);
00830 
00831                         $HTMLcode.='<br /><br />'.
00832                                                 '<a href="'.htmlspecialchars($BACK_PATH.'move_el.php?table=tt_content&uid='.$eRParts[1].'&sys_language_uid='.$this->current_sys_language.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/move_record.gif','width="11" height="12"').' vspace="0" hspace="5" align="top" title="'.$LANG->getLL('move_record',1).'" alt="" />'.
00833                                                 $LANG->getLL('move_record',1).
00834                                                 '</a>';
00835 
00836                         $HTMLcode.='<br /><img src="clear.gif" width="1" height="5" alt="" />';
00837                         $HTMLcode.='<br />'.
00838                                                 '<a href="'.htmlspecialchars('db_new_content_el.php?id='.$this->id.'&sys_language_uid='.$this->current_sys_language.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00839                                                 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/new_record.gif','width="16" height="12"').' vspace="0" hspace="2" align="top" title="'.$LANG->getLL('newContentElement',1).'" alt="" />'.
00840                                                 $LANG->getLL('newContentElement',1).
00841                                                 '</a>';
00842 
00843                         $content.=$this->doc->spacer(20);
00844                         $content.=$this->doc->section($LANG->getLL('CEonThisPage'),$HTMLcode,0,1);
00845                         $content.=$this->doc->spacer(20);
00846                 }
00847 
00848                         // Finally, if comments were generated in TCEforms object, print these as a HTML comment:
00849                 if (count($tceforms->commentMessages))  {
00850                         $content.='
00851         <!-- TCEFORM messages
00852         '.htmlspecialchars(implode(chr(10),$tceforms->commentMessages)).'
00853         -->
00854         ';
00855                 }
00856 
00857                         // Adding content to internal accumulation variable:
00858                 $this->content.=$content;
00859         }
00860 
00866         function renderListContent()    {
00867                 global $LANG,$BACK_PATH,$TCA;
00868 
00869                         // Initialize list object (see "class.db_layout.inc"):
00870                 $dblist = t3lib_div::makeInstance('tx_cms_layout');
00871                 $dblist->backPath = $BACK_PATH;
00872                 $dblist->thumbs = $this->imagemode;
00873                 $dblist->no_noWrap = 1;
00874                 $dblist->descrTable = $this->descrTable;
00875 
00876                 $this->pointer = t3lib_div::intInRange($this->pointer,0,100000);
00877                 $dblist->script = 'db_layout.php';
00878                 $dblist->showIcon = 0;
00879                 $dblist->setLMargin=0;
00880                 $dblist->doEdit = $this->EDIT_CONTENT;
00881                 $dblist->ext_CALC_PERMS = $this->CALC_PERMS;
00882 
00883                 $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
00884                 $dblist->id = $this->id;
00885                 $dblist->nextThree = t3lib_div::intInRange($this->modTSconfig['properties']['editFieldsAtATime'],0,10);
00886                 $dblist->option_showBigButtons = $this->modTSconfig['properties']['disableBigButtons'] ? 0 : 1;
00887                 $dblist->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1;
00888                 $dblist->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0;
00889                 if (!$dblist->nextThree)        $dblist->nextThree = 1;
00890 
00891                 $dblist->externalTables = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables'];
00892 
00893 
00894                         // Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!)
00895                 $h_menu = $dblist->getTableMenu($this->id);
00896 
00897                         // Initialize other variables:
00898                 $h_func='';
00899                 $tableOutput=array();
00900                 $tableJSOutput=array();
00901                 $CMcounter = 0;
00902 
00903                         // Traverse the list of table names which has records on this page (that array is populated by the $dblist object during the function getTableMenu()):
00904                 reset($dblist->activeTables);
00905                 while(list($table)=each($dblist->activeTables)) {
00906 
00907                                 // Load full table definitions:
00908                         t3lib_div::loadTCA($table);
00909 
00910                         if (!isset($dblist->externalTables[$table]))    {
00911                                         // Creating special conditions for each table:
00912                                 switch($table)  {
00913                                         case 'tt_board':
00914                                                 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_board]',$this->MOD_SETTINGS['tt_board'],$this->MOD_MENU['tt_board'],'db_layout.php','');
00915                                         break;
00916                                         case 'tt_address':
00917                                                 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_address]',$this->MOD_SETTINGS['tt_address'],$this->MOD_MENU['tt_address'],'db_layout.php','');
00918                                         break;
00919                                         case 'tt_links':
00920                                                 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_links]',$this->MOD_SETTINGS['tt_links'],$this->MOD_MENU['tt_links'],'db_layout.php','');
00921                                         break;
00922                                         case 'tt_calender':
00923                                                 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_calender]',$this->MOD_SETTINGS['tt_calender'],$this->MOD_MENU['tt_calender'],'db_layout.php','');
00924                                         break;
00925                                         case 'tt_products':
00926                                                 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_products]',$this->MOD_SETTINGS['tt_products'],$this->MOD_MENU['tt_products'],'db_layout.php','');
00927                                         break;
00928                                         case 'tt_guest':
00929                                         case 'tt_news':
00930                                         case 'fe_users':
00931                                                 // Nothing
00932                                         break;
00933                                         case 'tt_content':
00934                                                 $q_count = $this->getNumberOfHiddenElements();
00935                                                 $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.')');
00936 
00937                                                 $dblist->tt_contentConfig['showCommands'] = 1;  // Boolean: Display up/down arrows and edit icons for tt_content records
00938                                                 $dblist->tt_contentConfig['showInfo'] = 1;              // Boolean: Display info-marks or not
00939                                                 $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
00940 
00941                                                         // Setting up the tt_content columns to show:
00942                                                 if (is_array($TCA['tt_content']['columns']['colPos']['config']['items']))       {
00943                                                         $colList = array();
00944                                                         foreach($TCA['tt_content']['columns']['colPos']['config']['items'] as $temp)    {
00945                                                                 $colList[] = $temp[1];
00946                                                         }
00947                                                 } else {        // ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
00948                                                         $colList = array('1','0','2','3');
00949                                                 }
00950                                                 if (strcmp($this->colPosList,''))       {
00951                                                         $colList = array_intersect(t3lib_div::intExplode(',',$this->colPosList),$colList);
00952                                                 }
00953 
00954                                                         // If only one column found, display the single-column view.
00955                                                 if (count($colList)==1) {
00956                                                         $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
00957                                                         $dblist->tt_contentConfig['showSingleCol'] = current($colList); // The column(s) to show if single mode (under each other)
00958                                                 }
00959                                                 $dblist->tt_contentConfig['cols'] = implode(',',$colList);              // The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
00960                                                 $dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
00961                                                 $dblist->tt_contentConfig['sys_language_uid'] = intval($this->current_sys_language);
00962 
00963                                                         // If the function menu is set to "Language":
00964                                                 if ($this->MOD_SETTINGS['function']==2) {
00965                                                         $dblist->tt_contentConfig['single'] = 0;
00966                                                         $dblist->tt_contentConfig['languageMode'] = 1;
00967                                                         $dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
00968                                                         $dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
00969                                                 }
00970                                         break;
00971                                 }
00972                         } else {
00973                                 $h_func = '';
00974                         }
00975 
00976                                 // Start the dblist object:
00977                         $dblist->itemsLimitSingleTable = 1000;
00978                         $dblist->start($this->id,$table,$this->pointer,$this->search_field,$this->search_levels,$this->showLimit);
00979                         $dblist->counter = $CMcounter;
00980                         $dblist->ext_function = $this->MOD_SETTINGS['function'];
00981 
00982                                 // Render versioning selector:
00983                         $dblist->HTMLcode.= $this->doc->getVersionSelector($this->id);
00984 
00985                                 // Generate the list of elements here:
00986                         $dblist->generateList();
00987 
00988                                 // Adding the list content to the tableOutput variable:
00989                         $tableOutput[$table]=
00990                                                         ($h_func?$h_func.'<br /><img src="clear.gif" width="1" height="4" alt="" /><br />':'').
00991                                                         $dblist->HTMLcode.
00992                                                         ($h_func_b?'<img src="clear.gif" width="1" height="10" alt="" /><br />'.$h_func_b:'');
00993 
00994                                 // ... and any accumulated JavaScript goes the same way!
00995                         $tableJSOutput[$table] = $dblist->JScode;
00996 
00997                                 // Increase global counter:
00998                         $CMcounter+= $dblist->counter;
00999 
01000                                 // Reset variables after operation:
01001                         $dblist->HTMLcode='';
01002                         $dblist->JScode='';
01003                         $h_func = '';
01004                         $h_func_b = '';
01005                 }       // END: traverse tables
01006 
01007 
01008                         // For Context Sensitive Menus:
01009                 $CMparts = $this->doc->getContextMenuCode();
01010                 $this->doc->bodyTagAdditions = $CMparts[1];
01011                 $this->doc->JScode.= $CMparts[0];
01012                 $this->doc->postCode.= $CMparts[2];
01013 
01014 
01015                         // Draw the page header.
01016                 $headerSection = $this->doc->getHeader('pages',$this->pageinfo,$this->pageinfo['_thePath']).'<br />'.
01017                                                 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path',1).': '.
01018                                                 '<span title="'.htmlspecialchars($this->pageinfo['_thePathFull']).'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'],-50)).'</span>';
01019 
01020 
01021                         // Create icon "toolbar" for common operations like creating/moving elements/pages etc.
01022                 $toolBar='';
01023                         // History:
01024                 $toolBar.='<a href="#" onclick="'.htmlspecialchars('jumpToUrl(\''.$BACK_PATH.'show_rechis.php?element='.rawurlencode('pages:'.$this->id).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')).'#latest\');return false;').'">'.
01025                                         '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/history2.gif','width="13" height="12"').' vspace="2" hspace="2" align="top" title="'.$LANG->getLL('recordHistory',1).'" alt="" />'.
01026                                         '</a>';
01027                         // New content element
01028                 $toolBar.='<a href="'.htmlspecialchars('db_new_content_el.php?id='.$this->id.'&sys_language_uid='.$this->current_sys_language.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
01029                                         '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/new_record.gif','width="16" height="12"').' vspace="2" hspace="1" align="top" title="'.$LANG->getLL('newContentElement',1).'" alt="" />'.
01030                                         '</a>';
01031                         // Move page:
01032                 $toolBar.='<a href="'.htmlspecialchars($BACK_PATH.'move_el.php?table=pages&uid='.$this->id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
01033                                         '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/move_page.gif','width="11" height="12"').' vspace="2" hspace="2" align="top" title="'.$LANG->getLL('move_page',1).'" alt="" />'.
01034                                         '</a>';
01035                         // Create new page (wizard):
01036                 $toolBar.='<a href="#" onclick="'.htmlspecialchars('jumpToUrl(\''.$BACK_PATH.'db_new.php?id='.$this->id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')).'\');return false;').'">'.
01037                                         '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/new_page.gif','width="13" height="12"').' hspace="0" vspace="2" align="top" title="'.$LANG->getLL('newPage',1).'" alt="" />'.
01038                                         '</a>';
01039                         // Edit page header:
01040                 $params='&edit[pages]['.$this->id.']=edit';
01041                 $toolBar.='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$BACK_PATH)).'">'.
01042                                         '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/edit2.gif','width="11" height="12"').' hspace="2" vspace="2" align="top" title="'.$LANG->getLL('editPageHeader',1).'" alt="" />'.
01043                                         '</a>';
01044 
01045                         // Add CSH (Context Sensitive Help) icon to tool bar:
01046                 $toolBar.= t3lib_BEfunc::cshItem($this->descrTable,'columns_'.$this->MOD_SETTINGS['function'],$BACK_PATH,'',FALSE,'margin-top: 0px; margin-bottom: 0px;');
01047 
01048                         // Wrap the toolbar into a table:
01049                 $headerSection.='
01050                         <table border="0" cellpadding="0" cellspacing="0" class="bgColor4">
01051                                 <tr>
01052                                         <td>'.$toolBar.'</td>
01053                                 </tr>
01054                         </table>';
01055 
01056 
01057                         // Create menu of table-icons for jumping to table-listing anchor points:
01058                 if ($this->MOD_SETTINGS['function']!=3 && count($tableOutput)>1)        {
01059                         $goToTable_menu = '<td valign="top" width="1%" nowrap="nowrap">'.$h_menu.'</td>';
01060                 } else {
01061                         $goToTable_menu = '';
01062                 }
01063 
01064                         // Compile the whole header section into a table: Toolbar, Table selector, Function menu(s), Page-edit icon:
01065                 $hS2='
01066                         <table border="0" cellpadding="0" cellspacing="0" width="100%">
01067                                 <tr>
01068                                         <td valign="top" width="99%">'.$headerSection.'</td>
01069                                         '.$goToTable_menu.'
01070                                         <td valign="top" width="1%">'.$this->topFuncMenu.'</td>
01071                                         <td valign="top" align="right" width="1%"><img src="clear.gif" width="1" height="3" alt="" /><br />'.$this->editIcon.'</td>
01072                                 </tr>
01073                         </table>';
01074 
01075                         // Create page header:
01076                 $this->content.=$this->doc->startPage($LANG->getLL('title'));
01077                 $this->content.=$this->doc->section('',$hS2);
01078 
01079 
01080                         // Now, create listing based on which element is selected in the function menu:
01081 
01082                 if ($this->MOD_SETTINGS['function']==3) {
01083 
01084                                 // Making page info:
01085                         $this->content.=$this->doc->spacer(10);
01086                         $this->content.=$this->doc->section($LANG->getLL('pageInformation'),$dblist->getPageInfoBox($this->pageinfo,$this->CALC_PERMS&2),0,1);
01087                 } else {
01088 
01089                                 // Add the content for each table we have rendered (traversing $tableOutput variable)
01090                         foreach($tableOutput as $table => $output)      {
01091                                 $this->content.=$this->doc->section('<a name="'.$table.'"></a>'.$dblist->activeTables[$table],$output,TRUE,TRUE,0,TRUE);
01092                                 $this->content.=$this->doc->spacer(15);
01093                                 $this->content.=$this->doc->sectionEnd();
01094                         }
01095 
01096                                 // Making search form:
01097                         if (!$this->modTSconfig['properties']['disableSearchBox'] && count($tableOutput))       {
01098                                 $this->content.=$this->doc->section($LANG->sL('LLL:EXT:lang/locallang_core.php:labels.search'),$dblist->getSearchBox(),0,1);
01099                         }
01100 
01101                                 // Making display of Sys-notes (from extension "sys_note")
01102                         $dblist->id=$this->id;
01103                         $sysNotes = $dblist->showSysNotesForPage();
01104                         if ($sysNotes)  {
01105                                 $this->content.=$this->doc->spacer(10);
01106                                 $this->content.=$this->doc->section($LANG->getLL('internalNotes'),$sysNotes,0,1);
01107                         }
01108 
01109                                 // Display advanced options: Clear cache, new record link etc:
01110                         if (!$this->modTSconfig['properties']['disableAdvanced'])       {
01111 
01112                                         // Clear cache links:
01113                                 $af_content = $this->doc->clearCacheMenu($this->id);
01114 
01115                                         // "Create new record" link:
01116                                 if (!$this->modTSconfig['properties']['noCreateRecordsLink']) {
01117                                         $af_content.='
01118 
01119                                         <!--
01120                                                 Link for creating a new record:
01121                                         -->
01122                                         <div id="typo3-newRecordLink">
01123                                                         <a href="'.htmlspecialchars($BACK_PATH.'db_new.php?id='.$this->id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
01124                                                 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/new_el.gif','width="11" height="12"').' alt="" />'.
01125                                                 $LANG->getLL('newRecordGeneral',1).
01126                                                 '</a>
01127                                         </div>';
01128                                 }
01129 
01130                                         // Add content of the advanced-options section:
01131                                 $this->content.=$this->doc->spacer(10);
01132                                 $this->content.=$this->doc->section($LANG->getLL('advancedFunctions'),$af_content,0,1);
01133                         }
01134 
01135                                 // Add spacer in bottom of page:
01136                         $this->content.=$this->doc->spacer(10);
01137                 }
01138         }
01139 
01145         function printContent() {
01146                 echo $this->content;
01147         }
01148 
01149 
01150 
01151 
01152 
01153 
01154 
01155 
01156 
01157 
01158 
01159 
01160 
01161         /*******************************
01162          *
01163          * Other functions
01164          *
01165          ******************************/
01166 
01172         function getNumberOfHiddenElements()    {
01173                 $q_res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'tt_content', 'pid='.intval($this->id).' AND sys_language_uid='.intval($this->current_sys_language).t3lib_BEfunc::BEenableFields('tt_content',1).t3lib_BEfunc::deleteClause('tt_content'));
01174                 list($q_count) = $GLOBALS['TYPO3_DB']->sql_fetch_row($q_res);
01175                 return $q_count;
01176         }
01177 
01185         function local_linkThisScript($params)  {
01186                 $params['popView']='';
01187                 $params['new_unique_uid']='';
01188                 return t3lib_div::linkThisScript($params);
01189         }
01190 
01197         function exec_languageQuery($id)        {
01198                 $exQ = $GLOBALS['BE_USER']->isAdmin() ? '' : ' AND sys_language.hidden=0';
01199                 if ($id)        {
01200                         return $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01201                                                         'sys_language.*',
01202                                                         'pages_language_overlay,sys_language',
01203                                                         'pages_language_overlay.sys_language_uid=sys_language.uid AND pages_language_overlay.pid='.intval($id).$exQ,
01204                                                         'pages_language_overlay.sys_language_uid,sys_language.uid,sys_language.pid,sys_language.tstamp,sys_language.hidden,sys_language.title,sys_language.static_lang_isocode,sys_language.flag',
01205                                                         'sys_language.title'
01206                                                 );
01207                 } else {
01208                         return $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01209                                                         'sys_language.*',
01210                                                         'sys_language',
01211                                                         'sys_language.hidden=0',
01212                                                         '',
01213                                                         'sys_language.title'
01214                                                 );
01215                 }
01216         }
01217 }
01218 
01219 // Include extension?
01220 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/layout/db_layout.php'])    {
01221         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/layout/db_layout.php']);
01222 }
01223 
01224 
01225 
01226 
01227 
01228 
01229 
01230 
01231 
01232 
01233 
01234 
01235 // Make instance:
01236 $SOBE = t3lib_div::makeInstance('SC_db_layout');
01237 $SOBE->init();
01238 
01239 // Include files?
01240 foreach($SOBE->include_once as $INC_FILE)       include_once($INC_FILE);
01241 
01242 $SOBE->clearCache();
01243 $SOBE->main();
01244 $SOBE->printContent();
01245 ?>


Généré par Le spécialiste TYPO3 avec  doxygen 1.4.6