summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--action.php270
-rw-r--r--admin_trees_config.php2
-rw-r--r--admin_users.php2
-rw-r--r--app/Functions/FunctionsEdit.php59
-rw-r--r--app/Http/Controllers/AutocompleteController.php134
-rw-r--r--app/Http/Controllers/EditGedcomRecordController.php180
-rw-r--r--app/Http/Controllers/PendingChangesController.php258
-rw-r--r--app/Http/Controllers/ReportEngineController.php6
-rw-r--r--app/Http/Controllers/UserController.php20
-rw-r--r--app/Module/GoogleMapsModule.php2
-rw-r--r--app/Module/StoriesModule.php2
-rw-r--r--app/Select2.php84
-rw-r--r--edit_interface.php6
-rw-r--r--public/assets-2.0.0/js/webtrees.js2
-rw-r--r--resources/assets/js/webtrees.js47
-rw-r--r--resources/views/admin/merge-records-step-1.php24
-rw-r--r--resources/views/admin/tree-privacy.php12
-rw-r--r--resources/views/ancestors-page.php2
-rw-r--r--resources/views/blocks/charts-config.php2
-rw-r--r--resources/views/compact-tree-page.php2
-rw-r--r--resources/views/descendants-page.php2
-rw-r--r--resources/views/edit-account-page.php2
-rw-r--r--resources/views/family-book-page.php2
-rw-r--r--resources/views/family-page-menu.php2
-rw-r--r--resources/views/fan-page.php2
-rw-r--r--resources/views/gedcom-record-page-menu.php2
-rw-r--r--resources/views/hourglass-page.php2
-rw-r--r--resources/views/individual-page-menu.php2
-rw-r--r--resources/views/interactive-tree-page.php2
-rw-r--r--resources/views/lifespans-page.php2
-rw-r--r--resources/views/media-page-menu.php2
-rw-r--r--resources/views/modals/create-family.php7
-rw-r--r--resources/views/modals/source-fields.php2
-rw-r--r--resources/views/modules/census-assistant.php2
-rw-r--r--resources/views/note-page-menu.php2
-rw-r--r--resources/views/pedigree-page.php2
-rw-r--r--resources/views/relationships-page.php4
-rw-r--r--resources/views/repository-page-menu.php2
-rw-r--r--resources/views/source-page-menu.php2
-rw-r--r--resources/views/timeline-page.php2
-rw-r--r--routes/web.php15
41 files changed, 664 insertions, 514 deletions
diff --git a/action.php b/action.php
deleted file mode 100644
index d37cb4949c..0000000000
--- a/action.php
+++ /dev/null
@@ -1,270 +0,0 @@
-<?php
-/**
- * webtrees: online genealogy
- * Copyright (C) 2018 webtrees development team
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-namespace Fisharebest\Webtrees;
-
-use Fisharebest\Webtrees\Functions\FunctionsDb;
-use Fisharebest\Webtrees\Functions\FunctionsEdit;
-use Fisharebest\Webtrees\Functions\FunctionsImport;
-
-/** @global Tree $WT_TREE */
-global $WT_TREE;
-
-require 'includes/session.php';
-
-if (!Filter::checkCsrf()) {
- http_response_code(406);
-
- return;
-}
-
-switch (Filter::post('action', null, Filter::get('action'))) {
-case 'accept-changes':
- // Accept all the pending changes for a record
- $record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
- if ($record && Auth::isModerator($record->getTree()) && $record->canShow() && $record->canEdit()) {
- if ($record->isPendingDeletion()) {
- FlashMessages::addMessage(/* I18N: %s is the name of a genealogy record */
- I18N::translate('“%s” has been deleted.', $record->getFullName()));
- } else {
- FlashMessages::addMessage(/* I18N: %s is the name of a genealogy record */
- I18N::translate('The changes to “%s” have been accepted.', $record->getFullName()));
- }
- FunctionsImport::acceptAllChanges($record->getXref(), $record->getTree()->getTreeId());
- } else {
- http_response_code(406);
- }
- break;
-
-case 'copy-fact':
- // Copy a fact to the clipboard
- $xref = Filter::post('xref', WT_REGEX_XREF);
- $fact_id = Filter::post('fact_id');
-
- $record = GedcomRecord::getInstance($xref, $WT_TREE);
-
- if ($record && $record->canEdit()) {
- foreach ($record->getFacts() as $fact) {
- if ($fact->getFactId() == $fact_id) {
- switch ($fact->getTag()) {
- case 'NOTE':
- case 'SOUR':
- case 'OBJE':
- $type = 'all'; // paste this anywhere
- break;
- default:
- $type = $record::RECORD_TYPE; // paste only to the same record type
- break;
- }
- $clipboard = Session::get('clipboard');
- if (!is_array($clipboard)) {
- $clipboard = [];
- }
- $clipboard[$fact_id] = [
- 'type' => $type,
- 'factrec' => $fact->getGedcom(),
- 'fact' => $fact->getTag(),
- ];
- // The clipboard only holds 10 facts
- while (count($clipboard) > 10) {
- array_shift($clipboard);
- }
- Session::put('clipboard', $clipboard);
- FlashMessages::addMessage(I18N::translate('The record has been copied to the clipboard.'));
- break 2;
- }
- }
- }
- break;
-
-case 'paste-fact':
- // Paste a fact from the clipboard
- $xref = Filter::post('xref', WT_REGEX_XREF);
- $fact_id = Filter::post('fact_id');
- $record = GedcomRecord::getInstance($xref, $WT_TREE);
- $clipboard = Session::get('clipboard');
-
- if ($record && $record->canEdit() && isset($clipboard[$fact_id])) {
- $record->createFact($clipboard[$fact_id]['factrec'], true);
- }
- break;
-
-case 'delete-fact':
- $xref = Filter::post('xref', WT_REGEX_XREF);
- $fact_id = Filter::post('fact_id');
-
- $record = GedcomRecord::getInstance($xref, $WT_TREE);
- if ($record && $record->canShow() && $record->canEdit()) {
- foreach ($record->getFacts() as $fact) {
- if ($fact->getFactId() == $fact_id && $fact->canShow() && $fact->canEdit()) {
- $record->deleteFact($fact_id, true);
- break 2;
- }
- }
- }
-
- // Can’t find the record/fact, or don’t have permission to delete it.
- http_response_code(406);
- break;
-
-case 'delete-record':
- $record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
- if ($record && Auth::isEditor($record->getTree()) && $record->canShow() && $record->canEdit()) {
- // Delete links to this record
- foreach (FunctionsDb::fetchAllLinks($record->getXref(), $record->getTree()->getTreeId()) as $xref) {
- $linker = GedcomRecord::getInstance($xref, $WT_TREE);
- $old_gedcom = $linker->getGedcom();
- $new_gedcom = FunctionsEdit::removeLinks($old_gedcom, $record->getXref());
- // FunctionsDb::fetch_all_links() does not take account of pending changes. The links (or even the
- // record itself) may have already been deleted.
- if ($old_gedcom !== $new_gedcom) {
- // If we have removed a link from a family to an individual, and it has only one member
- if (preg_match('/^0 @' . WT_REGEX_XREF . '@ FAM/', $new_gedcom) && preg_match_all('/\n1 (HUSB|WIFE|CHIL) @(' . WT_REGEX_XREF . ')@/', $new_gedcom, $match) == 1) {
- // Delete the family
- $family = GedcomRecord::getInstance($xref, $WT_TREE);
- FlashMessages::addMessage(/* I18N: %s is the name of a family group, e.g. “Husband name + Wife name” */ I18N::translate('The family “%s” has been deleted because it only has one member.', $family->getFullName()));
- $family->deleteRecord();
- // Delete any remaining link to this family
- if ($match) {
- $relict = GedcomRecord::getInstance($match[2][0], $WT_TREE);
- $new_gedcom = $relict->getGedcom();
- $new_gedcom = FunctionsEdit::removeLinks($new_gedcom, $linker->getXref());
- $relict->updateRecord($new_gedcom, false);
- FlashMessages::addMessage(/* I18N: %s are names of records, such as sources, repositories or individuals */ I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $relict->getFullName(), $family->getFullName()));
- }
- } else {
- // Remove links from $linker to $record
- FlashMessages::addMessage(/* I18N: %s are names of records, such as sources, repositories or individuals */ I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $linker->getFullName(), $record->getFullName()));
- $linker->updateRecord($new_gedcom, false);
- }
- }
- }
- // Delete the record itself
- $record->deleteRecord();
- } else {
- http_response_code(406);
- }
- break;
-
-case 'delete-user':
- $user = User::find(Filter::postInteger('user_id'));
-
- if ($user && Auth::isAdmin() && Auth::user() !== $user) {
- Log::addAuthenticationLog('Deleted user: ' . $user->getUserName());
- $user->delete();
- }
- break;
-
-case 'unlink-media':
- // Remove links from an individual and their spouse-family records to a media object.
- // Used by the "unlink" option on the album (lightbox) tab.
- $source = Individual::getInstance(Filter::post('source', WT_REGEX_XREF), $WT_TREE);
- $target = Filter::post('target', WT_REGEX_XREF);
- if ($source && $source->canShow() && $source->canEdit() && $target) {
- // Consider the individual and their spouse-family records
- $sources = $source->getSpouseFamilies();
- $sources[] = $source;
- foreach ($sources as $source) {
- foreach ($source->getFacts() as $fact) {
- if (!$fact->isPendingDeletion()) {
- if ($fact->getValue() == '@' . $target . '@') {
- // Level 1 links
- $source->deleteFact($fact->getFactId(), true);
- } elseif (strpos($fact->getGedcom(), ' @' . $target . '@')) {
- // Level 2-3 links
- $source->updateFact($fact->getFactId(), preg_replace(['/\n2 OBJE @' . $target . '@(\n[3-9].*)*/', '/\n3 OBJE @' . $target . '@(\n[4-9].*)*/'], '', $fact->getGedcom()), true);
- }
- }
- }
- }
- } else {
- http_response_code(406);
- }
- break;
-
-case 'reject-changes':
- // Reject all the pending changes for a record
- $record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
- if ($record && $record->canEdit() && Auth::isModerator($record->getTree())) {
- FlashMessages::addMessage(/* I18N: %s is the name of an individual, source or other record */ I18N::translate('The changes to “%s” have been rejected.', $record->getFullName()));
- FunctionsImport::rejectAllChanges($record);
- } else {
- http_response_code(406);
- }
- break;
-
-case 'select2-family':
- $page = Filter::postInteger('page');
- $query = Filter::post('q', null, '');
- header('Content-Type: application/json');
- echo json_encode(Select2::familySearch($WT_TREE, $page, $query));
- break;
-
-case 'select2-flag':
- $page = Filter::postInteger('page');
- $query = Filter::post('q', null, '');
- header('Content-Type: application/json');
- echo json_encode(Select2::flagSearch($page, $query));
- break;
-
-case 'select2-individual':
- $page = Filter::postInteger('page');
- $query = Filter::post('q', null, '');
- header('Content-Type: application/json');
- echo json_encode(Select2::individualSearch($WT_TREE, $page, $query));
- break;
-
-case 'select2-media':
- $page = Filter::postInteger('page');
- $query = Filter::post('q', null, '');
- header('Content-Type: application/json');
- echo json_encode(Select2::mediaObjectSearch($WT_TREE, $page, $query));
- break;
-
-case 'select2-note':
- $page = Filter::postInteger('page');
- $query = Filter::post('q', null, '');
- header('Content-Type: application/json');
- echo json_encode(Select2::noteSearch($WT_TREE, $page, $query));
- break;
-
-case 'select2-place':
- $page = Filter::postInteger('page');
- $query = Filter::post('q', null, '');
- header('Content-Type: application/json');
- echo json_encode(Select2::placeSearch($WT_TREE, $page, $query, true));
- break;
-
-case 'select2-repository':
- $page = Filter::postInteger('page');
- $query = Filter::post('q', null, '');
- header('Content-Type: application/json');
- echo json_encode(Select2::repositorySearch($WT_TREE, $page, $query));
- break;
-
-case 'select2-source':
- $page = Filter::postInteger('page');
- $query = Filter::post('q', null, '');
- header('Content-Type: application/json');
- echo json_encode(Select2::sourceSearch($WT_TREE, $page, $query));
- break;
-
-case 'select2-submitter':
- $page = Filter::postInteger('page');
- $query = Filter::post('q', null, '');
- header('Content-Type: application/json');
- echo json_encode(Select2::submitterSearch($WT_TREE, $page, $query));
- break;
-}
diff --git a/admin_trees_config.php b/admin_trees_config.php
index 8b02ffdb02..7f12a56fc7 100644
--- a/admin_trees_config.php
+++ b/admin_trees_config.php
@@ -323,7 +323,7 @@ echo Bootstrap4::breadcrumbs([
<?= /* I18N: A configuration setting */ I18N::translate('Default individual') ?>
</label>
<div class="col-sm-9">
- <?= FunctionsEdit::formControlIndividual(Individual::getInstance($WT_TREE->getPreference('PEDIGREE_ROOT_ID'), $WT_TREE), ['id' => 'PEDIGREE_ROOT_ID', 'name' => 'PEDIGREE_ROOT_ID']) ?>
+ <?= FunctionsEdit::formControlIndividual($WT_TREE, Individual::getInstance($WT_TREE->getPreference('PEDIGREE_ROOT_ID'), $WT_TREE), ['id' => 'PEDIGREE_ROOT_ID', 'name' => 'PEDIGREE_ROOT_ID']) ?>
<p class="small text-muted">
<?= /* I18N: Help text for the “Default individual” configuration setting */ I18N::translate('This individual will be selected by default when viewing charts and reports.') ?>
</p>
diff --git a/admin_users.php b/admin_users.php
index cff8a264cf..484693bb52 100644
--- a/admin_users.php
+++ b/admin_users.php
@@ -625,7 +625,7 @@ case 'edit':
</select>
</td>
<td>
- <?= FunctionsEdit::formControlIndividual(Individual::getInstance($tree->getUserPreference($user, 'gedcomid'), $tree), ['id' => 'gedcomid' . $tree->getTreeId(), 'name' => 'gedcomid' . $tree->getTreeId(), 'data-ajax--data--ged' => $tree->getName()]) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, Individual::getInstance($tree->getUserPreference($user, 'gedcomid'), $tree), ['id' => 'gedcomid' . $tree->getTreeId(), 'name' => 'gedcomid' . $tree->getTreeId(), 'data-ajax--data--ged' => $tree->getName()]) ?>
</td>
<td>
<select name="RELATIONSHIP_PATH_LENGTH<?= $tree->getTreeId() ?>" id="RELATIONSHIP_PATH_LENGTH<?= $tree->getTreeId() ?>" class="relpath">
diff --git a/app/Functions/FunctionsEdit.php b/app/Functions/FunctionsEdit.php
index d589610473..66fdddc98f 100644
--- a/app/Functions/FunctionsEdit.php
+++ b/app/Functions/FunctionsEdit.php
@@ -51,6 +51,7 @@ use Fisharebest\Webtrees\Note;
use Fisharebest\Webtrees\Repository;
use Fisharebest\Webtrees\Select2;
use Fisharebest\Webtrees\Source;
+use Fisharebest\Webtrees\Tree;
use Fisharebest\Webtrees\User;
use Ramsey\Uuid\Uuid;
@@ -297,12 +298,13 @@ class FunctionsEdit {
/**
* Create a form control to select a family.
*
+ * @param Tree $tree
* @param Family|null $family
* @param string[] $attributes
*
* @return string
*/
- public static function formControlFamily(Family $family = null, array $attributes = []) {
+ public static function formControlFamily(Tree $tree, Family $family = null, array $attributes = []) {
$value = '';
$options = ['' => ''];
@@ -311,7 +313,7 @@ class FunctionsEdit {
$options = [$value => view('selects/family', ['family' => $family])];
}
- return Bootstrap4::select($options, $value, Select2::familyConfig() + $attributes);
+ return Bootstrap4::select($options, $value, Select2::familyConfig($tree) + $attributes);
}
/**
@@ -337,12 +339,13 @@ class FunctionsEdit {
/**
* Create a form control to select an individual.
*
+ * @param Tree $tree
* @param Individual|null $individual
* @param string[] $attributes
*
* @return string
*/
- public static function formControlIndividual(Individual $individual = null, array $attributes = []) {
+ public static function formControlIndividual(Tree $tree, Individual $individual = null, array $attributes = []) {
$value = '';
$options = ['' => ''];
@@ -351,18 +354,19 @@ class FunctionsEdit {
$options = [$value => view('selects/individual', ['individual' => $individual])];
}
- return Bootstrap4::select($options, $value, Select2::individualConfig() + $attributes);
+ return Bootstrap4::select($options, $value, Select2::individualConfig($tree) + $attributes);
}
/**
* Create a form control to select a media object.
*
+ * @param Tree $tree
* @param Media|null $media
* @param string[] $attributes
*
* @return string
*/
- public static function formControlMediaObject(Media $media = null, array $attributes = []) {
+ public static function formControlMediaObject(Tree $tree, Media $media = null, array $attributes = []) {
$value = '';
$options = ['' => ''];
@@ -371,18 +375,19 @@ class FunctionsEdit {
$options = [$value => view('selects/media', ['media' => $media])];
}
- return Bootstrap4::select($options, $value, Select2::mediaObjectConfig() + $attributes);
+ return Bootstrap4::select($options, $value, Select2::mediaObjectConfig($tree) + $attributes);
}
/**
* Create a form control to select a note.
*
+ * @param Tree $tree
* @param Note|null $note
* @param string[]|null $attributes
*
* @return string
*/
- public static function formControlNote(Note $note = null, array $attributes = []) {
+ public static function formControlNote(Tree $tree, Note $note = null, array $attributes = []) {
$value = '';
$options = ['' => ''];
@@ -391,18 +396,19 @@ class FunctionsEdit {
$options = [$value => view('selects/note', ['note' => $note])];
}
- return Bootstrap4::select($options, $value, Select2::noteConfig() + $attributes);
+ return Bootstrap4::select($options, $value, Select2::noteConfig($tree) + $attributes);
}
/**
* Create a form control to select a place.
*
+ * @param Tree $tree
* @param string $place
* @param string[] $attributes
*
* @return string
*/
- public static function formControlPlace($place, array $attributes = []) {
+ public static function formControlPlace(Tree $tree, $place, array $attributes = []) {
$value = '';
$options = ['' => ''];
@@ -410,18 +416,19 @@ class FunctionsEdit {
$options = [$place => $place];
}
- return Bootstrap4::select($options, $value, Select2::placeConfig() + $attributes);
+ return Bootstrap4::select($options, $value, Select2::placeConfig($tree) + $attributes);
}
/**
* Create a form control to select a repository.
*
+ * @param Tree $tree
* @param Repository|null $repository
* @param string[] $attributes
*
* @return string
*/
- public static function formControlRepository(Repository $repository = null, array $attributes = []) {
+ public static function formControlRepository(Tree $tree, Repository $repository = null, array $attributes = []) {
$value = '';
$options = ['' => ''];
@@ -430,18 +437,19 @@ class FunctionsEdit {
$options = [$value => view('selects/repository', ['repository' => $repository])];
}
- return Bootstrap4::select($options, $value, Select2::repositoryConfig() + $attributes);
+ return Bootstrap4::select($options, $value, Select2::repositoryConfig($tree) + $attributes);
}
/**
* Create a form control to select a source.
*
+ * @param Tree $tree
* @param Source|null $source
* @param string[] $attributes
*
* @return string
*/
- public static function formControlSource(Source $source = null, array $attributes = []) {
+ public static function formControlSource(Tree $tree, Source $source = null, array $attributes = []) {
$value = '';
$options = ['' => ''];
@@ -450,18 +458,19 @@ class FunctionsEdit {
$options = [$value => view('selects/source', ['source' => $source])];
}
- return Bootstrap4::select($options, $value, Select2::sourceConfig() + $attributes);
+ return Bootstrap4::select($options, $value, Select2::sourceConfig($tree) + $attributes);
}
/**
* Create a form control to select a submitter.
*
+ * @param Tree $tree
* @param GedcomRecord|null $submitter
* @param string[] $attributes
*
* @return string
*/
- public static function formControlSubmitter(GedcomRecord $submitter = null, array $attributes = []) {
+ public static function formControlSubmitter(Tree $tree, GedcomRecord $submitter = null, array $attributes = []) {
$value = '';
$options = ['' => ''];
@@ -470,7 +479,7 @@ class FunctionsEdit {
$options = [$value => view('selects/submitter', ['submitter' => $submitter])];
}
- return Bootstrap4::select($options, $value, Select2::submitterConfig() + $attributes);
+ return Bootstrap4::select($options, $value, Select2::submitterConfig($tree) + $attributes);
}
/**
@@ -701,12 +710,12 @@ class FunctionsEdit {
} elseif ($fact === 'ADOP') {
$html .= Bootstrap4::select(GedcomCodeAdop::getValues($person), $value, ['id' => $id, 'name' => $name]);
} elseif ($fact === 'ALIA') {
- $html .= self::formControlIndividual(Individual::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]);
+ $html .= self::formControlIndividual($WT_TREE, Individual::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]);
} elseif ($fact === 'ASSO' || $fact === '_ASSO') {
$html .=
'<div class="input-group">' .
'<span class="input-group-btn"><button class="btn btn-secondary" type="button" onclick="createNewRecord(' . $id . ')" title="' . I18N::translate('Create an individual') . '"><i class="fas fa-plus"></i></button></span>' .
- self::formControlIndividual(Individual::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
+ self::formControlIndividual($WT_TREE, Individual::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
'</div>';
if ($level === '1') {
$html .= '<p class="small text-muted">' . I18N::translate('An associate is another individual who was involved with this individual, such as a friend or an employer.') . '</p>';
@@ -725,7 +734,7 @@ class FunctionsEdit {
$html .=
'<div class="input-group">' .
'<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-target="#modal-create-family" data-element-id="' . $id . '" title="' . I18N::translate('Create a family') . '"><i class="fas fa-plus"></i></button></span>' .
- self::formControlFamily(Family::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
+ self::formControlFamily($WT_TREE, Family::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
'</div>';
} elseif ($fact === 'LATI') {
$html .= '<input class="form-control" type="text" id="' . $id . '" name="' . $name . '" value="' . e($value) . '" oninput="valid_lati_long(this, \'N\', \'S\')">';
@@ -739,13 +748,13 @@ class FunctionsEdit {
'<i class="fas fa-plus"></i><' .
'/button>' .
'</span>' .
- self::formControlNote(Note::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
+ self::formControlNote($WT_TREE, Note::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
'</div>';
} elseif ($fact === 'OBJE') {
$html .=
'<div class="input-group">' .
'<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-href="' . e(route('create-media-object', ['tree' => $WT_TREE->getName()])) . '" data-target="#wt-ajax-modal" data-select-id="' . $id . '" title="' . I18N::translate('Create a media object') . '"><i class="fas fa-plus"></i></button></span>' .
- self::formControlMediaObject(Media::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
+ self::formControlMediaObject($WT_TREE, Media::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
'</div>';
} elseif ($fact === 'PAGE') {
$html .= '<input class="form-control" type="text" id="' . $id . '" name="' . $name . '" value="' . e($value) . '" data-autocomplete-type="PAGE" data-autocomplete-extra="#' . $previous_ids['SOUR'] . '">';
@@ -782,7 +791,7 @@ class FunctionsEdit {
$html .=
'<div class="input-group">' .
'<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-href="' . e(route('create-repository', ['tree' => $WT_TREE->getName()])) . '" data-target="#wt-ajax-modal" data-select-id="' . $id . '" title="' . I18N::translate('Create a repository') . '"><i class="fas fa-plus"></i></button></span>' .
- self::formControlRepository(Repository::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
+ self::formControlRepository($WT_TREE, Repository::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
'</div>';
} elseif ($fact === 'RESN') {
$html .= '<div class="input-group">';
@@ -791,7 +800,7 @@ class FunctionsEdit {
$html .= '</span>';
$html .= '</div>';
} elseif ($fact === 'SEX') {
- if ($value !== 'M' && !$value !== 'F') {
+ if ($value !== 'M' && $value !== 'F') {
$value = 'U';
}
$html .= Bootstrap4::radioButtons($name, ['M' => I18N::translate('Male'), 'F' => I18N::translate('Female'), 'U' => I18N::translateContext('unknown gender', 'Unknown')], $value, true);
@@ -799,7 +808,7 @@ class FunctionsEdit {
$html .=
'<div class="input-group">' .
'<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-href="' . e(route('create-source', ['tree' => $WT_TREE->getName()])) . '" data-target="#wt-ajax-modal" data-select-id="' . $id . '" title="' . I18N::translate('Create a source') . '"><i class="fas fa-plus"></i></button></span>' .
- self::formControlSource(Source::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
+ self::formControlSource($WT_TREE, Source::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
'</div>';
} elseif ($fact === 'STAT') {
$html .= Bootstrap4::select(GedcomCodeStat::statusNames($upperlevel), $value);
@@ -807,7 +816,7 @@ class FunctionsEdit {
$html .=
'<div class="input-group">' .
'<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-href="' . e(route('create-submitter', ['tree' => $WT_TREE->getName()])) . '" data-target="#wt-ajax-modal" data-select-id="' . $id . '" title="' . I18N::translate('Create a submitter') . '"><i class="fas fa-plus"></i></button></span>' .
- self::formControlSubmitter(GedcomRecord::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
+ self::formControlSubmitter($WT_TREE, GedcomRecord::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) .
'</div>';
} elseif ($fact === 'TEMP') {
$html .= Bootstrap4::select(FunctionsEdit::optionsTemples(), $value, ['id' => $id, 'name' => $name]);
diff --git a/app/Http/Controllers/AutocompleteController.php b/app/Http/Controllers/AutocompleteController.php
index 1f222f8410..f7ce94a3cd 100644
--- a/app/Http/Controllers/AutocompleteController.php
+++ b/app/Http/Controllers/AutocompleteController.php
@@ -22,7 +22,9 @@ use Fisharebest\Webtrees\Database;
use Fisharebest\Webtrees\Family;
use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Place;
+use Fisharebest\Webtrees\Select2;
use Fisharebest\Webtrees\Source;
+use Fisharebest\Webtrees\Tree;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use Symfony\Component\HttpFoundation\JsonResponse;
@@ -187,4 +189,136 @@ class AutocompleteController extends AbstractBaseController {
return new JsonResponse($data);
}
+
+ /**
+ * @param Request $request
+ *
+ * @return JsonResponse
+ */
+ public function select2Family(Request $request): JsonResponse {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+
+ $page = (int) $request->get('page');
+ $query = $request->get('q');
+
+ return new JsonResponse(Select2::familySearch($tree, $page, $query));
+ }
+
+ /**
+ * @param Request $request
+ *
+ * @return JsonResponse
+ */
+ public function select2Flag(Request $request): JsonResponse {
+ $page = $request->get('page');
+ $query = (int) $request->get('q');
+
+ return new JsonResponse(Select2::flagSearch($page, $query));
+ }
+
+ /**
+ * @param Request $request
+ *
+ * @return JsonResponse
+ */
+ public function select2Individual(Request $request): JsonResponse {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+
+ $page = (int) $request->get('page');
+ $query = $request->get('q');
+
+ return new JsonResponse(Select2::individualSearch($tree, $page, $query));
+ }
+
+ /**
+ * @param Request $request
+ *
+ * @return JsonResponse
+ */
+ public function select2Media(Request $request): JsonResponse {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+
+ $page = (int) $request->get('page');
+ $query = $request->get('q');
+
+ return new JsonResponse(Select2::mediaObjectSearch($tree, $page, $query));
+ }
+
+ /**
+ * @param Request $request
+ *
+ * @return JsonResponse
+ */
+ public function select2Note(Request $request): JsonResponse {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+
+ $page = (int) $request->get('page');
+ $query = $request->get('q');
+
+ return new JsonResponse(Select2::noteSearch($tree, $page, $query));
+ }
+
+ /**
+ * @param Request $request
+ *
+ * @return JsonResponse
+ */
+ public function select2Place(Request $request): JsonResponse {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+
+ $page = (int) $request->get('page');
+ $query = $request->get('q');
+
+ return new JsonResponse(Select2::placeSearch($tree, $page, $query, true));
+ }
+
+ /**
+ * @param Request $request
+ *
+ * @return JsonResponse
+ */
+ public function select2Repository(Request $request): JsonResponse {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+
+ $page = (int) $request->get('page');
+ $query = $request->get('q');
+
+ return new JsonResponse(Select2::repositorySearch($tree, $page, $query));
+ }
+
+ /**
+ * @param Request $request
+ *
+ * @return JsonResponse
+ */
+ public function select2Source(Request $request): JsonResponse {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+
+ $page = (int) $request->get('page');
+ $query = $request->get('q');
+
+ return new JsonResponse(Select2::sourceSearch($tree, $page, $query));
+ }
+
+ /**
+ * @param Request $request
+ *
+ * @return JsonResponse
+ */
+ public function select2Submitter(Request $request): JsonResponse {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+
+ $page = (int) $request->get('page');
+ $query = $request->get('q');
+
+ return new JsonResponse(Select2::submitterSearch($tree, $page, $query));
+ }
}
diff --git a/app/Http/Controllers/EditGedcomRecordController.php b/app/Http/Controllers/EditGedcomRecordController.php
index 6eea6878b8..b3ea3f161a 100644
--- a/app/Http/Controllers/EditGedcomRecordController.php
+++ b/app/Http/Controllers/EditGedcomRecordController.php
@@ -18,8 +18,12 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\Controllers;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\FlashMessages;
+use Fisharebest\Webtrees\Functions\FunctionsDb;
+use Fisharebest\Webtrees\Functions\FunctionsEdit;
use Fisharebest\Webtrees\GedcomRecord;
use Fisharebest\Webtrees\I18N;
+use Fisharebest\Webtrees\Session;
use Fisharebest\Webtrees\Tree;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
@@ -32,19 +36,183 @@ class EditGedcomRecordController extends AbstractBaseController {
const GEDCOM_FACT_REGEX = '^(1 .*(\n2 .*(\n3 .*(\n4 .*(\n5 .*(\n6 .*))))))?$';
/**
+ * Copy a fact to the clipboard.
+ *
* @param Request $request
*
* @return Response
*/
- public function editRawFact(Request $request): Response {
+ public function copyFact(Request $request): Response {
/** @var Tree $tree */
- $tree = $request->attributes->get('tree');
- $xref = $request->get('xref');
+ $tree = $request->attributes->get('tree');
+
+ $xref = $request->get('xref', '');
$fact_id = $request->get('fact_id');
+
$record = GedcomRecord::getInstance($xref, $tree);
$this->checkRecordAccess($record, true);
+ foreach ($record->getFacts() as $fact) {
+ if ($fact->getFactId() == $fact_id) {
+ switch ($fact->getTag()) {
+ case 'NOTE':
+ case 'SOUR':
+ case 'OBJE':
+ $type = 'all'; // paste this anywhere
+ break;
+ default:
+ $type = $record::RECORD_TYPE; // paste only to the same record type
+ break;
+ }
+ $clipboard = Session::get('clipboard');
+ if (!is_array($clipboard)) {
+ $clipboard = [];
+ }
+ $clipboard[$fact_id] = [
+ 'type' => $type,
+ 'factrec' => $fact->getGedcom(),
+ 'fact' => $fact->getTag(),
+ ];
+
+ // The clipboard only holds 10 facts
+ $clipboard = array_slice($clipboard, -10);
+
+ Session::put('clipboard', $clipboard);
+ FlashMessages::addMessage(I18N::translate('The record has been copied to the clipboard.'));
+ break;
+ }
+ }
+
+ return new Response;
+ }
+
+ /**
+ * Delete a fact.
+ *
+ * @param Request $request
+ *
+ * @return Response
+ */
+ public function deleteFact(Request $request): Response {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+
+ $xref = $request->get('xref', '');
+ $fact_id = $request->get('fact_id');
+
+ $record = GedcomRecord::getInstance($xref, $tree);
+
+ $this->checkRecordAccess($record, true);
+
+ foreach ($record->getFacts() as $fact) {
+ if ($fact->getFactId() == $fact_id && $fact->canShow() && $fact->canEdit()) {
+ $record->deleteFact($fact_id, true);
+ break;
+ }
+ }
+
+ return new Response;
+ }
+
+ /**
+ * Delete a record.
+ *
+ * @param Request $request
+ *
+ * @return Response
+ */
+ public function deleteRecord(Request $request): Response {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+
+ $xref = $request->get('xref', '');
+
+ $record = GedcomRecord::getInstance($xref, $tree);
+
+ $this->checkRecordAccess($record, true);
+
+ if ($record && Auth::isEditor($record->getTree()) && $record->canShow() && $record->canEdit()) {
+ // Delete links to this record
+ foreach (FunctionsDb::fetchAllLinks($record->getXref(), $record->getTree()->getTreeId()) as $xref) {
+ $linker = GedcomRecord::getInstance($xref, $tree);
+ $old_gedcom = $linker->getGedcom();
+ $new_gedcom = FunctionsEdit::removeLinks($old_gedcom, $record->getXref());
+ // FunctionsDb::fetch_all_links() does not take account of pending changes. The links (or even the
+ // record itself) may have already been deleted.
+ if ($old_gedcom !== $new_gedcom) {
+ // If we have removed a link from a family to an individual, and it has only one member
+ if (preg_match('/^0 @' . WT_REGEX_XREF . '@ FAM/', $new_gedcom) && preg_match_all('/\n1 (HUSB|WIFE|CHIL) @(' . WT_REGEX_XREF . ')@/', $new_gedcom, $match) == 1) {
+ // Delete the family
+ $family = GedcomRecord::getInstance($xref, $tree);
+ FlashMessages::addMessage(/* I18N: %s is the name of a family group, e.g. “Husband name + Wife name” */
+ I18N::translate('The family “%s” has been deleted because it only has one member.', $family->getFullName()));
+ $family->deleteRecord();
+ // Delete any remaining link to this family
+ if ($match) {
+ $relict = GedcomRecord::getInstance($match[2][0], $tree);
+ $new_gedcom = $relict->getGedcom();
+ $new_gedcom = FunctionsEdit::removeLinks($new_gedcom, $linker->getXref());
+ $relict->updateRecord($new_gedcom, false);
+ FlashMessages::addMessage(/* I18N: %s are names of records, such as sources, repositories or individuals */
+ I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $relict->getFullName(), $family->getFullName()));
+ }
+ } else {
+ // Remove links from $linker to $record
+ FlashMessages::addMessage(/* I18N: %s are names of records, such as sources, repositories or individuals */
+ I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $linker->getFullName(), $record->getFullName()));
+ $linker->updateRecord($new_gedcom, false);
+ }
+ }
+ }
+ // Delete the record itself
+ $record->deleteRecord();
+ }
+
+ return new Response;
+ }
+
+ /**
+ * Paste a fact from the clipboard into a record.
+ *
+ * @param Request $request
+ *
+ * @return Response
+ */
+ public function pasteFact(Request $request): Response {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+
+ $xref = $request->get('xref', '');
+ $fact_id = $request->get('fact_id');
+
+ $record = GedcomRecord::getInstance($xref, $tree);
+
+ $this->checkRecordAccess($record, true);
+
+ $clipboard = Session::get('clipboard');
+
+ if (isset($clipboard[$fact_id])) {
+ $record->createFact($clipboard[$fact_id]['factrec'], true);
+ }
+
+ return new Response;
+ }
+
+ /**
+ * @param Request $request
+ *
+ * @return Response
+ */
+ public function editRawFact(Request $request): Response {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+ $xref = $request->get('xref');
+ $fact_id = $request->get('fact_id');
+ $record = GedcomRecord::getInstance($xref, $tree);
+
+ $this->checkRecordAccess($record, true);
+
$title = I18N::translate('Edit the raw GEDCOM') . ' - ' . $record->getFullName();
foreach ($record->getFacts() as $fact) {
@@ -73,11 +241,11 @@ class EditGedcomRecordController extends AbstractBaseController {
$fact_id = $request->get('fact_id');
$gedcom = $request->get('gedcom');
- $record = GedcomRecord::getInstance($xref, $tree);
+ $record = GedcomRecord::getInstance($xref, $tree);
// Cleanup the client’s bad editing?
- $gedcom = preg_replace('/[\r\n]+/', "\n", $gedcom); // Empty lines
- $gedcom = trim($gedcom); // Leading/trailing spaces
+ $gedcom = preg_replace('/[\r\n]+/', "\n", $gedcom); // Empty lines
+ $gedcom = trim($gedcom); // Leading/trailing spaces
$this->checkRecordAccess($record, true);
diff --git a/app/Http/Controllers/PendingChangesController.php b/app/Http/Controllers/PendingChangesController.php
index bcdf6e0511..9660a21ccb 100644
--- a/app/Http/Controllers/PendingChangesController.php
+++ b/app/Http/Controllers/PendingChangesController.php
@@ -17,8 +17,10 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\Controllers;
+use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Database;
use Fisharebest\Webtrees\Family;
+use Fisharebest\Webtrees\FlashMessages;
use Fisharebest\Webtrees\Functions\FunctionsImport;
use Fisharebest\Webtrees\GedcomRecord;
use Fisharebest\Webtrees\I18N;
@@ -34,83 +36,54 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
- * Accept and reject pending changes
+ * Show, accept and reject pending changes.
*/
class PendingChangesController extends AbstractBaseController {
/**
- * Show the pending changes for the current tree.
+ * Accept all changes to a tree.
*
* @param Request $request
*
- * @return Response
+ * @return RedirectResponse
*/
- public function showChanges(Request $request): Response {
+ public function acceptAllChanges(Request $request): RedirectResponse {
/** @var Tree $tree */
$tree = $request->attributes->get('tree');
- $url = $request->get('url', route('tree-page', ['ged' => $tree->getName()]));
+ $url = $request->get('url', '');
- $rows = Database::prepare(
- "SELECT c.*, UNIX_TIMESTAMP(c.change_time) + :offset AS change_timestamp, u.user_name, u.real_name, g.gedcom_name, new_gedcom, old_gedcom" .
+ $changes = Database::prepare(
+ "SELECT change_id, xref, old_gedcom, new_gedcom" .
" FROM `##change` c" .
- " JOIN `##user` u USING (user_id)" .
" JOIN `##gedcom` g USING (gedcom_id)" .
- " WHERE c.status='pending'" .
- " ORDER BY gedcom_id, c.xref, c.change_id"
+ " WHERE c.status = 'pending' AND gedcom_id = :tree_id" .
+ " ORDER BY change_id"
)->execute([
- 'offset' => WT_TIMESTAMP_OFFSET,
+ 'tree_id' => $tree->getTreeId(),
])->fetchAll();
- $changes = [];
- foreach ($rows as $row) {
- $change_tree = Tree::findById($row->gedcom_id);
-
- preg_match('/^0 (?:@' . WT_REGEX_XREF . '@ )?(' . WT_REGEX_TAG . ')/', $row->old_gedcom . $row->new_gedcom, $match);
-
- switch ($match[1]) {
- case 'INDI':
- $row->record = new Individual($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
- break;
- case 'FAM':
- $row->record = new Family($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
- break;
- case 'SOUR':
- $row->record = new Source($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
- break;
- case 'REPO':
- $row->record = new Repository($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
- break;
- case 'OBJE':
- $row->record = new Media($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
- break;
- case 'NOTE':
- $row->record = new Note($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
- break;
- default:
- $row->record = new GedcomRecord($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
- break;
+ foreach ($changes as $change) {
+ if (empty($change->new_gedcom)) {
+ // delete
+ FunctionsImport::updateRecord($change->old_gedcom, $change->gedcom_id, true);
+ } else {
+ // add/update
+ FunctionsImport::updateRecord($change->new_gedcom, $change->gedcom_id, false);
}
- $changes[$row->gedcom_id][$row->xref][] = $row;
- }
-
- $title = I18N::translate('Pending changes');
+ Database::prepare(
+ "UPDATE `##change` SET status = 'accepted' WHERE change_id = :change_id"
+ )->execute([
+ 'change_id' => $change->change_id,
+ ]);
- // If the current tree has changes, activate that tab. Otherwise activate the first tab.
- if (empty($changes[$tree->getTreeId()])) {
- reset($changes);
- $active_tree_id = key($changes);
- } else {
- $active_tree_id = $tree->getTreeId();
+ Log::addEditLog('Accepted change ' . $change->change_id . ' for ' . $change->xref . ' / ' . $tree->getName());
}
- return $this->viewResponse('pending-changes-page', [
- 'active_tree_id' => $active_tree_id,
- 'changes' => $changes,
- 'title' => $title,
- 'tree' => $tree,
- 'url' => $url,
- ]);
+ return new RedirectResponse(route('show-pending', [
+ 'ged' => $tree->getName(),
+ 'url' => $url,
+ ]));
}
/**
@@ -167,6 +140,62 @@ class PendingChangesController extends AbstractBaseController {
}
/**
+ * Accept all changes to a single record.
+ *
+ * @param Request $request
+ *
+ * @return Response
+ */
+ public function acceptChanges(Request $request): Response {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+
+ $xref = $request->get('xref', '');
+
+ $record = GedcomRecord::getInstance($xref, $tree);
+
+ $this->checkRecordAccess($record, false);
+
+ if ($record && Auth::isModerator($tree)) {
+ if ($record->isPendingDeletion()) {
+ FlashMessages::addMessage(/* I18N: %s is the name of a genealogy record */
+ I18N::translate('“%s” has been deleted.', $record->getFullName()));
+ } else {
+ FlashMessages::addMessage(/* I18N: %s is the name of a genealogy record */
+ I18N::translate('The changes to “%s” have been accepted.', $record->getFullName()));
+ }
+ FunctionsImport::acceptAllChanges($record->getXref(), $record->getTree()->getTreeId());
+ }
+
+ return new Response;
+ }
+
+ /**
+ * Reject all changes to a tree.
+ *
+ * @param Request $request
+ *
+ * @return RedirectResponse
+ */
+ public function rejectAllChanges(Request $request): RedirectResponse {
+ /** @var Tree $tree */
+ $tree = $request->attributes->get('tree');
+
+ $url = $request->get('url', '');
+
+ Database::prepare(
+ "UPDATE `##change` SET status = 'rejected' WHERE status = 'pending' AND gedcom_id = :tree_id"
+ )->execute([
+ 'tree_id' => $tree->getTreeId(),
+ ]);
+
+ return new RedirectResponse(route('show-pending', [
+ 'ged' => $tree->getName(),
+ 'url' => $url,
+ ]));
+ }
+
+ /**
* Reject a change (and all subsequent changes) to a single record.
*
* @param Request $request
@@ -202,74 +231,103 @@ class PendingChangesController extends AbstractBaseController {
}
/**
- * Accept all changes to a tree.
+ * Accept all changes to a single record.
*
* @param Request $request
*
- * @return RedirectResponse
+ * @return Response
*/
- public function acceptAllChanges(Request $request): RedirectResponse {
+ public function rejectChanges(Request $request): Response {
/** @var Tree $tree */
$tree = $request->attributes->get('tree');
- $url = $request->get('url', '');
+ $xref = $request->get('xref', '');
- $changes = Database::prepare(
- "SELECT change_id, xref, old_gedcom, new_gedcom" .
- " FROM `##change` c" .
- " JOIN `##gedcom` g USING (gedcom_id)" .
- " WHERE c.status = 'pending' AND gedcom_id = :tree_id" .
- " ORDER BY change_id"
- )->execute([
- 'tree_id' => $tree->getTreeId(),
- ])->fetchAll();
-
- foreach ($changes as $change) {
- if (empty($change->new_gedcom)) {
- // delete
- FunctionsImport::updateRecord($change->old_gedcom, $change->gedcom_id, true);
- } else {
- // add/update
- FunctionsImport::updateRecord($change->new_gedcom, $change->gedcom_id, false);
- }
+ $record = GedcomRecord::getInstance($xref, $tree);
- Database::prepare(
- "UPDATE `##change` SET status = 'accepted' WHERE change_id = :change_id"
- )->execute([
- 'change_id' => $change->change_id,
- ]);
+ $this->checkRecordAccess($record, false);
- Log::addEditLog('Accepted change ' . $change->change_id . ' for ' . $change->xref . ' / ' . $tree->getName());
+ if ($record && Auth::isModerator($tree)) {
+ FlashMessages::addMessage(/* I18N: %s is the name of an individual, source or other record */ I18N::translate('The changes to “%s” have been rejected.', $record->getFullName()));
+ FunctionsImport::rejectAllChanges($record);
}
- return new RedirectResponse(route('show-pending', [
- 'ged' => $tree->getName(),
- 'url' => $url,
- ]));
+ return new Response;
}
/**
- * Reject all changes to a tree.
+ * Show the pending changes for the current tree.
*
* @param Request $request
*
- * @return RedirectResponse
+ * @return Response
*/
- public function rejectAllChanges(Request $request): RedirectResponse {
+ public function showChanges(Request $request): Response {
/** @var Tree $tree */
$tree = $request->attributes->get('tree');
- $url = $request->get('url', '');
+ $url = $request->get('url', route('tree-page', ['ged' => $tree->getName()]));
- Database::prepare(
- "UPDATE `##change` SET status = 'rejected' WHERE status = 'pending' AND gedcom_id = :tree_id"
+ $rows = Database::prepare(
+ "SELECT c.*, UNIX_TIMESTAMP(c.change_time) + :offset AS change_timestamp, u.user_name, u.real_name, g.gedcom_name, new_gedcom, old_gedcom" .
+ " FROM `##change` c" .
+ " JOIN `##user` u USING (user_id)" .
+ " JOIN `##gedcom` g USING (gedcom_id)" .
+ " WHERE c.status='pending'" .
+ " ORDER BY gedcom_id, c.xref, c.change_id"
)->execute([
- 'tree_id' => $tree->getTreeId(),
- ]);
+ 'offset' => WT_TIMESTAMP_OFFSET,
+ ])->fetchAll();
- return new RedirectResponse(route('show-pending', [
- 'ged' => $tree->getName(),
- 'url' => $url,
- ]));
+ $changes = [];
+ foreach ($rows as $row) {
+ $change_tree = Tree::findById($row->gedcom_id);
+
+ preg_match('/^0 (?:@' . WT_REGEX_XREF . '@ )?(' . WT_REGEX_TAG . ')/', $row->old_gedcom . $row->new_gedcom, $match);
+
+ switch ($match[1]) {
+ case 'INDI':
+ $row->record = new Individual($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
+ break;
+ case 'FAM':
+ $row->record = new Family($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
+ break;
+ case 'SOUR':
+ $row->record = new Source($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
+ break;
+ case 'REPO':
+ $row->record = new Repository($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
+ break;
+ case 'OBJE':
+ $row->record = new Media($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
+ break;
+ case 'NOTE':
+ $row->record = new Note($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
+ break;
+ default:
+ $row->record = new GedcomRecord($row->xref, $row->old_gedcom, $row->new_gedcom, $change_tree);
+ break;
+ }
+
+ $changes[$row->gedcom_id][$row->xref][] = $row;
+ }
+
+ $title = I18N::translate('Pending changes');
+
+ // If the current tree has changes, activate that tab. Otherwise activate the first tab.
+ if (empty($changes[$tree->getTreeId()])) {
+ reset($changes);
+ $active_tree_id = key($changes);
+ } else {
+ $active_tree_id = $tree->getTreeId();
+ }
+
+ return $this->viewResponse('pending-changes-page', [
+ 'active_tree_id' => $active_tree_id,
+ 'changes' => $changes,
+ 'title' => $title,
+ 'tree' => $tree,
+ 'url' => $url,
+ ]);
}
}
diff --git a/app/Http/Controllers/ReportEngineController.php b/app/Http/Controllers/ReportEngineController.php
index 37f8018a1b..e8ed17fe07 100644
--- a/app/Http/Controllers/ReportEngineController.php
+++ b/app/Http/Controllers/ReportEngineController.php
@@ -108,15 +108,15 @@ class ReportEngineController extends AbstractBaseController {
switch ($input['lookup']) {
case 'INDI':
$individual = Individual::getInstance($pid, $tree);
- $input['control'] = FunctionsEdit::formControlIndividual($individual, $attributes);
+ $input['control'] = FunctionsEdit::formControlIndividual($tree, $individual, $attributes);
break;
case 'FAM':
$family = Family::getInstance($pid, $tree);
- $input['control'] = FunctionsEdit::formControlFamily($family, $attributes);
+ $input['control'] = FunctionsEdit::formControlFamily($tree, $family, $attributes);
break;
case 'SOUR':
$source = Source::getInstance($pid, $tree);
- $input['control'] = FunctionsEdit::formControlSource($source, $attributes);
+ $input['control'] = FunctionsEdit::formControlSource($tree, $source, $attributes);
break;
case 'DATE':
$attributes += [
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 9219ea21f2..a43c00e8cd 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -32,6 +32,26 @@ use Symfony\Component\HttpFoundation\Response;
*/
class UserController extends AbstractBaseController {
/**
+ * Delete a user.
+ *
+ * @param Request $request
+ *
+ * @return Response
+ */
+ public function delete(Request $request): Response {
+ $user_id = (int) $request->get('user_id');
+
+ $user = User::find($user_id);
+
+ if ($user && Auth::isAdmin() && Auth::user() !== $user) {
+ Log::addAuthenticationLog('Deleted user: ' . $user->getUserName());
+ $user->delete();
+ }
+
+ return new Response;
+ }
+
+ /**
* Select a language.
*
* @param Request $request
diff --git a/app/Module/GoogleMapsModule.php b/app/Module/GoogleMapsModule.php
index 0d7369c9f7..03b3164d59 100644
--- a/app/Module/GoogleMapsModule.php
+++ b/app/Module/GoogleMapsModule.php
@@ -987,7 +987,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface,
<?= I18N::translate('Individual') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual($controller->root, ['id' => 'rootid', 'name' => 'rootid']) ?>
+ <?= FunctionsEdit::formControlIndividual($WT_TREE, $controller->root, ['id' => 'rootid', 'name' => 'rootid']) ?>
</div>
</div>
diff --git a/app/Module/StoriesModule.php b/app/Module/StoriesModule.php
index 163db81601..22d72db867 100644
--- a/app/Module/StoriesModule.php
+++ b/app/Module/StoriesModule.php
@@ -233,7 +233,7 @@ class StoriesModule extends AbstractModule implements ModuleTabInterface, Module
<?= I18N::translate('Individual') ?>
</label>
<div class="col-sm-9">
- <?= FunctionsEdit::formControlIndividual($individual, ['id' => 'xref', 'name' => 'xref']) ?>
+ <?= FunctionsEdit::formControlIndividual($WT_TREE, $individual, ['id' => 'xref', 'name' => 'xref']) ?>
</div>
</div>
diff --git a/app/Select2.php b/app/Select2.php
index c029effb4f..903c37ba60 100644
--- a/app/Select2.php
+++ b/app/Select2.php
@@ -35,15 +35,15 @@ class Select2 extends Html {
const DELAY = '350';
// API endpoints
- const URL_FAM = 'action.php?action=select2-family';
- const URL_INDI = 'action.php?action=select2-individual';
- const URL_NOTE = 'action.php?action=select2-note';
- const URL_OBJE = 'action.php?action=select2-media';
- const URL_PLAC = 'action.php?action=select2-place';
- const URL_REPO = 'action.php?action=select2-repository';
- const URL_SOUR = 'action.php?action=select2-source';
- const URL_SUBM = 'action.php?action=select2-submitter';
- const URL_FLAG = 'action.php?action=select2-flag';
+ const URL_FAM = 'index.php?route=select2-family';
+ const URL_INDI = 'index.php?route=select2-individual';
+ const URL_NOTE = 'index.php?route=select2-note';
+ const URL_OBJE = 'index.php?route=select2-media';
+ const URL_PLAC = 'index.php?route=select2-place';
+ const URL_REPO = 'index.php?route=select2-repository';
+ const URL_SOUR = 'index.php?route=select2-source';
+ const URL_SUBM = 'index.php?route=select2-submitter';
+ const URL_FLAG = 'index.php?route=select2-flag';
/**
* Select2 configuration that is common to all searches.
@@ -65,10 +65,14 @@ class Select2 extends Html {
/**
* Select2 configuration for a family lookup.
*
+ * @param Tree $tree
+ *
* @return string[]
*/
- public static function familyConfig() {
- return self::commonConfig() + ['data-ajax--url' => self::URL_FAM];
+ public static function familyConfig(Tree $tree) {
+ $url = route('select2-family', ['ged' => $tree->getName()]);
+
+ return self::commonConfig() + ['data-ajax--url' => $url];
}
/**
@@ -134,7 +138,7 @@ class Select2 extends Html {
* @return string[]
*/
public static function flagConfig() {
- return self::commonConfig() + ['data-ajax--url' => self::URL_FLAG];
+ return self::commonConfig() + ['data-ajax--url' => route('select2-flag')];
}
/**
@@ -198,10 +202,14 @@ class Select2 extends Html {
/**
* Select2 configuration for an individual lookup.
*
+ * @param Tree $tree
+ *
* @return string[]
*/
- public static function individualConfig() {
- return self::commonConfig() + ['data-ajax--url' => self::URL_INDI];
+ public static function individualConfig(Tree $tree) {
+ $url = route('select2-individual', ['ged' => $tree->getName()]);
+
+ return self::commonConfig() + ['data-ajax--url' => $url];
}
/**
@@ -258,10 +266,14 @@ class Select2 extends Html {
/**
* Select2 configuration for a media object lookup.
*
+ * @param Tree $tree
+ *
* @return string[]
*/
- public static function mediaObjectConfig() {
- return self::commonConfig() + ['data-ajax--url' => self::URL_OBJE];
+ public static function mediaObjectConfig(Tree $tree) {
+ $url = route('select2-media', ['ged' => $tree->getName()]);
+
+ return self::commonConfig() + ['data-ajax--url' => $url];
}
/**
@@ -317,10 +329,14 @@ class Select2 extends Html {
/**
* Select2 configuration for a note.
*
+ * @param Tree $tree
+ *
* @return string[]
*/
- public static function noteConfig() {
- return self::commonConfig() + ['data-ajax--url' => self::URL_NOTE];
+ public static function noteConfig(Tree $tree) {
+ $url = route('select2-note', ['ged' => $tree->getName()]);
+
+ return self::commonConfig() + ['data-ajax--url' => $url];
}
/**
@@ -376,10 +392,14 @@ class Select2 extends Html {
/**
* Select2 configuration for a note.
*
+ * @param Tree $tree
+ *
* @return string[]
*/
- public static function placeConfig() {
- return self::commonConfig() + ['data-ajax--url' => self::URL_PLAC];
+ public static function placeConfig(Tree $tree) {
+ $url = route('select2-place', ['ged' => $tree->getName()]);
+
+ return self::commonConfig() + ['data-ajax--url' => $url];
}
/**
@@ -469,10 +489,14 @@ class Select2 extends Html {
/**
* Select2 configuration for a repository lookup.
*
+ * @param Tree $tree
+ *
* @return string[]
*/
- public static function repositoryConfig() {
- return self::commonConfig() + ['data-ajax--url' => self::URL_REPO];
+ public static function repositoryConfig(Tree $tree) {
+ $url = route('select2-repository', ['ged' => $tree->getName()]);
+
+ return self::commonConfig() + ['data-ajax--url' => $url];
}
/**
@@ -528,10 +552,14 @@ class Select2 extends Html {
/**
* Select2 configuration for a source lookup.
*
+ * @param Tree $tree
+ *
* @return string[]
*/
- public static function sourceConfig() {
- return self::commonConfig() + ['data-ajax--url' => self::URL_SOUR];
+ public static function sourceConfig(Tree $tree) {
+ $url = route('select2-source', ['ged' => $tree->getName()]);
+
+ return self::commonConfig() + ['data-ajax--url' => $url];
}
/**
@@ -587,10 +615,14 @@ class Select2 extends Html {
/**
* Select2 configuration for a submitter lookup.
*
+ * @param Tree $tree
+ *
* @return string[]
*/
- public static function submitterConfig() {
- return self::commonConfig() + ['data-ajax--url' => self::URL_SUBM];
+ public static function submitterConfig(Tree $tree) {
+ $url = route('select2-submitter', ['ged' => $tree->getName()]);
+
+ return self::commonConfig() + ['data-ajax--url' => $url];
}
/**
diff --git a/edit_interface.php b/edit_interface.php
index 62009c327e..0466c8e632 100644
--- a/edit_interface.php
+++ b/edit_interface.php
@@ -795,7 +795,7 @@ case 'addfamlink':
<?= I18N::translate('Family') ?>
</label>
<div class="col-sm-9">
- <?= FunctionsEdit::formControlFamily(null, ['id' => 'famid', 'name' => 'famid']) ?>
+ <?= FunctionsEdit::formControlFamily($controller->tree(), null, ['id' => 'famid', 'name' => 'famid']) ?>
</div>
</div>
@@ -911,7 +911,7 @@ case 'linkspouse':
<?= $label ?>
</label>
<div class="col-sm-9">
- <?= FunctionsEdit::formControlIndividual(null, ['id' => 'spouse', 'name' => 'spid']) ?>
+ <?= FunctionsEdit::formControlIndividual($controller->tree(), null, ['id' => 'spouse', 'name' => 'spid']) ?>
</div>
</div>
@@ -1055,7 +1055,7 @@ case 'add-media-link':
</button>
</span>
<?php endif ?>
- <?= FunctionsEdit::formControlMediaObject(null, ['id' => 'media-xref', 'name' => 'media-xref', 'data-element-id' => 'media-xref']) ?>
+ <?= FunctionsEdit::formControlMediaObject($controller->tree(), null, ['id' => 'media-xref', 'name' => 'media-xref', 'data-element-id' => 'media-xref']) ?>
</div>
</div>
</div>
diff --git a/public/assets-2.0.0/js/webtrees.js b/public/assets-2.0.0/js/webtrees.js
index 0e7345ee93..f670ad410f 100644
--- a/public/assets-2.0.0/js/webtrees.js
+++ b/public/assets-2.0.0/js/webtrees.js
@@ -1 +1 @@
-"use strict";function expand_layer(e){return $("#"+e+"_img").toggleClass("icon-plus icon-minus"),$("#"+e).slideToggle("fast"),$("#"+e+"-alt").toggle(),!1}function accept_changes(e){return $.post("action.php",{action:"accept-changes",xref:e,ged:WT_GEDCOM},function(){location.reload()}),!1}function reject_changes(e){return $.post("action.php",{action:"reject-changes",xref:e,ged:WT_GEDCOM},function(){location.reload()}),!1}function delete_record(e,t,n){return confirm(e)&&$.post("action.php",{action:"delete-record",xref:t,ged:void 0===n?WT_GEDCOM:n},function(){location.reload()}),!1}function delete_fact(e,t,n){return confirm(e)&&$.post("action.php",{action:"delete-fact",xref:t,fact_id:n,ged:WT_GEDCOM},function(){location.reload()}),!1}function unlink_media(e,t,n){return confirm(e)&&$.post("action.php",{action:"unlink-media",source:t,target:n,ged:WT_GEDCOM},function(){location.reload()}),!1}function copy_fact(e,t){return $.post("action.php",{action:"copy-fact",xref:e,fact_id:t,ged:WT_GEDCOM},function(){location.reload()}),!1}function paste_fact(e,t){return $.post("action.php",{action:"paste-fact",xref:e,fact_id:$(t).val(),ged:WT_GEDCOM},function(){location.reload()}),!1}function delete_user(e,t){return confirm(e)&&$.post("action.php",{action:"delete-user",user_id:t},function(){location.reload()}),!1}function masquerade(e){return $.post("index.php",{route:"masquerade",user_id:e},function(){location.reload()}),!1}function addmedia_links(e,t,n){return pastefield=e,insertRowToTable(t,n),!1}function valid_date(e){var t=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"],n=["MUHAR","SAFAR","RABIA","RABIT","JUMAA","JUMAT","RAJAB","SHAAB","RAMAD","SHAWW","DHUAQ","DHUAH"],o=["TSH","CSH","KSL","TVT","SHV","ADR","ADS","NSN","IYR","SVN","TMZ","AAV","ELL"],a=["VEND","BRUM","FRIM","NIVO","PLUV","VENT","GERM","FLOR","PRAI","MESS","THER","FRUC","COMP"],l=["FARVA","ORDIB","KHORD","TIR","MORDA","SHAHR","MEHR","ABAN","AZAR","DEY","BAHMA","ESFAN"],i=e.value,s=i.split("("),r="";if(s.length>1&&(i=s[0],r=s[1]),i=i.toUpperCase(),i=i.replace(/\s+/," "),i=i.replace(/(^\s)|(\s$)/,""),i=i.replace(/(\d)([A-Z])/,"$1 $2"),i=i.replace(/([A-Z])(\d)/,"$1 $2"),i.match(/^Q ([1-4]) (\d\d\d\d)$/)&&(i="BET "+t[3*RegExp.$1-3]+" "+RegExp.$2+" AND "+t[3*RegExp.$1-1]+" "+RegExp.$2),i.match(/^(@#DHIJRI@|HIJRI)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(i="@#DHIJRI@"+RegExp.$2+n[parseInt(RegExp.$3,10)-1]+RegExp.$4),i.match(/^(@#DJALALI@|JALALI)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(i="@#DJALALI@"+RegExp.$2+l[parseInt(RegExp.$3,10)-1]+RegExp.$4),i.match(/^(@#DHEBREW@|HEBREW)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(i="@#DHEBREW@"+RegExp.$2+o[parseInt(RegExp.$3,10)-1]+RegExp.$4),i.match(/^(@#DFRENCH R@|FRENCH)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(i="@#DFRENCH R@"+RegExp.$2+a[parseInt(RegExp.$3,10)-1]+RegExp.$4),/^([^\d]*)(\d+)[^\d](\d+)[^\d](\d+)$/i.exec(i)){var c=RegExp.$1,d=parseInt(RegExp.$2,10),u=parseInt(RegExp.$3,10),p=parseInt(RegExp.$4,10),f="DMY";"undefined"!=typeof locale_date_format&&("MDY"!==locale_date_format&&"YMD"!==locale_date_format||(f=locale_date_format));var m=(new Date).getFullYear(),h=m%100,g=m-h;"DMY"===f&&d<=31&&u<=12||d>13&&d<=31&&u<=12&&p>31?i=c+d+" "+t[u-1]+" "+(p>=100?p:p<=h?p+g:p+g-100):"MDY"===f&&d<=12&&u<=31||u>13&&u<=31&&d<=12&&p>31?i=c+u+" "+t[d-1]+" "+(p>=100?p:p<=h?p+g:p+g-100):("YMD"===f&&u<=12&&p<=31||p>13&&p<=31&&u<=12&&d>31)&&(i=c+p+" "+t[u-1]+" "+(d>=100?d:d<=h?d+g:d+g-100))}i=i.replace(/^[>]([\w ]+)$/,"AFT $1"),i=i.replace(/^[<]([\w ]+)$/,"BEF $1"),i=i.replace(/^([\w ]+)[-]$/,"FROM $1"),i=i.replace(/^[-]([\w ]+)$/,"TO $1"),i=i.replace(/^[~]([\w ]+)$/,"ABT $1"),i=i.replace(/^[*]([\w ]+)$/,"EST $1"),i=i.replace(/^[#]([\w ]+)$/,"CAL $1"),i=i.replace(/^([\w ]+) ?- ?([\w ]+)$/,"BET $1 AND $2"),i=i.replace(/^([\w ]+) ?~ ?([\w ]+)$/,"FROM $1 TO $2"),i=i.replace(/(JANUARY)/,"JAN"),i=i.replace(/(FEBRUARY)/,"FEB"),i=i.replace(/(MARCH)/,"MAR"),i=i.replace(/(APRIL)/,"APR"),i=i.replace(/(MAY)/,"MAY"),i=i.replace(/(JUNE)/,"JUN"),i=i.replace(/(JULY)/,"JUL"),i=i.replace(/(AUGUST)/,"AUG"),i=i.replace(/(SEPTEMBER)/,"SEP"),i=i.replace(/(OCTOBER)/,"OCT"),i=i.replace(/(NOVEMBER)/,"NOV"),i=i.replace(/(DECEMBER)/,"DEC"),i=i.replace(/(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)\.? (\d\d?)[, ]+(\d\d\d\d)/,"$2 $1 $3"),i=i.replace(/(^| )(\d [A-Z]{3,5} \d{4})/,"$10$2"),r&&(i=i+" ("+r),e.value!==i&&(e.value=i)}function show_submenu(e,t){var n=document.body.scrollWidth+document.documentElement.scrollLeft,o=document.getElementById(e);if(o&&o.style){document.all?n=document.body.offsetWidth:(n=document.body.scrollWidth+document.documentElement.scrollLeft-55,"rtl"===textDirection&&o.offsetLeft+o.offsetWidth+10);for(var a=0,l=o.childNodes.length,i=0;i<l;i++){var s=o.childNodes[i];s.offsetWidth>a+5&&(a=s.offsetWidth)}o.offsetWidth<a&&(o.style.width=a+"px");var r;if((r=document.getElementById(t))&&(o.style.left=r.style.left,o.offsetLeft+o.offsetWidth+10>n)){var c=n-o.offsetWidth;o.style.left=c+"px"}o.offsetLeft<0&&(o.style.left="0px"),o.offsetHeight>500&&(o.style.height="400px",o.style.overflow="auto"),o.style.visibility="visible"}clearTimeout(menutimeouts[e]),menutimeouts[e]=null}function hide_submenu(e){if("number"==typeof menutimeouts[e]){var t=document.getElementById(e);t&&t.style&&(t.style.visibility="hidden"),clearTimeout(menutimeouts[e]),menutimeouts[e]=null}}function timeout_submenu(e){"number"!=typeof menutimeouts[e]&&(menutimeouts[e]=setTimeout("hide_submenu('"+e+"')",100))}function statusDisable(e){var t=document.getElementById(e);t.checked=!1,t.disabled=!0}function statusEnable(e){document.getElementById(e).disabled=!1}function statusChecked(e){document.getElementById(e).checked=!0}function cal_setMonthNames(e,t,n,o,a,l,i,s,r,c,d,u){monthLabels[1]=e,monthLabels[2]=t,monthLabels[3]=n,monthLabels[4]=o,monthLabels[5]=a,monthLabels[6]=l,monthLabels[7]=i,monthLabels[8]=s,monthLabels[9]=r,monthLabels[10]=c,monthLabels[11]=d,monthLabels[12]=u}function cal_setDayHeaders(e,t,n,o,a,l,i){daysOfWeek[0]=e,daysOfWeek[1]=t,daysOfWeek[2]=n,daysOfWeek[3]=o,daysOfWeek[4]=a,daysOfWeek[5]=l,daysOfWeek[6]=i}function cal_setWeekStart(e){e>=0&&e<7&&(weekStart=e)}function calendarWidget(e,t){var n=document.getElementById(e),o=document.getElementById(t);if("visible"===n.style.visibility)return n.style.visibility="hidden",!1;if("show"===n.style.visibility)return n.style.visibility="hide",!1;var a,l=/((\d+ (JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC) )?\d+)/i;return a=l.exec(o.value)?new Date(RegExp.$1):new Date,n.innerHTML=cal_generateSelectorContent(t,e,a),"hidden"===n.style.visibility?(n.style.visibility="visible",!1):"hide"===n.style.visibility&&(n.style.visibility="show",!1)}function cal_generateSelectorContent(e,t,n){var o,a,l='<table border="1"><tr>';for(l+='<td><select class="form-control" id="'+e+'_daySelect" onchange="return cal_updateCalendar(\''+e+"', '"+t+"');\">",o=1;o<32;o++)l+='<option value="'+o+'"',n.getDate()===o&&(l+=' selected="selected"'),l+=">"+o+"</option>";for(l+="</select></td>",l+='<td><select class="form-control" id="'+e+'_monSelect" onchange="return cal_updateCalendar(\''+e+"', '"+t+"');\">",o=1;o<13;o++)l+='<option value="'+o+'"',n.getMonth()+1===o&&(l+=' selected="selected"'),l+=">"+monthLabels[o]+"</option>";for(l+="</select></td>",l+='<td><input class="form-control" type="text" id="'+e+'_yearInput" size="5" value="'+n.getFullYear()+'" onchange="return cal_updateCalendar(\''+e+"', '"+t+"');\" /></td></tr>",l+='<tr><td colspan="3">',l+='<table width="100%">',l+="<tr>",a=weekStart,o=0;o<7;o++)l+="<td ",l+='class="descriptionbox"',l+=">",l+=daysOfWeek[a],l+="</td>",++a>6&&(a=0);l+="</tr>";var i=new Date(n.getFullYear(),n.getMonth(),1),s=i.getDay();s-=weekStart;for(i=i.getTime()-864e5*s+432e5,i=new Date(i),a=0;a<6;a++){for(l+="<tr>",o=0;o<7;o++){l+="<td ",i.getMonth()===n.getMonth()?i.getDate()===n.getDate()?l+='class="descriptionbox"':l+='class="optionbox"':l+='style="background-color:#EAEAEA; border: solid #AAAAAA 1px;"',l+='><a href="#" onclick="return cal_dateClicked(\''+e+"', '"+t+"', "+i.getFullYear()+", "+i.getMonth()+", "+i.getDate()+');">',l+=i.getDate(),l+="</a></td>";var r=i.getTime()+864e5;i=new Date(r)}l+="</tr>"}return l+="</table>",l+="</td></tr>",l+="</table>"}function cal_setDateField(e,t,n,o){var a=document.getElementById(e);return!!a&&(o<10&&(o="0"+o),a.value=o+" "+monthShort[n+1]+" "+t,!1)}function cal_updateCalendar(e,t){var n=document.getElementById(e+"_daySelect");if(!n)return!1;var o=document.getElementById(e+"_monSelect");if(!o)return!1;var a=document.getElementById(e+"_yearInput");if(!a)return!1;var l=parseInt(o.options[o.selectedIndex].value,10);l-=1;var i=new Date(a.value,l,n.options[n.selectedIndex].value);cal_setDateField(e,i.getFullYear(),i.getMonth(),i.getDate());var s=document.getElementById(t);return s?(s.innerHTML=cal_generateSelectorContent(e,t,i),!1):(alert("no dateDiv "+t),!1)}function cal_dateClicked(e,t,n,o,a){return cal_setDateField(e,n,o,a),calendarWidget(t,e),!1}function openerpasteid(e){window.opener.paste_id&&window.opener.paste_id(e),window.close()}function paste_id(e){pastefield.value=e}function pastename(e){nameElement&&(nameElement.innerHTML=e),remElement&&(remElement.style.display="block")}function paste_char(e){document.selection?(pastefield.focus(),document.selection.createRange().text=e):pastefield.selectionStart||0===pastefield.selectionStart?(pastefield.value=pastefield.value.substring(0,pastefield.selectionStart)+e+pastefield.value.substring(pastefield.selectionEnd,pastefield.value.length),pastefield.selectionStart=pastefield.selectionEnd=pastefield.selectionStart+e.length):pastefield.value+=e,"NPFX"!==pastefield.id&&"GIVN"!==pastefield.id&&"SPFX"!==pastefield.id&&"SURN"!==pastefield.id&&"NSFX"!==pastefield.id||updatewholename()}function ilinkitem(e,t,n){return n=void 0===n?WT_GEDCOM:n,window.open("inverselink.php?mediaid="+encodeURIComponent(e)+"&linkto="+encodeURIComponent(t)+"&ged="+encodeURIComponent(n),"_blank",find_window_specs),!1}function persistent_toggle(e,t){var n=document.getElementById(e),o=document.querySelectorAll(t),a=localStorage.getItem(e);if(n){""!==a&&(a="none"),n.checked=""===a;for(var l=0;l<o.length;++l)o[l].style.display=a;n.addEventListener("click",function(){console.log(a),a=""===a?"none":"",localStorage.setItem(e,a);for(var t=0;t<o.length;++t)o[t].style.display=a})}}function valid_lati_long(e,t,n){var o=e.value.toUpperCase();o=o.replace(/(^\s*)|(\s*$)/g,""),o=o.replace(/ /g,":"),o=o.replace(/\+/g,""),o=o.replace(/-/g,n),o=o.replace(/,/g,"."),o=o.replace(/\u00b0/g,":"),o=o.replace(/\u0027/g,":"),o=o.replace(/^([0-9]+):([0-9]+):([0-9.]+)(.*)/g,function(e,t,n,o,a){var l=parseFloat(t);return l+=n/60,l+=o/3600,l=Math.round(1e4*l)/1e4,a+l}),o=o.replace(/^([0-9]+):([0-9]+)(.*)/g,function(e,t,n,o){var a=parseFloat(t);return a+=n/60,a=Math.round(1e4*a)/1e4,o+a}),o=o.replace(/(.*)([N|S|E|W]+)$/g,"$2$1"),o&&o.charAt(0)!==n&&o.charAt(0)!==t&&(o=t+o),e.value=o}function activate_colorbox(e){$.extend($.colorbox.settings,{fixed:!0,current:"",previous:"",next:"",slideshowStart:"",slideshowStop:"",close:""}),e&&$.extend($.colorbox.settings,e),$("body").on("click","a.gallery",function(){$("a[type^=image].gallery").colorbox({photo:!0,maxWidth:"95%",maxHeight:"95%",rel:"gallery",slideshow:!0,slideshowAuto:!1,onComplete:function(){$(".cboxPhoto").unbind("click"),wheelzoom(document.querySelectorAll(".cboxPhoto"))}})})}function autocomplete(e){$(e).each(function(){$(this).typeahead(null,{display:"value",source:new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:this.dataset.autocompleteUrl,wildcard:"QUERY"}})})})}function insertTextAtCursor(e,t){var n=e.scrollTop,o=e.selectionStart,a=e.value.substring(0,o),l=e.value.substring(e.selectionEnd,e.value.length);e.value=a+t+l,e.selectionStart=o+t.length,e.selectionEnd=e.selectionStart,e.focus(),e.scrollTop=n}var textDirection=$("html").attr("dir"),pastefield,menutimeouts=[],monthLabels=[];monthLabels[1]="January",monthLabels[2]="February",monthLabels[3]="March",monthLabels[4]="April",monthLabels[5]="May",monthLabels[6]="June",monthLabels[7]="July",monthLabels[8]="August",monthLabels[9]="September",monthLabels[10]="October",monthLabels[11]="November",monthLabels[12]="December";var monthShort=[];monthShort[1]="JAN",monthShort[2]="FEB",monthShort[3]="MAR",monthShort[4]="APR",monthShort[5]="MAY",monthShort[6]="JUN",monthShort[7]="JUL",monthShort[8]="AUG",monthShort[9]="SEP",monthShort[10]="OCT",monthShort[11]="NOV",monthShort[12]="DEC";var daysOfWeek=[];daysOfWeek[0]="S",daysOfWeek[1]="M",daysOfWeek[2]="T",daysOfWeek[3]="W",daysOfWeek[4]="T",daysOfWeek[5]="F",daysOfWeek[6]="S";var weekStart=0;$("body").on("click",".iconz",function(e){function t(){o.parent().css("z-index",100),n(),i.addClass("nameZoom"),l.hide(0,function(){a.slideDown()})}function n(){o.toggleClass(function(){return s+" "+s+"-expanded"})}e.stopPropagation();var o=$(this).closest(".person_box_template"),a=o.find(".inout"),l=o.find(".inout2"),i=o.find(".namedef"),s=o.attr("class").match(/(box-style[0-2])/)[1];a.text().length?o.hasClass(s)?t():function(){a.slideUp(function(){l.show(0),i.removeClass("nameZoom"),n(),o.parent().css("z-index","")})}():(o.css("cursor","progress"),a.load("index.php",{route:"expand-chart-box",xref:o.data("pid"),ged:WT_GEDCOM},function(){o.css("cursor",""),t()})),o.find(".iconz").toggleClass("icon-zoomin icon-zoomout")}),$(function(){$.ajaxSetup({headers:{"X-CSRF-TOKEN":$("meta[name=csrf]").attr("content")}}),$("[data-ajax-url]").each(function(){$(this).load($(this).data("ajaxUrl"))}),$('a[data-toggle="tab"][data-href]').on("show.bs.tab",function(){$(this.getAttribute("href")+":empty").load($(this).data("href"))}),autocomplete("input[data-autocomplete-url]"),$("select.select2").select2({escapeMarkup:function(e){return e}}),$("select.select2").on("select2:unselect",function(e){$(e.delegateTarget).append('<option value="" selected="selected"></option>')}),$.fn.dataTableExt.oSort["text-asc"]=function(e,t){return e.localeCompare(t,document.documentElement.lang,{sensitivity:"base"})},$.fn.dataTableExt.oSort["text-desc"]=function(e,t){return t.localeCompare(e,document.documentElement.lang,{sensitivity:"base"})},$("table.datatables").each(function(){$(this).DataTable(),$(this).show()}),$(".wt-modal-create-record").on("show.bs.modal",function(e){$("form",$(this)).data("element-id",$(e.relatedTarget).data("element-id")),$("form .form-group input:first",$(this)).focus()}),$(".wt-modal-create-record form").on("submit",function(e){e.preventDefault();var t=$(this).data("element-id");$.ajax({url:"action.php",type:"POST",data:new FormData(this),async:!1,cache:!1,contentType:!1,processData:!1,success:function(e){$("#"+t).select2().empty().append(new Option(e.text,e.id)).val(e.id).trigger("change")},failure:function(e){alert(e.error_message)}}),this.reset(),$(this).closest(".wt-modal-create-record").modal("hide")}),$(".menu-language").on("click","[data-language]",function(){return $.post("index.php",{route:"language",language:$(this).data("language")},function(){window.location.reload()}),!1}),$(".menu-theme").on("click","[data-theme]",function(){return $.post("index.php",{route:"theme",theme:$(this).data("theme")},function(){window.location.reload()}),!1});var e;$(".wt-osk-trigger").click(function(){e=document.getElementById($(this).data("id")),e.focus(),$(".wt-osk").show()}),$(document).on("focusin",":input",function(){e=this}),$(".wt-osk-script-button").change(function(){$(".wt-osk-script").prop("hidden",!0),$(".wt-osk-script-"+$(this).data("script")).prop("hidden",!1)}),$(".wt-osk-shift-button").click(function(){document.querySelector(".wt-osk-keys").classList.toggle("shifted")}),$(".wt-osk-keys").on("click",".wt-osk-key",function(){var t=$(this).contents().get(0).nodeValue,n=$(".wt-osk-shift-button").hasClass("active"),o=$("sup",this)[0];if(n&&void 0!==o&&(t=o.innerText),null!==e){var a=e.selectionStart,l=e.value,i=l.substring(0,a),s=l.substring(a,l.length);e.value=i+t+s,!1===$(".wt-osk-pin-button").hasClass("active")&&$(".wt-osk").hide()}})}); \ No newline at end of file
+"use strict";function expand_layer(e){return $("#"+e+"_img").toggleClass("icon-plus icon-minus"),$("#"+e).slideToggle("fast"),$("#"+e+"-alt").toggle(),!1}function accept_changes(e){return $.post("index.php",{route:"accept-changes",xref:e,ged:WT_GEDCOM},function(){location.reload()}),!1}function reject_changes(e){return $.post("index.php",{route:"reject-changes",xref:e,ged:WT_GEDCOM},function(){location.reload()}),!1}function delete_record(e,t,n){return confirm(e)&&$.post("index.php",{route:"delete-record",xref:t,ged:void 0===n?WT_GEDCOM:n},function(){location.reload()}),!1}function delete_fact(e,t,n){return confirm(e)&&$.post("index.php",{route:"delete-fact",xref:t,fact_id:n,ged:WT_GEDCOM},function(){location.reload()}),!1}function copy_fact(e,t){return $.post("index.php",{route:"copy-fact",xref:e,fact_id:t,ged:WT_GEDCOM},function(){location.reload()}),!1}function paste_fact(e,t){return $.post("index.php",{route:"paste-fact",xref:e,fact_id:$(t).val(),ged:WT_GEDCOM},function(){location.reload()}),!1}function delete_user(e,t){return confirm(e)&&$.post("index.php",{route:"delete-user",user_id:t},function(){location.reload()}),!1}function masquerade(e){return $.post("index.php",{route:"masquerade",user_id:e},function(){location.reload()}),!1}function addmedia_links(e,t,n){return pastefield=e,insertRowToTable(t,n),!1}function valid_date(e){var t=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"],n=["MUHAR","SAFAR","RABIA","RABIT","JUMAA","JUMAT","RAJAB","SHAAB","RAMAD","SHAWW","DHUAQ","DHUAH"],o=["TSH","CSH","KSL","TVT","SHV","ADR","ADS","NSN","IYR","SVN","TMZ","AAV","ELL"],a=["VEND","BRUM","FRIM","NIVO","PLUV","VENT","GERM","FLOR","PRAI","MESS","THER","FRUC","COMP"],l=["FARVA","ORDIB","KHORD","TIR","MORDA","SHAHR","MEHR","ABAN","AZAR","DEY","BAHMA","ESFAN"],i=e.value,r=i.split("("),s="";if(r.length>1&&(i=r[0],s=r[1]),i=i.toUpperCase(),i=i.replace(/\s+/," "),i=i.replace(/(^\s)|(\s$)/,""),i=i.replace(/(\d)([A-Z])/,"$1 $2"),i=i.replace(/([A-Z])(\d)/,"$1 $2"),i.match(/^Q ([1-4]) (\d\d\d\d)$/)&&(i="BET "+t[3*RegExp.$1-3]+" "+RegExp.$2+" AND "+t[3*RegExp.$1-1]+" "+RegExp.$2),i.match(/^(@#DHIJRI@|HIJRI)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(i="@#DHIJRI@"+RegExp.$2+n[parseInt(RegExp.$3,10)-1]+RegExp.$4),i.match(/^(@#DJALALI@|JALALI)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(i="@#DJALALI@"+RegExp.$2+l[parseInt(RegExp.$3,10)-1]+RegExp.$4),i.match(/^(@#DHEBREW@|HEBREW)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(i="@#DHEBREW@"+RegExp.$2+o[parseInt(RegExp.$3,10)-1]+RegExp.$4),i.match(/^(@#DFRENCH R@|FRENCH)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(i="@#DFRENCH R@"+RegExp.$2+a[parseInt(RegExp.$3,10)-1]+RegExp.$4),/^([^\d]*)(\d+)[^\d](\d+)[^\d](\d+)$/i.exec(i)){var d=RegExp.$1,c=parseInt(RegExp.$2,10),u=parseInt(RegExp.$3,10),p=parseInt(RegExp.$4,10),f="DMY";"undefined"!=typeof locale_date_format&&("MDY"!==locale_date_format&&"YMD"!==locale_date_format||(f=locale_date_format));var m=(new Date).getFullYear(),h=m%100,g=m-h;"DMY"===f&&c<=31&&u<=12||c>13&&c<=31&&u<=12&&p>31?i=d+c+" "+t[u-1]+" "+(p>=100?p:p<=h?p+g:p+g-100):"MDY"===f&&c<=12&&u<=31||u>13&&u<=31&&c<=12&&p>31?i=d+u+" "+t[c-1]+" "+(p>=100?p:p<=h?p+g:p+g-100):("YMD"===f&&u<=12&&p<=31||p>13&&p<=31&&u<=12&&c>31)&&(i=d+p+" "+t[u-1]+" "+(c>=100?c:c<=h?c+g:c+g-100))}i=i.replace(/^[>]([\w ]+)$/,"AFT $1"),i=i.replace(/^[<]([\w ]+)$/,"BEF $1"),i=i.replace(/^([\w ]+)[-]$/,"FROM $1"),i=i.replace(/^[-]([\w ]+)$/,"TO $1"),i=i.replace(/^[~]([\w ]+)$/,"ABT $1"),i=i.replace(/^[*]([\w ]+)$/,"EST $1"),i=i.replace(/^[#]([\w ]+)$/,"CAL $1"),i=i.replace(/^([\w ]+) ?- ?([\w ]+)$/,"BET $1 AND $2"),i=i.replace(/^([\w ]+) ?~ ?([\w ]+)$/,"FROM $1 TO $2"),i=i.replace(/(JANUARY)/,"JAN"),i=i.replace(/(FEBRUARY)/,"FEB"),i=i.replace(/(MARCH)/,"MAR"),i=i.replace(/(APRIL)/,"APR"),i=i.replace(/(MAY)/,"MAY"),i=i.replace(/(JUNE)/,"JUN"),i=i.replace(/(JULY)/,"JUL"),i=i.replace(/(AUGUST)/,"AUG"),i=i.replace(/(SEPTEMBER)/,"SEP"),i=i.replace(/(OCTOBER)/,"OCT"),i=i.replace(/(NOVEMBER)/,"NOV"),i=i.replace(/(DECEMBER)/,"DEC"),i=i.replace(/(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)\.? (\d\d?)[, ]+(\d\d\d\d)/,"$2 $1 $3"),i=i.replace(/(^| )(\d [A-Z]{3,5} \d{4})/,"$10$2"),s&&(i=i+" ("+s),e.value!==i&&(e.value=i)}function show_submenu(e,t){var n=document.body.scrollWidth+document.documentElement.scrollLeft,o=document.getElementById(e);if(o&&o.style){document.all?n=document.body.offsetWidth:(n=document.body.scrollWidth+document.documentElement.scrollLeft-55,"rtl"===textDirection&&o.offsetLeft+o.offsetWidth+10);for(var a=0,l=o.childNodes.length,i=0;i<l;i++){var r=o.childNodes[i];r.offsetWidth>a+5&&(a=r.offsetWidth)}o.offsetWidth<a&&(o.style.width=a+"px");var s;if((s=document.getElementById(t))&&(o.style.left=s.style.left,o.offsetLeft+o.offsetWidth+10>n)){var d=n-o.offsetWidth;o.style.left=d+"px"}o.offsetLeft<0&&(o.style.left="0px"),o.offsetHeight>500&&(o.style.height="400px",o.style.overflow="auto"),o.style.visibility="visible"}clearTimeout(menutimeouts[e]),menutimeouts[e]=null}function hide_submenu(e){if("number"==typeof menutimeouts[e]){var t=document.getElementById(e);t&&t.style&&(t.style.visibility="hidden"),clearTimeout(menutimeouts[e]),menutimeouts[e]=null}}function timeout_submenu(e){"number"!=typeof menutimeouts[e]&&(menutimeouts[e]=setTimeout("hide_submenu('"+e+"')",100))}function statusDisable(e){var t=document.getElementById(e);t.checked=!1,t.disabled=!0}function statusEnable(e){document.getElementById(e).disabled=!1}function statusChecked(e){document.getElementById(e).checked=!0}function cal_setMonthNames(e,t,n,o,a,l,i,r,s,d,c,u){monthLabels[1]=e,monthLabels[2]=t,monthLabels[3]=n,monthLabels[4]=o,monthLabels[5]=a,monthLabels[6]=l,monthLabels[7]=i,monthLabels[8]=r,monthLabels[9]=s,monthLabels[10]=d,monthLabels[11]=c,monthLabels[12]=u}function cal_setDayHeaders(e,t,n,o,a,l,i){daysOfWeek[0]=e,daysOfWeek[1]=t,daysOfWeek[2]=n,daysOfWeek[3]=o,daysOfWeek[4]=a,daysOfWeek[5]=l,daysOfWeek[6]=i}function cal_setWeekStart(e){e>=0&&e<7&&(weekStart=e)}function calendarWidget(e,t){var n=document.getElementById(e),o=document.getElementById(t);if("visible"===n.style.visibility)return n.style.visibility="hidden",!1;if("show"===n.style.visibility)return n.style.visibility="hide",!1;var a,l=/((\d+ (JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC) )?\d+)/i;return a=l.exec(o.value)?new Date(RegExp.$1):new Date,n.innerHTML=cal_generateSelectorContent(t,e,a),"hidden"===n.style.visibility?(n.style.visibility="visible",!1):"hide"===n.style.visibility&&(n.style.visibility="show",!1)}function cal_generateSelectorContent(e,t,n){var o,a,l='<table border="1"><tr>';for(l+='<td><select class="form-control" id="'+e+'_daySelect" onchange="return cal_updateCalendar(\''+e+"', '"+t+"');\">",o=1;o<32;o++)l+='<option value="'+o+'"',n.getDate()===o&&(l+=' selected="selected"'),l+=">"+o+"</option>";for(l+="</select></td>",l+='<td><select class="form-control" id="'+e+'_monSelect" onchange="return cal_updateCalendar(\''+e+"', '"+t+"');\">",o=1;o<13;o++)l+='<option value="'+o+'"',n.getMonth()+1===o&&(l+=' selected="selected"'),l+=">"+monthLabels[o]+"</option>";for(l+="</select></td>",l+='<td><input class="form-control" type="text" id="'+e+'_yearInput" size="5" value="'+n.getFullYear()+'" onchange="return cal_updateCalendar(\''+e+"', '"+t+"');\" /></td></tr>",l+='<tr><td colspan="3">',l+='<table width="100%">',l+="<tr>",a=weekStart,o=0;o<7;o++)l+="<td ",l+='class="descriptionbox"',l+=">",l+=daysOfWeek[a],l+="</td>",++a>6&&(a=0);l+="</tr>";var i=new Date(n.getFullYear(),n.getMonth(),1),r=i.getDay();r-=weekStart;for(i=i.getTime()-864e5*r+432e5,i=new Date(i),a=0;a<6;a++){for(l+="<tr>",o=0;o<7;o++){l+="<td ",i.getMonth()===n.getMonth()?i.getDate()===n.getDate()?l+='class="descriptionbox"':l+='class="optionbox"':l+='style="background-color:#EAEAEA; border: solid #AAAAAA 1px;"',l+='><a href="#" onclick="return cal_dateClicked(\''+e+"', '"+t+"', "+i.getFullYear()+", "+i.getMonth()+", "+i.getDate()+');">',l+=i.getDate(),l+="</a></td>";var s=i.getTime()+864e5;i=new Date(s)}l+="</tr>"}return l+="</table>",l+="</td></tr>",l+="</table>"}function cal_setDateField(e,t,n,o){var a=document.getElementById(e);return!!a&&(o<10&&(o="0"+o),a.value=o+" "+monthShort[n+1]+" "+t,!1)}function cal_updateCalendar(e,t){var n=document.getElementById(e+"_daySelect");if(!n)return!1;var o=document.getElementById(e+"_monSelect");if(!o)return!1;var a=document.getElementById(e+"_yearInput");if(!a)return!1;var l=parseInt(o.options[o.selectedIndex].value,10);l-=1;var i=new Date(a.value,l,n.options[n.selectedIndex].value);cal_setDateField(e,i.getFullYear(),i.getMonth(),i.getDate());var r=document.getElementById(t);return r?(r.innerHTML=cal_generateSelectorContent(e,t,i),!1):(alert("no dateDiv "+t),!1)}function cal_dateClicked(e,t,n,o,a){return cal_setDateField(e,n,o,a),calendarWidget(t,e),!1}function openerpasteid(e){window.opener.paste_id&&window.opener.paste_id(e),window.close()}function paste_id(e){pastefield.value=e}function pastename(e){nameElement&&(nameElement.innerHTML=e),remElement&&(remElement.style.display="block")}function paste_char(e){document.selection?(pastefield.focus(),document.selection.createRange().text=e):pastefield.selectionStart||0===pastefield.selectionStart?(pastefield.value=pastefield.value.substring(0,pastefield.selectionStart)+e+pastefield.value.substring(pastefield.selectionEnd,pastefield.value.length),pastefield.selectionStart=pastefield.selectionEnd=pastefield.selectionStart+e.length):pastefield.value+=e,"NPFX"!==pastefield.id&&"GIVN"!==pastefield.id&&"SPFX"!==pastefield.id&&"SURN"!==pastefield.id&&"NSFX"!==pastefield.id||updatewholename()}function ilinkitem(e,t,n){return n=void 0===n?WT_GEDCOM:n,window.open("inverselink.php?mediaid="+encodeURIComponent(e)+"&linkto="+encodeURIComponent(t)+"&ged="+encodeURIComponent(n),"_blank",find_window_specs),!1}function persistent_toggle(e,t){var n=document.getElementById(e),o=document.querySelectorAll(t),a=localStorage.getItem(e);if(n){""!==a&&(a="none"),n.checked=""===a;for(var l=0;l<o.length;++l)o[l].style.display=a;n.addEventListener("click",function(){console.log(a),a=""===a?"none":"",localStorage.setItem(e,a);for(var t=0;t<o.length;++t)o[t].style.display=a})}}function valid_lati_long(e,t,n){var o=e.value.toUpperCase();o=o.replace(/(^\s*)|(\s*$)/g,""),o=o.replace(/ /g,":"),o=o.replace(/\+/g,""),o=o.replace(/-/g,n),o=o.replace(/,/g,"."),o=o.replace(/\u00b0/g,":"),o=o.replace(/\u0027/g,":"),o=o.replace(/^([0-9]+):([0-9]+):([0-9.]+)(.*)/g,function(e,t,n,o,a){var l=parseFloat(t);return l+=n/60,l+=o/3600,l=Math.round(1e4*l)/1e4,a+l}),o=o.replace(/^([0-9]+):([0-9]+)(.*)/g,function(e,t,n,o){var a=parseFloat(t);return a+=n/60,a=Math.round(1e4*a)/1e4,o+a}),o=o.replace(/(.*)([N|S|E|W]+)$/g,"$2$1"),o&&o.charAt(0)!==n&&o.charAt(0)!==t&&(o=t+o),e.value=o}function activate_colorbox(e){$.extend($.colorbox.settings,{fixed:!0,current:"",previous:"",next:"",slideshowStart:"",slideshowStop:"",close:""}),e&&$.extend($.colorbox.settings,e),$("body").on("click","a.gallery",function(){$("a[type^=image].gallery").colorbox({photo:!0,maxWidth:"95%",maxHeight:"95%",rel:"gallery",slideshow:!0,slideshowAuto:!1,onComplete:function(){$(".cboxPhoto").unbind("click"),wheelzoom(document.querySelectorAll(".cboxPhoto"))}})})}function autocomplete(e){$(e).each(function(){$(this).typeahead(null,{display:"value",source:new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:this.dataset.autocompleteUrl,wildcard:"QUERY"}})})})}function insertTextAtCursor(e,t){var n=e.scrollTop,o=e.selectionStart,a=e.value.substring(0,o),l=e.value.substring(e.selectionEnd,e.value.length);e.value=a+t+l,e.selectionStart=o+t.length,e.selectionEnd=e.selectionStart,e.focus(),e.scrollTop=n}var textDirection=$("html").attr("dir"),pastefield,menutimeouts=[],monthLabels=[];monthLabels[1]="January",monthLabels[2]="February",monthLabels[3]="March",monthLabels[4]="April",monthLabels[5]="May",monthLabels[6]="June",monthLabels[7]="July",monthLabels[8]="August",monthLabels[9]="September",monthLabels[10]="October",monthLabels[11]="November",monthLabels[12]="December";var monthShort=[];monthShort[1]="JAN",monthShort[2]="FEB",monthShort[3]="MAR",monthShort[4]="APR",monthShort[5]="MAY",monthShort[6]="JUN",monthShort[7]="JUL",monthShort[8]="AUG",monthShort[9]="SEP",monthShort[10]="OCT",monthShort[11]="NOV",monthShort[12]="DEC";var daysOfWeek=[];daysOfWeek[0]="S",daysOfWeek[1]="M",daysOfWeek[2]="T",daysOfWeek[3]="W",daysOfWeek[4]="T",daysOfWeek[5]="F",daysOfWeek[6]="S";var weekStart=0;$("body").on("click",".iconz",function(e){function t(){o.parent().css("z-index",100),n(),i.addClass("nameZoom"),l.hide(0,function(){a.slideDown()})}function n(){o.toggleClass(function(){return r+" "+r+"-expanded"})}e.stopPropagation();var o=$(this).closest(".person_box_template"),a=o.find(".inout"),l=o.find(".inout2"),i=o.find(".namedef"),r=o.attr("class").match(/(box-style[0-2])/)[1];a.text().length?o.hasClass(r)?t():function(){a.slideUp(function(){l.show(0),i.removeClass("nameZoom"),n(),o.parent().css("z-index","")})}():(o.css("cursor","progress"),a.load("index.php",{route:"expand-chart-box",xref:o.data("pid"),ged:WT_GEDCOM},function(){o.css("cursor",""),t()})),o.find(".iconz").toggleClass("icon-zoomin icon-zoomout")}),$(function(){$.ajaxSetup({headers:{"X-CSRF-TOKEN":$("meta[name=csrf]").attr("content")}}),$("[data-ajax-url]").each(function(){$(this).load($(this).data("ajaxUrl"))}),$('a[data-toggle="tab"][data-href]').on("show.bs.tab",function(){$(this.getAttribute("href")+":empty").load($(this).data("href"))}),autocomplete("input[data-autocomplete-url]"),$("select.select2").select2({escapeMarkup:function(e){return e}}),$("select.select2").on("select2:unselect",function(e){$(e.delegateTarget).append('<option value="" selected="selected"></option>')}),$.fn.dataTableExt.oSort["text-asc"]=function(e,t){return e.localeCompare(t,document.documentElement.lang,{sensitivity:"base"})},$.fn.dataTableExt.oSort["text-desc"]=function(e,t){return t.localeCompare(e,document.documentElement.lang,{sensitivity:"base"})},$("table.datatables").each(function(){$(this).DataTable(),$(this).show()}),$(".wt-modal-create-record").on("show.bs.modal",function(e){$("form",$(this)).data("element-id",$(e.relatedTarget).data("element-id")),$("form .form-group input:first",$(this)).focus()}),$(".wt-modal-create-record form").on("submit",function(e){e.preventDefault();var t=$(this).data("element-id");alert(123),$.ajax({url:"index.php",type:"POST",data:new FormData(this),async:!1,cache:!1,contentType:!1,processData:!1,success:function(e){$("#"+t).select2().empty().append(new Option(e.text,e.id)).val(e.id).trigger("change")},failure:function(e){alert(e.error_message)}}),this.reset(),$(this).closest(".wt-modal-create-record").modal("hide")}),$(".menu-language").on("click","[data-language]",function(){return $.post("index.php",{route:"language",language:$(this).data("language")},function(){window.location.reload()}),!1}),$(".menu-theme").on("click","[data-theme]",function(){return $.post("index.php",{route:"theme",theme:$(this).data("theme")},function(){window.location.reload()}),!1});var e;$(".wt-osk-trigger").click(function(){e=document.getElementById($(this).data("id")),e.focus(),$(".wt-osk").show()}),$(document).on("focusin",":input",function(){e=this}),$(".wt-osk-script-button").change(function(){$(".wt-osk-script").prop("hidden",!0),$(".wt-osk-script-"+$(this).data("script")).prop("hidden",!1)}),$(".wt-osk-shift-button").click(function(){document.querySelector(".wt-osk-keys").classList.toggle("shifted")}),$(".wt-osk-keys").on("click",".wt-osk-key",function(){var t=$(this).contents().get(0).nodeValue,n=$(".wt-osk-shift-button").hasClass("active"),o=$("sup",this)[0];if(n&&void 0!==o&&(t=o.innerText),null!==e){var a=e.selectionStart,l=e.value,i=l.substring(0,a),r=l.substring(a,l.length);e.value=i+t+r,!1===$(".wt-osk-pin-button").hasClass("active")&&$(".wt-osk").hide()}})}); \ No newline at end of file
diff --git a/resources/assets/js/webtrees.js b/resources/assets/js/webtrees.js
index 334af1f5fb..a205d84c08 100644
--- a/resources/assets/js/webtrees.js
+++ b/resources/assets/js/webtrees.js
@@ -27,8 +27,8 @@ function expand_layer (sid) {
// Accept the changes to a record - and reload the page
function accept_changes (xref) {
- $.post('action.php', {
- action: 'accept-changes',
+ $.post('index.php', {
+ route: 'accept-changes',
xref: xref,
ged: WT_GEDCOM,
},
@@ -40,8 +40,8 @@ function accept_changes (xref) {
// Reject the changes to a record - and reload the page
function reject_changes (xref) {
- $.post('action.php', {
- action: 'reject-changes',
+ $.post('index.php', {
+ route: 'reject-changes',
xref: xref,
ged: WT_GEDCOM,
},
@@ -54,8 +54,8 @@ function reject_changes (xref) {
// Delete a record - and reload the page
function delete_record (message, xref, gedcom) {
if (confirm(message)) {
- $.post('action.php', {
- action: 'delete-record',
+ $.post('index.php', {
+ route: 'delete-record',
xref: xref,
ged: typeof gedcom === 'undefined' ? WT_GEDCOM : gedcom,
},
@@ -69,8 +69,8 @@ function delete_record (message, xref, gedcom) {
// Delete a fact - and reload the page
function delete_fact (message, xref, fact_id) {
if (confirm(message)) {
- $.post('action.php', {
- action: 'delete-fact',
+ $.post('index.php', {
+ route: 'delete-fact',
xref: xref,
fact_id: fact_id,
ged: WT_GEDCOM,
@@ -82,26 +82,10 @@ function delete_fact (message, xref, fact_id) {
return false;
}
-// Remove links from one record to another - and reload the page
-function unlink_media (message, source, target) {
- if (confirm(message)) {
- $.post('action.php', {
- action: 'unlink-media',
- source: source,
- target: target,
- ged: WT_GEDCOM,
- },
- function () {
- location.reload();
- });
- }
- return false;
-}
-
// Copy a fact to the clipboard
function copy_fact (xref, fact_id) {
- $.post('action.php', {
- action: 'copy-fact',
+ $.post('index.php', {
+ route: 'copy-fact',
xref: xref,
fact_id: fact_id,
ged: WT_GEDCOM,
@@ -114,8 +98,8 @@ function copy_fact (xref, fact_id) {
// Paste a fact from the clipboard
function paste_fact (xref, element) {
- $.post('action.php', {
- action: 'paste-fact',
+ $.post('index.php', {
+ route: 'paste-fact',
xref: xref,
fact_id: $(element).val(), // element is the <select> containing the option
ged: WT_GEDCOM,
@@ -129,8 +113,8 @@ function paste_fact (xref, element) {
// Delete a user - and reload the page
function delete_user (message, user_id) {
if (confirm(message)) {
- $.post('action.php', {
- action: 'delete-user',
+ $.post('index.php', {
+ route: 'delete-user',
user_id: user_id,
},
function () {
@@ -919,8 +903,9 @@ $(function () {
$('.wt-modal-create-record form').on('submit', function (event) {
event.preventDefault();
var elementId = $(this).data('element-id');
+ alert(123);
$.ajax({
- url: 'action.php',
+ url: 'index.php',
type: 'POST',
data: new FormData(this),
async: false,
diff --git a/resources/views/admin/merge-records-step-1.php b/resources/views/admin/merge-records-step-1.php
index edbd29688c..b4f202941c 100644
--- a/resources/views/admin/merge-records-step-1.php
+++ b/resources/views/admin/merge-records-step-1.php
@@ -31,22 +31,22 @@
<?= I18N::translate('First record') ?>
</span>
<span class="col-sm-9 select-record select-individual">
- <?= FunctionsEdit::formControlIndividual($individual1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, $individual1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;']) ?>
</span>
<span class="col-sm-9 select-record select-family d-none">
- <?= FunctionsEdit::formControlFamily($family1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlFamily($tree, $family1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
<span class="col-sm-9 select-record select-source d-none">
- <?= FunctionsEdit::formControlSource($source1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlSource($tree, $source1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
<span class="col-sm-9 select-record select-repository d-none">
- <?= FunctionsEdit::formControlRepository($repository1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlRepository($tree, $repository1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
<span class="col-sm-9 select-record select-note d-none">
- <?= FunctionsEdit::formControlNote($note1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlNote($tree, $note1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
<span class="col-sm-9 select-record select-media d-none">
- <?= FunctionsEdit::formControlMediaObject($media2, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlMediaObject($tree, $media2, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
</label>
@@ -55,22 +55,22 @@
<?= I18N::translate('Second record') ?>
</span>
<span class="col-sm-9 select-record select-individual">
- <?= FunctionsEdit::formControlIndividual($individual2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, $individual2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;']) ?>
</span>
<span class="col-sm-9 select-record select-family d-none">
- <?= FunctionsEdit::formControlFamily($family2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlFamily($tree, $family2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
<span class="col-sm-9 select-record select-source d-none">
- <?= FunctionsEdit::formControlSource($source2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlSource($tree, $source2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
<span class="col-sm-9 select-record select-repository d-none">
- <?= FunctionsEdit::formControlRepository($repository2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlRepository($tree, $repository2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
<span class="col-sm-9 select-record select-note d-none">
- <?= FunctionsEdit::formControlNote($note2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlNote($tree, $note2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
<span class="col-sm-9 select-record select-media d-none">
- <?= FunctionsEdit::formControlMediaObject($media2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlMediaObject($tree, $media2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
</label>
diff --git a/resources/views/admin/tree-privacy.php b/resources/views/admin/tree-privacy.php
index f5cb12cd1f..beb8f9eb6d 100644
--- a/resources/views/admin/tree-privacy.php
+++ b/resources/views/admin/tree-privacy.php
@@ -175,22 +175,22 @@
<option value="media"><?= I18N::translate('Media object') ?></option>
</select>
<span class="select-record select-individual">
- <?= FunctionsEdit::formControlIndividual(null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;']) ?>
</span>
<span class="select-record select-family d-none">
- <?= FunctionsEdit::formControlFamily(null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlFamily($tree, null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
<span class="select-record select-source d-none">
- <?= FunctionsEdit::formControlSource(null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlSource($tree, null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
<span class="select-record select-repository d-none">
- <?= FunctionsEdit::formControlRepository(null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlRepository($tree, null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
<span class="select-record select-note d-none">
- <?= FunctionsEdit::formControlNote(null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlNote($tree, null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
<span class="select-record select-media d-none">
- <?= FunctionsEdit::formControlMediaObject(null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
+ <?= FunctionsEdit::formControlMediaObject($tree, null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
</span>
<input data-autocomplete-type="IFSRO" id="xref" maxlength="20" name="xref[]" type="text">
</td>
diff --git a/resources/views/ancestors-page.php b/resources/views/ancestors-page.php
index 0dc87d5fdf..fc08f296db 100644
--- a/resources/views/ancestors-page.php
+++ b/resources/views/ancestors-page.php
@@ -15,7 +15,7 @@
<?= I18N::translate('Individual') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual($individual, ['id' => 'xref', 'name' => 'xref']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, $individual, ['id' => 'xref', 'name' => 'xref']) ?>
</div>
</div>
diff --git a/resources/views/blocks/charts-config.php b/resources/views/blocks/charts-config.php
index 234bd43273..7664114b20 100644
--- a/resources/views/blocks/charts-config.php
+++ b/resources/views/blocks/charts-config.php
@@ -18,6 +18,6 @@
</label>
</label>
<div class="col-sm-9">
- <?= FunctionsEdit::formControlIndividual($individual, ['id' => 'pid', 'name' => 'pid']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, $individual, ['id' => 'pid', 'name' => 'pid']) ?>
</div>
</div>
diff --git a/resources/views/compact-tree-page.php b/resources/views/compact-tree-page.php
index 8ff557fb7a..02c30c711d 100644
--- a/resources/views/compact-tree-page.php
+++ b/resources/views/compact-tree-page.php
@@ -14,7 +14,7 @@
<?= I18N::translate('Individual') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual($individual, ['id' => 'xref', 'name' => 'xref']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, $individual, ['id' => 'xref', 'name' => 'xref']) ?>
</div>
</div>
diff --git a/resources/views/descendants-page.php b/resources/views/descendants-page.php
index 5fa0bd8f63..3c09ad9931 100644
--- a/resources/views/descendants-page.php
+++ b/resources/views/descendants-page.php
@@ -15,7 +15,7 @@
<?= I18N::translate('Individual') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual($individual, ['id' => 'xref', 'name' => 'xref']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, $individual, ['id' => 'xref', 'name' => 'xref']) ?>
</div>
</div>
diff --git a/resources/views/edit-account-page.php b/resources/views/edit-account-page.php
index f06c12ec1d..26b1309561 100644
--- a/resources/views/edit-account-page.php
+++ b/resources/views/edit-account-page.php
@@ -73,7 +73,7 @@
<?= I18N::translate('Default individual') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual($default_individual, ['id' => 'root-id',
+ <?= FunctionsEdit::formControlIndividual($tree, $default_individual, ['id' => 'root-id',
'name' => 'root_id', 'aria-describedby' => 'root-id-description']) ?>
<p class="small text-muted" id="root-id-description">
<?= I18N::translate('This individual will be selected by default when viewing charts and reports.') ?>
diff --git a/resources/views/family-book-page.php b/resources/views/family-book-page.php
index dc5a5666a8..cbaef9d138 100644
--- a/resources/views/family-book-page.php
+++ b/resources/views/family-book-page.php
@@ -15,7 +15,7 @@
<?= I18N::translate('Individual') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual($individual, ['id' => 'xref', 'name' => 'xref']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, $individual, ['id' => 'xref', 'name' => 'xref']) ?>
</div>
</div>
diff --git a/resources/views/family-page-menu.php b/resources/views/family-page-menu.php
index be5b920158..ac340a702e 100644
--- a/resources/views/family-page-menu.php
+++ b/resources/views/family-page-menu.php
@@ -25,7 +25,7 @@
<div class="dropdown-divider"></div>
- <a class="dropdown-item menu-fam-del" href="#" onclick="return delete_record('<?= I18N::translate('Deleting the family will unlink all of the individuals from each other but will leave the individuals in place. Are you sure you want to delete this family?') ?>', '<?= e($record->getXref()) ?>');">
+ <a class="dropdown-item menu-fam-del" href="#" onclick="return delete_record('<?= I18N::translate('Deleting the family will unlink all of the individuals from each other but will leave the individuals in place. Are you sure you want to delete this family?') ?>', '<?= e($record->getXref()) ?>', '<?= $record->getXref() ?>');">
<?= I18N::translate('Delete') ?>
</a>
diff --git a/resources/views/fan-page.php b/resources/views/fan-page.php
index ce8492d735..5e8ebc2445 100644
--- a/resources/views/fan-page.php
+++ b/resources/views/fan-page.php
@@ -15,7 +15,7 @@
<?= I18N::translate('Individual') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual($individual, ['id' => 'xref', 'name' => 'xref']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, $individual, ['id' => 'xref', 'name' => 'xref']) ?>
</div>
</div>
diff --git a/resources/views/gedcom-record-page-menu.php b/resources/views/gedcom-record-page-menu.php
index f960988c6f..b198920554 100644
--- a/resources/views/gedcom-record-page-menu.php
+++ b/resources/views/gedcom-record-page-menu.php
@@ -9,7 +9,7 @@
<?= I18N::translate('edit') ?>
</button>
<div class="dropdown-menu dropdown-menu-right wt-page-menu-items" aria-labelledby="page-menu">
- <a class="dropdown-item menu-indi-del" href="#" onclick="return delete_record('<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->getFullName())) ?>');">
+ <a class="dropdown-item menu-indi-del" href="#" onclick="return delete_record('<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->getFullName())) ?>', '<?= $record->getXref() ?>');">
<?= I18N::translate('Delete') ?>
</a>
diff --git a/resources/views/hourglass-page.php b/resources/views/hourglass-page.php
index f542713ff8..8fdbaf26e2 100644
--- a/resources/views/hourglass-page.php
+++ b/resources/views/hourglass-page.php
@@ -15,7 +15,7 @@
<?= I18N::translate('Individual') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual($individual, ['id' => 'xref', 'name' => 'xref']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, $individual, ['id' => 'xref', 'name' => 'xref']) ?>
</div>
</div>
diff --git a/resources/views/individual-page-menu.php b/resources/views/individual-page-menu.php
index 0ba0ff29ea..7428875a4f 100644
--- a/resources/views/individual-page-menu.php
+++ b/resources/views/individual-page-menu.php
@@ -33,7 +33,7 @@
<?php endif ?>
- <a class="dropdown-item menu-indi-del" href="#" onclick="return delete_record('<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($individual->getFullName())) ?>');">
+ <a class="dropdown-item menu-indi-del" href="#" onclick="return delete_record('<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($individual->getFullName())) ?>', '<?= $individual->getXref() ?>');">
<?= I18N::translate('Delete') ?>
</a>
diff --git a/resources/views/interactive-tree-page.php b/resources/views/interactive-tree-page.php
index e21d52d885..1d6b48e42f 100644
--- a/resources/views/interactive-tree-page.php
+++ b/resources/views/interactive-tree-page.php
@@ -15,7 +15,7 @@
<?= I18N::translate('Individual') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual($individual, ['id' => 'rootid', 'name' => 'rootid']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, $individual, ['id' => 'rootid', 'name' => 'rootid']) ?>
</div>
</div>
diff --git a/resources/views/lifespans-page.php b/resources/views/lifespans-page.php
index 464bad82f7..1004a13d96 100644
--- a/resources/views/lifespans-page.php
+++ b/resources/views/lifespans-page.php
@@ -19,7 +19,7 @@
<?= I18N::translate('Add individuals') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual(null, [
+ <?= FunctionsEdit::formControlIndividual($tree, null, [
'id' => 'addxref',
'name' => 'addxref',
]) ?>
diff --git a/resources/views/media-page-menu.php b/resources/views/media-page-menu.php
index 8ca76a6ce2..fb83567c1c 100644
--- a/resources/views/media-page-menu.php
+++ b/resources/views/media-page-menu.php
@@ -27,7 +27,7 @@
</a>
<?php endif ?>
- <a class="dropdown-item menu-obje-del" href="#" onclick="return delete_record('<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->getFullName())) ?>');">
+ <a class="dropdown-item menu-obje-del" href="#" onclick="return delete_record('<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->getFullName())) ?>', '<?= $record->getXref() ?>');">
<?= I18N::translate('Delete') ?>
</a>
diff --git a/resources/views/modals/create-family.php b/resources/views/modals/create-family.php
index b1a772af18..d6412e2ce6 100644
--- a/resources/views/modals/create-family.php
+++ b/resources/views/modals/create-family.php
@@ -3,9 +3,8 @@
<?php use Fisharebest\Webtrees\Functions\FunctionsEdit; ?>
<div class="modal wt-modal-create-record" id="modal-create-family">
- <form id="form-create-family"><!-- This form is posted using jQuery -->
+ <form action="<?= e(route('create-family')) ?>" id="form-create-family">
<?= csrf_field() ?>
- <input type="hidden" name="action" value="create-family">
<input type="hidden" name="ged" value="<?= e($tree->getName()) ?>">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
@@ -20,13 +19,13 @@
<label class="col-form-label" for="husband">
<?= I18N::translate('Husband') ?>
</label>
- <?= FunctionsEdit::formControlIndividual(null, ['id' => 'husband', 'name' => 'husband']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, null, ['id' => 'husband', 'name' => 'husband']) ?>
</div>
<div class="form-group">
<label class="col-form-label" for="wife">
<?= I18N::translate('Wife') ?>
</label>
- <?= FunctionsEdit::formControlIndividual(null, ['id' => 'wife', 'name' => 'wife']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, null, ['id' => 'wife', 'name' => 'wife']) ?>
</div>
</div>
<div class="modal-footer">
diff --git a/resources/views/modals/source-fields.php b/resources/views/modals/source-fields.php
index fe04fbea98..9dac7659b8 100644
--- a/resources/views/modals/source-fields.php
+++ b/resources/views/modals/source-fields.php
@@ -36,7 +36,7 @@
<?= I18N::translate('Repository') ?>
</label>
<div class="col-sm-4">
- <?= FunctionsEdit::formControlRepository(null, ['id' => 'source-repository', 'name' => 'source-repository']) ?>
+ <?= FunctionsEdit::formControlRepository($tree, null, ['id' => 'source-repository', 'name' => 'source-repository']) ?>
</div>
<label class="col-form-label col-sm-2" for="source-call-number">
<?= I18N::translate('Call number') ?>
diff --git a/resources/views/modules/census-assistant.php b/resources/views/modules/census-assistant.php
index 4e27075362..41bb5cd0f5 100644
--- a/resources/views/modules/census-assistant.php
+++ b/resources/views/modules/census-assistant.php
@@ -52,7 +52,7 @@
<?= I18N::translate('Individuals') ?>
</span>
</div>
- <?= FunctionsEdit::formControlIndividual($individual, ['id' => 'census-assistant-individual', 'style' => 'width:100%']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, $individual, ['id' => 'census-assistant-individual', 'style' => 'width:100%']) ?>
<span class="input-group-btn">
<button type="button" class="btn btn-primary" id="census-assistant-add">
<?= FontAwesome::semanticIcon('add', I18N::translate('Add')) ?>
diff --git a/resources/views/note-page-menu.php b/resources/views/note-page-menu.php
index 176115e2e0..0dbd57858b 100644
--- a/resources/views/note-page-menu.php
+++ b/resources/views/note-page-menu.php
@@ -9,7 +9,7 @@
<?= I18N::translate('edit') ?>
</button>
<div class="dropdown-menu dropdown-menu-right wt-page-menu-items" aria-labelledby="page-menu">
- <a class="dropdown-item menu-note-del" href="#" onclick="return delete_record('<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->getFullName())) ?>');">
+ <a class="dropdown-item menu-note-del" href="#" onclick="return delete_record('<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->getFullName())) ?>', '<?= $record->getXref() ?>');">
<?= I18N::translate('Delete') ?>
</a>
diff --git a/resources/views/pedigree-page.php b/resources/views/pedigree-page.php
index 1ebb30f6e5..e58c9443dd 100644
--- a/resources/views/pedigree-page.php
+++ b/resources/views/pedigree-page.php
@@ -15,7 +15,7 @@
<?= I18N::translate('Individual') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual($individual, ['id' => 'xref', 'name' => 'xref']) ?>
+ <?= FunctionsEdit::formControlIndividual($tree, $individual, ['id' => 'xref', 'name' => 'xref']) ?>
</div>
</div>
diff --git a/resources/views/relationships-page.php b/resources/views/relationships-page.php
index ec60cbea95..8efbb3e38b 100644
--- a/resources/views/relationships-page.php
+++ b/resources/views/relationships-page.php
@@ -21,7 +21,7 @@ use Fisharebest\Webtrees\View;
<?= I18N::translate('Individual 1') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual($individual1, [
+ <?= FunctionsEdit::formControlIndividual($tree, $individual1, [
'id' => 'xref1',
'name' => 'xref1',
]) ?>
@@ -37,7 +37,7 @@ use Fisharebest\Webtrees\View;
<?= I18N::translate('Individual 2') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual($individual2, [
+ <?= FunctionsEdit::formControlIndividual($tree, $individual2, [
'id' => 'xref2',
'name' => 'xref2',
]) ?>
diff --git a/resources/views/repository-page-menu.php b/resources/views/repository-page-menu.php
index 3625f73379..731553fda7 100644
--- a/resources/views/repository-page-menu.php
+++ b/resources/views/repository-page-menu.php
@@ -9,7 +9,7 @@
<?= I18N::translate('edit') ?>
</button>
<div class="dropdown-menu dropdown-menu-right wt-page-menu-items" aria-labelledby="page-menu">
- <a class="dropdown-item menu-repo-del" href="#" onclick="return delete_record('<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->getFullName())) ?>');">
+ <a class="dropdown-item menu-repo-del" href="#" onclick="return delete_record('<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->getFullName())) ?>', '<?= $record->getXref() ?>');">
<?= I18N::translate('Delete') ?>
</a>
diff --git a/resources/views/source-page-menu.php b/resources/views/source-page-menu.php
index 3a5dbcbfcb..cdb5838d63 100644
--- a/resources/views/source-page-menu.php
+++ b/resources/views/source-page-menu.php
@@ -9,7 +9,7 @@
<?= I18N::translate('edit') ?>
</button>
<div class="dropdown-menu dropdown-menu-right wt-page-menu-items" aria-labelledby="page-menu">
- <a class="dropdown-item menu-sour-del" href="#" onclick="return delete_record('<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->getFullName())) ?>');">
+ <a class="dropdown-item menu-sour-del" href="#" onclick="return delete_record('<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->getFullName())) ?>', '<?= $record->getXref() ?>');">
<?= I18N::translate('Delete') ?>
</a>
diff --git a/resources/views/timeline-page.php b/resources/views/timeline-page.php
index 9c03907f7d..ce404e340e 100644
--- a/resources/views/timeline-page.php
+++ b/resources/views/timeline-page.php
@@ -26,7 +26,7 @@ use Fisharebest\Webtrees\View;
<?= I18N::translate('Individual') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= FunctionsEdit::formControlIndividual(null, [
+ <?= FunctionsEdit::formControlIndividual($tree, null, [
'id' => 'xref-add',
'name' => 'xrefs[]',
]) ?>
diff --git a/routes/web.php b/routes/web.php
index 49ffb3b9ba..ad1733853d 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -51,6 +51,7 @@ if (Auth::isAdmin()) {
'GET:unused-media-thumbnail' => 'MediaFileController@unusedMediaThumbnail',
'GET:broadcast' => 'MessageController@broadcastPage',
'POST:broadcast' => 'MessageController@broadcastAction',
+ 'POST:select2-flag' => 'AutocompleteController@select2Flag',
];
}
@@ -115,6 +116,10 @@ if ($tree instanceof Tree && $tree->getPreference('imported') === '1' && Auth::i
'POST:edit-raw-record' => 'EditGedcomRecordController@editRawRecordAction',
'GET:edit-raw-fact' => 'EditGedcomRecordController@editRawFact',
'POST:edit-raw-fact' => 'EditGedcomRecordController@editRawFactAction',
+ 'POST:copy-fact' => 'EditGedcomRecordController@copyFact',
+ 'POST:delete-fact' => 'EditGedcomRecordController@deleteFact',
+ 'POST:paste-fact' => 'EditGedcomRecordController@pasteFact',
+ 'POST:delete-record' => 'EditGedcomRecordController@deleteRecord',
];
}
@@ -199,6 +204,15 @@ if ($tree instanceof Tree && $tree->getPreference('imported') === '1') {
'GET:statistics-chart' => 'StatisticsChartController@chartCustomChart',
'GET:timeline' => 'TimelineChartController@page',
'GET:timeline-chart' => 'TimelineChartController@chart',
+ 'POST:accept-changes' => 'PendingChangesController@acceptChanges',
+ 'POST:reject-changes' => 'PendingChangesController@rejectChanges',
+ 'POST:select2-family' => 'AutocompleteController@select2Family',
+ 'POST:select2-individual' => 'AutocompleteController@select2Individual',
+ 'POST:select2-media' => 'AutocompleteController@select2MediaObject',
+ 'POST:select2-note' => 'AutocompleteController@select2Note',
+ 'POST:select2-source' => 'AutocompleteController@select2Source',
+ 'POST:select2-submitter' => 'AutocompleteController@select2Submitter',
+ 'POST:select2-repository' => 'AutocompleteController@select2Repository',
];
}
@@ -215,6 +229,7 @@ $routes += [
'GET:verify' => 'Auth\\VerifyEmailController@verify',
'GET:forgot-password' => 'Auth\\ForgotPasswordController@forgotPasswordPage',
'POST:forgot-password' => 'Auth\\ForgotPasswordController@forgotPasswordAction',
+ 'POST:delete-user' => 'UserController@delete',
'POST:language' => 'UserController@language',
'POST:masquerade' => 'UserController@masquerade',
'POST:theme' => 'UserController@theme',