Bug #18855
closedWrong JavaScript inclusion in t3lib_TCEforms
0%
Description
the handling of adding js-stuff in tceforms seems broken to me. ;(
prototype.js is added twice by default :-<
please see my comments in the supplied tceforms-comments.diff..
(issue imported from #M8518)
Files
Updated by Oliver Hader over 16 years ago
- use $GLOBALS['TBE_TEMPLATE']->loadJavascriptLib([filename]) to include JavaScript sources (prototype, script.aculo.us and TBE_EDITOR) in the constructor of t3lib_TCEforms
- remove inclusion of prototype.js from alt_doc.php
- remove (again) static JavaScript from t3lib_TCEforms::JSbottom()
Updated by Benni Mack over 16 years ago
Yes. Full ACK.
Never include prototype manually. Should definitively be something for 4.2.1.
Updated by Benni Mack over 16 years ago
I did a quick hack using these function, but haven't tested that yet.
The real solution would be to change the "loadJavascriptLib()" to see if it is not just loaded in the local document, but also not loaded in the $GLOBALs[TBE_TEMPLATE]->Jslibs array. sounds good?
Updated by Oliver Hader over 16 years ago
Thanks Benni, I changed your patch in one thing in alt_doc.php:
We have in alt_doc.php the class member $doc which gets an instance of "template" and additionally we have another instance in $GLOBALS['TBE_TEMPLATE'] - now $doc is a reference to the global template object. I currently cannot see any negative side-effects of that and also don't know why this once was separated.
Maybe this behaviour on different template instances could also be solved by a singleton pattern in general.
However, the patch now works with latest Trunk revision - if also tested it with some IRRE functionalities.
@Peter: The libs are now included in the HTML HEAD node, thus you can now add data again to t3lib_TCEforms->additionalJS_post.
Updated by Peter Niederlag over 16 years ago
concerning the conditional statement within 'if ($this->inline->inlineCount) {':
We don't need sriptacoulous there!, it is already included in that branch just a couple of lines above. I don't see any sense in adding it again.
Updated by Oliver Hader over 16 years ago
Hi Peter, I just changed Benni's patch to work with current Trunk.
You're right, that needs not to be defined twice - however it it's only added once with the loadJavascriptLib() function. Loading the scriptaculous libs outside the "inline" block, was introduced by Kasper during 4.2 development - I don't know if it's really required for the flexform sections...
http://forge.typo3.org/repositories/diff/typo3v4-core?rev=2628
Updated by Oliver Hader about 16 years ago
- TYPO3_4-2 (rev. 4256)
- Trunk (rev. 4257)
Updated by Stanislas Rolland about 16 years ago
Since revisions 4256/57, the Full Screen RTE wizard fails on js error: TBE_EDITOR is not defined.
Updated by Oliver Hader about 16 years ago
The fix of the introduced bug will be handled in issue #19423
Updated by Peter Niederlag about 16 years ago
Hi Olli,
---------------------------------------------------------------------
$this->loadJavascriptLib('contrib/scriptaculous/scriptaculous.js');
----------------------------------------------------------------------
is required for flexform sections to work. They are broken now. :-<
My suggestion would be to just move that line from the 'if ($this->inline->inlineCount) {' block to the gerneral block.
I'll attach a patch in a second
Updated by Oliver Hader about 16 years ago
The inclusion of scriptaculous should stay where it is.
But, additionally, when flexform sections are rendered/required, the same line of should be called there:
$this->loadJavascriptLib('contrib/scriptaculous/scriptaculous.js');
Additionally I'm going to create a new bug report for this issue.
Updated by Oliver Hader about 16 years ago
Ralf, that depends on which "issue" you're talking about. The initial one WAS.
See fixes for side-effects in the relationships of this report or create a new report if you experienced others.