Added generic event for static dialogs
authorAlexander Ebert <ebert@woltlab.com>
Wed, 23 Aug 2017 12:48:13 +0000 (14:48 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 23 Aug 2017 12:48:13 +0000 (14:48 +0200)
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js

index 67f5a060f6e3215d252b7cd032e64b5ebef65c01..e34c7a782e93d11f545e4f92c11fe4292db64760 100644 (file)
@@ -10,12 +10,14 @@ define(
        [
                'enquire',      'Ajax',       'Core',      'Dictionary',
                'Environment',  'Language',   'ObjectMap', 'Dom/ChangeListener',
-               'Dom/Traverse', 'Dom/Util',   'Ui/Confirmation', 'Ui/Screen', 'Ui/SimpleDropdown'
+               'Dom/Traverse', 'Dom/Util',   'Ui/Confirmation', 'Ui/Screen', 'Ui/SimpleDropdown',
+               'EventHandler'
        ],
        function(
                enquire,        Ajax,         Core,        Dictionary,
                Environment,    Language,     ObjectMap,   DomChangeListener,
-               DomTraverse,    DomUtil,      UiConfirmation, UiScreen, UiSimpleDropdown
+               DomTraverse,    DomUtil,      UiConfirmation, UiScreen, UiSimpleDropdown,
+               EventHandler
        )
 {
        "use strict";
@@ -97,6 +99,7 @@ define(
                                if (id && (container = elById(id))) {
                                        ((function(button, container) {
                                                container.classList.remove('jsStaticDialogContent');
+                                               elData(container, 'is-static-dialog', true);
                                                elHide(container);
                                                button.addEventListener(WCF_CLICK_EVENT, this.openStatic.bind(this, container.id, null, { title: elData(container, 'title') }));
                                        }).bind(this))(button, container);
@@ -467,6 +470,13 @@ define(
                                        data.onShow(data.content);
                                }
                                
+                               if (elDataBool(data.content, 'is-static-dialog')) {
+                                       EventHandler.fire('com.woltlab.wcf.dialog', 'openStatic', {
+                                               content: data.content,
+                                               id: id
+                                       });
+                               }
+                               
                                // close existing dropdowns
                                UiSimpleDropdown.closeAll();
                                window.WCF.Dropdown.Interactive.Handler.closeAll();