[TASK] Replace icon by IconFactory: actions-page-open
[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 Psr\Http\Message\ServerRequestInterface;
18 use TYPO3\CMS\Core\Http\Response;
19 use TYPO3\CMS\Core\Imaging\Icon;
20 use TYPO3\CMS\Core\Imaging\IconFactory;
21 use TYPO3\CMS\Core\Utility\ArrayUtility;
22 use TYPO3\CMS\Core\Utility\DiffUtility;
23 use TYPO3\CMS\Core\Utility\GeneralUtility;
24 use TYPO3\CMS\Backend\Utility\BackendUtility;
25 use TYPO3\CMS\Backend\Utility\IconUtility;
26
27 /**
28 * Versioning module, including workspace management
29 */
30 class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass implements \TYPO3\CMS\Core\Http\ControllerInterface {
31
32 /**
33 * Module configuration
34 *
35 * @var array
36 */
37 public $MCONF = array();
38
39 /**
40 * Module menu items
41 *
42 * @var array
43 */
44 public $MOD_MENU = array();
45
46 /**
47 * Module session settings
48 *
49 * @var array
50 */
51 public $MOD_SETTINGS = array();
52
53 /**
54 * document template object
55 *
56 * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
57 */
58 public $doc;
59
60 /**
61 * @var string
62 */
63 public $content;
64
65 /**
66 * Accumulated content
67 *
68 * @var int
69 */
70 public $showWorkspaceCol = 0;
71
72 /**
73 * @var array
74 */
75 public $formatWorkspace_cache = array();
76
77 /**
78 * @var array
79 */
80 public $formatCount_cache = array();
81
82 /**
83 * @var array
84 */
85 public $targets = array();
86
87 /**
88 * Accumulation of online targets.
89 *
90 * @var string
91 */
92 public $pageModule = '';
93
94 /**
95 * Name of page module
96 *
97 * @var bool
98 */
99 public $publishAccess = FALSE;
100
101 /**
102 * @var array
103 */
104 public $stageIndex = array();
105
106 /**
107 * @var array
108 */
109 public $recIndex = array();
110
111 /**
112 * @var IconFactory
113 */
114 protected $iconFactory;
115
116 /**
117 * The name of the module
118 *
119 * @var string
120 */
121 protected $moduleName = 'web_txversionM1';
122
123 /**
124 * Initialize language files
125 */
126 public function __construct() {
127 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
128 $GLOBALS['SOBE'] = $this;
129 $GLOBALS['LANG']->includeLLFile('EXT:version/Resources/Private/Language/locallang.xlf');
130 }
131
132 /**
133 * Initialize menu configuration
134 *
135 * @return void
136 */
137 public function menuConfig() {
138 // CLEANSE SETTINGS
139 $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->moduleName, 'ses');
140 }
141
142 /**
143 * Main function of the module. Write the content to $this->content
144 *
145 * @return void
146 */
147 public function main() {
148 // Template markers
149 $markers = array(
150 'CSH' => '',
151 'FUNC_MENU' => '',
152 'WS_MENU' => '',
153 'CONTENT' => ''
154 );
155 // Setting module configuration:
156 $this->MCONF['name'] = $this->moduleName;
157 $this->REQUEST_URI = str_replace('&sendToReview=1', '', GeneralUtility::getIndpEnv('REQUEST_URI'));
158 // Draw the header.
159 $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
160 $this->doc->setModuleTemplate('EXT:version/Resources/Private/Templates/version.html');
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->uid = $record['uid'];
189 // Might have changed if new live record was found!
190 // Access check!
191 // The page will show only if there is a valid page and if this page may be viewed by the user
192 $this->pageinfo = BackendUtility::readPageAccess($pidValue, $this->perms_clause);
193 $access = is_array($this->pageinfo) ? 1 : 0;
194 if ($pidValue && $access || $GLOBALS['BE_USER']->user['admin'] && !$pidValue) {
195 // If another page module was specified, replace the default Page module with the new one
196 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
197 $this->pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
198 // Setting publish access permission for workspace:
199 $this->publishAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace);
200 $this->versioningMgm();
201 }
202 // Setting up the buttons and markers for docheader
203 $docHeaderButtons = $this->getButtons();
204 $markers['CSH'] = $docHeaderButtons['csh'];
205 $markers['FUNC_MENU'] = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
206 $markers['CONTENT'] = $this->content;
207 } else {
208 // If no access or id value, create empty document
209 $this->content = $this->doc->section($GLOBALS['LANG']->getLL('clickAPage_header'), $GLOBALS['LANG']->getLL('clickAPage_content'), 0, 1);
210 // Setting up the buttons and markers for docheader
211 $docHeaderButtons = $this->getButtons();
212 $markers['CONTENT'] = $this->content;
213 }
214 // Build the <body> for the module
215 $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
216 $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
217 $this->content .= $this->doc->endPage();
218 $this->content = $this->doc->insertStylesAndJS($this->content);
219 }
220
221 /**
222 * Outputs accumulated module content to browser.
223 *
224 * @return void
225 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
226 */
227 public function printContent() {
228 GeneralUtility::logDeprecatedFunction();
229 echo $this->content;
230 }
231
232 /**
233 * Create the panel of buttons for submitting the form or otherwise perform operations.
234 *
235 * @return array All available buttons as an assoc. array
236 */
237 protected function getButtons() {
238 $buttons = array(
239 'csh' => '',
240 'view' => '',
241 'record_list' => '',
242 'shortcut' => ''
243 );
244 // CSH
245 if ($this->recordFound && $GLOBALS['TCA'][$this->table]['ctrl']['versioningWS']) {
246 // View page
247 $buttons['view'] = '
248 <a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">
249 ' . $this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL) . '
250 </a>';
251 // Shortcut
252 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
253 $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->moduleName);
254 }
255 // If access to Web>List for user, then link to that module.
256 $buttons['record_list'] = BackendUtility::getListViewLink(array(
257 'id' => $this->pageinfo['uid'],
258 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
259 ), '', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showList'));
260 }
261 return $buttons;
262 }
263
264 /******************************
265 *
266 * Versioning management
267 *
268 ******************************/
269 /**
270 * Management of versions for record
271 *
272 * @return void
273 */
274 public function versioningMgm() {
275 // Diffing:
276 $diff_1 = GeneralUtility::_POST('diff_1');
277 $diff_2 = GeneralUtility::_POST('diff_2');
278 if (GeneralUtility::_POST('do_diff')) {
279 $content = '';
280 $content .= '<div class="panel panel-space panel-default">';
281 $content .= '<div class="panel-heading">' . $GLOBALS['LANG']->getLL('diffing') . '</div>';
282 if ($diff_1 && $diff_2) {
283 $diff_1_record = BackendUtility::getRecord($this->table, $diff_1);
284 $diff_2_record = BackendUtility::getRecord($this->table, $diff_2);
285 if (is_array($diff_1_record) && is_array($diff_2_record)) {
286 $diffUtility = GeneralUtility::makeInstance(DiffUtility::class);
287 $rows = array();
288 $rows[] = '
289 <tr>
290 <th>' . $GLOBALS['LANG']->getLL('fieldname') . '</th>
291 <th width="98%">' . $GLOBALS['LANG']->getLL('coloredDiffView') . ':</th>
292 </tr>
293 ';
294 foreach ($diff_1_record as $fN => $fV) {
295 if ($GLOBALS['TCA'][$this->table]['columns'][$fN] && $GLOBALS['TCA'][$this->table]['columns'][$fN]['config']['type'] !== 'passthrough' && !GeneralUtility::inList('t3ver_label', $fN)) {
296 if ((string)$diff_1_record[$fN] !== (string)$diff_2_record[$fN]) {
297 $diffres = $diffUtility->makeDiffDisplay(
298 BackendUtility::getProcessedValue($this->table, $fN, $diff_2_record[$fN], 0, 1),
299 BackendUtility::getProcessedValue($this->table, $fN, $diff_1_record[$fN], 0, 1)
300 );
301 $rows[] = '
302 <tr>
303 <td>' . $fN . '</td>
304 <td width="98%">' . $diffres . '</td>
305 </tr>
306 ';
307 }
308 }
309 }
310 if (count($rows) > 1) {
311 $content .= '<div class="table-fit"><table class="table">' . implode('', $rows) . '</table></div>';
312 } else {
313 $content .= '<div class="panel-body">' . $GLOBALS['LANG']->getLL('recordsMatchesCompletely') . '</div>';
314 }
315 } else {
316 $content .= '<div class="panel-body">' . $GLOBALS['LANG']->getLL('errorRecordsNotFound') . '</div>';
317 }
318 } else {
319 $content .= '<div class="panel-body">' . $GLOBALS['LANG']->getLL('errorDiffSources') . '</div>';
320 }
321 $content .= '</div>';
322 }
323 // Element:
324 $record = BackendUtility::getRecord($this->table, $this->uid);
325 $recTitle = BackendUtility::getRecordTitle($this->table, $record, TRUE);
326 // Display versions:
327 $content .= '
328 <form name="theform" action="' . str_replace('&sendToReview=1', '', $this->REQUEST_URI) . '" method="post">
329 <div class="panel panel-space panel-default">
330 <div class="panel-heading">' . $recTitle . '</div>
331 <div class="table-fit">
332 <table class="table">
333 <thead>
334 <tr>
335 <th colspan="2" class="col-icon"></th>
336 <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_title') . '">' . $GLOBALS['LANG']->getLL('tblHeader_title') . '</th>
337 <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_uid') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_uid') . '</i></th>
338 <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_oid') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_oid') . '</i></th>
339 <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_id') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_id') . '</i></th>
340 <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_wsid') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_wsid') . '</i></th>
341 <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_state', TRUE) . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_state') . '</i></th>
342 <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_stage') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_stage') . '</i></th>
343 <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_count') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_count') . '</i></th>
344 <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_pid') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_pid') . '</i></th>
345 <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_label') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . '</i></th>
346 <th></th>
347 <th colspan="2">
348 <button class="btn btn-default btn-sm" type="submit" name="do_diff" value="true">
349 ' . $GLOBALS['LANG']->getLL('diff') . '
350 </button>
351 </th>
352 </tr>
353 </thead>
354 <tbody>
355 ';
356 $versions = BackendUtility::selectVersionsOfRecord($this->table, $this->uid, '*', $GLOBALS['BE_USER']->workspace);
357 foreach ($versions as $row) {
358 $adminLinks = $this->adminLinks($this->table, $row);
359 $content .= '
360 <tr' . ($row['uid'] != $this->uid ? '' : ' class="active"') . '>
361 <td class="col-icon">' .
362 ($row['uid'] != $this->uid ?
363 '<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) . '">' . $this->iconFactory->getIcon('actions-version-swap-version', Icon::SIZE_SMALL) . '</a>' :
364 '<span title="' . $GLOBALS['LANG']->getLL('currentOnlineVersion', TRUE) . '">' . $this->iconFactory->getIcon('status-status-current', Icon::SIZE_SMALL) . '</span>'
365 ) . '
366 </td>
367 <td class="col-icon">' . IconUtility::getSpriteIconForRecord($this->table, $row) . '</td>
368 <td>' . BackendUtility::getRecordTitle($this->table, $row, TRUE) . '</td>
369 <td>' . $row['uid'] . '</td>
370 <td>' . $row['t3ver_oid'] . '</td>
371 <td>' . $row['t3ver_id'] . '</td>
372 <td>' . $row['t3ver_wsid'] . '</td>
373 <td>' . $row['t3ver_state'] . '</td>
374 <td>' . $row['t3ver_stage'] . '</td>
375 <td>' . $row['t3ver_count'] . '</td>
376 <td>' . $row['pid'] . '</td>
377 <td>
378 <a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick('&edit[' . $this->table . '][' . $row['uid'] . ']=edit&columnsOnly=t3ver_label')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit', TRUE) . '">
379 ' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL) . '
380 </a>' . htmlspecialchars($row['t3ver_label']) . '
381 </td>
382 <td class="col-control">' . $adminLinks . '</td>
383 <td class="text-center success"><input type="radio" name="diff_1" value="' . $row['uid'] . '"' . ($diff_1 == $row['uid'] ? ' checked="checked"' : '') . '/></td>
384 <td class="text-center danger"><input type="radio" name="diff_2" value="' . $row['uid'] . '"' . ($diff_2 == $row['uid'] ? ' checked="checked"' : '') . '/></td>
385 </tr>';
386 // 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;)
387 if ($this->table === 'pages' && $row['uid'] != $this->uid) {
388 $sub = $this->pageSubContent($row['uid']);
389 if ($sub) {
390 $content .= '
391 <tr>
392 <td colspan="2"></td>
393 <td colspan="11">' . $sub . '</td>
394 <td class="success"></td>
395 <td class="danger"></td>
396 </tr>';
397 }
398 }
399 }
400 $content .= '
401 </tbody>
402 </table>
403 </div>
404 </div>
405 </form>';
406 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('title'), $content, 0, 1);
407 // Create new:
408 $content = '
409 <form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_db')) . '" method="post">
410 <div class="row">
411 <div class="col-sm-6 col-md-4 col-lg-3">
412 <div class="form-group">
413 <label for="typo3-new-version-label">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . '</label>
414 <input id="typo3-new-version-label" class="form-control" type="text" name="cmd[' . $this->table . '][' . $this->uid . '][version][label]" />
415 </div>
416 <div class="form-group">
417 <input type="hidden" name="cmd[' . $this->table . '][' . $this->uid . '][version][action]" value="new" />
418 <input type="hidden" name="prErr" value="1" />
419 <input type="hidden" name="redirect" value="' . htmlspecialchars($this->REQUEST_URI) . '" />
420 <input class="btn btn-default" type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('createNewVersion') . '" />
421 ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
422 </div>
423 </div>
424 </div>
425 </form>
426
427 ';
428 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('createNewVersion'), $content, 0, 1);
429 }
430
431 /**
432 * Recursively look for children for page version with $pid
433 *
434 * @param int $pid UID of page record for which to look up sub-elements following that version
435 * @param int $c Counter, do not set (limits to 100 levels)
436 * @return string Table with content if any
437 */
438 public function pageSubContent($pid, $c = 0) {
439 $tableNames = ArrayUtility::removeArrayEntryByValue(array_keys($GLOBALS['TCA']), 'pages');
440 $tableNames[] = 'pages';
441 $content = '';
442 foreach ($tableNames as $table) {
443 // Basically list ALL tables - not only those being copied might be found!
444 $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'pid=' . (int)$pid . BackendUtility::deleteClause($table), '', $GLOBALS['TCA'][$table]['ctrl']['sortby'] ? $GLOBALS['TCA'][$table]['ctrl']['sortby'] : '');
445 if ($GLOBALS['TYPO3_DB']->sql_num_rows($mres)) {
446 $content .= '
447 <table class="table">
448 <tr>
449 <th class="col-icon">' . IconUtility::getSpriteIconForRecord($table, array()) . '</th>
450 <th class="col-title">' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title'], TRUE) . '</th>
451 <th></th>
452 <th></th>
453 </tr>';
454 while ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) {
455 $ownVer = $this->lookForOwnVersions($table, $subrow['uid']);
456 $content .= '
457 <tr>
458 <td class="col-icon">' . IconUtility::getSpriteIconForRecord($table, $subrow) . '</td>
459 <td class="col-title">' . BackendUtility::getRecordTitle($table, $subrow, TRUE) . '</td>
460 <td>' . ($ownVer > 1 ? '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $subrow['uid']))) . '">' . ($ownVer - 1) . '</a>' : '') . '</td>
461 <td class="col-control">' . $this->adminLinks($table, $subrow) . '</td>
462 </tr>';
463 if ($table == 'pages' && $c < 100) {
464 $sub = $this->pageSubContent($subrow['uid'], $c + 1);
465 if ($sub) {
466 $content .= '
467 <tr>
468 <td></td>
469 <td></td>
470 <td></td>
471 <td width="98%">' . $sub . '</td>
472 </tr>';
473 }
474 }
475 }
476 $content .= '</table>';
477 }
478 $GLOBALS['TYPO3_DB']->sql_free_result($mres);
479 }
480 return $content;
481 }
482
483 /**
484 * Look for number of versions of a record
485 *
486 * @param string $table Table name
487 * @param int $uid Record uid
488 * @return int Number of versions for record, FALSE if none.
489 */
490 public function lookForOwnVersions($table, $uid) {
491 $versions = BackendUtility::selectVersionsOfRecord($table, $uid, 'uid');
492 if (is_array($versions)) {
493 return count($versions);
494 }
495 return FALSE;
496 }
497
498 /**
499 * Administrative links for a table / record
500 *
501 * @param string $table Table name
502 * @param array $row Record for which administrative links are generated.
503 * @return string HTML link tags.
504 */
505 public function adminLinks($table, $row) {
506 // Edit link:
507 $adminLink = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick('&edit[' . $table . '][' . $row['uid'] . ']=edit')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit', TRUE) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL) . '</a>';
508 // Delete link:
509 $adminLink .= '<a class="btn btn-default" href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete', TRUE) . '">' . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL) . '</a>';
510 if ($table === 'pages') {
511 // If another page module was specified, replace the default Page module with the new one
512 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
513 $pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
514 // Perform some access checks:
515 $a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list');
516 $a_wp = $GLOBALS['BE_USER']->check('modules', $pageModule);
517 $adminLink .= '<a class="btn btn-default" href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(\'' . $pageModule . '\'); return false;">'
518 . $this->iconFactory->getIcon('actions-page-open', Icon::SIZE_SMALL)
519 . '</a>';
520 $adminLink .= '<a class="btn btn-default" href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(\'web_list\'); return false;">' . $this->iconFactory->getIcon('actions-system-list-open', Icon::SIZE_SMALL) . '</a>';
521 // "View page" icon is added:
522 $adminLink .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['uid'], '', BackendUtility::BEgetRootLine($row['uid']))) . '">' . $this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL) . '</a>';
523 } else {
524 if ($row['pid'] == -1) {
525 $getVars = '&ADMCMD_vPrev[' . rawurlencode(($table . ':' . $row['t3ver_oid'])) . ']=' . $row['uid'];
526 // "View page" icon is added:
527 $adminLink .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['_REAL_PID'], '', BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . $this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL) . '</a>';
528 }
529 }
530 return '<div class="btn-group btn-group-sm" role="group">' . $adminLink . '</div>';
531 }
532
533
534 /**
535 * Injects the request object for the current request and gathers all data
536 *
537 * @param ServerRequestInterface $request
538 * @return \Psr\Http\Message\ResponseInterface $response
539 */
540 public function processRequest(ServerRequestInterface $request) {
541 $this->init();
542 $this->main();
543
544 /** @var Response $response */
545 $response = GeneralUtility::makeInstance(Response::class);
546 $response->getBody()->write($this->content);
547 return $response;
548 }
549 }