[TASK] Cleanup EXT:version
[Packages/TYPO3.CMS.git] / typo3 / sysext / version / Classes / Controller / VersionModuleController.php
1 <?php
2 namespace TYPO3\CMS\Version\Controller;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Core\Utility\GeneralUtility;
18 use TYPO3\CMS\Backend\Utility\BackendUtility;
19 use TYPO3\CMS\Backend\Utility\IconUtility;
20
21 /**
22 * Versioning module, including workspace management
23 *
24 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
25 */
26 class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
27
28 /**
29 * Module configuration
30 *
31 * @var array
32 * @todo Define visibility
33 */
34 public $MCONF = array();
35
36 /**
37 * Module menu items
38 *
39 * @var array
40 * @todo Define visibility
41 */
42 public $MOD_MENU = array();
43
44 /**
45 * Module session settings
46 *
47 * @var array
48 * @todo Define visibility
49 */
50 public $MOD_SETTINGS = array();
51
52 /**
53 * document template object
54 *
55 * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
56 * @todo Define visibility
57 */
58 public $doc;
59
60 /**
61 * @var string
62 * @todo Define visibility
63 */
64 public $content;
65
66 /**
67 * Accumulated content
68 *
69 * @var int
70 * @todo Define visibility
71 */
72 public $showWorkspaceCol = 0;
73
74 /**
75 * @var array
76 * @todo Define visibility
77 */
78 public $formatWorkspace_cache = array();
79
80 /**
81 * @var array
82 * @todo Define visibility
83 */
84 public $formatCount_cache = array();
85
86 /**
87 * @var array
88 * @todo Define visibility
89 */
90 public $targets = array();
91
92 /**
93 * Accumulation of online targets.
94 *
95 * @var string
96 * @todo Define visibility
97 */
98 public $pageModule = '';
99
100 /**
101 * Name of page module
102 *
103 * @var bool
104 * @todo Define visibility
105 */
106 public $publishAccess = FALSE;
107
108 /**
109 * @var array
110 * @todo Define visibility
111 */
112 public $be_user_Array = array();
113
114 /**
115 * @var array
116 * @todo Define visibility
117 */
118 public $stageIndex = array();
119
120 /**
121 * @var array
122 * @todo Define visibility
123 */
124 public $recIndex = array();
125
126 /**
127 * Initialize language files
128 */
129 public function __construct() {
130 $GLOBALS['LANG']->includeLLFile('EXT:version/locallang.xlf');
131 }
132
133 /**
134 * Initialize menu configuration
135 *
136 * @return void
137 * @todo Define visibility
138 */
139 public function menuConfig() {
140 // CLEANSE SETTINGS
141 $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->MCONF['name'], 'ses');
142 }
143
144 /**
145 * Main function of the module. Write the content to $this->content
146 *
147 * @return void
148 * @todo Define visibility
149 */
150 public function main() {
151 // Template markers
152 $markers = array(
153 'CSH' => '',
154 'FUNC_MENU' => '',
155 'WS_MENU' => '',
156 'CONTENT' => ''
157 );
158 // Setting module configuration:
159 $this->MCONF = $GLOBALS['MCONF'];
160 $this->REQUEST_URI = str_replace('&sendToReview=1', '', GeneralUtility::getIndpEnv('REQUEST_URI'));
161 // Draw the header.
162 $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
163 $this->doc->backPath = $GLOBALS['BACK_PATH'];
164 $this->doc->setModuleTemplate('EXT:version/Resources/Private/Templates/version.html');
165 // Add styles
166 $this->doc->inDocStylesArray[$GLOBALS['MCONF']['name']] = '
167 .version-diff-1 { background-color: green; }
168 .version-diff-2 { background-color: red; }
169 ';
170 // Setting up the context sensitive menu:
171 $this->doc->getContextMenuCode();
172 // Getting input data:
173 $this->id = (int)GeneralUtility::_GP('id');
174
175 // Record uid. Goes with table name to indicate specific record
176 $this->uid = (int)GeneralUtility::_GP('uid');
177 // // Record table. Goes with uid to indicate specific record
178 $this->table = GeneralUtility::_GP('table');
179
180 $this->details = GeneralUtility::_GP('details');
181 // Page id. If set, indicates activation from Web>Versioning module
182 $this->diffOnly = GeneralUtility::_GP('diffOnly');
183 // Flag. If set, shows only the offline version and with diff-view
184 // Force this setting:
185 $this->MOD_SETTINGS['expandSubElements'] = TRUE;
186 $this->MOD_SETTINGS['diff'] = $this->details || $this->MOD_SETTINGS['diff'] ? 1 : 0;
187 // Reading the record:
188 $record = BackendUtility::getRecord($this->table, $this->uid);
189 if ($record['pid'] == -1) {
190 $record = BackendUtility::getRecord($this->table, $record['t3ver_oid']);
191 }
192 $this->recordFound = is_array($record);
193 $pidValue = $this->table === 'pages' ? $this->uid : $record['pid'];
194 // Checking access etc.
195 if ($this->recordFound && $GLOBALS['TCA'][$this->table]['ctrl']['versioningWS'] && !$this->id) {
196 $this->doc->form = '<form action="" method="post">';
197 $this->uid = $record['uid'];
198 // Might have changed if new live record was found!
199 // Access check!
200 // The page will show only if there is a valid page and if this page may be viewed by the user
201 $this->pageinfo = BackendUtility::readPageAccess($pidValue, $this->perms_clause);
202 $access = is_array($this->pageinfo) ? 1 : 0;
203 if ($pidValue && $access || $GLOBALS['BE_USER']->user['admin'] && !$pidValue) {
204 // JavaScript
205 $this->doc->JScode .= $this->doc->wrapScriptTags('
206
207 function hlSubelements(origId, verId, over, diffLayer) { //
208 if (over) {
209 document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\';
210 document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\';
211 if (diffLayer) {
212 document.getElementById(\'diff_\'+verId).style.visibility = \'visible\';
213 }
214 } else {
215 document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\';
216 document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\';
217 if (diffLayer) {
218 document.getElementById(\'diff_\'+verId).style.visibility = \'hidden\';
219 }
220 }
221 }
222 ');
223 // If another page module was specified, replace the default Page module with the new one
224 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
225 $this->pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
226 // Setting publish access permission for workspace:
227 $this->publishAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace);
228 $this->versioningMgm();
229 }
230 $this->content .= $this->doc->spacer(10);
231 // Setting up the buttons and markers for docheader
232 $docHeaderButtons = $this->getButtons();
233 $markers['CSH'] = $docHeaderButtons['csh'];
234 $markers['FUNC_MENU'] = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
235 $markers['CONTENT'] = $this->content;
236 } else {
237 // If no access or id value, create empty document
238 $this->content = $this->doc->section($GLOBALS['LANG']->getLL('clickAPage_header'), $GLOBALS['LANG']->getLL('clickAPage_content'), 0, 1);
239 // Setting up the buttons and markers for docheader
240 $docHeaderButtons = $this->getButtons();
241 $markers['CONTENT'] = $this->content;
242 }
243 // Build the <body> for the module
244 $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
245 $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
246 $this->content .= $this->doc->endPage();
247 $this->content = $this->doc->insertStylesAndJS($this->content);
248 }
249
250 /**
251 * Outputs accumulated module content to browser.
252 *
253 * @return void
254 */
255 public function printContent() {
256 echo $this->content;
257 }
258
259 /**
260 * Create the panel of buttons for submitting the form or otherwise perform operations.
261 *
262 * @return array All available buttons as an assoc. array
263 */
264 protected function getButtons() {
265 $buttons = array(
266 'csh' => '',
267 'view' => '',
268 'record_list' => '',
269 'shortcut' => ''
270 );
271 // CSH
272 if ($this->recordFound && $GLOBALS['TCA'][$this->table]['ctrl']['versioningWS']) {
273 // View page
274 $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
275 // Shortcut
276 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
277 $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']);
278 }
279 // If access to Web>List for user, then link to that module.
280 $buttons['record_list'] = BackendUtility::getListViewLink(array(
281 'id' => $this->pageinfo['uid'],
282 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
283 ), '', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showList'));
284 }
285 return $buttons;
286 }
287
288 /******************************
289 *
290 * Versioning management
291 *
292 ******************************/
293 /**
294 * Management of versions for record
295 *
296 * @return void
297 * @todo Define visibility
298 */
299 public function versioningMgm() {
300 // Diffing:
301 $diff_1 = GeneralUtility::_POST('diff_1');
302 $diff_2 = GeneralUtility::_POST('diff_2');
303 if (GeneralUtility::_POST('do_diff')) {
304 $content = '';
305 $content .= '<h3>' . $GLOBALS['LANG']->getLL('diffing') . ':</h3>';
306 if ($diff_1 && $diff_2) {
307 $diff_1_record = BackendUtility::getRecord($this->table, $diff_1);
308 $diff_2_record = BackendUtility::getRecord($this->table, $diff_2);
309 if (is_array($diff_1_record) && is_array($diff_2_record)) {
310 $t3lib_diff_Obj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\DiffUtility');
311 $tRows = array();
312 $tRows[] = '
313 <tr class="bgColor5 tableheader">
314 <td>' . $GLOBALS['LANG']->getLL('fieldname') . '</td>
315 <td width="98%">' . $GLOBALS['LANG']->getLL('coloredDiffView') . ':</td>
316 </tr>
317 ';
318 foreach ($diff_1_record as $fN => $fV) {
319 if ($GLOBALS['TCA'][$this->table]['columns'][$fN] && $GLOBALS['TCA'][$this->table]['columns'][$fN]['config']['type'] !== 'passthrough' && !GeneralUtility::inList('t3ver_label', $fN)) {
320 if ((string)$diff_1_record[$fN] !== (string)$diff_2_record[$fN]) {
321 $diffres = $t3lib_diff_Obj->makeDiffDisplay(BackendUtility::getProcessedValue($this->table, $fN, $diff_2_record[$fN], 0, 1), BackendUtility::getProcessedValue($this->table, $fN, $diff_1_record[$fN], 0, 1));
322 $tRows[] = '
323 <tr class="bgColor4">
324 <td>' . $fN . '</td>
325 <td width="98%">' . $diffres . '</td>
326 </tr>
327 ';
328 }
329 }
330 }
331 if (count($tRows) > 1) {
332 $content .= '<table border="0" cellpadding="1" cellspacing="1" width="100%">' . implode('', $tRows) . '</table><br /><br />';
333 } else {
334 $content .= $GLOBALS['LANG']->getLL('recordsMatchesCompletely');
335 }
336 } else {
337 $content .= $GLOBALS['LANG']->getLL('errorRecordsNotFound');
338 }
339 } else {
340 $content .= $GLOBALS['LANG']->getLL('errorDiffSources');
341 }
342 }
343 // Element:
344 $record = BackendUtility::getRecord($this->table, $this->uid);
345 $recordIcon = IconUtility::getSpriteIconForRecord($this->table, $record);
346 $recTitle = BackendUtility::getRecordTitle($this->table, $record, TRUE);
347 // Display versions:
348 $content .= '
349 ' . $recordIcon . $recTitle . '
350 <form name="theform" action="' . str_replace('&sendToReview=1', '', $this->REQUEST_URI) . '" method="post">
351 <table border="0" cellspacing="1" cellpadding="1">';
352 $content .= '
353 <tr class="bgColor5 tableheader">
354 <td>&nbsp;</td>
355 <td>&nbsp;</td>
356 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_title') . '">' . $GLOBALS['LANG']->getLL('tblHeader_title') . '</td>
357 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_uid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_uid') . '</td>
358 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_oid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_oid') . '</td>
359 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_id') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_id') . '</td>
360 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_wsid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_wsid') . '</td>
361 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_state') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_state') . '</td>
362 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_stage') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_stage') . '</td>
363 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_count') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_count') . '</td>
364 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_pid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_pid') . '</td>
365 <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_label') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . '</td>
366 <td colspan="2"><input type="submit" name="do_diff" value="' . $GLOBALS['LANG']->getLL('diff') . '" /></td>
367 </tr>';
368 $versions = BackendUtility::selectVersionsOfRecord($this->table, $this->uid, '*', $GLOBALS['BE_USER']->workspace);
369 foreach ($versions as $row) {
370 $adminLinks = $this->adminLinks($this->table, $row);
371 $content .= '
372 <tr class="' . ($row['uid'] != $this->uid ? 'bgColor4' : 'bgColor2 tableheader') . '">
373 <td>' . ($row['uid'] != $this->uid ?
374 '<a href="' . $this->doc->issueCommand(('&cmd[' . $this->table . '][' . $this->uid . '][version][swapWith]=' . $row['uid'] . '&cmd[' . $this->table . '][' . $this->uid . '][version][action]=swap')) . '" title="' . $GLOBALS['LANG']->getLL('swapWithCurrent', TRUE) . '">' . IconUtility::getSpriteIcon('actions-version-swap-version') . '</a>' :
375 IconUtility::getSpriteIcon('status-status-current', array('title' => $GLOBALS['LANG']->getLL('currentOnlineVersion', TRUE)))) . '</td>
376 <td nowrap="nowrap">' . $adminLinks . '</td>
377 <td nowrap="nowrap">' . BackendUtility::getRecordTitle($this->table, $row, TRUE) . '</td>
378 <td>' . $row['uid'] . '</td>
379 <td>' . $row['t3ver_oid'] . '</td>
380 <td>' . $row['t3ver_id'] . '</td>
381 <td>' . $row['t3ver_wsid'] . '</td>
382 <td>' . $row['t3ver_state'] . '</td>
383 <td>' . $row['t3ver_stage'] . '</td>
384 <td>' . $row['t3ver_count'] . '</td>
385 <td>' . $row['pid'] . '</td>
386 <td nowrap="nowrap"><a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick(('&edit[' . $this->table . '][' . $row['uid'] . ']=edit&columnsOnly=t3ver_label'), $this->doc->backPath)) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>' . htmlspecialchars($row['t3ver_label']) . '</td>
387 <td class="version-diff-1"><input type="radio" name="diff_1" value="' . $row['uid'] . '"' . ($diff_1 == $row['uid'] ? ' checked="checked"' : '') . '/></td>
388 <td class="version-diff-2"><input type="radio" name="diff_2" value="' . $row['uid'] . '"' . ($diff_2 == $row['uid'] ? ' checked="checked"' : '') . '/></td>
389 </tr>';
390 // Show sub-content if the table is pages AND it is not the online branch (because that will mostly render the WHOLE tree below - not smart;)
391 if ($this->table == 'pages' && $row['uid'] != $this->uid) {
392 $sub = $this->pageSubContent($row['uid']);
393 if ($sub) {
394 $content .= '
395 <tr>
396 <td></td>
397 <td></td>
398 <td colspan="10">' . $sub . '</td>
399 <td colspan="2"></td>
400 </tr>';
401 }
402 }
403 }
404 $content .= '</table></form>';
405 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('title'), $content, 0, 1);
406 // Create new:
407 $content = '
408
409 <form action="' . $this->doc->backPath . 'tce_db.php" method="post">
410 ' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . ': <input type="text" name="cmd[' . $this->table . '][' . $this->uid . '][version][label]" /><br />
411 <br /><input type="hidden" name="cmd[' . $this->table . '][' . $this->uid . '][version][action]" value="new" />
412 <input type="hidden" name="prErr" value="1" />
413 <input type="hidden" name="redirect" value="' . htmlspecialchars($this->REQUEST_URI) . '" />
414 <input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('createNewVersion') . '" />
415 ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
416 </form>
417
418 ';
419 $this->content .= $this->doc->spacer(15);
420 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('createNewVersion'), $content, 0, 1);
421 }
422
423 /**
424 * Recursively look for children for page version with $pid
425 *
426 * @param integer $pid UID of page record for which to look up sub-elements following that version
427 * @param integer $c Counter, do not set (limits to 100 levels)
428 * @return string Table with content if any
429 * @todo Define visibility
430 */
431 public function pageSubContent($pid, $c = 0) {
432 $tableNames = GeneralUtility::removeArrayEntryByValue(array_keys($GLOBALS['TCA']), 'pages');
433 $tableNames[] = 'pages';
434 $content = '';
435 foreach ($tableNames as $tN) {
436 // Basically list ALL tables - not only those being copied might be found!
437 $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $tN, 'pid=' . (int)$pid . BackendUtility::deleteClause($tN), '', $GLOBALS['TCA'][$tN]['ctrl']['sortby'] ? $GLOBALS['TCA'][$tN]['ctrl']['sortby'] : '');
438 if ($GLOBALS['TYPO3_DB']->sql_num_rows($mres)) {
439 $content .= '
440 <tr>
441 <td colspan="4" class="' . ($GLOBALS['TCA'][$tN]['ctrl']['versioning_followPages'] ? 'bgColor6' : ($tN == 'pages' ? 'bgColor5' : 'bgColor-10')) . '"' . (!$GLOBALS['TCA'][$tN]['ctrl']['versioning_followPages'] && $tN !== 'pages' ? ' style="color: #666666; font-style:italic;"' : '') . '>' . $tN . '</td>
442 </tr>';
443 while ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) {
444 $ownVer = $this->lookForOwnVersions($tN, $subrow['uid']);
445 $content .= '
446 <tr>
447 <td>' . $this->adminLinks($tN, $subrow) . '</td>
448 <td>' . $subrow['uid'] . '</td>
449 ' . ($ownVer > 1 ? '<td style="font-weight: bold; background-color: yellow;"><a href="' .
450 BackendUtility::getModuleUrl('web_txversionM1', array('table' => $tN, 'uid' => $subrow['uid'])) .
451 '">' . ($ownVer - 1) . '</a></td>' : '<td></td>') . '
452 <td width="98%">' . BackendUtility::getRecordTitle($tN, $subrow, TRUE) . '</td>
453 </tr>';
454 if ($tN == 'pages' && $c < 100) {
455 $sub = $this->pageSubContent($subrow['uid'], $c + 1);
456 if ($sub) {
457 $content .= '
458 <tr>
459 <td></td>
460 <td></td>
461 <td></td>
462 <td width="98%">' . $sub . '</td>
463 </tr>';
464 }
465 }
466 }
467 }
468 $GLOBALS['TYPO3_DB']->sql_free_result($mres);
469 }
470 return $content ? '<table border="1" cellpadding="1" cellspacing="0" width="100%">' . $content . '</table>' : '';
471 }
472
473 /**
474 * Look for number of versions of a record
475 *
476 * @param string $table Table name
477 * @param integer $uid Record uid
478 * @return integer Number of versions for record, FALSE if none.
479 * @todo Define visibility
480 */
481 public function lookForOwnVersions($table, $uid) {
482 $versions = BackendUtility::selectVersionsOfRecord($table, $uid, 'uid');
483 if (is_array($versions)) {
484 return count($versions);
485 }
486 return FALSE;
487 }
488
489 /**
490 * Administrative links for a table / record
491 *
492 * @param string $table Table name
493 * @param array $row Record for which administrative links are generated.
494 * @return string HTML link tags.
495 * @todo Define visibility
496 */
497 public function adminLinks($table, $row) {
498 // Edit link:
499 $adminLink = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick(('&edit[' . $table . '][' . $row['uid'] . ']=edit'), $this->doc->backPath)) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
500 // Delete link:
501 $adminLink .= '<a href="' . htmlspecialchars($this->doc->issueCommand(('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1'))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete', TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
502 if ($table === 'pages') {
503 // If another page module was specified, replace the default Page module with the new one
504 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
505 $pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
506 // Perform some acccess checks:
507 $a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list');
508 $a_wp = $GLOBALS['BE_USER']->check('modules', $pageModule);
509 $adminLink .= '<a href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(\'' . $pageModule . '\'); return false;">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>';
510 $adminLink .= '<a href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(\'web_list\'); return false;">' . IconUtility::getSpriteIcon('actions-system-list-open') . '</a>';
511 // "View page" icon is added:
512 $adminLink .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['uid'], $this->doc->backPath, BackendUtility::BEgetRootLine($row['uid']))) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
513 } else {
514 if ($row['pid'] == -1) {
515 $getVars = '&ADMCMD_vPrev[' . rawurlencode(($table . ':' . $row['t3ver_oid'])) . ']=' . $row['uid'];
516 // "View page" icon is added:
517 $adminLink .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['_REAL_PID'], $this->doc->backPath, BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
518 }
519 }
520 return $adminLink;
521 }
522 }