X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=js%2Finstall-common.js;h=b7014e37a42659c156663e8d1883d3cc360a00cc;hp=f01a38b3fb34acfb26929c3292a98966e8200843;hb=e9da1508b2a3ccbf63adc999981674740a47e074;hpb=1d22c70e65e858422ee0d17a7612f4b5c0757a42 diff --git a/js/install-common.js b/js/install-common.js index f01a38b3fb..b7014e37a4 100644 --- a/js/install-common.js +++ b/js/install-common.js @@ -1,13 +1,8 @@ /** * JavaScript for common installer functions * -------------------------------------------------------------------- - * $Revision:: $ - * $Date:: $ - * $Tag:: 0.2.1-FINAL $ - * $Author:: $ - * -------------------------------------------------------------------- * Copyright (c) 2003 - 2009 by Roland Haeder - * Copyright (c) 2009 - 2012 by Mailer Developer Team + * Copyright (c) 2009 - 2015 by Mailer Developer Team * For more information visit: http://mxchange.org * * This program is free software; you can redistribute it and/or modify @@ -31,12 +26,12 @@ var installationSteps = new Array(); // Failed step var failedStep = ''; -var counterSuccess = 0; // Init all installation steps installationSteps[0] = 'import_tables_sql'; installationSteps[1] = 'import_menu_sql'; installationSteps[2] = 'install_extensions'; +installationSteps[3] = 'register_first_admin'; // Always keep as last step installationSteps[installationSteps.length] = 'write_local_config'; @@ -55,54 +50,28 @@ function doFinishInstallation () { // Display progress window displayProgressWindow('install', 'Init ...'); - // Start installation loop delayed - window.setTimeout('doInstallationLoop()', 500); - - // Wait here - window.setTimeout('doWait()', 500); -} - -// Do wait -function doWait () { - // Is still something to do? - if ((failedStep == '') && (counterSuccess != installationSteps.length)) { - // Wait one round more - window.setTimeout('doWait()', 500); - } else if ((failedStep == '') && (counterSuccess == installationSteps.length)) { - // Close window - closeProgressWindow('install', true, false); - - // Redirect to old 'finished' page - document.location.href = 'admin.php'; - } else if (failedStep != '') { - // Something happens that should not happen! - displayErrorWindow('install', 'failedStep=' + failedStep); - } -} - -// Update progress bar -function updateProgressBar () { - // Increment counter - counterSuccess++; + // Wait for window fader + $().ready(function () { + // Start installation loop delayed + window.setTimeout('doInstallationLoop()', 500); - // Do only update <= 100% values - if (counterSuccess <= installationSteps.length) { - // Update progress bar - $('#progressbar').progressbar({ - value: (counterSuccess / installationSteps.length * 100) - }); - } // END - if + // Wait here + $('body').delay(500); + }); } // Does the "installation loop" function doInstallationLoop () { + // Reset counter + counterSuccess = 0; + // For-loop for all installation steps for (var i = 0; i < installationSteps.length; i++) { // Output message outputInstallationStepMessage(installationSteps[i]); // Initialize next step - if (!sendInstallationStepRequest(i) == true) { + if (sendInstallationStepRequest(i) === false) { // Failed step, so remember it for later display failedStep = installationSteps[i]; @@ -114,14 +83,17 @@ function doInstallationLoop () { $('body').delay(500); // Update progress bar - updateProgressBar(); + updateProgressBar(installationSteps.length); } // END - for // Is success counter same as array size if (counterSuccess != installationSteps.length) { // Display error message displayErrorWindow('install', getAjaxContent() + ':' + counterSuccess + '/' + installationSteps.length + ':' + failedStep); - } // END - if + } else { + // Redirect to admin.php + document.location.href = 'admin.php'; + } } // Sends an "installation step" request out @@ -133,7 +105,7 @@ function sendInstallationStepRequest (i) { } // END - if // Send out the request - return sendAjaxRequest('install', 'do_step', '&step=' + installationSteps[i], true); + return sendAjaxRequest('install', 'do_step', '&step=' + installationSteps[i], false); } // Outputs a "step message"