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