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