]> git.mxchange.org Git - mailer.git/blobdiff - js/install-common.js
Mailer project rwritten:
[mailer.git] / js / install-common.js
index f01a38b3fb34acfb26929c3292a98966e8200843..4d056852919352fad8b5c8fb26ad21d11ecbac54 100644 (file)
@@ -31,7 +31,6 @@ var installationSteps = new Array();
 
 // Failed step
 var failedStep = '';
-var counterSuccess = 0;
 
 // Init all installation steps
 installationSteps[0] = 'import_tables_sql';
@@ -55,43 +54,14 @@ function doFinishInstallation () {
        // Display progress window
        displayProgressWindow('install', 'Init ...');
 
-       // Start installation loop delayed
-       window.setTimeout('doInstallationLoop()', 500);
+       // Wait for window fader
+       $().ready(function () {
+               // 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++;
-
-       // 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"
@@ -102,7 +72,7 @@ function doInstallationLoop () {
                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,7 +84,7 @@ function doInstallationLoop () {
                $('body').delay(500);
 
                // Update progress bar
-               updateProgressBar();
+               updateProgressBar(installationSteps.length);
        } // END - for
 
        // Is success counter same as array size
@@ -133,7 +103,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"