[BUGFIX] Prevent compression of scripts that use ajax.php
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_positionmap.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
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.
13 *
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.
18 *
19 *
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.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Contains class for creating a position map.
29 *
30 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
31 * XHTML compliant (should be)
32 *
33 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
34 */
35
36
37 /**
38 * Position map class - generating a page tree / content element list which links for inserting (copy/move) of records.
39 * Used for pages / tt_content element wizards of various kinds.
40 *
41 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
42 * @package TYPO3
43 * @subpackage t3lib
44 */
45 class t3lib_positionMap {
46
47 // EXTERNAL, static:
48 var $moveOrCopy = 'move';
49 var $dontPrintPageInsertIcons = 0;
50 var $backPath = '';
51 var $depth = 2; // How deep the position page tree will go.
52 var $cur_sys_language; // Can be set to the sys_language uid to select content elements for.
53
54
55 // INTERNAL, dynamic:
56 var $R_URI = ''; // Request uri
57 var $elUid = ''; // Element id.
58 var $moveUid = ''; // tt_content element uid to move.
59
60 // Caching arrays:
61 var $getModConfigCache = array();
62 var $checkNewPageCache = Array();
63
64 // Label keys:
65 var $l_insertNewPageHere = 'insertNewPageHere';
66 var $l_insertNewRecordHere = 'insertNewRecordHere';
67
68 var $modConfigStr = 'mod.web_list.newPageWiz';
69
70
71 /*************************************
72 *
73 * Page position map:
74 *
75 **************************************/
76
77 /**
78 * Creates a "position tree" based on the page tree.
79 * Notice: A class, "localPageTree" must exist and probably it is an extension class of the t3lib_pageTree class. See "db_new.php" in the core for an example.
80 *
81 * @param integer Current page id
82 * @param array Current page record.
83 * @param string Page selection permission clause.
84 * @param string Current REQUEST_URI
85 * @return string HTML code for the tree.
86 */
87 function positionTree($id, $pageinfo, $perms_clause, $R_URI) {
88 $code = '';
89 // Make page tree object:
90 /** @var $t3lib_pageTree localPageTree */
91 $t3lib_pageTree = t3lib_div::makeInstance('localPageTree');
92 $t3lib_pageTree->init(' AND ' . $perms_clause);
93 $t3lib_pageTree->addField('pid');
94
95 // Initialize variables:
96 $this->R_URI = $R_URI;
97 $this->elUid = $id;
98
99 // Create page tree, in $this->depth levels.
100 $t3lib_pageTree->getTree($pageinfo['pid'], $this->depth);
101 if (!$this->dontPrintPageInsertIcons) {
102 $code .= $this->JSimgFunc();
103 }
104
105 // Initialize variables:
106 $saveBlankLineState = array();
107 $saveLatestUid = array();
108 $latestInvDepth = $this->depth;
109
110 // Traverse the tree:
111 foreach ($t3lib_pageTree->tree as $cc => $dat) {
112
113 // Make link + parameters.
114 $latestInvDepth = $dat['invertedDepth'];
115 $saveLatestUid[$latestInvDepth] = $dat;
116 if (isset($t3lib_pageTree->tree[$cc - 1])) {
117 $prev_dat = $t3lib_pageTree->tree[$cc - 1];
118
119 // If current page, subpage?
120 if ($prev_dat['row']['uid'] == $id) {
121 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($id) && !($prev_dat['invertedDepth'] > $t3lib_pageTree->tree[$cc]['invertedDepth'])) { // 1) It must be allowed to create a new page and 2) If there are subpages there is no need to render a subpage icon here - it'll be done over the subpages...
122 $code .= '<span class="nobr">' .
123 $this->insertQuadLines($dat['blankLineCode']) .
124 '<img src="clear.gif" width="18" height="8" align="top" alt="" />' .
125 '<a href="#" onclick="' . htmlspecialchars($this->onClickEvent($id, $id, 1)) . '" onmouseover="' . htmlspecialchars('changeImg(\'mImgSubpage' . $cc . '\',0);') . '" onmouseout="' . htmlspecialchars('changeImg(\'mImgSubpage' . $cc . '\',1);') . '">' .
126 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' name="mImgSubpage' . $cc . '" border="0" align="top" title="' . $this->insertlabel() . '" alt="" />' .
127 '</a></span><br />';
128 }
129 }
130
131 if ($prev_dat['invertedDepth'] > $t3lib_pageTree->tree[$cc]['invertedDepth']) { // If going down
132 $prevPid = $t3lib_pageTree->tree[$cc]['row']['pid'];
133 } elseif ($prev_dat['invertedDepth'] < $t3lib_pageTree->tree[$cc]['invertedDepth']) { // If going up
134 // First of all the previous level should have an icon:
135 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($prev_dat['row']['pid'])) {
136 $prevPid = (-$prev_dat['row']['uid']);
137 $code .= '<span class="nobr">' .
138 $this->insertQuadLines($dat['blankLineCode']) .
139 '<img src="clear.gif" width="18" height="1" align="top" alt="" />' .
140 '<a href="#" onclick="' . htmlspecialchars($this->onClickEvent($prevPid, $prev_dat['row']['pid'], 2)) . '" onmouseover="' . htmlspecialchars('changeImg(\'mImgAfter' . $cc . '\',0);') . '" onmouseout="' . htmlspecialchars('changeImg(\'mImgAfter' . $cc . '\',1);') . '">' .
141 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' name="mImgAfter' . $cc . '" border="0" align="top" title="' . $this->insertlabel() . '" alt="" />' .
142 '</a></span><br />';
143 }
144
145 // Then set the current prevPid
146 $prevPid = -$prev_dat['row']['pid'];
147 } else {
148 $prevPid = -$prev_dat['row']['uid']; // In on the same level
149 }
150 } else {
151 $prevPid = $dat['row']['pid']; // First in the tree
152 }
153 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($dat['row']['pid'])) {
154 $code .= '<span class="nobr">' .
155 $this->insertQuadLines($dat['blankLineCode']) .
156 '<a href="#" onclick="' . htmlspecialchars($this->onClickEvent($prevPid, $dat['row']['pid'], 3)) . '" onmouseover="' . htmlspecialchars('changeImg(\'mImg' . $cc . '\',0);') . '" onmouseout="' . htmlspecialchars('changeImg(\'mImg' . $cc . '\',1);') . '">' .
157 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' name="mImg' . $cc . '" border="0" align="top" title="' . $this->insertlabel() . '" alt="" />' .
158 '</a></span><br />';
159 }
160
161 // The line with the icon and title:
162 $t_code = '<span class="nobr">' .
163 $dat['HTML'] .
164 $this->linkPageTitle(
165 $this->boldTitle(
166 htmlspecialchars(t3lib_div::fixed_lgd_cs($dat['row']['title'], $GLOBALS['BE_USER']->uc['titleLen'])),
167 $dat,
168 $id),
169 $dat['row']
170 ) . '</span><br />';
171 $code .= $t_code;
172 }
173
174 // If the current page was the last in the tree:
175 $prev_dat = end($t3lib_pageTree->tree);
176 if ($prev_dat['row']['uid'] == $id) {
177 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($id)) {
178 $code .= '<span class="nobr">' .
179 $this->insertQuadLines($saveLatestUid[$latestInvDepth]['blankLineCode'], 1) .
180 '<img src="clear.gif" width="18" height="8" align="top" alt="" />' .
181 '<a href="#" onclick="' . $this->onClickEvent($id, $id, 4) . '" onmouseover="' . htmlspecialchars('changeImg(\'mImgSubpage' . $cc . '\',0);') . '" onmouseout="' . htmlspecialchars('changeImg(\'mImgSubpage' . $cc . '\',1);') . '">' .
182 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' name="mImgSubpage' . $cc . '" border="0" align="top" title="' . $this->insertlabel() . '" alt="" />' .
183 '</a></span><br />';
184 }
185 }
186
187 for ($a = $latestInvDepth; $a <= $this->depth; $a++) {
188 $dat = $saveLatestUid[$a];
189 $prevPid = (-$dat['row']['uid']);
190 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($dat['row']['pid'])) {
191 $code .= '<span class="nobr">' .
192 $this->insertQuadLines($dat['blankLineCode'], 1) .
193 '<a href="#" onclick="' . htmlspecialchars($this->onClickEvent($prevPid, $dat['row']['pid'], 5)) . '" onmouseover="' . htmlspecialchars('changeImg(\'mImgEnd' . $a . '\',0);') . '" onmouseout="' . htmlspecialchars('changeImg(\'mImgEnd' . $a . '\',1);') . '">' .
194 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' name="mImgEnd' . $a . '" border="0" align="top" title="' . $this->insertlabel() . '" alt="" />' .
195 '</a></span><br />';
196 }
197 }
198
199 return $code;
200 }
201
202 /**
203 * Creates the JavaScritp for insert new-record rollover image
204 *
205 * @param string Insert record image prefix.
206 * @return string <script> section
207 */
208 function JSimgFunc($prefix = '') {
209 $code = $GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
210
211 var img_newrecord_marker=new Image();
212 img_newrecord_marker.src = "' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord' . $prefix . '_marker.gif', '', 1) . '";
213
214 var img_newrecord_marker_d=new Image();
215 img_newrecord_marker_d.src = "' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord' . $prefix . '_marker_d.gif', '', 1) . '";
216
217 function changeImg(name,d) { //
218 if (document[name]) {
219 if (d) {
220 document[name].src = img_newrecord_marker_d.src;
221 } else {
222 document[name].src = img_newrecord_marker.src;
223 }
224 }
225 }
226 ');
227 return $code;
228 }
229
230 /**
231 * Wrap $t_code in bold IF the $dat uid matches $id
232 *
233 * @param string Title string
234 * @param array Infomation array with record array inside.
235 * @param integer The current id.
236 * @return string The title string.
237 */
238 function boldTitle($t_code, $dat, $id) {
239 if ($dat['row']['uid'] == $id) {
240 $t_code = '<strong>' . $t_code . '</strong>';
241 }
242 return $t_code;
243 }
244
245 /**
246 * Creates the onclick event for the insert-icons.
247 *
248 * TSconfig mod.web_list.newPageWiz.overrideWithExtension may contain an extension which provides a module
249 * to be used instead of the normal create new page wizard.
250 *
251 * @param integer The pid.
252 * @param integer New page id.
253 * @return string Onclick attribute content
254 */
255 function onClickEvent($pid, $newPagePID) {
256 $TSconfigProp = $this->getModConfig($newPagePID);
257
258 if ($TSconfigProp['overrideWithExtension']) {
259 if (t3lib_extMgm::isLoaded($TSconfigProp['overrideWithExtension'])) {
260 $onclick = "window.location.href='" . t3lib_extMgm::extRelPath($TSconfigProp['overrideWithExtension']) . 'mod1/index.php?cmd=crPage&positionPid=' . $pid . "';";
261 return $onclick;
262 }
263 }
264
265 $params = '&edit[pages][' . $pid . ']=new&returnNewPageId=1';
266 return t3lib_BEfunc::editOnClick($params, '', $this->R_URI);
267 }
268
269 /**
270 * Get label, htmlspecialchars()'ed
271 *
272 * @return string The localized label for "insert new page here"
273 */
274 function insertlabel() {
275 return $GLOBALS['LANG']->getLL($this->l_insertNewPageHere, 1);
276 }
277
278 /**
279 * Wrapping page title.
280 *
281 * @param string Page title.
282 * @param array Page record (?)
283 * @return string Wrapped title.
284 */
285 function linkPageTitle($str, $rec) {
286 return $str;
287 }
288
289 /**
290 * Checks if the user has permission to created pages inside of the $pid page.
291 * Uses caching so only one regular lookup is made - hence you can call the function multiple times without worrying about performance.
292 *
293 * @param integer Page id for which to test.
294 * @return boolean
295 */
296 function checkNewPageInPid($pid) {
297 if (!isset($this->checkNewPageCache[$pid])) {
298 $pidInfo = t3lib_BEfunc::getRecord('pages', $pid);
299 $this->checkNewPageCache[$pid] = ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess($pidInfo, 8));
300 }
301 return $this->checkNewPageCache[$pid];
302 }
303
304 /**
305 * Returns module configuration for a pid.
306 *
307 * @param integer Page id for which to get the module configuration.
308 * @return array The properties of teh module configuration for the page id.
309 * @see onClickEvent()
310 */
311 function getModConfig($pid) {
312 if (!isset($this->getModConfigCache[$pid])) {
313 // Acquiring TSconfig for this PID:
314 $this->getModConfigCache[$pid] = t3lib_BEfunc::getModTSconfig($pid, $this->modConfigStr);
315 }
316 return $this->getModConfigCache[$pid]['properties'];
317 }
318
319 /**
320 * Insert half/quad lines.
321 *
322 * @param string keywords for which lines to insert.
323 * @param boolean If TRUE all lines are just blank clear.gifs
324 * @return string HTML content.
325 */
326 function insertQuadLines($codes, $allBlank = 0) {
327 $codeA = t3lib_div::trimExplode(',', $codes . ",line", 1);
328
329 $lines = array();
330 foreach ($codeA as $code) {
331 if ($code == "blank" || $allBlank) {
332 $lines[] = '<img src="clear.gif" width="18" height="8" align="top" alt="" />';
333 } else {
334 $lines[] = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/ol/halfline.gif', 'width="18" height="8"') . ' align="top" alt="" />';
335 }
336 }
337 return implode('', $lines);
338 }
339
340
341 /*************************************
342 *
343 * Content element positioning:
344 *
345 **************************************/
346
347 /**
348 * Creates HTML for inserting/moving content elements.
349 *
350 * @param integer page id onto which to insert content element.
351 * @param integer Move-uid (tt_content element uid?)
352 * @param string List of columns to show
353 * @param boolean If not set, then hidden/starttime/endtime records are filtered out.
354 * @param string Request URI
355 * @return string HTML
356 */
357 function printContentElementColumns($pid, $moveUid, $colPosList, $showHidden, $R_URI) {
358 $this->R_URI = $R_URI;
359 $this->moveUid = $moveUid;
360 $colPosArray = t3lib_div::trimExplode(',', $colPosList, 1);
361
362 $lines = array();
363 foreach ($colPosArray as $kk => $vv) {
364 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
365 '*',
366 'tt_content',
367 'pid=' . intval($pid) .
368 ($showHidden ? '' : t3lib_BEfunc::BEenableFields('tt_content')) .
369 ' AND colPos=' . intval($vv) .
370 (strcmp($this->cur_sys_language, '') ? ' AND sys_language_uid=' . intval($this->cur_sys_language) : '') .
371 t3lib_BEfunc::deleteClause('tt_content') .
372 t3lib_BEfunc::versioningPlaceholderClause('tt_content'),
373 '',
374 'sorting'
375 );
376 $lines[$vv] = array();
377 $lines[$vv][] = $this->insertPositionIcon('', $vv, $kk, $moveUid, $pid);
378 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
379 t3lib_BEfunc::workspaceOL('tt_content', $row);
380 if (is_array($row)) {
381 $lines[$vv][] = $this->wrapRecordHeader($this->getRecordHeader($row), $row);
382 $lines[$vv][] = $this->insertPositionIcon($row, $vv, $kk, $moveUid, $pid);
383 }
384 }
385 $GLOBALS['TYPO3_DB']->sql_free_result($res);
386 }
387 return $this->printRecordMap($lines, $colPosArray, $pid);
388 }
389
390 /**
391 * Creates the table with the content columns
392 *
393 * @param array Array with arrays of lines for each column
394 * @param array Column position array
395 * @param integer The id of the page
396 * @return string HTML
397 */
398 function printRecordMap($lines, $colPosArray, $pid = 0) {
399
400 $row1 = '';
401 $row2 = '';
402 $count = t3lib_utility_Math::forceIntegerInRange(count($colPosArray), 1);
403
404 $backendLayout = t3lib_div::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getSelectedBackendLayout', $pid, $this);
405
406 if (isset($backendLayout['__config']['backend_layout.'])) {
407
408 $table = '<div class="t3-gridContainer"><table border="0" cellspacing="0" cellpadding="0" id="typo3-ttContentList">';
409
410 $colCount = intval($backendLayout['__config']['backend_layout.']['colCount']);
411 $rowCount = intval($backendLayout['__config']['backend_layout.']['rowCount']);
412
413 $table .= '<colgroup>';
414 for ($i = 0; $i < $colCount; $i++) {
415 $table .= '<col style="width:' . (100 / $colCount) . '%"></col>';
416 }
417 $table .= '</colgroup>';
418
419 $tcaItems = t3lib_div::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getColPosListItemsParsed', $pid, $this);
420
421 // cycle through rows
422 for ($row = 1; $row <= $rowCount; $row++) {
423 $rowConfig = $backendLayout['__config']['backend_layout.']['rows.'][$row . '.'];
424 if (!isset($rowConfig)) {
425 continue;
426 }
427
428 $table .= '<tr>';
429
430 for ($col = 1; $col <= $colCount; $col++) {
431 $columnConfig = $rowConfig['columns.'][$col . '.'];
432 if (!isset($columnConfig)) {
433 continue;
434 }
435
436 // which tt_content colPos should be displayed inside this cell
437 $columnKey = intval($columnConfig['colPos']);
438 $head = '';
439
440 $params = array();
441 $params['pid'] = $pid;
442
443 foreach ($tcaItems as $item) {
444 if ($item[1] == $columnKey) {
445 $head = $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'colPos', $columnKey, $params), 1);
446 }
447 }
448
449 // render the grid cell
450 $table .= '<td valign="top"' .
451 (isset($columnConfig['colspan']) ? ' colspan="' . $columnConfig['colspan'] . '"' : '') .
452 (isset($columnConfig['rowspan']) ? ' rowspan="' . $columnConfig['rowspan'] . '"' : '') .
453 ' class="t3-gridCell t3-page-column t3-page-column-' . $columnKey .
454 (!isset($columnConfig['colPos']) ? ' t3-gridCell-unassigned' : '') .
455 ((isset($columnConfig['colPos']) && ! $head) ? ' t3-gridCell-restricted' : '') .
456 (isset($columnConfig['colspan']) ? ' t3-gridCell-width' . $columnConfig['colspan'] : '') .
457 (isset($columnConfig['rowspan']) ? ' t3-gridCell-height' . $columnConfig['rowspan'] : '') . '">';
458
459 $table .= '<div class="t3-page-colHeader t3-row-header">';
460
461 if (isset($columnConfig['colPos']) && $head) {
462 $table .= $this->wrapColumnHeader($head, '', '') . '</div>' . implode('<br />', $lines[$columnKey]);
463 } elseif ($columnConfig['colPos']) {
464 $table .= $this->wrapColumnHeader($GLOBALS['LANG']->getLL('noAccess'), '', '') . '</div>';
465 } elseif ($columnConfig['name']) {
466 $table .= $this->wrapColumnHeader($columnConfig['name'], '', '') . '</div>';
467 } else {
468 $table .= $this->wrapColumnHeader($GLOBALS['LANG']->getLL('notAssigned'), '', '') . '</div>';
469 }
470 $table .= '</td>';
471 }
472 $table .= '</tr>';
473 }
474 $table .= '</table></div>';
475 } else {
476 // Traverse the columns here:
477 foreach ($colPosArray as $kk => $vv) {
478 $row1 .= '<td align="center" width="' . round(100 / $count) . '%"><div class="t3-page-colHeader t3-row-header">' .
479 $this->wrapColumnHeader($GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'colPos', $vv, $pid), 1), $vv) .
480 '</div></td>';
481 $row2 .= '<td valign="top" nowrap="nowrap">' .
482 implode('<br />', $lines[$vv]) .
483 '</td>';
484 }
485
486 $table = '
487
488 <!--
489 Map of records in columns:
490 -->
491 <table border="0" cellpadding="0" cellspacing="0" id="typo3-ttContentList">
492 <tr>' . $row1 . '</tr>
493 <tr>' . $row2 . '</tr>
494 </table>
495
496 ';
497 }
498 return $this->JSimgFunc('2') . $table;
499 }
500
501 /**
502 * Wrapping the column header
503 *
504 * @param string Header value
505 * @param string Column info.
506 * @return string
507 * @see printRecordMap()
508 */
509 function wrapColumnHeader($str, $vv) {
510 return $str;
511 }
512
513 /**
514 * Creates a linked position icon.
515 *
516 * @param array Element row.
517 * @param string Column position value.
518 * @param integer Column key.
519 * @param integer Move uid
520 * @param integer PID value.
521 * @return string
522 */
523 function insertPositionIcon($row, $vv, $kk, $moveUid, $pid) {
524 $cc = hexdec(substr(md5($row['uid'] . '-' . $vv . '-' . $kk), 0, 4));
525 return '<a href="#" onclick="' . htmlspecialchars($this->onClickInsertRecord($row, $vv, $moveUid, $pid, $this->cur_sys_language)) . '" onmouseover="' . htmlspecialchars('changeImg(\'mImg' . $cc . '\',0);') . '" onmouseout="' . htmlspecialchars('changeImg(\'mImg' . $cc . '\',1);') . '">' .
526 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord2_marker_d.gif', 'width="100" height="8"') . ' name="mImg' . $cc . '" border="0" align="top" title="' . $GLOBALS['LANG']->getLL($this->l_insertNewRecordHere, 1) . '" alt="" />' .
527 '</a>';
528 }
529
530 /**
531 * Create on-click event value.
532 *
533 * @param array The record.
534 * @param string Column position value.
535 * @param integer Move uid
536 * @param integer PID value.
537 * @param integer System language (not used currently)
538 * @return string
539 */
540 function onClickInsertRecord($row, $vv, $moveUid, $pid, $sys_lang = 0) {
541 $table = 'tt_content';
542 if (is_array($row)) {
543 $location = 'tce_db.php?cmd[' . $table . '][' . $moveUid . '][' . $this->moveOrCopy . ']=-' . $row['uid'] . '&prErr=1&uPT=1&vC=' . $GLOBALS['BE_USER']->veriCode() . t3lib_BEfunc::getUrlToken('tceAction');
544 } else {
545 $location = 'tce_db.php?cmd[' . $table . '][' . $moveUid . '][' . $this->moveOrCopy . ']=' . $pid . '&data[' . $table . '][' . $moveUid . '][colPos]=' . $vv . '&prErr=1&vC=' . $GLOBALS['BE_USER']->veriCode() . t3lib_BEfunc::getUrlToken('tceAction');
546 }
547
548 $location .= '&redirect=' . rawurlencode($this->R_URI); // returns to prev. page
549
550 return 'window.location.href=\'' . $location . '\';return false;';
551 }
552
553 /**
554 * Wrapping the record header (from getRecordHeader())
555 *
556 * @param string HTML content
557 * @param array Record array.
558 * @return string HTML content
559 */
560 function wrapRecordHeader($str, $row) {
561 return $str;
562 }
563
564 /**
565 * Create record header (includes teh record icon, record title etc.)
566 *
567 * @param array Record row.
568 * @return string HTML
569 */
570 function getRecordHeader($row) {
571 $line = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $row, array('title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($row, 'tt_content'))));
572 $line .= t3lib_BEfunc::getRecordTitle('tt_content', $row, TRUE);
573 return $this->wrapRecordTitle($line, $row);
574 }
575
576 /**
577 * Wrapping the title of the record.
578 *
579 * @param string The title value.
580 * @param array The record row.
581 * @return string Wrapped title string.
582 */
583 function wrapRecordTitle($str, $row) {
584 return '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('uid' => intval($row['uid']), 'moveUid' => ''))) . '">' . $str . '</a>';
585 }
586 }
587
588 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_positionmap.php'])) {
589 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_positionmap.php']);
590 }
591 ?>