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


Généré par L'expert TYPO3 avec  doxygen 1.4.6