X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=js%2Finstall-common.js;h=cfe7e32494389963706769b8198fe321946d9d37;hb=refs%2Fheads%2Fserver-0.2.1-FINAL%2Fwernis-schleuder-de;hp=87fcbda4b0b577d8f9d87ba2d90cc0e8296ad492;hpb=df4166450ac4788f58931bd5d30c617432a63f9d;p=mailer.git diff --git a/js/install-common.js b/js/install-common.js index 87fcbda4b0..cfe7e32494 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 - 2016 by Mailer Developer Team * For more information visit: http://mxchange.org * * This program is free software; you can redistribute it and/or modify @@ -27,27 +22,95 @@ */ // Installation steps array -var installSteps = new Array(); +var installationSteps = new Array(); + +// Failed step +var failedStep = ''; // Init all installation steps -installSteps[0] = ''; -installSteps[1] = ''; -installSteps[2] = ''; -installSteps[3] = ''; +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'; // Switches instaler by redirecting function switchInstaller (installer) { // Switch installer - document.location.href='install.php?installer=' + installer; + document.location.href = 'install.php?installer=' + installer; } // User has clicked on 'finish' function doFinishInstallation () { // First disable all buttons button - disableElement('input#next_page'); - disableElement('input#previous_page'); - disableElement('input#finish'); + resetFooterNavigation(); + + // Display progress window + displayProgressWindow('install', 'Init ...'); + + // Wait for window fader + $().ready(function () { + // Start installation loop delayed + window.setTimeout('doInstallationLoop()', 500); + + // 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) === false) { + // Failed step, so remember it for later display + failedStep = installationSteps[i]; + + // Stop here + break; + } // END - if + + // Wait a little + $('body').delay(500); + + // Update progress bar + 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); + } else { + // Redirect to admin.php + document.location.href = 'admin.php'; + } +} + +// Sends an "installation step" request out +function sendInstallationStepRequest (i) { + // Is it set? + if (installationSteps[i] == undefined) { + // Not set installation step, so don't send it out + throw new 'installationSteps[' + i + '] is not set.'; + } // END - if + + // Send out the request + return sendAjaxRequest('install', 'do_step', '&step=' + installationSteps[i], false); +} - // Display process window - displayProcessWindow('install', ''); +// Outputs a "step message" +function outputInstallationStepMessage (step) { + // Set content + // @TODO Progress bar is out-of-order: + '
' + setProgressContent('install', step); }