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