[BUGFIX] Avoid double loading of global RequireJS modules 44/45944/2
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Thu, 14 Jan 2016 16:17:10 +0000 (17:17 +0100)
committerAndreas Fernandez <typo3@scripting-base.de>
Fri, 15 Jan 2016 14:31:49 +0000 (15:31 +0100)
Resolves: #72704
Releases: master, 7.6
Change-Id: Ifa56d193a5d92048855b99b58807948d452fc17a
Reviewed-on: https://review.typo3.org/45944
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
14 files changed:
typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler.js
typo3/sysext/backend/Resources/Public/JavaScript/DragUploader.js
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js
typo3/sysext/backend/Resources/Public/JavaScript/FormEngineFlexForm.js
typo3/sysext/backend/Resources/Public/JavaScript/Localization.js
typo3/sysext/backend/Resources/Public/JavaScript/LoginRefresh.js
typo3/sysext/backend/Resources/Public/JavaScript/Modal.js
typo3/sysext/backend/Resources/Public/JavaScript/Notification.js
typo3/sysext/backend/Resources/Public/JavaScript/OnlineMedia.js
typo3/sysext/backend/Resources/Public/JavaScript/Severity.js [new file with mode: 0644]
typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js
typo3/sysext/lang/Resources/Public/JavaScript/LanguageModule.js
typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js
typo3/sysext/t3editor/Resources/Public/JavaScript/T3editor.js

index 3001a73..e9205ba 100644 (file)
  * Module: TYPO3/CMS/Backend/AjaxDataHandler
  * AjaxDataHandler - Javascript functions to work with AJAX and interacting with tce_db.php
  */
-define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons', 'TYPO3/CMS/Backend/Notification'], function ($, Modal, Icons) {
+define(['jquery',
+               'TYPO3/CMS/Backend/Modal',
+               'TYPO3/CMS/Backend/Icons',
+               'TYPO3/CMS/Backend/Notification',
+               'TYPO3/CMS/Backend/Severity',
+          ], function ($, Modal, Icons, Notification, Severity) {
        'use strict';
 
        /**
@@ -77,7 +82,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons', 'TYPO3/C
                $(document).on('click', AjaxDataHandler.identifier.delete, function(evt) {
                        evt.preventDefault();
                        var $anchorElement = $(this);
-                       var $modal = Modal.confirm($anchorElement.data('title'), $anchorElement.data('message'), top.TYPO3.Severity.warning, [
+                       var $modal = Modal.confirm($anchorElement.data('title'), $anchorElement.data('message'), Severity.warning, [
                                {
                                        text: $(this).data('button-close-text') || TYPO3.lang['button.cancel'] || 'Cancel',
                                        active: true,
@@ -217,7 +222,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons', 'TYPO3/C
         */
        AjaxDataHandler.handleErrors = function(result) {
                $.each(result.messages, function(position, message) {
-                       top.TYPO3.Notification.error(message.title, message.message);
+                       Notification.error(message.title, message.message);
                });
        };
 
index e0b9b1b..6170cd8 100644 (file)
  * Module: TYPO3/CMS/Backend/DragUploader
  *
  */
-define(['jquery', 'moment', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Lang/Lang'], function($, moment, NProgress, Modal) {
+define(['jquery',
+               'moment',
+               'nprogress',
+               'TYPO3/CMS/Backend/Modal',
+               'TYPO3/CMS/Backend/Notification',
+               'TYPO3/CMS/Backend/Severity',
+               'TYPO3/CMS/Lang/Lang'
+          ], function($, moment, NProgress, Modal, Notification, Severity) {
 
        /**
         * Array of files which are asked for being overridden
@@ -278,7 +285,7 @@ define(['jquery', 'moment', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/L
                                                cache: false,
                                                success: function(data) {
                                                        $.each(data, function(index, flashMessage) {
-                                                               top.TYPO3.Notification.showMessage(flashMessage.title, flashMessage.message, flashMessage.severity);
+                                                               Notification.showMessage(flashMessage.title, flashMessage.message, flashMessage.severity);
                                                        });
                                                }
                                        });
@@ -334,7 +341,7 @@ define(['jquery', 'moment', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/L
                                $modalContent.find('table').append($record);
                        }
 
-                       var $modal = Modal.confirm(TYPO3.lang['file_upload.existingfiles.title'], $modalContent, top.TYPO3.Severity.warning, [
+                       var $modal = Modal.confirm(TYPO3.lang['file_upload.existingfiles.title'], $modalContent, Severity.warning, [
                                {
                                        text: $(this).data('button-close-text') || TYPO3.lang['file_upload.button.cancel'] || 'Cancel',
                                        active: true,
index 3d6ca19..ebcbdfc 100644 (file)
@@ -30,7 +30,10 @@ var setFormValueOpenBrowser
 /**
  * Module: TYPO3/CMS/Backend/FormEngine
  */
-define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($, Modal) {
+define(['jquery',
+               'TYPO3/CMS/Backend/Modal',
+               'TYPO3/CMS/Backend/Severity'
+          ], function ($, Modal, Severity) {
 
        /**
         *
@@ -611,7 +614,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($, Modal) {
                        var title = TYPO3.lang['label.confirm.delete_record.title'] || 'Delete this record?';
                        var content = TYPO3.lang['label.confirm.delete_record.content'] || 'Are you sure you want to delete this record?';
                        var $anchorElement = $(this);
-                       var $modal = Modal.confirm(title, content, top.TYPO3.Severity.warning, [
+                       var $modal = Modal.confirm(title, content, Severity.warning, [
                                {
                                        text: TYPO3.lang['buttons.confirm.delete_record.no'] || 'Cancel',
                                        active: true,
@@ -637,7 +640,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($, Modal) {
                        var title = TYPO3.lang['label.confirm.delete_record.title'] || 'Delete this record?';
                        var content = TYPO3.lang['label.confirm.delete_record.content'] || 'Are you sure you want to delete this record?';
                        var $anchorElement = $(this);
-                       var $modal = Modal.confirm(title, content, top.TYPO3.Severity.warning, [
+                       var $modal = Modal.confirm(title, content, Severity.warning, [
                                {
                                        text: TYPO3.lang['buttons.confirm.delete_record.no'] || 'Cancel',
                                        active: true,
@@ -896,7 +899,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($, Modal) {
                if ($('.has-change').length > 0) {
                        var title = TYPO3.lang['label.confirm.close_without_save.title'] || 'Do you want to quit without saving?';
                        var content = TYPO3.lang['label.confirm.close_without_save.content'] || 'You have currently unsaved changes. Are you sure that you want to discard all changes?';
-                       var $modal = Modal.confirm(title, content, top.TYPO3.Severity.warning, [
+                       var $modal = Modal.confirm(title, content, Severity.warning, [
                                {
                                        text: TYPO3.lang['buttons.confirm.close_without_save.no'] || 'No, I will continue editing',
                                        active: true,
@@ -929,7 +932,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($, Modal) {
                if ($('.has-error').length > 0) {
                        var title = TYPO3.lang['label.alert.save_with_error.title'] || 'You have errors in your form!';
                        var content = TYPO3.lang['label.alert.save_with_error.content'] || 'Please check the form, there is at least one error in your form.';
-                       var $modal = Modal.confirm(title, content, top.TYPO3.Severity.error, [
+                       var $modal = Modal.confirm(title, content, Severity.error, [
                                {
                                        text: TYPO3.lang['buttons.alert.save_with_error.ok'] || 'OK',
                                        btnClass: 'btn-danger',
index 9c4dbc5..8ff2642 100644 (file)
  * currently TYPO3.FormEngine.FlexFormElement represents one Flexform element
  * which can contain one ore more sections
  */
-define(['jquery', 'TYPO3/CMS/Backend/FormEngine'], function ($) {
+define(['jquery',
+               'TYPO3/CMS/Backend/Modal',
+               'TYPO3/CMS/Backend/FormEngine'
+          ], function ($, Modal) {
 
        /**
         *
@@ -92,15 +95,15 @@ define(['jquery', 'TYPO3/CMS/Backend/FormEngine'], function ($) {
 
                                        var confirmTitle = TYPO3.lang['flexform.section.delete.title'] || 'Are you sure?';
                                        var confirmMessage = TYPO3.lang['flexform.section.delete.message'] || 'Are you sure you want to delete this section?';
-                                       var $confirm = top.TYPO3.Modal.confirm(confirmTitle, confirmMessage);
+                                       var $confirm = Modal.confirm(confirmTitle, confirmMessage);
                                        $confirm.on('confirm.button.cancel', function() {
-                                               top.TYPO3.Modal.currentModal.trigger('modal-dismiss');
+                                               Modal.currentModal.trigger('modal-dismiss');
                                        });
                                        $confirm.on('confirm.button.ok', function(event) {
                                                $(evt.target).closest(opts.sectionSelector).hide().addClass(opts.sectionDeletedClass);
                                                me.setActionStatus();
                                                TYPO3.FormEngine.Validation.validate();
-                                               top.TYPO3.Modal.currentModal.trigger('modal-dismiss');
+                                               Modal.currentModal.trigger('modal-dismiss');
                                        });
                                });
 
index 64ee984..c26f566 100644 (file)
@@ -20,8 +20,9 @@ define([
        'TYPO3/CMS/Backend/AjaxDataHandler',
        'TYPO3/CMS/Backend/Modal',
        'TYPO3/CMS/Backend/Icons',
+       'TYPO3/CMS/Backend/Severity',
        'bootstrap'
-], function($, DataHandler, Modal, Icons) {
+], function($, DataHandler, Modal, Icons, Severity) {
        'use strict';
 
        /**
@@ -119,7 +120,7 @@ define([
                        var $modal = Modal.confirm(
                                TYPO3.lang['localize.wizard.header'].replace('{0}', $triggerButton.data('colposName')).replace('{1}', $triggerButton.data('languageName')),
                                modalContent,
-                               top.TYPO3.Severity.info, [
+                               Severity.info, [
                                        {
                                                text: TYPO3.lang['localize.wizard.button.cancel'] || 'Cancel',
                                                active: true,
@@ -368,4 +369,4 @@ define([
        $(Localization.initialize);
 
        return Localization;
-});
\ No newline at end of file
+});
index 3ce5481..530c9b2 100644 (file)
@@ -16,7 +16,7 @@
  * Task that periodically checks if a blocking event in the backend occurred and
  * displays a proper dialog to the user.
  */
-define(['jquery', 'bootstrap'], function($) {
+define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($, Typo3Notification) {
        /**
         *
         * @type {{identifier: {loginrefresh: string, lockedModal: string, loginFormModal: string}, options: {modalConfig: {backdrop: string}}, webNotification: null, intervalId: null, backendIsLocked: boolean, isTimingOut: boolean, $timeoutModal: string, $backendLockedModal: string, $loginForm: string, loginFramesetUrl: string, logoutUrl: string}}
@@ -322,7 +322,7 @@ define(['jquery', 'bootstrap'], function($) {
                        passwordFieldValue = $passwordField.val();
 
                if (passwordFieldValue === '' && $useridentField.val() === '') {
-                       top.TYPO3.Notification.error(TYPO3.LLL.core.refresh_login_failed, TYPO3.LLL.core.refresh_login_emptyPassword);
+                       Typo3Notification.error(TYPO3.LLL.core.refresh_login_failed, TYPO3.LLL.core.refresh_login_emptyPassword);
                        $passwordField.focus();
                        return;
                }
@@ -348,7 +348,7 @@ define(['jquery', 'bootstrap'], function($) {
                                        // User is logged in
                                        LoginRefresh.hideLoginForm();
                                } else {
-                                       top.TYPO3.Notification.error(TYPO3.LLL.core.refresh_login_failed, TYPO3.LLL.core.refresh_login_failed_message);
+                                       Typo3Notification.error(TYPO3.LLL.core.refresh_login_failed, TYPO3.LLL.core.refresh_login_failed_message);
                                        $passwordField.focus();
                                }
                        }
index fec6a10..dd57af5 100644 (file)
 /**
  * Module: TYPO3/CMS/Backend/Modal
  * API for modal windows powered by Twitter Bootstrap.
- * This module depends on TYPO3/CMS/Backend/Notification due to top.TYPO3.Severity.
  */
-define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) {
+define(['jquery',
+               'TYPO3/CMS/Backend/Severity',
+               'bootstrap'
+          ], function($, Severity) {
        'use strict';
 
-       // fetch from parent
-       if (parent && parent.window.TYPO3 && parent.window.TYPO3.Modal) {
-               // we need to trigger the event capturing again, in order to make sure this works inside iframes
-               parent.window.TYPO3.Modal.initializeMarkupTrigger(document);
-               return parent.window.TYPO3.Modal;
-       }
+       try {
+               // fetch from parent
+               if (parent && parent.window.TYPO3 && parent.window.TYPO3.Modal) {
+                       // we need to trigger the event capturing again, in order to make sure this works inside iframes
+                       parent.window.TYPO3.Modal.initializeMarkupTrigger(document);
+                       return parent.window.TYPO3.Modal;
+               }
 
-       // fetch object from outer frame
-       if (top && top.TYPO3.Modal) {
-               // we need to trigger the event capturing again, in order to make sure this works inside iframes
-               top.TYPO3.Modal.initializeMarkupTrigger(document);
-               return top.TYPO3.Modal;
+               // fetch object from outer frame
+               if (top && top.TYPO3.Modal) {
+                       // we need to trigger the event capturing again, in order to make sure this works inside iframes
+                       top.TYPO3.Modal.initializeMarkupTrigger(document);
+                       return top.TYPO3.Modal;
+               }
+       } catch (e) {
+               // This only happens if the opener, parent or top is some other url (eg a local file)
+               // which loaded the current window. Then the browser's cross domain policy jumps in
+               // and raises an exception.
+               // For this case we are safe and we can create our global object below.
        }
 
        /**
@@ -64,26 +73,26 @@ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) {
        /**
         * Get the correct css class for given severity
         *
-        * @param {int} severity use constants from top.TYPO3.Severity.*
+        * @param {int} severity use constants from Severity.*
         * @returns {String}
         * @private
         */
        Modal.getSeverityClass = function(severity) {
                var severityClass;
                switch (severity) {
-                       case top.TYPO3.Severity.notice:
+                       case Severity.notice:
                                severityClass = 'notice';
                                break;
-                       case top.TYPO3.Severity.ok:
+                       case Severity.ok:
                                severityClass = 'success';
                                break;
-                       case top.TYPO3.Severity.warning:
+                       case Severity.warning:
                                severityClass = 'warning';
                                break;
-                       case top.TYPO3.Severity.error:
+                       case Severity.error:
                                severityClass = 'danger';
                                break;
-                       case top.TYPO3.Severity.info:
+                       case Severity.info:
                        default:
                                severityClass = 'info';
                                break;
@@ -100,12 +109,12 @@ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) {
         *
         * @param {String} title the title for the confirm modal
         * @param {String} content the content for the conform modal, e.g. the main question
-        * @param {int} [severity=top.TYPO3.Severity.warning] severity default top.TYPO3.Severity.warning
+        * @param {int} [severity=Severity.warning] severity default Severity.warning
         * @param {array} [buttons] an array with buttons, default no buttons
         * @param {array} [additionalCssClasses=''] additional css classes to add to the modal
         */
        Modal.confirm = function(title, content, severity, buttons, additionalCssClasses) {
-               severity = (typeof severity !== 'undefined' ? severity : top.TYPO3.Severity.warning);
+               severity = (typeof severity !== 'undefined' ? severity : Severity.warning);
                buttons = buttons || [
                                {
                                        text: $(this).data('button-close-text') || TYPO3.lang['button.cancel'] || 'Cancel',
@@ -161,14 +170,14 @@ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) {
         *
         * @param {String} title the title for the confirm modal
         * @param {String} content the content for the conform modal, e.g. the main question
-        * @param {int} severity default top.TYPO3.Severity.info
+        * @param {int} severity default Severity.info
         * @param {array} buttons an array with buttons, default no buttons
         * @param {array} additionalCssClasses additional css classes to add to the modal
         */
        Modal.show = function(title, content, severity, buttons, additionalCssClasses) {
                var i;
 
-               severity = (typeof severity !== 'undefined' ? severity : top.TYPO3.Severity.info);
+               severity = (typeof severity !== 'undefined' ? severity : Severity.info);
                buttons = buttons || [];
                additionalCssClasses = additionalCssClasses || [];
 
@@ -298,7 +307,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) {
                        var url = $element.data('url') || null;
                        var title = $element.data('title') || 'Alert';
                        var content = $element.data('content') || 'Are you sure?';
-                       var severity = (typeof top.TYPO3.Severity[$element.data('severity')] !== 'undefined') ? top.TYPO3.Severity[$element.data('severity')] : top.TYPO3.Severity.info;
+                       var severity = (typeof Severity[$element.data('severity')] !== 'undefined') ? Severity[$element.data('severity')] : Severity.info;
                        var buttons = [
                                {
                                        text: $element.data('button-close-text') || 'Close',
index 4e60875..4827e0d 100644 (file)
 /**
  * Module: TYPO3/CMS/Backend/Notification
  * Notification API for the TYPO3 backend
+ *
+ * @deprecation: Severity got its own AMD module, it is required here only for
+ * backwards compatibility reasons
  */
-define(['jquery'], function ($) {
+define(['jquery', 'TYPO3/CMS/Backend/Severity'], function ($) {
        'use strict';
 
-       /**
-        * Severity object
-        *
-        * @type {{notice: number, information: number, info: number, ok: number, warning: number, error: number}}
-        * @exports TYPO3/CMS/Backend/Severity
-        */
-       var Severity = {
-               notice: -2,
-               // @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 9, use info instead of information
-               information: -1,
-               info: -1,
-               ok: 0,
-               warning: 1,
-               error: 2
-       };
+       try {
+               // fetch from parent
+               if (parent && parent.window.TYPO3 && parent.window.TYPO3.Notification) {
+                       return parent.window.TYPO3.Notification;
+               }
+
+               // fetch object from outer frame
+               if (top && top.TYPO3.Notification) {
+                       return top.TYPO3.Notification;
+               }
+       } catch (e) {
+               // This only happens if the opener, parent or top is some other url (eg a local file)
+               // which loaded the current window. Then the browser's cross domain policy jumps in
+               // and raises an exception.
+               // For this case we are safe and we can create our global object below.
+       }
 
        /**
         * The main Notification object
@@ -209,18 +213,10 @@ define(['jquery'], function ($) {
                }
        };
 
-       if (typeof TYPO3.Severity === 'undefined') {
-               TYPO3.Severity = Severity;
-       }
-       if (typeof top.TYPO3.Severity === 'undefined') {
-               top.TYPO3.Severity = Severity;
-       }
-       if (typeof TYPO3.Notification === 'undefined') {
-               TYPO3.Notification = Notification;
-       }
-       if (typeof top.TYPO3.Notification === 'undefined') {
-               top.TYPO3.Notification = Notification;
-       }
+
+
+       // attach to global frame
+       TYPO3.Notification = Notification;
 
        return Notification;
 });
index d427fb5..68342f0 100644 (file)
  * Module: TYPO3/CMS/Backend/OnlineMedia
  * Javascript for show the online media dialog
  */
-define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Lang/Lang'], function($, NProgress, Modal) {
+define(['jquery',
+               'nprogress',
+               'TYPO3/CMS/Backend/Modal',
+               'TYPO3/CMS/Backend/Severity',
+               'TYPO3/CMS/Lang/Lang'
+          ], function($, NProgress, Modal, Severity) {
        'use strict';
 
        /**
@@ -57,10 +62,10 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Lang/Lang']
                                                var $confirm = Modal.confirm(
                                                        'ERROR',
                                                        data.error,
-                                                       top.TYPO3.Severity.error,
+                                                       Severity.error,
                                                        [{
                                                                text: TYPO3.lang['button.ok'] || 'OK',
-                                                               btnClass: 'btn-' + Modal.getSeverityClass(top.TYPO3.Severity.error),
+                                                               btnClass: 'btn-' + Modal.getSeverityClass(Severity.error),
                                                                name: 'ok',
                                                                active: true
                                                        }]
@@ -82,7 +87,7 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Lang/Lang']
                                '<div class="form-control-wrap">' +
                                        '<input type="text" class="form-control online-media-url" placeholder="' + me.placeholder + '" />' +
                                '</div>',
-                               top.TYPO3.Severity.notice,
+                               Severity.notice,
                                [{
                                        text: me.btnSubmit,
                                        btnClass: 'btn',
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Severity.js b/typo3/sysext/backend/Resources/Public/JavaScript/Severity.js
new file mode 100644 (file)
index 0000000..96b9e4f
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * 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!
+ */
+
+/**
+ * Module: TYPO3/CMS/Backend/Notification
+ * Notification API for the TYPO3 backend
+ */
+define(function () {
+       'use strict';
+
+       try {
+               // fetch from opening window
+               if (window.opener && window.opener.TYPO3 && window.opener.TYPO3.Severity) {
+                       return window.opener.TYPO3.Severity;
+               }
+
+               // fetch from parent
+               if (parent && parent.window.TYPO3 && parent.window.TYPO3.Severity) {
+                       return parent.window.TYPO3.Severity;
+               }
+
+               // fetch object from outer frame
+               if (top && top.TYPO3.Severity) {
+                       return top.TYPO3.Severity;
+               }
+       } catch (e) {
+               // This only happens if the opener, parent or top is some other url (eg a local file)
+               // which loaded the current window. Then the browser's cross domain policy jumps in
+               // and raises an exception.
+               // For this case we are safe and we can create our global object below.
+       }
+
+       /**
+        * Severity object
+        *
+        * @type {{notice: number, information: number, info: number, ok: number, warning: number, error: number}}
+        * @exports TYPO3/CMS/Backend/Severity
+        */
+       var Severity = {
+               notice: -2,
+               // @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 9, use info instead of information
+               information: -1,
+               info: -1,
+               ok: 0,
+               warning: 1,
+               error: 2
+       };
+
+       // attach to global frame
+       TYPO3.Severity = Severity;
+
+       return Severity;
+});
index 98764d0..bf1bf59 100644 (file)
@@ -24,9 +24,11 @@ define([
        'TYPO3/CMS/Backend/Modal',
        'TYPO3/CMS/Backend/SplitButtons',
        'TYPO3/CMS/Backend/Tooltip',
+       'TYPO3/CMS/Backend/Notification',
+       'TYPO3/CMS/Backend/Severity',
        'datatables',
        'TYPO3/CMS/Backend/jquery.clearable'
-], function($, NProgress, Modal, SplitButtons, Tooltip) {
+], function($, NProgress, Modal, SplitButtons, Tooltip, Notification, Severity) {
 
        /**
         *
@@ -99,7 +101,7 @@ define([
                                Modal.confirm(
                                        TYPO3.lang['extensionList.removalConfirmation.title'],
                                        TYPO3.lang['extensionList.removalConfirmation.question'],
-                                       top.TYPO3.Severity.error,
+                                       Severity.error,
                                        [
                                                {
                                                        text: TYPO3.lang['button.cancel'],
@@ -256,7 +258,7 @@ define([
                Modal.confirm(
                        TYPO3.lang['extensionList.updateConfirmation.questionVersionComments'],
                        message,
-                       top.TYPO3.Severity.warning,
+                       Severity.warning,
                        [
                                {
                                        text: TYPO3.lang['button.cancel'],
@@ -455,7 +457,7 @@ define([
        Repository.getDependencies = function(data) {
                NProgress.done();
                if (data.hasDependencies) {
-                       Modal.confirm(data.title, data.message, top.TYPO3.Severity.info, [
+                       Modal.confirm(data.title, data.message, Severity.info, [
                                {
                                        text: TYPO3.lang['button.cancel'],
                                        active: true,
@@ -474,7 +476,7 @@ define([
                        ]);
                } else {
                        if(data.hasErrors) {
-                               top.TYPO3.Notification.error(data.title, data.message, 15);
+                               Notification.error(data.title, data.message, 15);
                        } else {
                                Repository.getResolveDependenciesAndInstallResult(data.url + '&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]=' + Repository.downloadPath);
                        }
@@ -495,7 +497,7 @@ define([
                        },
                        success: function (data) {
                                if (data.errorCount > 0) {
-                                       Modal.confirm(data.errorTitle, data.errorMessage, top.TYPO3.Severity.error, [
+                                       Modal.confirm(data.errorTitle, data.errorMessage, Severity.error, [
                                                {
                                                        text: TYPO3.lang['button.cancel'],
                                                        active: true,
@@ -528,7 +530,7 @@ define([
                                                        successMessage += '\n* ' + extkey
                                                });
                                        });
-                                       top.TYPO3.Notification.info(TYPO3.lang['extensionList.dependenciesResolveFlashMessage.title' + data.installationTypeLanguageKey].replace(/\{0\}/g, data.extension), successMessage, 15);
+                                       Notification.info(TYPO3.lang['extensionList.dependenciesResolveFlashMessage.title' + data.installationTypeLanguageKey].replace(/\{0\}/g, data.extension), successMessage, 15);
                                        top.TYPO3.ModuleMenu.App.refreshMenu();
                                }
                        },
@@ -630,7 +632,7 @@ define([
                        success: function(data) {
                                // Something went wrong, show message
                                if (data.errorMessage.length) {
-                                       top.TYPO3.Notification.error(TYPO3.lang['extensionList.updateFromTerFlashMessage.title'], data.errorMessage, 10);
+                                       Notification.error(TYPO3.lang['extensionList.updateFromTerFlashMessage.title'], data.errorMessage, 10);
                                }
 
                                // Message with latest updates
@@ -651,7 +653,7 @@ define([
                                // Create an error message with diagnosis info.
                                var errorMessage = textStatus + '(' + errorThrown + '): ' + jqXHR.responseText;
 
-                               top.TYPO3.Notification.warning(
+                               Notification.warning(
                                        TYPO3.lang['extensionList.updateFromTerFlashMessage.title'],
                                        errorMessage,
                                        10
index 540e1fc..4e1de2c 100644 (file)
  * Module: TYPO3/CMS/Lang/LanguageModule
  * Language module class
  */
-define(['jquery', 'moment', 'TYPO3/CMS/Backend/Icons', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable'], function($, moment, Icons) {
+define(['jquery',
+               'moment',
+               'TYPO3/CMS/Backend/Icons',
+               'TYPO3/CMS/Backend/Notification',
+               'datatables',
+               'TYPO3/CMS/Backend/jquery.clearable'
+          ], function($, moment, Icons, Notification) {
        'use strict';
 
        /**
@@ -568,7 +574,7 @@ define(['jquery', 'moment', 'TYPO3/CMS/Backend/Icons', 'datatables', 'TYPO3/CMS/
                if (LanguageModule.userAbortRequest) {
                        LanguageModule.displaySuccess(LanguageModule.labels.canceled);
                } else if (typeof label === 'string' && label !== '') {
-                       top.TYPO3.Notification.error(LanguageModule.labels.errorHeader, label);
+                       Notification.error(LanguageModule.labels.errorHeader, label);
                }
        };
 
@@ -579,7 +585,7 @@ define(['jquery', 'moment', 'TYPO3/CMS/Backend/Icons', 'datatables', 'TYPO3/CMS/
         */
        LanguageModule.displayInformation = function(label) {
                if (typeof label === 'string' && label !== '') {
-                       top.TYPO3.Notification.info(LanguageModule.labels.infoHeader, label);
+                       Notification.info(LanguageModule.labels.infoHeader, label);
                }
        };
 
@@ -590,7 +596,7 @@ define(['jquery', 'moment', 'TYPO3/CMS/Backend/Icons', 'datatables', 'TYPO3/CMS/
         */
        LanguageModule.displaySuccess = function(label) {
                if (typeof label === 'string' && label !== '') {
-                       top.TYPO3.Notification.success(LanguageModule.labels.successHeader, label);
+                       Notification.success(LanguageModule.labels.successHeader, label);
                }
        };
 
index 2cbbc86..b00c046 100644 (file)
  * Module: TYPO3/CMS/Recycler/Recycler
  * RequireJS module for Recycler
  */
-define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/jquery.clearable'], function($, NProgress, Modal) {
+define(['jquery',
+               'nprogress',
+               'TYPO3/CMS/Backend/Modal',
+               'TYPO3/CMS/Backend/Notification',
+               'TYPO3/CMS/Backend/Severity',
+               'TYPO3/CMS/Backend/jquery.clearable'
+          ], function($, NProgress, Modal, Notification, Severity) {
        'use strict';
 
        /**
@@ -362,7 +368,7 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/jqu
                        message = Recycler.createMessage(message, [recordTitle, '[' + records + ']']);
                }
 
-               Modal.confirm(TYPO3.lang['modal.delete.header'], message, top.TYPO3.Severity.error, [
+               Modal.confirm(TYPO3.lang['modal.delete.header'], message, Severity.error, [
                        {
                                text: TYPO3.lang['button.cancel'],
                                btnClass: 'btn-default',
@@ -414,7 +420,7 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/jqu
                        $message = messageText;
                }
 
-               Modal.confirm(TYPO3.lang['modal.undo.header'], $message, top.TYPO3.Severity.ok, [
+               Modal.confirm(TYPO3.lang['modal.undo.header'], $message, Severity.ok, [
                        {
                                text: TYPO3.lang['button.cancel'],
                                btnClass: 'btn-default',
@@ -462,9 +468,9 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/jqu
                        },
                        success: function(data) {
                                if (data.success) {
-                                       top.TYPO3.Notification.success('', data.message);
+                                       Notification.success('', data.message);
                                } else {
-                                       top.TYPO3.Notification.error('', data.message);
+                                       Notification.error('', data.message);
                                }
 
                                // reload recycler data
index 11de224..7fe92bf 100644 (file)
 /**
  * Module: TYPO3/CMS/T3editor/T3editor
  */
-define(['jquery', 'TYPO3/CMS/Backend/SplitButtons'], function ($, SplitButtons) {
+define(['jquery',
+               'TYPO3/CMS/Backend/SplitButtons',
+               'TYPO3/CMS/Backend/Notification'
+          ], function ($, SplitButtons, Notification) {
        'use strict';
 
        /**
@@ -153,9 +156,9 @@ define(['jquery', 'TYPO3/CMS/Backend/SplitButtons'], function ($, SplitButtons)
                        this.textModified = false;
                } else {
                        if (typeof returnedData.exceptionMessage !== 'undefined') {
-                               top.TYPO3.Notification.error(codemirror.options.labels.errorWhileSaving[0]['target'], returnedData.exceptionMessage);
+                               Notification.error(codemirror.options.labels.errorWhileSaving[0]['target'], returnedData.exceptionMessage);
                        } else {
-                               top.TYPO3.Notification.error(codemirror.options.labels.errorWhileSaving[0]['target'], '');
+                               Notification.error(codemirror.options.labels.errorWhileSaving[0]['target'], '');
                        }
                }
        };