diff options
| author | Greg Roach <fisharebest@gmail.com> | 2021-05-11 13:48:42 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2021-05-14 14:10:37 +0100 |
| commit | efd4768b0eab1f325771cdbc6181ff84f85f2149 (patch) | |
| tree | 8eb6d588142b030f6080134fbd972a61f5baf14a /resources/views | |
| parent | 9b80d2d98159cfc0110760b8e215998864838ff9 (diff) | |
| download | webtrees-efd4768b0eab1f325771cdbc6181ff84f85f2149.tar.gz webtrees-efd4768b0eab1f325771cdbc6181ff84f85f2149.tar.bz2 webtrees-efd4768b0eab1f325771cdbc6181ff84f85f2149.zip | |
Working on GEDCOM elements
Diffstat (limited to 'resources/views')
24 files changed, 150 insertions, 991 deletions
diff --git a/resources/views/admin/control-panel.phtml b/resources/views/admin/control-panel.phtml index a36faf3b6e..9bd1da54f3 100644 --- a/resources/views/admin/control-panel.phtml +++ b/resources/views/admin/control-panel.phtml @@ -691,7 +691,7 @@ use Illuminate\Support\Collection; <li> <span class="fa-li"><?= view('icons/tag') ?></span> <a href="<?= e(route(ModulesCustomTagsPage::class)) ?>"> - <?= I18N::translate('Custom tags') ?> + <?= I18N::translate('Custom GEDCOM tags') ?> </a> <?= view('components/badge', ['count' => $custom_tags_modules_enabled->count(), 'total' => $custom_tags_modules_disabled->count(), 'context' => 'primary']) ?> </li> diff --git a/resources/views/cards/add-associate.phtml b/resources/views/cards/add-associate.phtml deleted file mode 100644 index e69e934f9e..0000000000 --- a/resources/views/cards/add-associate.phtml +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -use Fisharebest\Webtrees\Functions\FunctionsEdit; -use Fisharebest\Webtrees\I18N; -use Fisharebest\Webtrees\Tree; - -/** - * @var string $id - * @var int $level - * @var Tree $tree - */ - -?> - -<div class="card mb-4"> - <a class="card-header" href="#" data-toggle="collapse" data-target="#add-associate-<?= e($id) ?>" aria-expanded="false" aria-controls="add-associate"> - <?= I18N::translate('Associate') ?> - </a> - - <div class="card-body collapse" id="add-associate-<?= e($id) ?>"> - <?= FunctionsEdit::addSimpleTag($tree, $level . ' _ASSO') ?> - <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' RELA') ?> - <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' NOTE') ?> - <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' SHARED_NOTE') ?> - </div> -</div> diff --git a/resources/views/cards/add-fact.phtml b/resources/views/cards/add-fact.phtml deleted file mode 100644 index e8ae311ecc..0000000000 --- a/resources/views/cards/add-fact.phtml +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -use Fisharebest\Webtrees\Functions\FunctionsEdit; -use Fisharebest\Webtrees\GedcomTag; -use Fisharebest\Webtrees\Tree; - -/** - * @var string $tag - * @var Tree $tree - */ - -?> - -<div class="card mb-4"> - <a class="card-header" href="#" data-toggle="collapse" data-target="#add-fact-<?= $tag ?>" aria-expanded="false" aria-controls="add-fact-<?= $tag ?>"> - <?= GedcomTag::getLabel($tag) ?> - </a> - - <div class="card-body collapse" id="add-fact-<?= $tag ?>"> - <?php FunctionsEdit::addSimpleTags($tree, $tag) ?> - </div> -</div> diff --git a/resources/views/cards/add-media-object.phtml b/resources/views/cards/add-media-object.phtml deleted file mode 100644 index f7dbef1153..0000000000 --- a/resources/views/cards/add-media-object.phtml +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -use Fisharebest\Webtrees\Functions\FunctionsEdit; -use Fisharebest\Webtrees\I18N; -use Fisharebest\Webtrees\Tree; - -/** - * @var int $level - * @var Tree $tree - */ - -?> - -<div class="card mb-4"> - <a class="card-header" href="#" data-toggle="collapse" data-target="#add-media-object" aria-expanded="false" aria-controls="add-media-object"> - <?= I18N::translate('Add a media object') ?> - </a> - - <div class="card-body collapse" id="add-media-object"> - <?= FunctionsEdit::addSimpleTag($tree, $level . ' OBJE') ?> - </div> -</div> diff --git a/resources/views/cards/add-note.phtml b/resources/views/cards/add-note.phtml deleted file mode 100644 index 85316052d5..0000000000 --- a/resources/views/cards/add-note.phtml +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -use Fisharebest\Webtrees\Functions\FunctionsEdit; -use Fisharebest\Webtrees\I18N; -use Fisharebest\Webtrees\Tree; - -/** - * @var int $level - * @var Tree $tree - */ - -?> - -<div class="card mb-4"> - <a class="card-header" href="#" data-toggle="collapse" data-target="#add-note" aria-expanded="false" aria-controls="add-note"> - <?= I18N::translate('Note') ?> - </a> - - <div class="card-body collapse" id="add-note"> - <?= FunctionsEdit::addSimpleTag($tree, $level . ' NOTE') ?> - </div> -</div> diff --git a/resources/views/cards/add-restriction.phtml b/resources/views/cards/add-restriction.phtml deleted file mode 100644 index 263ed56c33..0000000000 --- a/resources/views/cards/add-restriction.phtml +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -use Fisharebest\Webtrees\Functions\FunctionsEdit; -use Fisharebest\Webtrees\I18N; -use Fisharebest\Webtrees\Tree; - -/** - * @var int $level - * @var Tree $tree - */ - -?> - -<div class="card mb-4"> - <a class="card-header" href="#" data-toggle="collapse" data-target="#add-restriction" aria-expanded="false" aria-controls="add-restriction"> - <?= I18N::translate('Restriction') ?> - </a> - - <div class="card-body collapse" id="add-restriction"> - <?= FunctionsEdit::addSimpleTag($tree, $level . ' RESN') ?> - </div> -</div> diff --git a/resources/views/cards/add-shared-note.phtml b/resources/views/cards/add-shared-note.phtml deleted file mode 100644 index 03cf4c4124..0000000000 --- a/resources/views/cards/add-shared-note.phtml +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -use Fisharebest\Webtrees\Functions\FunctionsEdit; -use Fisharebest\Webtrees\I18N; -use Fisharebest\Webtrees\Tree; - -/** - * @var int $level - * @var Tree $tree - */ - -?> - -<div class="card mb-4"> - <a class="card-header" href="#" data-toggle="collapse" data-target="#add-note-object" aria-expanded="false" aria-controls="add-note-object"> - <?= I18N::translate('Shared note') ?> - </a> - - <div class="card-body collapse" id="add-note-object"> - <?= FunctionsEdit::addSimpleTag($tree, $level . ' SHARED_NOTE') ?> - </div> -</div> diff --git a/resources/views/cards/add-sour-data-even.phtml b/resources/views/cards/add-sour-data-even.phtml deleted file mode 100644 index 943e2b153b..0000000000 --- a/resources/views/cards/add-sour-data-even.phtml +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -use Fisharebest\Webtrees\Functions\FunctionsEdit; -use Fisharebest\Webtrees\I18N; -use Fisharebest\Webtrees\Tree; - -/** - * @var Tree $tree - */ - -?> - -<div class="card mb-4"> - <a class="card-header" href="#" data-toggle="collapse" data-target="#add-sour-data-even-object" aria-expanded="false" aria-controls="add-sour-data-even-object"> - <?= I18N::translate('Add an event') ?> - </a> - - <div class="card-body collapse" id="add-sour-data-even-object"> - <?= FunctionsEdit::addSimpleTag($tree, '2 EVEN') ?> - <?= FunctionsEdit::addSimpleTag($tree, '3 DATE') ?> - <?= FunctionsEdit::addSimpleTag($tree, '3 PLAC') ?> - </div> -</div> diff --git a/resources/views/cards/add-source-citation.phtml b/resources/views/cards/add-source-citation.phtml deleted file mode 100644 index bcc3c744e7..0000000000 --- a/resources/views/cards/add-source-citation.phtml +++ /dev/null @@ -1,80 +0,0 @@ -<?php - -use Fisharebest\Webtrees\Fact; -use Fisharebest\Webtrees\Functions\FunctionsEdit; -use Fisharebest\Webtrees\Gedcom; -use Fisharebest\Webtrees\GedcomTag; -use Fisharebest\Webtrees\I18N; -use Fisharebest\Webtrees\Tree; -use Illuminate\Support\Collection; - -/** - * @var string $bdm - * @var bool $full_citations - * @var int $level - * @var string $prefer_level2_sources - * @var string $quick_required_facts - * @var string $quick_required_famfacts - * @var Tree $tree - */ - -?> - -<div class="card mb-4"> - <a class="card-header" href="#" data-toggle="collapse" data-target="#add-source-citation" aria-expanded="false" aria-controls="add-source-citation"> - <?= I18N::translate('Source') ?> - </a> - - <div class="card-body collapse" id="add-source-citation"> - <?= FunctionsEdit::addSimpleTag($tree, $level . ' SOUR') ?> - - <?php if ($level === 1) : ?> - <div class="row"> - <div class="col-sm-3"></div> - <div class="col-sm-9"> - <?php if (str_contains($bdm, 'B')) : ?> - <label> - <input type="checkbox" name="SOUR_INDI" <?= $prefer_level2_sources === '2' ? 'checked' : '' ?> value="1"> - <?= I18N::translate('Individual') ?> - </label> - <?php if (preg_match_all('/(' . Gedcom::REGEX_TAG . ')/', $quick_required_facts, $matches)) : ?> - <?php foreach (Fact::sortFactTags(new Collection($matches[1])) as $match) : ?> - <label> - <input type="checkbox" name="SOUR_<?= $match ?>" <?= $prefer_level2_sources === '1' ? 'checked' : '' ?> value="1"> - <?= GedcomTag::getLabel($match) ?> - </label> - <?php endforeach ?> - <?php endif ?> - <?php endif ?> - - <?php if (str_contains($bdm, 'M')) : ?> - <label> - <input type="checkbox" name="SOUR_FAM" <?= $prefer_level2_sources === '2' ? 'checked' : '' ?> value="1"> - <?= I18N::translate('Family') ?> - </label> - <?php if (preg_match_all('/(' . Gedcom::REGEX_TAG . ')/', $quick_required_famfacts, $matches)) : ?> - <?php foreach (Fact::sortFactTags(new Collection($matches[1])) as $match) : ?> - <label> - <input type="checkbox" name="SOUR_<?= $match ?>" <?= $prefer_level2_sources === '1' ? 'checked' : '' ?> value="1"> - <?= GedcomTag::getLabel($match) ?> - </label> - <?php endforeach ?> - <?php endif ?> - <?php endif ?> - </div> - </div> - <?php endif ?> - - <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' PAGE') ?> - <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' DATA') ?> - <?= FunctionsEdit::addSimpleTag($tree, ($level + 2) . ' TEXT') ?> - - <?php if ($full_citations) : ?> - <?= FunctionsEdit::addSimpleTag($tree, ($level + 2) . ' DATE', '', I18N::translate('Date of entry in original source')) ?> - <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' QUAY') ?> - <?php endif ?> - - <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' OBJE') ?> - <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' SHARED_NOTE') ?> - </div> -</div> diff --git a/resources/views/edit/add-fact.phtml b/resources/views/edit/add-fact.phtml deleted file mode 100644 index 6bf82e34ac..0000000000 --- a/resources/views/edit/add-fact.phtml +++ /dev/null @@ -1,110 +0,0 @@ -<?php - -use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Config; -use Fisharebest\Webtrees\Functions\FunctionsEdit; -use Fisharebest\Webtrees\GedcomRecord; -use Fisharebest\Webtrees\GedcomTag; -use Fisharebest\Webtrees\Http\RequestHandlers\EditFactAction; -use Fisharebest\Webtrees\I18N; -use Fisharebest\Webtrees\Tree; -use Ramsey\Uuid\Uuid; - -/** - * @var string $fact - * @var GedcomRecord $record - * @var string $title - * @var Tree $tree - */ - -?> - -<h2 class="wt-page-title"><?= $title ?></h2> - -<form method="post" action="<?= e(route(EditFactAction::class, ['tree' => $tree->name(), 'xref' => $record->xref()])) ?>" class="wt-page-content"> - <?= csrf_field() ?> - - <?php FunctionsEdit::createAddForm($tree, $fact) ?> - - <?php if ($record->tag() === 'SOUR' && $fact === 'DATA') : ?> - <?= view('cards/add-note', ['level' => 2, 'tree' => $tree]) ?> - <?= view('cards/add-shared-note', ['level' => 2, 'tree' => $tree]) ?> - <?php endif ?> - - <?php if (($record->tag() === 'INDI' || $record->tag() === 'FAM') && $fact !== 'OBJE' && $fact !== 'NOTE' && $fact !== 'SHARED_NOTE' && $fact !== 'REPO' && $fact !== 'SOUR' && $fact !== 'SUBM' && $fact !== 'ASSO' && $fact !== 'ALIA' && $fact !== 'SEX') : ?> - <?= view('cards/add-source-citation', [ - 'level' => 2, - 'full_citations' => $tree->getPreference('FULL_SOURCES'), - 'tree' => $tree, - ]) ?> - - <?php if ($tree->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($tree)) : ?> - <?= view('cards/add-media-object', [ - 'level' => 2, - 'tree' => $tree, - ]) ?> - <?php endif ?> - - <?php if ($fact !== 'NOTE') : ?> - <?= view('cards/add-note', [ - 'level' => 2, - 'tree' => $tree, - ]) ?> - - <?= view('cards/add-shared-note', [ - 'level' => 2, - 'tree' => $tree, - ]) ?> - <?php endif ?> - - <?= view('cards/add-associate', [ - 'id' => Uuid::uuid4()->toString(), - 'level' => 2, - 'tree' => $tree, - ]) ?> - <?php if (in_array($fact, Config::twoAssociates(), true)) : ?> - <?= view('cards/add-associate', [ - 'id' => Uuid::uuid4()->toString(), - 'level' => 2, - 'tree' => $tree, - ]) ?> - <?php endif ?> - - <?= view('cards/add-restriction', [ - 'level' => 2, - 'tree' => $tree, - ]) ?> - <?php endif ?> - - <div class="form-group row"> - <label class="col-sm-3 col-form-label" for="keep_chan"> - <?= I18N::translate('Last change') ?> - </label> - <div class="col-sm-9"> - <?= view('components/checkbox-inline', ['label' => I18N::translate('Keep the existing “last change” information'), 'name' => 'keep_chan', 'checked' => (bool) $tree->getPreference('NO_UPDATE_CHAN')]) ?> - <?= GedcomTag::getLabelValue('DATE', view('components/datetime', ['timestamp' => $record->lastChangeTimestamp()])) ?> - <?= GedcomTag::getLabelValue('_WT_USER', e($record->lastChangeUser())) ?> - </div> - </div> - - <div class="form-group row"> - <div class="col-sm-3 wt-page-options-label"> - </div> - <div class="col-sm-9 wt-page-options-value"> - <button class="btn btn-primary" type="submit"> - <?= view('icons/save') ?> - <?= /* I18N: A button label. */ - I18N::translate('save') ?> - </button> - <a class="btn btn-secondary" href="<?= e($record->url()) ?>"> - <?= view('icons/cancel') ?> - <?= /* I18N: A button label. */ - I18N::translate('cancel') ?> - </a> - </div> - </div> -</form> - -<?= view('modals/on-screen-keyboard') ?> -<?= view('modals/ajax') ?> -<?= view('edit/initialize-calendar-popup') ?> diff --git a/resources/views/edit/edit-fact.phtml b/resources/views/edit/edit-fact.phtml index fc1350343c..3af77ad995 100644 --- a/resources/views/edit/edit-fact.phtml +++ b/resources/views/edit/edit-fact.phtml @@ -1,14 +1,10 @@ <?php -use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Config; use Fisharebest\Webtrees\Fact; -use Fisharebest\Webtrees\Functions\FunctionsEdit; use Fisharebest\Webtrees\Http\RequestHandlers\EditFactAction; use Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactPage; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Tree; -use Ramsey\Uuid\Uuid; /** * @var bool $can_edit_raw @@ -26,84 +22,7 @@ use Ramsey\Uuid\Uuid; <?= csrf_field() ?> <input type="hidden" name="url" value="<?= e($url) ?>"> - <?php FunctionsEdit::createEditForm($fact) ?> - - <?php - $level1type = $fact->getTag(); - switch ($fact->record()->tag()) { - case 'SOUR': - if ($level1type === 'DATA') { - // SOUR:DATA facts may take a NOTE (but the SOUR record may not). - echo view('cards/add-note', [ - 'level' => 2, - 'tree' => $tree, - ]); - echo view('cards/add-shared-note', [ - 'level' => 2, - 'tree' => $tree, - ]); - // SOUR:DATA facts may also take multiple EVEN. - echo view('cards/add-sour-data-even', [ - 'tree' => $tree, - ]); - } - break; - case 'FAM': - case 'INDI': - // FAM and INDI records have real facts. They can take NOTE/SOUR/OBJE/etc. - if ($level1type !== 'SEX' && $level1type !== 'NOTE' && $level1type !== 'ALIA') { - if ($level1type !== 'SOUR') { - echo view('cards/add-source-citation', [ - 'level' => 2, - 'full_citations' => $tree->getPreference('FULL_SOURCES'), - 'tree' => $tree, - ]); - } - if ($level1type !== 'OBJE') { - if ($tree->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($tree)) { - echo view('cards/add-media-object', [ - 'level' => 2, - 'tree' => $tree, - ]); - } - } - echo view('cards/add-note', [ - 'level' => 2, - 'tree' => $tree, - ]); - echo view('cards/add-shared-note', [ - 'level' => 2, - 'tree' => $tree, - ]); - if ($level1type !== 'ASSO' && $level1type !== 'NOTE' && $level1type !== 'SOUR') { - echo view('cards/add-associate', [ - 'id' => Uuid::uuid4()->toString(), - 'level' => 2, - 'tree' => $tree, - ]); - } - // allow to add godfather and godmother for CHR fact or best man and bridesmaid for MARR fact in one window - if (in_array($level1type, Config::twoAssociates(), true)) { - echo view('cards/add-associate', [ - 'id' => Uuid::uuid4()->toString(), - 'level' => 2, - 'tree' => $tree, - ]); - } - if ($level1type !== 'SOUR') { - echo view('cards/add-restriction', [ - 'level' => 2, - 'tree' => $tree, - ]); - } - } - break; - default: - // Other types of record do not have these lower-level records - break; - } - - ?> + <?= view('edit/edit-gedcom-fields', ['gedcom' => $fact->insertMissingSubtags(), 'hierarchy' => explode(':', $fact->tag()), 'tree' => $fact->record()->tree(), 'prefix' => '']) ?> <div class="form-group row"> <div class="col-sm-3 wt-page-options-label"> diff --git a/resources/views/edit/link-spouse-to-individual.phtml b/resources/views/edit/link-spouse-to-individual.phtml index 4091153080..7e5bc01d1d 100644 --- a/resources/views/edit/link-spouse-to-individual.phtml +++ b/resources/views/edit/link-spouse-to-individual.phtml @@ -1,36 +1,44 @@ <?php -use Fisharebest\Webtrees\Functions\FunctionsEdit; -use Fisharebest\Webtrees\Http\RequestHandlers\LinkSpouseToIndividualAction; use Fisharebest\Webtrees\I18N; -use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Tree; /** - * @var Individual $individual - * @var string $label - * @var string $title - * @var Tree $tree - * @var string $xref + * @var string $title + * @var string $label + * @var string $cancel_url + * @var string $post_url + * @var Tree $tree */ ?> <h2 class="wt-page-title"><?= $title ?></h2> -<form method="post" action="<?= e(route(LinkSpouseToIndividualAction::class, ['tree' => $tree->name(), 'xref' => $xref])) ?>" class="wt-page-content"> +<form method="post" action="<?= e($post_url) ?>" class="wt-page-content"> <?= csrf_field() ?> - <div class="form-group row"> - <label class="col-sm-3 col-form-label" for="spouse"> + <div class="card mb-2"> + <div class="card-header"> <?= $label ?> - </label> - <div class="col-sm-9"> + </div> + <div class="card-body pb-1"> <?= view('components/select-individual', ['name' => 'spid', 'id' => 'spouse', 'tree' => $tree]) ?> </div> </div> - <?= FunctionsEdit::addSimpleTags($tree, 'MARR') ?> + <?php foreach ($facts ?? [] as $prefix => $prefix_facts) : ?> + <?php foreach ($prefix_facts as $fact) : ?> + <div class="card mb-2"> + <div class="card-header"> + <?= $fact->label() ?> + </div> + <div class="card-body pb-1"> + <?= view('edit/edit-gedcom-fields', ['gedcom' => $fact->insertMissingSubtags(), 'hierarchy' => explode(':', $fact->tag()), 'tree' => $fact->record()->tree(), 'prefix' => $prefix]) ?> + </div> + </div> + <?php endforeach ?> + <?php endforeach ?> <div class="row form-group"> <div class="col-sm-9 offset-sm-3"> @@ -39,7 +47,7 @@ use Fisharebest\Webtrees\Tree; <?= /* I18N: A button label. */ I18N::translate('save') ?> </button> - <a class="btn btn-secondary" href="<?= e($individual->url()) ?>"> + <a class="btn btn-secondary" href="<?= e($cancel_url) ?>"> <?= view('icons/cancel') ?> <?= /* I18N: A button label. */ I18N::translate('cancel') ?> @@ -47,5 +55,3 @@ use Fisharebest\Webtrees\Tree; </div> </div> </form> - -<?= view('modals/ajax') ?> diff --git a/resources/views/edit/new-individual.phtml b/resources/views/edit/new-individual.phtml index d64e097f6f..2c92ba3bd0 100644 --- a/resources/views/edit/new-individual.phtml +++ b/resources/views/edit/new-individual.phtml @@ -11,344 +11,57 @@ use Fisharebest\Webtrees\Http\RequestHandlers\AddParentToIndividualAction; use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToFamilyAction; use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToIndividualAction; use Fisharebest\Webtrees\Http\RequestHandlers\AddUnlinkedAction; -use Fisharebest\Webtrees\Http\RequestHandlers\EditFactAction; use Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactPage; +use Fisharebest\Webtrees\Http\RequestHandlers\EditFactAction; use Fisharebest\Webtrees\Http\RequestHandlers\ManageTrees; use Fisharebest\Webtrees\I18N; -use Fisharebest\Webtrees\Individual; -use Fisharebest\Webtrees\Registry; -use Fisharebest\Webtrees\SurnameTradition; use Fisharebest\Webtrees\Tree; -use Fisharebest\Webtrees\View; -use Illuminate\Support\Collection; /** - * @var Family|null $family - * @var string $famtag - * @var string $gender - * @var Individual|null $individual - * @var Fact|null $name_fact - * @var string $next_action - * @var string $title - * @var Tree $tree + * @var string $cancel_url + * @var string $post_url + * @var string $title + * @var Tree $tree + * @var string $url */ ?> -<?php -if ($individual instanceof Individual) { - $xref = $individual->xref(); - $cancel_url = $individual->url(); -} elseif ($family !== null) { - $xref = $family->xref(); - $cancel_url = $family->url(); -} else { - $cancel_url = route(ManageTrees::class, ['tree' => $tree->name()]); - $xref = 'new'; -} - -// Different cultures do surnames differently -$surname_tradition = SurnameTradition::create($tree->getPreference('SURNAME_TRADITION')); - -if ($name_fact instanceof Fact) { - // Editing an existing name - $name_fact_id = $name_fact->id(); - $namerec = $name_fact->gedcom(); - $name_fields = [ - 'NAME' => $name_fact->value(), - 'TYPE' => $name_fact->attribute('TYPE'), - 'NPFX' => $name_fact->attribute('NPFX'), - 'GIVN' => $name_fact->attribute('GIVN'), - 'NICK' => $name_fact->attribute('NICK'), - 'SPFX' => $name_fact->attribute('SPFX'), - 'SURN' => $name_fact->attribute('SURN'), - 'NSFX' => $name_fact->attribute('NSFX'), - ]; -} else { - // Creating a new name - $name_fact_id = ''; - $namerec = ''; - $name_fields = [ - 'NAME' => '', - 'TYPE' => '', - 'NPFX' => '', - 'GIVN' => '', - 'NICK' => '', - 'SPFX' => '', - 'SURN' => '', - 'NSFX' => '', - ]; - - // Inherit surname from parents, spouse or child - if ($family) { - $father = $family->husband(); - if ($father instanceof Individual && $father->facts(['NAME'])->isNotEmpty()) { - $father_name = $father->facts(['NAME'])->first()->value(); - } else { - $father_name = ''; - } - $mother = $family->wife(); - if ($mother instanceof Individual && $mother->facts(['NAME'])->isNotEmpty()) { - $mother_name = $mother->facts(['NAME'])->first()->value(); - } else { - $mother_name = ''; - } - } else { - $father = null; - $mother = null; - $father_name = ''; - $mother_name = ''; - } - if ($individual && $individual->facts(['NAME'])->isNotEmpty()) { - $indi_name = $individual->facts(['NAME'])->first()->value(); - } else { - $indi_name = ''; - } - - switch ($next_action) { - case AddChildToFamilyAction::class: - $name_fields = array_merge($name_fields, $surname_tradition->newChildNames($father_name, $mother_name, $gender)); - break; - case AddChildToIndividualAction::class: - if ($individual->sex() === 'F') { - $name_fields = array_merge($name_fields, $surname_tradition->newChildNames('', $indi_name, $gender)); - } else { - $name_fields = array_merge($name_fields, $surname_tradition->newChildNames($indi_name, '', $gender)); - } - break; - case AddParentToIndividualAction::class: - $name_fields = array_merge($name_fields, $surname_tradition->newParentNames($indi_name, $gender)); - break; - case AddSpouseToFamilyAction::class: - if ($father) { - $name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($father_name, $gender)); - } else { - $name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($mother_name, $gender)); - } - break; - case AddSpouseToIndividualAction::class: - $name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($indi_name, $gender)); - break; - case AddUnlinkedAction::class: - case EditFactAction::class: - if ($surname_tradition->hasSurnames()) { - $name_fields['NAME'] = '//'; - } - break; - } -} - -$bdm = ''; // used to copy '1 SOUR' to '2 SOUR' for BIRT DEAT MARR - -?> <h2 class="wt-page-title"><?= $title ?></h2> -<form method="post" action="<?= e(route($next_action, ['tree' => $tree->name(), 'xref' => $xref, 'fact_id' => $name_fact ? $name_fact->id() : null])) ?>" onsubmit="return checkform();"> - <input type="hidden" name="fact_id" value="<?= e($name_fact_id) ?>"> - <input type="hidden" name="famtag" value="<?= e($famtag) ?>"> - <input type="hidden" name="gender" value="<?= $gender ?>"> +<form method="post" action="<?= e($post_url) ?>"> <?= csrf_field() ?> - <?php if ($next_action === AddChildToFamilyAction::class || $next_action === AddChildToIndividualAction::class) : ?> - <?= FunctionsEdit::addSimpleTag($tree, '0 PEDI') ?> - <?php endif ?> - - <?php - // If we are adding a new individual, choose the sex. - if ($next_action !== EditFactAction::class) { - if ($famtag === 'HUSB' || $gender === 'M') { - echo FunctionsEdit::addSimpleTag($tree, '0 SEX M'); - } elseif ($famtag === 'WIFE' || $gender === 'F') { - echo FunctionsEdit::addSimpleTag($tree, '0 SEX F'); - } else { - echo FunctionsEdit::addSimpleTag($tree, '0 SEX'); - } - } - ?> - - <?php - // First - standard name fields - foreach ($name_fields as $tag => $value) { - if (substr_compare($tag, '_', 0, 1) !== 0) { - echo FunctionsEdit::addSimpleTag($tree, '0 ' . $tag . ' ' . $value, '', ''); - } - } + <?php foreach ($facts ?? [] as $prefix => $prefix_facts) : ?> + <?php foreach ($prefix_facts as $fact) : ?> + <div class="card mb-2"> + <div class="card-header"> + <?= $fact->label() ?> + </div> + <div class="card-body pb-1"> + <?= view('edit/edit-gedcom-fields', ['gedcom' => $fact->insertMissingSubtags(), 'hierarchy' => explode(':', $fact->tag()), 'tree' => $fact->record()->tree(), 'prefix' => $prefix]) ?> + </div> + </div> + <?php endforeach ?> + <?php endforeach ?> - // Second - advanced name fields - if ($surname_tradition->hasMarriedNames() || preg_match('/\n2 _MARNM /', $namerec)) { - $adv_name_fields = ['_MARNM' => '']; - } else { - $adv_name_fields = []; - } - if (preg_match_all('/(' . Gedcom::REGEX_TAG . ')/', $tree->getPreference('ADVANCED_NAME_FACTS'), $match)) { - foreach ($match[1] as $tag) { - // Ignore advanced facts that duplicate standard facts - if (!in_array($tag, ['TYPE', 'NPFX', 'GIVN', 'NICK', 'SPFX', 'SURN', 'NSFX'])) { - $adv_name_fields[$tag] = ''; - } - } - } - - foreach (array_keys($adv_name_fields) as $tag) { - // Edit existing tags, grouped together - if (preg_match_all('/2 ' . $tag . ' (.+)/', $namerec, $match)) { - foreach ($match[1] as $value) { - $label = Registry::elementFactory()->make('INDI:NAME:' . $tag)->label(); - echo FunctionsEdit::addSimpleTag($tree, '2 ' . $tag . ' ' . $value, '', $label); - if ($tag === '_MARNM') { - preg_match_all('/\/([^\/]*)\//', $value, $matches); - echo FunctionsEdit::addSimpleTag($tree, '2 _MARNM_SURN ' . implode(',', $matches[1])); - } - } - } - // Allow a new tag to be entered - if (!array_key_exists($tag, $name_fields)) { - $label = Registry::elementFactory()->make('INDI:NAME:' . $tag)->label(); - echo FunctionsEdit::addSimpleTag($tree, '0 ' . $tag, '', $label); - if ($tag === '_MARNM') { - echo FunctionsEdit::addSimpleTag($tree, '0 _MARNM_SURN'); - } - } - } - - // Third - new/existing custom name fields - foreach ($name_fields as $tag => $value) { - if (substr_compare($tag, '_', 0, 1) === 0) { - echo FunctionsEdit::addSimpleTag($tree, '0 ' . $tag . ' ' . $value); - if ($tag === '_MARNM') { - preg_match_all('/\/([^\/]*)\//', $value, $matches); - echo FunctionsEdit::addSimpleTag($tree, '2 _MARNM_SURN ' . implode(',', $matches[1])); - } - } - } - - // Fourth - SOUR, NOTE, _CUSTOM, etc. - if ($namerec !== '') { - $gedlines = explode("\n", $namerec); // -- find the number of lines in the record - $fields = explode(' ', $gedlines[0]); - $glevel = $fields[0]; - $level = $glevel; - $type = $fields[1]; - $tags = []; - $i = 0; - do { - if ($type !== 'TYPE' && !array_key_exists($type, $name_fields) && !array_key_exists($type, $adv_name_fields)) { - $text = ''; - for ($j = 2; $j < count($fields); $j++) { - if ($j > 2) { - $text .= ' '; - } - $text .= $fields[$j]; - } - while (($i + 1 < count($gedlines)) && (preg_match('/' . ($level + 1) . ' CONT ?(.*)/', $gedlines[$i + 1], $cmatch) > 0)) { - $text .= "\n" . $cmatch[1]; - $i++; - } - echo FunctionsEdit::addSimpleTag($tree, $level . ' ' . $type . ' ' . $text); - } - $tags[] = $type; - $i++; - if (isset($gedlines[$i])) { - $fields = explode(' ', $gedlines[$i]); - $level = $fields[0]; - if (isset($fields[1])) { - $type = $fields[1]; - } - } - } while (($level > $glevel) && ($i < count($gedlines))); - } - - // If we are adding a new individual, add the basic details - if ($next_action !== EditFactAction::class) { - $bdm = 'BD'; - $tags = new Collection(); - preg_match_all('/(' . Gedcom::REGEX_TAG . ')/', $tree->getPreference('QUICK_REQUIRED_FACTS'), $matches); - $tags = $tags->merge($matches[1]); - - // If adding a spouse add the option to add a marriage fact to the new family - if ($next_action === AddSpouseToIndividualAction::class || $next_action === AddSpouseToFamilyAction::class) { - $bdm .= 'M'; - preg_match_all('/(' . Gedcom::REGEX_TAG . ')/', $tree->getPreference('QUICK_REQUIRED_FAMFACTS'), $matches); - $tags = $tags->merge($matches[1]); - } - - foreach (Fact::sortFactTags($tags) as $tag) { - echo view('cards/add-fact', [ - 'tag' => $tag, - 'tree' => $tree, - ]); - } - } - - if ($next_action === EditFactAction::class ) { - // GEDCOM 5.5.1 spec says NAME doesn’t get a OBJE - echo view('cards/add-source-citation', [ - 'level' => 2, - 'full_citations' => $tree->getPreference('FULL_SOURCES'), - 'tree' => $tree, - ]); - echo view('cards/add-note', [ - 'level' => 2, - 'tree' => $tree, - ]); - echo view('cards/add-shared-note', [ - 'level' => 2, - 'tree' => $tree, - ]); - echo view('cards/add-restriction', [ - 'level' => 2, - 'tree' => $tree, - ]); - } else { - echo view('cards/add-source-citation', [ - 'bdm' => $bdm, - 'level' => 1, - 'full_citations' => (bool) $tree->getPreference('FULL_SOURCES'), - 'prefer_level2_sources' => $tree->getPreference('PREFER_LEVEL2_SOURCES'), - 'quick_required_facts' => $tree->getPreference('QUICK_REQUIRED_FACTS'), - 'quick_required_famfacts' => $tree->getPreference('QUICK_REQUIRED_FAMFACTS'), - 'tree' => $tree, - ]); - echo view('cards/add-note', [ - 'level' => 1, - 'tree' => $tree, - ]); - echo view('cards/add-shared-note', [ - 'level' => 1, - 'tree' => $tree, - ]); - echo view('cards/add-restriction', [ - 'level' => 1, - 'tree' => $tree, - ]); - } - - ?> <div class="row form-group"> <div class="col-sm-9 offset-sm-3"> - <button class="btn btn-primary" type="submit"> + <button class="btn btn-primary" type="submit" name="url" value="<?= e($url) ?>"> <?= view('icons/save') ?> <?= /* I18N: A button label. */ I18N::translate('save') ?> </button> - <?php if ($next_action !== EditFactAction::class) : ?> - <button class="btn btn-primary" type="submit" name="goto" value="new"> - <?= view('icons/save') ?> - <?= /* I18N: A button label. */ - I18N::translate('go to new individual') ?> - </button> - <?php endif ?> + <button class="btn btn-primary" type="submit"> + <?= view('icons/save') ?> + <?= /* I18N: A button label. */ + I18N::translate('go to new individual') ?> + </button> <a class="btn btn-secondary" href="<?= e($cancel_url) ?>"> <?= view('icons/cancel') ?> <?= /* I18N: A button label. */ I18N::translate('cancel') ?> </a> - - <?php if ($name_fact instanceof Fact && (Auth::isAdmin() || $tree->getPreference('SHOW_GEDCOM_RECORD'))) : ?> - <a class="btn btn-link" href="<?= e(route(EditRawFactPage::class, ['xref' => $xref, 'fact_id' => $name_fact->id(), 'tree' => $tree->name()])) ?>"> - <?= I18N::translate('Edit the raw GEDCOM') ?> - </a> - <?php endif ?> </div> </div> </form> @@ -356,160 +69,3 @@ $bdm = ''; // used to copy '1 SOUR' to '2 SOUR' for BIRT DEAT MARR <?= view('modals/on-screen-keyboard') ?> <?= view('modals/ajax') ?> <?= view('edit/initialize-calendar-popup') ?> - -<?php View::push('javascript') ?> -<script> - var SURNAME_TRADITION = <?= json_encode($tree->getPreference('SURNAME_TRADITION')) ?>; - - var NAME = $("[name=NAME]"); - - // Generate a full name from the name components - function generate_name() { - var npfx = document.querySelector("[name=NPFX]").value; - var givn = document.querySelector("[name=GIVN]").value; - var spfx = document.querySelector("[name=SPFX]").value; - var surn = document.querySelector("[name=SURN]").value; - var nsfx = document.querySelector("[name=NSFX]").value; - var sex_input = document.querySelector("[name=SEX]:checked"); - var sex = sex_input ? sex_input.value : "U"; - - return webtrees.buildNameFromParts(npfx, givn, spfx, surn, nsfx, sex); - } - - // Update the NAME and _MARNM fields from the name components - // and also display the value in read-only "gedcom" format. - function updatewholename() { - // Don’t update the name if the user manually changed it - if (manualChange) { - return; - } - - var npfx = document.querySelector("[name=NPFX]").value; - var givn = document.querySelector("[name=GIVN]").value; - var spfx = document.querySelector("[name=SPFX]").value; - var surn = document.querySelector("[name=SURN]").value; - var nsfx = document.querySelector("[name=NSFX]").value; - var name = generate_name(); - - var display_id = NAME.attr("id") + "_display"; - - NAME.val(name); - $("#" + display_id).text(name); - - // Married names inherit some NSFX values, but not these - nsfx = nsfx.replace(/^(I|II|III|IV|V|VI|Junior|Jr\.?|Senior|Sr\.?)$/i, ""); - - // Update _MARNM field from _MARNM_SURN field and display it - var ip = document.getElementsByTagName("input"); - var marnm_id = ""; - var romn = ""; - var heb = ""; - var i; - - for (i = 0; i < ip.length; i++) { - if (ip[i].id.indexOf("_HEB") === 0) { - // Remember this field - we might need it later - heb = val; - } - if (ip[i].id.indexOf("ROMN") === 0) { - // Remember this field - we might need it later - romn = val; - } - } - - for (i = 0; i < ip.length; i++) { - var val = ip[i].value; - - if (ip[i].id.indexOf("_MARNM") === 0) { - if (ip[i].id.indexOf("_MARNM_SURN") === 0) { - var msurn = ""; - if (val !== "") { - if (surn === "" || webtrees.detectScript(val) === webtrees.detectScript(surn)) { - // Same script as NAME field? - msurn = name.replace(/\/.*\//, "/" + val + "/"); - } else if (heb !== "" && webtrees.detectScript(val) === webtrees.detectScript(heb)) { - // Same script as _HEB field? - msurn = heb.replace(/\/.*\//, "/" + val + "/"); - } else if (romn !== "" && webtrees.detectScript(val) === webtrees.detectScript(romn)) { - //. Same script as ROMN field - msurn = romn.replace(/\/.*\//, "/" + val + "/"); - } - } - document.getElementById(marnm_id).value = msurn; - document.getElementById(marnm_id + "_display").innerHTML = msurn; - } else { - marnm_id = ip[i].id; - } - } - } - } - - // Toggle the name editor fields between - // <input type="hidden"> <span style="display:inline"> - // <input type="text"> <span style="display:none"> - - var oldName = ""; - - // Calls to generate_name() trigger an update - hence need to - // set the manual change to true first. We are probably - // listening to the wrong events on the input fields... - var manualChange = generate_name() !== NAME.val(); - - function convertHidden(eid) { - var input1 = $("#" + eid); - var input2 = $("#" + eid + "_display"); - - if (input1.attr("type") === "hidden") { - input1.attr("type", "text"); - input2.hide(); - } else { - input1.attr("type", "hidden"); - input2.show(); - } - } - - /** - * if the user manually changed the NAME field, then update the textual - * HTML representation of it - * If the value changed set manualChange to true so that changing - * the other fields doesn’t change the NAME line - */ - function updateTextName(eid) { - var element = document.getElementById(eid); - if (element) { - if (element.value !== oldName) { - manualChange = true; - } - var delement = document.getElementById(eid + "_display"); - if (delement) { - delement.innerHTML = element.value; - } - } - } - - function checkform() { - var ip = document.getElementsByTagName("input"); - for (var i = 0; i < ip.length; i++) { - // ADD slashes to _HEB and _AKA names - if (ip[i].id.indexOf("_AKA") === 0 || ip[i].id.indexOf("_HEB") === 0 || ip[i].id.indexOf("ROMN") === 0) - if (ip[i].value.indexOf("/") < 0 && ip[i].value !== "") - ip[i].value = ip[i].value.replace(/([^\s]+)\s*$/, "/$1/"); - // Blank out temporary _MARNM_SURN - if (ip[i].id.indexOf("_MARNM_SURN") === 0) - ip[i].value = ""; - // Convert "xxx yyy" and "xxx y yyy" surnames to "xxx,yyy" - if ((SURNAME_TRADITION === "spanish" || "SURNAME_TRADITION" === "portuguese") && ip[i].id.indexOf("SURN") === 0) { - ip[i].value = document.forms[0].SURN.value.replace(/^\s*([^\s,]{2,})\s+([iIyY] +)?([^\s,]{2,})\s*$/, "$1,$3"); - } - } - return true; - } - - // If the name isn’t initially formed from the components in a standard way, - // then don’t automatically update it. - if (NAME.val() !== generate_name() && NAME.val() !== "//") { - convertHidden(NAME.attr("id")); - } -</script> -<?php View::endpush() ?> - diff --git a/resources/views/family-page-children.phtml b/resources/views/family-page-children.phtml index 7920931dab..06907a4ce4 100644 --- a/resources/views/family-page-children.phtml +++ b/resources/views/family-page-children.phtml @@ -37,11 +37,11 @@ use Fisharebest\Webtrees\I18N; <?php endforeach ?> <?php if ($family->canEdit()) : ?> <div class="wt-chart-box"> - <a class="btn btn-link" href="<?= e(route(AddChildToFamilyPage::class, ['gender' => 'M', 'tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>"> + <a class="btn btn-link" href="<?= e(route(AddChildToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'sex' => 'M'])) ?>"> <?= I18N::translate('Add a son') ?> </a> | - <a class="btn btn-link" href="<?= e(route(AddChildToFamilyPage::class, ['gender' => 'F', 'tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>"> + <a class="btn btn-link" href="<?= e(route(AddChildToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'sex' => 'F'])) ?>"> <?= I18N::translate('Add a daughter') ?> </a> <br> diff --git a/resources/views/family-page-grandparents.phtml b/resources/views/family-page-grandparents.phtml index 75611764d4..da736c70a5 100644 --- a/resources/views/family-page-grandparents.phtml +++ b/resources/views/family-page-grandparents.phtml @@ -7,8 +7,9 @@ use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Individual; /** - * @var Individual|null $individual - * @var Family|null $family + * @var Family $family + * @var Individual $individual + * @var Family|null $parent_family */ ?> @@ -26,24 +27,24 @@ use Fisharebest\Webtrees\Individual; <div class="align-self-center"> <?php if ($individual === null) : ?> <?= view('chart-box', ['individual' => null]) ?> - <?php elseif ($family === null) : ?> + <?php elseif ($parent_family === null) : ?> <div class="wt-chart-box"> <?php if ($individual->canEdit()) : ?> - <a class="btn btn-link" href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'gender' => 'M'])) ?>"> + <a class="btn btn-link" href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'sex' => 'M', 'url' => $family->url()])) ?>"> <?= I18N::translate('Add a father') ?> </a> <?php endif ?> </div> - <?php elseif ($family->husband() === null) : ?> + <?php elseif ($parent_family->husband() === null) : ?> <div class="wt-chart-box"> - <?php if ($family->canEdit()) : ?> - <a class="btn btn-link" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'famtag' => 'HUSB'])) ?>"> + <?php if ($parent_family->canEdit()) : ?> + <a class="btn btn-link" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $parent_family->tree()->name(), 'xref' => $parent_family->xref(), 'sex' => 'M', 'url' => $family->url()])) ?>"> <?= I18N::translate('Add a father') ?> </a> <?php endif ?> </div> <?php else : ?> - <?= view('chart-box', ['individual' => $family ? $family->husband() : null]) ?> + <?= view('chart-box', ['individual' => $parent_family ? $parent_family->husband() : null]) ?> <?php endif ?> </div> </div> @@ -56,31 +57,31 @@ use Fisharebest\Webtrees\Individual; <div class="align-self-center"> <?php if ($individual === null) : ?> <?= view('chart-box', ['individual' => null]) ?> - <?php elseif ($family === null) : ?> + <?php elseif ($parent_family === null) : ?> <div class="wt-chart-box"> <?php if ($individual->canEdit()) : ?> - <a class="btn btn-link" href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'gender' => 'F'])) ?>"> + <a class="btn btn-link" href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'sex' => 'F', 'url' => $family->url()])) ?>"> <?= I18N::translate('Add a mother') ?> </a> <?php endif ?> </div> - <?php elseif ($family->wife() === null) : ?> + <?php elseif ($parent_family->wife() === null) : ?> <div class="wt-chart-box"> - <?php if ($family->canEdit()) : ?> - <a class="btn btn-link" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'famtag' => 'WIFE'])) ?>"> + <?php if ($parent_family->canEdit()) : ?> + <a class="btn btn-link" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $parent_family->tree()->name(), 'xref' => $parent_family->xref(), 'sex' => 'F', 'url' => $family->url()])) ?>"> <?= I18N::translate('Add a mother') ?> </a> <?php endif ?> </div> <?php else : ?> - <?= view('chart-box', ['individual' => $family ? $family->wife() : null]) ?> + <?= view('chart-box', ['individual' => $parent_family ? $parent_family->wife() : null]) ?> <?php endif ?> </div> </div> </div> - <?php if ($family !== null) : ?> + <?php if ($parent_family !== null) : ?> <div class="align-self-center"> - <a class="btn btn-text" href="<?= e($family->url()) ?>" title="<?= strip_tags($family->fullName()) ?>"> + <a class="btn btn-text" href="<?= e($parent_family->url()) ?>" title="<?= strip_tags($parent_family->fullName()) ?>"> <?= view('icons/arrow-right') ?> </a> </div> diff --git a/resources/views/family-page-menu.phtml b/resources/views/family-page-menu.phtml index dcafc5c357..5359b10a19 100644 --- a/resources/views/family-page-menu.phtml +++ b/resources/views/family-page-menu.phtml @@ -29,20 +29,20 @@ use Fisharebest\Webtrees\I18N; </a> <?php if ($record->husband() === null) : ?> - <a class="dropdown-item" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'famtag' => 'HUSB'])) ?>"> + <a class="dropdown-item" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'sex' => 'M'])) ?>"> <?= view('icons/add') ?> <?= I18N::translate('Add a husband') ?> </a> <?php endif ?> <?php if ($record->wife() === null) : ?> - <a class="dropdown-item" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'famtag' => 'WIFE'])) ?>"> + <a class="dropdown-item" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'sex' => 'F'])) ?>"> <?= view('icons/add') ?> <?= I18N::translate('Add a wife') ?> </a> <?php endif ?> - <a class="dropdown-item" href="<?= e(route(AddChildToFamilyPage::class, ['gender' => 'U', 'tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>"> + <a class="dropdown-item" href="<?= e(route(AddChildToFamilyPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'sex' => 'U'])) ?>"> <?= view('icons/add') ?> <?= I18N::translate('Add a child') ?> </a> diff --git a/resources/views/family-page-parents.phtml b/resources/views/family-page-parents.phtml index 1cb009b2af..f72876f591 100644 --- a/resources/views/family-page-parents.phtml +++ b/resources/views/family-page-parents.phtml @@ -23,7 +23,7 @@ use Fisharebest\Webtrees\Individual; <?php else : ?> <div class="wt-chart-box"> <?php if ($family->canEdit()) : ?> - <a class="btn btn-link" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'famtag' => 'HUSB'])) ?>"> + <a class="btn btn-link" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'sex' => 'M'])) ?>"> <?= I18N::translate('Add a husband')?> </a> <?php endif ?> @@ -31,7 +31,7 @@ use Fisharebest\Webtrees\Individual; <?php endif ?> </div> - <?= view('family-page-grandparents', ['family' => $family->husband() ? $family->husband()->childFamilies()->first() : null, 'individual' => $family->husband()]) ?> + <?= view('family-page-grandparents', ['family' => $family, 'parent_family' => $family->husband() ? $family->husband()->childFamilies()->first() : null, 'individual' => $family->husband()]) ?> </div> <div class="d-flex"> @@ -45,7 +45,7 @@ use Fisharebest\Webtrees\Individual; <?php else : ?> <div class="wt-chart-box"> <?php if ($family->canEdit()) : ?> - <a class="btn btn-link" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'famtag' => 'WIFE'])) ?>"> + <a class="btn btn-link" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'sex' => 'F'])) ?>"> <?= I18N::translate('Add a wife')?> </a> <?php endif ?> @@ -53,7 +53,7 @@ use Fisharebest\Webtrees\Individual; <?php endif ?> </div> - <?= view('family-page-grandparents', ['family' => $family->wife() ? $family->wife()->childFamilies()->first() : null, 'individual' => $family->wife()]) ?> + <?= view('family-page-grandparents', ['family' => $family, 'parent_family' => $family->wife() ? $family->wife()->childFamilies()->first() : null, 'individual' => $family->wife()]) ?> </div> </div> </div> diff --git a/resources/views/individual-name.phtml b/resources/views/individual-name.phtml index 4c3d32792e..a6ca658ae6 100644 --- a/resources/views/individual-name.phtml +++ b/resources/views/individual-name.phtml @@ -6,7 +6,7 @@ use Fisharebest\Webtrees\Functions\FunctionsPrint; use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; use Fisharebest\Webtrees\Http\RequestHandlers\CopyFact; use Fisharebest\Webtrees\Http\RequestHandlers\DeleteFact; -use Fisharebest\Webtrees\Http\RequestHandlers\EditName; +use Fisharebest\Webtrees\Http\RequestHandlers\EditFactPage; use Fisharebest\Webtrees\I18N; /** @@ -43,7 +43,7 @@ if ($fact->isPendingDeletion()) { <?= $fake_individual->fullName() ?> <?php if ($fact->attribute('TYPE') !== '') : ?> — - <?= Registry::elementFactory()->make('INDI:NAME:TYPE')->value($fact->attribute('TYPE'), $tree) ?> + <?= Registry::elementFactory()->make($fact->tag() . ':TYPE')->value($fact->attribute('TYPE'), $tree) ?> <?php endif ?> </a> </div> @@ -56,16 +56,13 @@ if ($fact->isPendingDeletion()) { <?php preg_match_all('/\n2 (\w+) (.+)/', $fact->gedcom(), $matches, PREG_SET_ORDER) ?> <?php foreach ($matches as $key => $match) : ?> <?php [, $tag, $value] = $match ?> + <?php $element = Registry::elementFactory()->make($fact->tag() . ':' . $tag) ?> <?php if ($tag !== 'SOUR' && $tag !== 'NOTE') : ?> <dt class="col-md-4 col-lg-3"> - <?= Registry::elementFactory()->make($fact->tag() . ':' . $tag)->label() ?> + <?= $element->label() ?> </dt> <dd class="col-md-8 col-lg-9"> - <?php if ($tag === 'TYPE') : ?> - <?= Registry::elementFactory()->make('INDI:NAME:TYPE')->value($value, $tree) ?> - <?php else: ?> - <span dir="auto"><?= e($value) ?></span> - <?php endif ?> + <?= $element->value($value, $fact->record()->tree()) ?> </dd> <?php endif ?> <?php endforeach ?> @@ -76,7 +73,7 @@ if ($fact->isPendingDeletion()) { <?php if ($fact->canEdit()) : ?> <div class="d-flex"> - <a class="btn btn-link ml-auto" href="<?= e(route(EditName::class, ['xref' => $individual->xref(), 'fact_id' => $fact->id(), 'tree' => $individual->tree()->name()])) ?>" title="<?= I18N::translate('Edit the name') ?>"> + <a class="btn btn-link ml-auto" href="<?= e(route(EditFactPage::class, ['xref' => $individual->xref(), 'fact_id' => $fact->id(), 'tree' => $individual->tree()->name()])) ?>" title="<?= I18N::translate('Edit the name') ?>"> <?= view('icons/edit') ?> <span class="sr-only"><?= I18N::translate('Edit the name') ?></span> </a> diff --git a/resources/views/individual-page-menu.phtml b/resources/views/individual-page-menu.phtml index a22bc6a946..e93b576dd7 100644 --- a/resources/views/individual-page-menu.phtml +++ b/resources/views/individual-page-menu.phtml @@ -1,7 +1,6 @@ <?php use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Http\RequestHandlers\AddName; use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact; use Fisharebest\Webtrees\Http\RequestHandlers\DeleteRecord; use Fisharebest\Webtrees\Http\RequestHandlers\EditFactPage; @@ -36,7 +35,7 @@ use Illuminate\Support\Collection; <hr> <?php endif ?> - <a class="dropdown-item" href="<?= e(route(AddName::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>"> + <a class="dropdown-item" href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'NAME'])) ?>"> <?= view('icons/add') ?> <?= I18N::translate('Add a name') ?> </a> diff --git a/resources/views/media-page-menu.phtml b/resources/views/media-page-menu.phtml index 2ad7e9459b..8268e1360a 100644 --- a/resources/views/media-page-menu.phtml +++ b/resources/views/media-page-menu.phtml @@ -1,8 +1,7 @@ <?php -use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\Http\RequestHandlers\DeleteRecord; -use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordPage; +use Fisharebest\Webtrees\Http\RequestHandlers\EditRecordPage; use Fisharebest\Webtrees\Http\RequestHandlers\LinkMediaToFamilyModal; use Fisharebest\Webtrees\Http\RequestHandlers\LinkMediaToIndividualModal; use Fisharebest\Webtrees\Http\RequestHandlers\LinkMediaToSourceModal; @@ -22,6 +21,11 @@ use Fisharebest\Webtrees\Media; </button> <div class="dropdown-menu dropdown-menu-right wt-page-menu-items" aria-labelledby="page-menu"> + <a class="dropdown-item" href="<?= route(EditRecordPage::class, ['xref' => $record->xref(), 'tree' => $record->tree()->name()]) ?>"> + <?= view('icons/edit') ?> + <?= I18N::translate('Edit') ?> + </a> + <a class="dropdown-item" href="#" data-href="<?= e(route(LinkMediaToIndividualModal::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" data-target="#wt-ajax-modal" data-toggle="modal" data-backdrop="static"> <?= view('icons/link') ?> <?= I18N::translate('Link this media object to an individual') ?> @@ -43,12 +47,5 @@ use Fisharebest\Webtrees\Media; <?= view('icons/delete') ?> <?= I18N::translate('Delete') ?> </a> - - <?php if (Auth::isAdmin() || $record->tree()->getPreference('SHOW_GEDCOM_RECORD')) : ?> - <a class="dropdown-item" href="<?= e(route(EditRawRecordPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>"> - <?= view('icons/edit') ?> - <?= I18N::translate('Edit the raw GEDCOM') ?> - </a> - <?php endif ?> </div> </div> diff --git a/resources/views/media-page.phtml b/resources/views/media-page.phtml index fbc6e65bbe..2593c61a71 100644 --- a/resources/views/media-page.phtml +++ b/resources/views/media-page.phtml @@ -1,10 +1,9 @@ <?php use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Fact; -use Fisharebest\Webtrees\Family; use Fisharebest\Webtrees\Functions\FunctionsPrint; use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; +use Fisharebest\Webtrees\GedcomTag; use Fisharebest\Webtrees\Http\RequestHandlers\AddMediaFileModal; use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact; use Fisharebest\Webtrees\Http\RequestHandlers\DeleteFact; @@ -12,25 +11,22 @@ use Fisharebest\Webtrees\Http\RequestHandlers\EditMediaFileModal; use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord; use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord; use Fisharebest\Webtrees\I18N; -use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Media; -use Fisharebest\Webtrees\Note; use Fisharebest\Webtrees\Registry; -use Fisharebest\Webtrees\Source; use Fisharebest\Webtrees\Tree; use Illuminate\Support\Collection; -use League\Flysystem\FilesystemInterface; +use League\Flysystem\FilesystemOperator; /** - * @var Collection<Fact> $clipboard_facts - * @var FilesystemInterface $data_filesystem - * @var Collection<Fact> $facts - * @var Collection<Family> $families - * @var Collection<Individual> $individuals - * @var Media $media - * @var Collection<Note> $notes - * @var Collection<Source> $sources - * @var Tree $tree + * @var Collection $clipboard_facts + * @var FilesystemOperator $data_filesystem + * @var Collection $facts + * @var Collection $families + * @var Collection $individuals + * @var Media $media + * @var Collection $notes + * @var Collection $sources + * @var Tree $tree */ ?> @@ -98,7 +94,7 @@ use League\Flysystem\FilesystemInterface; <div class="tab-pane active fade show" role="tabpanel" id="details"> <table class="table wt-facts-table"> <?php foreach ($media->mediaFiles() as $media_file) : ?> - <tr class="<?= $media_file->isPendingAddition() ? 'wt-new' : '' ?> <?= $media_file->isPendingDeletion() ? 'wt-old' : '' ?>"> + <tr class="<?= $media_file->isPendingAddition() ? 'wt-new' : '' ?><?= $media_file->isPendingDeletion() ? 'wt-old' : '' ?>"> <th scope="row"> <?= I18N::translate('Media file') ?> <?php if ($media->canEdit()) : ?> diff --git a/resources/views/modules/custom-tags/config.phtml b/resources/views/modules/custom-tags/config.phtml index 905a75198f..467bada86c 100644 --- a/resources/views/modules/custom-tags/config.phtml +++ b/resources/views/modules/custom-tags/config.phtml @@ -1,11 +1,14 @@ <?php +use Fisharebest\Webtrees\Contracts\ElementFactoryInterface; use Fisharebest\Webtrees\Contracts\ElementInterface; use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; use Fisharebest\Webtrees\Http\RequestHandlers\ModulesAllPage; use Fisharebest\Webtrees\I18N; /** + * @var ElementFactoryInterface $element_factory + * @var array<string,array<string>> $subtags * @var array<string,ElementInterface> $tags * @var string $title */ @@ -16,24 +19,58 @@ use Fisharebest\Webtrees\I18N; <h1><?= $title ?></h1> +<h2><?= I18N::translate('Display custom GEDCOM tags') ?></h2> + <table class="table table-bordered"> - <caption class="sr-only"><?= I18N::translate('Custom tags') ?></caption> + <caption class="sr-only"><?= I18N::translate('Custom GEDCOM tags') ?></caption> + <thead> <tr> - <th><?= I18N::translate('Custom tag') ?></th> + <th><?= I18N::translate('Custom GEDCOM tag') ?></th> <th><?= I18N::translate('Label') ?></th> </tr> </thead> + <tbody> <?php foreach ($tags as $tag => $element) : ?> <tr> - <td><code><?= $tag ?></code></td> + <td dir="ltr"><code><?= $tag ?></code></td> <td><?= $element->label() ?></td> </tr> <?php endforeach ?> </tbody> </table> +<h2><?= I18N::translate('Add/remove GEDCOM tags in the edit forms') ?></h2> + +<table class="table table-bordered"> + <caption class="sr-only"><?= I18N::translate('Custom sub-tags') ?></caption> + + <thead> + <tr> + <th><?= I18N::translate('GEDCOM tag') ?></th> + <th><?= I18N::translate('Label') ?></th> + <th><?= I18N::translate('GEDCOM sub-tag') ?></th> + <th><?= I18N::translate('Label') ?></th> + <th><?= I18N::translate('Count') ?></th> + </tr> + </thead> + + <tbody> + <?php foreach ($subtags as $tag => $children) : ?> + <?php foreach ($children as $child) : ?> + <tr> + <td dir="ltr"><code><?= $tag ?></code></td> + <td><?= $element_factory->make($tag)->label() ?></td> + <td dir="ltr"><code><?= $child[0] ?></code></td> + <td><?= $element_factory->make($tag . ':' . $child[0])->label() ?></td> + <td><?= $child[1] ?? '0:1' ?></td> + </tr> + <?php endforeach ?> + <?php endforeach ?> + </tbody> +</table> + <p> <a href="<?= e(route(ControlPanel::class)) ?>" class="btn btn-primary"> <?= view('icons/save') ?> diff --git a/resources/views/modules/relatives/family.phtml b/resources/views/modules/relatives/family.phtml index f961502611..562f3908c3 100644 --- a/resources/views/modules/relatives/family.phtml +++ b/resources/views/modules/relatives/family.phtml @@ -59,7 +59,7 @@ use Fisharebest\Webtrees\Services\RelationshipService; <tr> <th scope="row"></th> <td> - <a href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'famtag' => 'HUSB'])) ?>"> + <a href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'sex' => 'M', 'url' => $individual->url() . '#tab-relatives'])) ?>"> <?= I18N::translate('Add a husband') ?> </a> </td> @@ -96,7 +96,7 @@ use Fisharebest\Webtrees\Services\RelationshipService; <tr> <th scope="row"></th> <td> - <a href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'famtag' => 'WIFE'])) ?>"> + <a href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'sex' => 'F', 'url' => $individual->url() . '#tab-relatives'])) ?>"> <?= I18N::translate('Add a wife') ?> </a> </td> @@ -216,15 +216,15 @@ use Fisharebest\Webtrees\Services\RelationshipService; </th> <td> - <a href="<?= e(route(AddChildToFamilyPage::class, ['gender' => 'M', 'tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>"> + <a href="<?= e(route(AddChildToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'sex' => 'M', 'url' => $individual->url() . '#tab-relatives'])) ?>"> <?= $type === 'FAMS' ? I18N::translate('Add a son') : I18N::translate('Add a brother') ?> </a> | - <a href="<?= e(route(AddChildToFamilyPage::class, ['gender' => 'F', 'tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>"> + <a href="<?= e(route(AddChildToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'sex' => 'F', 'url' => $individual->url() . '#tab-relatives'])) ?>"> <?= $type === 'FAMS' ? I18N::translate('Add a daughter') : I18N::translate('Add a sister') ?> </a> | - <a href="<?= e(route(AddChildToFamilyPage::class, ['gender' => 'U', 'tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>"> + <a href="<?= e(route(AddChildToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'sex' => 'U', 'url' => $individual->url() . '#tab-relatives'])) ?>"> <?= $type === 'FAMS' ? I18N::translate('Add a child') : I18N::translate('Add a sibling') ?> </a> diff --git a/resources/views/modules/relatives/tab.phtml b/resources/views/modules/relatives/tab.phtml index 5a4f610e94..9ecb4f0e46 100644 --- a/resources/views/modules/relatives/tab.phtml +++ b/resources/views/modules/relatives/tab.phtml @@ -45,14 +45,14 @@ use Illuminate\Support\Collection; <tbody> <tr> <td> - <a href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'gender' => 'M'])) ?>"> + <a href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'sex' => 'M', 'url' => $individual->url() . '#tab-relatives'])) ?>"> <?= I18N::translate('Add a father') ?> </a> </td> </tr> <tr> <td> - <a href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'gender' => 'F'])) ?>"> + <a href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'sex' => 'F', 'url' => $individual->url() . '#tab-relatives'])) ?>"> <?= I18N::translate('Add a mother') ?> </a> </td> @@ -129,7 +129,7 @@ use Illuminate\Support\Collection; <tr> <td> - <a href="<?= e(route(AddSpouseToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>"> + <a href="<?= e(route(AddSpouseToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'url' => $individual->url() . '#tab-relatives'])) ?>"> <?php if ($individual->sex() !== 'F') : ?> <?= I18N::translate('Add a wife') ?> <?php else : ?> @@ -153,7 +153,7 @@ use Illuminate\Support\Collection; <tr> <td> - <a href="<?= e(route(AddChildToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'gender' => 'U'])) ?>"> + <a href="<?= e(route(AddChildToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'sex' => 'U'])) ?>"> <?= I18N::translate('Add a child to create a one-parent family') ?> </a> </td> |
