2 namespace TYPO3\CMS\Version\Controller;
130 $GLOBALS[
'LANG']->includeLLFile(
'EXT:version/Resources/Private/Language/locallang.xlf');
164 $this->doc->setModuleTemplate(
'EXT:version/Resources/Private/Templates/version.html');
167 $this->doc->getContextMenuCode();
181 $this->MOD_SETTINGS[
'expandSubElements'] =
true;
182 $this->MOD_SETTINGS[
'diff'] = $this->details || $this->MOD_SETTINGS[
'diff'] ? 1 : 0;
185 if ($record[
'pid'] == -1) {
188 $this->recordFound = is_array($record);
189 $pidValue = $this->table ===
'pages' ? $this->uid : $record[
'pid'];
191 if ($this->recordFound &&
$GLOBALS[
'TCA'][$this->table][
'ctrl'][
'versioningWS'] && !$this->
id) {
192 $this->uid = $record[
'uid'];
197 $access = is_array($this->pageinfo) ? 1 : 0;
198 if ($pidValue && $access ||
$GLOBALS[
'BE_USER']->user[
'admin'] && !$pidValue) {
200 $newPageModule = trim(
$GLOBALS[
'BE_USER']->getTSConfigVal(
'options.overridePageModule'));
203 $this->publishAccess =
$GLOBALS[
'BE_USER']->workspacePublishAccess(
$GLOBALS[
'BE_USER']->workspace);
208 $markers[
'CSH'] = $docHeaderButtons[
'csh'];
209 $markers[
'FUNC_MENU'] =
BackendUtility::getFuncMenu($this->
id,
'SET[function]', $this->MOD_SETTINGS[
'function'], $this->MOD_MENU[
'function']);
213 $this->content =
'<h2>' .
$GLOBALS[
'LANG']->getLL(
'clickAPage_header',
true) .
'</h2><div>' .
$GLOBALS[
'LANG']->getLL(
'clickAPage_content') .
'</div>';
219 $this->content = $this->doc->startPage(
$GLOBALS[
'LANG']->getLL(
'title'));
220 $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
221 $this->content .= $this->doc->endPage();
222 $this->content = $this->doc->insertStylesAndJS($this->content);
251 if ($this->recordFound &&
$GLOBALS[
'TCA'][$this->table][
'ctrl'][
'versioningWS']) {
255 ' . $this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-view',
Icon::SIZE_SMALL)->render() .
'
258 if (
$GLOBALS[
'BE_USER']->mayMakeShortcut()) {
259 $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);
262 $buttons[
'record_list'] = BackendUtility::getListViewLink(array(
263 'id' => $this->pageinfo[
'uid'],
265 ),
'',
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.showList'));
287 $content .=
'<div class="panel panel-space panel-default">';
288 $content .=
'<div class="panel-heading">' .
$GLOBALS[
'LANG']->getLL(
'diffing') .
'</div>';
289 if ($diff_1 && $diff_2) {
292 if (is_array($diff_1_record) && is_array($diff_2_record)) {
297 <th>' .
$GLOBALS[
'LANG']->getLL(
'fieldname') .
'</th>
298 <th width="98%">' .
$GLOBALS[
'LANG']->getLL(
'coloredDiffView') .
':</th>
301 foreach ($diff_1_record as $fN => $fV) {
303 if ((
string)$diff_1_record[$fN] !== (
string)$diff_2_record[$fN]) {
304 $diffres = $diffUtility->makeDiffDisplay(
305 BackendUtility::getProcessedValue($this->table, $fN, $diff_2_record[$fN], 0, 1),
306 BackendUtility::getProcessedValue($this->table, $fN, $diff_1_record[$fN], 0, 1)
311 <td width="98%">' . $diffres .
'</td>
317 if (count($rows) > 1) {
318 $content .=
'<div class="table-fit"><table class="table">' . implode(
'', $rows) .
'</table></div>';
320 $content .=
'<div class="panel-body">' .
$GLOBALS[
'LANG']->getLL(
'recordsMatchesCompletely') .
'</div>';
323 $content .=
'<div class="panel-body">' .
$GLOBALS[
'LANG']->getLL(
'errorRecordsNotFound') .
'</div>';
326 $content .=
'<div class="panel-body">' .
$GLOBALS[
'LANG']->getLL(
'errorDiffSources') .
'</div>';
335 <form name="theform" action="' . str_replace(
'&sendToReview=1',
'', $this->REQUEST_URI) .
'" method="post">
336 <div class="panel panel-space panel-default">
337 <div class="panel-heading">' . $recTitle .
'</div>
338 <div class="table-fit">
339 <table class="table">
342 <th colspan="2" class="col-icon"></th>
343 <th title="' .
$GLOBALS[
'LANG']->getLL(
'tblHeaderDesc_title') .
'">' .
$GLOBALS[
'LANG']->getLL(
'tblHeader_title') .
'</th>
344 <th title="' .
$GLOBALS[
'LANG']->getLL(
'tblHeaderDesc_uid') .
'"><i>' .
$GLOBALS[
'LANG']->getLL(
'tblHeader_uid') .
'</i></th>
345 <th title="' .
$GLOBALS[
'LANG']->getLL(
'tblHeaderDesc_t3ver_oid') .
'"><i>' .
$GLOBALS[
'LANG']->getLL(
'tblHeader_t3ver_oid') .
'</i></th>
346 <th title="' .
$GLOBALS[
'LANG']->getLL(
'tblHeaderDesc_t3ver_id') .
'"><i>' .
$GLOBALS[
'LANG']->getLL(
'tblHeader_t3ver_id') .
'</i></th>
347 <th title="' .
$GLOBALS[
'LANG']->getLL(
'tblHeaderDesc_t3ver_wsid') .
'"><i>' .
$GLOBALS[
'LANG']->getLL(
'tblHeader_t3ver_wsid') .
'</i></th>
348 <th title="' .
$GLOBALS[
'LANG']->getLL(
'tblHeaderDesc_t3ver_state',
true) .
'"><i>' .
$GLOBALS[
'LANG']->getLL(
'tblHeader_t3ver_state') .
'</i></th>
349 <th title="' .
$GLOBALS[
'LANG']->getLL(
'tblHeaderDesc_t3ver_stage') .
'"><i>' .
$GLOBALS[
'LANG']->getLL(
'tblHeader_t3ver_stage') .
'</i></th>
350 <th title="' .
$GLOBALS[
'LANG']->getLL(
'tblHeaderDesc_t3ver_count') .
'"><i>' .
$GLOBALS[
'LANG']->getLL(
'tblHeader_t3ver_count') .
'</i></th>
351 <th title="' .
$GLOBALS[
'LANG']->getLL(
'tblHeaderDesc_pid') .
'"><i>' .
$GLOBALS[
'LANG']->getLL(
'tblHeader_pid') .
'</i></th>
352 <th title="' .
$GLOBALS[
'LANG']->getLL(
'tblHeaderDesc_t3ver_label') .
'"><i>' .
$GLOBALS[
'LANG']->getLL(
'tblHeader_t3ver_label') .
'</i></th>
355 <button class="btn btn-default btn-sm" type="submit" name="do_diff" value="true">
356 ' .
$GLOBALS[
'LANG']->getLL(
'diff') .
'
364 foreach ($versions as $row) {
365 $adminLinks = $this->
adminLinks($this->table, $row);
367 $editUrl = BackendUtility::getModuleUrl(
'record_edit', [
370 $row[
'uid'] =>
'edit'
373 'columnsOnly' =>
't3ver_label',
377 <tr' . ($row[
'uid'] != $this->uid ?
'' :
' class="active"') .
'>
378 <td class="col-icon">' .
379 ($row[
'uid'] != $this->uid ?
380 '<a href="' .
BackendUtility::getLinkToDataHandlerAction(
'&cmd[' . $this->table .
'][' . $this->uid .
'][version][swapWith]=' . $row[
'uid'] .
'&cmd[' . $this->table .
'][' . $this->uid .
'][version][action]=swap') .
'" title="' .
$GLOBALS[
'LANG']->getLL(
'swapWithCurrent',
true) .
'">' . $this->moduleTemplate->getIconFactory()->getIcon(
'actions-version-swap-version',
Icon::SIZE_SMALL)->render() .
'</a>' :
381 '<span title="' .
$GLOBALS[
'LANG']->getLL(
'currentOnlineVersion',
true) .
'">' . $this->moduleTemplate->getIconFactory()->getIcon(
'status-status-current',
Icon::SIZE_SMALL)->render() .
'</span>'
384 <td class="col-icon">' . $this->moduleTemplate->getIconFactory()->getIconForRecord($this->table, $row,
Icon::SIZE_SMALL)->render() .
'</td>
386 <td>' . $row[
'uid'] .
'</td>
387 <td>' . $row[
't3ver_oid'] .
'</td>
388 <td>' . $row[
't3ver_id'] .
'</td>
389 <td>' . $row[
't3ver_wsid'] .
'</td>
390 <td>' . $row[
't3ver_state'] .
'</td>
391 <td>' . $row[
't3ver_stage'] .
'</td>
392 <td>' . $row[
't3ver_count'] .
'</td>
393 <td>' . $row[
'pid'] .
'</td>
395 <a href="' . htmlspecialchars($editUrl) .
'" title="' .
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:cm.edit',
true) .
'">
396 ' . $this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-open',
Icon::SIZE_SMALL)->render() .
'
397 </a>' . htmlspecialchars($row[
't3ver_label']) .
'
399 <td class="col-control">' . $adminLinks .
'</td>
400 <td class="text-center success"><input type="radio" name="diff_1" value="' . $row[
'uid'] .
'"' . ($diff_1 == $row[
'uid'] ?
' checked="checked"' :
'') .
'/></td>
401 <td class="text-center danger"><input type="radio" name="diff_2" value="' . $row[
'uid'] .
'"' . ($diff_2 == $row[
'uid'] ?
' checked="checked"' :
'') .
'/></td>
404 if ($this->table ===
'pages' && $row[
'uid'] != $this->uid) {
409 <td colspan="2"></td>
410 <td colspan="11">' . $sub .
'</td>
411 <td class="success"></td>
412 <td class="danger"></td>
423 $this->content .=
'<h2>' .
$GLOBALS[
'LANG']->getLL(
'title',
true) .
'</h2><div>' .
$content .
'</div>';
426 <form action="' . htmlspecialchars(BackendUtility::getModuleUrl(
'tce_db')) .
'" method="post">
428 <div class="col-sm-6 col-md-4 col-lg-3">
429 <div class="form-group">
430 <label for="typo3-new-version-label">' .
$GLOBALS[
'LANG']->getLL(
'tblHeader_t3ver_label') .
'</label>
431 <input id="typo3-new-version-label" class="form-control" type="text" name="cmd[' . $this->table .
'][' . $this->uid .
'][version][label]" />
433 <div class="form-group">
434 <input type="hidden" name="cmd[' . $this->table .
'][' . $this->uid .
'][version][action]" value="new" />
435 <input type="hidden" name="prErr" value="1" />
436 <input type="hidden" name="redirect" value="' . htmlspecialchars($this->REQUEST_URI) .
'" />
437 <input class="btn btn-default" type="submit" name="_" value="' .
$GLOBALS[
'LANG']->getLL(
'createNewVersion') .
'" />
444 $this->content .=
'<h2>' .
$GLOBALS[
'LANG']->getLL(
'createNewVersion',
true) .
'</h2><div>' .
$content .
'</div>';
457 $tableNames[] =
'pages';
459 foreach ($tableNames as $table) {
462 if (
$GLOBALS[
'TYPO3_DB']->sql_num_rows($mres)) {
464 <table class="table">
466 <th class="col-icon">' . $this->moduleTemplate->getIconFactory()->getIconForRecord($table, array(),
Icon::SIZE_SMALL)->render() .
'</th>
467 <th class="col-title">' .
$GLOBALS[
'LANG']->sL(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'title'],
true) .
'</th>
471 while ($subrow =
$GLOBALS[
'TYPO3_DB']->sql_fetch_assoc($mres)) {
475 <td class="col-icon">' . $this->moduleTemplate->getIconFactory()->getIconForRecord($table, $subrow,
Icon::SIZE_SMALL)->render() .
'</td>
477 <td>' . ($ownVer > 1 ?
'<a href="' . htmlspecialchars(BackendUtility::getModuleUrl(
'web_txversionM1', array(
'table' => $table,
'uid' => $subrow[
'uid']))) .
'">' . ($ownVer - 1) .
'</a>' :
'') .
'</td>
478 <td class="col-control">' . $this->
adminLinks($table, $subrow) .
'</td>
480 if ($table ==
'pages' && $c < 100) {
488 <td width="98%">' . $sub .
'</td>
495 $GLOBALS[
'TYPO3_DB']->sql_free_result($mres);
510 if (is_array($versions)) {
511 return count($versions);
526 $editUrl = BackendUtility::getModuleUrl(
'record_edit', [
529 $row[
'uid'] =>
'edit'
534 $adminLink =
'<a class="btn btn-default" href="' . htmlspecialchars($editUrl) .
'" title="' .
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:cm.edit',
true) .
'">' . $this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-open',
Icon::SIZE_SMALL)->render() .
'</a>';
536 $adminLink .=
'<a class="btn btn-default" href="' . htmlspecialchars(
BackendUtility::getLinkToDataHandlerAction(
'&cmd[' . $table .
'][' . $row[
'uid'] .
'][delete]=1')) .
'" title="' .
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:cm.delete',
true) .
'">' . $this->moduleTemplate->getIconFactory()->getIcon(
'actions-edit-delete',
Icon::SIZE_SMALL)->render() .
'</a>';
537 if ($table ===
'pages') {
539 $newPageModule = trim(
$GLOBALS[
'BE_USER']->getTSConfigVal(
'options.overridePageModule'));
542 $a_wl =
$GLOBALS[
'BE_USER']->check(
'modules',
'web_list');
544 $adminLink .=
'<a class="btn btn-default" href="#" onclick="top.loadEditId(' . $row[
'uid'] .
');top.goToModule(\'' .
$pageModule .
'\');
return false;
">'
545 . $this->moduleTemplate->getIconFactory()->getIcon('actions-page-open', Icon::SIZE_SMALL)->render()
547 $adminLink .= '<a class="btn btn-
default" href="#
" onclick="top.loadEditId(
' . $row['uid
'] . ');top.goToModule(\
'web_list\'); return false;">' . $this->moduleTemplate->getIconFactory()->getIcon(
'actions-system-list-open',
Icon::SIZE_SMALL)->render() .
'</a>';
551 if ($row[
'pid'] == -1) {
552 $getVars =
'&ADMCMD_vPrev[' . rawurlencode(($table .
':' . $row[
't3ver_oid'])) .
']=' . $row[
'uid'];
557 return '<div class="btn-group btn-group-sm" role="group">' . $adminLink .
'</div>';
573 $response->
getBody()->write($this->content);