// Installer can work with 18MO (under 32MO sub ajax queries are triggered)

This commit is contained in:
rMalie
2012-02-09 15:37:48 +00:00
parent f55c4bace4
commit 7969d242e9
9 changed files with 207 additions and 142 deletions
+65 -3
View File
@@ -17,6 +17,8 @@ function start_install()
$('.error_log').hide();
$('#progress_bar').show();
$('#progress_bar .installing').show();
process_pixel = parseInt($('#progress_bar .total').css('width')) / process_steps.length;
process_install();
}
@@ -52,11 +54,14 @@ function process_install(step)
}
else
{
$('#progress_bar .total .progress').animate({'width': '+='+process_percent+'%'}, 500);
$('#progress_bar .total span').html(Math.ceil(current_step * process_percent)+'%');
$('#progress_bar .total .progress').animate({'width': '+='+process_pixel+'px'}, 500);
$('#progress_bar .total span').html(Math.ceil(current_step * (100 / process_steps.length))+'%');
// Process next step
process_install(process_steps[current_step]);
if (process_steps[current_step].subtasks)
process_install_subtasks(process_steps[current_step]);
else
process_install(process_steps[current_step]);
}
}
// An error occured during this step
@@ -73,6 +78,63 @@ function process_install(step)
});
}
function process_install_subtasks(step)
{
$('.installing').hide().html(step.lang+' ...').fadeIn('slow');
process_install_subtask(step, 0);
}
function process_install_subtask(step, current_subtask)
{
var params = {};
params[step.key] = 'true';
params['subtask'] = current_subtask;
$.each(step.subtasks[current_subtask], function(k, v)
{
params[k] = v;
});
$.ajax({
url: 'index.php',
data: params,
dataType: 'json',
cache: false,
success: function(json)
{
// No error during this step
if (json && json.success === true)
{
current_subtask++;
var subtask_process_pixel = process_pixel / step.subtasks.length;
$('#progress_bar .total .progress').animate({'width': '+='+subtask_process_pixel+'px'}, 500);
$('#progress_bar .total span').html(Math.ceil((current_step * (100 / process_steps.length)) + Math.ceil(current_subtask * ((100 / process_steps.length) / step.subtasks.length)))+'%');
if (current_subtask >= step.subtasks.length)
{
current_step++;
$('#process_step_'+step.key).show().addClass('success');
if (process_steps[current_step].subtasks)
process_install_subtasks(process_steps[current_step]);
else
process_install(process_steps[current_step]);
}
else
process_install_subtask(step, current_subtask);
}
// An error occured during this step
else
{
install_error(step, (json) ? json.message : '');
}
},
// An error HTTP (page not found, json not valid, etc.) occured during this step
error: function()
{
install_error(step);
}
});
}
function install_error(step, errors)
{
current_step = 0;
+1 -1
View File
@@ -704,7 +704,7 @@ ul#optional_update {list-style-type:none;}
/* STEP 5 ******************************************/
#install_process_form{
min-height: 260px;
min-height: 300px;
}
#progress_bar {
display: none;
-1
View File
@@ -4,7 +4,6 @@
<!--
var install_is_done = '<?php echo addslashes($this->l('Done!')) ?>';
var process_steps = <?php echo Tools::jsonEncode($this->process_steps) ?>;
var process_percent = <?php echo 100 / count($this->process_steps) ?>;
-->
</script>