[BUGFIX] RTE: Image modify dialogue: keep the current image tab 39/36839/2
authorStanislas Rolland <typo3@sjbr.ca>
Wed, 11 Feb 2015 16:27:14 +0000 (11:27 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Wed, 11 Feb 2015 16:28:57 +0000 (17:28 +0100)
When there is a current image, it should be possible to come back
to the current image tab after visiting the other tabs.

Releases: master
Resolves: #65009
Change-Id: I6a2b362bbe136201c37718423fe2a8a183222871
Reviewed-on: http://review.typo3.org/36839
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
typo3/sysext/rtehtmlarea/Classes/SelectImage.php

index e7ea49c..6749664 100644 (file)
@@ -101,6 +101,7 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                if (!$this->act) {
                        $this->act = FALSE;
                }
+               $this->addModifyTab = GeneralUtility::_GP('addModifyTab');
                // Process bparams
                $pArr = explode('|', $this->bparams);
                $pRteArr = explode(':', $pArr[1]);
@@ -322,8 +323,9 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
 
                                var cur_width = selectedImageRef ? "&cWidth="+selectedImageRef.style.width : "";
                                var cur_height = selectedImageRef ? "&cHeight="+selectedImageRef.style.height : "";
+                               var addModifyTab = plugin.image ? "&addModifyTab=1" : "";
 
-                               var theLocation = URL+add_act+add_editorNo+add_sys_language_content+RTEtsConfigParams+cur_width+cur_height+(typeof(anchor)=="string"?anchor:"");
+                               var theLocation = URL+add_act+add_editorNo+add_sys_language_content+RTEtsConfigParams+addModifyTab+cur_width+cur_height+(typeof(anchor)=="string"?anchor:"");
                                window.location.href = theLocation;
                                return false;
                        }
@@ -788,7 +790,7 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
         */
        protected function buildMenuArray($wiz, $allowedItems) {
                $menuDef = array();
-               if (in_array('image', $this->allowedItems) && ($this->act === 'image' || GeneralUtility::_GP('cWidth'))) {
+               if (in_array('image', $this->allowedItems) && ($this->act === 'image' || $this->addModifyTab)) {
                        $menuDef['image']['isActive'] = FALSE;
                        $menuDef['image']['label'] = $GLOBALS['LANG']->getLL('currentImage', TRUE);
                        $menuDef['image']['url'] = '#';
@@ -875,10 +877,6 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                foreach ($this->hookObjects as $hookObject) {
                        $allowedItems = $hookObject->addAllowedItems($allowedItems);
                }
-               // Remove tab "image" if there is no current image
-               if ($this->act !== 'image') {
-                       $allowedItems = array_diff($allowedItems, array('image'));
-               }
                // Remove options according to RTE configuration
                if (is_array($this->buttonConfig['options.']) && $this->buttonConfig['options.']['removeItems']) {
                        $allowedItems = array_diff($allowedItems, GeneralUtility::trimExplode(',', $this->buttonConfig['options.']['removeItems'], TRUE));