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