Unified dialog API access using object references
authorAlexander Ebert <ebert@woltlab.com>
Tue, 21 Nov 2017 11:47:11 +0000 (12:47 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 21 Nov 2017 11:47:11 +0000 (12:47 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js

index 1c3c82fe040afbf671d067c0589f038b1348b41a..01a50e19d08a98a2a0f65496f1779b14c3609f75 100644 (file)
@@ -273,12 +273,7 @@ define(
                 * @param       {string}                title           dialog title
                 */
                setTitle: function(id, title) {
-                       if (typeof id === 'object') {
-                               var dialogData = _dialogObjects.get(id);
-                               if (dialogData !== undefined) {
-                                       id = dialogData.id;
-                               }
-                       }
+                       id = this._getDialogId(id);
                        
                        var data = _dialogs.get(id);
                        if (data === undefined) {
@@ -494,6 +489,8 @@ define(
                 * @param       {string}        id      element id
                 */
                rebuild: function(id) {
+                       id = this._getDialogId(id);
+                       
                        var data = _dialogs.get(id);
                        if (data === undefined) {
                                throw new Error("Expected a valid dialog id, '" + id + "' does not match any active dialog.");
@@ -595,12 +592,7 @@ define(
                 * @param       {(string|object)}       id      element id or callback object
                 */
                close: function(id) {
-                       if (typeof id === 'object') {
-                               var dialogData = _dialogObjects.get(id);
-                               if (dialogData !== undefined) {
-                                       id = dialogData.id;
-                               }
-                       }
+                       id = this._getDialogId(id);
                        
                        var data = _dialogs.get(id);
                        if (data === undefined) {