xref: /webtrees/resources/views/edit/raw-gedcom-fact.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
13b3db8adSGreg Roach<?php
23b3db8adSGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
59db6d3cbSGreg Roachuse Fisharebest\Webtrees\Fact;
648c46458SGreg Roachuse Fisharebest\Webtrees\Gedcom;
73b3db8adSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactAction;
83b3db8adSGreg Roachuse Fisharebest\Webtrees\I18N;
948c46458SGreg Roachuse Fisharebest\Webtrees\View;
109d7cdf93SGreg Roachuse Fisharebest\Webtrees\Webtrees;
113b3db8adSGreg Roach
129db6d3cbSGreg Roach/**
139db6d3cbSGreg Roach * @var Fact        $fact
149db6d3cbSGreg Roach * @var string      $title
159db6d3cbSGreg Roach * @var string|null $url
169db6d3cbSGreg Roach */
179db6d3cbSGreg Roach
183b3db8adSGreg Roach?>
19dd6b2bfcSGreg Roach
20dd6b2bfcSGreg Roach<h2 class="wt-page-title"><?= $title ?></h2>
21dd6b2bfcSGreg Roach
2248c46458SGreg Roach<form method="post" id="edit-raw-gedcom" action="<?= e(route(EditRawFactAction::class, ['tree' => $fact->record()->tree()->name(), 'xref' => $fact->record()->xref(), 'fact_id' => $fact->id()])) ?>" class="wt-page-content">
239db6d3cbSGreg Roach    <input type="hidden" name="url" value="<?= e($url ?? $fact->record()->url()) ?>">
24dd6b2bfcSGreg Roach
25315eb316SGreg Roach    <div class="form-text">
26dd6b2bfcSGreg 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.') ?>
27315eb316SGreg Roach    </div>
28315eb316SGreg Roach    <div class="form-text">
299d7cdf93SGreg Roach        <?= /* I18N: %s is a URL */ I18N::translate('You can download a copy of the GEDCOM specification from %s.', '<a href="' . e(Webtrees::GEDCOM_PDF) . '">' . e(Webtrees::GEDCOM_PDF) . '</a>') ?>
30315eb316SGreg Roach    </div>
31dd6b2bfcSGreg Roach
32dd6b2bfcSGreg Roach    <div class="card my-2">
33dd6b2bfcSGreg Roach        <label class="card-header py-1 px-2 d-flex" for="gedcom">
34dd6b2bfcSGreg Roach            <?= $fact->summary() ?>
35dd6b2bfcSGreg Roach        </label>
3648c46458SGreg Roach        <textarea class="card-body form-control py-1 px-2" data-wt-pattern="<?= e(Gedcom::REGEX_FACT) ?>" id="gedcom" name="gedcom" rows="<?= 5 + preg_match_all('/\n/', $fact->gedcom()) ?>" dir="ltr"><?= e($fact->gedcom()) ?></textarea>
37dd6b2bfcSGreg Roach    </div>
38dd6b2bfcSGreg Roach
399e3c2cf9SGreg Roach    <div class="row mb-3">
40dd6b2bfcSGreg Roach        <div class="col-sm-9 offset-sm-3">
41dd6b2bfcSGreg Roach            <button class="btn btn-primary" type="submit">
42d993d560SGreg Roach                <?= view('icons/save') ?>
43dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('save') ?>
44dd6b2bfcSGreg Roach            </button>
45e7766c08SGreg Roach            <a class="btn btn-secondary" href="<?= e($fact->record()->url()) ?>">
46d993d560SGreg Roach                <?= view('icons/cancel') ?>
47dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
48dd6b2bfcSGreg Roach            </a>
49dd6b2bfcSGreg Roach        </div>
50dd6b2bfcSGreg Roach    </div>
5181443e3cSGreg Roach
5281443e3cSGreg Roach    <?= csrf_field() ?>
53dd6b2bfcSGreg Roach</form>
54dd6b2bfcSGreg Roach
5548c46458SGreg Roach<?php View::push('javascript') ?>
5648c46458SGreg Roach<script>
5748c46458SGreg Roach  webtrees.textareaPatterns(document.getElementById('edit-raw-gedcom'));
5848c46458SGreg Roach</script>
5948c46458SGreg Roach<?php View::endpush() ?>
6048c46458SGreg Roach
61