[BUGFIX] Set Severity object properly 59/55859/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Wed, 21 Feb 2018 20:30:32 +0000 (21:30 +0100)
committerFrank Naegler <frank.naegler@typo3.org>
Wed, 21 Feb 2018 21:25:42 +0000 (22:25 +0100)
This patch fixes two issues with setting the `Severity` object:
* Check if TYPO3 is an available namespace
* Store the object in `TYPO3.Severity`

Change-Id: Ice2b410f1a588c09f7a689f54ed127d8ee90f9fa
Resolves: #84007
Related: #83955
Releases: master
Reviewed-on: https://review.typo3.org/55859
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Build/types/TYPO3/index.d.ts
typo3/sysext/backend/Resources/Private/TypeScript/Severity.ts
typo3/sysext/backend/Resources/Public/JavaScript/Severity.js

index e32b368..880ba92 100644 (file)
@@ -10,6 +10,7 @@ declare namespace TYPO3 {
   export let InfoWindow: any;
   export let Notification: any;
   export let Popover: any;
+  export let Severity: any;
   export let ShortcutMenu: any;
   export let Storage: any;
   export let Utility: any;
index d675498..fc45c69 100644 (file)
@@ -80,7 +80,11 @@ try {
 
 if (!severityObject) {
   severityObject = Severity;
+
+  // attach to global frame
+  if (typeof TYPO3 !== 'undefined') {
+    TYPO3.Severity = severityObject;
+  }
 }
 
-TYPO3.Storage = severityObject;
 export = severityObject;
index a03e3d7..2e92483 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","./Enum/Severity"],function(a,b,c){"use strict";var d,e=function(){function a(){}return a.getCssClass=function(a){var b;switch(a){case c.SeverityEnum.notice:b="notice";break;case c.SeverityEnum.ok:b="success";break;case c.SeverityEnum.warning:b="warning";break;case c.SeverityEnum.error:b="danger";break;case c.SeverityEnum.info:default:b="info"}return b},a.notice=c.SeverityEnum.notice,a.info=c.SeverityEnum.info,a.ok=c.SeverityEnum.ok,a.warning=c.SeverityEnum.warning,a.error=c.SeverityEnum.error,a}();try{window.opener&&window.opener.TYPO3&&window.opener.TYPO3.Severity&&(d=window.opener.TYPO3.Severity),parent&&parent.window.TYPO3&&parent.window.TYPO3.Severity&&(d=parent.window.TYPO3.Severity),top&&top.TYPO3&&top.TYPO3.Severity&&(d=top.TYPO3.Severity)}catch(a){}return d||(d=e),TYPO3.Storage=d,d});
\ No newline at end of file
+define(["require","exports","./Enum/Severity"],function(a,b,c){"use strict";var d,e=function(){function a(){}return a.getCssClass=function(a){var b;switch(a){case c.SeverityEnum.notice:b="notice";break;case c.SeverityEnum.ok:b="success";break;case c.SeverityEnum.warning:b="warning";break;case c.SeverityEnum.error:b="danger";break;case c.SeverityEnum.info:default:b="info"}return b},a.notice=c.SeverityEnum.notice,a.info=c.SeverityEnum.info,a.ok=c.SeverityEnum.ok,a.warning=c.SeverityEnum.warning,a.error=c.SeverityEnum.error,a}();try{window.opener&&window.opener.TYPO3&&window.opener.TYPO3.Severity&&(d=window.opener.TYPO3.Severity),parent&&parent.window.TYPO3&&parent.window.TYPO3.Severity&&(d=parent.window.TYPO3.Severity),top&&top.TYPO3&&top.TYPO3.Severity&&(d=top.TYPO3.Severity)}catch(a){}return d||(d=e,"undefined"!=typeof TYPO3&&(TYPO3.Severity=d)),d});
\ No newline at end of file