From fed8bce0ce00b793b09fbb7be493eef40a164cf9 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 20 Jul 2013 14:21:13 +0200 Subject: [PATCH] Added proper cleanup/success message after import --- wcfsetup/install/files/acp/js/WCF.ACP.js | 33 ++++++++++++++++--- .../files/acp/templates/dataImport.tpl | 3 +- wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index f0e08fcd87..12fa84b11a 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -2232,12 +2232,19 @@ WCF.ACP.Import.Manager = Class.extend({ */ _proxy: null, + /** + * redirect URL + * @var string + */ + _redirectURL: '', + /** * Initializes the WCF.ACP.Importer object. * * @param array objectTypes + * @param string redirectURL */ - init: function(objectTypes) { + init: function(objectTypes, redirectURL) { this._currentAction = ''; this._index = -1; this._objectTypes = objectTypes; @@ -2246,6 +2253,7 @@ WCF.ACP.Import.Manager = Class.extend({ success: $.proxy(this._success, this), url: 'index.php/WorkerProxy/?t=' + SECURITY_TOKEN + SID_ARG_2ND }); + this._redirectURL = redirectURL; this._invoke(); }, @@ -2256,9 +2264,26 @@ WCF.ACP.Import.Manager = Class.extend({ _invoke: function() { this._index++; if (this._index >= this._objectTypes.length) { - this._dialog.find('.icon-spinner').removeClass('icon-spinner').addClass('icon-ok'); - - // TODO: invoke cleanup here + // cleanup + new WCF.Action.Proxy({ + autoSend: true, + data: { + actionName: 'resetMapping', + className: 'wcf\\system\\importer\\ImportHandler' + }, + success: $.proxy(function() { + this._dialog.find('.icon-spinner').removeClass('icon-spinner').addClass('icon-ok'); + this._dialog.find('h1').text(WCF.Language.get('wcf.acp.dataImport.completed')); + + var $form = $('
').appendTo(this._dialog.find('#workerContainer')); + $('').click($.proxy(function() { + window.location = this._redirectURL; + }, this)).appendTo($form); + + this._dialog.wcfDialog('render'); + }, this), + url: 'index.php/AJAXInvokeAction/?t=' + SECURITY_TOKEN + SID_ARG_2ND + }); } else { this._run( diff --git a/wcfsetup/install/files/acp/templates/dataImport.tpl b/wcfsetup/install/files/acp/templates/dataImport.tpl index 7d8c212b31..5539de9122 100644 --- a/wcfsetup/install/files/acp/templates/dataImport.tpl +++ b/wcfsetup/install/files/acp/templates/dataImport.tpl @@ -6,11 +6,12 @@ {if $queue|isset} WCF.Language.addObject({ 'wcf.acp.dataImport': '{lang}wcf.acp.dataImport{/lang}', + 'wcf.acp.dataImport.completed': '{lang}wcf.acp.dataImport.completed{/lang}', {implode from=$importers item=importer}'wcf.acp.dataImport.data.{@$importer}': '{lang}wcf.acp.dataImport.data.{@$importer}{/lang}'{/implode} }); var $queues = [ {implode from=$queue item=item}'{@$item}'{/implode} ]; - new WCF.ACP.Import.Manager($queues); + new WCF.ACP.Import.Manager($queues, '{link controller='RebuildData'}{/link}'); {/if} $('.jsImportSection').change(function(event) { diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 9f3d21d699..3aa8038952 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -178,6 +178,7 @@ + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 934773db4e..0331720781 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -177,6 +177,7 @@ Examples for medium ID detection: + -- 2.20.1