1<?php 2 3use Fisharebest\Webtrees\Gedcom; 4use Fisharebest\Webtrees\GedcomRecord; 5use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordAction; 6use Fisharebest\Webtrees\I18N; 7use Fisharebest\Webtrees\Tree; 8use Fisharebest\Webtrees\View; 9use Fisharebest\Webtrees\Webtrees; 10 11/** 12 * @var string $level0 13 * @var GedcomRecord $record 14 * @var string $title 15 * @var Tree $tree 16 */ 17 18?> 19 20<h2 class="wt-page-title"><?= $title ?></h2> 21 22<form method="post" id="edit-raw-gedcom" action="<?= e(route(EditRawRecordAction::class, ['tree' => $tree->name(), 'xref' => $record->xref()])) ?>" class="wt-page-content"> 23 <div class="form-text"> 24 <?= 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.') ?> 25 <br> 26 <?= /* 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>') ?> 27 </div> 28 29 <div class="card"> 30 <label class="card-header py-1 px-2" for="level0"> 31 <?= $record->fullName() ?> 32 </label> 33 <textarea class="card-body form-control py-1 px-2" id="level0" name="level0" rows="1" dir="ltr" readonly><?= e($level0) ?></textarea> 34 </div> 35 36 <div class="wt-sortable-list"> 37 <?php foreach ($record->facts([], false, null, true) as $fact) : ?> 38 <div class="card my-2 wt-sortable-item"> 39 <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>"> 40 <div class="card-header"> 41 <?= view('edit/reorder-card-header', ['title' => $fact->summary()]) ?> 42 </div> 43 <label class="visually-hidden" for="fact-<?= e($fact->id()) ?>"><?= $fact->summary() ?></label> 44 45 <?php if ($fact->tag() === 'OBJE:FILE') : ?> 46 <div class="alert alert-warning mb-0"> 47 <?= view('icons/warning') ?> 48 <?= I18N::translate('If you modify the filename, you should also rename the file.') ?> 49 </div> 50 <?php endif ?> 51 52 <textarea class="card-body form-control py-1 px-2" data-wt-pattern="<?= e(Gedcom::REGEX_FACT) ?>" dir="ltr" id="fact-<?= e($fact->id()) ?>" name="fact[]" rows="<?= 1 + preg_match_all('/\n/', $fact->gedcom()) ?>"><?= e($fact->gedcom()) ?></textarea> 53 </div> 54 <?php endforeach ?> 55 56 <div class="card my-2"> 57 <label class="card-header py-1 px-2" for="fact-add"> 58 <?= I18N::translate('Add a fact') ?> 59 </label> 60 <input type="hidden" name="fact_id[]" value=""> 61 <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" rows="5"></textarea> 62 </div> 63 </div> 64 65 <div class="row mb-3"> 66 <div class="col-sm-9 offset-sm-3"> 67 <button class="btn btn-primary" type="submit"> 68 <?= view('icons/save') ?> 69 <?= /* I18N: A button label. */ I18N::translate('save') ?> 70 </button> 71 <a class="btn btn-secondary" href="<?= e($record->url()) ?>"> 72 <?= view('icons/cancel') ?> 73 <?= /* I18N: A button label. */ I18N::translate('cancel') ?> 74 </a> 75 </div> 76 </div> 77 78 <?= csrf_field() ?> 79</form> 80 81<?php View::push('javascript') ?> 82<script> 83 new Sortable(document.querySelector('.wt-sortable-list'), { 84 handle: '.card-header', 85 }); 86 87 webtrees.textareaPatterns(document.getElementById('edit-raw-gedcom')); 88</script> 89<?php View::endpush() ?> 90