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