[FEATURE] Hide "save and view" button where not useful 45/22245/17
authorFrederic Gaus <frederic.gaus@flagbit.de>
Fri, 12 Jul 2013 11:07:16 +0000 (13:07 +0200)
committerAndreas Wolf <andreas.wolf@typo3.org>
Sun, 19 Jul 2015 08:51:30 +0000 (10:51 +0200)
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 <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Andreas Wolf <andreas.wolf@typo3.org>
Tested-by: Andreas Wolf <andreas.wolf@typo3.org>
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Controller/NewRecordController.php
typo3/sysext/core/Documentation/Changelog/master/Feature-20194-ConfigurationForDisplayingTheSaveViewButton.rst [new file with mode: 0644]

index 7d1d1da..28b17a8 100644 (file)
@@ -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;
        }
 
index bc6dc72..991998d 100644 (file)
@@ -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;
        }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-20194-ConfigurationForDisplayingTheSaveViewButton.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-20194-ConfigurationForDisplayingTheSaveViewButton.rst
new file mode 100644 (file)
index 0000000..32c5e17
--- /dev/null
@@ -0,0 +1,14 @@
+=======================================================================
+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.