xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision 75b444f74a3f1005e5f45f80589c0e892ad69b7b)
1*75b444f7SGreg Roach<?php use Fisharebest\Webtrees\I18N;
2*75b444f7SGreg Roachuse Fisharebest\Webtrees\View; ?>
3*75b444f7SGreg Roach<?php ?>
4dd6b2bfcSGreg Roach
5dd6b2bfcSGreg Roach<h2 class="wt-page-title"><?= $title ?></h2>
6dd6b2bfcSGreg Roach
7dd6b2bfcSGreg Roach<form class="wt-page-content" method="post">
8dd6b2bfcSGreg Roach    <?= csrf_field() ?>
9aa6f03bbSGreg Roach    <input type="hidden" name="ged" value="<?= e($tree->name()) ?>">
10c0935879SGreg Roach    <input type="hidden" name="xref" value="<?= e($record->xref()) ?>">
11dd6b2bfcSGreg Roach
12dd6b2bfcSGreg Roach    <p class="text-muted small">
13dd6b2bfcSGreg 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.') ?>
14dd6b2bfcSGreg Roach    </p>
15dd6b2bfcSGreg Roach    <p class="text-muted small">
16dd6b2bfcSGreg 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>') ?>
17dd6b2bfcSGreg Roach    </p>
18dd6b2bfcSGreg Roach
19dd6b2bfcSGreg Roach    <div class="card">
20dd6b2bfcSGreg Roach        <label class="card-header py-1 px-2" for="fact0">
2139ca88baSGreg Roach            <?= $record->fullName() ?>
22dd6b2bfcSGreg Roach        </label>
23dd6b2bfcSGreg Roach        <div class="card-body form-control py-1 px-2">
24b51c2707SGreg Roach            <textarea class="card-body form-control py-1 px-2" id="fact0" rows="1" dir="ltr">0 @<?= e($record->xref()) ?>@ <?= e($record::RECORD_TYPE) ?></textarea>
25dd6b2bfcSGreg Roach        </div>
26dd6b2bfcSGreg Roach    </div>
27dd6b2bfcSGreg Roach
28*75b444f7SGreg Roach    <div id="wt-sortable-list">
2930158ae7SGreg Roach        <?php foreach ($record->facts() as $fact) : ?>
30dd6b2bfcSGreg Roach            <?php if (!$fact->isPendingDeletion()) : ?>
31dd6b2bfcSGreg Roach                <div class="card my-2">
329ba7eeb1SGreg Roach                    <label class="card-header py-1 px-2 d-flex" for="fact-<?= e($fact->id()) ?>">
3310e872f2SGreg Roach                        <span class="drag-handle">
34dd6b2bfcSGreg Roach                            <?= view('icons/drag-handle') ?>
3510e872f2SGreg Roach                        </span>
36dd6b2bfcSGreg Roach                        <?= $fact->summary() ?>
37dd6b2bfcSGreg Roach                    </label>
389ba7eeb1SGreg Roach                    <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
39c67a93abSGreg Roach                    <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-<?= e($fact->id()) ?>" name="fact[]" rows="<?= 1 + preg_match_all('/\n/', $fact->gedcom()) ?>"><?= e($fact->gedcom()) ?></textarea>
40dd6b2bfcSGreg Roach                </div>
41dd6b2bfcSGreg Roach            <?php endif ?>
42dd6b2bfcSGreg Roach        <?php endforeach ?>
43dd6b2bfcSGreg Roach
44dd6b2bfcSGreg Roach        <div class="card my-2">
45dd6b2bfcSGreg Roach            <label class="card-header py-1 px-2" for="fact-add">
46dd6b2bfcSGreg Roach                <?= I18N::translate('Add a fact') ?>
47dd6b2bfcSGreg Roach            </label>
489ba7eeb1SGreg Roach            <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
49c67a93abSGreg Roach            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" rows="5"></textarea>
50dd6b2bfcSGreg Roach        </div>
51dd6b2bfcSGreg Roach    </div>
52dd6b2bfcSGreg Roach
53dd6b2bfcSGreg Roach    <div class="row form-group">
54dd6b2bfcSGreg Roach        <div class="col-sm-9 offset-sm-3">
55dd6b2bfcSGreg Roach            <button class="btn btn-primary" type="submit">
56d993d560SGreg Roach                <?= view('icons/save') ?>
57dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('save') ?>
58dd6b2bfcSGreg Roach            </button>
59dd6b2bfcSGreg Roach            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
60d993d560SGreg Roach                <?= view('icons/cancel') ?>
61dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
62dd6b2bfcSGreg Roach            </a>
63dd6b2bfcSGreg Roach        </div>
64dd6b2bfcSGreg Roach    </div>
65dd6b2bfcSGreg Roach</form>
66dd6b2bfcSGreg Roach
67dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
68dd6b2bfcSGreg Roach<script>
69*75b444f7SGreg Roach    new Sortable(document.getElementById("wt-sortable-list"), {
70*75b444f7SGreg Roach        handle: ".drag-handle",
71dd6b2bfcSGreg Roach    });
72dd6b2bfcSGreg Roach</script>
73dd6b2bfcSGreg Roach<?php View::endpush() ?>
74