Commit f6ad976a authored by Frederic Gaus's avatar Frederic Gaus Committed by Andreas Wolf
Browse files

[FEATURE] Hide "save and view" button where not useful

Per default the save&view button is not rendered anymore for the doktypes
254, 255 and 199. This behaviour can be changed by TSConfig.

Resolves: #49972
Resolves: #20194
Releases: master
Change-Id: I0eba112827521af0efb3c8049898e3e72d0d0838
Reviewed-on: http://review.typo3.org/22245


Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Andreas Wolf's avatarAndreas Wolf <andreas.wolf@typo3.org>
Tested-by: Andreas Wolf's avatarAndreas Wolf <andreas.wolf@typo3.org>
parent f4dc2c66
......@@ -676,6 +676,7 @@ class EditDocumentController {
$this->R_URI = $this->R_URL_parts['path'] . '?' . ltrim(GeneralUtility::implodeArrayForUrl('', $this->R_URL_getvars), '&');
// Setting virtual document name
$this->MCONF['name'] = 'xMOD_alt_doc.php';
// Create an instance of the document template object
$this->doc = $GLOBALS['TBE_TEMPLATE'];
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
......@@ -1119,7 +1120,16 @@ class EditDocumentController {
$buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" name="_savedok" class="c-inputButton" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" />'));
// SAVE / VIEW button:
if ($this->viewId && !$this->noView && $this->getNewIconMode($this->firstEl['table'], 'saveDocView')) {
$buttons['save_view'] = IconUtility::getSpriteIcon('actions-document-save-view', array('html' => '<input onclick="window.open(\'\', \'newTYPO3frontendWindow\');" type="image" class="c-inputButton" name="_savedokview" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', TRUE) . '" />'));
$pagesTSconfig = BackendUtility::getPagesTSconfig($this->pageinfo['uid']);
if (isset($pagesTSconfig['TCEMAIN.']['preview.']['disableButtonForDokType'])) {
$excludeDokTypes = GeneralUtility::intExplode(',', $pagesTSconfig['TCEMAIN.']['preview.']['disableButtonForDokType'], TRUE);
} else {
// exclude sysfolders and recycler by default
$excludeDokTypes = array(PageRepository::DOKTYPE_RECYCLER, PageRepository::DOKTYPE_SYSFOLDER, PageRepository::DOKTYPE_SPACER);
}
if (!in_array((int)$this->pageinfo['doktype'], $excludeDokTypes, TRUE) || isset($pagesTSconfig['TCEMAIN.']['preview.'][$this->firstEl['table'].'.']['previewPageId'])) {
$buttons['save_view'] = IconUtility::getSpriteIcon('actions-document-save-view', array('html' => '<input onclick="window.open(\'\', \'newTYPO3frontendWindow\');" type="image" class="c-inputButton" name="_savedokview" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', TRUE) . '" />'));
}
}
// SAVE / NEW button:
if (count($this->elementsData) === 1 && $this->getNewIconMode($this->firstEl['table'])) {
......@@ -1182,6 +1192,7 @@ class EditDocumentController {
$buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'TCEforms');
$buttons['shortcut'] = $this->shortCutLink();
$buttons['open_in_new_window'] = $this->openInNewWindowLink();
return $buttons;
}
......
......@@ -23,6 +23,8 @@ use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Tree\View\PagePositionMap;
use TYPO3\CMS\Backend\Tree\View\NewRecordPageTreeView;
use TYPO3\CMS\Core\Utility\HttpUtility;
use TYPO3\CMS\Frontend\Page\PageRepository;
/**
* Script class for 'db_new'
......@@ -305,7 +307,16 @@ class NewRecordController {
}
if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
// View
$buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $this->doc->backPath, BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
$pagesTSconfig = BackendUtility::getPagesTSconfig($this->pageinfo['uid']);
if (isset($pagesTSconfig['TCEMAIN.']['preview.']['disableButtonForDokType'])) {
$excludeDokTypes = GeneralUtility::intExplode(',', $pagesTSconfig['TCEMAIN.']['preview.']['disableButtonForDokType'], TRUE);
} else {
// exclude sysfolders and recycler by default
$excludeDokTypes = array(PageRepository::DOKTYPE_RECYCLER, PageRepository::DOKTYPE_SYSFOLDER, PageRepository::DOKTYPE_SPACER);
}
if (!in_array((int)$this->pageinfo['doktype'], $excludeDokTypes, TRUE)) {
$buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $this->doc->backPath, BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
}
}
return $buttons;
}
......
=======================================================================
Feature: #20194 - Configuration for displaying the "save & view" button
=======================================================================
Description
===========
The "save & view" button is configurable by TSConfig "TCEMAIN.preview.disableButtonForDokType" (CSV of "doktype" IDs) to disable the button for custom page "doktype"s. The default value is set in the PHP implementation: "254, 255, 199" (Storage Folder, Recycler and Menu Seperator)
Impact
======
The "save & view" button is not displayed in folders and recycler pages anymore.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment