1<?php 2 3use Fisharebest\Webtrees\Auth; 4use Fisharebest\Webtrees\Functions\FunctionsPrint; 5use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; 6use Fisharebest\Webtrees\GedcomTag; 7use Fisharebest\Webtrees\Http\RequestHandlers\DeleteFact; 8use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord; 9use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord; 10use Fisharebest\Webtrees\I18N; 11use Fisharebest\Webtrees\Media; 12use Illuminate\Support\Collection; 13 14/** 15 * @var Collection $clipboard_facts 16 * @var Collection $facts 17 * @var Collection $families 18 * @var Collection $individuals 19 * @var Media $media 20 * @var Collection $notes 21 * @var Collection $sources 22 */ 23?> 24 25<?php if ($media->isPendingDeletion()) : ?> 26 <?php if (Auth::isModerator($media->tree())) : ?> 27 <?= view('components/alert-warning-dismissible', ['alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ I18N::translate('This media object has been deleted. You should review the deletion and then %1$s or %2$s it.', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesAcceptRecord::class, ['tree' => $media->tree()->name(), 'xref' => $media->xref()])) . '">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'accept') . '</a>', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesRejectRecord::class, ['tree' => $media->tree()->name(), 'xref' => $media->xref()])) . '">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?> 28 <?php elseif (Auth::isEditor($media->tree())) : ?> 29 <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This media object has been deleted. The deletion will need to be reviewed by a moderator.') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?> 30 <?php endif ?> 31<?php elseif ($media->isPendingAddition()) : ?> 32 <?php if (Auth::isModerator($media->tree())) : ?> 33 <?= view('components/alert-warning-dismissible', ['alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ I18N::translate('This media object has been edited. You should review the changes and then %1$s or %2$s them.', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesAcceptRecord::class, ['tree' => $media->tree()->name(), 'xref' => $media->xref()])) . '">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'accept') . '</a>', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesRejectRecord::class, ['tree' => $media->tree()->name(), 'xref' => $media->xref()])) . '">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?> 34 <?php elseif (Auth::isEditor($media->tree())) : ?> 35 <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This media object has been edited. The changes need to be reviewed by a moderator.') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?> 36 <?php endif ?> 37<?php endif ?> 38 39<div class="d-flex mb-4"> 40 <h2 class="wt-page-title mx-auto"> 41 <?= $media->fullName() ?> 42 </h2> 43 <?php if ($media->canEdit()) : ?> 44 <?= view('media-page-menu', ['record' => $media]) ?> 45 <?php endif ?> 46</div> 47 48<div class="wt-page-content"> 49 <ul class="nav nav-tabs" role="tablist"> 50 <li class="nav-item"> 51 <a class="nav-link active" data-toggle="tab" role="tab" href="#details"> 52 <?= I18N::translate('Details') ?> 53 </a> 54 </li> 55 <li class="nav-item"> 56 <a class="nav-link<?= $individuals->isEmpty() ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#individuals"> 57 <?= I18N::translate('Individuals') ?> 58 <?= view('components/badge', ['count' => $individuals->count()]) ?> 59 </a> 60 </li> 61 <li class="nav-item"> 62 <a class="nav-link<?= $families->isEmpty() ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#families"> 63 <?= I18N::translate('Families') ?> 64 <?= view('components/badge', ['count' => $families->count()]) ?> 65 </a> 66 </li> 67 <li class="nav-item"> 68 <a class="nav-link<?= $sources->isEmpty() ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#sources"> 69 <?= I18N::translate('Sources') ?> 70 <?= view('components/badge', ['count' => $sources->count()]) ?> 71 </a> 72 </li> 73 <li class="nav-item"> 74 <a class="nav-link<?= $notes->isEmpty() ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#notes"> 75 <?= I18N::translate('Notes') ?> 76 <?= view('components/badge', ['count' => $notes->count()]) ?> 77 </a> 78 </li> 79 </ul> 80 81 <div class="tab-content mt-4"> 82 <div class="tab-pane active fade show" role="tabpanel" id="details"> 83 <table class="table wt-facts-table"> 84 <?php foreach ($media->mediaFiles() as $media_file) : ?> 85 <tr class="<?= $media_file->isPendingAddition() ? 'wt-new' : '' ?><?= $media_file->isPendingDeletion() ? 'wt-old' : '' ?>"> 86 <th scope="row"> 87 <?= I18N::translate('Media file') ?> 88 <?php if ($media->canEdit()) : ?> 89 <div class="editfacts"> 90 <a class="btn btn-link" href="#" data-toggle="modal" data-target="#wt-ajax-modal" data-href="<?= route('edit-media-file', ['tree' => $media->tree()->name(), 'xref' => $media->xref(), 'fact_id' => $media_file->factId()]) ?>" title="<?= I18N::translate('Edit') ?>"> 91 <?= view('icons/edit') ?> 92 <span class="sr-only"> 93 <?= I18N::translate('Edit') ?> 94 </span> 95 </a> 96 97 <?php if (count($media->mediaFiles()) > 1) : ?> 98 <a class="btn btn-link" href="#" data-confirm="<?= I18N::translate('Are you sure you want to delete this fact?') ?>" data-post-url="<?= e(route(DeleteFact::class, ['tree' => $media->tree()->name(), 'xref' => $media->xref(), 'fact_id' => $media_file->factId()()])) ?>" title="<?= I18N::translate('Delete') ?>"> 99 <?= view('icons/delete') ?> 100 <span class="sr-only"> 101 <?= I18N::translate('Delete') ?> 102 </span> 103 </a> 104 105 <?php endif ?> 106 </div> 107 <?php endif ?> 108 </th> 109 <td class="d-flex justify-content-between"> 110 <div> 111 <?php if ($media_file->isExternal()) : ?> 112 <?= GedcomTag::getLabelValue('URL', $media_file->filename()) ?> 113 <?php elseif (Auth::isEditor($media->tree())) :?> 114 <?php if (!$media_file->fileExists()) : ?> 115 <p class="alert alert-danger"> 116 <?= I18N::translate('The file “%s” does not exist.', $media_file->filename()) ?> 117 </p> 118 <?php endif ?> 119 <?= GedcomTag::getLabelValue('FILE', $media_file->filename()) ?> 120 <?php endif ?> 121 122 <?= GedcomTag::getLabelValue('TITL', $media_file->title()) ?> 123 <?= GedcomTag::getLabelValue('TYPE', $media_file->type()) ?> 124 <?= GedcomTag::getLabelValue('FORM', $media_file->format()) ?> 125 </div> 126 127 <div> 128 <?php if (!$media_file->isExternal()) : ?> 129 <?= $media_file->displayImage(200, 150, 'contain', []) ?> 130 <?php if ($media->tree()->getPreference('SHOW_MEDIA_DOWNLOAD') >= Auth::accessLevel($media->tree()) && $media_file->fileExists()) : ?> 131 <br> 132 <a href="<?= $media_file->imageUrl(0, 0, '') ?>"> 133 <?= I18N::translate('Download file') ?> 134 </a> 135 <?php endif ?> 136 <?php endif ?> 137 </div> 138 </td> 139 </tr> 140 <?php endforeach ?> 141 <?php foreach ($facts as $fact) : ?> 142 <?php if ($fact->getTag() !== 'FILE') : ?> 143 <?php FunctionsPrintFacts::printFact($fact, $media) ?> 144 <?php endif ?> 145 <?php endforeach ?> 146 <?php if ($media->canEdit()) : ?> 147 <?= view('edit/paste-fact-row', ['record' => $media, 'facts' => $clipboard_facts]) ?> 148 149 <?php FunctionsPrint::printAddNewFact($media, $facts, 'OBJE') ?> 150 <tr> 151 <th> 152 <?= I18N::translate('Source') ?> 153 </th> 154 <td> 155 <a href="<?= e(route('add-fact', ['tree' => $media->tree()->name(), 'xref' => $media->xref(), 'fact' => 'SOUR'])) ?>"> 156 <?= I18N::translate('Add a source citation') ?> 157 </a> 158 </td> 159 </tr> 160 <tr> 161 <th scope="row"> 162 <?= I18N::translate('Shared note') ?> 163 </th> 164 <td> 165 <a href="<?= e(route('add-fact', ['tree' => $media->tree()->name(), 'xref' => $media->xref(), 'fact' => 'SHARED_NOTE'])) ?>"> 166 <?= I18N::translate('Add a shared note') ?> 167 </a> 168 </td> 169 </tr> 170 <tr> 171 <th scope="row"> 172 <?= I18N::translate('Restriction') ?> 173 </th> 174 <td> 175 <a href="<?= e(route('add-fact', ['tree' => $media->tree()->name(), 'xref' => $media->xref(), 'fact' => 'RESN'])) ?>"> 176 <?= I18N::translate('Add a restriction') ?> 177 </a> 178 </td> 179 </tr> 180 <tr> 181 <th scope="row"> 182 <?= I18N::translate('Media file') ?> 183 </th> 184 <td> 185 <a href="#" data-href="<?= e(route('add-media-file', ['tree' => $media->tree()->name(), 'xref' => $media->xref()])) ?>" data-target="#wt-ajax-modal" data-toggle="modal"> 186 <?= I18N::translate('Add a media file') ?> 187 </a> 188 </td> 189 </tr> 190 <?php endif ?> 191 </table> 192 </div> 193 194 <div class="tab-pane fade" role="tabpanel" id="individuals"> 195 <?= view('lists/individuals-table', ['individuals' => $individuals, 'sosa' => false, 'tree' => $tree]) ?> 196 </div> 197 198 <div class="tab-pane fade" role="tabpanel" id="families"> 199 <?= view('lists/families-table', ['families' => $families, 'tree' => $tree]) ?> 200 </div> 201 202 <div class="tab-pane fade" role="tabpanel" id="sources"> 203 <?= view('lists/sources-table', ['sources' => $sources, 'tree' => $tree]) ?> 204 </div> 205 206 <div class="tab-pane fade" role="tabpanel" id="notes"> 207 <?= view('lists/notes-table', ['notes' => $notes, 'tree' => $tree]) ?> 208 </div> 209 </div> 210</div> 211 212<?= view('modals/ajax') ?> 213