diff options
Diffstat (limited to 'resources/views')
| -rw-r--r-- | resources/views/admin/control-panel-tree-list.phtml | 87 | ||||
| -rw-r--r-- | resources/views/admin/control-panel.phtml | 7 | ||||
| -rw-r--r-- | resources/views/admin/modules.phtml | 13 | ||||
| -rw-r--r-- | resources/views/branches-page.phtml | 6 | ||||
| -rw-r--r-- | resources/views/icons/list.phtml | 1 | ||||
| -rw-r--r-- | resources/views/lists/surnames-table.phtml | 31 | ||||
| -rw-r--r-- | resources/views/media-list-page.phtml | 26 | ||||
| -rw-r--r-- | resources/views/places-page.phtml | 6 |
8 files changed, 143 insertions, 34 deletions
diff --git a/resources/views/admin/control-panel-tree-list.phtml b/resources/views/admin/control-panel-tree-list.phtml index 25b73a4144..6d684affda 100644 --- a/resources/views/admin/control-panel-tree-list.phtml +++ b/resources/views/admin/control-panel-tree-list.phtml @@ -1,4 +1,13 @@ <?php use Fisharebest\Webtrees\I18N; ?> +<?php use Fisharebest\Webtrees\Auth; ?> +<?php use Fisharebest\Webtrees\Module\IndividualListModule; ?> +<?php use Fisharebest\Webtrees\Module\FamilyListModule; ?> +<?php use Fisharebest\Webtrees\Module\MediaListModule; ?> +<?php use Fisharebest\Webtrees\Module\ModuleInterface; ?> +<?php use Fisharebest\Webtrees\Module\NoteListModule; ?> +<?php use Fisharebest\Webtrees\Module\RepositoryListModule; ?> +<?php use Fisharebest\Webtrees\Module\SourceListModule; ?> +<?php use Fisharebest\Webtrees\Services\ModuleService; ?> <?php foreach ($all_trees as $tree) : ?> <tr class="<?= $changes[$tree->id()] ? 'danger' : '' ?>"> @@ -26,7 +35,18 @@ </td> <td class="d-none d-sm-table-cell text-right"> <?php if ($individuals[$tree->id()]) : ?> - <a href="<?= e(route('individual-list', ['ged' => $tree->name()])) ?>"> + <?php + //find a module providing individual lists + $module = app(ModuleService::class)->findByComponent('list', $tree, Auth::user())->first(function (ModuleInterface $module) { + return $module instanceof IndividualListModule; + }); + + if ($module instanceof IndividualListModule) { + echo '<a href="'.e($module->listUrl($tree)).'">'; + } else { + echo '<a>'; + } + ?> <?= I18N::number($individuals[$tree->id()]) ?> </a> <?php else : ?> @@ -35,7 +55,18 @@ </td> <td class="d-none d-lg-table-cell text-right"> <?php if ($families[$tree->id()]) : ?> - <a href="<?= e(route('family-list', ['ged' => $tree->name()])) ?>"> + <?php + //find a module providing family lists + $module = app(ModuleService::class)->findByComponent('list', $tree, Auth::user())->first(function (ModuleInterface $module) { + return $module instanceof FamilyListModule; + }); + + if ($module instanceof FamilyListModule) { + echo '<a href="'.e($module->listUrl($tree)).'">'; + } else { + echo '<a>'; + } + ?> <?= I18N::number($families[$tree->id()]) ?> </a> <?php else : ?> @@ -44,7 +75,18 @@ </td> <td class="d-none d-sm-table-cell text-right"> <?php if ($sources[$tree->id()]) : ?> - <a href="<?= e(route('source-list', ['ged' => $tree->name()])) ?>"> + <?php + //find a module providing source lists + $module = app(ModuleService::class)->findByComponent('list', $tree, Auth::user())->first(function (ModuleInterface $module) { + return $module instanceof SourceListModule; + }); + + if ($module instanceof SourceListModule) { + echo '<a href="'.e($module->listUrl($tree)).'">'; + } else { + echo '<a>'; + } + ?> <?= I18N::number($sources[$tree->id()]) ?> </a> <?php else : ?> @@ -53,7 +95,18 @@ </td> <td class="d-none d-lg-table-cell text-right"> <?php if ($repositories[$tree->id()]) : ?> - <a href="<?= e(route('repository-list', ['ged' => $tree->name()])) ?>"> + <?php + //find a module providing repository lists + $module = app(ModuleService::class)->findByComponent('list', $tree, Auth::user())->first(function (ModuleInterface $module) { + return $module instanceof RepositoryListModule; + }); + + if ($module instanceof RepositoryListModule) { + echo '<a href="'.e($module->listUrl($tree)).'">'; + } else { + echo '<a>'; + } + ?> <?= I18N::number($repositories[$tree->id()]) ?> </a> <?php else : ?> @@ -62,7 +115,18 @@ </td> <td class="d-none d-sm-table-cell text-right"> <?php if ($media[$tree->id()]) : ?> - <a href="<?= e(route('media-list', ['ged' => $tree->name()])) ?>"> + <?php + //find a module providing media lists + $module = app(ModuleService::class)->findByComponent('list', $tree, Auth::user())->first(function (ModuleInterface $module) { + return $module instanceof MediaListModule; + }); + + if ($module instanceof MediaListModule) { + echo '<a href="'.e($module->listUrl($tree)).'">'; + } else { + echo '<a>'; + } + ?> <?= I18N::number($media[$tree->id()]) ?> </a> <?php else : ?> @@ -71,7 +135,18 @@ </td> <td class="d-none d-lg-table-cell text-right"> <?php if ($notes[$tree->id()]) : ?> - <a href="<?= e(route('note-list', ['ged' => $tree->name()])) ?>"> + <?php + //find a module providing note lists + $module = app(ModuleService::class)->findByComponent('list', $tree, Auth::user())->first(function (ModuleInterface $module) { + return $module instanceof NoteListModule; + }); + + if ($module instanceof NoteListModule) { + echo '<a href="'.e($module->listUrl($tree)).'">'; + } else { + echo '<a>'; + } + ?> <?= I18N::number($media[$tree->id()]) ?> </a> <?php else : ?> diff --git a/resources/views/admin/control-panel.phtml b/resources/views/admin/control-panel.phtml index 9f9c09e6ab..20bc5d4103 100644 --- a/resources/views/admin/control-panel.phtml +++ b/resources/views/admin/control-panel.phtml @@ -331,6 +331,13 @@ <?= view('components/badge', ['count' => $chart_modules->count(), 'context' => 'primary']) ?> </li> <li> + <span class="fa-li"><?= view('icons/list') ?></span> + <a href="<?= e(route('lists')) ?>"> + <?= I18N::translate('Lists') ?> + </a> + <?= view('components/badge', ['count' => $list_modules->count(), 'context' => 'primary']) ?> + </li> + <li> <span class="fa-li"><?= view('icons/report') ?></span> <a href="<?= e(route('reports')) ?>"> <?= I18N::translate('Reports') ?> diff --git a/resources/views/admin/modules.phtml b/resources/views/admin/modules.phtml index 0f168bc6e8..b969fe4948 100644 --- a/resources/views/admin/modules.phtml +++ b/resources/views/admin/modules.phtml @@ -9,6 +9,7 @@ <?php use Fisharebest\Webtrees\Module\ModuleFooterInterface; ?> <?php use Fisharebest\Webtrees\Module\ModuleHistoricEventsInterface; ?> <?php use Fisharebest\Webtrees\Module\ModuleLanguageInterface; ?> +<?php use Fisharebest\Webtrees\Module\ModuleListInterface; ?> <?php use Fisharebest\Webtrees\Module\ModuleMenuInterface; ?> <?php use Fisharebest\Webtrees\Module\ModuleReportInterface; ?> <?php use Fisharebest\Webtrees\Module\ModuleSidebarInterface; ?> @@ -75,6 +76,10 @@ <?= view('icons/chart') ?> <span class="sr-only"><?= I18N::translate('Charts') ?></span> </th> + <th title="<?= I18N::translate('Lists') ?>"> + <?= view('icons/list') ?> + <span class="sr-only"><?= I18N::translate('Lists') ?></span> + </th> <th title="<?= I18N::translate('Reports') ?>"> <?= view('icons/report') ?> <span class="sr-only"><?= I18N::translate('Reports') ?></span> @@ -198,6 +203,14 @@ - <?php endif ?> </td> + <td class="text-center text-muted" title="<?= I18N::translate('List') ?>"> + <?php if ($module instanceof ModuleListInterface) : ?> + <?= view('icons/list') ?> + <span class="sr-only"><?= I18N::translate('List') ?></span> + <?php else : ?> + - + <?php endif ?> + </td> <td class="text-center text-muted" title="<?= I18N::translate('Report') ?>"> <?php if ($module instanceof ModuleReportInterface) : ?> <?= view('icons/report') ?> diff --git a/resources/views/branches-page.phtml b/resources/views/branches-page.phtml index da0f6e5c83..2235d19b2c 100644 --- a/resources/views/branches-page.phtml +++ b/resources/views/branches-page.phtml @@ -6,7 +6,9 @@ </h2> <form class="wt-page-options wt-page-options-branches d-print-none"> - <input type="hidden" name="route" value="branches"> + <input type="hidden" name="route" value="module"> + <input type="hidden" name="module" value="<?= e($module) ?>"> + <input type="hidden" name="action" value="<?= e($action) ?>"> <input type="hidden" name="ged" value="<?= e($tree->name()) ?>"> <div class="form-group row"> @@ -42,5 +44,5 @@ </form> <?php if ($surname !== '') : ?> - <div class="wt-ajax-load wt-page-content wt-chart wt-branches" data-ajax-url="<?= e(route('branches-list', ['surname' => $surname, 'soundex_std' => $soundex_std, 'soundex_dm' => $soundex_dm, 'ged' => $tree->name()])) ?>"></div> + <div class="wt-ajax-load wt-page-content wt-chart wt-branches" data-ajax-url="<?= e(route('module', ['module' => $module, 'action' => 'List', 'surname' => $surname, 'soundex_std' => $soundex_std, 'soundex_dm' => $soundex_dm, 'ged' => $tree->name()])) ?>"></div> <?php endif ?> diff --git a/resources/views/icons/list.phtml b/resources/views/icons/list.phtml new file mode 100644 index 0000000000..2d0344f114 --- /dev/null +++ b/resources/views/icons/list.phtml @@ -0,0 +1 @@ +<i class="fas fa-list fa-fw wt-icon-list" aria-hidden="true"></i> diff --git a/resources/views/lists/surnames-table.phtml b/resources/views/lists/surnames-table.phtml index 19bac44961..8e6a30c654 100644 --- a/resources/views/lists/surnames-table.phtml +++ b/resources/views/lists/surnames-table.phtml @@ -10,7 +10,7 @@ <?= I18N::translate('Surname') ?> </th> <th> - <?php if ($route == 'family-list') :?> + <?php if ($families) :?> <?= I18N::translate('Spouses') ?> <?php else : ?> <?= I18N::translate('Individuals') ?> @@ -25,19 +25,28 @@ <td data-sort="<?= e($surn) ?>"> <!-- Multiple surname variants, e.g. von Groot, van Groot, van der Groot, etc. --> <?php foreach ($surns as $spfxsurn => $indis) : ?> - <?php if ($spfxsurn) : ?> - <?php if ($surn !== '') : ?> - <a href="<?= route($route, ['surname' => $surn, 'ged' => $tree->name()]) ?>" dir="auto"> - <?= e($spfxsurn) ?> - </a> + <?php if ($module instanceof IndividualListModule) : ?> + <?php if ($spfxsurn) : ?> + <?php if ($surn !== '') : ?> + <a href="<?= $module->listUrl($tree, ['surname' => $surn]) ?>" dir="auto"> + <?= e($spfxsurn) ?> + </a> + <?php else : ?> + <a href="<?= $module->listUrl($tree, ['alpha' => ',']) ?>" dir="auto"> + <?= e($spfxsurn) ?> + </a> + <?php endif ?> <?php else : ?> - <a href="<?= route($route, ['alpha' => ',', 'ged' => $tree->name()]) ?>" dir="auto"> - <?= e($spfxsurn) ?> - </a> + <!-- No surname, but a value from "2 SURN"? A common workaround for toponyms, etc. --> + <a href="<?= $module->listUrl($tree, ['surname' => $surn]) ?>" dir="auto"><?= e($surn) ?></a> <?php endif ?> <?php else : ?> - <!-- No surname, but a value from "2 SURN"? A common workaround for toponyms, etc. --> - <a href="<?= route($route, ['surname' => $surn, 'ged' => $tree->name()]) ?>" dir="auto"><?= e($surn) ?></a> + <?php if ($spfxsurn) : ?> + <span dir="auto"><?= e($spfxsurn) ?></span> + <?php else : ?> + <!-- No surname, but a value from "2 SURN"? A common workaround for toponyms, etc. --> + <span dir="auto"><?= e($surn) ?></span> + <?php endif ?> <?php endif ?> <br> <?php endforeach ?> diff --git a/resources/views/media-list-page.phtml b/resources/views/media-list-page.phtml index 9a216e78ff..8090ed4a9c 100644 --- a/resources/views/media-list-page.phtml +++ b/resources/views/media-list-page.phtml @@ -12,8 +12,10 @@ <form class="wt-page-options wt-page-options-media-list d-print-none"> <input type="hidden" name="ged" value="<?= e($tree->name()) ?>"> - <input type="hidden" name="route" value="media-list"> - <input type="hidden" name="action" value="1"> + <input type="hidden" name="route" value="module"> + <input type="hidden" name="module" value="<?= e($module) ?>"> + <input type="hidden" name="action" value="<?= e($action) ?>"> + <input type="hidden" name="action2" value="1"> <input type="hidden" name="search" value="yes"> <div class="row form-group"> @@ -58,10 +60,10 @@ <div class="col-sm-3 col-form-label wt-page-options-label"> </div> <div class="col-sm-3 wt-page-options-value"> - <button type="submit" name="action" value="1" class="btn btn-primary"> + <button type="submit" name="action2" value="1" class="btn btn-primary"> <?= /* I18N: A button label. */ I18N::translate('search') ?> </button> - <a class="btn btn-secondary" href="<?= e(route('media-list', ['ged' => $tree->name()])) ?>"> + <a class="btn btn-secondary" href="<?= e(route('module', ['module' => $module, 'action' => $action, 'ged' => $tree->name()])) ?>"> <?= /* I18N: A button label. */ I18N::translate('reset') ?> </a> </div> @@ -75,14 +77,14 @@ <div class="row text-center"> <div class="col"> <?php if ($page > 1) : ?> - <a href="<?= e(route('media-list', ['ged' => $tree->name(), 'action' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => 1])) ?>"> + <a href="<?= e(route('module', ['module' => $module, 'action' => $action, 'ged' => $tree->name(), 'action2' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => 1])) ?>"> <?= I18N::translate('first') ?> </a> <?php endif ?> </div> <div class="col"> <?php if ($page > 1) : ?> - <a href="<?= e(route('media-list', ['ged' => $tree->name(), 'action' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => $page - 1])) ?>"> + <a href="<?= e(route('module', ['module' => $module, 'action' => $action, 'ged' => $tree->name(), 'action2' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => $page - 1])) ?>"> <?= I18N::translate('previous') ?> </a> <?php endif ?> @@ -92,14 +94,14 @@ </div> <div class="col"> <?php if ($page < $pages) : ?> - <a href="<?= e(route('media-list', ['ged' => $tree->name(), 'action' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => $page + 1])) ?>"> + <a href="<?= e(route('module', ['module' => $module, 'action' => $action, 'ged' => $tree->name(), 'action2' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => $page + 1])) ?>"> <?= I18N::translate('next') ?> </a> <?php endif ?> </div> <div class="col"> <?php if ($page < $pages) : ?> - <a href="<?= e(route('media-list', ['ged' => $tree->name(), 'action' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => $pages])) ?>"> + <a href="<?= e(route('module', ['module' => $module, 'action' => $action, 'ged' => $tree->name(), 'action2' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => $pages])) ?>"> <?= I18N::translate('last') ?> </a> <?php endif ?> @@ -181,14 +183,14 @@ <div class="row text-center"> <div class="col"> <?php if ($page > 1) : ?> - <a href="<?= e(route('media-list', ['ged' => $tree->name(), 'action' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => 1])) ?>"> + <a href="<?= e(route('module', ['module' => $module, 'action' => $action, 'ged' => $tree->name(), 'action2' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => 1])) ?>"> <?= I18N::translate('first') ?> </a> <?php endif ?> </div> <div class="col"> <?php if ($page > 1) : ?> - <a href="<?= e(route('media-list', ['ged' => $tree->name(), 'action' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => $page - 1])) ?>"> + <a href="<?= e(route('module', ['module' => $module, 'action' => $action, 'ged' => $tree->name(), 'action2' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => $page - 1])) ?>"> <?= I18N::translate('previous') ?> </a> <?php endif ?> @@ -198,14 +200,14 @@ </div> <div class="col"> <?php if ($page < $pages) : ?> - <a href="<?= e(route('media-list', ['ged' => $tree->name(), 'action' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => $page + 1])) ?>"> + <a href="<?= e(route('module', ['module' => $module, 'action' => $action, 'ged' => $tree->name(), 'action2' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => $page + 1])) ?>"> <?= I18N::translate('next') ?> </a> <?php endif ?> </div> <div class="col"> <?php if ($page < $pages) : ?> - <a href="<?= e(route('media-list', ['ged' => $tree->name(), 'action' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => $pages])) ?>"> + <a href="<?= e(route('module', ['module' => $module, 'action' => $action, 'ged' => $tree->name(), 'action2' => '1', 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'form_type' => $form_type, 'max' => $max, 'page' => $pages])) ?>"> <?= I18N::translate('last') ?> </a> <?php endif ?> diff --git a/resources/views/places-page.phtml b/resources/views/places-page.phtml index 0f5a26ff18..2648f77fe5 100644 --- a/resources/views/places-page.phtml +++ b/resources/views/places-page.phtml @@ -5,7 +5,7 @@ <h4><?= $title ?></h4> <h5 class="text-center"> <?php if ($current) : ?> - <a href="<?= e(route('place-hierarchy', ['ged' => $tree->name()])) ?>"> + <a href="<?= e(route('module', ['module' => $module, 'action' => $action, 'ged' => $tree->name()])) ?>"> <?= I18N::translate('World') ?> </a> <?php else : ?> @@ -29,13 +29,13 @@ <?= $content ?> <div class="text-center"> <?php if ($showeventslink) : ?> - <a class="formField" href= <?= e(route('place-hierarchy', ['ged' => $tree->name(), 'parent' => $parent, 'action' => 'hierarchy-e'])) ?>> + <a class="formField" href= <?= e(route('module', ['module' => $module, 'action' => $action, 'ged' => $tree->name(), 'parent' => $parent, 'action2' => 'hierarchy-e'])) ?>> <?= I18N::translate('View table of events occurring in %s', $place) ?> </a> | <?php endif ?> - <a href="<?= e(route('place-hierarchy', ['ged' => $tree->name(), 'action' => key($nextaction)])) ?>"> + <a href="<?= e(route('module', ['module' => $module, 'action' => $action, 'ged' => $tree->name(), 'action2' => key($nextaction)])) ?>"> <?= current($nextaction) ?> </a> </div> |
