Bug #18855
Wrong JavaScript inclusion in t3lib_TCEforms
Status: | Closed | Start date: | 2008-05-26 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Oliver Hader | % Done: | 0% |
|
Category: | - | Spent time: | - | |
Target version: | - | |||
TYPO3 Version: | 4.2 | Is Regression: | ||
PHP Version: | 5.2 | Sprint Focus: | ||
Complexity: |
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)
Related issues
History
#1 Updated by Oliver Hader about 7 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()
#2 Updated by Benjamin Mack about 7 years ago
Yes. Full ACK.
Never include prototype manually. Should definitively be something for 4.2.1.
#3 Updated by Benjamin Mack about 7 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?
#4 Updated by Oliver Hader about 7 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.
#5 Updated by Peter Niederlag about 7 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.
#6 Updated by Oliver Hader about 7 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
#7 Updated by Oliver Hader almost 7 years ago
- TYPO3_4-2 (rev. 4256)
- Trunk (rev. 4257)
#8 Updated by Stanislas Rolland almost 7 years ago
Since revisions 4256/57, the Full Screen RTE wizard fails on js error: TBE_EDITOR is not defined.
#9 Updated by Oliver Hader almost 7 years ago
The fix of the introduced bug will be handled in issue #19423
#10 Updated by Peter Niederlag almost 7 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
#11 Updated by Oliver Hader almost 7 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.
#12 Updated by Ralf Seliger almost 7 years ago
This issue is NOT fixed in 4.2.2.
#13 Updated by Oliver Hader almost 7 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.