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