Documentation TYPO3 par Ameos

db_layout.php

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


Généré par Les spécialistes TYPO3 avec  doxygen 1.4.6