// Installation steps array
var installSteps = new Array();
+// Failed step
+var failedStep = '';
+var counterSuccess = 0;
+
// Init all installation steps
-installSteps[0] = '';
-installSteps[1] = '';
-installSteps[2] = '';
-installSteps[3] = '';
+installSteps[0] = 'import_tables_sql';
+installSteps[1] = 'import_menu_sql';
+installSteps[2] = 'write_local_config';
+installSteps[3] = 'install_extensions';
// Switches instaler by redirecting
function switchInstaller (installer) {
// Display process window
displayProcessWindow('install', '');
+
+ // Start installation loop
+ doInstallationLoop();
+
+ // Is success counter same as array size
+ if (counterSuccess != installSteps.length) {
+ // Display error message
+ displayErrorWindow('install', getAjaxContent());
+ }
+}
+
+// Does the "installation loop"
+function doInstallationLoop () {
+ // For-loop for all installation steps
+ for (var i = 0; i < installSteps.length; i++) {
+ // Output message
+ outputInstallationStepMessage(installSteps[i]);
+
+ // Initialize next step
+ if (!sendInstallationStepRequest(installSteps[i]) == true) {
+ // Failed step, so remember it for later display
+ failedStep = installSteps[i];
+
+ // Stop here
+ break;
+ }
+
+ // Did went okay
+ counterSuccess++;
+
+ // Wait a little
+ } // END - for
+}
+
+// Sends an "installation step" request out
+function sendInstallationStepRequest (step) {
+ // Send out the request
+ return sendAjaxRequest('install', 'do_step', '&step=' + step, true);
+}
+
+// Outputs a "step message"
+function outputInstallationStepMessage (step) {
+ // Set content
+ setProcessContent('install', step);
}