From 15743e5ab632b4ef3e3d100e83021b4e3092e881 Mon Sep 17 00:00:00 2001 From: Georg Ringer <georg.ringer@gmail.com> Date: Tue, 9 Sep 2014 09:17:43 +0200 Subject: [PATCH] [TASK] Merge extra_page_cm_options into backend Move the lines of the hook of extra_page_cm_options into EXT:backend to cleanup up the core. Resolves: #55136 Releases: 6.3 Change-Id: I318888775f4ec02caec6b0cb35f1e461f748224d Reviewed-on: http://review.typo3.org/32665 Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Markus Klein <klein.t3@reelworx.at> Tested-by: Markus Klein <klein.t3@reelworx.at> --- composer.json | 1 - .../backend/Classes/ClickMenu/ClickMenu.php | 93 ++++++++++++ .../Classes/ExtraPageContextMenuOptions.php | 136 ------------------ .../Migrations/Code/ClassAliasMap.php | 4 - .../extra_page_cm_options/composer.json | 22 --- .../extra_page_cm_options/ext_emconf.php | 22 --- .../sysext/extra_page_cm_options/ext_icon.gif | Bin 241 -> 0 bytes .../extra_page_cm_options/ext_tables.php | 8 -- .../extra_page_cm_options/locallang.xlf | 11 -- typo3/sysext/impexp/locallang_csh.xlf | 4 +- typo3/sysext/lang/locallang_core.xlf | 3 + 11 files changed, 98 insertions(+), 206 deletions(-) delete mode 100644 typo3/sysext/extra_page_cm_options/Classes/ExtraPageContextMenuOptions.php delete mode 100644 typo3/sysext/extra_page_cm_options/Migrations/Code/ClassAliasMap.php delete mode 100644 typo3/sysext/extra_page_cm_options/composer.json delete mode 100644 typo3/sysext/extra_page_cm_options/ext_emconf.php delete mode 100644 typo3/sysext/extra_page_cm_options/ext_icon.gif delete mode 100644 typo3/sysext/extra_page_cm_options/ext_tables.php delete mode 100644 typo3/sysext/extra_page_cm_options/locallang.xlf diff --git a/composer.json b/composer.json index 2586420084cc..f54c3a39a517 100644 --- a/composer.json +++ b/composer.json @@ -69,7 +69,6 @@ "typo3/cms-documentation": "self.version", "typo3/cms-extbase": "self.version", "typo3/cms-extensionmanager": "self.version", - "typo3/cms-extra-page-cm-options": "self.version", "typo3/cms-feedit": "self.version", "typo3/cms-felogin": "self.version", "typo3/cms-filelist": "self.version", diff --git a/typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php b/typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php index 6d5705a8156e..e663add872e6 100644 --- a/typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php +++ b/typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php @@ -275,6 +275,99 @@ class ClickMenu { $menuItems['pasteafter'] = $this->DB_paste($table, -$uid, 'after', $elInfo); } } + $subname = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('subname'); + $localItems = array(); + if (!$this->cmLevel && !in_array('moreoptions', $this->disabledItems, TRUE)) { + // Creating menu items here: + if ($this->editOK) { + $localItems[] = 'spacer'; + $localItems['moreoptions'] = $this->linkItem( + $this->label('more'), + $this->excludeIcon(''), + 'top.loadTopMenu(\'' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript() . '&cmLevel=1&subname=moreoptions\');return false;', + FALSE, + TRUE + ); + $menuItemHideUnhideAllowed = FALSE; + $hiddenField = ''; + // Check if column for disabled is defined + if (isset($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'])) { + $hiddenField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']; + if ( + $hiddenField !== '' && !empty($GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude'] + && $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $hiddenField)) + ) { + $menuItemHideUnhideAllowed = TRUE; + } + } + if ($menuItemHideUnhideAllowed && !in_array('hide', $this->disabledItems, TRUE)) { + $localItems['hide'] = $this->DB_hideUnhide($table, $this->rec, $hiddenField); + } + $anyEnableColumnsFieldAllowed = FALSE; + // Check if columns are defined + if (isset($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) { + $columnsToCheck = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']; + if ($table === 'pages' && !empty($columnsToCheck)) { + $columnsToCheck[] = 'extendToSubpages'; + } + foreach ($columnsToCheck as $currentColumn) { + if ( + !empty($GLOBALS['TCA'][$table]['columns'][$currentColumn]['exclude']) + && $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $currentColumn) + ) { + $anyEnableColumnsFieldAllowed = TRUE; + } + } + } + if ($anyEnableColumnsFieldAllowed && !in_array('edit_access', $this->disabledItems, TRUE)) { + $localItems['edit_access'] = $this->DB_editAccess($table, $uid); + } + if ($table === 'pages' && $this->editPageIconSet && !in_array('edit_pageproperties', $this->disabledItems, TRUE)) { + $localItems['edit_pageproperties'] = $this->DB_editPageProperties($uid); + } + } + // Find delete element among the input menu items and insert the local items just before that: + $c = 0; + $deleteFound = FALSE; + foreach ($menuItems as $key => $value) { + $c++; + if ($key === 'delete') { + $deleteFound = TRUE; + break; + } + } + if ($deleteFound) { + // .. subtract two... (delete item + its spacer element...) + $c -= 2; + // and insert the items just before the delete element. + array_splice($menuItems, $c, 0, $localItems); + } else { + $menuItems = array_merge($menuItems, $localItems); + } + } elseif ($subname === 'moreoptions') { + // If the page can be edited, then show this: + if ($this->editOK) { + if (($table === 'pages' || $table === 'tt_content') && !in_array('move_wizard', $this->disabledItems, TRUE)) { + $localItems['move_wizard'] = $this->DB_moveWizard($table, $uid, $this->rec); + } + if (($table === 'pages' || $table === 'tt_content') && !in_array('new_wizard', $this->disabledItems, TRUE)) { + $localItems['new_wizard'] = $this->DB_newWizard($table, $uid, $this->rec); + } + if ($table === 'pages' && !in_array('perms', $this->disabledItems, TRUE) && $GLOBALS['BE_USER']->check('modules', 'web_perm')) { + $localItems['perms'] = $this->DB_perms($table, $uid, $this->rec); + } + if (!in_array('db_list', $this->disabledItems, TRUE) && $GLOBALS['BE_USER']->check('modules', 'web_list')) { + $localItems['db_list'] = $this->DB_db_list($table, $uid, $this->rec); + } + } + // Temporary mount point item: + if ($table === 'pages') { + $localItems['temp_mount_point'] = $this->DB_tempMountPoint($uid); + } + // Merge the locally created items into the current menu items passed to this function. + $menuItems = array_merge($menuItems, $localItems); + } + // Delete: $elInfo = array(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $this->rec), $GLOBALS['BE_USER']->uc['titleLen'])); if (!in_array('delete', $this->disabledItems) && !$root && !$DBmount && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'delete')) { diff --git a/typo3/sysext/extra_page_cm_options/Classes/ExtraPageContextMenuOptions.php b/typo3/sysext/extra_page_cm_options/Classes/ExtraPageContextMenuOptions.php deleted file mode 100644 index f526992ed6fd..000000000000 --- a/typo3/sysext/extra_page_cm_options/Classes/ExtraPageContextMenuOptions.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php -namespace TYPO3\CMS\ExtraPageCmOptions; - -/** - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ - -/** - * Class to add extra context menu options - * - * @author Kasper Skårhøj <kasperYYYY@typo3.com> - */ -class ExtraPageContextMenuOptions { - - /** - * Adding various standard options to the context menu. - * This includes both first and second level. - * - * @param object $backRef The calling object. Value by reference. - * @param array $menuItems Array with the currently collected menu items to show. - * @param string $table Table name of clicked item. - * @param integer $uid UID of clicked item. - * @return array Modified $menuItems array - */ - public function main(&$backRef, $menuItems, $table, $uid) { - // Accumulation of local items. - $localItems = array(); - $subname = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('subname'); - // Detecting menu level - // LEVEL: Primary menu. - if (!in_array('moreoptions', $backRef->disabledItems) && !$backRef->cmLevel) { - // Creating menu items here: - if ($backRef->editOK) { - $localLanguage = $GLOBALS['LANG']->includeLLFile('EXT:extra_page_cm_options/locallang.xlf', FALSE); - $localItems[] = 'spacer'; - $localItems['moreoptions'] = $backRef->linkItem( - $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('label', $localLanguage)), - $backRef->excludeIcon(''), - 'top.loadTopMenu(\'' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript() . '&cmLevel=1&subname=moreoptions\');return false;', - 0, - 1 - ); - $menuItemHideUnhideAllowed = FALSE; - $hiddenField = ''; - // Check if column for disabled is defined - if (isset($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']) && isset($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'])) { - $hiddenField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']; - if ( - $hiddenField !== '' && !empty($GLOBALS['TCA'][$table]['columns'][$hiddenField]) - && (!empty($GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude']) - && $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $hiddenField)) - ) { - $menuItemHideUnhideAllowed = TRUE; - } - } - if ($menuItemHideUnhideAllowed && !in_array('hide', $backRef->disabledItems)) { - $localItems['hide'] = $backRef->DB_hideUnhide($table, $backRef->rec, $hiddenField); - } - $anyEnableColumnsFieldAllowed = FALSE; - // Check if columns are defined - if (isset($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) { - $columnsToCheck = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']; - if ($table === 'pages' && !empty($columnsToCheck)) { - $columnsToCheck[] = 'extendToSubpages'; - } - foreach ($columnsToCheck as $currentColumn) { - if ( - isset($GLOBALS['TCA'][$table]['columns'][$currentColumn]) - && (!empty($GLOBALS['TCA'][$table]['columns'][$currentColumn]['exclude']) - && $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $currentColumn)) - ) { - $anyEnableColumnsFieldAllowed = TRUE; - } - } - } - if ($anyEnableColumnsFieldAllowed && !in_array('edit_access', $backRef->disabledItems)) { - $localItems['edit_access'] = $backRef->DB_editAccess($table, $uid); - } - if ($table === 'pages' && $backRef->editPageIconSet && !in_array('edit_pageproperties', $backRef->disabledItems)) { - $localItems['edit_pageproperties'] = $backRef->DB_editPageProperties($uid); - } - } - // Find delete element among the input menu items and insert the local items just before that: - $c = 0; - $deleteFound = FALSE; - foreach ($menuItems as $key => $value) { - $c++; - if ($key === 'delete') { - $deleteFound = TRUE; - break; - } - } - if ($deleteFound) { - // .. subtract two... (delete item + its spacer element...) - $c -= 2; - // and insert the items just before the delete element. - array_splice($menuItems, $c, 0, $localItems); - } else { - $menuItems = array_merge($menuItems, $localItems); - } - } elseif ($subname === 'moreoptions') { - // If the page can be edited, then show this: - if ($backRef->editOK) { - if (($table === 'pages' || $table === 'tt_content') && !in_array('move_wizard', $backRef->disabledItems)) { - $localItems['move_wizard'] = $backRef->DB_moveWizard($table, $uid, $backRef->rec); - } - if (($table === 'pages' || $table === 'tt_content') && !in_array('new_wizard', $backRef->disabledItems)) { - $localItems['new_wizard'] = $backRef->DB_newWizard($table, $uid, $backRef->rec); - } - if ($table === 'pages' && !in_array('perms', $backRef->disabledItems) && $GLOBALS['BE_USER']->check('modules', 'web_perm')) { - $localItems['perms'] = $backRef->DB_perms($table, $uid, $backRef->rec); - } - if (!in_array('db_list', $backRef->disabledItems) && $GLOBALS['BE_USER']->check('modules', 'web_list')) { - $localItems['db_list'] = $backRef->DB_db_list($table, $uid, $backRef->rec); - } - } - // Temporary mount point item: - if ($table === 'pages') { - $localItems['temp_mount_point'] = $backRef->DB_tempMountPoint($uid); - } - // Merge the locally made items into the current menu items passed to this function. - $menuItems = array_merge($menuItems, $localItems); - } - return $menuItems; - } - -} diff --git a/typo3/sysext/extra_page_cm_options/Migrations/Code/ClassAliasMap.php b/typo3/sysext/extra_page_cm_options/Migrations/Code/ClassAliasMap.php deleted file mode 100644 index 41810fad227c..000000000000 --- a/typo3/sysext/extra_page_cm_options/Migrations/Code/ClassAliasMap.php +++ /dev/null @@ -1,4 +0,0 @@ -<?php -return array( - 'tx_extrapagecmoptions' => 'TYPO3\\CMS\\ExtraPageCmOptions\\ExtraPageContextMenuOptions', -); diff --git a/typo3/sysext/extra_page_cm_options/composer.json b/typo3/sysext/extra_page_cm_options/composer.json deleted file mode 100644 index 1518ed03eb10..000000000000 --- a/typo3/sysext/extra_page_cm_options/composer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "typo3/cms-extra-page-cm-options", - "type": "typo3-cms-framework", - "description": "TYPO3 Core", - "homepage": "http://typo3.org", - "license": ["GPL-2.0+"], - "version": "6.3.0", - - "require": { - "typo3/cms-core": "*" - }, - "replace": { - "extra_page_cm_options": "*" - }, - "extra": { - "typo3/cms": { - "Package": { - "partOfFactoryDefault": true - } - } - } -} diff --git a/typo3/sysext/extra_page_cm_options/ext_emconf.php b/typo3/sysext/extra_page_cm_options/ext_emconf.php deleted file mode 100644 index 4ed0dc86251c..000000000000 --- a/typo3/sysext/extra_page_cm_options/ext_emconf.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php -$EM_CONF[$_EXTKEY] = array( - 'title' => 'Extra Click Menu Options', - 'description' => 'Adds a submenu with extra options for page and tt_content click-menus.', - 'category' => 'be', - 'state' => 'stable', - 'uploadfolder' => 0, - 'createDirs' => '', - 'clearCacheOnLoad' => 0, - 'author' => 'Kasper Skaarhoj', - 'author_email' => 'kasperYYYY@typo3.com', - 'author_company' => 'Curby Soft Multimedia', - 'version' => '6.3.0', - '_md5_values_when_last_written' => '', - 'constraints' => array( - 'depends' => array( - 'typo3' => '6.3.0-6.3.99', - ), - 'conflicts' => array(), - 'suggests' => array(), - ), -); diff --git a/typo3/sysext/extra_page_cm_options/ext_icon.gif b/typo3/sysext/extra_page_cm_options/ext_icon.gif deleted file mode 100644 index 338c9f0f10eb0e0d3a6b9662ba2303b2ba71f51c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 241 zcmZ?wbhEHb6lD-%_#(kzY;3&z>YUO&$-ch6&ptmkH#e`Wto;4^cWrI$kt0WT?%bJ> zknr;5%jD$b?Ck6*Q>HjMIjvl|^2?Vmt*x!su3d9pqILH9vH$=7GvEM<KUr8A7$g{U zK=L3v9a!@e)cR5~lMXChl^L+NU;$rxEVJO!-~;cpIT$pz?h@$MYIDxW=9_r@^y(i8 zZoNlecA2wO>`z!$e1~`T-lf?g3K6PY%3oU(Htu=V(#_Im6tBamC)y~cC7@KK9VO1r Y8^+8gJc(h_)JfbKDYIrPDKc0C01D4rLjV8( diff --git a/typo3/sysext/extra_page_cm_options/ext_tables.php b/typo3/sysext/extra_page_cm_options/ext_tables.php deleted file mode 100644 index 46e4ca33717e..000000000000 --- a/typo3/sysext/extra_page_cm_options/ext_tables.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -defined('TYPO3_MODE') or die(); - -if (TYPO3_MODE === 'BE') { - $GLOBALS['TBE_MODULES_EXT']['xMOD_alt_clickmenu']['extendCMclasses'][] = array( - 'name' => 'TYPO3\\CMS\\ExtraPageCmOptions\\ExtraPageContextMenuOptions', - ); -} diff --git a/typo3/sysext/extra_page_cm_options/locallang.xlf b/typo3/sysext/extra_page_cm_options/locallang.xlf deleted file mode 100644 index 0e55fc6b3cd2..000000000000 --- a/typo3/sysext/extra_page_cm_options/locallang.xlf +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xliff version="1.0"> - <file source-language="en" datatype="plaintext" original="messages" date="2011-10-17T20:22:32Z" product-name="extra_page_cm_options"> - <header/> - <body> - <trans-unit id="label" xml:space="preserve"> - <source>More options...</source> - </trans-unit> - </body> - </file> -</xliff> \ No newline at end of file diff --git a/typo3/sysext/impexp/locallang_csh.xlf b/typo3/sysext/impexp/locallang_csh.xlf index ce75fdfa81bf..d9f3e67c60e0 100644 --- a/typo3/sysext/impexp/locallang_csh.xlf +++ b/typo3/sysext/impexp/locallang_csh.xlf @@ -20,7 +20,7 @@ <source>Exporting records from TYPO3</source> </trans-unit> <trans-unit id="export.description" xml:space="preserve"> - <source>To export TYPO3 T3D/XML files you click any record icon or page in the page tree (including the root page!), select "More options" (requires the extensions "extra_page_cm_options" to be installed) and then "Export to .t3d". This will bring up the export interface where you can configure options for your export session.</source> + <source>To export TYPO3 T3D/XML files you click any record icon or page in the page tree (including the root page!), select "More options" and then "Export to .t3d". This will bring up the export interface where you can configure options for your export session.</source> </trans-unit> <trans-unit id="export.details" xml:space="preserve"> <source>There are a number of methods by which you can export data from TYPO3: @@ -271,7 +271,7 @@ Entering a file name to save to makes it possible to write your export directly <source>Importing TYPO3 records</source> </trans-unit> <trans-unit id="import.description" xml:space="preserve"> - <source>To import TYPO3 T3D/XML files into the page tree you click any page in the page tree (including the root page!), select "More options" (requires the extensions "extra_page_cm_options" to be installed) and then "Import from .t3d". This will bring up the import interface where you can select a file to import or upload a new one.</source> + <source>To import TYPO3 T3D/XML files into the page tree you click any page in the page tree (including the root page!), select "More options" and then "Import from .t3d". This will bring up the import interface where you can select a file to import or upload a new one.</source> </trans-unit> <trans-unit id="import.details" xml:space="preserve"> <source><b>Tip: Import into a Sys Folder</b> diff --git a/typo3/sysext/lang/locallang_core.xlf b/typo3/sysext/lang/locallang_core.xlf index b82900818d44..ce1c03293e2b 100644 --- a/typo3/sysext/lang/locallang_core.xlf +++ b/typo3/sysext/lang/locallang_core.xlf @@ -877,6 +877,9 @@ Would you like to save now in order to refresh the display?</source> <trans-unit id="cm.expandBranch" xml:space="preserve"> <source>Expand Branch</source> </trans-unit> + <trans-unit id="cm.more" xml:space="preserve"> + <source>More options...</source> + </trans-unit> <trans-unit id="tree.defaultPageTitle" xml:space="preserve"> <source>[Default Title]</source> </trans-unit> -- GitLab