1d70512abSGreg Roach<?php 2d70512abSGreg Roach 3d70512abSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; 44b3ef6caSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\FixLevel0MediaAction; 54b3ef6caSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\FixLevel0MediaData; 6d70512abSGreg Roachuse Fisharebest\Webtrees\I18N; 7d70512abSGreg Roach 87c2c99faSGreg Roach/** 97c2c99faSGreg Roach * @var string $title 107c2c99faSGreg Roach */ 117c2c99faSGreg Roach 12d70512abSGreg Roach?> 13dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\View; ?> 14dd6b2bfcSGreg Roach 150c0910bfSGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?> 16dd6b2bfcSGreg Roach 17dd6b2bfcSGreg Roach<h1><?= $title ?></h1> 18dd6b2bfcSGreg Roach 19dd6b2bfcSGreg Roach<p> 20dd6b2bfcSGreg Roach <?= I18N::translate('If a media object is linked to an individual, when it should be linked to a fact or event, then you can move it to the correct location.') ?> 21dd6b2bfcSGreg Roach</p> 22dd6b2bfcSGreg Roach 2371d313c5SGreg Roach<table 24b4139381SGreg Roach class="table table-bordered table-sm table-hover wt-fix-table datatables d-none" 2571d313c5SGreg Roach <?= view('lists/datatables-attributes') ?> 26*728c8c27SGreg Roach data-ajax="<?= e(json_encode(['url' => route(FixLevel0MediaData::class)], JSON_THROW_ON_ERROR)) ?>" 2771d313c5SGreg Roach data-server-side="true" 2871d313c5SGreg Roach> 29315eb316SGreg Roach <caption class="visually-hidden"> 30dd6b2bfcSGreg Roach <?= I18N::translate('Media objects') ?> 31dd6b2bfcSGreg Roach </caption> 32dd6b2bfcSGreg Roach <thead class="thead-dark"> 33dd6b2bfcSGreg Roach <tr> 34dd6b2bfcSGreg Roach <th data-sortable="false"><?= I18N::translate('Family tree') ?></th> 35dd6b2bfcSGreg Roach <th data-sortable="false"><?= I18N::translate('Media object') ?></th> 36dd6b2bfcSGreg Roach <th data-sortable="false"><?= I18N::translate('Title') ?></th> 37dd6b2bfcSGreg Roach <th data-sortable="false"><?= I18N::translate('Individual') ?></th> 38dd6b2bfcSGreg Roach <th data-sortable="false"><?= I18N::translate('Facts and events') ?></th> 39dd6b2bfcSGreg Roach </tr> 40dd6b2bfcSGreg Roach </thead> 41dd6b2bfcSGreg Roach</table> 42dd6b2bfcSGreg Roach 43dd6b2bfcSGreg Roach<?php View::push('javascript') ?> 44dd6b2bfcSGreg Roach<script> 45dd6b2bfcSGreg Roach 'use strict'; 46dd6b2bfcSGreg Roach 47dd6b2bfcSGreg Roach // If we click on a button, post the request and reload the table 48dd6b2bfcSGreg Roach document.querySelector(".wt-fix-table").onclick = function (event) { 49dd6b2bfcSGreg Roach let element = event.target; 50dd6b2bfcSGreg Roach if (element.classList.contains("wt-fix-button")) { 51dd6b2bfcSGreg Roach event.stopPropagation(); 52dd6b2bfcSGreg Roach if (confirm(element.dataset.confirm)) { 53dd6b2bfcSGreg Roach $.ajax({ 54dd6b2bfcSGreg Roach data: { 55dd6b2bfcSGreg Roach "fact_id": element.dataset.factId, 56dd6b2bfcSGreg Roach "indi_xref": element.dataset.individualXref, 57dd6b2bfcSGreg Roach "obje_xref": element.dataset.mediaXref, 58dd6b2bfcSGreg Roach "tree_id": element.dataset.treeId 59dd6b2bfcSGreg Roach }, 60dd6b2bfcSGreg Roach method: "POST", 61*728c8c27SGreg Roach url: <?= json_encode(route(FixLevel0MediaAction::class), JSON_THROW_ON_ERROR) ?> 62dd6b2bfcSGreg Roach }).done(function () { 63dd6b2bfcSGreg Roach $(".wt-fix-table").DataTable().ajax.reload(null, false); 64dd6b2bfcSGreg Roach }); 65dd6b2bfcSGreg Roach } 66dd6b2bfcSGreg Roach } 67dd6b2bfcSGreg Roach }; 68dd6b2bfcSGreg Roach</script> 69dd6b2bfcSGreg Roach<?php View::endpush() ?> 70