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