2009-01-01 00:23:29 +00:00
|
|
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
2008-12-28 10:14:12 +00:00
|
|
|
<script type="text/javascript">
|
2009-07-23 20:43:32 -07:00
|
|
|
var target_value;
|
|
|
|
|
var animation = null;
|
|
|
|
|
var delta = 1;
|
|
|
|
|
animate_progress_bar = function() {
|
|
|
|
|
var current_value = Number($(".gProgressBar div").css("width").replace("%", ""));
|
|
|
|
|
if (current_value != target_value) {
|
|
|
|
|
var new_value = Math.min(current_value + delta, target_value);
|
|
|
|
|
if (target_value - current_value > delta) {
|
|
|
|
|
delta += .075;
|
|
|
|
|
}
|
2009-07-28 20:31:24 -07:00
|
|
|
if (target_value == 100) {
|
|
|
|
|
new_value = 100;
|
|
|
|
|
}
|
2009-07-23 20:43:32 -07:00
|
|
|
$(".gProgressBar").progressbar("value", new_value);
|
|
|
|
|
animation = setTimeout(function() { animate_progress_bar(target_value); }, 100);
|
|
|
|
|
} else {
|
|
|
|
|
animation = null;
|
|
|
|
|
delta = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-28 10:14:12 +00:00
|
|
|
update = function() {
|
|
|
|
|
$.ajax({
|
2008-12-28 23:48:15 +00:00
|
|
|
url: "<?= url::site("admin/maintenance/run/$task->id?csrf=$csrf") ?>",
|
2008-12-28 10:14:12 +00:00
|
|
|
dataType: "json",
|
|
|
|
|
success: function(data) {
|
2009-07-23 20:43:32 -07:00
|
|
|
target_value = data.task.percent_complete;
|
|
|
|
|
if (!animation) {
|
|
|
|
|
animate_progress_bar();
|
|
|
|
|
}
|
2008-12-28 10:14:12 +00:00
|
|
|
$("#gStatus").html("" + data.task.status);
|
2009-01-06 08:59:09 +00:00
|
|
|
if (data.task.done) {
|
|
|
|
|
$("#gPauseButton").hide();
|
|
|
|
|
$("#gDoneButton").show();
|
|
|
|
|
} else {
|
2008-12-28 10:14:12 +00:00
|
|
|
setTimeout(update, 100);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2009-03-17 05:20:37 +00:00
|
|
|
$(".gProgressBar").progressbar({value: 0});
|
2008-12-28 10:14:12 +00:00
|
|
|
update();
|
2009-01-06 08:59:09 +00:00
|
|
|
dismiss = function() {
|
|
|
|
|
window.location.reload();
|
|
|
|
|
}
|
2008-12-28 10:14:12 +00:00
|
|
|
</script>
|
2009-02-09 05:28:30 +00:00
|
|
|
<div id="gProgress">
|
2009-06-19 13:25:42 -07:00
|
|
|
<h1> <?= $task->name ?> </h1>
|
2009-03-17 05:20:37 +00:00
|
|
|
<div class="gProgressBar"></div>
|
2009-06-19 13:25:42 -07:00
|
|
|
<div id="gStatus">
|
|
|
|
|
<?= t("Starting up...") ?>
|
|
|
|
|
</div>
|
2009-01-06 08:59:09 +00:00
|
|
|
<div>
|
2009-03-16 05:50:05 +00:00
|
|
|
<button id="gPauseButton" class="ui-state-default ui-corner-all" onclick="dismiss()"><?= t("Pause") ?></button>
|
2009-07-10 14:12:13 -07:00
|
|
|
<button id="gDoneButton" class="ui-state-default ui-corner-all" style="display: none" onclick="dismiss()"><?= t("Close") ?></button>
|
2009-01-06 08:59:09 +00:00
|
|
|
</div>
|
2008-12-28 10:14:12 +00:00
|
|
|
</div>
|