How to disable HTML transformation in TYPO3 8 LTS completely - typo3

In TYPO3 8.7.8 LTS and a clean installation with the setting to create one blank basis page during install and the CKEditor extension disabled when you write something in a text element (I think it is the tt_content.bodytext field) it gets transformed (<p> tags added, line breaks removed etc...) even so there is no WYSIWYG-Editor enabled. So this transformation has to happen in the TYPO3 backend.
I'm trying to disable this now for a while but I failed so far. I tried the approaches from https://docs.typo3.org/typo3cms/CoreApiReference/Rte/Transformations/Tsconfig/Index.html
And here mainly
This configuration in "Page TSconfig" will disable the RTE altogether:
RTE.default.disabled = 1
To be precise my Page TSConfig looks like this and the transformation still happens:
RTE.default.proc.dontRemoveUnknownTags_db = 1
RTE.default.proc.entryHTMLparser_db = 0
RTE.default.proc.exitHTMLparser_db = 0
RTE.default.disabled = 1
RTE.config.tt_content.bodytext.proc.dontRemoveUnknownTags_db = 1
RTE.config.tt_content.bodytext.proc.entryHTMLparser_db = 0
RTE.config.tt_content.bodytext.proc.exitHTMLparser_db = 0
RTE.config.tt_content.bodytext.disabled = 1
So the question is, how can I disable the HTML transformations completely? Do I need to add something in the TypoScript Setup (I tried a bit but no luck) or do I have to do something completely different/in a different stop than the Page TSConfig?

Looking at (and debugging) \TYPO3\CMS\Core\Html\RteHtmlParser and here RTE_transform($value, $specConf = [], $direction = 'rte', $thisConfig = []) which seems to be the responsible function for the transformation of this field, I know that the transformations for my case happen in the mode foreach.
I also know that my RTE.default.disabled = 1 wasn't in the wrong place. It was part of the loaded config, however at least at this point it has no effect at all.
What has an effect is setting RTE.default.proc.overruleMode = none or RTE.default.proc.mode = none. One would do it and any string which is not a registered mode works to disable any transformation.
IMHO: The TYPO3 documentation seems as messy as its code base, maybe RTE.default.disabled = 1 has a use case somewhere and maybe you would find it if you would digg further into the documentation but I fear it may also just be an artefact from some old version which most of this pre- and postprocessing logic seems to be (and from what I've seen here in the last two hours I'm not confident other parts of this framework are 'modern', the mere amount of db queries for simplest backend tasks indicates I could be right). Anyways, my problem is solved and good luck to anyone who also needs to work with this reptile from the past for some reason.
tl;dr: set RTE.default.proc.overruleMode = none in your Page TSConfig

Related

TYPO3 WEC_Map Extension <script> Tag not inserted in HTML

I’m using Typo3 (Version 6.2.14) and upgraded WEC_Map to version 3.1.3 because I saw a warning on my map which says that I need to use an API key for Google Maps.
So I’ve generated an API key for "Maps Static API" and inserted it in WEC Map Admin. (I’ve used the same key for Browser API Key and Server API Key. Only difference is that I’ve added the secret for the Browser API Key separated by a comma.)
If I’ve visit my FE User Map in the backend the map is showing.
In the frontend instead I get the following error: "
There doesn't seem to be anything to display. Make sure the map is configured correctly and there are users or markers set".
Inspecting the source code I saw that the script tag to maps.googleapis.com is not generated. It looks like this is causing the issue, but I don't know why it is happening.
I hope that someone using a similar setup can point me into the right direction.
Thank you guys. (It would be nice if someone could add the Tag for WEC_Map)
Ok I resolved this. The problem was that I was using the userGroups setting to filter the map markers by multiple user groups.
plugin.tx_wecmap_pi2 {
height = 500
width = 500
showDirections = 1
prefillAddress = 0
initialMapType = G_HYBRID_MAP
controls.mapControlSize = large
controls.showOverviewMap = 1
controls.showMapType = 1
controls.showScale = 1
userGroups = 2,3,5
pid = 2,3,5 # <-- This uses a AND condition
}
Since this setting is using an AND condition under the hood I received the error "There doesn't seem to be anything to display. Make sure the map is configured correctly and there are users or markers set"
In fact I opened a feature request for this 3 years ago. Unfortunately the feature request never made it into the plugin. But Jan Bartels posted a workaround as reply to the feature request. This workaround got lost while updating the extension.
Also recomment to the extension authors to make it more clear in their documentation that the property userGroups uses a AND condition.

How to trigger a tx_news search using typolink

We recently switched from tt_news to Georg Ringers News extension and I - as a novice typo3 coder - need help fixing some typoscript code that was used to trigger context specific searches using typolink.
The old snippet was
typolink.parameter = 649
typolink.useCacheHash = 1
typolink.additionalParams.current = 1
typolink.additionalParams.wrap = &tx_ttnews[swords]=|
The new parameter needs to be &tx_news_pi1 but swords does not work. I can't find documentation or examples how the search value can be set. I searched the code itself and dumb tried my luck with &tx_news_pi1[search]=| but that just shows the default numerical typo3 error "Oops, an error occurred! Code: 2018020814150924e87636" if something cannot be rendered. BTW: The referenced search result page works fine if called using the search form.
After grabbing through the code try &tx_news_pi1[overwriteDemand][search][subject]=|.
On the target list you need to allow overwriting of the demand in the plugin flexform!
The solution of Thomas works for me even without the [overwriteDemand] using the search result page as target. Thx.
typolink.parameter = 649
typolink.useCacheHash = 1
typolink.additionalParams.current = 1
typolink.additionalParams.wrap = &tx_news_pi1[search][subject]=|
I really would like to know how this could be grabbed from the code. :-) It seems that I have to learn more about php and the underlying data structure - [search][subject] looks like a kind of array which I didn't expect for that type of parameter.

Display an older version of a CQ page

For audit purposes I got the requirment to create a tool where the authors can look at older versions of a CQ page. I managed to get the available versions with the JCR VersionManager using the following code (used in a SlingServlet with cq:Page as the resourceType):
Session session = request.getResourceResolver().adaptTo(Session.class);
VersionManager vm = session.getWorkspace().getVersionManager();
VersionHistory versionHistory = vm.getVersionHistory(request.getResource().getPath());
VersionIterator vIt = versionHistory.getAllVersions();
while (vIt.hasNext()) {
Version version = vIt.nextVersion();
String no = version.getName();
Calendar createdDate = version.getCreated();
// do something with it
}
The path of the version points to e.g. /jcr:system/jcr:versionStorage/d6/23/4f/d6234f36-3360-4024-bee2-411020ac63ae/1.0 where I can see a child node called jcr:frozenNode which seems to represent the jcr:content node of this specific version.
How can I tell CQ to render the page in this version? I would expect an url with some parameter or selector, but I didn't find any documentation. I tried to reverse engineer it with the Timewarp, but there the URL seems to be still the original and the magic is hidden somewhere.
I was also in contact with adobe support regarding this, and beside the timewarp there seems to be no built in feature to achieve this. Nevertheless I did some experimenting and found a feasible workaround. Though it might not be easy for a complex layout with many fixed components in the template, luckily on our case we mainly have a parsys.
So my solution is the following: I load the older version through two selectors in the url:
I called it "versionhistory" which is used to take another rendering script called versionhistory.jsp on the page component.
contains the actual version/node name (replacing "." with "_" to not add more selectors
In my versionhistory.jsp I just add the correct path for the parsys component (taking the example path from the question), and include the same layout elements as in the default script e.g. page.jsp:
<cq:include path="/jcr:system/jcr:versionStorage/d6/23/4f/d6234f36-3360-4024-bee2-411020ac63ae/1.0/jcr:frozenNode/par" resourceType="foundation/components/parsys" />

Is it possible to use a control without putting it on a form in VB6?

I'm pretty sure about the answer to this, but I'm trying a variety of things to get a very stubborn project to work. One idea was to try to run code through a control without defining it on a form.
So, for example, my original code looked like this:
frmProcess.MyViewer.MaxPageSize = 100
frmProcess.MyViewer.ResetPages
frmProcess.MyViewer.AddPageToView "C:\TestPage1.txt"
I've changed it to:
Dim objViewer As MyViewer
objViewer.MaxPageSize = 100
objViewer.ResetPages
objViewer.AddPageToView "C:\TestPage1.txt"
I get an error window with "Run-time error '91': Object variable or With block variable not set".
But there doesn't seem to be a way to 'set' this control. Is this just impossible, or is there another way to do it that doesn't require a form?
EDIT: I ended up abandoning this entire path of activity, as an alternate solution was found that got around the problem I was having with this form freezing. I don't want to delete this question in case someone else comes along and can benefit from the answers, which are potentially useful.
Try this on a form.
Dim objViewer As MyViewer
Set objViewer = Controls.Add("MyViewer", "MyViewer1")
objViewer.MaxPageSize = 100
objViewer.ResetPages
objViewer.AddPageToView "C:\TestPage1.txt"
I've had similar situations in the past. If all else fails and you have to use a form you can do something crude like
1) Set the .Left property of the control to a negative number (like -10000) so the control doesn't appear on the form, the user can not see it
2) Make the entire form not visible..
ActiveX controls normally expect a number of services from their containers, for example persistence. They are also "packaged and marked" in ways that set the kinds of instantiation they support.
See Introduction to ActiveX Controls.
While it is perfectly possible for a control to be created in such a way as to make many of the available services optional, most controls are created from template code that requires a number of them. And most controls that are "visible at runtime" are going to require container services.
However that doesn't mean a control can't be designed to support containerless instantiation. A well known example of such a control is Microsoft Script Control 1.0 (MSScriptControl.ScriptControl) which can be used either way.

phpThumb is not setting parameter – fltr[] usm

I am using Brett's Mr. PHP thumb caching script along with phpThumb to create my thumbs. It works extremely well, except for one thing... I cannot get it to set and process the UnSharpMask filter. The relevant part of the script looks like this:
// generate the thumbnail
require('../phpthumb/phpthumb.class.php');
$phpThumb = new phpThumb();
$phpThumb->setSourceFilename($image);
$phpThumb->setParameter('w',$width);
$phpThumb->setParameter('h',$height);
$phpThumb->setParameter('q','95'); // set the quality to 95%
$phpThumb->setParameter('fltr[]','usm|80|0.5|3'); // <--- THIS SHOULD SET THE USM FILTER
$phpThumb->setParameter('f',substr($thumb,-3,3)); // set the output file format
if (!$phpThumb->GenerateThumbnail()) {
error('cannot generate thumbnail');
}
I'm guessing there's a problem with my syntax, since the fltr[] parameter requires brackets. I have tried escaping the brackets like so: 'fltr[]' but that didn't work either.
I've used several other possible parameters with good success (zoom cropping, max height, max width, etc...) Everything seems to work except the filters (including usm - UnSharpMask).
I don't get any errors. It spits out thumbs all day long. They're just not sharpened.
For reference, here's the official phpThumb readme file that discusses all the possible settings and filters.
Thanks for looking.
Well after much trial, error, and aggravation, I finally discovered the solution buried in one of the demo files that come with phpThumb.
It's a matter of removing the brackets all together. Basically changing this line:
$phpThumb->setParameter('fltr[]','usm|80|0.5|3');
to this:
$phpThumb->setParameter('fltr','usm|80|0.5|3');
After that, it's only a matter of tweaking the settings to get the desired amount of sharpness.