2 /*************************************************************
5 * (c) 1999-2008 Kasper Skaarhoj (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 ***************************************************************/
28 * Include file extending recordList which extended t3lib_recordList
29 * Used specifically for the Web>List module (db_list.php)
32 * Revised for TYPO3 3.6 December/2003 by Kasper Skaarhoj
35 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
38 * [CLASS/FUNCTION INDEX of SCRIPT]
42 * 91: class localRecordList extends recordList
43 * 123: function writeTop($row)
44 * 304: function getTable($table,$id,$rowlist)
45 * 559: function renderListRow($table,$row,$cc,$titleCol,$thumbsCol,$indent=0)
46 * 648: function renderListHeader($table,$currentIdList)
48 * SECTION: Rendering of various elements
49 * 796: function makeControl($table,$row)
50 * 986: function makeClip($table,$row)
51 * 1057: function makeRef($table,$uid)
52 * 1086: function makeLocalizationPanel($table,$row)
53 * 1148: function fieldSelectBox($table,$formFields=1)
55 * SECTION: Helper functions
56 * 1231: function linkClipboardHeaderIcon($string,$table,$cmd,$warning='')
57 * 1242: function clipNumPane()
58 * 1256: function addSortLink($code,$field,$table)
59 * 1281: function recPath($pid)
60 * 1294: function showNewRecLink($table)
61 * 1304: function makeReturnUrl()
63 * SECTION: CSV related functions
64 * 1329: function initCSV()
65 * 1352: function addToCSV($row,$table)
66 * 1376: function setCsvRow($csvRow)
67 * 1387: function outputCSV($prefix)
70 * (This index is automatically created/updated by the extension "extdeveval")
84 * Class for rendering of Web>List module
86 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
90 class localRecordList extends recordList {
93 var $alternateBgColors=FALSE; // If true, table rows in the list will alternate in background colors (and have background colors at all!)
94 var $allowedNewTables=array(); // Used to indicate which tables (values in the array) that can have a create-new-record link. If the array is empty, all tables are allowed.
95 var $deniedNewTables=array(); // Used to indicate which tables (values in the array) that cannot have a create-new-record link. If the array is empty, all tables are allowed.
96 var $newWizards=FALSE; // If true, the control panel will contain links to the create-new wizards for pages and tt_content elements (normally, the link goes to just creating a new element without the wizards!).
98 var $dontShowClipControlPanels=FALSE; // If true, will disable the rendering of clipboard + control panels.
99 var $showClipboard=FALSE; // If true, will show the clipboard in the field list.
100 var $noControlPanels = FALSE; // If true, will DISABLE all control panels in lists. (Takes precedence)
101 var $clickMenuEnabled = TRUE; // If true, clickmenus will be rendered
103 var $totalRowCount; // count of record rows in view
105 var $spaceIcon; // space icon used for alignment
108 var $pageRow=array(); // Set to the page record (see writeTop())
110 var $csvLines=array(); // Used to accumulate CSV lines in for CSV export.
111 var $csvOutput=FALSE; // If set, the listing is returned as CSV instead.
116 * @var t3lib_clipboard
119 var $CBnames=array(); // Tracking names of elements (for clipboard use)
120 var $duplicateStack=array(); // Used to track which elements has duplicates and how many
123 * Create the panel of buttons for submitting the form or otherwise perform operations.
125 * @return array all available buttons as an assoc. array
127 public function getButtons() {
147 // Get users permissions for this page record:
148 $localCalcPerms = $GLOBALS['BE_USER']->calcPerms($this->pageRow);
151 if (!strlen($this->id)) {
152 $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_module_noId', $GLOBALS['BACK_PATH'], '', TRUE);
153 } elseif(!$this->id) {
154 $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_module_root', $GLOBALS['BACK_PATH'], '', TRUE);
156 $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_module', $GLOBALS['BACK_PATH'], '', TRUE);
159 if (isset($this->id)) {
161 $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->id, $this->backPath, t3lib_BEfunc::BEgetRootLine($this->id))) . '">' .
162 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/zoom.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '" alt="" />' .
166 if (!$GLOBALS['SOBE']->modTSconfig['properties']['noCreateRecordsLink']) {
167 $buttons['new_record'] = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $this->backPath . 'db_new.php?id=' . $this->id . '\');') . '">' .
168 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/new_el.gif') . ' title="' . $LANG->getLL('newRecordGeneral', 1) . '" alt="" />' .
172 // If edit permissions are set (see class.t3lib_userauthgroup.php)
173 if ($localCalcPerms&2 && !empty($this->id)) {
176 $params = '&edit[pages][' . $this->pageRow['uid'] . ']=edit';
177 $buttons['edit'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath, -1)) . '">' .
178 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/edit2.gif') . ' title="' . $LANG->getLL('editPage', 1) . '" alt="" />' .
181 if ($this->pageRow['hidden']) {
182 $params = '&data[pages][' . $this->pageRow['uid'] . '][hidden]=0';
183 $buttons['hide_unhide'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '">' .
184 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/button_unhide.gif') . ' title="' . $LANG->getLL('unHidePage', 1) . '" alt="" />' .
188 $params = '&data[pages][' . $this->pageRow['uid'] . '][hidden]=1';
189 $buttons['hide_unhide'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '">'.
190 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/button_hide.gif') . ' title="' . $LANG->getLL('hidePage', 1) . '" alt="" />' .
195 $buttons['move'] = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $this->backPath . 'move_el.php?table=pages&uid=' . $this->pageRow['uid'] . '\');') . '">' .
196 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/move_' . ($this->table == 'tt_content' ? 'record' : 'page') . '.gif') . ' title="' . $LANG->getLL('move_page', 1) . '" alt="" />' .
200 $buttons['level_up'] = '<a href="' . htmlspecialchars($this->listURL($this->pageRow['pid'])) . '" onclick="setHighlight(' . $this->pageRow['pid'] . ')">' .
201 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/i/pages_up.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', 1) . '" alt="" />' .
208 if (($localCalcPerms&8) || ($localCalcPerms&16)) {
209 $elFromTable = $this->clipObj->elFromTable('');
210 if (count($elFromTable)) {
211 $buttons['paste'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('', $this->id)) . '" onclick="' . htmlspecialchars('return ' . $this->clipObj->confirmMsg('pages', $this->pageRow, 'into', $elFromTable)) . '">' .
212 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/clip_pasteafter.gif') . ' title="' . $LANG->getLL('clip_paste', 1) . '" alt="" />' .
218 $buttons['cache'] = '<a href="' . htmlspecialchars($this->listURL() . '&clear_cache=1') . '">' .
219 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/clear_cache.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.clear_cache', 1) . '" alt="" />' .
225 $buttons['csv'] = '<a href="' . htmlspecialchars($this->listURL() . '&csv=1') . '">' .
226 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/csv.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.csv', 1) . '" alt="" />' .
230 if (t3lib_extMgm::isLoaded('impexp')) {
231 $buttons['export'] = '<a href="' . htmlspecialchars($this->backPath. 'mod.php?M=xMOD_tximpexp&tx_impexp[action]=export&tx_impexp[list][]=' . rawurlencode($this->table . ':' . $this->id)) . '">' .
232 '<img' . t3lib_iconWorks::skinImg($this->backPath, t3lib_extMgm::extRelPath('impexp') . 'export.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.export', 1) . '" alt="" />' .
239 $buttons['reload'] = '<a href="' . htmlspecialchars($this->listURL()) . '">' .
240 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/refresh_n.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.reload', 1) . '" alt="" />' .
244 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
245 $buttons['shortcut'] = $GLOBALS['TBE_TEMPLATE']->makeShortcutIcon('id, imagemode, pointer, table, search_field, search_levels, showLimit, sortField, sortRev', implode(',', array_keys($this->MOD_MENU)), 'web_list');
249 if ($this->returnUrl) {
250 $buttons['back'] = '<a href="' . htmlspecialchars(t3lib_div::linkThisUrl($this->returnUrl, array('id' => $this->id))) . '" class="typo3-goBack">' .
251 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/goback.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.goBack', 1) . '" alt="" />' .
260 * Creates the listing of records from a single table
262 * @param string Table name
263 * @param integer Page id
264 * @param string List of fields to show in the listing. Pseudo fields will be added including the record header.
265 * @return string HTML table with the listing for the record.
267 function getTable($table,$id,$rowlist) {
268 global $TCA, $TYPO3_CONF_VARS;
270 // Loading all TCA details for this table:
271 t3lib_div::loadTCA($table);
275 $titleCol = $TCA[$table]['ctrl']['label'];
276 $thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
277 $l10nEnabled = $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'];
278 $tableCollapsed = (!$this->tablesCollapsed[$table]) ? false : true;
280 // prepare space icon
281 $iconWidth = $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeWidth'] ? $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeWidth'] : 12;
282 $iconHeight = $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeHeight'] ? $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeHeight'] : 12;
283 $this->spaceIcon = '<img src="' . $this->backPath . 'clear.gif" width="' . $iconWidth . '" height="' . $iconHeight . '" title="" alt="" />';
285 // Cleaning rowlist for duplicates and place the $titleCol as the first column always!
286 $this->fieldArray=array();
288 $this->fieldArray[] = $titleCol; // Add title column
290 if (!t3lib_div::inList($rowlist,'_CONTROL_')) {
291 $this->fieldArray[] = '_CONTROL_';
292 $this->fieldArray[] = '_AFTERCONTROL_';
295 if ($this->showClipboard) {
296 $this->fieldArray[] = '_CLIPBOARD_';
299 if (!$this->dontShowClipControlPanels) {
300 $this->fieldArray[]='_REF_';
301 $this->fieldArray[]='_AFTERREF_';
304 if ($this->searchLevels) {
305 $this->fieldArray[]='_PATH_';
308 if ($this->localizationView && $l10nEnabled) {
309 $this->fieldArray[] = '_LOCALIZATION_';
310 $this->fieldArray[] = '_LOCALIZATION_b';
312 '.$TCA[$table]['ctrl']['languageField'].'<=0
314 '.$TCA[$table]['ctrl']['transOrigPointerField'].' = 0
318 $this->fieldArray=array_unique(array_merge($this->fieldArray,t3lib_div::trimExplode(',',$rowlist,1)));
319 if ($this->noControlPanels) {
320 $tempArray = array_flip($this->fieldArray);
321 unset($tempArray['_CONTROL_']);
322 unset($tempArray['_CLIPBOARD_']);
323 $this->fieldArray = array_keys($tempArray);
326 // Creating the list of fields to include in the SQL query:
327 $selectFields = $this->fieldArray;
328 $selectFields[] = 'uid';
329 $selectFields[] = 'pid';
330 if ($thumbsCol) $selectFields[] = $thumbsCol; // adding column for thumbnails
331 if ($table=='pages') {
332 if (t3lib_extMgm::isLoaded('cms')) {
333 $selectFields[] = 'module';
334 $selectFields[] = 'extendToSubpages';
335 $selectFields[] = 'nav_hide';
337 $selectFields[] = 'doktype';
339 if (is_array($TCA[$table]['ctrl']['enablecolumns'])) {
340 $selectFields = array_merge($selectFields,$TCA[$table]['ctrl']['enablecolumns']);
342 if ($TCA[$table]['ctrl']['type']) {
343 $selectFields[] = $TCA[$table]['ctrl']['type'];
345 if ($TCA[$table]['ctrl']['typeicon_column']) {
346 $selectFields[] = $TCA[$table]['ctrl']['typeicon_column'];
348 if ($TCA[$table]['ctrl']['versioningWS']) {
349 $selectFields[] = 't3ver_id';
350 $selectFields[] = 't3ver_state';
351 $selectFields[] = 't3ver_wsid';
352 $selectFields[] = 't3ver_swapmode'; // Filtered out when pages in makeFieldList()
355 $selectFields[] = $TCA[$table]['ctrl']['languageField'];
356 $selectFields[] = $TCA[$table]['ctrl']['transOrigPointerField'];
358 if ($TCA[$table]['ctrl']['label_alt']) {
359 $selectFields = array_merge($selectFields,t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['label_alt'],1));
361 $selectFields = array_unique($selectFields); // Unique list!
362 $selectFields = array_intersect($selectFields,$this->makeFieldList($table,1)); // Making sure that the fields in the field-list ARE in the field-list from TCA!
363 $selFieldList = implode(',',$selectFields); // implode it into a list of fields for the SQL-statement.
366 * @hook DB-List getTable
368 * @request Malte Jansen <mail@maltejansen.de>
370 if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'])) {
371 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'] as $classData) {
372 $hookObject = &t3lib_div::getUserObj($classData);
374 if(!($hookObject instanceof t3lib_localRecordListGetTableHook)) {
375 throw new UnexpectedValueException('$hookObject must implement interface t3lib_localRecordListGetTableHook', 1195114460);
378 $hookObject->getDBlistQuery($table, $id, $addWhere, $selFieldList, $this);
382 // Create the SQL query for selecting the elements in the listing:
383 if ($this->csvOutput) { // do not do paging when outputting as CSV
387 if ($this->firstElementNumber > 2 && $this->iLimit > 0) {
388 // Get the two previous rows for sorting if displaying page > 1
389 $this->firstElementNumber = $this->firstElementNumber - 2;
390 $this->iLimit = $this->iLimit + 2;
391 $queryParts = $this->makeQueryArray($table, $id,$addWhere,$selFieldList); // (API function from class.db_list.inc)
392 $this->firstElementNumber = $this->firstElementNumber + 2;
393 $this->iLimit = $this->iLimit - 2;
395 $queryParts = $this->makeQueryArray($table, $id,$addWhere,$selFieldList); // (API function from class.db_list.inc)
398 $this->setTotalItems($queryParts); // Finding the total amount of records on the page (API function from class.db_list.inc)
403 $listOnlyInSingleTableMode = $this->listOnlyInSingleTableMode && !$this->table;
405 // If the count query returned any number of records, we perform the real query, selecting records.
406 if ($this->totalItems) {
407 // Fetch records only if not in single table mode or if in multi table mode and not collapsed
408 if ($listOnlyInSingleTableMode || (!$this->table && $tableCollapsed)) {
409 $dbCount = $this->totalItems;
411 // set the showLimit to the number of records when outputting as CSV
412 if ($this->csvOutput) {
413 $this->showLimit = $this->totalItems;
414 $this->iLimit = $this->totalItems;
416 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
417 $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
421 // If any records was selected, render the list:
424 // Half line is drawn between tables:
425 if (!$listOnlyInSingleTableMode) {
427 if (!$this->table && !$rowlist) {
428 $theData[$titleCol] = '<img src="clear.gif" width="'.($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel']?'230':'350').'" height="1" alt="" />';
429 if (in_array('_CONTROL_',$this->fieldArray)) $theData['_CONTROL_']='';
430 if (in_array('_CLIPBOARD_',$this->fieldArray)) $theData['_CLIPBOARD_']='';
432 $out.=$this->addelement(0,'',$theData,'class="c-table-row-spacer"',$this->leftMargin);
435 // Header line is drawn
437 if ($this->disableSingleTableView) {
438 $theData[$titleCol] = '<span class="c-table">'.$GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'],1).'</span> ('.$this->totalItems.')';
440 $theData[$titleCol] = $this->linkWrapTable($table,'<span class="c-table">'.$GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'],1).'</span> ('.$this->totalItems.') <img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/'.($this->table?'minus':'plus').'bullet_list.gif','width="18" height="12"').' hspace="10" class="absmiddle" title="'.$GLOBALS['LANG']->getLL(!$this->table?'expandView':'contractView',1).'" alt="" />');
444 $theData[$titleCol].= t3lib_BEfunc::cshItem($table,'',$this->backPath,'',FALSE,'margin-bottom:0px; white-space: normal;');
446 if ($listOnlyInSingleTableMode) {
449 <td class="c-headLineTable" style="width:95%;">'.$theData[$titleCol].'</td>
452 if ($GLOBALS['BE_USER']->uc["edit_showFieldHelp"]) {
453 $GLOBALS['LANG']->loadSingleTableDescription($table);
454 if (isset($GLOBALS['TCA_DESCR'][$table]['columns'][''])) {
455 $onClick = 'vHWin=window.open(\'view_help.php?tfID='.$table.'.\',\'viewFieldHelp\',\'height=400,width=600,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;';
458 <td class="c-tableDescription">'.t3lib_BEfunc::helpTextIcon($table,'',$this->backPath,TRUE).$GLOBALS['TCA_DESCR'][$table]['columns']['']['description'].'</td>
463 // Render collapse button if in multi table mode
466 $collapseIcon = '<a href="' . htmlspecialchars($this->listURL()) . '&collapse[' . $table . ']=' . ($tableCollapsed ? '0' : '1') . '"><img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/arrow' . ($tableCollapsed ? 'right' : 'down') . '.png') . ' class="collapseIcon" alt="" title="' . ($tableCollapsed ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.expandTable',1) : $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.collapseTable',1)) . '" /></a>';
468 $out .= $this->addelement(1, $collapseIcon, $theData, ' class="c-headLineTable"', '');
471 // Render table rows only if in multi table view and not collapsed or if in single table view
472 if (!$listOnlyInSingleTableMode && (!$tableCollapsed || $this->table)) {
473 // Fixing a order table for sortby tables
474 $this->currentTable = array();
475 $currentIdList = array();
476 $doSort = ($TCA[$table]['ctrl']['sortby'] && !$this->sortField);
481 // Get first two rows and initialize prevPrevUid and prevUid if on page > 1
482 if ($this->firstElementNumber > 2 && $this->iLimit > 0) {
483 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
484 $prevPrevUid = -(int) $row['uid'];
485 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
486 $prevUid = $row['uid'];
489 $accRows = array(); // Accumulate rows here
490 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
492 // In offline workspace, look for alternative record:
493 t3lib_BEfunc::workspaceOL($table, $row, $GLOBALS['BE_USER']->workspace, TRUE);
495 if (is_array($row)) {
497 $currentIdList[] = $row['uid'];
500 $this->currentTable['prev'][$row['uid']] = $prevPrevUid;
501 $this->currentTable['next'][$prevUid] = '-'.$row['uid'];
502 $this->currentTable['prevUid'][$row['uid']] = $prevUid;
504 $prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
505 $prevUid=$row['uid'];
509 $GLOBALS['TYPO3_DB']->sql_free_result($result);
511 $this->totalRowCount = count($accRows);
514 if ($this->csvOutput) $this->initCSV();
517 $this->CBnames=array();
518 $this->duplicateStack=array();
519 $this->eCounter=$this->firstElementNumber;
524 foreach($accRows as $row) {
525 // Render item row if counter < limit
526 if ($cc < $this->iLimit) {
528 $iOut.= $this->renderListRow($table,$row,$cc,$titleCol,$thumbsCol);
530 // If localization view is enabled it means that the selected records are either default or All language and here we will not select translations which point to the main record:
531 if ($this->localizationView && $l10nEnabled) {
533 // Look for translations of this record:
534 $translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
538 ' AND '.$TCA[$table]['ctrl']['languageField'].'>0'.
539 ' AND '.$TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($row['uid']).
540 t3lib_BEfunc::deleteClause($table).
541 t3lib_BEfunc::versioningPlaceholderClause($table)
544 // For each available translation, render the record:
545 if (is_array($translations)) {
546 foreach($translations as $lRow) {
547 // In offline workspace, look for alternative record:
548 t3lib_BEfunc::workspaceOL($table, $lRow, $GLOBALS['BE_USER']->workspace);
550 if (is_array($lRow) && $GLOBALS['BE_USER']->checkLanguageAccess($lRow[$TCA[$table]['ctrl']['languageField']])) {
551 $currentIdList[] = $lRow['uid'];
552 $iOut.=$this->renderListRow($table,$lRow,$cc,$titleCol,$thumbsCol,18);
559 // Counter of total rows incremented:
563 // Record navigation is added to the beginning and end of the table if in single table mode
565 $pageNavigation = $this->renderListNavigation();
566 $iOut = $pageNavigation . $iOut . $pageNavigation;
569 // The header row for the table is now created:
570 $out.=$this->renderListHeader($table,$currentIdList);
573 // The list of records is added after the header:
576 // ... and it is all wrapped in a table:
582 DB listing of elements: "'.htmlspecialchars($table).'"
584 <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist'.($listOnlyInSingleTableMode?' typo3-dblist-overview':'').'">
589 if ($this->csvOutput) $this->outputCSV($table); // This ends the page with exit.
597 * Rendering a single row for the list
599 * @param string Table name
600 * @param array Current record
601 * @param integer Counter, counting for each time an element is rendered (used for alternating colors)
602 * @param string Table field (column) where header value is found
603 * @param string Table field (column) where (possible) thumbnails can be found
604 * @param integer Indent from left.
605 * @return string Table row for the element
609 function renderListRow($table,$row,$cc,$titleCol,$thumbsCol,$indent=0) {
612 if (strlen($this->searchString)) { // If in search mode, make sure the preview will show the correct page
613 $id_orig = $this->id;
614 $this->id = $row['pid'];
617 if (is_array($row)) {
619 // add special classes for first and last row
621 if ($cc == 1 && $indent == 0) {
622 $rowSpecial .= ' firstcol';
624 if ($cc == $this->totalRowCount || $cc == $this->iLimit) {
625 $rowSpecial .= ' lastcol';
628 // Background color, if any:
629 if ($this->alternateBgColors) {
630 $row_bgColor = ($cc%2) ? ' class="db_list_normal'.$rowSpecial.'"' : ' class="db_list_alt'.$rowSpecial.'"';
632 $row_bgColor = ' class="db_list_normal'.$rowSpecial.'"';
634 // Overriding with versions background color if any:
635 $row_bgColor = $row['_CSSCLASS'] ? ' class="'.$row['_CSSCLASS'].'"' : $row_bgColor;
640 // The icon with link
641 $alttext = t3lib_BEfunc::getRecordIconAltText($row,$table);
642 $iconImg = t3lib_iconWorks::getIconImage($table,$row,$this->backPath,'title="'.htmlspecialchars($alttext).'"'.($indent ? ' style="margin-left: '.$indent.'px;"' : ''));
643 $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,$table,$row['uid']) : $iconImg;
645 // Preparing and getting the data-array
647 foreach($this->fieldArray as $fCol) {
648 if ($fCol==$titleCol) {
649 $recTitle = t3lib_BEfunc::getRecordTitle($table,$row,FALSE,TRUE);
650 // If the record is edit-locked by another user, we will show a little warning sign:
651 if (($lockInfo = t3lib_BEfunc::isRecordLocked($table, $row['uid']))) {
652 $warning = '<a href="#" onclick="' . htmlspecialchars('alert(' . $GLOBALS['LANG']->JScharCode($lockInfo['msg']) . '); return false;') . '">' .
653 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/recordlock_warning3.gif', 'width="17" height="12"') . ' title="' . htmlspecialchars($lockInfo['msg']) . '" alt="" />' .
656 $theData[$fCol] = $warning . $this->linkWrapItems($table, $row['uid'], $recTitle, $row);
657 } elseif ($fCol == 'pid') {
658 $theData[$fCol]=$row[$fCol];
659 } elseif ($fCol == '_PATH_') {
660 $theData[$fCol]=$this->recPath($row['pid']);
661 } elseif ($fCol == '_REF_') {
662 $theData[$fCol]=$this->makeRef($table,$row['uid']);
663 } elseif ($fCol == '_CONTROL_') {
664 $theData[$fCol]=$this->makeControl($table,$row);
665 } elseif ($fCol == '_AFTERCONTROL_' || $fCol == '_AFTERREF_') {
666 $theData[$fCol] = ' ';
667 } elseif ($fCol == '_CLIPBOARD_') {
668 $theData[$fCol]=$this->makeClip($table,$row);
669 } elseif ($fCol == '_LOCALIZATION_') {
670 list($lC1, $lC2) = $this->makeLocalizationPanel($table,$row);
671 $theData[$fCol] = $lC1;
672 $theData[$fCol.'b'] = $lC2;
673 } elseif ($fCol == '_LOCALIZATION_b') {
674 // Do nothing, has been done above.
676 $tmpProc = t3lib_BEfunc::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid']);
677 $theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]);
678 $row[$fCol] = $tmpProc;
682 if (strlen($this->searchString)) { // Reset the ID if it was overwritten
683 $this->id = $id_orig;
686 // Add row to CSV list:
687 if ($this->csvOutput) {
688 $this->addToCSV($row,$table);
691 // Add classes to table cells
692 $this->addElement_tdCssClass[$titleCol] = 'col-title';
693 if (!$this->dontShowClipControlPanels) {
694 $this->addElement_tdCssClass['_CONTROL_'] = 'col-control';
695 $this->addElement_tdCssClass['_AFTERCONTROL_'] = 'col-control-space';
696 $this->addElement_tdCssClass['_CLIPBOARD_'] = 'col-clipboard';
698 $this->addElement_tdCssClass['_PATH_'] = 'col-path';
699 $this->addElement_tdCssClass['_LOCALIZATION_'] = 'col-localizationa';
700 $this->addElement_tdCssClass['_LOCALIZATION_b'] = 'col-localizationb';
703 // Create element in table cells:
704 $iOut.=$this->addelement(1,$theIcon,$theData,$row_bgColor);
706 // Render thumbsnails if a thumbnail column exists and there is content in it:
707 if ($this->thumbs && trim($row[$thumbsCol])) {
708 $iOut.=$this->addelement(4,'', Array($titleCol=>$this->thumbCode($row,$table,$thumbsCol)),$row_bgColor);
711 // Finally, return table row element:
717 * Rendering the header row for a table
719 * @param string Table name
720 * @param array Array of the currently displayed uids of the table
721 * @return string Header table row
725 function renderListHeader($table, $currentIdList) {
726 global $TCA, $LANG, $TYPO3_CONF_VARS;
731 // Traverse the fields:
732 foreach($this->fieldArray as $fCol) {
734 // Calculate users permissions to edit records in the table:
735 $permsEdit = $this->calcPerms & ($table=='pages'?2:16);
737 switch((string)$fCol) {
738 case '_PATH_': // Path
739 $theData[$fCol] = '<i>['.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels._PATH_',1).']</i>';
741 case '_REF_': // References
742 $theData[$fCol] = '<i>['.$LANG->sL('LLL:EXT:lang/locallang_mod_file_list.xml:c__REF_',1).']</i>';
744 case '_LOCALIZATION_': // Path
745 $theData[$fCol] = '<i>['.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels._LOCALIZATION_',1).']</i>';
747 case '_LOCALIZATION_b': // Path
748 $theData[$fCol] = $LANG->getLL('Localize',1);
750 case '_CLIPBOARD_': // Clipboard:
753 // If there are elements on the clipboard for this table, then display the "paste into" icon:
754 $elFromTable = $this->clipObj->elFromTable($table);
755 if (count($elFromTable)) {
756 $cells['pasteAfter']='<a href="'.htmlspecialchars($this->clipObj->pasteUrl($table,$this->id)).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg('pages',$this->pageRow,'into',$elFromTable)).'">'.
757 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_pasteafter.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_paste',1).'" alt="" />'.
761 // If the numeric clipboard pads are enabled, display the control icons for that:
762 if ($this->clipObj->current!='normal') {
764 // The "select" link:
765 $cells['copyMarked']=$this->linkClipboardHeaderIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_copy.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_selectMarked',1).'" alt="" />',$table,'setCB');
767 // The "edit marked" link:
768 $editIdList = implode(',',$currentIdList);
769 $editIdList = "'+editList('".$table."','".$editIdList."')+'";
770 $params='&edit['.$table.']['.$editIdList.']=edit&disHelp=1';
771 $cells['edit']='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
772 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$LANG->getLL('clip_editMarked',1).'" alt="" />'.
775 // The "Delete marked" link:
776 $cells['delete']=$this->linkClipboardHeaderIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/garbage.gif','width="11" height="12"').' title="'.$LANG->getLL('clip_deleteMarked',1).'" alt="" />',$table,'delete',sprintf($LANG->getLL('clip_deleteMarkedWarning'),$LANG->sL($TCA[$table]['ctrl']['title'])));
778 // The "Select all" link:
779 $cells['markAll']='<a href="#" onclick="'.htmlspecialchars('checkOffCB(\''.implode(',',$this->CBnames).'\'); return false;').'">'.
780 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_select.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_markRecords',1).'" alt="" />'.
786 * @hook renderListHeaderActions: Allows to change the clipboard icons of the Web>List table headers
788 * @request Bernhard Kraft <krafbt@kraftb.at>
789 * @usage Above each listed table in Web>List a header row is shown. This hook allows to modify the icons responsible for the clipboard functions (shown above the clipboard checkboxes when a clipboard other than "Normal" is selected), or other "Action" functions which perform operations on the listed records.
791 if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
792 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
793 $hookObject = &t3lib_div::getUserObj($classData);
794 if(!($hookObject instanceof localRecordList_actionsHook)) {
795 throw new UnexpectedValueException('$hookObject must implement interface localRecordList_actionsHook', 1195567850);
797 $cells = $hookObject->renderListHeaderActions($table, $currentIdList, $cells, $this);
800 $theData[$fCol]=implode('',$cells);
802 case '_CONTROL_': // Control panel:
803 if (!$TCA[$table]['ctrl']['readOnly']) {
805 // If new records can be created on this page, add links:
806 if ($this->calcPerms&($table=='pages'?8:16) && $this->showNewRecLink($table)) {
807 if ($table=="tt_content" && $this->newWizards) {
808 // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
809 $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
810 $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension'];
811 $newContentWizScriptPath = $this->backPath.t3lib_extMgm::isLoaded($tmpTSc) ? (t3lib_extMgm::extRelPath($tmpTSc).'mod1/db_new_content_el.php') : 'sysext/cms/layout/db_new_content_el.php';
813 $icon = '<a href="#" onclick="'.htmlspecialchars('return jumpExt(\''.$newContentWizScriptPath.'?id='.$this->id.'\');').'">'.
814 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'el').'.gif','width="'.($table=='pages'?13:11).'" height="12"').' title="'.$LANG->getLL('new',1).'" alt="" />'.
816 } elseif ($table=='pages' && $this->newWizards) {
817 $icon = '<a href="'.htmlspecialchars($this->backPath.'db_new.php?id='.$this->id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
818 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'el').'.gif','width="'.($table=='pages'?13:11).'" height="12"').' title="'.$LANG->getLL('new',1).'" alt="" />'.
822 $params = '&edit['.$table.']['.$this->id.']=new';
823 if ($table == 'pages_language_overlay') {
824 $params .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $this->pageRow['doktype'];
826 $icon = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
827 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'el').'.gif','width="'.($table=='pages'?13:11).'" height="12"').' title="'.$LANG->getLL('new',1).'" alt="" />'.
832 // If the table can be edited, add link for editing ALL SHOWN fields for all listed records:
833 if ($permsEdit && $this->table && is_array($currentIdList)) {
834 $editIdList = implode(',',$currentIdList);
835 if ($this->clipNumPane()) $editIdList = "'+editList('".$table."','".$editIdList."')+'";
836 $params = '&edit['.$table.']['.$editIdList.']=edit&columnsOnly='.implode(',',$this->fieldArray).'&disHelp=1';
837 $icon .= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
838 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$LANG->getLL('editShownColumns',1).'" alt="" />'.
841 // add an empty entry, so column count fits again after moving this into $icon
842 $theData[$fCol] = ' ';
845 case '_AFTERCONTROL_': // space column
846 case '_AFTERREF_': // space column
847 $theData[$fCol] = ' ';
849 default: // Regular fields header:
851 if ($this->table && is_array($currentIdList)) {
853 // If the numeric clipboard pads are selected, show duplicate sorting link:
854 if ($this->clipNumPane()) {
855 $theData[$fCol].='<a href="'.htmlspecialchars($this->listURL('',-1).'&duplicateField='.$fCol).'">'.
856 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/select_duplicates.gif','width="11" height="11"').' title="'.$LANG->getLL('clip_duplicates',1).'" alt="" />'.
860 // If the table can be edited, add link for editing THIS field for all listed records:
861 if (!$TCA[$table]['ctrl']['readOnly'] && $permsEdit && $TCA[$table]['columns'][$fCol]) {
862 $editIdList = implode(',',$currentIdList);
863 if ($this->clipNumPane()) $editIdList = "'+editList('".$table."','".$editIdList."')+'";
864 $params='&edit['.$table.']['.$editIdList.']=edit&columnsOnly='.$fCol.'&disHelp=1';
865 $iTitle = sprintf($LANG->getLL('editThisColumn'),ereg_replace(':$','',trim($LANG->sL(t3lib_BEfunc::getItemLabel($table,$fCol)))));
866 $theData[$fCol].='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
867 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.htmlspecialchars($iTitle).'" alt="" />'.
871 $theData[$fCol].=$this->addSortLink($LANG->sL(t3lib_BEfunc::getItemLabel($table,$fCol,'<i>[|]</i>')),$fCol,$table);
878 * @hook renderListHeader: Allows to change the contents of columns/cells of the Web>List table headers
880 * @request Bernhard Kraft <krafbt@kraftb.at>
881 * @usage Above each listed table in Web>List a header row is shown. Containing the labels of all shown fields and additional icons to create new records for this table or perform special clipboard tasks like mark and copy all listed records to clipboard, etc.
883 if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
884 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
885 $hookObject = &t3lib_div::getUserObj($classData);
886 if(!($hookObject instanceof localRecordList_actionsHook)) {
887 throw new UnexpectedValueException('$hookObject must implement interface localRecordList_actionsHook', 1195567855);
889 $theData = $hookObject->renderListHeader($table, $currentIdList, $theData, $this);
893 // Create and return header table row:
894 return $this->addelement(1, $icon, $theData, ' class="c-headLine"', '');
898 * Creates a page browser for tables with many records
900 * @return string Navigation HTML
902 * @author Dmitry Pikhno <dpi@goldenplanet.com>
903 * @author Christian Kuhn <lolli@schwarzbu.ch>
905 protected function renderListNavigation() {
906 $totalPages = ceil($this->totalItems / $this->iLimit);
910 // Show page selector if not all records fit into one page
911 if ($totalPages > 1) {
912 $first = $previous = $next = $last = $reload = '';
913 $listURL = $this->listURL('', $this->table);
916 $currentPage = floor(($this->firstElementNumber + 1) / $this->iLimit) + 1;
918 // Compile first, previous, next, last and refresh buttons
919 if ($currentPage > 1) {
920 $labelFirst = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:first');
922 $first = '<a href="' . $listURL . '&pointer=0">
923 <img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_first.gif')
924 . 'alt="' . $labelFirst . '" title="' . $labelFirst . '" />
927 $first = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_first_disabled.gif') . 'alt="" title="" />';
930 if (($currentPage - 1) > 0) {
931 $labelPrevious = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:previous');
933 $previous = '<a href="' . $listURL . '&pointer=' . (($currentPage - 2) * $this->iLimit) . '">
934 <img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_previous.gif')
935 . 'alt="' . $labelPrevious . '" title="' . $labelPrevious . '" />
938 $previous = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_previous_disabled.gif') . 'alt="" title="" />';
941 if (($currentPage + 1) <= $totalPages) {
942 $labelNext = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:next');
944 $next = '<a href="' . $listURL . '&pointer=' . (($currentPage) * $this->iLimit) . '">
945 <img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_next.gif')
946 . 'alt="' . $labelNext . '" title="' . $labelNext . '" />
949 $next = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_next_disabled.gif') . 'alt="" title="" />';
952 if ($currentPage != $totalPages) {
953 $labelLast = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:last');
955 $last = '<a href="' . $listURL . '&pointer=' . (($totalPages - 1) * $this->iLimit) . '">
956 <img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_last.gif')
957 . 'alt="' . $labelLast . '" title="' . $labelLast . '" />
960 $last = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/control_last_disabled.gif') . 'alt="" title="" />';
963 $reload = '<a href="#" onclick="document.dblistForm.action=\''
964 . $listURL . '&pointer=\'+calculatePointer(); document.dblistForm.submit(); return true;">
965 <img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/refresh_n.gif')
966 . 'alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:reload')
967 . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:reload')
970 // Add js to traverse a page select input to a pointer value
972 <script type="text/JavaScript">
975 function calculatePointer(){
976 page = document.getElementById(\'jumpPage\').value;
978 if (page > ' . $totalPages . ') {
979 page = ' . $totalPages . ';
986 pointer = (page - 1) * ' . $this->iLimit . ';
995 $pageNumberInput = '<span>
996 <input type="text" value="' . $currentPage
997 . '" size="3" id="jumpPage" name="jumpPage" onkeyup="if (event.keyCode == Event.KEY_RETURN) { document.dblistForm.action=\'' . $listURL . '&pointer=\'+calculatePointer(); document.dblistForm.submit(); } return true;" />
999 $pageIndicator = '<span class="pageIndicator">'
1000 . sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:pageIndicator'), $pageNumberInput, $totalPages)
1003 if ($this->totalItems > ($this->firstElementNumber + $this->iLimit)) {
1004 $lastElementNumber = $this->firstElementNumber + $this->iLimit;
1006 $lastElementNumber = $this->totalItems;
1008 $rangeIndicator = '<span class="pageIndicator">'
1009 . sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:rangeIndicator'), $this->firstElementNumber + 1, $lastElementNumber)
1012 $content .= '<div id="typo3-dblist-pagination">'
1013 . $first . $previous
1014 . '<span class="bar"> </span>'
1015 . $rangeIndicator . '<span class="bar"> </span>'
1016 . $pageIndicator . '<span class="bar"> </span>'
1017 . $next . $last . '<span class="bar"> </span>'
1020 } // end of if pages > 1
1023 $titleColumn = $this->fieldArray[0];
1024 $data[$titleColumn] = $content;
1026 return ($this->addElement(1, '', $data));
1034 /*********************************
1036 * Rendering of various elements
1038 *********************************/
1041 * Creates the control panel for a single record in the listing.
1043 * @param string The table
1044 * @param array The record for which to make the control panel.
1045 * @return string HTML table with the control panel (unless disabled)
1047 function makeControl($table,$row) {
1048 global $TCA, $LANG, $SOBE, $TYPO3_CONF_VARS;
1050 if ($this->dontShowClipControlPanels) return '';
1053 t3lib_div::loadTCA($table);
1056 // If the listed table is 'pages' we have to request the permission settings for each page:
1057 if ($table=='pages') {
1058 $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',$row['uid']));
1061 // This expresses the edit permissions for this particular element:
1062 $permsEdit = ($table=='pages' && ($localCalcPerms&2)) || ($table!='pages' && ($this->calcPerms&16));
1064 // "Show" link (only pages and tt_content elements)
1065 if ($table=='pages' || $table=='tt_content') {
1066 $params='&edit['.$table.']['.$row['uid'].']=edit';
1067 $cells['view']='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($table=='tt_content'?$this->id.'#'.$row['uid']:$row['uid'], $this->backPath)).'">'.
1068 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom.gif','width="12" height="12"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPage',1).'" alt="" />'.
1070 } elseif(!$this->table) {
1071 $cells['view'] = $this->spaceIcon;
1074 // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
1076 $params='&edit['.$table.']['.$row['uid'].']=edit';
1077 $cells['edit']='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
1078 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2'.(!$TCA[$table]['ctrl']['readOnly']?'':'_d').'.gif','width="11" height="12"').' title="'.$LANG->getLL('edit',1).'" alt="" />'.
1080 } elseif(!$this->table) {
1081 $cells['edit'] = $this->spaceIcon;
1084 // "Move" wizard link for pages/tt_content elements:
1085 if (($table=="tt_content" && $permsEdit) || ($table=='pages')) {
1086 $cells['move']='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\''.$this->backPath.'move_el.php?table='.$table.'&uid='.$row['uid'].'\');').'">'.
1087 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/move_'.($table=='tt_content'?'record':'page').'.gif','width="11" height="12"').' title="'.$LANG->getLL('move_'.($table=='tt_content'?'record':'page'),1).'" alt="" />'.
1089 } elseif(!$this->table) {
1090 $cells['move'] = $this->spaceIcon;
1093 // If the extended control panel is enabled OR if we are seeing a single table:
1094 if ($SOBE->MOD_SETTINGS['bigControlPanel'] || $this->table) {
1096 // "Info": (All records)
1097 $cells['viewBig']='<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$table.'\', \''.$row['uid'].'\'); return false;').'">'.
1098 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom2.gif','width="12" height="12"').' title="'.$LANG->getLL('showInfo',1).'" alt="" />'.
1101 // If the table is NOT a read-only table, then show these links:
1102 if (!$TCA[$table]['ctrl']['readOnly']) {
1104 // "Revert" link (history/undo)
1105 $cells['history']='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\''.$this->backPath.'show_rechis.php?element='.rawurlencode($table.':'.$row['uid']).'\',\'#latest\');').'">'.
1106 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/history2.gif','width="13" height="12"').' title="'.$LANG->getLL('history',1).'" alt="" />'.
1110 if (t3lib_extMgm::isLoaded('version')) {
1111 $vers = t3lib_BEfunc::selectVersionsOfRecord($table, $row['uid'], 'uid', $GLOBALS['BE_USER']->workspace);
1112 if (is_array($vers)) { // If table can be versionized.
1113 if (count($vers)>1) {
1114 $class = 'typo3-ctrl-versioning-multipleVersions';
1115 $lab = count($vers)-1;
1117 $class = 'typo3-ctrl-versioning-oneVersion';
1121 $cells['version']='<a href="'.htmlspecialchars($this->backPath.t3lib_extMgm::extRelPath('version')).'cm1/index.php?table='.rawurlencode($table).'&uid='.rawurlencode($row['uid']).'" title="'.$LANG->getLL('displayVersions',1).'" class="typo3-ctrl-versioning ' . $class . '">'.
1124 } elseif(!$this->table) {
1125 $cells['version'] = '<span class="typo3-ctrl-versioning typo3-ctrl-versioning-hidden">V</span>';
1129 // "Edit Perms" link:
1130 if ($table=='pages' && $GLOBALS['BE_USER']->check('modules','web_perm')) {
1131 $cells['perms']='<a href="'.htmlspecialchars('mod/web/perm/index.php?id='.$row['uid'].'&return_id='.$row['uid'].'&edit=1').'">'.
1132 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/perm.gif','width="7" height="12"').' title="'.$LANG->getLL('permissions',1).'" alt="" />'.
1134 } elseif(!$this->table && $GLOBALS['BE_USER']->check('modules','web_perm')) {
1135 $cells['perms'] = $this->spaceIcon;
1138 // "New record after" link (ONLY if the records in the table are sorted by a "sortby"-row or if default values can depend on previous record):
1139 if ($TCA[$table]['ctrl']['sortby'] || $TCA[$table]['ctrl']['useColumnsForDefaultValues']) {
1141 ($table!='pages' && ($this->calcPerms&16)) || // For NON-pages, must have permission to edit content on this parent page
1142 ($table=='pages' && ($this->calcPerms&8)) // For pages, must have permission to create new pages here.
1144 if ($this->showNewRecLink($table)) {
1145 $params='&edit['.$table.']['.(-($row['_MOVE_PLH']?$row['_MOVE_PLH_uid']:$row['uid'])).']=new';
1146 $cells['new']='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
1147 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'el').'.gif','width="'.($table=='pages'?13:11).'" height="12"').' title="'.$LANG->getLL('new'.($table=='pages'?'Page':'Record'),1).'" alt="" />'.
1151 } elseif(!$this->table) {
1152 $cells['new'] = $this->spaceIcon;
1156 if ($permsEdit && $TCA[$table]['ctrl']['sortby'] && !$this->sortField && !$this->searchLevels) {
1157 if (isset($this->currentTable['prev'][$row['uid']])) { // Up
1158 $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['prev'][$row['uid']];
1159 $cells['moveUp']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
1160 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_up.gif','width="11" height="10"').' title="'.$LANG->getLL('moveUp',1).'" alt="" />'.
1163 $cells['moveUp'] = $this->spaceIcon;
1165 if ($this->currentTable['next'][$row['uid']]) { // Down
1166 $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['next'][$row['uid']];
1167 $cells['moveDown']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
1168 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_down.gif','width="11" height="10"').' title="'.$LANG->getLL('moveDown',1).'" alt="" />'.
1171 $cells['moveDown'] = $this->spaceIcon;
1173 } elseif(!$this->table) {
1174 $cells['moveUp'] = $this->spaceIcon;
1175 $cells['moveDown'] = $this->spaceIcon;
1178 // "Hide/Unhide" links:
1179 $hiddenField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
1180 if ($permsEdit && $hiddenField && $TCA[$table]['columns'][$hiddenField] && (!$TCA[$table]['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields',$table.':'.$hiddenField))) {
1181 if ($row[$hiddenField]) {
1182 $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=0';
1183 $cells['hide']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
1184 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_unhide.gif','width="11" height="10"').' title="'.$LANG->getLL('unHide'.($table=='pages'?'Page':''),1).'" alt="" />'.
1187 $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=1';
1188 $cells['hide']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
1189 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_hide.gif','width="11" height="10"').' title="'.$LANG->getLL('hide'.($table=='pages'?'Page':''),1).'" alt="" />'.
1192 } elseif(!$this->table) {
1193 $cells['hide'] = $this->spaceIcon;
1198 ($table=='pages' && ($localCalcPerms&4)) || ($table!='pages' && ($this->calcPerms&16))
1200 $titleOrig = t3lib_BEfunc::getRecordTitle($table,$row,FALSE,TRUE);
1201 $titleLength = $GLOBALS['BE_USER']->uc['titleLen'];
1202 if (!$titleLength || !t3lib_div::testInt($titleLength) || $titleLength < 0) {
1205 $title = t3lib_div::slashJS(t3lib_div::fixed_lgd_cs($titleOrig, $titleLength),1);
1206 $params = '&cmd['.$table.']['.$row['uid'].'][delete]=1';
1207 $cells['delete']='<a href="#" onclick="'.htmlspecialchars('if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning').' "'. $title.'" '.t3lib_BEfunc::referenceCount($table,$row['uid'],' (There are %s reference(s) to this record!)')).')) {jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');} return false;').'">'.
1208 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/garbage.gif','width="11" height="12"').' title="'.$LANG->getLL('delete',1).'" alt="" />'.
1210 } elseif(!$this->table) {
1211 $cells['delete'] = $this->spaceIcon;
1214 // "Levels" links: Moving pages into new levels...
1215 if ($permsEdit && $table=='pages' && !$this->searchLevels) {
1217 // Up (Paste as the page right after the current parent page)
1218 if ($this->calcPerms&8) {
1219 $params='&cmd['.$table.']['.$row['uid'].'][move]='.-$this->id;
1220 $cells['moveLeft']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
1221 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_left.gif','width="11" height="10"').' title="'.$LANG->getLL('prevLevel',1).'" alt="" />'.
1224 // Down (Paste as subpage to the page right above)
1225 if ($this->currentTable['prevUid'][$row['uid']]) {
1226 $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',$this->currentTable['prevUid'][$row['uid']]));
1227 if ($localCalcPerms&8) {
1228 $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['prevUid'][$row['uid']];
1229 $cells['moveRight']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
1230 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_right.gif','width="11" height="10"').' title="'.$LANG->getLL('nextLevel',1).'" alt="" />'.
1233 $cells['moveRight'] = $this->spaceIcon;
1236 $cells['moveRight'] = $this->spaceIcon;
1238 } elseif(!$this->table) {
1239 $cells['moveLeft'] = $this->spaceIcon;
1240 $cells['moveRight'] = $this->spaceIcon;
1247 * @hook recStatInfoHooks: Allows to insert HTML before record icons on various places
1249 * @request Kasper Skaarhoj <kasper2007@typo3.com>
1251 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
1253 $_params = array($table,$row['uid']);
1254 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
1255 $stat.=t3lib_div::callUserFunction($_funcRef,$_params,$this);
1257 $cells['stat'] = $stat;
1260 * @hook makeControl: Allows to change control icons of records in list-module
1262 * @request Bernhard Kraft <krafbt@kraftb.at>
1263 * @usage This hook method gets passed the current $cells array as third parameter. This array contains values for the icons/actions generated for each record in Web>List. Each array entry is accessible by an index-key. The order of the icons is dependend on the order of those array entries.
1265 if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
1266 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
1267 $hookObject = &t3lib_div::getUserObj($classData);
1268 if(!($hookObject instanceof localRecordList_actionsHook)) {
1269 throw new UnexpectedValueException('$hookObject must implement interface localRecordList_actionsHook', 1195567840);
1271 $cells = $hookObject->makeControl($table, $row, $cells, $this);
1275 // Compile items into a DIV-element:
1277 <!-- CONTROL PANEL: '.$table.':'.$row['uid'].' -->
1278 <div class="typo3-DBctrl">'.implode('',$cells).'</div>';
1282 * Creates the clipboard panel for a single record in the listing.
1284 * @param string The table
1285 * @param array The record for which to make the clipboard panel.
1286 * @return string HTML table with the clipboard panel (unless disabled)
1288 function makeClip($table,$row) {
1289 global $TCA, $LANG, $TYPO3_CONF_VARS;
1291 // Return blank, if disabled:
1292 if ($this->dontShowClipControlPanels) return '';
1295 $cells['pasteAfter'] = $cells['pasteInto'] = $this->spaceIcon;
1297 // Return blank, if disabled:
1298 // Whether a numeric clipboard pad is active or the normal pad we will see different content of the panel:
1299 if ($this->clipObj->current=='normal') { // For the "Normal" pad:
1301 // Show copy/cut icons:
1302 $isSel = (string)$this->clipObj->isSelected($table,$row['uid']);
1303 $cells['copy']='<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],1,($isSel=='copy'),array('returnUrl'=>'')).'\');').'">'.
1304 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_copy'.($isSel=='copy'?'_h':'').'.gif','width="12" height="12"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:cm.copy',1).'" alt="" />'.
1306 $cells['cut']='<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],0,($isSel=='cut'),array('returnUrl'=>'')).'\');').'">'.
1307 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_cut'.($isSel=='cut'?'_h':'').'.gif','width="12" height="12"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:cm.cut',1).'" alt="" />'.
1310 } else { // For the numeric clipboard pads (showing checkboxes where one can select elements on/off)
1312 // Setting name of the element in ->CBnames array:
1313 $n=$table.'|'.$row['uid'];
1314 $this->CBnames[]=$n;
1316 // Check if the current element is selected and if so, prepare to set the checkbox as selected:
1317 $checked = ($this->clipObj->isSelected($table,$row['uid'])?' checked="checked"':'');
1319 // If the "duplicateField" value is set then select all elements which are duplicates...
1320 if ($this->duplicateField && isset($row[$this->duplicateField])) {
1322 if (in_array($row[$this->duplicateField], $this->duplicateStack)) {
1323 $checked=' checked="checked"';
1325 $this->duplicateStack[] = $row[$this->duplicateField];
1328 // Adding the checkbox to the panel:
1329 $cells['select']='<input type="hidden" name="CBH['.$n.']" value="0" /><input type="checkbox" name="CBC['.$n.']" value="1" class="smallCheckboxes"'.$checked.' />';
1332 // Now, looking for selected elements from the current table:
1333 $elFromTable = $this->clipObj->elFromTable($table);
1334 if (count($elFromTable) && $TCA[$table]['ctrl']['sortby']) { // IF elements are found and they can be individually ordered, then add a "paste after" icon:
1335 $cells['pasteAfter']='<a href="'.htmlspecialchars($this->clipObj->pasteUrl($table,-$row['uid'])).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg($table,$row,'after',$elFromTable)).'">'.
1336 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_pasteafter.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_pasteAfter',1).'" alt="" />'.
1340 // Now, looking for elements in general:
1341 $elFromTable = $this->clipObj->elFromTable('');
1342 if ($table=='pages' && count($elFromTable)) {
1343 $cells['pasteInto']='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('',$row['uid'])).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg($table,$row,'into',$elFromTable)).'">'.
1344 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_pasteinto.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_pasteInto',1).'" alt="" />'.
1349 * @hook makeClip: Allows to change clip-icons of records in list-module
1351 * @request Bernhard Kraft <krafbt@kraftb.at>
1352 * @usage This hook method gets passed the current $cells array as third parameter. This array contains values for the clipboard icons generated for each record in Web>List. Each array entry is accessible by an index-key. The order of the icons is dependend on the order of those array entries.
1354 if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
1355 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
1356 $hookObject = &t3lib_div::getUserObj($classData);
1357 if(!($hookObject instanceof localRecordList_actionsHook)) {
1358 throw new UnexpectedValueException('$hookObject must implement interface localRecordList_actionsHook', 1195567845);
1360 $cells = $hookObject->makeClip($table, $row, $cells, $this);
1364 // Compile items into a DIV-element:
1365 return ' <!-- CLIPBOARD PANEL: '.$table.':'.$row['uid'].' -->
1366 <div class="typo3-clipCtrl">'.implode('',$cells).'</div>';
1370 * Make reference count
1372 * @param string Table name
1373 * @param integer UID of record
1374 * @return string HTML-table
1376 function makeRef($table,$uid) {
1378 // Look up the path:
1379 $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
1382 'ref_table='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_refindex').
1383 ' AND ref_uid='.intval($uid).
1387 // Compile information for title tag:
1389 if (is_array($rows)) {
1390 foreach($rows as $row) {
1391 $infoData[]=$row['tablename'].':'.$row['recuid'].':'.$row['field'];
1395 return count($infoData) ? '<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$table.'\', \''.$uid.'\'); return false;').'" title="'.htmlspecialchars(t3lib_div::fixed_lgd_cs(implode(' / ',$infoData),100)).'">'.count($infoData).'</a>' : '';
1399 * Creates the localization panel
1401 * @param string The table
1402 * @param array The record for which to make the localization panel.
1403 * @return array Array with key 0/1 with content for column 1 and 2
1405 function makeLocalizationPanel($table,$row) {
1413 $t8Tools = t3lib_div::makeInstance('t3lib_transl8tools');
1414 $translations = $t8Tools->translationInfo($table,$row['uid']);
1416 // Language title and icon:
1417 $out[0] = $this->languageFlag($row[$TCA[$table]['ctrl']['languageField']]);
1419 if (is_array($translations)) {
1421 // Traverse page translations and add icon for each language that does NOT yet exist:
1423 foreach($this->pageOverlays as $lUid_OnPage => $lsysRec) {
1424 if (!isset($translations['translations'][$lUid_OnPage]) && $GLOBALS['BE_USER']->checkLanguageAccess($lUid_OnPage)) {
1425 $href = $GLOBALS['TBE_TEMPLATE']->issueCommand(
1426 '&cmd['.$table.']['.$row['uid'].'][localize]='.$lUid_OnPage,
1427 $this->listURL().'&justLocalized='.rawurlencode($table.':'.$row['uid'].':'.$lUid_OnPage)
1430 $lC = ($this->languageIconTitles[$lUid_OnPage]['flagIcon'] ? '<img src="'.$this->languageIconTitles[$lUid_OnPage]['flagIcon'].'" class="absmiddle" alt="" />' : $this->languageIconTitles[$lUid_OnPage]['title']);
1431 $lC = '<a href="'.htmlspecialchars($href).'">'.$lC.'</a> ';
1437 if ($lNew) $out[1].= $lNew;
1439 $out[0] = ' '.$out[0];
1447 * Create the selector box for selecting fields to display from a table:
1449 * @param string Table name
1450 * @param boolean If true, form-fields will be wrapped around the table.
1451 * @return string HTML table with the selector box (name: displayFields['.$table.'][])
1453 function fieldSelectBox($table,$formFields=1) {
1457 t3lib_div::loadTCA($table);
1458 $formElements=array('','');
1460 $formElements=array('<form action="'.htmlspecialchars($this->listURL()).'" method="post">','</form>');
1463 // Load already selected fields, if any:
1464 $setFields=is_array($this->setFields[$table]) ? $this->setFields[$table] : array();
1466 // Request fields from table:
1467 $fields = $this->makeFieldList($table, false, true);
1469 // Add pseudo "control" fields
1472 $fields[]='_LOCALIZATION_';
1473 $fields[]='_CONTROL_';
1474 $fields[]='_CLIPBOARD_';
1476 // Create an option for each field:
1478 $opt[] = '<option value=""></option>';
1479 foreach($fields as $fN) {
1480 $fL = is_array($TCA[$table]['columns'][$fN]) ? ereg_replace(':$','',$LANG->sL($TCA[$table]['columns'][$fN]['label'])) : '['.$fN.']'; // Field label
1482 <option value="'.$fN.'"'.(in_array($fN,$setFields)?' selected="selected"':'').'>'.htmlspecialchars($fL).'</option>';
1485 // Compile the options into a multiple selector box:
1487 <select size="'.t3lib_div::intInRange(count($fields)+1,3,20).'" multiple="multiple" name="displayFields['.$table.'][]">'.implode('',$opt).'
1491 // Table with the field selector::
1493 '.$formElements[0].'
1496 Field selector for extended table view:
1498 <table border="0" cellpadding="0" cellspacing="0" class="bgColor4" id="typo3-dblist-fieldSelect">
1501 <td><input type="submit" name="search" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.setFields',1).'" /></td>
1518 /*********************************
1522 *********************************/
1525 * Creates a link around $string. The link contains an onclick action which submits the script with some clipboard action.
1526 * Currently, this is used for setting elements / delete elements.
1528 * @param string The HTML content to link (image/text)
1529 * @param string Table name
1530 * @param string Clipboard command (eg. "setCB" or "delete")
1531 * @param string Warning text, if any ("delete" uses this for confirmation)
1532 * @return string <a> tag wrapped link.
1534 function linkClipboardHeaderIcon($string,$table,$cmd,$warning='') {
1535 $onClickEvent = 'document.dblistForm.cmd.value=\''.$cmd.'\';document.dblistForm.cmd_table.value=\''.$table.'\';document.dblistForm.submit();';
1536 if ($warning) $onClickEvent = 'if (confirm('.$GLOBALS['LANG']->JScharCode($warning).')){'.$onClickEvent.'}';
1537 return '<a href="#" onclick="'.htmlspecialchars($onClickEvent.'return false;').'">'.$string.'</a>';
1541 * Returns true if a numeric clipboard pad is selected/active
1545 function clipNumPane() {
1546 return in_Array('_CLIPBOARD_',$this->fieldArray) && $this->clipObj->current!='normal';
1550 * Creates a sort-by link on the input string ($code).
1551 * It will automatically detect if sorting should be ascending or descending depending on $this->sortRev.
1552 * Also some fields will not be possible to sort (including if single-table-view is disabled).
1554 * @param string The string to link (text)
1555 * @param string The fieldname represented by the title ($code)
1556 * @param string Table name
1557 * @return string Linked $code variable
1559 function addSortLink($code,$field,$table) {
1561 // Certain circumstances just return string right away (no links):
1562 if ($field=='_CONTROL_' || $field=='_LOCALIZATION_' || $field=='_CLIPBOARD_' || $field=='_REF_' || $this->disableSingleTableView) return $code;
1564 // If "_PATH_" (showing record path) is selected, force sorting by pid field (will at least group the records!)
1565 if ($field=='_PATH_') $field=pid;
1567 // Create the sort link:
1568 $sortUrl = $this->listURL('',-1,'sortField,sortRev,table').'&table='.$table.'&sortField='.$field.'&sortRev='.($this->sortRev || ($this->sortField!=$field)?0:1);
1569 $sortArrow = ($this->sortField==$field?'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/red'.($this->sortRev?'up':'down').'.gif','width="7" height="4"').' alt="" />':'');
1571 // Return linked field:
1572 return '<a href="'.htmlspecialchars($sortUrl).'">'.$code.
1578 * Returns the path for a certain pid
1579 * The result is cached internally for the session, thus you can call this function as much as you like without performance problems.
1581 * @param integer The page id for which to get the path
1582 * @return string The path.
1584 function recPath($pid) {
1585 if (!isset($this->recPath_cache[$pid])) {
1586 $this->recPath_cache[$pid] = t3lib_BEfunc::getRecordPath($pid,$this->perms_clause,20);
1588 return $this->recPath_cache[$pid];
1592 * Returns true if a link for creating new records should be displayed for $table
1594 * @param string Table name
1595 * @return boolean Returns true if a link for creating new records should be displayed for $table
1596 * @see SC_db_new::showNewRecLink
1598 function showNewRecLink($table) {
1599 // No deny/allow tables are set:
1600 if (!count($this->allowedNewTables) && !count($this->deniedNewTables)) {
1602 // If table is not denied (which takes precedence over allowed tables):
1603 } elseif (!in_array($table, $this->deniedNewTables) && (!count($this->allowedNewTables) || in_array($table, $this->allowedNewTables))) {
1605 // If table is denied or allowed tables are set, but table is not part of:
1612 * Creates the "&returnUrl" parameter for links - this is used when the script links to other scripts and passes its own URL with the link so other scripts can return to the listing again.
1613 * Uses REQUEST_URI as value.
1617 function makeReturnUrl() {
1618 return '&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
1631 /************************************
1633 * CSV related functions
1635 ************************************/
1638 * Initializes internal csvLines array with the header of field names
1642 function initCSV() {
1645 $this->csvLines=array();
1647 // Getting header line with field names:
1649 foreach ($this->fieldArray as $fN) {
1650 if ($fN == '_CONTROL_' || $fN == '_CLIPBOARD_') {
1656 // Set the header + an empty row:
1657 $this->setCsvRow($csvRow);
1658 $this->csvLines[] = '';
1663 * Adds the content of input array $row to the CSV list:
1665 * @param array Record array, from which the values of fields found in $this->fieldArray will be listed in the CSV output.
1666 * @param string Table name
1669 function addToCSV($row,$table) {
1671 // Traversing fields, adding values from $row:
1673 foreach ($this->fieldArray as $fN) {
1676 $csvRow[] = $this->recPath($row['pid']);
1680 $csvRow[] = $this->makeRef($table, $row['uid']);
1683 // remove these columns from the CSV view
1690 $csvRow[] = $row[$fN];
1694 // Set the values in the CSV list
1695 $this->setCsvRow($csvRow);
1700 * Adds input row of values to the internal csvLines array as a CSV formatted line
1702 * @param array Array with values to be listed.
1705 function setCsvRow($csvRow) {
1706 $this->csvLines[] = t3lib_div::csvValues($csvRow);
1710 * Compiles the internal csvLines array to a csv-string and outputs it to the browser.
1711 * This function exits!
1713 * @param string Filename prefix:
1714 * @return void EXITS php execusion!
1716 function outputCSV($prefix) {
1718 // Setting filename:
1719 $filename=$prefix.'_'.date('dmy-Hi').'.csv';
1721 // Creating output header:
1722 $mimeType = 'application/octet-stream';
1723 Header('Content-Type: '.$mimeType);
1724 Header('Content-Disposition: attachment; filename='.$filename);
1726 // Printing the content of the CSV lines:
1727 echo implode(chr(13).chr(10),$this->csvLines);
1736 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc']) {
1737 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc']);