xref: /webtrees/resources/views/admin/upgrade/steps.phtml (revision 7c2c99fad7cacd17c98be88238ff735d82c6351b)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
4use Fisharebest\Webtrees\I18N;
5use Fisharebest\Webtrees\View;
6
7/**
8 * @var array<string,string> $steps
9 * @var string               $title
10 */
11
12?>
13
14<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>
15
16<h1><?= $title ?></h1>
17
18<p>
19    <?= I18N::translate('It can take several minutes to download and install the upgrade. Be patient.') ?>
20</p>
21
22<dl>
23    <?php foreach ($steps as $url => $text) : ?>
24    <dt><?= $text ?></dt>
25    <dd class="wt-ajax-load" data-url="<?= e($url) ?>"></dd>
26    <?php endforeach ?>
27</dl>
28
29<?php View::push('javascript') ?>
30<script>
31  function nextAjaxStep() {
32    $("dd:empty:first").each(function(n, el) {
33      $(el).load(el.dataset.url, {}, function (responseText, textStatus, req) {
34        el.innerHTML = responseText;
35        if (textStatus === "error") {
36          $(".wt-ajax-load").removeClass("wt-ajax-load");
37        } else {
38          nextAjaxStep();
39        }
40      });
41
42      // Only process one callback at a time.
43      return false;
44    });
45  }
46
47  nextAjaxStep();
48</script>
49<?php View::endpush() ?>
50