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