[BUGFIX] Remove prototype JS from tbe_editor 67/41767/3
authorMarkus Klein <markus.klein@typo3.org>
Tue, 21 Jul 2015 08:34:49 +0000 (10:34 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 21 Jul 2015 14:23:16 +0000 (16:23 +0200)
Two references to prototype JS are removed from tbe_editor.
Code changed with the prototype removal is further streamlined.
One parameter, exclusively used for script.aculo.us, in
GeneralUtility::createVersionNumberedFilename is removed as well.

Releases: master
Resolves: #68413
Related: #39721
Change-Id: I9f8328b1789f3423aa33813de0cd736b135cfa55
Reviewed-on: http://review.typo3.org/41767
Reviewed-by: Frederic Gaus <frederic.gaus@flagbit.de>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js
typo3/sysext/core/Classes/Utility/GeneralUtility.php

index acde74e..0f098a4 100644 (file)
@@ -92,30 +92,28 @@ var TBE_EDITOR = {
                if (nestedLevelIdent && TBE_EDITOR.nested.level && TBE_EDITOR.nested.level[nestedLevelIdent]) {
                        nestedLevel = TBE_EDITOR.nested.level[nestedLevelIdent];
                        if (!nestedLevel.clean) {
-                               if (typeof nestedLevel.item == 'object') {
-                                       $H(nestedLevel.item).each(
-                                               function(pair) {
-                                                       if (isClean || typeof isClean == 'undefined') {
+                               if (typeof nestedLevel.item === 'object') {
+                                       TYPO3.jQuery.each(nestedLevel.item, function(key, value) {
+                                                       if (isClean || typeof isClean === 'undefined') {
                                                                isClean = (
-                                                                       TBE_EDITOR.checkElements('required', false, pair.value[0], pair.value[1]) &&
-                                                                       TBE_EDITOR.checkElements('range', false, pair.value[0], pair.value[1])
+                                                                       TBE_EDITOR.checkElements('required', false, value[0], value[1]) &&
+                                                                       TBE_EDITOR.checkElements('range', false, value[0], value[1])
                                                                );
                                                        }
                                                }
                                        );
-                                       if (typeof isClean != 'undefined' && !isClean) {
+                                       if (typeof isClean !== 'undefined' && !isClean) {
                                                return false;
                                        }
                                }
-                               if (typeof nestedLevel.sub == 'object') {
-                                       $H(nestedLevel.sub).each(
-                                               function(pair) {
-                                                       if (isClean || typeof isClean == 'undefined') {
-                                                               isClean = TBE_EDITOR.checkNested(pair.key);
+                               if (typeof nestedLevel.sub === 'object') {
+                                       TYPO3.jQuery.each(nestedLevel.sub, function(key, value) {
+                                                       if (isClean || typeof isClean === 'undefined') {
+                                                               isClean = TBE_EDITOR.checkNested(key);
                                                        }
                                                }
                                        );
-                                       if (typeof isClean != 'undefined' && !isClean) {
+                                       if (typeof isClean !== 'undefined' && !isClean) {
                                                return false;
                                        }
                                }
@@ -370,13 +368,7 @@ var TBE_EDITOR_str_replace = TBE_EDITOR.str_replace;
 var typo3form = {
        fieldSetNull: function(fieldName, isNull) {
                if (document[TBE_EDITOR.formname][fieldName]) {
-                       var $formFieldItemWrapper = TYPO3.jQuery(document[TBE_EDITOR.formname][fieldName]).closest('.t3js-formengine-field-item');
-
-                       if (isNull) {
-                               $formFieldItemWrapper.addClass('disabled');
-                       } else {
-                               $formFieldItemWrapper.removeClass('disabled');
-                       }
+                       TYPO3.jQuery(document[TBE_EDITOR.formname][fieldName]).closest('.t3js-formengine-field-item').toggleClass('disabled', isNull);
                }
        },
        fieldTogglePlaceholder: function(fieldName, showPlaceholder) {
@@ -384,16 +376,9 @@ var typo3form = {
                        return;
                }
 
-               var formFieldItemWrapper = TYPO3.jQuery(document[TBE_EDITOR.formname][fieldName]).closest('.t3js-formengine-field-item');
-               var placeholder = formFieldItemWrapper.find('.t3js-formengine-placeholder-placeholder');
-               var formField = formFieldItemWrapper.find('.t3js-formengine-placeholder-formfield');
-               if (showPlaceholder) {
-                       placeholder.show();
-                       formField.hide();
-               } else {
-                       placeholder.hide();
-                       formField.show();
-               }
+               var $formFieldItemWrapper = TYPO3.jQuery(document[TBE_EDITOR.formname][fieldName]).closest('.t3js-formengine-field-item');
+               $formFieldItemWrapper.find('.t3js-formengine-placeholder-placeholder').toggle(showPlaceholder);
+               $formFieldItemWrapper.find('.t3js-formengine-placeholder-formfield').toggle(!showPlaceholder);
        },
        fieldSet: function(theField, evallist, is_in, checkbox, checkboxValue) {
                var i;
index 79659a2..58b98d7 100755 (executable)
@@ -3105,10 +3105,9 @@ Connection: close
         * = FALSE (BE) / "querystring" (FE) : add timestamp as parameter
         *
         * @param string $file Relative path to file including all potential query parameters (not htmlspecialchared yet)
-        * @param bool $forceQueryString If settings would suggest to embed in filename, this parameter allows us to force the versioning to occur in the query string. This is needed for scriptaculous.js which cannot have a different filename in order to load its modules (?load=...)
         * @return string Relative path with version filename including the timestamp
         */
-       static public function createVersionNumberedFilename($file, $forceQueryString = FALSE) {
+       static public function createVersionNumberedFilename($file) {
                $lookupFile = explode('?', $file);
                $path = self::resolveBackPath(self::dirname(PATH_thisScript) . '/' . $lookupFile[0]);
 
@@ -3131,7 +3130,7 @@ Connection: close
                        // File not found, return filename unaltered
                        $fullName = $file;
                } else {
-                       if (!$mode || $forceQueryString) {
+                       if (!$mode) {
                                // If use of .htaccess rule is not configured,
                                // we use the default query-string method
                                if ($lookupFile[1]) {