Bug #81190

rtehtmlarea: TSconfig with page based condition is ignored in BrowseLinks and SelectImage windows

Added by Marc Bastian Heinrichs over 1 year ago. Updated about 2 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2017-05-11
Due date:
% Done:

100%

TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Scenario:
  • You have a multi tree instance with different RTE TSconfigs per tree.
  • You want to avoid references to the TSconfig files in page records.
  • So you use conditions with including the tsconfig in ext_localconf like this:
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
        '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:foo/Configuration/TsConfig/Page/page_base.ts" condition="[PIDinRootline = 1234]">'
    );
    

Problem:
The TSconfig is totally ignored in the BrowseLinks and SelectImage windows loaded in an iframe.

Reason:
The ConditionMatcher instantiated by the TypoScriptParser tries to determine the page using GetVars 'id', 'edit' or 'cmd'. Those vars are not used loading the iframes, but a special string called 'RTEtsConfigParams'. So no page id, so no rootline to be evaluated for the condition.

Fix:
Include GetVar 'id' with the page uid into the iframe url.

I did not checked (yet) if v8 has a similar bug with ckeditor.


Related issues

Related to TYPO3 Core - Bug #81853: TSconfig with page based condition is ignored using page tree commands and clipboard New 2017-07-13

Associated revisions

Revision 59fb2adf (diff)
Added by Marc Bastian Heinrichs about 1 year ago

[BUGFIX] Add page uid to rte module urls for correct TSconfig loading

Because of a missing page uid in rte module window iframe urls, like for
the BrowseLinks popup, the ConditionMatcher could not evaluate
conditions in INCLUDE_TYPOSCRIPT that rely on the page uid, like
PIDinRootline.

Resolves: #81190
Releases: 7.6
Change-Id: I7952b910d9caa50ce5ca1abd6bf7309ad80c60b1
Reviewed-on: https://review.typo3.org/52756
Reviewed-by: Wouter Wolters <>
Tested-by: TYPO3com <>
Reviewed-by: Jan Helke <>
Tested-by: Riccardo De Contardi <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

History

#1 Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52756

#2 Updated by Riccardo De Contardi over 1 year ago

I have performed the following test with TYPO3 7.6.18:

1) use the standard RTEHtmlarea config

2) load a TSConfig file only for a specific pagetree:

ext_localconf of my extension:

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
    '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:bhsiteconf/Configuration/TypoScript/TSconfig/Test/test.ts" condition="[PIDinRootline = 44]">'
);

2) file test.ts:

RTE.default{
    showButtons = *
}

RTE.classesAnchor {
   externalLink {
      class = external-link
      type = url
      altText = TESTE
      titleText = TESTE
   }
   externalLinkInNewWindow {
      class = external-link-new-window
      type = url
      altText = TESTENW
      titleText = TESTENW
   }
   internalLink {
      class = internal-link
      type = page
      altText = TESTI
      titleText = TESTI
   }
   internalLinkInNewWindow {
      class = internal-link-new-window
      type = page
      altText = TESTINW
      titleText = TESTINW
   }
   download {
      class = download
      type = file
      altText = TESTD
      titleText = TESTD
   }
   mail {
      class = mail
      type = mail
      altText = TESTM
      titleText = TESTM
   }
}

Results:

The "new" name for the link classes are loaded for the subpages of page 44

Is this test sufficient or a more complete test should be performed?

#3 Updated by Marc Bastian Heinrichs over 1 year ago

Hey Riccardo, thx for testing. I can not confirm your test. Still buggy for me in 7.6.18.

The problematic code starts here
https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_7-6/typo3/sysext/backend/Classes/Utility/BackendUtility.php#L1333
The TypoScriptParser has no idea about the page id, so the BackendConditionMatcher created here
https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_7-6/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php#L855
could not be feed with the page id, like here
https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_7-6/typo3/sysext/backend/Classes/Configuration/TsConfigParser.php#L108

So the BackendConditionMatcher uses its function determinePageId to get the page id.

#4 Updated by Marc Bastian Heinrichs over 1 year ago

  • Related to Bug #81853: TSconfig with page based condition is ignored using page tree commands and clipboard added

#5 Updated by Marc Bastian Heinrichs about 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#6 Updated by Benni Mack about 2 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF