[TASK] Remove old prototype.js utilities 98/34098/4
authorBenjamin Mack <benni@typo3.org>
Thu, 13 Nov 2014 16:53:00 +0000 (17:53 +0100)
committerFelix Kopp <felix-source@phorax.com>
Sat, 15 Nov 2014 10:32:14 +0000 (11:32 +0100)
One of the initial JS files with prototype
called common.js (which was moved from
typo3/js/common.js into EXT:backend
with the file structure change) was previously
used for calls using Prototype AJAX
calls.

The file was now used in two areas:
- backend.php - containing an instance of
the mother object "TYPO3" used for the
backend scaffolding via ExtJS.
- old Prototype trees (loaded in DocumentTemplate)
introducing an API when using prototype as AJAX handler
when errors from AJAX requests occurred (was piped
to the ExtJS debug bar).

Removing the common.js file leads to
a) moving the "mother object" TYPO3 into backend.js
where all other ExtJS initialization for the TYPO3 Backend
is done.
b) "old" Trees using AJAX without the hook
for show error messages.

The toolbarmanager.js file was a base
helper function to open/hide toolbar items
which is now completely provided with
Bootstrap's dropdown functionality.

As a result, the prototype/scriptaculous
component is not needed in backend.php
anymore, and is removed by default.

Any extension that needs prototype in the
backend.php namespace can of course
re-enable scriptaculous.

Resolves: #62926
Releases: master
Change-Id: Icbbc048944360c3ac469c816ad07c4a2a112836b
Reviewed-on: http://review.typo3.org/34098
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Felix Kopp <felix-source@phorax.com>
Tested-by: Felix Kopp <felix-source@phorax.com>
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/backend/Resources/Public/JavaScript/backend.js
typo3/sysext/backend/Resources/Public/JavaScript/common.js [deleted file]
typo3/sysext/backend/Resources/Public/JavaScript/toolbarmanager.js [deleted file]

index 700a306..3322189 100644 (file)
@@ -104,7 +104,6 @@ class BackendController {
                $this->moduleLoader = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Module\ModuleLoader::class);
                $this->moduleLoader->load($GLOBALS['TBE_MODULES']);
                $this->pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
-               $this->pageRenderer->loadScriptaculous('builder,effects,controls,dragdrop');
                $this->pageRenderer->loadExtJS();
                $this->pageRenderer->loadJquery(NULL, NULL, \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_NAMESPACE_DEFAULT_NOCONFLICT);
                $this->pageRenderer->enableExtJSQuickTips();
@@ -113,11 +112,9 @@ class BackendController {
                // Add default BE javascript
                $this->js = '';
                $this->jsFiles = array(
-                       'common' => 'sysext/backend/Resources/Public/JavaScript/common.js',
                        'locallang' => $this->getLocalLangFileName(),
                        'modernizr' => 'contrib/modernizr/modernizr.min.js',
                        'md5' => 'sysext/backend/Resources/Public/JavaScript/md5.js',
-                       'toolbarmanager' => 'sysext/backend/Resources/Public/JavaScript/toolbarmanager.js',
                        'modulemenu' => 'sysext/backend/Resources/Public/JavaScript/modulemenu.js',
                        'evalfield' => 'sysext/backend/Resources/Public/JavaScript/jsfunc.evalfield.js',
                        'flashmessages' => 'sysext/backend/Resources/Public/JavaScript/flashmessages.js',
index 9320f69..2472d72 100644 (file)
@@ -1485,7 +1485,6 @@ function jumpToUrl(URL) {
        public function getDragDropCode($table) {
                $this->getContextMenuCode();
                $this->pageRenderer->loadPrototype();
-               $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/common.js');
                $this->loadJavascriptLib('js/tree.js');
                // Setting prefs for drag & drop
                $this->JScodeArray['dragdrop'] = '
index 96a7d32..af0de52 100644 (file)
  * The TYPO3 project - inspiring people to share!
  */
 
+
+/**
+ * common storage and global object, could later hold more information about the current user etc.
+ */
+var TYPO3 = TYPO3 || {};
+TYPO3 = Ext.apply(TYPO3, {
+       // store instances that only should be running once
+       _instances: {},
+       getInstance: function(className) {
+               return TYPO3._instances[className] || false;
+       },
+       addInstance: function(className, instance) {
+               TYPO3._instances[className] = instance;
+               return instance;
+       },
+
+       helpers: {
+               // creates an array by splitting a string into parts, taking a delimiter
+               split: function(str, delim) {
+                       var res = [];
+                       while (str.indexOf(delim) > 0) {
+                               res.push(str.substr(0, str.indexOf(delim)));
+                               str = str.substr(str.indexOf(delim) + delim.length);
+                       }
+                       return res;
+               }
+       }
+});
+
 /**
  * general backend javascript functions
  */
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/common.js b/typo3/sysext/backend/Resources/Public/JavaScript/common.js
deleted file mode 100644 (file)
index cab69e0..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * javascript functions regarding the TYPO3 wrapper
- * for the javascript library "prototype"
- *
- * Please make sure that prototype.js is loaded before loading this
- * file in your script, the responder is only added if prototype was loaded
- */
-
-// This is done to prevent trouble with Twitter Bootstrap
-if (Prototype.BrowserFeatures.ElementExtensions) {
-    var disablePrototypeJS = function (method, pluginsToDisable) {
-            var handler = function (event) {
-                event.target[method] = undefined;
-                setTimeout(function () {
-                    delete event.target[method];
-                }, 0);
-            };
-            pluginsToDisable.each(function (plugin) {
-                TYPO3.jQuery(window).on(method + '.bs.' + plugin, handler);
-            });
-        },
-        pluginsToDisable = ['collapse', 'dropdown', 'modal', 'tooltip'];
-    disablePrototypeJS('show', pluginsToDisable);
-    disablePrototypeJS('hide', pluginsToDisable);
-}
-
-if (Prototype) {
-       // adding generic a responder to use when a AJAX request is done
-       Ajax.Responders.register({
-               onCreate: function(request, transport) {
-
-                       // if the TYPO3 AJAX backend is used,
-                       // the onSuccess & onComplete callbacks are hooked
-                       if (request.url.indexOf("ajax.php") === -1) {
-                               return;
-                       }
-
-                       var origSuccess = request.options.onSuccess, origComplete = request.options.onComplete;
-
-                       // hooking "onSuccess"
-                       if (origSuccess) {
-                               request.options.onSuccess = function(xhr, json) {
-                                       if (!json) {
-                                               T3AJAX.showError(xhr);
-                                       } else {
-                                               origSuccess(xhr, json);
-                                       }
-                               }
-                       }
-
-                       // hooking "onComplete", using T3Error handler if available
-                       if (origComplete) {
-                               request.options.onComplete = function(xhr, json) {
-                                       if (!json && request.options.onT3Error) {
-                                               request.options.onT3Error(xhr, json);
-                                       } else if (!json) {
-                                               T3AJAX.showError(xhr);
-                                       } else {
-                                               origComplete(xhr, json);
-                                       }
-                               };
-                       }
-               }
-       });
-}
-
-var T3AJAX = {};
-T3AJAX.showError = function(xhr, json) {
-       if (typeof xhr.responseText !== undefined && xhr.responseText) {
-               if (typeof Ext.MessageBox !== undefined) {
-                       Ext.MessageBox.alert('TYPO3', xhr.responseText);
-               }
-               else {
-                       alert(xhr.responseText);
-               }
-       }
-};
-
-// common storage and global object, could later hold more information about the current user etc.
-if (typeof TYPO3 === undefined) {
-       // window definition required, otherwise IE8 clears TYPO3 variable completely
-       window['TYPO3'] = {};
-}
-TYPO3 = Ext.apply(TYPO3, {
-       // store instances that only should be running once
-       _instances: {},
-       getInstance: function(className) {
-               return TYPO3._instances[className] || false;
-       },
-       addInstance: function(className, instance) {
-               TYPO3._instances[className] = instance;
-               return instance;
-       },
-
-       helpers: {
-               // creates an array by splitting a string into parts, taking a delimiter
-               split: function(str, delim) {
-                       var res = [];
-                       while (str.indexOf(delim) > 0) {
-                               res.push(str.substr(0, str.indexOf(delim)));
-                               str = str.substr(str.indexOf(delim) + delim.length);
-                       }
-                       return res;
-               }
-       }
-});
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/toolbarmanager.js b/typo3/sysext/backend/Resources/Public/JavaScript/toolbarmanager.js
deleted file mode 100644 (file)
index 0ae0b18..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * @deprecated with CMS 7, will be removed in CMS 8
- */
-var ToolbarManager = Class.create({
-
-       /**
-        * hides all toolbar item menus except for the which was clicked
-        */
-       hideOthers: function(toolbarItem) {},
-
-       /**
-        * Hide all expanded toolbar menus
-        */
-       hideAll: function() {},
-
-       /**
-        * refreshs positioning of all submenus
-        */
-       refreshAll: function() {},
-
-       /**
-        * @param elementId The parent element of the menu to be positioned
-        */
-       positionMenu: function(elementId) {}
-
-});
-
-var TYPO3BackendToolbarManager = new ToolbarManager();
\ No newline at end of file