[TASK] version entry script cleanup
[Packages/TYPO3.CMS.git] / typo3 / sysext / version / Classes / Controller / VersionModuleController.php
1 <?php
2 namespace TYPO3\CMS\Version\Controller;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2004-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 use TYPO3\CMS\Core\Utility\GeneralUtility;
28 use TYPO3\CMS\Backend\Utility\BackendUtility;
29 use TYPO3\CMS\Backend\Utility\IconUtility;
30
31 /**
32 * Versioning module, including workspace management
33 *
34 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
35 */
36 class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
37
38 // Default variables for backend modules
39 /**
40 * @todo Define visibility
41 */
42 public $MCONF = array();
43
44 // Module configuration
45 /**
46 * @todo Define visibility
47 */
48 public $MOD_MENU = array();
49
50 // Module menu items
51 /**
52 * @todo Define visibility
53 */
54 public $MOD_SETTINGS = array();
55
56 // Module session settings
57 /**
58 * document template object
59 *
60 * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
61 * @todo Define visibility
62 */
63 public $doc;
64
65 /**
66 * @todo Define visibility
67 */
68 public $content;
69
70 // Accumulated content
71 // Internal:
72 /**
73 * @todo Define visibility
74 */
75 public $showWorkspaceCol = 0;
76
77 /**
78 * @todo Define visibility
79 */
80 public $formatWorkspace_cache = array();
81
82 /**
83 * @todo Define visibility
84 */
85 public $formatCount_cache = array();
86
87 /**
88 * @todo Define visibility
89 */
90 public $targets = array();
91
92 // Accumulation of online targets.
93 /**
94 * @todo Define visibility
95 */
96 public $pageModule = '';
97
98 // Name of page module
99 /**
100 * @todo Define visibility
101 */
102 public $publishAccess = FALSE;
103
104 /**
105 * @todo Define visibility
106 */
107 public $be_user_Array = array();
108
109 /**
110 * @todo Define visibility
111 */
112 public $stageIndex = array();
113
114 /**
115 * @todo Define visibility
116 */
117 public $recIndex = array();
118
119 /**
120 * Initialize language files
121 */
122 public function __construct() {
123 $GLOBALS['LANG']->includeLLFile('EXT:version/locallang.xlf');
124 }
125
126 // Determines whether to show the dummy draft workspace
127 /*********************************
128 *
129 * Standard module initialization
130 *
131 *********************************/
132 /**
133 * Initialize menu configuration
134 *
135 * @return void
136 * @todo Define visibility
137 */
138 public function menuConfig() {
139 // CLEANSE SETTINGS
140 $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->MCONF['name'], 'ses');
141 }
142
143 /**
144 * Main function of the module. Write the content to $this->content
145 *
146 * @return void
147 * @todo Define visibility
148 */
149 public function main() {
150 // Template markers
151 $markers = array(
152 'CSH' => '',
153 'FUNC_MENU' => '',
154 'WS_MENU' => '',
155 'CONTENT' => ''
156 );
157 // Setting module configuration:
158 $this->MCONF = $GLOBALS['MCONF'];
159 $this->REQUEST_URI = str_replace('&sendToReview=1', '', GeneralUtility::getIndpEnv('REQUEST_URI'));
160 // Draw the header.
161 $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
162 $this->doc->backPath = $GLOBALS['BACK_PATH'];
163 $this->doc->setModuleTemplate('EXT:version/Resources/Private/Templates/version.html');
164 // Add styles
165 $this->doc->inDocStylesArray[$GLOBALS['MCONF']['name']] = '
166 .version-diff-1 { background-color: green; }
167 .version-diff-2 { background-color: red; }
168 ';
169 // Setting up the context sensitive menu:
170 $this->doc->getContextMenuCode();
171 // Getting input data:
172 $this->id = (int)GeneralUtility::_GP('id');
173
174 // Record uid. Goes with table name to indicate specific record
175 $this->uid = (int)GeneralUtility::_GP('uid');
176 // // Record table. Goes with uid to indicate specific record
177 $this->table = GeneralUtility::_GP('table');
178
179 $this->details = GeneralUtility::_GP('details');
180 // Page id. If set, indicates activation from Web>Versioning module
181 $this->diffOnly = GeneralUtility::_GP('diffOnly');
182 // Flag. If set, shows only the offline version and with diff-view
183 // Force this setting:
184 $this->MOD_SETTINGS['expandSubElements'] = TRUE;
185 $this->MOD_SETTINGS['diff'] = $this->details || $this->MOD_SETTINGS['diff'] ? 1 : 0;
186 // Reading the record:
187 $record = BackendUtility::getRecord($this->table, $this->uid);
188 if ($record['pid'] == -1) {
189 $record = BackendUtility::getRecord($this->table, $record['t3ver_oid']);
190 }
191 $this->recordFound = is_array($record);
192 $pidValue = $this->table === 'pages' ? $this->uid : $record['pid'];
193 // Checking access etc.
194 if ($this->recordFound && $GLOBALS['TCA'][$this->table]['ctrl']['versioningWS'] && !$this->id) {
195 $this->doc->form = '<form action="" method="post">';
196 $this->uid = $record['uid'];
197 // Might have changed if new live record was found!
198 // Access check!
199 // The page will show only if there is a valid page and if this page may be viewed by the user
200 $this->pageinfo = BackendUtility::readPageAccess($pidValue, $this->perms_clause);
201 $access = is_array($this->pageinfo) ? 1 : 0;
202 if ($pidValue && $access || $GLOBALS['BE_USER']->user['admin'] && !$pidValue) {
203 // JavaScript
204 $this->doc->JScode .= $this->doc->wrapScriptTags('
205
206 function hlSubelements(origId, verId, over, diffLayer) { //
207 if (over) {
208 document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\';
209 document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\';
210 if (diffLayer) {
211 document.getElementById(\'diff_\'+verId).style.visibility = \'visible\';
212 }
213 } else {
214 document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\';
215 document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\';
216 if (diffLayer) {
217 document.getElementById(\'diff_\'+verId).style.visibility = \'hidden\';
218 }
219 }
220 }
221 ');
222 // If another page module was specified, replace the default Page module with the new one
223 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
224 $this->pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
225 // Setting publish access permission for workspace:
226 $this->publishAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace);
227 $this->versioningMgm();
228 }
229 $this->content .= $this->doc->spacer(10);
230 // Setting up the buttons and markers for docheader
231 $docHeaderButtons = $this->getButtons();
232 $markers['CSH'] = $docHeaderButtons['csh'];
233 $markers['FUNC_MENU'] = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
234 $markers['CONTENT'] = $this->content;
235 } else {
236 // If no access or id value, create empty document
237 $this->content = $this->doc->section($GLOBALS['LANG']->getLL('clickAPage_header'), $GLOBALS['LANG']->getLL('clickAPage_content'), 0, 1);
238 // Setting up the buttons and markers for docheader
239 $docHeaderButtons = $this->getButtons();
240 $markers['CONTENT'] = $this->content;
241 }
242 // Build the <body> for the module
243 $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
244 $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
245 $this->content .= $this->doc->endPage();
246 $this->content = $this->doc->insertStylesAndJS($this->content);
247 }
248
249 /**
250 * Outputs accumulated module content to browser.
251 *
252 * @return void
253 * @todo Define visibility
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 UID of page record for which to look up sub-elements following that version
427 * @param integer 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 }
469 return $content ? '<table border="1" cellpadding="1" cellspacing="0" width="100%">' . $content . '</table>' : '';
470 }
471
472 /**
473 * Look for number of versions of a record
474 *
475 * @param string Table name
476 * @param integer Record uid
477 * @return integer Number of versions for record, FALSE if none.
478 * @todo Define visibility
479 */
480 public function lookForOwnVersions($table, $uid) {
481 $versions = BackendUtility::selectVersionsOfRecord($table, $uid, 'uid');
482 if (is_array($versions)) {
483 return count($versions);
484 }
485 return FALSE;
486 }
487
488 /**
489 * Administrative links for a table / record
490 *
491 * @param string Table name
492 * @param array Record for which administrative links are generated.
493 * @return string HTML link tags.
494 * @todo Define visibility
495 */
496 public function adminLinks($table, $row) {
497 // Edit link:
498 $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>';
499 // Delete link:
500 $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>';
501 if ($table == 'pages') {
502 // If another page module was specified, replace the default Page module with the new one
503 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
504 $pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
505 // Perform some acccess checks:
506 $a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list');
507 $a_wp = $GLOBALS['BE_USER']->check('modules', $pageModule);
508 $adminLink .= '<a href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(\'' . $pageModule . '\'); return false;">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>';
509 $adminLink .= '<a href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(\'web_list\'); return false;">' . IconUtility::getSpriteIcon('actions-system-list-open') . '</a>';
510 // "View page" icon is added:
511 $adminLink .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['uid'], $this->doc->backPath, BackendUtility::BEgetRootLine($row['uid']))) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
512 } else {
513 if ($row['pid'] == -1) {
514 $getVars = '&ADMCMD_vPrev[' . rawurlencode(($table . ':' . $row['t3ver_oid'])) . ']=' . $row['uid'];
515 // "View page" icon is added:
516 $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>';
517 }
518 }
519 return $adminLink;
520 }
521 }