2 * JavaScript for common installer functions
3 * --------------------------------------------------------------------
8 * --------------------------------------------------------------------
9 * Copyright (c) 2003 - 2009 by Roland Haeder
10 * Copyright (c) 2009 - 2012 by Mailer Developer Team
11 * For more information visit: http://mxchange.org
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
29 // Installation steps array
30 var installSteps = new Array();
34 var counterSuccess = 0;
36 // Init all installation steps
37 installSteps[0] = 'import_tables_sql';
38 installSteps[1] = 'import_menu_sql';
39 installSteps[2] = 'write_local_config';
40 installSteps[3] = 'install_extensions';
42 // Switches instaler by redirecting
43 function switchInstaller (installer) {
45 document.location.href='install.php?installer=' + installer;
48 // User has clicked on 'finish'
49 function doFinishInstallation () {
50 // First disable all buttons button
51 disableElement('input#next_page');
52 disableElement('input#previous_page');
53 disableElement('input#finish');
55 // Display process window
56 displayProcessWindow('install', '');
58 // Start installation loop delayed
59 window.setTimeout("doInstallationLoop()", 500);
61 // Is success counter same as array size
62 if (counterSuccess != installSteps.length) {
63 // Display error message
64 displayErrorWindow('install', getAjaxContent());
68 // Does the "installation loop"
69 function doInstallationLoop () {
70 // For-loop for all installation steps
71 for (var i = 0; i < installSteps.length; i++) {
73 outputInstallationStepMessage(installSteps[i]);
75 // Initialize next step
76 if (!sendInstallationStepRequest(installSteps[i]) == true) {
77 // Failed step, so remember it for later display
78 failedStep = installSteps[i];
91 // Sends an "installation step" request out
92 function sendInstallationStepRequest (step) {
93 // Send out the request
94 return sendAjaxRequest('install', 'do_step', '&step=' + step, true);
97 // Outputs a "step message"
98 function outputInstallationStepMessage (step) {
100 setProcessContent('install', step);