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