xref: /webtrees/resources/views/admin/trees.phtml (revision ce42304a0e3b715b5830d587f136ecd5ca69f11b)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
5use Fisharebest\Webtrees\Http\RequestHandlers\CreateMediaObjectModal;
6use Fisharebest\Webtrees\Http\RequestHandlers\CreateNoteModal;
7use Fisharebest\Webtrees\Http\RequestHandlers\CreateRepositoryModal;
8use Fisharebest\Webtrees\Http\RequestHandlers\CreateSourceModal;
9use Fisharebest\Webtrees\Http\RequestHandlers\CreateSubmitterModal;
10use Fisharebest\Webtrees\Http\RequestHandlers\DataFixChoose;
11use Fisharebest\Webtrees\Http\RequestHandlers\DeleteTreeAction;
12use Fisharebest\Webtrees\Http\RequestHandlers\ExportGedcomPage;
13use Fisharebest\Webtrees\Http\RequestHandlers\MergeRecordsPage;
14use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogPage;
15use Fisharebest\Webtrees\Http\RequestHandlers\SelectDefaultTree;
16use Fisharebest\Webtrees\Http\RequestHandlers\TreePage;
17use Fisharebest\Webtrees\Http\RequestHandlers\UnconnectedPage;
18use Fisharebest\Webtrees\Http\RequestHandlers\UpdatePlacesPage;
19use Fisharebest\Webtrees\I18N;
20use Fisharebest\Webtrees\Site;
21use Fisharebest\Webtrees\View;
22use Illuminate\Database\Capsule\Manager as DB;
23
24?>
25
26<?php if (!empty($all_trees)) : ?>
27    <?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>
28<?php endif ?>
29
30<h1><?= $title ?></h1>
31
32<?php if (empty($all_trees)) : ?>
33    <div class="alert alert-info">
34        <?= I18N::translate('You need to create a family tree.') ?>
35    </div>
36<?php endif ?>
37
38<div id="accordion" role="tablist" aria-multiselectable="true">
39    <?php foreach ($all_trees as $managed_tree) : ?>
40        <?php if (Auth::isManager($managed_tree)) : ?>
41            <div class="card">
42                <div class="card-header" role="tab" id="card-tree-header-<?= $managed_tree->id() ?>">
43                    <h2 class="mb-0">
44                        <?= view('icons/tree') ?>
45                        <a data-toggle="collapse" data-parent="#accordion" href="#card-tree-content-<?= $managed_tree->id() ?>" <?= $managed_tree == $tree || $managed_tree->getPreference('imported') === '0' ? 'aria-expanded="true"' : '' ?> aria-controls="card-tree-content-<?= $managed_tree->id() ?>">
46                            <?= e($managed_tree->name()) ?><?= e($managed_tree->title()) ?>
47                        </a>
48                    </h2>
49                </div>
50                <div id="card-tree-content-<?= $managed_tree->id() ?>" class="collapse<?= $managed_tree == $tree || $managed_tree->getPreference('imported') === '0' ? ' show' : '' ?>" role="tabpanel" aria-labelledby="panel-tree-header-<?= $managed_tree->id() ?>">
51                    <div class="card-body">
52                        <?php $importing = DB::table('gedcom_chunk')->where('gedcom_id', '=', $managed_tree->id())->where('imported', '=', 0)->exists() ?>
53                        <?php if ($importing) : ?>
54                            <div id="import<?= $managed_tree->id() ?>" class="col-12">
55                                <div class="progress">
56                                    <?= I18N::translate('Calculating…') ?>
57                                </div>
58                            </div>
59                            <?php View::push('javascript'); ?>
60                                <script>
61                                    $("#import<?= $managed_tree->id() ?>").load("<?= route('import', ['tree' => $managed_tree->name()]) ?>", {});
62                                </script>
63                                <?php View::endpush() ?>
64                        <?php endif ?>
65                        <div class="row<?= $importing ? ' d-none' : '' ?>" id="actions<?= $managed_tree->id() ?>">
66                            <div class="col-sm-6 col-md-3">
67                                <h3>
68                                    <?= I18N::translate('Family tree') ?>
69                                </h3>
70                                <ul class="fa-ul">
71                                    <li>
72                                        <span class="fa-li"><?= view('icons/tree') ?></span>
73                                        <a href="<?= e(route(TreePage::class, ['tree' => $managed_tree->name()])) ?>">
74                                            <?= I18N::translate('Home page') ?>
75                                        </a>
76                                    </li>
77                                </ul>
78                                <ul class="fa-ul">
79                                    <!-- PREFERENCES -->
80                                    <li>
81                                        <span class="fa-li"><?= view('icons/preferences') ?></span>
82                                        <a href="<?= e(route('admin-trees-preferences', ['tree' => $managed_tree->name()])) ?>">
83                                            <?= I18N::translate('Preferences') ?>
84                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
85                                        </a>
86                                    </li>
87                                    <!-- PRIVACY -->
88                                    <li>
89                                        <span class="fa-li"><?= view('icons/lock') ?></span>
90                                        <a href="<?= e(route('tree-privacy', ['tree' => $managed_tree->name()])) ?>">
91                                            <?= I18N::translate('Privacy') ?>
92                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
93                                        </a>
94                                    </li>
95                                    <!-- DELETE -->
96                                    <?php if (count($all_trees) > 1 && Auth::isAdmin()) : ?>
97                                        <li>
98                                            <span class="fa-li"><?= view('icons/delete') ?></span>
99                                            <a href="#" data-post-url="<?= e(route(DeleteTreeAction::class, ['tree' => $managed_tree->name()])) ?>" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($managed_tree->title())) ?>">
100                                                <?= I18N::translate('Delete') ?>
101                                            </a>
102                                        </li>
103                                    <?php endif ?>
104
105                                    <!-- SET AS DEFAULT -->
106                                    <?php if (count($all_trees) > 1 && Auth::isAdmin()) : ?>
107                                        <li>
108                                            <span class="fa-li"><?= view('icons/favorite') ?></span>
109                                            <?php if ($managed_tree->name() === Site::getPreference('DEFAULT_GEDCOM')) : ?>
110                                                <?= I18N::translate('Default family tree') ?>
111                                            <?php else : ?>
112                                                <a href="#" onclick="document.defaultform<?= $managed_tree->id() ?>.submit();">
113                                                    <?= I18N::translate('Set as default') ?>
114                                                    <span class="sr-only"><?= e($managed_tree->title()) ?></span>
115                                                </a>
116                                                <form method="post" action="<?= route(SelectDefaultTree::class, ['tree' => $managed_tree->name()]) ?>" name="defaultform<?= $managed_tree->id() ?>">
117                                                    <?= csrf_field() ?>
118                                                    <!-- A11Y - forms need submit buttons, but they look ugly here -->
119                                                    <button class="sr-only" type="submit">
120                                                        <?= I18N::translate('Set as default') ?>
121                                                    </button>
122                                                </form>
123                                            <?php endif ?>
124                                        </li>
125                                    <?php endif ?>
126                                </ul>
127
128                                <ul class="fa-ul">
129                                    <!-- DATA FIXES -->
130                                    <li>
131                                        <span class="fa-li"><?= view('icons/data-fix') ?></span>
132                                        <a href="<?= e(route(DataFixChoose::class, ['tree' => $managed_tree->name()])) ?>">
133                                            <?= I18N::translate('Data fixes') ?>
134                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
135                                        </a>
136                                    </li>
137                                </ul>
138                            </div>
139                            <div class="col-sm-6 col-md-3">
140                                <h3>
141                                    <?= /* I18N: Individuals, sources, dates, places, etc. */
142                                    I18N::translate('Genealogy data') ?>
143                                </h3>
144                                <ul class="fa-ul">
145                                    <!-- FIND DUPLICATES -->
146                                    <li>
147                                        <span class="fa-li"><?= view('icons/copy') ?></span>
148                                        <a href="<?= e(route('admin-trees-duplicates', ['tree' => $managed_tree->name()])) ?>">
149                                            <?= I18N::translate('Find duplicates') ?>
150                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
151                                        </a>
152                                    </li>
153                                    <!-- MERGE -->
154                                    <li>
155                                        <span class="fa-li"><?= view('icons/merge') ?></span>
156                                        <a href="<?= e(route(MergeRecordsPage::class, ['tree' => $managed_tree->name()])) ?>">
157                                            <?= I18N::translate('Merge records') ?>
158                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
159                                        </a>
160                                    </li>
161                                    <!-- UPDATE PLACE NAMES -->
162                                    <li>
163                                        <span class="fa-li"><?= view('icons/location') ?></span>
164                                        <a href="<?= e(route(UpdatePlacesPage::class, ['tree' => $managed_tree->name()])) ?>">
165                                            <?= I18N::translate('Update place names') ?>
166                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
167                                        </a>
168                                    </li>
169                                    <!-- CHECK FOR ERRORS -->
170                                    <li>
171                                        <span class="fa-li"><?= view('icons/warning') ?></span>
172                                        <a href="<?= e(route('admin-trees-check', ['tree' => $managed_tree->name()])) ?>">
173                                            <?= I18N::translate('Check for errors') ?>
174                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
175                                        </a>
176                                    </li>
177                                    <!-- UNCONNECTED INDIVIDUALS -->
178                                    <li>
179                                        <span class="fa-li"><?= view('icons/unlink') ?></span>
180                                        <a href="<?= e(route(UnconnectedPage::class, ['tree' => $managed_tree->name()])) ?>">
181                                            <?= I18N::translate('Find unrelated individuals') ?>
182                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
183                                        </a>
184                                    </li>
185                                    <!-- RENUMBER -->
186                                    <li>
187                                        <span class="fa-li"><?= view('icons/sort') ?></span>
188                                        <a href="<?= e(route('admin-trees-renumber', ['tree' => $managed_tree->name()])) ?>">
189                                            <?= I18N::translate('Renumber') ?>
190                                            <span class="sr-only">
191                                        <?= e($managed_tree->title()) ?>
192                                    </span>
193                                        </a>
194                                    </li>
195                                    <!-- CHANGES -->
196                                    <li>
197                                        <span class="fa-li"><?= view('icons/edit') ?></span>
198                                        <a href="<?= route(PendingChangesLogPage::class, ['tree' => $managed_tree->name()]) ?>">
199                                            <?= I18N::translate('Changes log') ?>
200                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
201                                        </a>
202                                    </li>
203                                </ul>
204                            </div>
205                            <div class="clearfix visible-sm-block"></div>
206                            <div class="col-sm-6 col-md-3">
207                                <h3>
208                                    <?= I18N::translate('Add unlinked records') ?>
209                                </h3>
210                                <ul class="fa-ul">
211                                    <!-- UNLINKED INDIVIDUAL -->
212                                    <li>
213                                        <span class="fa-li"><?= view('icons/individual') ?></span>
214                                        <a href="<?= e(route('add-unlinked-individual', ['tree' => $managed_tree->name()])) ?>">
215                                            <?= I18N::translate('Individual') ?>
216                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
217                                        </a>
218                                    </li>
219                                    <!-- UNLINKED SOURCE -->
220                                    <li>
221                                        <span class="fa-li"><?= view('icons/source') ?></span>
222                                        <a href="#" data-href="<?= e(route(CreateSourceModal::class, ['tree' => $managed_tree->name()])) ?>" data-target="#wt-ajax-modal" data-toggle="modal">
223                                            <?= I18N::translate('Source') ?>
224                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
225                                        </a>
226                                    </li>
227                                    <!-- UNLINKED REPOSITORY -->
228                                    <li>
229                                        <span class="fa-li"><?= view('icons/repository') ?></span>
230                                        <a href="#" data-href="<?= e(route(CreateRepositoryModal::class, ['tree' => $managed_tree->name()])) ?>" data-target="#wt-ajax-modal" data-toggle="modal">
231                                            <?= I18N::translate('Repository') ?>
232                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
233                                        </a>
234                                    </li>
235                                    <!-- UNLINKED MEDIA OBJECT -->
236                                    <li>
237                                        <span class="fa-li"><?= view('icons/media') ?></span>
238                                        <a href="#" data-href="<?= e(route(CreateMediaObjectModal::class, ['tree' => $managed_tree->name()])) ?>" data-target="#wt-ajax-modal" data-toggle="modal">
239
240                                            <?= I18N::translate('Media object') ?>
241                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
242                                        </a>
243                                    </li>
244                                    <!-- UNLINKED NOTE -->
245                                    <li>
246                                        <span class="fa-li"><?= view('icons/note') ?></span>
247                                        <a href="#" data-href="<?= e(route(CreateNoteModal::class, ['tree' => $managed_tree->name()])) ?>" data-target="#wt-ajax-modal" data-toggle="modal">
248                                            <?= I18N::translate('Shared note') ?>
249                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
250                                        </a>
251                                    </li>
252                                    <!-- UNLINKED SUBMITTER -->
253                                    <li>
254                                        <span class="fa-li"><?= view('icons/submitter') ?></span>
255                                        <a href="#" data-href="<?= e(route(CreateSubmitterModal::class, ['tree' => $managed_tree->name()])) ?>" data-target="#wt-ajax-modal" data-toggle="modal">
256                                            <?= I18N::translate('Submitter') ?>
257                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
258                                        </a>
259                                    </li>
260                                </ul>
261                            </div>
262                            <div class="col-sm-6 col-md-3">
263                                <h3>
264                                    <?= I18N::translate('GEDCOM file') ?>
265                                </h3>
266                                <ul class="fa-ul">
267                                    <!-- DOWNLOAD/Export -->
268                                    <li>
269                                        <span class="fa-li"><?= view('icons/download') ?></span>
270                                        <a href="<?= e(route(ExportGedcomPage::class, ['tree' => $managed_tree->name()])) ?>">
271                                            <?= I18N::translate('Export') ?>
272                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
273                                        </a>
274                                    </li>
275                                    <!-- UPLOAD/IMPORT -->
276                                    <li>
277                                        <span class="fa-li"><?= view('icons/upload') ?></span>
278                                        <a href="<?= e(route('admin-trees-import', ['tree' => $managed_tree->name()])) ?>">
279                                            <?= I18N::translate('Import') ?>
280                                            <span class="sr-only"><?= e($managed_tree->title()) ?></span>
281                                        </a>
282                                    </li>
283                                </ul>
284                            </div>
285                        </div>
286                    </div>
287                </div>
288            </div>
289        <?php endif ?>
290    <?php endforeach ?>
291
292    <!-- BULK LOAD/SYNCHRONISE GEDCOM FILES -->
293    <?php if (count($gedcom_files) >= $multiple_tree_threshold) : ?>
294        <div class="card">
295            <div class="card-header" id="card-tree-create-header">
296                <h2 class="mb-0">
297                    <?= view('icons/sync') ?>
298                    <a data-toggle="collapse" data-parent="#accordion" href="#synchronize-gedcom-files">
299                        <?= I18N::translate('Synchronize family trees with GEDCOM files') ?>
300                    </a>
301                </h2>
302            </div>
303
304            <div id="synchronize-gedcom-files" class="panel-collapse collapse">
305                <div class="card-body">
306                    <p>
307                        <?= I18N::translate('Create, update, and delete a family tree for every GEDCOM file in the data folder.') ?>
308                    </p>
309                    <form method="post" action="<?= e(route('admin-trees-sync')) ?>" class="form form-horizontal">
310                        <?= csrf_field() ?>
311                        <button type="submit" class="btn btn-danger">
312                            <?= view('icons/save') ?>
313                            <?= /* I18N: A button label. */
314                            I18N::translate('continue') ?>
315                        </button>
316                        <p class="small text-muted">
317                            <?= I18N::translate('Caution! This may take a long time. Be patient.') ?>
318                        </p>
319                    </form>
320                </div>
321            </div>
322        </div>
323    <?php endif ?>
324</div>
325
326<?= view('modals/ajax') ?>
327