sr_freecap: viewhelper calls eIDSR instead of eID - no image shown - typo3

i want to imeplement the extension sr_freecap in an own extension in a TYPO3 9 LTS. The viewhelper shows the text and the correct html but the link to the image looks like this:
mydomain.com/index.php?eIDSR=sr_freecap_EidDispatcher&id=9781&vendorName=SJBR&extensionName=SrFreecap&pluginName=ImageGenerator&controllerName=ImageGenerator&actionName=show&formatName=png&L=0&set=571e0
When i call this url manually i get the whole page and not the image. Is eIDSR correct? I was in the opinion that the correct call should be eID= ... I can't find information about it.
Any help appreciated!

I missed the existing bug report: https://forge.typo3.org/issues/89735
I tried the above solution and it works:
Put in your extension in which you implements sr_freecap this file:
/your-extension/Configuration/RequestMiddlewares.php
with the following content:
<?php
return [
'frontend' => [
'srfreecap-eidhandler' => [
'target' => \SJBR\SrFreecap\Middleware\EidHandler::class,
'before' => [
'typo3/cms-frontend/content-length-headers',
],
]
]
];
this will work. Seems like a necaissary feature which is not mentioned in the manual.

Related

RequestMiddlewares.php: new handling? (TYPO3 Extbase)

This used to work in TYPO3 9 and TYPO3 10 but is not working from me in TYPO3 11:
EXTDIR/Configuration/RequestMiddlewares.php
<?php
return [
'frontend' => [
'varioous/rest/mail-chimp-middleware' => [
'target' => Varioous\Rest\MailChimpMiddleware::class,
'before' => [
'typo3/cms-frontend/eid',
'typo3/cms-frontend/tsfe',
],
],
],
];
I've looked at this description here https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ApiOverview/RequestHandling/Index.html but I can't find the problem. The code is from this example: https://various.at/news/typo3-tipps-und-tricks-psr-15-mideelware-am-beispiel-mailchimp-webhook and has been adjusted to a custom made extension that has been working fine with TYPO3 9 and TYPO3 10. The particular extension belongs to the customer and I am not permitted to post it here. It is configured exactly as the mailchimp extension is in the how-to and I am sure the author used that how-to as a reference. As it seems, the mailchimp extension from the TER stopped using middleware - so I can't use the current version as a reference to fix my problem.
With this temporary workaround it's working fine:
<?php
return [
'frontend' => [
'varioous/rest/mail-chimp-middleware' => [
'target' => Varioous\Rest\MailChimpMiddleware::class,
'before' => [
# 'typo3/cms-frontend/eid',
# 'typo3/cms-frontend/tsfe',
],
],
],
];
How do I have to adjust the references to 'typo3/cms-frontend/eid' and 'typo3/cms-frontend/tsfe' for TYPO3 11? When I look up HTTP Middlewares (PSR-15) in the Configuration BackEnd module I can find them in the frontend category:
typo3/cms-frontend/eid = TYPO3\CMS\Frontend\Middleware\EidHandler
typo3/cms-frontend/tsfe = TYPO3\CMS\Frontend\Middleware\TypoScriptFrontendInitialization
FYI Further description of the Problem:
Once the extension is activated, ALL local extbase extensions stop working. For Example:
#1316104317 TYPO3\CMS\Extbase\Mvc\Exception
The default controller for extension "News" and plugin "Pi1" can not be determined. Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.
Of course there is nothing wrong with the news extension. I temporarily added a debug output in the file typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php
protected function loadDefaultValues()
{
$configuration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
print_r($configuration);
When the extension with the middleware is activated, the value "controllerConfiguration" in the array returned from the ConfigurationManager is empty (for all local extensions).

In Mediawiki's tinymce extension, how to enable/disable buttons?

In https://www.mediawiki.org/wiki/Extension:TinyMCE, there a section with Toolbar buttons including a Citation/reference button which looks like this:
Furthermore, it says: "Depending on configuration, some or all of these buttons may be shown".
It is not clear however how to enable/disable specific buttons in LocalSettings.php.
In the https://www.mediawiki.org/wiki/Extension:TinyMCE/Configuration page, there are instructions on how to add buttons to toolbars, and based on that I have added this to my LocalSettings.php:
wfLoadExtension( "TinyMCE" );
$wgTinyMCEEnabled = true;
$wgTinyMCESettings = [
".tox-tinymce" => [
"toolbar+" => " | citation",
],
];
.tox-tinymce being the selector for the text box where TinyMCE applies.
The citation button does not appear currently, and before I debug, I'd like to know (1) if I am on the right track, and (2) how can i know the machine name of a button (I assume it's citation, but maybe it's "footnote" or "cite", it is not clear where to find the mapping of machine names to buttons).
I have gone through the mediawiki-extensions-TinyMCE-master
Inside custom plugin directory mediawiki/plugins I saw 12 custom plugins.
I have opened one by one plugin code I observed only 3 plugins wikitext, wikitoggle , wikiupload are loaded in tinymce plugin manager. Ex:-
tinymce.PluginManager.add('wikitoggle', wikitoggle);
I could enable these buttons directly in load-extensions.php.
wfLoadExtension( "TinyMCE" );
$wgTinyMCEEnabled = true;
$wgTinyMCESettings = [
"#wpTextbox1" => [
"toolbar" => 'wikitext wikitoggle wikiupload',
],
];
I saw wikireference code at the end it has plugin function defination.
function Plugin () {
// only load plugin if the 'cite' extension is enabled
// in the wiki, eg, if 'ref' tag is in extension tag list
if ( extensionTagsList.split('|').indexOf('ref') > -1 ) {
pluginManager.add('wikireference', function (editor) {
registerCommands( editor );
registerButtons( editor );
setup( editor );
});
}
}
Plugin();
// only load plugin if the 'cite' extension is enabled
// in the wiki, eg, if 'ref' tag is in extension tag list
from the plugin method comments I could figure it out how to load reference and comment buttons.
first we need to download and install Cite extension plugin
echo 'Downloading and installing Cite'
echo 'See https://www.mediawiki.org/wiki/Extension:Cite#Installation'
curl -O -L https://github.com/wikimedia/mediawiki-extensions-Cite/archive/refs/heads/master.zip
unzip master.zip
rm master.zip
mv mediawiki-extensions-Cite-master extensions/Cite
Enable reference and comment button in load-extensions.php
[
"toolbar" => 'reference comment',
],
];

Issue with Babel configuration/inconsistency

In the beginning of the docs "What is Babel", an example is listed to explain what Babel does. It states that Babel transforms the following ES2015 input:
[1, 2, 3].map((n) => n + 1);
To the following ES5 equivalent:
[1, 2, 3].map(function(n) {
return n + 1;
});
However, if you enter the same ES2015 code on the home page widget you get the following output:
"use strict";
[1, 2, 3].map(n => n + 1);
Am I missing something? Shouldn't the output be ES5 code?
The reason I am asking is that, after installing all the relevant packages ("#babel/cli", "#babel/core", and "#babel/preset-env") and running Babel from the command line, I am getting the same output as the home page widget.
I found a way to make it work in the Babel command line. I needed to use the --presets option:
npx babel script.js --out-file script-compiled.js --presets=#babel/preset-env
I still don't know why the home page widget does not work though.
You should check your options on the babel try page.
looks
the same output ES6 entry
You should try to create a babel.config.js file to run babel without parameters
// babel.config.js
module.exports = {
presets: [
[
"#babel/preset-env",
{
targets: {
node: "current",
},
},
],
],
};
On this file you can config many options, for example, the presets you want to use. here more information Babel config files

Ionic 2 page module segment optional params?

I am using ionic page module like this...
#IonicPage({
name: 'forgotten-password',
segment: 'forgotten-password/:email/:code',
defaultHistory: [ 'home' ]
})
The problem is without providing params, the url looks like this:
http://localhost:8100/#/forgotten-password/:email/:code
How can I omit the :email and :code from the route when they are not provided?

LavaCharts - Exporting Chart as an Image - 'getImageCallBack is not defined'

So I am using Kevin Hill's excellent PHP wrapper for Google Charts, 'LavaCharts' and am following his guide on how to access the image URI of each (I need to output the charts in an image format so that I can export the page as a PDF).
https://github.com/kevinkhill/lavacharts/wiki/Getting-a-chart-as-an-image-3.0.x
I am getting the following error: 'getImageCallBack is not defined'
I am registering the 'getImageCallBack' event on each chart from the Controller:
\Lava::PieChart('TotalCallsReceived', $totalCallsReceived, [
'events' => ['ready' => 'getImageCallBack'],
'title' => 'Total Calls Received & Transferred',
'is3D' => false,
]);
And then in the head of my page I have the following. (I will figure out what to do with the URI once I've solved this error. For now logging it is fine)
<script type="text/javascript">
function getImageCallback(event, chart) {
console.log(chart.getImageURI());
// This will return in the form of "data:image/png;base64,iVBORw0KGgoAAAAUA..."
}
</script>
Has anybody else overcome this problem?
the function names are different and need to match case...
the "B" is capitalized here...
'events' => ['ready' => 'getImageCallBack'],
and not here...
function getImageCallback(event, chart) {