summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Functions/FunctionsEdit.php67
-rw-r--r--edit_interface.php110
-rw-r--r--resources/views/cards/add-associate.php4
-rw-r--r--resources/views/cards/add-shared-note.php2
4 files changed, 89 insertions, 94 deletions
diff --git a/app/Functions/FunctionsEdit.php b/app/Functions/FunctionsEdit.php
index 0956b20704..a9186ece43 100644
--- a/app/Functions/FunctionsEdit.php
+++ b/app/Functions/FunctionsEdit.php
@@ -558,14 +558,7 @@ class FunctionsEdit {
$name = 'text[]';
}
- if ($level === '0') {
- $id = $fact;
- } else {
- $id = $fact . Uuid::uuid4();
- }
- if ($upperlevel) {
- $id = $upperlevel . '_' . $fact . Uuid::uuid4();
- }
+ $id = $fact . Uuid::uuid4()->toString();
$previous_ids[$fact] = $id;
@@ -751,10 +744,6 @@ class FunctionsEdit {
$html .= '<div class="input-group-append"><span class="input-group-text">' . FontAwesome::linkIcon('coordinates', I18N::translate('Latitude') . ' / ' . I18N::translate('Longitude'), ['data-toggle' => 'collapse', 'data-target' => '.child_of_' . $id]) . '</span></div>';
$html .= self::inputAddonHelp('PLAC');
$html .= '</div>';
- if (Module::getModuleByName('places_assistant')) {
- \PlacesAssistantModule::setup_place_subfields($id);
- \PlacesAssistantModule::print_place_subfields($id);
- }
} elseif ($fact === 'QUAY') {
$html .= Bootstrap4::select(GedcomCodeQuay::getValues(), $value, ['id' => $id, 'name' => $name]);
} elseif ($fact === 'RELA') {
@@ -985,60 +974,6 @@ class FunctionsEdit {
}
/**
- * Prints collapsable fields to add ASSO/RELA, SOUR, OBJE, etc.
- *
- * @param string $tag
- * @param int $level
- * @param string $parent_tag
- */
- public static function printAddLayer($tag, $level = 2, $parent_tag = '') {
- global $WT_TREE;
-
- switch ($tag) {
- case 'SOUR':
- echo view('cards/add-source-citation', [
- 'level' => $level,
- 'full_citations' => $WT_TREE->getPreference('FULL_SOURCES'),
- ]);
- break;
-
- case 'ASSO':
- case 'ASSO2':
- echo view('cards/add-associate', [
- 'level' => $level,
- ]);
- break;
-
- case 'NOTE':
- echo view('cards/add-note', [
- 'level' => $level,
- ]);
- break;
-
- case 'SHARED_NOTE':
- echo view('cards/add-shared-note', [
- 'level' => $level,
- 'parent_tag' => $parent_tag,
- ]);
- break;
-
- case 'OBJE':
- if ($WT_TREE->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($WT_TREE)) {
- echo view('cards/add-media-object', [
- 'level' => $level,
- ]);
- }
- break;
-
- case 'RESN':
- echo view('cards/add-restriction', [
- 'level' => $level,
- ]);
- break;
- }
- }
-
- /**
* Add some empty tags to create a new fact.
*
* @param string $fact
diff --git a/edit_interface.php b/edit_interface.php
index a7939f4034..c884e80ebc 100644
--- a/edit_interface.php
+++ b/edit_interface.php
@@ -21,6 +21,7 @@ use Fisharebest\Webtrees\Functions\FunctionsEdit;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
use Fisharebest\Webtrees\GedcomCode\GedcomCodePedi;
use Fisharebest\Webtrees\Module\CensusAssistantModule;
+use Ramsey\Uuid\Uuid;
require 'includes/session.php';
@@ -76,8 +77,12 @@ case 'edit':
case 'REPO':
// REPO:NAME facts may take a NOTE (but the REPO record may not).
if ($level1type === 'NAME') {
- FunctionsEdit::printAddLayer('NOTE');
- FunctionsEdit::printAddLayer('SHARED_NOTE');
+ echo view('cards/add-note', [
+ 'level' => 2,
+ ]);
+ echo view('cards/add-shared-note', [
+ 'level' => 2,
+ ]);
}
break;
case 'FAM':
@@ -85,22 +90,40 @@ case 'edit':
// FAM and INDI records have real facts. They can take NOTE/SOUR/OBJE/etc.
if ($level1type !== 'SEX' && $level1type !== 'NOTE' && $level1type !== 'ALIA') {
if ($level1type !== 'SOUR') {
- FunctionsEdit::printAddLayer('SOUR');
- }
+ echo view('cards/add-source-citation', [
+ 'level' => 2,
+ 'full_citations' => $controller->tree()->getPreference('FULL_SOURCES'),
+ ]); }
if ($level1type !== 'OBJE') {
- FunctionsEdit::printAddLayer('OBJE');
+ if ($controller->tree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($controller->tree())) {
+ echo view('cards/add-media-object', [
+ 'level' => 2,
+ ]);
+ }
}
- FunctionsEdit::printAddLayer('NOTE');
- FunctionsEdit::printAddLayer('SHARED_NOTE', 2, $level1type);
+ echo view('cards/add-note', [
+ 'level' => 2,
+ ]);
+ echo view('cards/add-shared-note', [
+ 'level' => 2,
+ ]);
if ($level1type !== 'ASSO' && $level1type !== 'NOTE' && $level1type !== 'SOUR') {
- FunctionsEdit::printAddLayer('ASSO');
+ echo view('cards/add-associate', [
+ 'id' => Uuid::uuid4()->toString(),
+ 'level' => 2,
+ ]);
}
// 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())) {
- FunctionsEdit::printAddLayer('ASSO2');
+ echo view('cards/add-associate', [
+ 'id' => Uuid::uuid4()->toString(),
+ 'level' => 2,
+ ]);
}
if ($level1type !== 'SOUR') {
- FunctionsEdit::printAddLayer('RESN');
+ echo view('cards/add-restriction', [
+ 'level' => 2,
+ ]);
}
}
break;
@@ -169,19 +192,38 @@ case 'add':
if ($level0type === 'INDI' || $level0type === 'FAM') {
// ... but not facts which are simply links to other records
if ($fact !== 'OBJE' && $fact !== 'NOTE' && $fact !== 'SHARED_NOTE' && $fact !== 'REPO' && $fact !== 'SOUR' && $fact !== 'SUBM' && $fact !== 'ASSO' && $fact !== 'ALIA' && $fact !== 'SEX') {
- FunctionsEdit::printAddLayer('SOUR');
- FunctionsEdit::printAddLayer('OBJE');
+ echo view('cards/add-source-citation', [
+ 'level' => 2,
+ 'full_citations' => $controller->tree()->getPreference('FULL_SOURCES'),
+ ]);
+ if ($controller->tree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($controller->tree())) {
+ echo view('cards/add-media-object', [
+ 'level' => 2,
+ ]);
+ }
// Don’t add notes to notes!
if ($fact !== 'NOTE') {
- FunctionsEdit::printAddLayer('NOTE');
- FunctionsEdit::printAddLayer('SHARED_NOTE', 2, $fact);
+ echo view('cards/add-note', [
+ 'level' => 2,
+ ]);
+ echo view('cards/add-shared-note', [
+ 'level' => 2,
+ ]);
}
- FunctionsEdit::printAddLayer('ASSO');
+ echo view('cards/add-associate', [
+ 'id' => Uuid::uuid4()->toString(),
+ 'level' => 2,
+ ]);
// allow to add godfather and godmother for CHR fact or best man and bridesmaid for MARR fact in one window
if (in_array($fact, Config::twoAssociates())) {
- FunctionsEdit::printAddLayer('ASSO2');
+ echo view('cards/add-associate', [
+ 'id' => Uuid::uuid4()->toString(),
+ 'level' => 2,
+ ]);
}
- FunctionsEdit::printAddLayer('RESN');
+ echo view('cards/add-restriction', [
+ 'level' => 2,
+ ]);
}
}
?>
@@ -1810,15 +1852,33 @@ function print_indi_form($nextaction, Individual $person = null, Family $family
echo '</table>';
if ($nextaction === 'update') {
// GEDCOM 5.5.1 spec says NAME doesn’t get a OBJE
- FunctionsEdit::printAddLayer('SOUR');
- FunctionsEdit::printAddLayer('NOTE');
- FunctionsEdit::printAddLayer('SHARED_NOTE');
- FunctionsEdit::printAddLayer('RESN');
+ echo view('cards/add-source-citation', [
+ 'level' => 2,
+ 'full_citations' => $controller->tree()->getPreference('FULL_SOURCES'),
+ ]);
+ echo view('cards/add-note', [
+ 'level' => 2,
+ ]);
+ echo view('cards/add-shared-note', [
+ 'level' => 2,
+ ]);
+ echo view('cards/add-restriction', [
+ 'level' => 2,
+ ]);
} else {
- FunctionsEdit::printAddLayer('SOUR', 1);
- FunctionsEdit::printAddLayer('NOTE', 1);
- FunctionsEdit::printAddLayer('SHARED_NOTE', 1);
- FunctionsEdit::printAddLayer('RESN', 1);
+ echo view('cards/add-source-citation', [
+ 'level' => 1,
+ 'full_citations' => $controller->tree()->getPreference('FULL_SOURCES'),
+ ]);
+ echo view('cards/add-note', [
+ 'level' => 1,
+ ]);
+ echo view('cards/add-shared-note', [
+ 'level' => 1,
+ ]);
+ echo view('cards/add-restriction', [
+ 'level' => 1,
+ ]);
}
?>
diff --git a/resources/views/cards/add-associate.php b/resources/views/cards/add-associate.php
index 836f473bf7..d4fd0de91a 100644
--- a/resources/views/cards/add-associate.php
+++ b/resources/views/cards/add-associate.php
@@ -3,12 +3,12 @@
<div class="card mb-4">
<div class="card-header">
- <a href="#" data-toggle="collapse" data-target="#add-associate" aria-expanded="false" aria-controls="add-associate">
+ <a href="#" data-toggle="collapse" data-target="#<?= e($id) ?>" aria-expanded="false" aria-controls="add-associate">
<?= I18N::translate('Add an associate') ?>
</a>
</div>
- <div class="card-body collapse" id="add-associate">
+ <div class="card-body collapse" id="<?= e($id) ?>">
<?= FunctionsEdit::addSimpleTag($level . ' _ASSO @') ?>
<?= FunctionsEdit::addSimpleTag(($level + 1) . ' RELA') ?>
<?= FunctionsEdit::addSimpleTag(($level + 1) . ' NOTE') ?>
diff --git a/resources/views/cards/add-shared-note.php b/resources/views/cards/add-shared-note.php
index b4fd3e77e1..4fcbabd779 100644
--- a/resources/views/cards/add-shared-note.php
+++ b/resources/views/cards/add-shared-note.php
@@ -9,6 +9,6 @@
</div>
<div class="card-body collapse" id="add-note-object">
- <?= FunctionsEdit::addSimpleTag($level . ' SHARED_NOTE', $parent_tag) ?>
+ <?= FunctionsEdit::addSimpleTag($level . ' SHARED_NOTE') ?>
</div>
</div>