2 /***************************************************************
5 * (c) 1999-2011 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 ***************************************************************/
31 * 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>
41 require($BACK_PATH.'init.php');
42 $LANG->includeLLFile('EXT:cms/layout/locallang.xml');
43 require_once('class.tx_cms_layout.php');
44 $BE_USER->modAccess($MCONF, 1);
46 // Will open up records locked by current user. It's assumed that the locking should end if this script is hit.
47 t3lib_BEfunc
::lockRecords();
49 // Exits if 'cms' extension is not loaded:
50 t3lib_extMgm
::isLoaded('cms', 1);
53 * Local extension of position map class
55 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
59 class ext_posMap
extends t3lib_positionMap
{
60 var $dontPrintPageInsertIcons = 1;
61 var $l_insertNewRecordHere = 'newContentElement';
64 * Wrapping the title of the record.
66 * @param string $str The title value.
67 * @param array $row The record row.
68 * @return string Wrapped title string.
70 function wrapRecordTitle($str, $row) {
71 $aOnClick = 'jumpToUrl(\''.$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:'.$row['uid'])).'\');return false;';
72 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>';
76 * Wrapping the column header
78 * @param string $str Header value
79 * @param string $vv Column info.
81 * @see printRecordMap()
83 function wrapColumnHeader($str, $vv) {
84 $aOnClick = 'jumpToUrl(\''.$GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'_EDIT_COL:'.$vv)).'\');return false;';
85 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>';
89 * Create on-click event value.
91 * @param array $row The record.
92 * @param string $vv Column position value.
93 * @param integer $moveUid Move uid
94 * @param integer $pid PID value.
95 * @param integer $sys_lang System language
98 function onClickInsertRecord($row, $vv, $moveUid, $pid, $sys_lang = 0) {
100 $location = $GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:new/-'.$row['uid'].'/'.$row['colPos']));
102 $location = $GLOBALS['SOBE']->local_linkThisScript(array('edit_record'=>'tt_content:new/'.$pid.'/'.$vv));
104 return 'jumpToUrl(\''.$location.'\');return false;';
108 * Wrapping the record header (from getRecordHeader())
110 * @param string $str HTML content
111 * @param array $row Record array.
112 * @return string HTML content
114 function wrapRecordHeader($str, $row) {
115 if ($row['uid'] == $this->moveUid
) {
116 return '<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'], 'gfx/content_client.gif', 'width="7" height="10"').' alt="" />'.$str;
124 * Script Class for Web > Layout module
126 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
133 // Page Id for which to make the listing
135 // Pointer - for browsing list of records.
147 // Clear-cache flag - if set, clears page cache for current id.
149 // PopView id - for opening a window with the page
151 // 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).
153 // 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.
157 // Page select perms clause
161 // Current ids page record
165 * Document template object
170 // Back path of the module
172 // "Pseudo" Description -table name
174 // List of column-integers to edit. Is set from TSconfig, default is "1,0,2,3"
176 // Flag: If content can be edited or not.
178 // Users permissions integer for this page.
180 // Currently selected language for editing content elements
181 var $current_sys_language;
182 // Module configuration
184 // Menu configuration
185 var $MOD_MENU=array();
186 // Module settings (session variable)
187 var $MOD_SETTINGS=array();
188 // Array, where files to include is accumulated in the init() function
189 var $include_once=array();
190 // Array of tables to be listed by the Web > Page module in addition to the default tables
191 var $externalTables = array();
193 // Internal, dynamic:
194 // Module output accumulation
196 // Function menu temporary storage
198 // Temporary storage for page edit icon
202 * Initializing the module
208 // Setting module configuration / page select clause
209 $this->MCONF
= $GLOBALS['MCONF'];
210 $this->perms_clause
= $GLOBALS['BE_USER']->getPagePermsClause(1);
211 $this->backPath
= $GLOBALS['BACK_PATH'];
214 $this->id
= intval(t3lib_div
::_GP('id'));
215 $this->pointer
= t3lib_div
::_GP('pointer');
216 $this->imagemode
= t3lib_div
::_GP('imagemode');
218 $this->clear_cache
= t3lib_div
::_GP('clear_cache');
219 $this->popView
= t3lib_div
::_GP('popView');
220 $this->edit_record
= t3lib_div
::_GP('edit_record');
221 $this->new_unique_uid
= t3lib_div
::_GP('new_unique_uid');
222 $this->search_field
= t3lib_div
::_GP('search_field');
223 $this->search_levels
= t3lib_div
::_GP('search_levels');
224 $this->showLimit
= t3lib_div
::_GP('showLimit');
225 $this->returnUrl
= t3lib_div
::sanitizeLocalUrl(t3lib_div
::_GP('returnUrl'));
226 $this->externalTables
= $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables'];
228 // Load page info array:
229 $this->pageinfo
= t3lib_BEfunc
::readPageAccess($this->id
, $this->perms_clause
);
234 // Setting sys language from session var:
235 $this->current_sys_language
=intval($this->MOD_SETTINGS
['language']);
237 // CSH / Descriptions:
238 $this->descrTable
= '_MOD_'.$this->MCONF
['name'];
242 * Initialize menu array
246 function menuConfig() {
248 $this->MOD_MENU
= array(
249 'tt_content_showHidden' => '',
250 'showPalettes' => '',
251 'showDescriptions' => '',
254 0 => $GLOBALS['LANG']->getLL('m_function_0'),
255 1 => $GLOBALS['LANG']->getLL('m_function_1'),
256 2 => $GLOBALS['LANG']->getLL('m_function_2')
259 0 => $GLOBALS['LANG']->getLL('m_default')
264 // $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables']['tx_myext'] =
265 // array ('default' => array(
266 // 'MENU' => 'LLL:EXT:tx_myext/locallang_db.xml:menuDefault',
267 // 'fList' => 'title,description,image',
269 if (is_array($this->externalTables
)) {
270 foreach ($this->externalTables
as $table => $tableSettings) {
271 // delete the default settings from above
272 if (is_array($this->MOD_MENU
[$table])) {
273 unset ($this->MOD_MENU
[$table]);
275 if (is_array($tableSettings) && count($tableSettings) > 1) {
276 foreach ($tableSettings as $key => $settings) {
277 $this->MOD_MENU
[$table][$key] = $GLOBALS['LANG']->sL($settings['MENU']);
283 // 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.
284 $res = $this->exec_languageQuery($this->id
);
285 while ($lrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
286 if ($GLOBALS['BE_USER']->checkLanguageAccess($lrow['uid'])) {
287 $this->MOD_MENU
['language'][$lrow['uid']] = ($lrow['hidden']?
'('.$lrow['title'].')':$lrow['title']);
291 // Find if there are ANY languages at all (and if not, remove the language option from function menu).
292 $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
295 ($GLOBALS['BE_USER']->isAdmin() ?
'' : 'hidden=0')
298 unset($this->MOD_MENU
['function']['2']);
301 // page/be_user TSconfig settings and blinding of menu-items
302 $this->modSharedTSconfig
= t3lib_BEfunc
::getModTSconfig($this->id
, 'mod.SHARED');
303 $this->modTSconfig
= t3lib_BEfunc
::getModTSconfig($this->id
, 'mod.'.$this->MCONF
['name']);
304 if ($this->modTSconfig
['properties']['QEisDefault']) ksort($this->MOD_MENU
['function']);
305 $this->MOD_MENU
['function'] = t3lib_BEfunc
::unsetMenuItems($this->modTSconfig
['properties'], $this->MOD_MENU
['function'], 'menu.function');
307 if (!$this->modTSconfig
['properties']['disablePageInformation']) {
308 $this->MOD_MENU
['function'][3] = $GLOBALS['LANG']->getLL('pageInformation');
311 // Remove QuickEdit as option if page type is not...
312 if (!t3lib_div
::inList($GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'] . ',6', $this->pageinfo
['doktype'])) {
313 unset($this->MOD_MENU
['function'][0]);
316 // Setting alternative default label:
317 if (($this->modSharedTSconfig
['properties']['defaultLanguageLabel'] ||
$this->modTSconfig
['properties']['defaultLanguageLabel']) && isset($this->MOD_MENU
['language'][0])) {
318 $this->MOD_MENU
['language'][0] = $this->modTSconfig
['properties']['defaultLanguageLabel'] ?
$this->modSharedTSconfig
['properties']['defaultLanguageLabel'] : $this->modSharedTSconfig
['properties']['defaultLanguageLabel'];
322 $this->MOD_SETTINGS
= t3lib_BEfunc
::getModuleData($this->MOD_MENU
, t3lib_div
::_GP('SET'), $this->MCONF
['name']);
324 // For all elements to be shown in draft workspaces & to also show hidden elements by default if user hasn't disabled the option
325 if (($GLOBALS['BE_USER']->workspace
!= 0) ||
($this->MOD_SETTINGS
['tt_content_showHidden'] !== '0')) {
326 $this->MOD_SETTINGS
['tt_content_showHidden'] = 1;
331 * Clears page cache for the current id, $this->id
335 function clearCache() {
336 if ($this->clear_cache
) {
337 $tce = t3lib_div
::makeInstance('t3lib_TCEmain');
338 $tce->stripslashes_values
= 0;
339 $tce->start(array(), array());
340 $tce->clear_cacheCmd($this->id
);
346 * Creates some general objects and calls other functions for the main rendering of module content.
352 // The page will show only if there is a valid page and if this page may be viewed by the user
353 $access = is_array($this->pageinfo
) ?
1 : 0;
354 if ($this->id
&& $access) {
356 // Initialize permission settings:
357 $this->CALC_PERMS
= $GLOBALS['BE_USER']->calcPerms($this->pageinfo
);
358 $this->EDIT_CONTENT
= ($this->CALC_PERMS
&16) ?
1 : 0;
360 // Start document template object:
361 $this->doc
= t3lib_div
::makeInstance('template');
362 $this->doc
->backPath
= $GLOBALS['BACK_PATH'];
363 $this->doc
->setModuleTemplate('templates/db_layout.html');
366 $this->doc
->JScode
= '<script type="text/javascript" ' .
367 'src="' . t3lib_div
::createVersionNumberedFilename($GLOBALS['BACK_PATH'] . '../t3lib/jsfunc.updateform.js') . '">' .
369 $this->doc
->JScode
.= $this->doc
->wrapScriptTags('
370 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id
).';
371 if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages'.intval($this->id
).'_"+top.fsMod.currentBank; '.intval($this->id
).';
372 function jumpToUrl(URL,formEl) { //
373 if (document.editform && TBE_EDITOR.isFormChanged) { // Check if the function exists... (works in all browsers?)
374 if (!TBE_EDITOR.isFormChanged()) { //
375 window.location.href = URL;
377 if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
379 } else window.location.href = URL;
381 ' . ($this->popView ? t3lib_BEfunc
::viewOnClick($this->id
, $GLOBALS['BACK_PATH'], t3lib_BEfunc
::BEgetRootLine($this->id
)) : '') . '
383 function deleteRecord(table,id,url) { //
384 if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('deleteWarning')) . ')) {
385 window.location.href = "' . $GLOBALS['BACK_PATH'] .
386 'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $GLOBALS['BE_USER']->veriCode() .
387 t3lib_BEfunc
::getUrlToken('tceAction') . '&prErr=1&uPT=1";
392 $this->doc
->JScode
.= $this->doc
->wrapScriptTags('
393 var DTM_array = new Array();
394 var DTM_origClass = new String();
396 // if tabs are used in a popup window the array might not exists
397 if(!top.DTM_currentTabs) {
398 top.DTM_currentTabs = new Array();
401 function DTM_activate(idBase,index,doToogle) { //
403 if (DTM_array[idBase]) {
404 for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) {
405 if (DTM_array[idBase][cnt] != idBase+"-"+index) {
406 document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none";
407 document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
413 if (document.getElementById(idBase+"-"+index+"-DIV")) {
414 if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
415 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
416 if(DTM_origClass=="") {
417 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
419 DTM_origClass = "tab";
421 top.DTM_currentTabs[idBase] = -1;
423 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
424 if(DTM_origClass=="") {
425 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
427 DTM_origClass = "tabact";
429 top.DTM_currentTabs[idBase] = index;
433 function DTM_toggle(idBase,index,isInit) { //
435 if (document.getElementById(idBase+"-"+index+"-DIV")) {
436 if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
437 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
439 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
441 DTM_origClass = "tab";
443 top.DTM_currentTabs[idBase+"-"+index] = 0;
445 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
447 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
449 DTM_origClass = "tabact";
451 top.DTM_currentTabs[idBase+"-"+index] = 1;
456 function DTM_mouseOver(obj) { //
457 DTM_origClass = obj.attributes.getNamedItem(\'class\').nodeValue;
458 obj.attributes.getNamedItem(\'class\').nodeValue += "_over";
461 function DTM_mouseOut(obj) { //
462 obj.attributes.getNamedItem(\'class\').nodeValue = DTM_origClass;
467 // Setting doc-header
468 $this->doc
->form
='<form action="'.htmlspecialchars('db_layout.php?id='.$this->id
.'&imagemode='.$this->imagemode
).'" method="post">';
470 // Creating the top function menu:
471 $this->topFuncMenu
= t3lib_BEfunc
::getFuncMenu($this->id
, 'SET[function]', $this->MOD_SETTINGS
['function'], $this->MOD_MENU
['function'], 'db_layout.php', '');
472 $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', '') : '');
475 // SHARED page-TSconfig settings.
476 $modTSconfig_SHARED = t3lib_BEfunc
::getModTSconfig($this->id
, 'mod.SHARED');
477 $this->colPosList
= strcmp(trim($this->modTSconfig
['properties']['tt_content.']['colPos_list']), '') ?
trim($this->modTSconfig
['properties']['tt_content.']['colPos_list']) : $modTSconfig_SHARED['properties']['colPos_list'];
478 if (!strcmp($this->colPosList
, '')) {
479 $backendLayout = t3lib_div
::callUserFunction( 'EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getSelectedBackendLayout', $this->id
, $this );
481 if (count($backendLayout['__colPosList'])) {
482 $this->colPosList
= implode(',', $backendLayout['__colPosList']);
485 if (!strcmp($this->colPosList
, '')) {
486 $this->colPosList
= '1,0,2,3';
488 // Removing duplicates, if any
489 $this->colPosList
= implode(',', array_unique(t3lib_div
::intExplode(',', $this->colPosList
)));
491 // Render the primary module content:
492 if ($this->MOD_SETTINGS
['function'] == 0) {
494 $body = $this->renderQuickEdit();
496 // All other listings
497 $body = $this->renderListContent();
500 // If page is a folder
501 if ($this->pageinfo
['doktype'] == 254) {
503 // access to list module
504 $moduleLoader = t3lib_div
::makeInstance('t3lib_loadModules');
505 $moduleLoader->load($GLOBALS['TBE_MODULES']);
506 $modules = $moduleLoader->modules
;
508 if (is_array($modules['web']['sub']['list'])) {
509 $flashMessage = t3lib_div
::makeInstance(
510 't3lib_FlashMessage',
511 '<p>' . $GLOBALS['LANG']->getLL('goToListModuleMessage') . '</p>
514 t3lib_iconWorks
::getSpriteIcon('actions-system-list-open') .
515 '<a href="javascript:top.goToModule( \'web_list\',1);">' .
516 $GLOBALS['LANG']->getLL('goToListModule') . '
520 t3lib_FlashMessage
::INFO
522 $body = $flashMessage->render() . $body;
527 if ($this->pageinfo
['content_from_pid']) {
528 $contentPage = t3lib_BEfunc
::getRecord('pages', intval($this->pageinfo
['content_from_pid']));
529 $title = t3lib_BEfunc
::getRecordTitle('pages', $contentPage);
530 $linkToPid = $this->local_linkThisScript(array('id' => $this->pageinfo
['content_from_pid']));
531 $link = '<a href="' . $linkToPid . '">' . htmlspecialchars($title) . ' (PID ' . intval($this->pageinfo
['content_from_pid']) . ')</a>';
532 $flashMessage = t3lib_div
::makeInstance(
533 't3lib_FlashMessage',
535 sprintf($GLOBALS['LANG']->getLL('content_from_pid_title'), $link),
536 t3lib_FlashMessage
::INFO
538 $body = $flashMessage->render() . $body;
541 // Setting up the buttons and markers for docheader
542 $docHeaderButtons = $this->getButtons($this->MOD_SETTINGS
['function']==0 ?
'quickEdit' : '');
544 'CSH' => $docHeaderButtons['csh'],
545 'TOP_FUNCTION_MENU' => $this->editSelect
. $this->topFuncMenu
,
546 'LANGSELECTOR' => $this->languageMenu
,
550 // Build the <body> for the module
551 $this->content
.= $this->doc
->moduleBody($this->pageinfo
, $docHeaderButtons, $markers);
552 // Renders the module page
553 $this->content
= $this->doc
->render(
554 $GLOBALS['LANG']->getLL('title'),
560 // If no access or id value, create empty document:
561 $this->doc
= t3lib_div
::makeInstance('template');
562 $this->doc
->backPath
= $GLOBALS['BACK_PATH'];
563 $this->doc
->setModuleTemplate('templates/db_layout.html');
565 $this->doc
->JScode
= $this->doc
->wrapScriptTags('
566 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id
).';
569 $flashMessage = t3lib_div
::makeInstance(
570 't3lib_FlashMessage',
571 $GLOBALS['LANG']->getLL('clickAPage_content'),
572 $GLOBALS['LANG']->getLL('clickAPage_header'),
573 t3lib_FlashMessage
::INFO
575 $body = $flashMessage->render();
577 // Setting up the buttons and markers for docheader
578 $docHeaderButtons = array(
580 'history_page' => '',
595 'history_record' => ''
599 'CSH' => t3lib_BEfunc
::cshItem($this->descrTable
, '', $GLOBALS['BACK_PATH'], '', TRUE
),
600 'TOP_FUNCTION_MENU' => '',
601 'LANGSELECTOR' => '',
605 $this->content
.= $this->doc
->moduleBody($this->pageinfo
, $docHeaderButtons, $markers);
606 // Renders the module page
607 $this->content
= $this->doc
->render(
608 $GLOBALS['LANG']->getLL('title'),
615 * Rendering the quick-edit view.
619 function renderQuickEdit() {
620 // Alternative template
621 $this->doc
->setModuleTemplate('templates/db_layout_quickedit.html');
623 // Alternative form tag; Quick Edit submits its content to tce_db.php.
624 $this->doc
->form
= '<form action="' .
625 htmlspecialchars($GLOBALS['BACK_PATH'] . 'tce_db.php?&prErr=1&uPT=1') . '" method="post" enctype="' .
626 $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
628 // Setting up the context sensitive menu:
629 $this->doc
->getContextMenuCode();
631 // Set the edit_record value for internal use in this function:
632 $edit_record = $this->edit_record
;
634 // If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php:
635 if (substr($edit_record, 0, 9) == '_EDIT_COL') {
636 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
639 'pid=' . intval($this->id
) . ' AND colPos=' . intval(substr($edit_record, 10)) . ' AND sys_language_uid=' . intval($this->current_sys_language
) .
640 ($this->MOD_SETTINGS
['tt_content_showHidden'] ?
'' : t3lib_BEfunc
::BEenableFields('tt_content')).
641 t3lib_BEfunc
::deleteClause('tt_content').
642 t3lib_BEfunc
::versioningPlaceholderClause('tt_content'),
647 while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
648 $idListA[] = $cRow['uid'];
651 $url = $GLOBALS['BACK_PATH'] . 'alt_doc.php?edit[tt_content][' . implode(',', $idListA) .
652 ']=edit&returnUrl=' . rawurlencode($this->local_linkThisScript(array('edit_record'=>'')));
653 t3lib_utility_Http
::redirect($url);
656 // If the former record edited was the creation of a NEW record, this will look up the created records uid:
657 if ($this->new_unique_uid
) {
658 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
661 'userid=' . intval($GLOBALS['BE_USER']->user
['uid']) . ' AND NEWid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->new_unique_uid
, 'sys_log')
663 $sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
664 if (is_array($sys_log_row)) {
665 $edit_record=$sys_log_row['tablename'].':'.$sys_log_row['recuid'];
670 // Creating the selector box, allowing the user to select which element to edit:
673 $languageOverlayRecord = '';
674 if ($this->current_sys_language
) {
675 list($languageOverlayRecord) = t3lib_BEfunc
::getRecordsByField('pages_language_overlay', 'pid', $this->id
, 'AND sys_language_uid='.intval($this->current_sys_language
));
677 if (is_array($languageOverlayRecord)) {
678 $inValue = 'pages_language_overlay:'.$languageOverlayRecord['uid'];
679 $is_selected +
= intval($edit_record==$inValue);
680 $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ?
' selected="selected"' : '') . '>[ ' . $GLOBALS['LANG']->getLL('editLanguageHeader', 1) . ' ]</option>';
682 $inValue = 'pages:'.$this->id
;
683 $is_selected +
= intval($edit_record==$inValue);
684 $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ?
' selected="selected"' : '') . '>[ ' . $GLOBALS['LANG']->getLL('editPageProperties', 1) . ' ]</option>';
687 // Selecting all content elements from this language and allowed colPos:
688 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
691 'pid='.intval($this->id
).' AND sys_language_uid='.intval($this->current_sys_language
).' AND colPos IN ('.$this->colPosList
.')'.
692 ($this->MOD_SETTINGS
['tt_content_showHidden'] ?
'' : t3lib_BEfunc
::BEenableFields('tt_content')).
693 t3lib_Befunc
::deleteClause('tt_content').
694 t3lib_BEfunc
::versioningPlaceholderClause('tt_content'),
700 // Page is the pid if no record to put this after.
702 while($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
703 t3lib_BEfunc
::workspaceOL('tt_content', $cRow);
705 if (is_array($cRow)) {
708 $edit_record='tt_content:'.$cRow['uid'];
712 if (strcmp($cRow['colPos'], $colPos)) {
713 $colPos = $cRow['colPos'];
714 $opt[] = '<option value=""></option>';
715 $opt[] = '<option value="_EDIT_COL:' . $colPos . '">__' . $GLOBALS['LANG']->sL(t3lib_BEfunc
::getLabelFromItemlist('tt_content', 'colPos', $colPos), 1) . ':__</option>';
717 $inValue = 'tt_content:'.$cRow['uid'];
718 $is_selected +
= intval($edit_record == $inValue);
719 $opt[] = '<option value="' . $inValue . '"' .
720 ($edit_record == $inValue ?
' selected="selected"' : '') .
721 '>' . htmlspecialchars(t3lib_div
::fixed_lgd_cs(
724 : '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title') . '] ' . strip_tags($cRow['bodytext'])),
725 $GLOBALS['BE_USER']->uc
['titleLen'])
727 $prev = -$cRow['uid'];
731 // If edit_record is not set (meaning, no content elements was found for this language) we simply set it to create a new element:
733 $edit_record='tt_content:new/'.$prev.'/'.$colPos;
735 $inValue = 'tt_content:new/'.$prev.'/'.$colPos;
736 $is_selected +
= intval($edit_record == $inValue);
737 $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ?
' selected="selected"' : '') . '>[ ' . $GLOBALS['LANG']->getLL('newLabel', 1) . ' ]</option>';
740 // If none is yet selected...
742 $opt[] = '<option value=""></option>';
743 $opt[] = '<option value="' . $edit_record . '" selected="selected">[ ' . $GLOBALS['LANG']->getLL('newLabel', 1) . ' ]</option>';
746 // Splitting the edit-record cmd value into table/uid:
747 $this->eRParts
= explode(':', $edit_record);
749 // Delete-button flag?
750 $this->deleteButton
= (t3lib_utility_Math
::canBeInterpretedAsInteger($this->eRParts
[1]) && $edit_record && (($this->eRParts
[0]!='pages' && $this->EDIT_CONTENT
) ||
($this->eRParts
[0]=='pages' && ($this->CALC_PERMS
&4))));
752 // If undo-button should be rendered (depends on available items in sys_history)
753 $this->undoButton
= 0;
754 $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');
755 if ($this->undoButtonR
= $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
756 $this->undoButton
= 1;
759 // Setting up the Return URL for coming back to THIS script (if links take the user to another script)
760 $R_URL_parts = parse_url(t3lib_div
::getIndpEnv('REQUEST_URI'));
761 $R_URL_getvars = t3lib_div
::_GET();
763 unset($R_URL_getvars['popView']);
764 unset($R_URL_getvars['new_unique_uid']);
765 $R_URL_getvars['edit_record']=$edit_record;
766 $this->R_URI
= $R_URL_parts['path'] . '?' . t3lib_div
::implodeArrayForUrl('', $R_URL_getvars);
768 // Setting close url/return url for exiting this script:
769 // Goes to 'Columns' view if close is pressed (default)
770 $this->closeUrl
= $this->local_linkThisScript(array('SET' => array('function' => 1)));
772 if ($GLOBALS['BE_USER']->uc
['condensedMode']) {
773 $this->closeUrl
= $GLOBALS['BACK_PATH'] . 'alt_db_navframe.php';
775 if ($this->returnUrl
) {
776 $this->closeUrl
= $this->returnUrl
;
778 // Return-url for JavaScript:
779 $retUrlStr = $this->returnUrl?
"+'&returnUrl='+'".rawurlencode($this->returnUrl
)."'":'';
781 // Drawing the edit record selectbox
782 $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>';
784 // Creating editing form:
785 if ($GLOBALS['BE_USER']->check('tables_modify', $this->eRParts
[0]) && $edit_record
786 && (($this->eRParts
[0] !== 'pages' && $this->EDIT_CONTENT
) ||
($this->eRParts
[0] === 'pages' && ($this->CALC_PERMS
&1)))) {
788 // Splitting uid parts for special features, if new:
789 list($uidVal, $ex_pid, $ex_colPos) = explode('/', $this->eRParts
[1]);
791 // Convert $uidVal to workspace version if any:
792 if ($uidVal != 'new') {
793 if ($draftRecord = t3lib_BEfunc
::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace
, $this->eRParts
[0], $uidVal, 'uid')) {
794 $uidVal = $draftRecord['uid'];
798 // Initializing transfer-data object:
799 $trData = t3lib_div
::makeInstance('t3lib_transferData');
800 $trData->addRawData
= TRUE
;
801 $trData->defVals
[$this->eRParts
[0]] = array (
802 'colPos' => intval($ex_colPos),
803 'sys_language_uid' => intval($this->current_sys_language
)
805 $trData->disableRTE
= $this->MOD_SETTINGS
['disableRTE'];
806 $trData->lockRecords
= 1;
808 $trData->fetchRecord($this->eRParts
[0], ($uidVal=='new'?
$this->id
:$uidVal), $uidVal);
810 // Getting/Making the record:
811 reset($trData->regTableItems_data
);
812 $rec = current($trData->regTableItems_data
);
813 if ($uidVal == 'new') {
814 $new_unique_uid = uniqid('NEW');
815 $rec['uid'] = $new_unique_uid;
816 $rec['pid'] = intval($ex_pid)?
intval($ex_pid):$this->id
;
817 $recordAccess = TRUE
;
819 $rec['uid'] = $uidVal;
821 // Checking internals access:
822 $recordAccess = $GLOBALS['BE_USER']->recordEditAccessInternals($this->eRParts
[0], $uidVal);
825 if (!$recordAccess) {
826 // If no edit access, print error message:
827 $content .= $this->doc
->section($GLOBALS['LANG']->getLL('noAccess'), $GLOBALS['LANG']->getLL('noAccess_msg') . '<br /><br />' .
828 ($GLOBALS['BE_USER']->errorMsg ?
'Reason: ' . $GLOBALS['BE_USER']->errorMsg
. '<br /><br />' : ''), 0, 1);
829 } elseif (is_array($rec)) { // If the record is an array (which it will always be... :-)
831 // Create instance of TCEforms, setting defaults:
832 $tceforms = t3lib_div
::makeInstance('t3lib_TCEforms');
833 $tceforms->backPath
= $GLOBALS['BACK_PATH'];
834 $tceforms->initDefaultBEMode();
835 $tceforms->fieldOrder
= $this->modTSconfig
['properties']['tt_content.']['fieldOrder'];
836 $tceforms->palettesCollapsed
= !$this->MOD_SETTINGS
['showPalettes'];
837 $tceforms->disableRTE
= $this->MOD_SETTINGS
['disableRTE'];
838 $tceforms->enableClickMenu
= TRUE
;
840 // Clipboard is initialized:
842 $tceforms->clipObj
= t3lib_div
::makeInstance('t3lib_clipboard');
843 // Initialize - reads the clipboard content from the user session
844 $tceforms->clipObj
->initializeClipboard();
847 if ($GLOBALS['BE_USER']->uc
['edit_showFieldHelp'] !== 'text' && $this->MOD_SETTINGS
['showDescriptions']) {
848 $tceforms->edit_showFieldHelp
= 'text';
851 // Render form, wrap it:
853 $panel .= $tceforms->getMainFields($this->eRParts
[0], $rec);
854 $panel = $tceforms->wrapTotal($panel, $rec, $this->eRParts
[0]);
856 // Add hidden fields:
858 if ($uidVal == 'new') {
859 $theCode .= '<input type="hidden" name="data['.$this->eRParts
[0].']['.$rec['uid'].'][pid]" value="'.$rec['pid'].'" />';
862 <input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />
863 <input type="hidden" name="_disableRTE" value="' . $tceforms->disableRTE
. '" />
864 <input type="hidden" name="edit_record" value="' . $edit_record . '" />
865 <input type="hidden" name="redirect" value="' . htmlspecialchars($uidVal == 'new' ? t3lib_extMgm
::extRelPath('cms') . 'layout/db_layout.php?id=' .
866 $this->id
. '&new_unique_uid=' . $new_unique_uid . '&returnUrl=' . rawurlencode($this->returnUrl
) : $this->R_URI
) . '" />
867 ' . t3lib_TCEforms
::getHiddenTokenField('tceAction');
869 // Add JavaScript as needed around the form:
870 $theCode=$tceforms->printNeededJSFunctions_top().$theCode.$tceforms->printNeededJSFunctions();
872 // Add warning sign if record was "locked":
873 if ($lockInfo = t3lib_BEfunc
::isRecordLocked($this->eRParts
[0], $rec['uid'])) {
874 $lockedMessage = t3lib_div
::makeInstance(
875 't3lib_FlashMessage',
876 htmlspecialchars($lockInfo['msg']),
878 t3lib_FlashMessage
::WARNING
880 t3lib_FlashMessageQueue
::addMessage($lockedMessage);
883 // Add whole form as a document section:
884 $content .= $this->doc
->section('', $theCode);
887 // If no edit access, print error message:
888 $content .= $this->doc
->section($GLOBALS['LANG']->getLL('noAccess'), $GLOBALS['LANG']->getLL('noAccess_msg') . '<br /><br />', 0, 1);
892 // Bottom controls (function menus):
893 $q_count = $this->getNumberOfHiddenElements();
894 $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"').
895 '<label for="checkTt_content_showHidden">' .
896 (!$q_count ?
$GLOBALS['TBE_TEMPLATE']->dfw($GLOBALS['LANG']->getLL('hiddenCE', 1)) : $GLOBALS['LANG']->getLL('hiddenCE', 1) .
897 ' (' . $q_count . ')') . '</label>';
899 $h_func_b.= '<br />'.
900 t3lib_BEfunc
::getFuncCheck($this->id
, 'SET[showPalettes]', $this->MOD_SETTINGS
['showPalettes'], 'db_layout.php', '', 'id="checkShowPalettes"').
901 '<label for="checkShowPalettes">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPalettes', 1) . '</label>';
903 if (t3lib_extMgm
::isLoaded('context_help') && $GLOBALS['BE_USER']->uc
['edit_showFieldHelp'] !== 'text') {
904 $h_func_b.= '<br />'.
905 t3lib_BEfunc
::getFuncCheck($this->id
, 'SET[showDescriptions]', $this->MOD_SETTINGS
['showDescriptions'], 'db_layout.php', '', 'id="checkShowDescriptions"').
906 '<label for="checkShowDescriptions">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showDescriptions', 1) . '</label>';
909 if ($GLOBALS['BE_USER']->isRTE()) {
910 $h_func_b.= '<br />'.
911 t3lib_BEfunc
::getFuncCheck($this->id
, 'SET[disableRTE]', $this->MOD_SETTINGS
['disableRTE'], 'db_layout.php', '', 'id="checkDisableRTE"').
912 '<label for="checkDisableRTE">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.disableRTE', 1) . '</label>';
915 // Add the function menus to bottom:
916 $content.=$this->doc
->section('', $h_func_b, 0, 0);
917 $content.=$this->doc
->spacer(10);
920 // Select element matrix:
921 if ($this->eRParts
[0]=='tt_content' && t3lib_utility_Math
::canBeInterpretedAsInteger($this->eRParts
[1])) {
922 $posMap = t3lib_div
::makeInstance('ext_posMap');
923 $posMap->backPath
= $GLOBALS['BACK_PATH'];
924 $posMap->cur_sys_language
=$this->current_sys_language
;
929 $HTMLcode.= t3lib_BEfunc
::cshItem($this->descrTable
, 'quickEdit_selElement', $GLOBALS['BACK_PATH'], '|<br />');
931 $HTMLcode.=$posMap->printContentElementColumns($this->id
, $this->eRParts
[1], $this->colPosList
, $this->MOD_SETTINGS
['tt_content_showHidden'], $this->R_URI
);
933 $content.=$this->doc
->spacer(20);
934 $content.=$this->doc
->section($GLOBALS['LANG']->getLL('CEonThisPage'), $HTMLcode, 0, 1);
935 $content.=$this->doc
->spacer(20);
938 // Finally, if comments were generated in TCEforms object, print these as a HTML comment:
939 if (count($tceforms->commentMessages
)) {
941 <!-- TCEFORM messages
942 '.htmlspecialchars(implode(LF
, $tceforms->commentMessages
)).'
950 * Rendering all other listings than QuickEdit
954 function renderListContent() {
955 // Initialize list object (see "class.db_layout.inc"):
956 /** @var $dblist tx_cms_layout */
957 $dblist = t3lib_div
::makeInstance('tx_cms_layout');
958 $dblist->backPath
= $GLOBALS['BACK_PATH'];
959 $dblist->thumbs
= $this->imagemode
;
960 $dblist->no_noWrap
= 1;
961 $dblist->descrTable
= $this->descrTable
;
963 $this->pointer
= t3lib_utility_Math
::forceIntegerInRange($this->pointer
, 0, 100000);
964 $dblist->script
= 'db_layout.php';
965 $dblist->showIcon
= 0;
966 $dblist->setLMargin
=0;
967 $dblist->doEdit
= $this->EDIT_CONTENT
;
968 $dblist->ext_CALC_PERMS
= $this->CALC_PERMS
;
970 $dblist->agePrefixes
= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
971 $dblist->id
= $this->id
;
972 $dblist->nextThree
= t3lib_utility_Math
::forceIntegerInRange($this->modTSconfig
['properties']['editFieldsAtATime'], 0, 10);
973 $dblist->option_showBigButtons
= ($this->modTSconfig
['properties']['disableBigButtons'] === '0');
974 $dblist->option_newWizard
= $this->modTSconfig
['properties']['disableNewContentElementWizard'] ?
0 : 1;
975 $dblist->defLangBinding
= $this->modTSconfig
['properties']['defLangBinding'] ?
1 : 0;
976 if (!$dblist->nextThree
) {
977 $dblist->nextThree
= 1;
980 $dblist->externalTables
= $this->externalTables
;
982 // Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!)
983 $h_menu = $dblist->getTableMenu($this->id
);
985 // Initialize other variables:
987 $tableOutput = array();
988 $tableJSOutput = array();
991 // Traverse the list of table names which has records on this page (that array is populated
992 // by the $dblist object during the function getTableMenu()):
993 foreach ($dblist->activeTables
as $table => $value) {
995 // Load full table definitions:
996 t3lib_div
::loadTCA($table);
998 if (!isset($dblist->externalTables
[$table])) {
999 $q_count = $this->getNumberOfHiddenElements();
1000 $h_func_b = t3lib_BEfunc
::getFuncCheck(
1002 'SET[tt_content_showHidden]',
1003 $this->MOD_SETTINGS
['tt_content_showHidden'],
1006 'id="checkTt_content_showHidden"'
1007 ) . '<label for="checkTt_content_showHidden">' .
1008 (!$q_count ?
$GLOBALS['TBE_TEMPLATE']->dfw($GLOBALS['LANG']->getLL('hiddenCE')) : $GLOBALS['LANG']->getLL('hiddenCE') . ' (' . $q_count . ')') . '</label>';
1009 // Boolean: Display up/down arrows and edit icons for tt_content records
1010 $dblist->tt_contentConfig
['showCommands'] = 1;
1011 // Boolean: Display info-marks or not
1012 $dblist->tt_contentConfig
['showInfo'] = 1;
1013 // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown
1014 // in the total width of the page
1015 $dblist->tt_contentConfig
['single'] = 0;
1017 if ($this->MOD_SETTINGS
['function'] == 4) {
1019 $dblist->tt_contentConfig
['showAsGrid'] = 1;
1022 // Setting up the tt_content columns to show:
1023 if (is_array($GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'])) {
1025 $tcaItems = t3lib_div
::callUserFunction( 'EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getColPosListItemsParsed', $this->id
, $this );
1026 foreach($tcaItems as $temp) {
1027 $colList[] = $temp[1];
1029 } else { // ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
1030 $colList = array('1', '0', '2', '3');
1032 if (strcmp($this->colPosList
, '')) {
1033 $colList = array_intersect(t3lib_div
::intExplode(',', $this->colPosList
), $colList);
1036 // If only one column found, display the single-column view.
1037 if (count($colList) === 1 && !$this->MOD_SETTINGS
['function'] === 4) {
1038 // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol']
1039 // is shown in the total width of the page
1040 $dblist->tt_contentConfig
['single'] = 1;
1041 // The column(s) to show if single mode (under each other)
1042 $dblist->tt_contentConfig
['showSingleCol'] = current($colList);
1044 // The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
1045 $dblist->tt_contentConfig
['cols'] = implode(',', $colList);
1046 $dblist->tt_contentConfig
['showHidden'] = $this->MOD_SETTINGS
['tt_content_showHidden'];
1047 $dblist->tt_contentConfig
['sys_language_uid'] = intval($this->current_sys_language
);
1049 // If the function menu is set to "Language":
1050 if ($this->MOD_SETTINGS
['function'] == 2) {
1051 $dblist->tt_contentConfig
['single'] = 0;
1052 $dblist->tt_contentConfig
['languageMode'] = 1;
1053 $dblist->tt_contentConfig
['languageCols'] = $this->MOD_MENU
['language'];
1054 $dblist->tt_contentConfig
['languageColsPointer'] = $this->current_sys_language
;
1057 if (isset($this->MOD_SETTINGS
) && isset($this->MOD_MENU
)) {
1058 $h_func = t3lib_BEfunc
::getFuncMenu($this->id
, 'SET[' . $table . ']', $this->MOD_SETTINGS
[$table], $this->MOD_MENU
[$table], 'db_layout.php', '');
1064 // Start the dblist object:
1065 $dblist->itemsLimitSingleTable
= 1000;
1066 $dblist->start($this->id
, $table, $this->pointer
, $this->search_field
, $this->search_levels
, $this->showLimit
);
1067 $dblist->counter
= $CMcounter;
1068 $dblist->ext_function
= $this->MOD_SETTINGS
['function'];
1070 // Render versioning selector:
1071 $dblist->HTMLcode
.= $this->doc
->getVersionSelector($this->id
);
1073 // Generate the list of elements here:
1074 $dblist->generateList();
1076 // Adding the list content to the tableOutput variable:
1077 $tableOutput[$table]=
1078 ($h_func ?
$h_func . '<br /><img src="clear.gif" width="1" height="4" alt="" /><br />' : '').
1080 ($h_func_b ?
'<img src="clear.gif" width="1" height="10" alt="" /><br />' . $h_func_b : '');
1082 // ... and any accumulated JavaScript goes the same way!
1083 $tableJSOutput[$table] = $dblist->JScode
;
1085 // Increase global counter:
1086 $CMcounter+
= $dblist->counter
;
1088 // Reset variables after operation:
1089 $dblist->HTMLcode
= '';
1090 $dblist->JScode
= '';
1093 } // END: traverse tables
1096 // For Context Sensitive Menus:
1097 $this->doc
->getContextMenuCode();
1099 $content .= $this->doc
->header($this->pageinfo
['title']);
1101 // Now, create listing based on which element is selected in the function menu:
1102 if ($this->MOD_SETTINGS
['function']==3) {
1104 // Making page info:
1105 $content .= $this->doc
->section($GLOBALS['LANG']->getLL('pageInformation'), $dblist->getPageInfoBox($this->pageinfo
, $this->CALC_PERMS
&2), 0, 1);
1108 // Add the content for each table we have rendered (traversing $tableOutput variable)
1109 foreach ($tableOutput as $table => $output) {
1110 $content .= $this->doc
->section('', $output, TRUE
, TRUE
, 0, TRUE
);
1111 $content .= $this->doc
->spacer(15);
1112 $content .= $this->doc
->sectionEnd();
1115 // Making search form:
1116 if (!$this->modTSconfig
['properties']['disableSearchBox'] && count($tableOutput)) {
1117 $sectionTitle = t3lib_BEfunc
::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.search', TRUE
));
1118 $content .= $this->doc
->section(
1120 $dblist->getSearchBox(0),
1121 FALSE
, TRUE
, FALSE
, TRUE
1125 // Making display of Sys-notes (from extension "sys_note")
1126 $dblist->id
=$this->id
;
1127 $sysNotes = $dblist->showSysNotesForPage();
1129 $content .= $this->doc
->spacer(10);
1130 $content .= $this->doc
->section($GLOBALS['LANG']->getLL('internalNotes'), $sysNotes, 0, 1);
1133 // Add spacer in bottom of page:
1134 $content.=$this->doc
->spacer(10);
1138 $content .= $this->doc
->spacer(10);
1144 * Print accumulated content of module
1148 function printContent() {
1149 echo $this->content
;
1152 /***************************
1154 * Sub-content functions, rendering specific parts of the module content.
1156 ***************************/
1159 * Create the panel of buttons for submitting the form or otherwise perform operations.
1161 * @param string $function Identifier for function of module
1162 * @return array all available buttons as an assoc. array
1164 protected function getButtons($function = '') {
1167 'history_page' => '',
1168 'new_content' => '',
1170 'move_record' => '',
1173 'record_list' => '',
1178 'savedokshow' => '',
1182 'history_record' => ''
1186 $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc
::viewOnClick($this->pageinfo
['uid'], $GLOBALS['BACK_PATH'], t3lib_BEfunc
::BEgetRootLine($this->pageinfo
['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', TRUE
) . '">' .
1187 t3lib_iconWorks
::getSpriteIcon('actions-document-view') .
1191 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
1192 $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']);
1196 if (!$this->modTSconfig
['properties']['disableAdvanced']) {
1197 $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
) . '">' .
1198 t3lib_iconWorks
::getSpriteIcon('actions-system-cache-clear') .
1202 // If access to Web>List for user, then link to that module.
1203 $buttons['record_list'] = t3lib_BEfunc
::getListViewLink(
1205 'id' => $this->pageinfo
['uid'],
1206 'returnUrl' => t3lib_div
::getIndpEnv('REQUEST_URI'),
1208 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList')
1211 if (!$this->modTSconfig
['properties']['disableIconToolbar']) {
1214 if (t3lib_utility_Math
::canBeInterpretedAsInteger($this->eRParts
[1])) {
1215 $buttons['move_record'] = '<a href="' . htmlspecialchars($GLOBALS['BACK_PATH'] . 'move_el.php?table=' . $this->eRParts
[0] . '&uid=' . $this->eRParts
[1] . '&returnUrl=' . rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI'))) . '">' .
1216 t3lib_iconWorks
::getSpriteIcon('actions-' . ($this->eRParts
[0] == 'tt_content' ?
'document' : 'page') . '-move', array('class'=>'c-inputButton','title' => $GLOBALS['LANG']->getLL('move_' . ($this->eRParts
[0] == 'tt_content' ?
'record' : 'page'), 1))) .
1219 // Edit page properties
1220 if ($this->CALC_PERMS
&2) {
1221 $params='&edit[pages][' . $this->id
. ']=edit';
1222 $buttons['edit_page'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc
::editOnClick($params, $GLOBALS['BACK_PATH'])) . '" title="' . $GLOBALS['LANG']->getLL('editPageProperties', TRUE
) . '">' .
1223 t3lib_iconWorks
::getSpriteIcon('actions-page-open') .
1227 // Add CSH (Context Sensitive Help) icon to tool bar
1228 if ($function == 'quickEdit') {
1229 $buttons['csh'] = t3lib_BEfunc
::cshItem($this->descrTable
, 'quickEdit', $GLOBALS['BACK_PATH'], '', TRUE
, 'margin-top: 0px; margin-bottom: 0px;');
1231 $buttons['csh'] = t3lib_BEfunc
::cshItem($this->descrTable
, 'columns_' . $this->MOD_SETTINGS
['function'], $GLOBALS['BACK_PATH'], '', TRUE
, 'margin-top: 0px; margin-bottom: 0px;');
1234 if ($function == 'quickEdit') {
1236 $buttons['savedok'] = '<input class="c-inputButton" type="image" name="savedok"' . t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'], 'gfx/savedok.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" alt="" />';
1238 // Save record and show page
1239 $buttons['savedokshow'] = '<a href="#" onclick="' . htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow', TRUE
) . '">' .
1240 t3lib_iconWorks
::getSpriteIcon('actions-document-save-view') .
1244 $buttons['closedok'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(unescape(\'' . rawurlencode($this->closeUrl
) . '\')); return false;') . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', TRUE
) . '">' .
1245 t3lib_iconWorks
::getSpriteIcon('actions-document-close') .
1249 if ($this->deleteButton
) {
1250 $buttons['deletedok'] = '<a href="#" onclick="' . htmlspecialchars('return deleteRecord(\'' . $this->eRParts
[0] . '\',\'' . $this->eRParts
[1] . '\',\'' . t3lib_div
::getIndpEnv('SCRIPT_NAME') . '?id=' . $this->id
. '\');') . '" title="' . $GLOBALS['LANG']->getLL('deleteItem', TRUE
) . '">' .
1251 t3lib_iconWorks
::getSpriteIcon('actions-edit-delete') .
1255 if ($this->undoButton
) {
1257 $buttons['undo'] = '<a href="#"
1258 onclick="' . htmlspecialchars('window.location.href=\'' . $GLOBALS['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;') . '"
1259 title="' . htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('undoLastChange'), t3lib_BEfunc
::calcAge($GLOBALS['EXEC_TIME'] - $this->undoButtonR
['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))) . '">' .
1260 t3lib_iconWorks
::getSpriteIcon('actions-edit-undo') .
1264 $buttons['history_record'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(\'' . $GLOBALS['BACK_PATH'] . 'show_rechis.php?element=' . rawurlencode($this->eRParts
[0] . ':' . $this->eRParts
[1]) . '&returnUrl=' . rawurlencode($this->R_URI
) . '#latest\');return false;') . '" title="' . $GLOBALS['LANG']->getLL('recordHistory', TRUE
) . '">' .
1265 t3lib_iconWorks
::getSpriteIcon('actions-document-history-open') .
1274 /*******************************
1278 ******************************/
1281 * Returns the number of hidden elements (including those hidden by start/end times)
1282 * on the current page (for the current sys_language)
1286 function getNumberOfHiddenElements() {
1287 return $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
1290 'pid=' . intval($this->id
) .
1291 ' AND sys_language_uid=' . intval($this->current_sys_language
) .
1292 t3lib_BEfunc
::BEenableFields('tt_content', 1) .
1293 t3lib_BEfunc
::deleteClause('tt_content') .
1294 t3lib_BEfunc
::versioningPlaceholderClause('tt_content')
1299 * Returns URL to the current script.
1300 * In particular the "popView" and "new_unique_uid" Get vars are unset.
1302 * @param array $params Parameters array, merged with global GET vars.
1303 * @return string URL
1305 function local_linkThisScript($params) {
1306 $params['popView'] = '';
1307 $params['new_unique_uid'] = '';
1308 return t3lib_div
::linkThisScript($params);
1312 * Returns a SQL query for selecting sys_language records.
1314 * @param integer $id 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)
1315 * @return string Return query string.
1317 function exec_languageQuery($id) {
1319 $exQ = t3lib_BEfunc
::deleteClause('pages_language_overlay') . ($GLOBALS['BE_USER']->isAdmin()?
'':' AND sys_language.hidden=0');
1320 return $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1322 'pages_language_overlay,sys_language',
1323 'pages_language_overlay.sys_language_uid=sys_language.uid AND pages_language_overlay.pid='.intval($id).$exQ,
1324 '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',
1325 'sys_language.title'
1328 return $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1331 'sys_language.hidden=0',
1333 'sys_language.title'
1340 $SOBE = t3lib_div
::makeInstance('SC_db_layout');
1344 foreach($SOBE->include_once as $INC_FILE) {
1345 include_once($INC_FILE);
1348 $SOBE->clearCache();
1350 $SOBE->printContent();