2 /***************************************************************
5 * (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
30 * This module lets you view a page in a more Content Management like style than the ordinary record-list
33 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
36 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
39 * [CLASS/FUNCTION INDEX of SCRIPT]
43 * 106: class ext_posMap extends t3lib_positionMap
44 * 117: function wrapRecordTitle($str,$row)
45 * 130: function wrapColumnHeader($str,$vv)
46 * 144: function onClickInsertRecord($row,$vv,$moveUid,$pid)
47 * 160: function wrapRecordHeader($str,$row)
50 * 181: class SC_db_layout
51 * 230: function init()
52 * 283: function menuConfig()
53 * 372: function clearCache()
54 * 387: function main()
55 * 489: function renderQuickEdit()
56 * 886: function renderListContent()
57 * 1165: function printContent()
59 * SECTION: Other functions
60 * 1192: function getNumberOfHiddenElements()
61 * 1205: function local_linkThisScript($params)
62 * 1217: function exec_languageQuery($id)
65 * (This index is automatically created/updated by the extension "extdeveval")
72 require($BACK_PATH.'init.php');
73 require($BACK_PATH.'template.php');
74 $LANG->includeLLFile('EXT:cms/layout/locallang.xml');
75 require_once(PATH_typo3
.'class.db_list.inc');
76 require_once('class.tx_cms_layout.php');
77 $BE_USER->modAccess($MCONF,1);
79 // Will open up records locked by current user. It's assumed that the locking should end if this script is hit.
80 t3lib_BEfunc
::lockRecords();
82 // Exits if 'cms' extension is not loaded:
83 t3lib_extMgm
::isLoaded('cms',1);
96 * Local extension of position map class
98 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
102 class ext_posMap
extends t3lib_positionMap
{
103 var $dontPrintPageInsertIcons = 1;
104 var $l_insertNewRecordHere='newContentElement';
107 * Wrapping the title of the record.
109 * @param string The title value.
110 * @param array The record row.
111 * @return string Wrapped title string.
113 function wrapRecordTitle($str,$row) {
114 $aOnClick = 'jumpToUrl(\''.$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:'.$row['uid'])).'\');return false;';
115 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>';
119 * Wrapping the column header
121 * @param string Header value
122 * @param string Column info.
124 * @see printRecordMap()
126 function wrapColumnHeader($str,$vv) {
127 $aOnClick = 'jumpToUrl(\''.$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'_EDIT_COL:'.$vv)).'\');return false;';
128 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>';
132 * Create on-click event value.
134 * @param array The record.
135 * @param string Column position value.
136 * @param integer Move uid
137 * @param integer PID value.
140 function onClickInsertRecord($row,$vv,$moveUid,$pid) {
141 if (is_array($row)) {
142 $location=$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:new/-'.$row['uid'].'/'.$row['colPos']));
144 $location=$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:new/'.$pid.'/'.$vv));
146 return 'jumpToUrl(\''.$location.'\');return false;';
150 * Wrapping the record header (from getRecordHeader())
152 * @param string HTML content
153 * @param array Record array.
154 * @return string HTML content
156 function wrapRecordHeader($str,$row) {
157 if ($row['uid']==$this->moveUid
) {
158 return '<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/content_client.gif','width="7" height="10"').' alt="" />'.$str;
171 * Script Class for Web > Layout module
173 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
180 var $id; // Page Id for which to make the listing
181 var $pointer; // Pointer - for browsing list of records.
182 var $imagemode; // Thumbnails or not
184 var $search_field; // Search-fields
185 var $search_levels; // Search-levels
186 var $showLimit; // Show-limit
187 var $returnUrl; // Return URL
189 var $clear_cache; // Clear-cache flag - if set, clears page cache for current id.
190 var $popView; // PopView id - for opening a window with the page
191 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).
192 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.
195 var $perms_clause; // Page select perms clause
196 var $modTSconfig; // Module TSconfig
197 var $pageinfo; // Current ids page record
200 * Document template object
205 var $backPath; // Back path of the module
207 var $descrTable; // "Pseudo" Description -table name
208 var $colPosList; // List of column-integers to edit. Is set from TSconfig, default is "1,0,2,3"
209 var $EDIT_CONTENT; // Flag: If content can be edited or not.
210 var $CALC_PERMS; // Users permissions integer for this page.
211 var $current_sys_language; // Currently selected language for editing content elements
213 var $MCONF=array(); // Module configuration
214 var $MOD_MENU=array(); // Menu configuration
215 var $MOD_SETTINGS=array(); // Module settings (session variable)
216 var $include_once=array(); // Array, where files to include is accumulated in the init() function
217 var $externalTables = array(); // Array of tables to be listed by the Web > Page module in addition to the default tables
219 // Internal, dynamic:
220 var $content; // Module output accumulation
221 var $topFuncMenu; // Function menu temporary storage
222 var $editIcon; // Temporary storage for page edit icon
229 * Initializing the module
236 // Setting module configuration / page select clause
237 $this->MCONF
= $GLOBALS['MCONF'];
238 $this->perms_clause
= $BE_USER->getPagePermsClause(1);
239 $this->backPath
= $GLOBALS['BACK_PATH'];
242 $this->id
= intval(t3lib_div
::_GP('id'));
243 $this->pointer
= t3lib_div
::_GP('pointer');
244 $this->imagemode
= t3lib_div
::_GP('imagemode');
246 $this->clear_cache
= t3lib_div
::_GP('clear_cache');
247 $this->popView
= t3lib_div
::_GP('popView');
248 $this->edit_record
= t3lib_div
::_GP('edit_record');
249 $this->new_unique_uid
= t3lib_div
::_GP('new_unique_uid');
250 $this->search_field
= t3lib_div
::_GP('search_field');
251 $this->search_levels
= t3lib_div
::_GP('search_levels');
252 $this->showLimit
= t3lib_div
::_GP('showLimit');
253 $this->returnUrl
= t3lib_div
::sanitizeLocalUrl(t3lib_div
::_GP('returnUrl'));
254 $this->externalTables
= $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables'];
256 // Load page info array:
257 $this->pageinfo
= t3lib_BEfunc
::readPageAccess($this->id
,$this->perms_clause
);
262 // Setting sys language from session var:
263 $this->current_sys_language
=intval($this->MOD_SETTINGS
['language']);
265 // Include scripts: QuickEdit
266 if ($this->MOD_SETTINGS
['function']==0) {
267 $this->include_once[]=PATH_t3lib
.'class.t3lib_tceforms.php';
268 $this->include_once[]=PATH_t3lib
.'class.t3lib_clipboard.php';
269 $this->include_once[]=PATH_t3lib
.'class.t3lib_loaddbgroup.php';
270 $this->include_once[]=PATH_t3lib
.'class.t3lib_transferdata.php';
273 // Include scripts: Clear-cache cmd.
274 if ($this->clear_cache
) {
275 $this->include_once[]=PATH_t3lib
.'class.t3lib_tcemain.php';
278 // CSH / Descriptions:
279 $this->descrTable
= '_MOD_'.$this->MCONF
['name'];
283 * Initialize menu array
287 function menuConfig() {
288 global $BE_USER,$LANG,$TYPO3_CONF_VARS;
291 $this->MOD_MENU
= array(
293 0 => $LANG->getLL('m_tt_board_0'),
294 'expand' => $LANG->getLL('m_tt_board_expand')
296 'tt_address' => array(
297 0 => $LANG->getLL('m_tt_address_0'),
298 1 => $LANG->getLL('m_tt_address_1'),
299 2 => $LANG->getLL('m_tt_address_2')
302 0 => $LANG->getLL('m_default'),
303 1 => $LANG->getLL('m_tt_links_1'),
304 2 => $LANG->getLL('m_tt_links_2')
306 'tt_calender' => array (
307 0 => $LANG->getLL('m_default'),
308 'date' => $LANG->getLL('m_tt_calender_date'),
309 'date_ext' => $LANG->getLL('m_tt_calender_date_ext'),
310 'todo' => $LANG->getLL('m_tt_calender_todo'),
311 'todo_ext' => $LANG->getLL('m_tt_calender_todo_ext')
313 'tt_products' => array (
314 0 => $LANG->getLL('m_default'),
315 'ext' => $LANG->getLL('m_tt_products_ext')
317 'tt_content_showHidden' => '',
318 'showPalettes' => '',
319 'showDescriptions' => '',
322 0 => $LANG->getLL('m_function_0'),
323 1 => $LANG->getLL('m_function_1'),
324 2 => $LANG->getLL('m_function_2'),
325 3 => $LANG->getLL('pageInformation'),
326 4 => $LANG->getLL('gridView')
329 0 => $LANG->getLL('m_default')
334 // $TYPO3_CONF_VARS['EXTCONF']['cms']['db_layout']['addTables']['tx_myext'] =
335 // array ('default' => array(
336 // 'MENU' => 'LLL:EXT:tx_myext/locallang_db.xml:menuDefault',
337 // 'fList' => 'title,description,image',
339 if (is_array($this->externalTables
)) {
340 foreach ($this->externalTables
as $table => $tableSettings) {
341 // delete the default settings from above
342 if (is_array($this->MOD_MENU
[$table])) {
343 unset ($this->MOD_MENU
[$table]);
345 if (is_array($tableSettings) && count($tableSettings) > 1) {
346 foreach ($tableSettings as $key => $settings) {
347 $this->MOD_MENU
[$table][$key] = $LANG->sL($settings['MENU']);
353 // 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.
354 $res = $this->exec_languageQuery($this->id
);
355 while($lrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
356 if ($GLOBALS['BE_USER']->checkLanguageAccess($lrow['uid'])) {
357 $this->MOD_MENU
['language'][$lrow['uid']]=($lrow['hidden']?
'('.$lrow['title'].')':$lrow['title']);
361 // Find if there are ANY languages at all (and if not, remove the language option from function menu).
362 $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'sys_language', ($BE_USER->isAdmin() ?
'' : 'hidden=0'));
364 unset($this->MOD_MENU
['function']['2']);
367 // page/be_user TSconfig settings and blinding of menu-items
368 $this->modSharedTSconfig
= t3lib_BEfunc
::getModTSconfig($this->id
, 'mod.SHARED');
369 $this->modTSconfig
= t3lib_BEfunc
::getModTSconfig($this->id
,'mod.'.$this->MCONF
['name']);
370 if ($this->modTSconfig
['properties']['QEisDefault']) ksort($this->MOD_MENU
['function']);
371 $this->MOD_MENU
['function'] = t3lib_BEfunc
::unsetMenuItems($this->modTSconfig
['properties'],$this->MOD_MENU
['function'],'menu.function');
373 // Remove QuickEdit as option if page type is not...
374 if (!t3lib_div
::inList($TYPO3_CONF_VARS['FE']['content_doktypes'].',6',$this->pageinfo
['doktype'])) {
375 unset($this->MOD_MENU
['function'][0]);
378 // Setting alternative default label:
379 if (($this->modSharedTSconfig
['properties']['defaultLanguageLabel'] ||
$this->modTSconfig
['properties']['defaultLanguageLabel']) && isset($this->MOD_MENU
['language'][0])) {
380 $this->MOD_MENU
['language'][0] = $this->modTSconfig
['properties']['defaultLanguageLabel'] ?
$this->modSharedTSconfig
['properties']['defaultLanguageLabel'] : $this->modSharedTSconfig
['properties']['defaultLanguageLabel'];
384 $this->MOD_SETTINGS
= t3lib_BEfunc
::getModuleData($this->MOD_MENU
, t3lib_div
::_GP('SET'), $this->MCONF
['name']);
386 // For all elements to be shown in draft workspaces & to also show hidden elements by default if user hasn't disabled the option
387 if (($GLOBALS['BE_USER']->workspace
!= 0) ||
($this->MOD_SETTINGS
['tt_content_showHidden'] !== '0')) {
388 $this->MOD_SETTINGS
['tt_content_showHidden'] = 1;
393 * Clears page cache for the current id, $this->id
397 function clearCache() {
398 if ($this->clear_cache
) {
399 $tce = t3lib_div
::makeInstance('t3lib_TCEmain');
400 $tce->stripslashes_values
=0;
401 $tce->start(Array(),Array());
402 $tce->clear_cacheCmd($this->id
);
408 * Creates some general objects and calls other functions for the main rendering of module content.
413 global $BE_USER,$LANG,$BACK_PATH;
416 // The page will show only if there is a valid page and if this page may be viewed by the user
417 $access = is_array($this->pageinfo
) ?
1 : 0;
418 if ($this->id
&& $access) {
420 // Initialize permission settings:
421 $this->CALC_PERMS
= $BE_USER->calcPerms($this->pageinfo
);
422 $this->EDIT_CONTENT
= ($this->CALC_PERMS
&16) ?
1 : 0;
424 // Start document template object:
425 $this->doc
= t3lib_div
::makeInstance('template');
426 $this->doc
->backPath
= $BACK_PATH;
427 $this->doc
->setModuleTemplate('templates/db_layout.html');
430 $this->doc
->JScode
= '<script type="text/javascript" ' .
431 'src="' . t3lib_div
::createVersionNumberedFilename($BACK_PATH . '../t3lib/jsfunc.updateform.js') . '">' .
433 $this->doc
->JScode
.= $this->doc
->wrapScriptTags('
434 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id
).';
435 if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages'.intval($this->id
).'_"+top.fsMod.currentBank; '.intval($this->id
).';
436 function jumpToUrl(URL,formEl) { //
437 if (document.editform && TBE_EDITOR.isFormChanged) { // Check if the function exists... (works in all browsers?)
438 if (!TBE_EDITOR.isFormChanged()) { //
439 window.location.href = URL;
441 if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
443 } else window.location.href = URL;
445 '.($this->popView ? t3lib_BEfunc
::viewOnClick($this->id
,$BACK_PATH,t3lib_BEfunc
::BEgetRootLine($this->id
)) : '').'
447 function deleteRecord(table,id,url) { //
448 if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).')) {
449 window.location.href = "'.$BACK_PATH.'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC='.$BE_USER->veriCode().'&prErr=1&uPT=1";
454 $this->doc
->JScode
.= $this->doc
->wrapScriptTags('
455 var DTM_array = new Array();
456 var DTM_origClass = new String();
458 // if tabs are used in a popup window the array might not exists
459 if(!top.DTM_currentTabs) {
460 top.DTM_currentTabs = new Array();
463 function DTM_activate(idBase,index,doToogle) { //
465 if (DTM_array[idBase]) {
466 for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) {
467 if (DTM_array[idBase][cnt] != idBase+"-"+index) {
468 document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none";
469 document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
475 if (document.getElementById(idBase+"-"+index+"-DIV")) {
476 if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
477 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
478 if(DTM_origClass=="") {
479 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
481 DTM_origClass = "tab";
483 top.DTM_currentTabs[idBase] = -1;
485 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
486 if(DTM_origClass=="") {
487 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
489 DTM_origClass = "tabact";
491 top.DTM_currentTabs[idBase] = index;
495 function DTM_toggle(idBase,index,isInit) { //
497 if (document.getElementById(idBase+"-"+index+"-DIV")) {
498 if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
499 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
501 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
503 DTM_origClass = "tab";
505 top.DTM_currentTabs[idBase+"-"+index] = 0;
507 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
509 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
511 DTM_origClass = "tabact";
513 top.DTM_currentTabs[idBase+"-"+index] = 1;
518 function DTM_mouseOver(obj) { //
519 DTM_origClass = obj.attributes.getNamedItem(\'class\').nodeValue;
520 obj.attributes.getNamedItem(\'class\').nodeValue += "_over";
523 function DTM_mouseOut(obj) { //
524 obj.attributes.getNamedItem(\'class\').nodeValue = DTM_origClass;
529 // Setting doc-header
530 $this->doc
->form
='<form action="'.htmlspecialchars('db_layout.php?id='.$this->id
.'&imagemode='.$this->imagemode
).'" method="post">';
532 // Creating the top function menu:
533 $this->topFuncMenu
= t3lib_BEfunc
::getFuncMenu($this->id
,'SET[function]',$this->MOD_SETTINGS
['function'],$this->MOD_MENU
['function'],'db_layout.php','');
534 $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','') : '');
537 $modTSconfig_SHARED = t3lib_BEfunc
::getModTSconfig($this->id
,'mod.SHARED'); // SHARED page-TSconfig settings.
538 $this->colPosList
= strcmp(trim($this->modTSconfig
['properties']['tt_content.']['colPos_list']),'') ?
trim($this->modTSconfig
['properties']['tt_content.']['colPos_list']) : $modTSconfig_SHARED['properties']['colPos_list'];
539 if (!strcmp($this->colPosList
,'')) {
540 $backendLayout = t3lib_div
::callUserFunction( 'EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getSelectedBackendLayout' , $this->id
, $this );
542 if(count($backendLayout['__colPosList'])) {
543 $this->colPosList
= implode(',', $backendLayout['__colPosList']);
546 if( !strcmp($this->colPosList
, '') ){
547 $this->colPosList
= '1,0,2,3';
549 $this->colPosList
= implode(',', array_unique(t3lib_div
::intExplode(',',$this->colPosList
))); // Removing duplicates, if any
551 // Render the primary module content:
552 if ($this->MOD_SETTINGS
['function']==0) {
553 $body = $this->renderQuickEdit(); // QuickEdit
555 $body = $this->renderListContent(); // All other listings
558 // If page is a sysfolder
559 if ($this->pageinfo
['doktype'] == 254) {
561 // access to list module
562 $moduleLoader = t3lib_div
::makeInstance('t3lib_loadModules');
563 $moduleLoader->load($GLOBALS['TBE_MODULES']);
564 $modules = $moduleLoader->modules
;
566 if (is_array($modules['web']['sub']['list'])) {
567 $flashMessage = t3lib_div
::makeInstance(
568 't3lib_FlashMessage',
569 '<p>' . $GLOBALS['LANG']->getLL('goToListModuleMessage') . '</p>
572 t3lib_iconWorks
::getSpriteIcon('actions-system-list-open') .
573 '<a href="javascript:top.goToModule( \'web_list\',1);">' .
574 $GLOBALS['LANG']->getLL('goToListModule') . '
578 t3lib_FlashMessage
::INFO
580 $body = $flashMessage->render() . $body;
585 if ($this->pageinfo
['content_from_pid']) {
586 $contentPage = t3lib_BEfunc
::getRecord('pages', intval($this->pageinfo
['content_from_pid']));
587 $title = t3lib_BEfunc
::getRecordTitle('pages', $contentPage);
588 $linkToPid = $this->local_linkThisScript(array('id' => $this->pageinfo
['content_from_pid']));
589 $link = '<a href="' . $linkToPid . '">' . htmlspecialchars($title) . ' (PID ' . intval($this->pageinfo
['content_from_pid']) . ')</a>';
590 $flashMessage = t3lib_div
::makeInstance(
591 't3lib_FlashMessage',
593 sprintf($GLOBALS['LANG']->getLL('content_from_pid_title'), $link),
594 t3lib_FlashMessage
::INFO
596 $body = $flashMessage->render() . $body;
599 // Setting up the buttons and markers for docheader
600 $docHeaderButtons = $this->getButtons($this->MOD_SETTINGS
['function']==0 ?
'quickEdit' : '');
602 'CSH' => $docHeaderButtons['csh'],
603 'TOP_FUNCTION_MENU' => $this->editSelect
. $this->topFuncMenu
,
604 'LANGSELECTOR' => $this->languageMenu
,
608 // Build the <body> for the module
609 $this->content
.= $this->doc
->moduleBody($this->pageinfo
, $docHeaderButtons, $markers);
610 // Renders the module page
611 $this->content
= $this->doc
->render(
612 $LANG->getLL('title'),
618 // If no access or id value, create empty document:
619 $this->doc
= t3lib_div
::makeInstance('template');
620 $this->doc
->backPath
= $BACK_PATH;
621 $this->doc
->setModuleTemplate('templates/db_layout.html');
623 $this->doc
->JScode
= $this->doc
->wrapScriptTags('
624 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id
).';
627 $flashMessage = t3lib_div
::makeInstance(
628 't3lib_FlashMessage',
629 $LANG->getLL('clickAPage_content'),
630 $LANG->getLL('clickAPage_header'),
631 t3lib_FlashMessage
::INFO
633 $body = $flashMessage->render();
635 // Setting up the buttons and markers for docheader
636 $docHeaderButtons = array(
638 'history_page' => '',
653 'history_record' => ''
657 'CSH' => t3lib_BEfunc
::cshItem($this->descrTable
, '', $BACK_PATH, '', TRUE),
658 'TOP_FUNCTION_MENU' => '',
659 'LANGSELECTOR' => '',
663 $this->content
.= $this->doc
->moduleBody($this->pageinfo
, $docHeaderButtons, $markers);
664 // Renders the module page
665 $this->content
= $this->doc
->render(
666 $LANG->getLL('title'),
673 * Rendering the quick-edit view.
677 function renderQuickEdit() {
678 global $LANG,$BE_USER,$BACK_PATH;
679 // Alternative template
680 $this->doc
->setModuleTemplate('templates/db_layout_quickedit.html');
682 // Alternative form tag; Quick Edit submits its content to tce_db.php.
683 $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);">';
685 // Setting up the context sensitive menu:
686 $this->doc
->getContextMenuCode();
688 // Set the edit_record value for internal use in this function:
689 $edit_record = $this->edit_record
;
691 // If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php:
692 if (substr($edit_record,0,9)=='_EDIT_COL') {
693 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
696 'pid='.intval($this->id
).' AND colPos='.intval(substr($edit_record,10)).' AND sys_language_uid='.intval($this->current_sys_language
).
697 ($this->MOD_SETTINGS
['tt_content_showHidden'] ?
'' : t3lib_BEfunc
::BEenableFields('tt_content')).
698 t3lib_BEfunc
::deleteClause('tt_content').
699 t3lib_BEfunc
::versioningPlaceholderClause('tt_content'),
704 while($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
705 $idListA[] = $cRow['uid'];
708 $url = $BACK_PATH.'alt_doc.php?edit[tt_content]['.implode(',',$idListA).']=edit&returnUrl='.rawurlencode($this->local_linkThisScript(array('edit_record'=>'')));
709 t3lib_utility_Http
::redirect($url);
712 // If the former record edited was the creation of a NEW record, this will look up the created records uid:
713 if ($this->new_unique_uid
) {
714 $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'));
715 $sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
716 if (is_array($sys_log_row)) {
717 $edit_record=$sys_log_row['tablename'].':'.$sys_log_row['recuid'];
722 // Creating the selector box, allowing the user to select which element to edit:
725 $languageOverlayRecord='';
726 if ($this->current_sys_language
) {
727 list($languageOverlayRecord) = t3lib_BEfunc
::getRecordsByField('pages_language_overlay','pid',$this->id
,'AND sys_language_uid='.intval($this->current_sys_language
));
729 if (is_array($languageOverlayRecord)) {
730 $inValue = 'pages_language_overlay:'.$languageOverlayRecord['uid'];
731 $is_selected+
=intval($edit_record==$inValue);
732 $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?
' selected="selected"':'').'>[ '.$LANG->getLL('editLanguageHeader',1).' ]</option>';
734 $inValue = 'pages:'.$this->id
;
735 $is_selected+
=intval($edit_record==$inValue);
736 $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?
' selected="selected"':'').'>[ '.$LANG->getLL('editPageProperties',1).' ]</option>';
739 // Selecting all content elements from this language and allowed colPos:
740 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
743 'pid='.intval($this->id
).' AND sys_language_uid='.intval($this->current_sys_language
).' AND colPos IN ('.$this->colPosList
.')'.
744 ($this->MOD_SETTINGS
['tt_content_showHidden'] ?
'' : t3lib_BEfunc
::BEenableFields('tt_content')).
745 t3lib_Befunc
::deleteClause('tt_content').
746 t3lib_BEfunc
::versioningPlaceholderClause('tt_content'),
752 $prev=$this->id
; // Page is the pid if no record to put this after.
753 while($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
754 t3lib_BEfunc
::workspaceOL('tt_content', $cRow);
756 if (is_array($cRow)) {
759 $edit_record='tt_content:'.$cRow['uid'];
763 if (strcmp($cRow['colPos'],$colPos)) {
764 $colPos=$cRow['colPos'];
765 $opt[]='<option value=""></option>';
766 $opt[]='<option value="_EDIT_COL:'.$colPos.'">__'.$LANG->sL(t3lib_BEfunc
::getLabelFromItemlist('tt_content','colPos',$colPos),1).':__</option>';
768 $inValue = 'tt_content:'.$cRow['uid'];
769 $is_selected+
=intval($edit_record==$inValue);
770 $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>';
775 // If edit_record is not set (meaning, no content elements was found for this language) we simply set it to create a new element:
777 $edit_record='tt_content:new/'.$prev.'/'.$colPos;
779 $inValue = 'tt_content:new/'.$prev.'/'.$colPos;
780 $is_selected+
=intval($edit_record==$inValue);
781 $opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?
' selected="selected"':'').'>[ '.$LANG->getLL('newLabel',1).' ]</option>';
784 // If none is yet selected...
786 $opt[]='<option value=""></option>';
787 $opt[]='<option value="'.$edit_record.'" selected="selected">[ '.$LANG->getLL('newLabel',1).' ]</option>';
791 // Splitting the edit-record cmd value into table/uid:
792 $this->eRParts
= explode(':',$edit_record);
796 // Delete-button flag?
797 $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))));
799 // If undo-button should be rendered (depends on available items in sys_history)
801 $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');
802 if ($this->undoButtonR
= $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
806 // Setting up the Return URL for coming back to THIS script (if links take the user to another script)
807 $R_URL_parts = parse_url(t3lib_div
::getIndpEnv('REQUEST_URI'));
808 $R_URL_getvars = t3lib_div
::_GET();
810 unset($R_URL_getvars['popView']);
811 unset($R_URL_getvars['new_unique_uid']);
812 $R_URL_getvars['edit_record']=$edit_record;
813 $this->R_URI
= $R_URL_parts['path'].'?'.t3lib_div
::implodeArrayForUrl('',$R_URL_getvars);
815 // Setting close url/return url for exiting this script:
816 $this->closeUrl
= $this->local_linkThisScript(array('SET'=>array('function'=>1))); // Goes to 'Columns' view if close is pressed (default)
818 if ($BE_USER->uc
['condensedMode']) {
819 $this->closeUrl
= $BACK_PATH.'alt_db_navframe.php';
821 if ($this->returnUrl
) {
822 $this->closeUrl
= $this->returnUrl
;
824 // Return-url for JavaScript:
825 $retUrlStr = $this->returnUrl?
"+'&returnUrl='+'".rawurlencode($this->returnUrl
)."'":'';
827 // Drawing the edit record selectbox
828 $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>';
830 // Creating editing form:
831 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)))) {
833 // Splitting uid parts for special features, if new:
834 list($uidVal,$ex_pid,$ex_colPos) = explode('/',$this->eRParts
[1]);
836 // Convert $uidVal to workspace version if any:
837 if ($uidVal!='new') {
838 if ($draftRecord = t3lib_BEfunc
::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace
, $this->eRParts
[0], $uidVal, 'uid')) {
839 $uidVal = $draftRecord['uid'];
843 // Initializing transfer-data object:
844 $trData = t3lib_div
::makeInstance('t3lib_transferData');
845 $trData->addRawData
= TRUE;
846 $trData->defVals
[$this->eRParts
[0]] = array (
847 'colPos' => intval($ex_colPos),
848 'sys_language_uid' => intval($this->current_sys_language
)
850 $trData->disableRTE
= $this->MOD_SETTINGS
['disableRTE'];
851 $trData->lockRecords
=1;
852 $trData->fetchRecord($this->eRParts
[0],($uidVal=='new'?
$this->id
:$uidVal),$uidVal); // 'new'
854 // Getting/Making the record:
855 reset($trData->regTableItems_data
);
856 $rec = current($trData->regTableItems_data
);
857 if ($uidVal=='new') {
858 $new_unique_uid = uniqid('NEW');
859 $rec['uid'] = $new_unique_uid;
860 $rec['pid'] = intval($ex_pid)?
intval($ex_pid):$this->id
;
861 $recordAccess = TRUE;
863 $rec['uid'] = $uidVal;
865 // Checking internals access:
866 $recordAccess = $BE_USER->recordEditAccessInternals($this->eRParts
[0],$uidVal);
869 if (!$recordAccess) {
870 // If no edit access, print error message:
871 $content.=$this->doc
->section($LANG->getLL('noAccess'),$LANG->getLL('noAccess_msg').'<br /><br />'.
872 ($BE_USER->errorMsg ?
'Reason: ' . $BE_USER->errorMsg
. '<br /><br />' : ''), 0, 1);
873 } elseif (is_array($rec)) { // If the record is an array (which it will always be... :-)
875 // Create instance of TCEforms, setting defaults:
876 $tceforms = t3lib_div
::makeInstance('t3lib_TCEforms');
877 $tceforms->backPath
= $BACK_PATH;
878 $tceforms->initDefaultBEMode();
879 $tceforms->fieldOrder
= $this->modTSconfig
['properties']['tt_content.']['fieldOrder'];
880 $tceforms->palettesCollapsed
= !$this->MOD_SETTINGS
['showPalettes'];
881 $tceforms->disableRTE
= $this->MOD_SETTINGS
['disableRTE'];
882 $tceforms->enableClickMenu
= TRUE;
884 // Clipboard is initialized:
885 $tceforms->clipObj
= t3lib_div
::makeInstance('t3lib_clipboard'); // Start clipboard
886 $tceforms->clipObj
->initializeClipboard(); // Initialize - reads the clipboard content from the user session
889 if ($BE_USER->uc
['edit_showFieldHelp']!='text' && $this->MOD_SETTINGS
['showDescriptions']) $tceforms->edit_showFieldHelp
='text';
891 // Render form, wrap it:
893 $panel.=$tceforms->getMainFields($this->eRParts
[0],$rec);
894 $panel=$tceforms->wrapTotal($panel,$rec,$this->eRParts
[0]);
896 // Add hidden fields:
898 if ($uidVal=='new') {
899 $theCode.='<input type="hidden" name="data['.$this->eRParts
[0].']['.$rec['uid'].'][pid]" value="'.$rec['pid'].'" />';
902 <input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />
903 <input type="hidden" name="_disableRTE" value="'.$tceforms->disableRTE
.'" />
904 <input type="hidden" name="edit_record" value="'.$edit_record.'" />
905 <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
).'" />
908 // Add JavaScript as needed around the form:
909 $theCode=$tceforms->printNeededJSFunctions_top().$theCode.$tceforms->printNeededJSFunctions();
911 // Add warning sign if record was "locked":
912 if ($lockInfo = t3lib_BEfunc
::isRecordLocked($this->eRParts
[0], $rec['uid'])) {
913 $lockedMessage = t3lib_div
::makeInstance(
914 't3lib_FlashMessage',
915 htmlspecialchars($lockInfo['msg']),
917 t3lib_FlashMessage
::WARNING
919 t3lib_FlashMessageQueue
::addMessage($lockedMessage);
922 // Add whole form as a document section:
923 $content .= $this->doc
->section('', $theCode);
926 // If no edit access, print error message:
927 $content.=$this->doc
->section($LANG->getLL('noAccess'),$LANG->getLL('noAccess_msg').'<br /><br />',0,1);
931 // Bottom controls (function menus):
932 $q_count = $this->getNumberOfHiddenElements();
933 $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"').
934 '<label for="checkTt_content_showHidden">'.(!$q_count?
$GLOBALS['TBE_TEMPLATE']->dfw($LANG->getLL('hiddenCE',1)):$LANG->getLL('hiddenCE',1).' ('.$q_count.')').'</label>';
936 $h_func_b.= '<br />'.
937 t3lib_BEfunc
::getFuncCheck($this->id
,'SET[showPalettes]',$this->MOD_SETTINGS
['showPalettes'],'db_layout.php','','id="checkShowPalettes"').
938 '<label for="checkShowPalettes">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPalettes',1).'</label>';
940 if (t3lib_extMgm
::isLoaded('context_help') && $BE_USER->uc
['edit_showFieldHelp']!='text') {
941 $h_func_b.= '<br />'.
942 t3lib_BEfunc
::getFuncCheck($this->id
,'SET[showDescriptions]',$this->MOD_SETTINGS
['showDescriptions'],'db_layout.php','','id="checkShowDescriptions"').
943 '<label for="checkShowDescriptions">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showDescriptions',1).'</label>';
946 if ($BE_USER->isRTE()) {
947 $h_func_b.= '<br />'.
948 t3lib_BEfunc
::getFuncCheck($this->id
,'SET[disableRTE]',$this->MOD_SETTINGS
['disableRTE'],'db_layout.php','','id="checkDisableRTE"').
949 '<label for="checkDisableRTE">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.disableRTE',1).'</label>';
952 // Add the function menus to bottom:
953 $content.=$this->doc
->section('',$h_func_b,0,0);
954 $content.=$this->doc
->spacer(10);
957 // Select element matrix:
958 if ($this->eRParts
[0]=='tt_content' && t3lib_div
::testInt($this->eRParts
[1])) {
959 $posMap = t3lib_div
::makeInstance('ext_posMap');
960 $posMap->backPath
= $BACK_PATH;
961 $posMap->cur_sys_language
=$this->current_sys_language
;
966 $HTMLcode.= t3lib_BEfunc
::cshItem($this->descrTable
, 'quickEdit_selElement', $BACK_PATH, '|<br />');
968 $HTMLcode.=$posMap->printContentElementColumns($this->id
,$this->eRParts
[1],$this->colPosList
,$this->MOD_SETTINGS
['tt_content_showHidden'],$this->R_URI
);
970 $content.=$this->doc
->spacer(20);
971 $content.=$this->doc
->section($LANG->getLL('CEonThisPage'),$HTMLcode,0,1);
972 $content.=$this->doc
->spacer(20);
975 // Finally, if comments were generated in TCEforms object, print these as a HTML comment:
976 if (count($tceforms->commentMessages
)) {
978 <!-- TCEFORM messages
979 '.htmlspecialchars(implode(LF
,$tceforms->commentMessages
)).'
987 * Rendering all other listings than QuickEdit
991 function renderListContent() {
992 global $LANG,$BACK_PATH,$TCA;
994 // Initialize list object (see "class.db_layout.inc"):
995 $dblist = t3lib_div
::makeInstance('tx_cms_layout');
996 $dblist->backPath
= $BACK_PATH;
997 $dblist->thumbs
= $this->imagemode
;
998 $dblist->no_noWrap
= 1;
999 $dblist->descrTable
= $this->descrTable
;
1001 $this->pointer
= t3lib_div
::intInRange($this->pointer
,0,100000);
1002 $dblist->script
= 'db_layout.php';
1003 $dblist->showIcon
= 0;
1004 $dblist->setLMargin
=0;
1005 $dblist->doEdit
= $this->EDIT_CONTENT
;
1006 $dblist->ext_CALC_PERMS
= $this->CALC_PERMS
;
1008 $dblist->agePrefixes
= $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
1009 $dblist->id
= $this->id
;
1010 $dblist->nextThree
= t3lib_div
::intInRange($this->modTSconfig
['properties']['editFieldsAtATime'],0,10);
1011 $dblist->option_showBigButtons
= ($this->modTSconfig
['properties']['disableBigButtons'] === '0');
1012 $dblist->option_newWizard
= $this->modTSconfig
['properties']['disableNewContentElementWizard'] ?
0 : 1;
1013 $dblist->defLangBinding
= $this->modTSconfig
['properties']['defLangBinding'] ?
1 : 0;
1014 if (!$dblist->nextThree
) $dblist->nextThree
= 1;
1016 $dblist->externalTables
= $this->externalTables
;
1018 // Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!)
1019 $h_menu = $dblist->getTableMenu($this->id
);
1021 // Initialize other variables:
1023 $tableOutput=array();
1024 $tableJSOutput=array();
1027 // Traverse the list of table names which has records on this page (that array is populated by the $dblist object during the function getTableMenu()):
1028 foreach ($dblist->activeTables
as $table => $value) {
1030 // Load full table definitions:
1031 t3lib_div
::loadTCA($table);
1033 if (!isset($dblist->externalTables
[$table])) {
1034 // Creating special conditions for each table:
1037 $h_func = t3lib_BEfunc
::getFuncMenu($this->id
,'SET[tt_board]',$this->MOD_SETTINGS
['tt_board'],$this->MOD_MENU
['tt_board'],'db_layout.php','');
1040 $h_func = t3lib_BEfunc
::getFuncMenu($this->id
,'SET[tt_address]',$this->MOD_SETTINGS
['tt_address'],$this->MOD_MENU
['tt_address'],'db_layout.php','');
1043 $h_func = t3lib_BEfunc
::getFuncMenu($this->id
,'SET[tt_links]',$this->MOD_SETTINGS
['tt_links'],$this->MOD_MENU
['tt_links'],'db_layout.php','');
1046 $h_func = t3lib_BEfunc
::getFuncMenu($this->id
,'SET[tt_calender]',$this->MOD_SETTINGS
['tt_calender'],$this->MOD_MENU
['tt_calender'],'db_layout.php','');
1049 $h_func = t3lib_BEfunc
::getFuncMenu($this->id
,'SET[tt_products]',$this->MOD_SETTINGS
['tt_products'],$this->MOD_MENU
['tt_products'],'db_layout.php','');
1057 $q_count = $this->getNumberOfHiddenElements();
1058 $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>';
1060 $dblist->tt_contentConfig
['showCommands'] = 1; // Boolean: Display up/down arrows and edit icons for tt_content records
1061 $dblist->tt_contentConfig
['showInfo'] = 1; // Boolean: Display info-marks or not
1062 $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
1064 if ($this->MOD_SETTINGS
['function'] == 4) {
1066 $dblist->tt_contentConfig
['showAsGrid'] = 1;
1069 // Setting up the tt_content columns to show:
1070 if (is_array($TCA['tt_content']['columns']['colPos']['config']['items'])) {
1072 $tcaItems = t3lib_div
::callUserFunction( 'EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getColPosListItemsParsed' , $this->id
, $this );
1073 foreach($tcaItems as $temp) {
1074 $colList[] = $temp[1];
1076 } else { // ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
1077 $colList = array('1','0','2','3');
1079 if (strcmp($this->colPosList
,'')) {
1080 $colList = array_intersect(t3lib_div
::intExplode(',',$this->colPosList
),$colList);
1083 // If only one column found, display the single-column view.
1084 if (count($colList) === 1 && !$this->MOD_SETTINGS
['function'] === 4) {
1085 $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
1086 $dblist->tt_contentConfig
['showSingleCol'] = current($colList); // The column(s) to show if single mode (under each other)
1088 $dblist->tt_contentConfig
['cols'] = implode(',',$colList); // The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
1089 $dblist->tt_contentConfig
['showHidden'] = $this->MOD_SETTINGS
['tt_content_showHidden'];
1090 $dblist->tt_contentConfig
['sys_language_uid'] = intval($this->current_sys_language
);
1092 // If the function menu is set to "Language":
1093 if ($this->MOD_SETTINGS
['function']==2) {
1094 $dblist->tt_contentConfig
['single'] = 0;
1095 $dblist->tt_contentConfig
['languageMode'] = 1;
1096 $dblist->tt_contentConfig
['languageCols'] = $this->MOD_MENU
['language'];
1097 $dblist->tt_contentConfig
['languageColsPointer'] = $this->current_sys_language
;
1102 if (isset($this->MOD_SETTINGS
) && isset($this->MOD_MENU
)) {
1103 $h_func = t3lib_BEfunc
::getFuncMenu($this->id
, 'SET[' . $table . ']', $this->MOD_SETTINGS
[$table], $this->MOD_MENU
[$table], 'db_layout.php', '');
1109 // Start the dblist object:
1110 $dblist->itemsLimitSingleTable
= 1000;
1111 $dblist->start($this->id
,$table,$this->pointer
,$this->search_field
,$this->search_levels
,$this->showLimit
);
1112 $dblist->counter
= $CMcounter;
1113 $dblist->ext_function
= $this->MOD_SETTINGS
['function'];
1115 // Render versioning selector:
1116 $dblist->HTMLcode
.= $this->doc
->getVersionSelector($this->id
);
1118 // Generate the list of elements here:
1119 $dblist->generateList();
1121 // Adding the list content to the tableOutput variable:
1122 $tableOutput[$table]=
1123 ($h_func?
$h_func.'<br /><img src="clear.gif" width="1" height="4" alt="" /><br />':'').
1125 ($h_func_b?
'<img src="clear.gif" width="1" height="10" alt="" /><br />'.$h_func_b:'');
1127 // ... and any accumulated JavaScript goes the same way!
1128 $tableJSOutput[$table] = $dblist->JScode
;
1130 // Increase global counter:
1131 $CMcounter+
= $dblist->counter
;
1133 // Reset variables after operation:
1134 $dblist->HTMLcode
='';
1138 } // END: traverse tables
1141 // For Context Sensitive Menus:
1142 $this->doc
->getContextMenuCode();
1144 // Now, create listing based on which element is selected in the function menu:
1146 if ($this->MOD_SETTINGS
['function']==3) {
1148 // Making page info:
1149 $content.=$this->doc
->spacer(10);
1150 $content.=$this->doc
->section($LANG->getLL('pageInformation'),$dblist->getPageInfoBox($this->pageinfo
,$this->CALC_PERMS
&2),0,1);
1153 // Add the content for each table we have rendered (traversing $tableOutput variable)
1154 foreach($tableOutput as $table => $output) {
1155 $content.=$this->doc
->section('<a name="'.$table.'"></a>'.$dblist->activeTables
[$table],$output,TRUE,TRUE,0,TRUE);
1156 $content.=$this->doc
->spacer(15);
1157 $content.=$this->doc
->sectionEnd();
1160 // Making search form:
1161 if (!$this->modTSconfig
['properties']['disableSearchBox'] && count($tableOutput)) {
1162 $sectionTitle = t3lib_BEfunc
::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.search', TRUE));
1163 $content .= $this->doc
->section(
1165 $dblist->getSearchBox(0),
1166 FALSE, TRUE, FALSE, TRUE
1170 // Making display of Sys-notes (from extension "sys_note")
1171 $dblist->id
=$this->id
;
1172 $sysNotes = $dblist->showSysNotesForPage();
1174 $content.=$this->doc
->spacer(10);
1175 $content.=$this->doc
->section($LANG->getLL('internalNotes'),$sysNotes,0,1);
1178 // Add spacer in bottom of page:
1179 $content.=$this->doc
->spacer(10);
1183 $content.=$this->doc
->spacer(10);
1189 * Print accumulated content of module
1193 function printContent() {
1194 echo $this->content
;
1197 /***************************
1199 * Sub-content functions, rendering specific parts of the module content.
1201 ***************************/
1204 * Create the panel of buttons for submitting the form or otherwise perform operations.
1206 * @param string Identifier for function of module
1207 * @return array all available buttons as an assoc. array
1209 protected function getButtons($function = '') {
1210 global $TCA, $LANG, $BACK_PATH, $BE_USER;
1214 'history_page' => '',
1215 'new_content' => '',
1217 'move_record' => '',
1220 'record_list' => '',
1225 'savedokshow' => '',
1229 'history_record' => ''
1233 $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) . '">' .
1234 t3lib_iconWorks
::getSpriteIcon('actions-document-view') .
1238 if ($BE_USER->mayMakeShortcut()) {
1239 $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']);
1243 if (!$this->modTSconfig
['properties']['disableAdvanced']) {
1244 $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) . '">' .
1245 t3lib_iconWorks
::getSpriteIcon('actions-system-cache-clear') .
1249 // If access to Web>List for user, then link to that module.
1250 $buttons['record_list'] = t3lib_extMgm
::createListViewLink(
1251 $this->pageinfo
['uid'],
1252 '&returnUrl=' . rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI')),
1253 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', TRUE)
1256 if (!$this->modTSconfig
['properties']['disableIconToolbar']) {
1259 $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) . '">' .
1260 t3lib_iconWorks
::getSpriteIcon('actions-document-history-open') .
1262 // New content element
1263 $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) . '">' .
1264 t3lib_iconWorks
::getSpriteIcon('actions-document-new') .
1267 $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) . '">' .
1268 t3lib_iconWorks
::getSpriteIcon('actions-page-move') .
1271 if (t3lib_div
::testInt($this->eRParts
[1])) {
1272 $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'))) . '">' .
1273 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))) .
1276 // Create new page (wizard)
1277 $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) . '">' .
1278 t3lib_iconWorks
::getSpriteIcon('actions-page-new') .
1280 // Edit page properties
1281 if ($this->CALC_PERMS
&2) {
1282 $params='&edit[pages][' . $this->id
. ']=edit';
1283 $buttons['edit_page'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc
::editOnClick($params, $BACK_PATH)) . '" title="' . $LANG->getLL('editPageProperties', TRUE) . '">' .
1284 t3lib_iconWorks
::getSpriteIcon('actions-page-open') .
1288 // Add CSH (Context Sensitive Help) icon to tool bar
1289 if($function == 'quickEdit') {
1290 $buttons['csh'] = t3lib_BEfunc
::cshItem($this->descrTable
, 'quickEdit', $BACK_PATH, '', TRUE, 'margin-top: 0px; margin-bottom: 0px;');
1292 $buttons['csh'] = t3lib_BEfunc
::cshItem($this->descrTable
, 'columns_' . $this->MOD_SETTINGS
['function'], $BACK_PATH, '', TRUE, 'margin-top: 0px; margin-bottom: 0px;');
1295 if($function == 'quickEdit') {
1297 $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="" />';
1299 // Save record and show page
1300 $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) . '">' .
1301 t3lib_iconWorks
::getSpriteIcon('actions-document-save-view') .
1305 $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) . '">' .
1306 t3lib_iconWorks
::getSpriteIcon('actions-document-close') .
1310 if($this->deleteButton
) {
1311 $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) . '">' .
1312 t3lib_iconWorks
::getSpriteIcon('actions-edit-delete') .
1316 if($this->undoButton
) {
1318 $buttons['undo'] = '<a href="#"
1319 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;') . '"
1320 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')))) . '">' .
1321 t3lib_iconWorks
::getSpriteIcon('actions-edit-undo') .
1325 $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) . '">' .
1326 t3lib_iconWorks
::getSpriteIcon('actions-document-history-open') .
1335 /*******************************
1339 ******************************/
1342 * Returns the number of hidden elements (including those hidden by start/end times) on the current page (for the current sys_language)
1346 function getNumberOfHiddenElements() {
1347 return $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
1350 'pid=' . intval($this->id
) .
1351 ' AND sys_language_uid=' . intval($this->current_sys_language
) .
1352 t3lib_BEfunc
::BEenableFields('tt_content', 1) .
1353 t3lib_BEfunc
::deleteClause('tt_content') .
1354 t3lib_BEfunc
::versioningPlaceholderClause('tt_content')
1359 * Returns URL to the current script.
1360 * In particular the "popView" and "new_unique_uid" Get vars are unset.
1362 * @param array Parameters array, merged with global GET vars.
1363 * @return string URL
1365 function local_linkThisScript($params) {
1366 $params['popView']='';
1367 $params['new_unique_uid']='';
1368 return t3lib_div
::linkThisScript($params);
1372 * Returns a SQL query for selecting sys_language records.
1374 * @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)
1375 * @return string Return query string.
1377 function exec_languageQuery($id) {
1379 $exQ = t3lib_BEfunc
::deleteClause('pages_language_overlay') . ($GLOBALS['BE_USER']->isAdmin()?
'':' AND sys_language.hidden=0');
1380 return $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1382 'pages_language_overlay,sys_language',
1383 'pages_language_overlay.sys_language_uid=sys_language.uid AND pages_language_overlay.pid='.intval($id).$exQ,
1384 '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',
1385 'sys_language.title'
1388 return $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1391 'sys_language.hidden=0',
1393 'sys_language.title'
1400 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['ext/cms/layout/db_layout.php']) {
1401 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['ext/cms/layout/db_layout.php']);
1406 $SOBE = t3lib_div
::makeInstance('SC_db_layout');
1410 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
1412 $SOBE->clearCache();
1414 $SOBE->printContent();