xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision dd6b2bfcc550270bb6d6778e11576148f71e4330)
1*dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\FontAwesome; ?>
2*dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\I18N; ?>
3*dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\View; ?>
4*dd6b2bfcSGreg Roach
5*dd6b2bfcSGreg Roach<h2 class="wt-page-title"><?= $title ?></h2>
6*dd6b2bfcSGreg Roach
7*dd6b2bfcSGreg Roach<form class="wt-page-content" method="post">
8*dd6b2bfcSGreg Roach    <?= csrf_field() ?>
9*dd6b2bfcSGreg Roach    <input type="hidden" name="ged" value="<?= e($tree->getName()) ?>">
10*dd6b2bfcSGreg Roach    <input type="hidden" name="xref" value="<?= e($record->getXref()) ?>">
11*dd6b2bfcSGreg Roach
12*dd6b2bfcSGreg Roach    <p class="text-muted small">
13*dd6b2bfcSGreg Roach        <?= I18N::translate('This page allows you to bypass the usual forms, and edit the underlying data directly. It is an advanced option, and you should not use it unless you understand the GEDCOM format. If you make a mistake here, it can be difficult to fix.') ?>
14*dd6b2bfcSGreg Roach    </p>
15*dd6b2bfcSGreg Roach    <p class="text-muted small">
16*dd6b2bfcSGreg Roach        <?= /* I18N: %s is a URL */ I18N::translate('You can download a copy of the GEDCOM specification from %s.', '<a href="https://wiki.webtrees.net/w/images-en/Ged551-5.pdf">https://wiki.webtrees.net/w/images-en/Ged551-5.pdf</a>') ?>
17*dd6b2bfcSGreg Roach    </p>
18*dd6b2bfcSGreg Roach
19*dd6b2bfcSGreg Roach    <div class="card">
20*dd6b2bfcSGreg Roach        <label class="card-header py-1 px-2" for="fact0">
21*dd6b2bfcSGreg Roach            <?= $record->getFullName() ?>
22*dd6b2bfcSGreg Roach        </label>
23*dd6b2bfcSGreg Roach        <div class="card-body form-control py-1 px-2">
24*dd6b2bfcSGreg Roach            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact0" rows="1">0 @<?= e($record->getXref()) ?>@ <?= e($record::RECORD_TYPE) ?></textarea>
25*dd6b2bfcSGreg Roach        </div>
26*dd6b2bfcSGreg Roach    </div>
27*dd6b2bfcSGreg Roach
28*dd6b2bfcSGreg Roach    <div id="raw-gedcom-list">
29*dd6b2bfcSGreg Roach        <?php foreach ($record->getFacts() as $fact) : ?>
30*dd6b2bfcSGreg Roach            <?php if (!$fact->isPendingDeletion()) : ?>
31*dd6b2bfcSGreg Roach                <div class="card my-2">
32*dd6b2bfcSGreg Roach                    <label class="card-header py-1 px-2 d-flex" for="fact-<?= e($fact->getFactId()) ?>">
33*dd6b2bfcSGreg Roach                        <?= view('icons/drag-handle') ?>
34*dd6b2bfcSGreg Roach                        <?= $fact->summary() ?>
35*dd6b2bfcSGreg Roach                    </label>
36*dd6b2bfcSGreg Roach                    <input type="hidden" name="fact_id[]" value="<?= e($fact->getFactId()) ?>">
37*dd6b2bfcSGreg Roach                    <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-<?= e($fact->getFactId()) ?>" name="fact[]" pattern="<?= e($pattern) ?>" rows="<?= 1 + preg_match_all('/\n/', $fact->getGedcom()) ?>"><?= e($fact->getGedcom()) ?></textarea>
38*dd6b2bfcSGreg Roach                </div>
39*dd6b2bfcSGreg Roach            <?php endif ?>
40*dd6b2bfcSGreg Roach        <?php endforeach ?>
41*dd6b2bfcSGreg Roach
42*dd6b2bfcSGreg Roach        <div class="card my-2">
43*dd6b2bfcSGreg Roach            <label class="card-header py-1 px-2" for="fact-add">
44*dd6b2bfcSGreg Roach                <?= I18N::translate('Add a fact') ?>
45*dd6b2bfcSGreg Roach            </label>
46*dd6b2bfcSGreg Roach            <input type="hidden" name="fact_id[]" value="<?= e($fact->getFactId()) ?>">
47*dd6b2bfcSGreg Roach            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" pattern="<?= e($pattern) ?>" rows="2"></textarea>
48*dd6b2bfcSGreg Roach        </div>
49*dd6b2bfcSGreg Roach    </div>
50*dd6b2bfcSGreg Roach
51*dd6b2bfcSGreg Roach    <div class="row form-group">
52*dd6b2bfcSGreg Roach        <div class="col-sm-9 offset-sm-3">
53*dd6b2bfcSGreg Roach            <button class="btn btn-primary" type="submit">
54*dd6b2bfcSGreg Roach                <?= FontAwesome::decorativeIcon('save') ?>
55*dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('save') ?>
56*dd6b2bfcSGreg Roach            </button>
57*dd6b2bfcSGreg Roach            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
58*dd6b2bfcSGreg Roach                <?= FontAwesome::decorativeIcon('cancel') ?>
59*dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
60*dd6b2bfcSGreg Roach            </a>
61*dd6b2bfcSGreg Roach        </div>
62*dd6b2bfcSGreg Roach    </div>
63*dd6b2bfcSGreg Roach</form>
64*dd6b2bfcSGreg Roach
65*dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
66*dd6b2bfcSGreg Roach<script>
67*dd6b2bfcSGreg Roach  new Sortable(document.getElementById("raw-gedcom-list"), {
68*dd6b2bfcSGreg Roach    handle: '.drag-handle'
69*dd6b2bfcSGreg Roach  });
70*dd6b2bfcSGreg Roach</script>
71*dd6b2bfcSGreg Roach<?php View::endpush() ?>
72