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