|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com) 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00027 /** 00028 * Module: Web>Page 00029 * 00030 * This module lets you view a page in a more Content Management like style than the ordinary record-list 00031 * 00032 * $Id: db_layout.php 10295 2011-01-25 09:33:06Z baschny $ 00033 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj 00034 * XHTML compliant 00035 * 00036 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00037 */ 00038 /** 00039 * [CLASS/FUNCTION INDEX of SCRIPT] 00040 * 00041 * 00042 * 00043 * 106: class ext_posMap extends t3lib_positionMap 00044 * 117: function wrapRecordTitle($str,$row) 00045 * 130: function wrapColumnHeader($str,$vv) 00046 * 144: function onClickInsertRecord($row,$vv,$moveUid,$pid) 00047 * 160: function wrapRecordHeader($str,$row) 00048 * 00049 * 00050 * 181: class SC_db_layout 00051 * 230: function init() 00052 * 283: function menuConfig() 00053 * 372: function clearCache() 00054 * 387: function main() 00055 * 489: function renderQuickEdit() 00056 * 886: function renderListContent() 00057 * 1165: function printContent() 00058 * 00059 * SECTION: Other functions 00060 * 1192: function getNumberOfHiddenElements() 00061 * 1205: function local_linkThisScript($params) 00062 * 1217: function exec_languageQuery($id) 00063 * 00064 * TOTAL FUNCTIONS: 14 00065 * (This index is automatically created/updated by the extension "extdeveval") 00066 * 00067 */ 00068 00069 00070 unset($MCONF); 00071 require('conf.php'); 00072 require($BACK_PATH.'init.php'); 00073 require($BACK_PATH.'template.php'); 00074 $LANG->includeLLFile('EXT:cms/layout/locallang.xml'); 00075 require_once(PATH_typo3.'class.db_list.inc'); 00076 require_once('class.tx_cms_layout.php'); 00077 $BE_USER->modAccess($MCONF,1); 00078 00079 // Will open up records locked by current user. It's assumed that the locking should end if this script is hit. 00080 t3lib_BEfunc::lockRecords(); 00081 00082 // Exits if 'cms' extension is not loaded: 00083 t3lib_extMgm::isLoaded('cms',1); 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 /** 00096 * Local extension of position map class 00097 * 00098 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00099 * @package TYPO3 00100 * @subpackage core 00101 */ 00102 class ext_posMap extends t3lib_positionMap { 00103 var $dontPrintPageInsertIcons = 1; 00104 var $l_insertNewRecordHere='newContentElement'; 00105 00106 /** 00107 * Wrapping the title of the record. 00108 * 00109 * @param string The title value. 00110 * @param array The record row. 00111 * @return string Wrapped title string. 00112 */ 00113 function wrapRecordTitle($str,$row) { 00114 $aOnClick = 'jumpToUrl(\''.$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:'.$row['uid'])).'\');return false;'; 00115 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>'; 00116 } 00117 00118 /** 00119 * Wrapping the column header 00120 * 00121 * @param string Header value 00122 * @param string Column info. 00123 * @return string 00124 * @see printRecordMap() 00125 */ 00126 function wrapColumnHeader($str,$vv) { 00127 $aOnClick = 'jumpToUrl(\''.$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'_EDIT_COL:'.$vv)).'\');return false;'; 00128 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>'; 00129 } 00130 00131 /** 00132 * Create on-click event value. 00133 * 00134 * @param array The record. 00135 * @param string Column position value. 00136 * @param integer Move uid 00137 * @param integer PID value. 00138 * @return string 00139 */ 00140 function onClickInsertRecord($row,$vv,$moveUid,$pid) { 00141 if (is_array($row)) { 00142 $location=$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:new/-'.$row['uid'].'/'.$row['colPos'])); 00143 } else { 00144 $location=$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:new/'.$pid.'/'.$vv)); 00145 } 00146 return 'jumpToUrl(\''.$location.'\');return false;'; 00147 } 00148 00149 /** 00150 * Wrapping the record header (from getRecordHeader()) 00151 * 00152 * @param string HTML content 00153 * @param array Record array. 00154 * @return string HTML content 00155 */ 00156 function wrapRecordHeader($str,$row) { 00157 if ($row['uid']==$this->moveUid) { 00158 return '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/content_client.gif','width="7" height="10"').' alt="" />'.$str; 00159 } else return $str; 00160 } 00161 } 00162 00163 00164 00165 00166 00167 00168 00169 00170 /** 00171 * Script Class for Web > Layout module 00172 * 00173 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00174 * @package TYPO3 00175 * @subpackage core 00176 */ 00177 class SC_db_layout { 00178 00179 // Internal, GPvars: 00180 var $id; // Page Id for which to make the listing 00181 var $pointer; // Pointer - for browsing list of records. 00182 var $imagemode; // Thumbnails or not 00183 00184 var $search_field; // Search-fields 00185 var $search_levels; // Search-levels 00186 var $showLimit; // Show-limit 00187 var $returnUrl; // Return URL 00188 00189 var $clear_cache; // Clear-cache flag - if set, clears page cache for current id. 00190 var $popView; // PopView id - for opening a window with the page 00191 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). 00192 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. 00193 00194 // Internal, static: 00195 var $perms_clause; // Page select perms clause 00196 var $modTSconfig; // Module TSconfig 00197 var $pageinfo; // Current ids page record 00198 00199 /** 00200 * Document template object 00201 * 00202 * @var mediumDoc 00203 */ 00204 var $doc; 00205 var $backPath; // Back path of the module 00206 00207 var $descrTable; // "Pseudo" Description -table name 00208 var $colPosList; // List of column-integers to edit. Is set from TSconfig, default is "1,0,2,3" 00209 var $EDIT_CONTENT; // Flag: If content can be edited or not. 00210 var $CALC_PERMS; // Users permissions integer for this page. 00211 var $current_sys_language; // Currently selected language for editing content elements 00212 00213 var $MCONF=array(); // Module configuration 00214 var $MOD_MENU=array(); // Menu configuration 00215 var $MOD_SETTINGS=array(); // Module settings (session variable) 00216 var $include_once=array(); // Array, where files to include is accumulated in the init() function 00217 var $externalTables = array(); // Array of tables to be listed by the Web > Page module in addition to the default tables 00218 00219 // Internal, dynamic: 00220 var $content; // Module output accumulation 00221 var $topFuncMenu; // Function menu temporary storage 00222 var $editIcon; // Temporary storage for page edit icon 00223 00224 00225 00226 00227 00228 /** 00229 * Initializing the module 00230 * 00231 * @return void 00232 */ 00233 function init() { 00234 global $BE_USER; 00235 00236 // Setting module configuration / page select clause 00237 $this->MCONF = $GLOBALS['MCONF']; 00238 $this->perms_clause = $BE_USER->getPagePermsClause(1); 00239 $this->backPath = $GLOBALS['BACK_PATH']; 00240 00241 // GPvars: 00242 $this->id = intval(t3lib_div::_GP('id')); 00243 $this->pointer = t3lib_div::_GP('pointer'); 00244 $this->imagemode = t3lib_div::_GP('imagemode'); 00245 00246 $this->clear_cache = t3lib_div::_GP('clear_cache'); 00247 $this->popView = t3lib_div::_GP('popView'); 00248 $this->edit_record = t3lib_div::_GP('edit_record'); 00249 $this->new_unique_uid = t3lib_div::_GP('new_unique_uid'); 00250 $this->search_field = t3lib_div::_GP('search_field'); 00251 $this->search_levels = t3lib_div::_GP('search_levels'); 00252 $this->showLimit = t3lib_div::_GP('showLimit'); 00253 $this->returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl')); 00254 $this->externalTables = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables']; 00255 00256 // Load page info array: 00257 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause); 00258 00259 // Initialize menu 00260 $this->menuConfig(); 00261 00262 // Setting sys language from session var: 00263 $this->current_sys_language=intval($this->MOD_SETTINGS['language']); 00264 00265 // Include scripts: QuickEdit 00266 if ($this->MOD_SETTINGS['function']==0) { 00267 $this->include_once[]=PATH_t3lib.'class.t3lib_tceforms.php'; 00268 $this->include_once[]=PATH_t3lib.'class.t3lib_clipboard.php'; 00269 $this->include_once[]=PATH_t3lib.'class.t3lib_loaddbgroup.php'; 00270 $this->include_once[]=PATH_t3lib.'class.t3lib_transferdata.php'; 00271 } 00272 00273 // Include scripts: Clear-cache cmd. 00274 if ($this->clear_cache) { 00275 $this->include_once[]=PATH_t3lib.'class.t3lib_tcemain.php'; 00276 } 00277 00278 // CSH / Descriptions: 00279 $this->descrTable = '_MOD_'.$this->MCONF['name']; 00280 } 00281 00282 /** 00283 * Initialize menu array 00284 * 00285 * @return void 00286 */ 00287 function menuConfig() { 00288 global $BE_USER,$LANG,$TYPO3_CONF_VARS; 00289 00290 // MENU-ITEMS: 00291 $this->MOD_MENU = array( 00292 'tt_board' => array( 00293 0 => $LANG->getLL('m_tt_board_0'), 00294 'expand' => $LANG->getLL('m_tt_board_expand') 00295 ), 00296 'tt_address' => array( 00297 0 => $LANG->getLL('m_tt_address_0'), 00298 1 => $LANG->getLL('m_tt_address_1'), 00299 2 => $LANG->getLL('m_tt_address_2') 00300 ), 00301 'tt_links' => array( 00302 0 => $LANG->getLL('m_default'), 00303 1 => $LANG->getLL('m_tt_links_1'), 00304 2 => $LANG->getLL('m_tt_links_2') 00305 ), 00306 'tt_calender' => array ( 00307 0 => $LANG->getLL('m_default'), 00308 'date' => $LANG->getLL('m_tt_calender_date'), 00309 'date_ext' => $LANG->getLL('m_tt_calender_date_ext'), 00310 'todo' => $LANG->getLL('m_tt_calender_todo'), 00311 'todo_ext' => $LANG->getLL('m_tt_calender_todo_ext') 00312 ), 00313 'tt_products' => array ( 00314 0 => $LANG->getLL('m_default'), 00315 'ext' => $LANG->getLL('m_tt_products_ext') 00316 ), 00317 'tt_content_showHidden' => '', 00318 'showPalettes' => '', 00319 'showDescriptions' => '', 00320 'disableRTE' => '', 00321 'function' => array( 00322 0 => $LANG->getLL('m_function_0'), 00323 1 => $LANG->getLL('m_function_1'), 00324 2 => $LANG->getLL('m_function_2'), 00325 3 => $LANG->getLL('pageInformation'), 00326 ), 00327 'language' => array( 00328 0 => $LANG->getLL('m_default') 00329 ) 00330 ); 00331 00332 // example settings: 00333 // $TYPO3_CONF_VARS['EXTCONF']['cms']['db_layout']['addTables']['tx_myext'] = 00334 // array ('default' => array( 00335 // 'MENU' => 'LLL:EXT:tx_myext/locallang_db.xml:menuDefault', 00336 // 'fList' => 'title,description,image', 00337 // 'icon' => TRUE), 00338 if (is_array($this->externalTables)) { 00339 foreach ($this->externalTables as $table => $tableSettings) { 00340 // delete the default settings from above 00341 if (is_array($this->MOD_MENU[$table])) { 00342 unset ($this->MOD_MENU[$table]); 00343 } 00344 if (is_array($tableSettings) && count($tableSettings) > 1) { 00345 foreach ($tableSettings as $key => $settings) { 00346 $this->MOD_MENU[$table][$key] = $LANG->sL($settings['MENU']); 00347 } 00348 } 00349 } 00350 } 00351 00352 // 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. 00353 $res = $this->exec_languageQuery($this->id); 00354 while($lrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00355 if ($GLOBALS['BE_USER']->checkLanguageAccess($lrow['uid'])) { 00356 $this->MOD_MENU['language'][$lrow['uid']]=($lrow['hidden']?'('.$lrow['title'].')':$lrow['title']); 00357 } 00358 } 00359 00360 // Find if there are ANY languages at all (and if not, remove the language option from function menu). 00361 $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'sys_language', ($BE_USER->isAdmin() ? '' : 'hidden=0')); 00362 if (!$count) { 00363 unset($this->MOD_MENU['function']['2']); 00364 } 00365 00366 // page/be_user TSconfig settings and blinding of menu-items 00367 $this->modSharedTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED'); 00368 $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']); 00369 if ($this->modTSconfig['properties']['QEisDefault']) ksort($this->MOD_MENU['function']); 00370 $this->MOD_MENU['function'] = t3lib_BEfunc::unsetMenuItems($this->modTSconfig['properties'],$this->MOD_MENU['function'],'menu.function'); 00371 00372 // Remove QuickEdit as option if page type is not... 00373 if (!t3lib_div::inList($TYPO3_CONF_VARS['FE']['content_doktypes'].',6',$this->pageinfo['doktype'])) { 00374 unset($this->MOD_MENU['function'][0]); 00375 } 00376 00377 // Setting alternative default label: 00378 if (($this->modSharedTSconfig['properties']['defaultLanguageLabel'] || $this->modTSconfig['properties']['defaultLanguageLabel']) && isset($this->MOD_MENU['language'][0])) { 00379 $this->MOD_MENU['language'][0] = $this->modTSconfig['properties']['defaultLanguageLabel'] ? $this->modSharedTSconfig['properties']['defaultLanguageLabel'] : $this->modSharedTSconfig['properties']['defaultLanguageLabel']; 00380 } 00381 00382 // Clean up settings 00383 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']); 00384 00385 // For all elements to be shown in draft workspaces & to also show hidden elements by default if user hasn't disabled the option 00386 if (($GLOBALS['BE_USER']->workspace != 0) || ($this->MOD_SETTINGS['tt_content_showHidden'] !== '0')) { 00387 $this->MOD_SETTINGS['tt_content_showHidden'] = 1; 00388 } 00389 } 00390 00391 /** 00392 * Clears page cache for the current id, $this->id 00393 * 00394 * @return void 00395 */ 00396 function clearCache() { 00397 if ($this->clear_cache) { 00398 $tce = t3lib_div::makeInstance('t3lib_TCEmain'); 00399 $tce->stripslashes_values=0; 00400 $tce->start(Array(),Array()); 00401 $tce->clear_cacheCmd($this->id); 00402 } 00403 } 00404 00405 /** 00406 * Main function. 00407 * Creates some general objects and calls other functions for the main rendering of module content. 00408 * 00409 * @return void 00410 */ 00411 function main() { 00412 global $BE_USER,$LANG,$BACK_PATH; 00413 00414 // Access check... 00415 // The page will show only if there is a valid page and if this page may be viewed by the user 00416 $access = is_array($this->pageinfo) ? 1 : 0; 00417 if ($this->id && $access) { 00418 00419 // Initialize permission settings: 00420 $this->CALC_PERMS = $BE_USER->calcPerms($this->pageinfo); 00421 $this->EDIT_CONTENT = ($this->CALC_PERMS&16) ? 1 : 0; 00422 00423 // Start document template object: 00424 $this->doc = t3lib_div::makeInstance('template'); 00425 $this->doc->backPath = $BACK_PATH; 00426 $this->doc->setModuleTemplate('templates/db_layout.html'); 00427 00428 // JavaScript: 00429 $this->doc->JScode = '<script type="text/javascript" ' . 00430 'src="' . t3lib_div::createVersionNumberedFilename($BACK_PATH . '../t3lib/jsfunc.updateform.js') . '">' . 00431 '</script>'; 00432 $this->doc->JScode.= $this->doc->wrapScriptTags(' 00433 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).'; 00434 if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages'.intval($this->id).'_"+top.fsMod.currentBank; '.intval($this->id).'; 00435 function jumpToUrl(URL,formEl) { // 00436 if (document.editform && TBE_EDITOR.isFormChanged) { // Check if the function exists... (works in all browsers?) 00437 if (!TBE_EDITOR.isFormChanged()) { // 00438 window.location.href = URL; 00439 } else if (formEl) { 00440 if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1; 00441 } 00442 } else window.location.href = URL; 00443 } 00444 '.($this->popView ? t3lib_BEfunc::viewOnClick($this->id,$BACK_PATH,t3lib_BEfunc::BEgetRootLine($this->id)) : '').' 00445 00446 function deleteRecord(table,id,url) { // 00447 if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).')) { 00448 window.location.href = "'.$BACK_PATH.'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $BE_USER->veriCode() . t3lib_BEfunc::getUrlToken('tceAction') . '&prErr=1&uPT=1"; 00449 } 00450 return false; 00451 } 00452 '); 00453 $this->doc->JScode.= $this->doc->wrapScriptTags(' 00454 var DTM_array = new Array(); 00455 var DTM_origClass = new String(); 00456 00457 // if tabs are used in a popup window the array might not exists 00458 if(!top.DTM_currentTabs) { 00459 top.DTM_currentTabs = new Array(); 00460 } 00461 00462 function DTM_activate(idBase,index,doToogle) { // 00463 // Hiding all: 00464 if (DTM_array[idBase]) { 00465 for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) { 00466 if (DTM_array[idBase][cnt] != idBase+"-"+index) { 00467 document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none"; 00468 document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; 00469 } 00470 } 00471 } 00472 00473 // Showing one: 00474 if (document.getElementById(idBase+"-"+index+"-DIV")) { 00475 if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { 00476 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none"; 00477 if(DTM_origClass=="") { 00478 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; 00479 } else { 00480 DTM_origClass = "tab"; 00481 } 00482 top.DTM_currentTabs[idBase] = -1; 00483 } else { 00484 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block"; 00485 if(DTM_origClass=="") { 00486 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact"; 00487 } else { 00488 DTM_origClass = "tabact"; 00489 } 00490 top.DTM_currentTabs[idBase] = index; 00491 } 00492 } 00493 } 00494 function DTM_toggle(idBase,index,isInit) { // 00495 // Showing one: 00496 if (document.getElementById(idBase+"-"+index+"-DIV")) { 00497 if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { 00498 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none"; 00499 if(isInit) { 00500 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; 00501 } else { 00502 DTM_origClass = "tab"; 00503 } 00504 top.DTM_currentTabs[idBase+"-"+index] = 0; 00505 } else { 00506 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block"; 00507 if(isInit) { 00508 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact"; 00509 } else { 00510 DTM_origClass = "tabact"; 00511 } 00512 top.DTM_currentTabs[idBase+"-"+index] = 1; 00513 } 00514 } 00515 } 00516 00517 function DTM_mouseOver(obj) { // 00518 DTM_origClass = obj.attributes.getNamedItem(\'class\').nodeValue; 00519 obj.attributes.getNamedItem(\'class\').nodeValue += "_over"; 00520 } 00521 00522 function DTM_mouseOut(obj) { // 00523 obj.attributes.getNamedItem(\'class\').nodeValue = DTM_origClass; 00524 DTM_origClass = ""; 00525 } 00526 '); 00527 00528 // Setting doc-header 00529 $this->doc->form='<form action="'.htmlspecialchars('db_layout.php?id='.$this->id.'&imagemode='.$this->imagemode).'" method="post">'; 00530 00531 // Creating the top function menu: 00532 $this->topFuncMenu = t3lib_BEfunc::getFuncMenu($this->id,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function'],'db_layout.php',''); 00533 $this->languageMenu = (count($this->MOD_MENU['language'])>1 ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.language',1) . t3lib_BEfunc::getFuncMenu($this->id,'SET[language]',$this->current_sys_language,$this->MOD_MENU['language'],'db_layout.php','') : ''); 00534 00535 // Find columns 00536 $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id,'mod.SHARED'); // SHARED page-TSconfig settings. 00537 $this->colPosList = strcmp(trim($this->modTSconfig['properties']['tt_content.']['colPos_list']),'') ? trim($this->modTSconfig['properties']['tt_content.']['colPos_list']) : $modTSconfig_SHARED['properties']['colPos_list']; 00538 if (!strcmp($this->colPosList,'')) { 00539 $backendLayout = t3lib_div::callUserFunction( 'EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getSelectedBackendLayout' , $this->id, $this ); 00540 00541 if(count($backendLayout['__colPosList'])) { 00542 $this->colPosList = implode(',', $backendLayout['__colPosList']); 00543 } 00544 } 00545 if( !strcmp($this->colPosList, '') ){ 00546 $this->colPosList = '1,0,2,3'; 00547 } 00548 $this->colPosList = implode(',', array_unique(t3lib_div::intExplode(',',$this->colPosList))); // Removing duplicates, if any 00549 00550 // Render the primary module content: 00551 if ($this->MOD_SETTINGS['function']==0) { 00552 $body = $this->renderQuickEdit(); // QuickEdit 00553 } else { 00554 $body = $this->renderListContent(); // All other listings 00555 } 00556 00557 // If page is a folder 00558 if ($this->pageinfo['doktype'] == 254) { 00559 00560 // access to list module 00561 $moduleLoader = t3lib_div::makeInstance('t3lib_loadModules'); 00562 $moduleLoader->load($GLOBALS['TBE_MODULES']); 00563 $modules = $moduleLoader->modules; 00564 00565 if (is_array($modules['web']['sub']['list'])) { 00566 $flashMessage = t3lib_div::makeInstance( 00567 't3lib_FlashMessage', 00568 '<p>' . $GLOBALS['LANG']->getLL('goToListModuleMessage') . '</p> 00569 <br /> 00570 <p>' . 00571 t3lib_iconWorks::getSpriteIcon('actions-system-list-open') . 00572 '<a href="javascript:top.goToModule( \'web_list\',1);">' . 00573 $GLOBALS['LANG']->getLL('goToListModule') . ' 00574 </a> 00575 </p>', 00576 '', 00577 t3lib_FlashMessage::INFO 00578 ); 00579 $body = $flashMessage->render() . $body; 00580 } 00581 } 00582 00583 00584 if ($this->pageinfo['content_from_pid']) { 00585 $contentPage = t3lib_BEfunc::getRecord('pages', intval($this->pageinfo['content_from_pid'])); 00586 $title = t3lib_BEfunc::getRecordTitle('pages', $contentPage); 00587 $linkToPid = $this->local_linkThisScript(array('id' => $this->pageinfo['content_from_pid'])); 00588 $link = '<a href="' . $linkToPid . '">' . htmlspecialchars($title) . ' (PID ' . intval($this->pageinfo['content_from_pid']) . ')</a>'; 00589 $flashMessage = t3lib_div::makeInstance( 00590 't3lib_FlashMessage', 00591 '', 00592 sprintf($GLOBALS['LANG']->getLL('content_from_pid_title'), $link), 00593 t3lib_FlashMessage::INFO 00594 ); 00595 $body = $flashMessage->render() . $body; 00596 } 00597 00598 // Setting up the buttons and markers for docheader 00599 $docHeaderButtons = $this->getButtons($this->MOD_SETTINGS['function']==0 ? 'quickEdit' : ''); 00600 $markers = array( 00601 'CSH' => $docHeaderButtons['csh'], 00602 'TOP_FUNCTION_MENU' => $this->editSelect . $this->topFuncMenu, 00603 'LANGSELECTOR' => $this->languageMenu, 00604 'CONTENT' => $body 00605 ); 00606 00607 // Build the <body> for the module 00608 $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); 00609 // Renders the module page 00610 $this->content = $this->doc->render( 00611 $LANG->getLL('title'), 00612 $this->content 00613 ); 00614 00615 } else { 00616 00617 // If no access or id value, create empty document: 00618 $this->doc = t3lib_div::makeInstance('template'); 00619 $this->doc->backPath = $BACK_PATH; 00620 $this->doc->setModuleTemplate('templates/db_layout.html'); 00621 00622 $this->doc->JScode = $this->doc->wrapScriptTags(' 00623 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).'; 00624 '); 00625 00626 $flashMessage = t3lib_div::makeInstance( 00627 't3lib_FlashMessage', 00628 $LANG->getLL('clickAPage_content'), 00629 $LANG->getLL('clickAPage_header'), 00630 t3lib_FlashMessage::INFO 00631 ); 00632 $body = $flashMessage->render(); 00633 00634 // Setting up the buttons and markers for docheader 00635 $docHeaderButtons = array( 00636 'view' => '', 00637 'history_page' => '', 00638 'new_content' => '', 00639 'move_page' => '', 00640 'move_record' => '', 00641 'new_page' => '', 00642 'edit_page' => '', 00643 'record_list' => '', 00644 'csh' => '', 00645 'shortcut' => '', 00646 'cache' => '', 00647 'savedok' => '', 00648 'savedokshow' => '', 00649 'closedok' => '', 00650 'deletedok' => '', 00651 'undo' => '', 00652 'history_record' => '' 00653 ); 00654 00655 $markers = array( 00656 'CSH' => t3lib_BEfunc::cshItem($this->descrTable, '', $BACK_PATH, '', TRUE), 00657 'TOP_FUNCTION_MENU' => '', 00658 'LANGSELECTOR' => '', 00659 'CONTENT' => $body 00660 ); 00661 00662 $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); 00663 // Renders the module page 00664 $this->content = $this->doc->render( 00665 $LANG->getLL('title'), 00666 $this->content 00667 ); 00668 } 00669 } 00670 00671 /** 00672 * Rendering the quick-edit view. 00673 * 00674 * @return void 00675 */ 00676 function renderQuickEdit() { 00677 global $LANG,$BE_USER,$BACK_PATH; 00678 // Alternative template 00679 $this->doc->setModuleTemplate('templates/db_layout_quickedit.html'); 00680 00681 // Alternative form tag; Quick Edit submits its content to tce_db.php. 00682 $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);">'; 00683 00684 // Setting up the context sensitive menu: 00685 $this->doc->getContextMenuCode(); 00686 00687 // Set the edit_record value for internal use in this function: 00688 $edit_record = $this->edit_record; 00689 00690 // If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php: 00691 if (substr($edit_record,0,9)=='_EDIT_COL') { 00692 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 00693 '*', 00694 'tt_content', 00695 'pid='.intval($this->id).' AND colPos='.intval(substr($edit_record,10)).' AND sys_language_uid='.intval($this->current_sys_language). 00696 ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')). 00697 t3lib_BEfunc::deleteClause('tt_content'). 00698 t3lib_BEfunc::versioningPlaceholderClause('tt_content'), 00699 '', 00700 'sorting' 00701 ); 00702 $idListA = array(); 00703 while($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00704 $idListA[] = $cRow['uid']; 00705 } 00706 00707 $url = $BACK_PATH.'alt_doc.php?edit[tt_content]['.implode(',',$idListA).']=edit&returnUrl='.rawurlencode($this->local_linkThisScript(array('edit_record'=>''))); 00708 t3lib_utility_Http::redirect($url); 00709 } 00710 00711 // If the former record edited was the creation of a NEW record, this will look up the created records uid: 00712 if ($this->new_unique_uid) { 00713 $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')); 00714 $sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); 00715 if (is_array($sys_log_row)) { 00716 $edit_record=$sys_log_row['tablename'].':'.$sys_log_row['recuid']; 00717 } 00718 } 00719 00720 00721 // Creating the selector box, allowing the user to select which element to edit: 00722 $opt=array(); 00723 $is_selected=0; 00724 $languageOverlayRecord=''; 00725 if ($this->current_sys_language) { 00726 list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$this->id,'AND sys_language_uid='.intval($this->current_sys_language)); 00727 } 00728 if (is_array($languageOverlayRecord)) { 00729 $inValue = 'pages_language_overlay:'.$languageOverlayRecord['uid']; 00730 $is_selected+=intval($edit_record==$inValue); 00731 $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('editLanguageHeader',1).' ]</option>'; 00732 } else { 00733 $inValue = 'pages:'.$this->id; 00734 $is_selected+=intval($edit_record==$inValue); 00735 $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('editPageProperties',1).' ]</option>'; 00736 } 00737 00738 // Selecting all content elements from this language and allowed colPos: 00739 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 00740 '*', 00741 'tt_content', 00742 'pid='.intval($this->id).' AND sys_language_uid='.intval($this->current_sys_language).' AND colPos IN ('.$this->colPosList.')'. 00743 ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')). 00744 t3lib_Befunc::deleteClause('tt_content'). 00745 t3lib_BEfunc::versioningPlaceholderClause('tt_content'), 00746 '', 00747 'colPos,sorting' 00748 ); 00749 $colPos=''; 00750 $first=1; 00751 $prev=$this->id; // Page is the pid if no record to put this after. 00752 while($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00753 t3lib_BEfunc::workspaceOL('tt_content', $cRow); 00754 00755 if (is_array($cRow)) { 00756 if ($first) { 00757 if (!$edit_record) { 00758 $edit_record='tt_content:'.$cRow['uid']; 00759 } 00760 $first = 0; 00761 } 00762 if (strcmp($cRow['colPos'],$colPos)) { 00763 $colPos=$cRow['colPos']; 00764 $opt[]='<option value=""></option>'; 00765 $opt[]='<option value="_EDIT_COL:'.$colPos.'">__'.$LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','colPos',$colPos),1).':__</option>'; 00766 } 00767 $inValue = 'tt_content:'.$cRow['uid']; 00768 $is_selected+=intval($edit_record==$inValue); 00769 $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>'; 00770 $prev=-$cRow['uid']; 00771 } 00772 } 00773 00774 // If edit_record is not set (meaning, no content elements was found for this language) we simply set it to create a new element: 00775 if (!$edit_record) { 00776 $edit_record='tt_content:new/'.$prev.'/'.$colPos; 00777 00778 $inValue = 'tt_content:new/'.$prev.'/'.$colPos; 00779 $is_selected+=intval($edit_record==$inValue); 00780 $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('newLabel',1).' ]</option>'; 00781 } 00782 00783 // If none is yet selected... 00784 if (!$is_selected) { 00785 $opt[]='<option value=""></option>'; 00786 $opt[]='<option value="'.$edit_record.'" selected="selected">[ '.$LANG->getLL('newLabel',1).' ]</option>'; 00787 } 00788 00789 00790 // Splitting the edit-record cmd value into table/uid: 00791 $this->eRParts = explode(':',$edit_record); 00792 00793 00794 00795 // Delete-button flag? 00796 $this->deleteButton = (t3lib_div::testInt($this->eRParts[1]) && $edit_record && (($this->eRParts[0]!='pages'&&$this->EDIT_CONTENT) || ($this->eRParts[0]=='pages'&&($this->CALC_PERMS&4)))); 00797 00798 // If undo-button should be rendered (depends on available items in sys_history) 00799 $this->undoButton=0; 00800 $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->eRParts[0], 'sys_history').' AND recuid='.intval($this->eRParts[1]), '', 'tstamp DESC', '1'); 00801 if ($this->undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) { 00802 $this->undoButton=1; 00803 } 00804 00805 // Setting up the Return URL for coming back to THIS script (if links take the user to another script) 00806 $R_URL_parts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI')); 00807 $R_URL_getvars = t3lib_div::_GET(); 00808 00809 unset($R_URL_getvars['popView']); 00810 unset($R_URL_getvars['new_unique_uid']); 00811 $R_URL_getvars['edit_record']=$edit_record; 00812 $this->R_URI = $R_URL_parts['path'].'?'.t3lib_div::implodeArrayForUrl('',$R_URL_getvars); 00813 00814 // Setting close url/return url for exiting this script: 00815 $this->closeUrl = $this->local_linkThisScript(array('SET'=>array('function'=>1))); // Goes to 'Columns' view if close is pressed (default) 00816 00817 if ($BE_USER->uc['condensedMode']) { 00818 $this->closeUrl = $BACK_PATH.'alt_db_navframe.php'; 00819 } 00820 if ($this->returnUrl) { 00821 $this->closeUrl = $this->returnUrl; 00822 } 00823 // Return-url for JavaScript: 00824 $retUrlStr = $this->returnUrl?"+'&returnUrl='+'".rawurlencode($this->returnUrl)."'":''; 00825 00826 // Drawing the edit record selectbox 00827 $this->editSelect = '<select name="edit_record" onchange="' . htmlspecialchars('jumpToUrl(\'db_layout.php?id=' . $this->id . '&edit_record=\'+escape(this.options[this.selectedIndex].value)' . $retUrlStr . ',this);') . '">' . implode('', $opt) . '</select>'; 00828 00829 // Creating editing form: 00830 if ($BE_USER->check('tables_modify',$this->eRParts[0]) && $edit_record && (($this->eRParts[0]!='pages'&&$this->EDIT_CONTENT) || ($this->eRParts[0]=='pages'&&($this->CALC_PERMS&1)))) { 00831 00832 // Splitting uid parts for special features, if new: 00833 list($uidVal,$ex_pid,$ex_colPos) = explode('/',$this->eRParts[1]); 00834 00835 // Convert $uidVal to workspace version if any: 00836 if ($uidVal!='new') { 00837 if ($draftRecord = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->eRParts[0], $uidVal, 'uid')) { 00838 $uidVal = $draftRecord['uid']; 00839 } 00840 } 00841 00842 // Initializing transfer-data object: 00843 $trData = t3lib_div::makeInstance('t3lib_transferData'); 00844 $trData->addRawData = TRUE; 00845 $trData->defVals[$this->eRParts[0]] = array ( 00846 'colPos' => intval($ex_colPos), 00847 'sys_language_uid' => intval($this->current_sys_language) 00848 ); 00849 $trData->disableRTE = $this->MOD_SETTINGS['disableRTE']; 00850 $trData->lockRecords=1; 00851 $trData->fetchRecord($this->eRParts[0],($uidVal=='new'?$this->id:$uidVal),$uidVal); // 'new' 00852 00853 // Getting/Making the record: 00854 reset($trData->regTableItems_data); 00855 $rec = current($trData->regTableItems_data); 00856 if ($uidVal=='new') { 00857 $new_unique_uid = uniqid('NEW'); 00858 $rec['uid'] = $new_unique_uid; 00859 $rec['pid'] = intval($ex_pid)?intval($ex_pid):$this->id; 00860 $recordAccess = TRUE; 00861 } else { 00862 $rec['uid'] = $uidVal; 00863 00864 // Checking internals access: 00865 $recordAccess = $BE_USER->recordEditAccessInternals($this->eRParts[0],$uidVal); 00866 } 00867 00868 if (!$recordAccess) { 00869 // If no edit access, print error message: 00870 $content.=$this->doc->section($LANG->getLL('noAccess'),$LANG->getLL('noAccess_msg').'<br /><br />'. 00871 ($BE_USER->errorMsg ? 'Reason: ' . $BE_USER->errorMsg . '<br /><br />' : ''), 0, 1); 00872 } elseif (is_array($rec)) { // If the record is an array (which it will always be... :-) 00873 00874 // Create instance of TCEforms, setting defaults: 00875 $tceforms = t3lib_div::makeInstance('t3lib_TCEforms'); 00876 $tceforms->backPath = $BACK_PATH; 00877 $tceforms->initDefaultBEMode(); 00878 $tceforms->fieldOrder = $this->modTSconfig['properties']['tt_content.']['fieldOrder']; 00879 $tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes']; 00880 $tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE']; 00881 $tceforms->enableClickMenu = TRUE; 00882 00883 // Clipboard is initialized: 00884 $tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard'); // Start clipboard 00885 $tceforms->clipObj->initializeClipboard(); // Initialize - reads the clipboard content from the user session 00886 00887 00888 if ($BE_USER->uc['edit_showFieldHelp']!='text' && $this->MOD_SETTINGS['showDescriptions']) $tceforms->edit_showFieldHelp='text'; 00889 00890 // Render form, wrap it: 00891 $panel=''; 00892 $panel.=$tceforms->getMainFields($this->eRParts[0],$rec); 00893 $panel=$tceforms->wrapTotal($panel,$rec,$this->eRParts[0]); 00894 00895 // Add hidden fields: 00896 $theCode=$panel; 00897 if ($uidVal=='new') { 00898 $theCode.='<input type="hidden" name="data['.$this->eRParts[0].']['.$rec['uid'].'][pid]" value="'.$rec['pid'].'" />'; 00899 } 00900 $theCode.=' 00901 <input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" /> 00902 <input type="hidden" name="_disableRTE" value="'.$tceforms->disableRTE.'" /> 00903 <input type="hidden" name="edit_record" value="'.$edit_record.'" /> 00904 <input type="hidden" name="redirect" value="'.htmlspecialchars($uidVal=='new' ? t3lib_extMgm::extRelPath('cms').'layout/db_layout.php?id='.$this->id.'&new_unique_uid='.$new_unique_uid.'&returnUrl='.rawurlencode($this->returnUrl) : $this->R_URI ).'" /> 00905 ' . t3lib_TCEforms::getHiddenTokenField('tceAction'); 00906 00907 // Add JavaScript as needed around the form: 00908 $theCode=$tceforms->printNeededJSFunctions_top().$theCode.$tceforms->printNeededJSFunctions(); 00909 00910 // Add warning sign if record was "locked": 00911 if ($lockInfo = t3lib_BEfunc::isRecordLocked($this->eRParts[0], $rec['uid'])) { 00912 $lockedMessage = t3lib_div::makeInstance( 00913 't3lib_FlashMessage', 00914 htmlspecialchars($lockInfo['msg']), 00915 '', 00916 t3lib_FlashMessage::WARNING 00917 ); 00918 t3lib_FlashMessageQueue::addMessage($lockedMessage); 00919 } 00920 00921 // Add whole form as a document section: 00922 $content .= $this->doc->section('', $theCode); 00923 } 00924 } else { 00925 // If no edit access, print error message: 00926 $content.=$this->doc->section($LANG->getLL('noAccess'),$LANG->getLL('noAccess_msg').'<br /><br />',0,1); 00927 } 00928 00929 00930 // Bottom controls (function menus): 00931 $q_count = $this->getNumberOfHiddenElements(); 00932 $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"'). 00933 '<label for="checkTt_content_showHidden">'.(!$q_count?$GLOBALS['TBE_TEMPLATE']->dfw($LANG->getLL('hiddenCE',1)):$LANG->getLL('hiddenCE',1).' ('.$q_count.')').'</label>'; 00934 00935 $h_func_b.= '<br />'. 00936 t3lib_BEfunc::getFuncCheck($this->id,'SET[showPalettes]',$this->MOD_SETTINGS['showPalettes'],'db_layout.php','','id="checkShowPalettes"'). 00937 '<label for="checkShowPalettes">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPalettes',1).'</label>'; 00938 00939 if (t3lib_extMgm::isLoaded('context_help') && $BE_USER->uc['edit_showFieldHelp']!='text') { 00940 $h_func_b.= '<br />'. 00941 t3lib_BEfunc::getFuncCheck($this->id,'SET[showDescriptions]',$this->MOD_SETTINGS['showDescriptions'],'db_layout.php','','id="checkShowDescriptions"'). 00942 '<label for="checkShowDescriptions">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showDescriptions',1).'</label>'; 00943 } 00944 00945 if ($BE_USER->isRTE()) { 00946 $h_func_b.= '<br />'. 00947 t3lib_BEfunc::getFuncCheck($this->id,'SET[disableRTE]',$this->MOD_SETTINGS['disableRTE'],'db_layout.php','','id="checkDisableRTE"'). 00948 '<label for="checkDisableRTE">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.disableRTE',1).'</label>'; 00949 } 00950 00951 // Add the function menus to bottom: 00952 $content.=$this->doc->section('',$h_func_b,0,0); 00953 $content.=$this->doc->spacer(10); 00954 00955 00956 // Select element matrix: 00957 if ($this->eRParts[0]=='tt_content' && t3lib_div::testInt($this->eRParts[1])) { 00958 $posMap = t3lib_div::makeInstance('ext_posMap'); 00959 $posMap->backPath = $BACK_PATH; 00960 $posMap->cur_sys_language=$this->current_sys_language; 00961 00962 $HTMLcode = ''; 00963 00964 // CSH: 00965 $HTMLcode.= t3lib_BEfunc::cshItem($this->descrTable, 'quickEdit_selElement', $BACK_PATH, '|<br />'); 00966 00967 $HTMLcode.=$posMap->printContentElementColumns($this->id,$this->eRParts[1],$this->colPosList,$this->MOD_SETTINGS['tt_content_showHidden'],$this->R_URI); 00968 00969 $content.=$this->doc->spacer(20); 00970 $content.=$this->doc->section($LANG->getLL('CEonThisPage'),$HTMLcode,0,1); 00971 $content.=$this->doc->spacer(20); 00972 } 00973 00974 // Finally, if comments were generated in TCEforms object, print these as a HTML comment: 00975 if (count($tceforms->commentMessages)) { 00976 $content.=' 00977 <!-- TCEFORM messages 00978 '.htmlspecialchars(implode(LF,$tceforms->commentMessages)).' 00979 --> 00980 '; 00981 } 00982 return $content; 00983 } 00984 00985 /** 00986 * Rendering all other listings than QuickEdit 00987 * 00988 * @return void 00989 */ 00990 function renderListContent() { 00991 global $LANG,$BACK_PATH,$TCA; 00992 00993 // Initialize list object (see "class.db_layout.inc"): 00994 $dblist = t3lib_div::makeInstance('tx_cms_layout'); 00995 $dblist->backPath = $BACK_PATH; 00996 $dblist->thumbs = $this->imagemode; 00997 $dblist->no_noWrap = 1; 00998 $dblist->descrTable = $this->descrTable; 00999 01000 $this->pointer = t3lib_div::intInRange($this->pointer,0,100000); 01001 $dblist->script = 'db_layout.php'; 01002 $dblist->showIcon = 0; 01003 $dblist->setLMargin=0; 01004 $dblist->doEdit = $this->EDIT_CONTENT; 01005 $dblist->ext_CALC_PERMS = $this->CALC_PERMS; 01006 01007 $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears'); 01008 $dblist->id = $this->id; 01009 $dblist->nextThree = t3lib_div::intInRange($this->modTSconfig['properties']['editFieldsAtATime'],0,10); 01010 $dblist->option_showBigButtons = ($this->modTSconfig['properties']['disableBigButtons'] === '0'); 01011 $dblist->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1; 01012 $dblist->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0; 01013 if (!$dblist->nextThree) $dblist->nextThree = 1; 01014 01015 $dblist->externalTables = $this->externalTables; 01016 01017 // Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!) 01018 $h_menu = $dblist->getTableMenu($this->id); 01019 01020 // Initialize other variables: 01021 $h_func=''; 01022 $tableOutput=array(); 01023 $tableJSOutput=array(); 01024 $CMcounter = 0; 01025 01026 // Traverse the list of table names which has records on this page (that array is populated by the $dblist object during the function getTableMenu()): 01027 foreach ($dblist->activeTables as $table => $value) { 01028 01029 // Load full table definitions: 01030 t3lib_div::loadTCA($table); 01031 01032 if (!isset($dblist->externalTables[$table])) { 01033 // Creating special conditions for each table: 01034 switch($table) { 01035 case 'tt_board': 01036 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_board]',$this->MOD_SETTINGS['tt_board'],$this->MOD_MENU['tt_board'],'db_layout.php',''); 01037 break; 01038 case 'tt_address': 01039 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_address]',$this->MOD_SETTINGS['tt_address'],$this->MOD_MENU['tt_address'],'db_layout.php',''); 01040 break; 01041 case 'tt_links': 01042 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_links]',$this->MOD_SETTINGS['tt_links'],$this->MOD_MENU['tt_links'],'db_layout.php',''); 01043 break; 01044 case 'tt_calender': 01045 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_calender]',$this->MOD_SETTINGS['tt_calender'],$this->MOD_MENU['tt_calender'],'db_layout.php',''); 01046 break; 01047 case 'tt_products': 01048 $h_func = t3lib_BEfunc::getFuncMenu($this->id,'SET[tt_products]',$this->MOD_SETTINGS['tt_products'],$this->MOD_MENU['tt_products'],'db_layout.php',''); 01049 break; 01050 case 'tt_guest': 01051 case 'tt_news': 01052 case 'fe_users': 01053 // Nothing 01054 break; 01055 case 'tt_content': 01056 $q_count = $this->getNumberOfHiddenElements(); 01057 $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>'; 01058 01059 $dblist->tt_contentConfig['showCommands'] = 1; // Boolean: Display up/down arrows and edit icons for tt_content records 01060 $dblist->tt_contentConfig['showInfo'] = 1; // Boolean: Display info-marks or not 01061 $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 01062 01063 if ($this->MOD_SETTINGS['function'] == 4) { 01064 // grid view 01065 $dblist->tt_contentConfig['showAsGrid'] = 1; 01066 } 01067 01068 // Setting up the tt_content columns to show: 01069 if (is_array($TCA['tt_content']['columns']['colPos']['config']['items'])) { 01070 $colList = array(); 01071 $tcaItems = t3lib_div::callUserFunction( 'EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getColPosListItemsParsed' , $this->id, $this ); 01072 foreach($tcaItems as $temp) { 01073 $colList[] = $temp[1]; 01074 } 01075 } else { // ... should be impossible that colPos has no array. But this is the fallback should it make any sense: 01076 $colList = array('1','0','2','3'); 01077 } 01078 if (strcmp($this->colPosList,'')) { 01079 $colList = array_intersect(t3lib_div::intExplode(',',$this->colPosList),$colList); 01080 } 01081 01082 // If only one column found, display the single-column view. 01083 if (count($colList) === 1 && !$this->MOD_SETTINGS['function'] === 4) { 01084 $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 01085 $dblist->tt_contentConfig['showSingleCol'] = current($colList); // The column(s) to show if single mode (under each other) 01086 } 01087 $dblist->tt_contentConfig['cols'] = implode(',',$colList); // The order of the rows: Default is left(1), Normal(0), right(2), margin(3) 01088 $dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden']; 01089 $dblist->tt_contentConfig['sys_language_uid'] = intval($this->current_sys_language); 01090 01091 // If the function menu is set to "Language": 01092 if ($this->MOD_SETTINGS['function']==2) { 01093 $dblist->tt_contentConfig['single'] = 0; 01094 $dblist->tt_contentConfig['languageMode'] = 1; 01095 $dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language']; 01096 $dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language; 01097 } 01098 break; 01099 } 01100 } else { 01101 if (isset($this->MOD_SETTINGS) && isset($this->MOD_MENU)) { 01102 $h_func = t3lib_BEfunc::getFuncMenu($this->id, 'SET[' . $table . ']', $this->MOD_SETTINGS[$table], $this->MOD_MENU[$table], 'db_layout.php', ''); 01103 } else { 01104 $h_func = ''; 01105 } 01106 } 01107 01108 // Start the dblist object: 01109 $dblist->itemsLimitSingleTable = 1000; 01110 $dblist->start($this->id,$table,$this->pointer,$this->search_field,$this->search_levels,$this->showLimit); 01111 $dblist->counter = $CMcounter; 01112 $dblist->ext_function = $this->MOD_SETTINGS['function']; 01113 01114 // Render versioning selector: 01115 $dblist->HTMLcode.= $this->doc->getVersionSelector($this->id); 01116 01117 // Generate the list of elements here: 01118 $dblist->generateList(); 01119 01120 // Adding the list content to the tableOutput variable: 01121 $tableOutput[$table]= 01122 ($h_func?$h_func.'<br /><img src="clear.gif" width="1" height="4" alt="" /><br />':''). 01123 $dblist->HTMLcode. 01124 ($h_func_b?'<img src="clear.gif" width="1" height="10" alt="" /><br />'.$h_func_b:''); 01125 01126 // ... and any accumulated JavaScript goes the same way! 01127 $tableJSOutput[$table] = $dblist->JScode; 01128 01129 // Increase global counter: 01130 $CMcounter+= $dblist->counter; 01131 01132 // Reset variables after operation: 01133 $dblist->HTMLcode=''; 01134 $dblist->JScode=''; 01135 $h_func = ''; 01136 $h_func_b = ''; 01137 } // END: traverse tables 01138 01139 01140 // For Context Sensitive Menus: 01141 $this->doc->getContextMenuCode(); 01142 01143 // Now, create listing based on which element is selected in the function menu: 01144 01145 if ($this->MOD_SETTINGS['function']==3) { 01146 01147 // Making page info: 01148 $content.=$this->doc->spacer(10); 01149 $content.=$this->doc->section($LANG->getLL('pageInformation'),$dblist->getPageInfoBox($this->pageinfo,$this->CALC_PERMS&2),0,1); 01150 } else { 01151 01152 // Add the content for each table we have rendered (traversing $tableOutput variable) 01153 foreach($tableOutput as $table => $output) { 01154 $content.=$this->doc->section('<a name="'.$table.'"></a>'.$dblist->activeTables[$table],$output,TRUE,TRUE,0,TRUE); 01155 $content.=$this->doc->spacer(15); 01156 $content.=$this->doc->sectionEnd(); 01157 } 01158 01159 // Making search form: 01160 if (!$this->modTSconfig['properties']['disableSearchBox'] && count($tableOutput)) { 01161 $sectionTitle = t3lib_BEfunc::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.search', TRUE)); 01162 $content .= $this->doc->section( 01163 $sectionTitle, 01164 $dblist->getSearchBox(0), 01165 FALSE, TRUE, FALSE, TRUE 01166 ); 01167 } 01168 01169 // Making display of Sys-notes (from extension "sys_note") 01170 $dblist->id=$this->id; 01171 $sysNotes = $dblist->showSysNotesForPage(); 01172 if ($sysNotes) { 01173 $content.=$this->doc->spacer(10); 01174 $content.=$this->doc->section($LANG->getLL('internalNotes'),$sysNotes,0,1); 01175 } 01176 01177 // Add spacer in bottom of page: 01178 $content.=$this->doc->spacer(10); 01179 } 01180 01181 // Ending page: 01182 $content.=$this->doc->spacer(10); 01183 01184 return $content; 01185 } 01186 01187 /** 01188 * Print accumulated content of module 01189 * 01190 * @return void 01191 */ 01192 function printContent() { 01193 echo $this->content; 01194 } 01195 01196 /*************************** 01197 * 01198 * Sub-content functions, rendering specific parts of the module content. 01199 * 01200 ***************************/ 01201 01202 /** 01203 * Create the panel of buttons for submitting the form or otherwise perform operations. 01204 * 01205 * @param string Identifier for function of module 01206 * @return array all available buttons as an assoc. array 01207 */ 01208 protected function getButtons($function = '') { 01209 global $TCA, $LANG, $BACK_PATH, $BE_USER; 01210 01211 $buttons = array( 01212 'view' => '', 01213 'history_page' => '', 01214 'new_content' => '', 01215 'move_page' => '', 01216 'move_record' => '', 01217 'new_page' => '', 01218 'edit_page' => '', 01219 'record_list' => '', 01220 'csh' => '', 01221 'shortcut' => '', 01222 'cache' => '', 01223 'savedok' => '', 01224 'savedokshow' => '', 01225 'closedok' => '', 01226 'deletedok' => '', 01227 'undo' => '', 01228 'history_record' => '' 01229 ); 01230 01231 // View page 01232 $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $BACK_PATH, t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', TRUE) . '">' . 01233 t3lib_iconWorks::getSpriteIcon('actions-document-view') . 01234 '</a>'; 01235 01236 // Shortcut 01237 if ($BE_USER->mayMakeShortcut()) { 01238 $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']); 01239 } 01240 01241 // Cache 01242 if (!$this->modTSconfig['properties']['disableAdvanced']) { 01243 $buttons['cache'] = '<a href="' . htmlspecialchars('db_layout.php?id=' . $this->pageinfo['uid'] . '&clear_cache=1') . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.clear_cache', TRUE) . '">' . 01244 t3lib_iconWorks::getSpriteIcon('actions-system-cache-clear') . 01245 '</a>'; 01246 } 01247 01248 // If access to Web>List for user, then link to that module. 01249 $buttons['record_list'] = t3lib_BEfunc::getListViewLink( 01250 array( 01251 'id' => $this->pageinfo['uid'], 01252 'returnUrl' => t3lib_div::getIndpEnv('REQUEST_URI'), 01253 ), 01254 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList') 01255 ); 01256 01257 if (!$this->modTSconfig['properties']['disableIconToolbar']) { 01258 01259 // Page history 01260 $buttons['history_page'] = '<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;') . '" title="' . $LANG->getLL('recordHistory', TRUE) . '">' . 01261 t3lib_iconWorks::getSpriteIcon('actions-document-history-open') . 01262 '</a>'; 01263 // New content element 01264 $buttons['new_content'] = '<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'))) . '" title="' . $LANG->getLL('newContentElement', TRUE) . '">' . 01265 t3lib_iconWorks::getSpriteIcon('actions-document-new') . 01266 '</a>'; 01267 // Move page 01268 $buttons['move_page'] = '<a href="' . htmlspecialchars($BACK_PATH . 'move_el.php?table=pages&uid=' . $this->id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '" title="' . $LANG->getLL('move_page', TRUE) . '">' . 01269 t3lib_iconWorks::getSpriteIcon('actions-page-move') . 01270 '</a>'; 01271 // Move record 01272 if (t3lib_div::testInt($this->eRParts[1])) { 01273 $buttons['move_record'] = '<a href="' . htmlspecialchars($BACK_PATH . 'move_el.php?table=' . $this->eRParts[0] . '&uid=' . $this->eRParts[1] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '">' . 01274 t3lib_iconWorks::getSpriteIcon('actions-' . ($this->eRParts[0] == 'tt_content' ? 'document' : 'page') . '-move',array('class'=>'c-inputButton','title' => $LANG->getLL('move_' . ($this->eRParts[0] == 'tt_content' ? 'record' : 'page'), 1))) . 01275 '</a>'; 01276 } 01277 // Create new page (wizard) 01278 $buttons['new_page'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(\'' . $BACK_PATH . 'db_new.php?id=' . $this->id . '&pagesOnly=1&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '\');return false;') . '" title="' . $LANG->getLL('newPage', TRUE) . '">' . 01279 t3lib_iconWorks::getSpriteIcon('actions-page-new') . 01280 '</a>'; 01281 // Edit page properties 01282 if ($this->CALC_PERMS&2) { 01283 $params='&edit[pages][' . $this->id . ']=edit'; 01284 $buttons['edit_page'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $BACK_PATH)) . '" title="' . $LANG->getLL('editPageProperties', TRUE) . '">' . 01285 t3lib_iconWorks::getSpriteIcon('actions-page-open') . 01286 '</a>'; 01287 } 01288 01289 // Add CSH (Context Sensitive Help) icon to tool bar 01290 if($function == 'quickEdit') { 01291 $buttons['csh'] = t3lib_BEfunc::cshItem($this->descrTable, 'quickEdit', $BACK_PATH, '', TRUE, 'margin-top: 0px; margin-bottom: 0px;'); 01292 } else { 01293 $buttons['csh'] = t3lib_BEfunc::cshItem($this->descrTable, 'columns_' . $this->MOD_SETTINGS['function'], $BACK_PATH, '', TRUE, 'margin-top: 0px; margin-bottom: 0px;'); 01294 } 01295 01296 if($function == 'quickEdit') { 01297 // Save record 01298 $buttons['savedok'] = '<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="" />'; 01299 01300 // Save record and show page 01301 $buttons['savedokshow'] = '<a href="#" onclick="' . htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow', TRUE) . '">' . 01302 t3lib_iconWorks::getSpriteIcon('actions-document-save-view') . 01303 '</a>'; 01304 01305 // Close record 01306 $buttons['closedok'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(unescape(\'' . rawurlencode($this->closeUrl) . '\')); return false;') . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', TRUE) . '">' . 01307 t3lib_iconWorks::getSpriteIcon('actions-document-close') . 01308 '</a>'; 01309 01310 // Delete record 01311 if($this->deleteButton) { 01312 $buttons['deletedok'] = '<a href="#" onclick="' . htmlspecialchars('return deleteRecord(\'' . $this->eRParts[0] . '\',\'' . $this->eRParts[1] . '\',\'' . t3lib_div::getIndpEnv('SCRIPT_NAME') . '?id=' . $this->id . '\');') . '" title="' . $LANG->getLL('deleteItem', TRUE) . '">' . 01313 t3lib_iconWorks::getSpriteIcon('actions-edit-delete') . 01314 '</a>'; 01315 } 01316 01317 if($this->undoButton) { 01318 // Undo button 01319 $buttons['undo'] = '<a href="#" 01320 onclick="' . htmlspecialchars('window.location.href=\'' . $BACK_PATH . 'show_rechis.php?element=' . rawurlencode($this->eRParts[0] . ':' . $this->eRParts[1]) . '&revert=ALL_FIELDS&sumUp=-1&returnUrl=' . rawurlencode($this->R_URI) . '\'; return false;') . '" 01321 title="' . htmlspecialchars(sprintf($LANG->getLL('undoLastChange'), t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $this->undoButtonR['tstamp'], $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))) . '">' . 01322 t3lib_iconWorks::getSpriteIcon('actions-edit-undo') . 01323 '</a>'; 01324 01325 // History button 01326 $buttons['history_record'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(\'' . $BACK_PATH . 'show_rechis.php?element=' . rawurlencode($this->eRParts[0] . ':' . $this->eRParts[1]) . '&returnUrl=' . rawurlencode($this->R_URI) . '#latest\');return false;') . '" title="' . $LANG->getLL('recordHistory', TRUE) . '">' . 01327 t3lib_iconWorks::getSpriteIcon('actions-document-history-open') . 01328 '</a>'; 01329 } 01330 } 01331 } 01332 01333 return $buttons; 01334 } 01335 01336 /******************************* 01337 * 01338 * Other functions 01339 * 01340 ******************************/ 01341 01342 /** 01343 * Returns the number of hidden elements (including those hidden by start/end times) on the current page (for the current sys_language) 01344 * 01345 * @return void 01346 */ 01347 function getNumberOfHiddenElements() { 01348 return $GLOBALS['TYPO3_DB']->exec_SELECTcountRows( 01349 'uid', 01350 'tt_content', 01351 'pid=' . intval($this->id) . 01352 ' AND sys_language_uid=' . intval($this->current_sys_language) . 01353 t3lib_BEfunc::BEenableFields('tt_content', 1) . 01354 t3lib_BEfunc::deleteClause('tt_content') . 01355 t3lib_BEfunc::versioningPlaceholderClause('tt_content') 01356 ); 01357 } 01358 01359 /** 01360 * Returns URL to the current script. 01361 * In particular the "popView" and "new_unique_uid" Get vars are unset. 01362 * 01363 * @param array Parameters array, merged with global GET vars. 01364 * @return string URL 01365 */ 01366 function local_linkThisScript($params) { 01367 $params['popView']=''; 01368 $params['new_unique_uid']=''; 01369 return t3lib_div::linkThisScript($params); 01370 } 01371 01372 /** 01373 * Returns a SQL query for selecting sys_language records. 01374 * 01375 * @param integer Page id: If zero, the query will select all sys_language records from root level which are NOT hidden. If set to another value, the query will select all sys_language records that has a pages_language_overlay record on that page (and is not hidden, unless you are admin user) 01376 * @return string Return query string. 01377 */ 01378 function exec_languageQuery($id) { 01379 if ($id) { 01380 $exQ = t3lib_BEfunc::deleteClause('pages_language_overlay') . ($GLOBALS['BE_USER']->isAdmin()?'':' AND sys_language.hidden=0'); 01381 return $GLOBALS['TYPO3_DB']->exec_SELECTquery( 01382 'sys_language.*', 01383 'pages_language_overlay,sys_language', 01384 'pages_language_overlay.sys_language_uid=sys_language.uid AND pages_language_overlay.pid='.intval($id).$exQ, 01385 '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', 01386 'sys_language.title' 01387 ); 01388 } else { 01389 return $GLOBALS['TYPO3_DB']->exec_SELECTquery( 01390 'sys_language.*', 01391 'sys_language', 01392 'sys_language.hidden=0', 01393 '', 01394 'sys_language.title' 01395 ); 01396 } 01397 } 01398 } 01399 01400 01401 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/cms/layout/db_layout.php'])) { 01402 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/cms/layout/db_layout.php']); 01403 } 01404 01405 01406 // Make instance: 01407 $SOBE = t3lib_div::makeInstance('SC_db_layout'); 01408 $SOBE->init(); 01409 01410 // Include files? 01411 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE); 01412 01413 $SOBE->clearCache(); 01414 $SOBE->main(); 01415 $SOBE->printContent(); 01416 01417 ?>
1.8.0