From 4da866adb8ac9b44d99c68d6b8b80520ef143467 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 10 Feb 2013 03:57:32 +0100 Subject: [PATCH] Removed AJAX-support for ui.wcfDialog Additionally WCF.showAJAXDialog() was removed too. --- wcfsetup/install/files/acp/js/WCF.ACP.js | 50 ++++---- wcfsetup/install/files/js/WCF.js | 149 +---------------------- 2 files changed, 27 insertions(+), 172 deletions(-) diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index 7959bdc4c3..0f79920b48 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -303,15 +303,8 @@ WCF.ACP.Package.Installation = Class.extend({ * Prepares installation dialog. */ prepareInstallation: function() { - WCF.showAJAXDialog('packageInstallationDialog', true, { - ajax: true, - closable: false, - data: this._getParameters(), - showLoadingOverlay: false, - success: $.proxy(this._success, this), - title: WCF.Language.get('wcf.acp.package.installation.title'), - url: 'index.php/' + this._actionName + '/?t=' + SECURITY_TOKEN + SID_ARG_2ND - }); + this._proxy.setOption('data', this._getParameters()); + this._proxy.sendRequest(); }, /** @@ -336,6 +329,14 @@ WCF.ACP.Package.Installation = Class.extend({ _success: function(data, textStatus, jqXHR) { this._shouldRender = false; + if (this._dialog === null) { + this._dialog = $('
').hide().appendTo(document.body); + this._dialog.wcfDialog({ + closable: false, + title: WCF.Language.get('wcf.acp.package.installation.title') + }); + } + if (data.step == 'rollback') { this._dialog.wcfDialog('close'); @@ -349,10 +350,6 @@ WCF.ACP.Package.Installation = Class.extend({ return; } - if (this._dialog == null) { - this._dialog = $('#packageInstallationDialog'); - } - // receive new queue id if (data.queueID) { this._queueID = data.queueID; @@ -1158,6 +1155,12 @@ WCF.ACP.Worker = Class.extend({ */ _proxy: null, + /** + * dialog title + * @var string + */ + _title: '', + /** * Initializes a new worker instance. * @@ -1171,23 +1174,16 @@ WCF.ACP.Worker = Class.extend({ this._dialogID = dialogID + 'Worker'; this._dialog = null; this._proxy = new WCF.Action.Proxy({ - showLoadingOverlay: false, - success: $.proxy(this._success, this), - url: 'index.php/WorkerProxy/?t=' + SECURITY_TOKEN + SID_ARG_2ND - }); - - // initialize AJAX-based dialog - WCF.showAJAXDialog(this._dialogID, true, { - url: 'index.php/WorkerProxy/?t=' + SECURITY_TOKEN + SID_ARG_2ND, - type: 'POST', + autoSend: true, data: { className: className, parameters: parameters || { } }, + showLoadingOverlay: false, success: $.proxy(this._success, this), - onClose: $.proxy(function() { this._aborted = true; }, this), - title: title + url: 'index.php/WorkerProxy/?t=' + SECURITY_TOKEN + SID_ARG_2ND }); + this._title = title; }, /** @@ -1202,7 +1198,11 @@ WCF.ACP.Worker = Class.extend({ // init binding if (this._dialog === null) { - this._dialog = $('#' + $.wcfEscapeID(this._dialogID)); + this._dialog = $('
').hide().appendTo(document.body); + this._dialog.wcfDialog({ + onClose: $.proxy(function() { this._aborted = true; }, this), + title: this._title + }); } // update progress diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 82308bbb06..dbdf319441 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -494,58 +494,12 @@ $.extend(WCF, { activeDialogs: 0, /** - * Counter for dynamic element id's + * Counter for dynamic element ids * * @var integer */ _idCounter: 0, - /** - * Shows a modal dialog with a built-in AJAX-loader. - * - * @param string dialogID - * @param boolean resetDialog - * @return jQuery - */ - showAJAXDialog: function(dialogID, resetDialog) { - if (!dialogID) { - dialogID = this.getRandomID(); - } - - if (!$.wcfIsset(dialogID)) { - $('
').appendTo(document.body); - } - - var dialog = $('#' + $.wcfEscapeID(dialogID)); - - if (resetDialog) { - dialog.empty(); - } - - var dialogOptions = arguments[2] || {}; - dialogOptions.ajax = true; - - dialog.wcfDialog(dialogOptions); - - return dialog; - }, - - /** - * Shows a modal dialog. - * - * @param string dialogID - */ - showDialog: function(dialogID) { - // we cannot work with a non-existant dialog, if you wish to - // load content via AJAX, see showAJAXDialog() instead - if (!$.wcfIsset(dialogID)) return; - - var $dialog = $('#' + $.wcfEscapeID(dialogID)); - - var dialogOptions = arguments[1] || {}; - $dialog.wcfDialog(dialogOptions); - }, - /** * Returns a dynamically created id. * @@ -7537,14 +7491,6 @@ $.widget('ui.wcfDialog', { title: '', zIndex: 400, - // AJAX support - ajax: false, - data: { }, - showLoadingOverlay: true, - success: null, - type: 'POST', - url: 'index.php/AJAXProxy/?t=' + SECURITY_TOKEN + SID_ARG_2ND, - // event callbacks onClose: null, onShow: null @@ -7554,21 +7500,6 @@ $.widget('ui.wcfDialog', { * Initializes a new dialog. */ _init: function() { - if (this.options.ajax) { - new WCF.Action.Proxy({ - autoSend: true, - data: this.options.data, - showLoadingOverlay: this.options.showLoadingOverlay, - success: $.proxy(this._success, this), - type: this.options.type, - url: this.options.url - }); - this.loading(); - - // force open if using AJAX - this.options.autoOpen = true; - } - if (this.options.autoOpen) { this.open(); } @@ -7657,63 +7588,6 @@ $.widget('ui.wcfDialog', { return this; }, - /** - * Handles successful AJAX requests. - * - * @param object data - * @param string textStatus - * @param jQuery jqXHR - */ - _success: function(data, textStatus, jqXHR) { - if (this._isOpen) { - // initialize dialog content - this._initDialog(data); - - if (this.options.success !== null && $.isFunction(this.options.success)) { - this.options.success(data, textStatus, jqXHR); - } - } - }, - - /** - * Initializes dialog content if applicable. - * - * @param object data - */ - _initDialog: function(data) { - // remove spinner - this._content.css('position', 'static').children('.icon-spinner').remove(); - - // insert template - if (this._getResponseValue(data, 'template')) { - this._content.children().html(this._getResponseValue(data, 'template')); - this.render(false, true); - } - - // set title - if (this._getResponseValue(data, 'title')) { - this._setOption('title', this._getResponseValue(data, 'title')); - } - }, - - /** - * Returns a response value, taking care of different object - * structure returned by AJAXProxy. - * - * @param object data - * @param string key - */ - _getResponseValue: function(data, key) { - if (data.returnValues && data.returnValues[key]) { - return data.returnValues[key]; - } - else if (data[key]) { - return data[key]; - } - - return null; - }, - /** * Opens this dialog. */ @@ -7743,14 +7617,6 @@ $.widget('ui.wcfDialog', { return this._isOpen; }, - /** - * Clears the dialog and applies a loading overlay - */ - loading: function() { - $('').appendTo(this._content.css('position', 'relative')); - this.render(); - }, - /** * Closes this dialog. */ @@ -7786,19 +7652,8 @@ $.widget('ui.wcfDialog', { /** * Renders this dialog, should be called whenever content is updated. - * - * @param boolean loaded - * @param boolean disableAnimation */ - render: function(loaded, disableAnimation) { - loaded = loaded || false; - disableAnimation = disableAnimation || false; - - if (loaded) { - // remove spinner - this._content.children('.icon-spinner').remove(); - } - + render: function() { // force dialog and it's contents to be visible this._container.show(); this._content.children().show(); -- 2.20.1