// Improve new install style (new progress bar)

This commit is contained in:
rMalie
2011-12-30 14:37:27 +00:00
parent c4c71dc5f9
commit bbf6c71e48
5 changed files with 48 additions and 63 deletions
+16 -30
View File
@@ -5,8 +5,6 @@ $(document).ready(function()
start_install();
});
is_installing_count = 0;
is_installing_max = 5;
current_step = 0;
function start_install()
{
@@ -17,7 +15,6 @@ function start_install()
$('.process_step').removeClass('fail').removeClass('success').hide();
$('.error_log').hide();
setTimeout(text_is_installing, 500);
$('#progress_bar').show();
$('#progress_bar .installing').show();
process_install();
@@ -27,10 +24,12 @@ function process_install(step)
{
if (!step)
step = process_steps[0];
$('.installing').hide().html(step.lang+' ...').fadeIn('slow');
$.ajax({
url: 'index.php',
data: step+'=true',
data: step.key+'=true',
dataType: 'json',
cache: false,
success: function(json)
@@ -38,11 +37,12 @@ function process_install(step)
// No error during this step
if (json.success)
{
$('#progress_bar_'+step).addClass('complete');
$('#process_step_'+step).show().addClass('success');
$('#process_step_'+step.key).show().addClass('success');
current_step++;
if (current_step >= process_steps.length)
{
$('#progress_bar .total .progress').animate({'width': '100%'}, 500);
// Installation finished
setTimeout(function()
{
@@ -51,6 +51,8 @@ function process_install(step)
}
else
{
$('#progress_bar .total .progress').animate({'width': '+='+process_percent+'%'}, 500);
// Process next step
process_install(process_steps[current_step]);
}
@@ -58,13 +60,13 @@ function process_install(step)
// An error occured during this step
else
{
install_error(step, json.message);
install_error(step.key, json.message);
}
},
// An error HTTP (page not found, json not valid, etc.) occured during this step
error: function()
{
install_error(step);
install_error(step.key);
}
});
}
@@ -73,12 +75,11 @@ function install_error(step, errors)
{
current_step = 0;
is_installing = false;
$('#process_step_'+step).show().addClass('fail');
$('#process_step_'+step.key).show().addClass('fail');
$.each(process_steps, function(k, v)
{
$('#progress_bar_'+v).removeClass('complete');
$('#progress_bar_'+v.key).removeClass('complete');
});
$('#progress_bar .installing').hide();
if (errors)
{
@@ -92,30 +93,15 @@ function install_error(step, errors)
display += '<li>'+v+'</li>';
});
display += '</ol>';
$('#process_step_'+step+' .error_log').html(display).show();
$('#process_step_'+step.key+' .error_log').html(display).show();
}
}
function install_success()
{
$('.installing').html(install_is_done);
return;
is_installing = false;
$('#install_process_form').slideUp();
$('#install_process_success').slideDown();
}
function text_is_installing()
{
if (!is_installing)
return;
var text = '';
for (var i = 0; i <= is_installing_count; i++)
text += '.';
$('#progress_bar .installing span').html(text);
is_installing_count++;
if (is_installing_count == is_installing_max)
is_installing_count = 0;
setTimeout(text_is_installing, 500);
}