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