1b6c326d8SGreg Roach<?php 2b6c326d8SGreg Roach 3870365fbSGreg Roachuse Fisharebest\Webtrees\Auth; 40c0910bfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; 5*6fd01894SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ManageTrees; 6*6fd01894SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\TreePrivacyAction; 7269403b3SGreg Roachuse Fisharebest\Webtrees\I18N; 8b6c326d8SGreg Roachuse Fisharebest\Webtrees\View; 9b6c326d8SGreg Roach 10b6c326d8SGreg Roach?> 11dd6b2bfcSGreg Roach 12*6fd01894SGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(ManageTrees::class, ['tree' => $tree->name()]) => I18N::translate('Manage family trees'), $title]]) ?> 13dd6b2bfcSGreg Roach 14dd6b2bfcSGreg Roach<h1><?= $title ?></h1> 15dd6b2bfcSGreg Roach 16*6fd01894SGreg Roach<form method="post" action="<?= e(route(TreePrivacyAction::class, ['tree' => $tree->name()])) ?>"> 17dd6b2bfcSGreg Roach <?= csrf_field() ?> 18dd6b2bfcSGreg Roach 19dd6b2bfcSGreg Roach <!-- REQUIRE_AUTHENTICATION --> 20dd6b2bfcSGreg Roach <div class="row form-group"> 21dd6b2bfcSGreg Roach <div class="col-form-label col-sm-4"> 22dd6b2bfcSGreg Roach <label> 23dd6b2bfcSGreg Roach <?= /* I18N: A configuration setting */ I18N::translate('Show the family tree') ?> 24dd6b2bfcSGreg Roach </label> 25dd6b2bfcSGreg Roach <div class="hidden-xs"> 26dd6b2bfcSGreg Roach <span class="badge visitors"><?= I18N::translate('visitors') ?></span> 27dd6b2bfcSGreg Roach <span class="badge members"><?= I18N::translate('members') ?></span> 28dd6b2bfcSGreg Roach </div> 29dd6b2bfcSGreg Roach </div> 30dd6b2bfcSGreg Roach <div class="col-sm-8"> 31c9e11c2aSGreg Roach <?= view('components/select', ['name' => 'REQUIRE_AUTHENTICATION', 'selected' => $tree->getPreference('REQUIRE_AUTHENTICATION'), 'options' => ['0' => I18N::translate('Show to visitors'), '1' => I18N::translate('Show to members')]]) ?> 32dd6b2bfcSGreg Roach <p class="small text-muted"> 33dd6b2bfcSGreg Roach <?= /* I18N: Help text for the “Family tree” configuration setting */ I18N::translate('Enabling this option will force all visitors to sign in before they can view any data on the website.') ?> 34dd6b2bfcSGreg Roach </p> 35dd6b2bfcSGreg Roach </div> 36dd6b2bfcSGreg Roach </div> 37dd6b2bfcSGreg Roach 38dd6b2bfcSGreg Roach <!-- SHOW_DEAD_PEOPLE --> 39dd6b2bfcSGreg Roach <div class="row form-group"> 40dd6b2bfcSGreg Roach <div class="col-form-label col-sm-4"> 41dd6b2bfcSGreg Roach <label for="SHOW_DEAD_PEOPLE"> 42dd6b2bfcSGreg Roach <?= /* I18N: A configuration setting */ I18N::translate('Show dead individuals') ?> 43dd6b2bfcSGreg Roach </label> 44dd6b2bfcSGreg Roach <div class="hidden-xs"> 45dd6b2bfcSGreg Roach <span class="badge visitors"><?= I18N::translate('visitors') ?></span> 46dd6b2bfcSGreg Roach <span class="badge members"><?= I18N::translate('members') ?></span> 47dd6b2bfcSGreg Roach </div> 48dd6b2bfcSGreg Roach </div> 49dd6b2bfcSGreg Roach <div class="col-sm-8"> 50870365fbSGreg Roach <?= view('components/select', ['name' => 'SHOW_DEAD_PEOPLE', 'selected' => $tree->getPreference('SHOW_DEAD_PEOPLE'), 'options' => array_slice(Auth::accessLevelNames(), 0, 2, true)]) ?> 51dd6b2bfcSGreg Roach <p class="small text-muted"> 52dd6b2bfcSGreg Roach <?= /* I18N: Help text for the “Show dead individuals” configuration setting */ I18N::translate('Set the privacy access level for all dead individuals.') ?> 53dd6b2bfcSGreg Roach </p> 54dd6b2bfcSGreg Roach </div> 55dd6b2bfcSGreg Roach </div> 56dd6b2bfcSGreg Roach 57dd6b2bfcSGreg Roach 58dd6b2bfcSGreg Roach <!-- MAX_ALIVE_AGE --> 59dd6b2bfcSGreg Roach <div class="row form-group"> 60dd6b2bfcSGreg Roach <label class="col-form-label col-sm-4" for="MAX_ALIVE_AGE"> 61dd6b2bfcSGreg Roach <?= I18N::translate('Age at which to assume an individual is dead') ?> 62dd6b2bfcSGreg Roach </label> 63dd6b2bfcSGreg Roach <div class="col-sm-8"> 64dd6b2bfcSGreg Roach <input 65dd6b2bfcSGreg Roach class="form-control" 66dd6b2bfcSGreg Roach id="MAX_ALIVE_AGE" 67ef59c27bSGreg Roach min="1" 68ef59c27bSGreg Roach max="9999" 69dd6b2bfcSGreg Roach name="MAX_ALIVE_AGE" 70ef59c27bSGreg Roach required 71ef59c27bSGreg Roach type="number" 72dd6b2bfcSGreg Roach value="<?= e($tree->getPreference('MAX_ALIVE_AGE')) ?>" 73dd6b2bfcSGreg Roach > 74dd6b2bfcSGreg Roach <p class="small text-muted"> 75dd6b2bfcSGreg Roach <?= /* I18N: Help text for the “Age at which to assume an individual is dead” configuration setting */ I18N::translate('If this individual has any events other than death, burial, or cremation more recent than this number of years, they are considered to be “alive”. Children’s birth dates are considered to be such events for this purpose.') ?> 76dd6b2bfcSGreg Roach </p> 77dd6b2bfcSGreg Roach </div> 78dd6b2bfcSGreg Roach </div> 79dd6b2bfcSGreg Roach 80dd6b2bfcSGreg Roach <!-- HIDE_LIVE_PEOPLE --> 81dd6b2bfcSGreg Roach <fieldset class="form-group"> 82dd6b2bfcSGreg Roach <div class="row"> 83dd6b2bfcSGreg Roach <div class="col-sm-4"> 84dd6b2bfcSGreg Roach <legend class="col-form-label"> 85dd6b2bfcSGreg Roach <?= /* I18N: A configuration setting */ I18N::translate('Show living individuals') ?> 86dd6b2bfcSGreg Roach <div class="hidden-xs"> 87dd6b2bfcSGreg Roach <span class="badge visitors"><?= I18N::translate('visitors') ?></span> 88dd6b2bfcSGreg Roach <span class="badge members"><?= I18N::translate('members') ?></span> 89dd6b2bfcSGreg Roach </div> 90dd6b2bfcSGreg Roach </legend> 91dd6b2bfcSGreg Roach </div> 92dd6b2bfcSGreg Roach <div class="col-sm-8"> 93c9e11c2aSGreg Roach <?= view('components/select', ['name' => 'HIDE_LIVE_PEOPLE', 'selected' => $tree->getPreference('HIDE_LIVE_PEOPLE'), 'options' => ['0' => I18N::translate('Show to visitors'), '1' => I18N::translate('Show to members')]]) ?> 94dd6b2bfcSGreg Roach <p class="small text-muted"> 95dd6b2bfcSGreg Roach <?= /* I18N: Help text for the “Show living individuals” configuration setting */ I18N::translate('If you show living individuals to visitors, all other privacy restrictions are ignored. Do this only if all the data in your tree is public.') ?> 96dd6b2bfcSGreg Roach </p> 97dd6b2bfcSGreg Roach </div> 98dd6b2bfcSGreg Roach </div> 99dd6b2bfcSGreg Roach </fieldset> 100dd6b2bfcSGreg Roach 101dd6b2bfcSGreg Roach <!-- KEEP_ALIVE_YEARS_BIRTH / KEEP_ALIVE_YEARS_DEATH --> 102dd6b2bfcSGreg Roach <fieldset class="form-group"> 103dd6b2bfcSGreg Roach <div class="row"> 104dd6b2bfcSGreg Roach <legend class="col-form-label col-sm-4"> 105dd6b2bfcSGreg Roach <?= /* I18N: A configuration setting. …who were born in the last XX years or died in the last YY years */ I18N::translate('Extend privacy to dead individuals') ?> 106dd6b2bfcSGreg Roach </legend> 107dd6b2bfcSGreg Roach <div class="col-sm-8"> 108dd6b2bfcSGreg Roach <?php 109dd6b2bfcSGreg Roach echo 110dd6b2bfcSGreg Roach /* I18N: Extend privacy to dead individuals who were… */ I18N::translate( 111dd6b2bfcSGreg Roach 'born in the last %1$s years or died in the last %2$s years', 112dd6b2bfcSGreg Roach '<input type="text" name="KEEP_ALIVE_YEARS_BIRTH" value="' . $tree->getPreference('KEEP_ALIVE_YEARS_BIRTH') . '" size="5" maxlength="3">', 113dd6b2bfcSGreg Roach '<input type="text" name="KEEP_ALIVE_YEARS_DEATH" value="' . $tree->getPreference('KEEP_ALIVE_YEARS_DEATH') . '" size="5" maxlength="3">' 114dd6b2bfcSGreg Roach ) ?> 115dd6b2bfcSGreg Roach <p class="small text-muted"> 116dd6b2bfcSGreg Roach <?= /* I18N: Help text for the “Extend privacy to dead individuals” configuration setting */ I18N::translate('In some countries, privacy laws apply not only to living individuals, but also to those who have died recently. This option will allow you to extend the privacy rules for living individuals to those who were born or died within a specified number of years. Leave these values empty to disable this feature.') ?> 117dd6b2bfcSGreg Roach </p> 118dd6b2bfcSGreg Roach </div> 119dd6b2bfcSGreg Roach </div> 120dd6b2bfcSGreg Roach </fieldset> 121dd6b2bfcSGreg Roach 122dd6b2bfcSGreg Roach <!-- SHOW_LIVING_NAMES --> 123dd6b2bfcSGreg Roach <div class="row form-group"> 124dd6b2bfcSGreg Roach <div class="col-form-label col-sm-4"> 125dd6b2bfcSGreg Roach <label for="SHOW_LIVING_NAMES"> 126dd6b2bfcSGreg Roach <?= /* I18N: A configuration setting */ I18N::translate('Show names of private individuals') ?> 127dd6b2bfcSGreg Roach </label> 128dd6b2bfcSGreg Roach <div class="hidden-xs"> 129dd6b2bfcSGreg Roach <span class="badge visitors"><?= I18N::translate('visitors') ?></span> 130dd6b2bfcSGreg Roach <span class="badge members"><?= I18N::translate('members') ?></span> 131dd6b2bfcSGreg Roach <span class="badge managers"><?= I18N::translate('managers') ?></span> 132dd6b2bfcSGreg Roach </div> 133dd6b2bfcSGreg Roach </div> 134dd6b2bfcSGreg Roach <div class="col-sm-8"> 135870365fbSGreg Roach <?= view('components/select', ['name' => 'SHOW_LIVING_NAMES', 'selected' => $tree->getPreference('SHOW_LIVING_NAMES'), 'options' => array_slice(Auth::accessLevelNames(), 0, 3, true)]) ?> 136dd6b2bfcSGreg Roach <p class="small text-muted"> 137dd6b2bfcSGreg Roach <?= /* I18N: Help text for the “Show names of private individuals” configuration setting */ I18N::translate('This option will show the names (but no other details) of private individuals. Individuals are private if they are still alive or if a privacy restriction has been added to their individual record. To hide a specific name, add a privacy restriction to that name record.') ?> 138dd6b2bfcSGreg Roach </p> 139dd6b2bfcSGreg Roach </div> 140dd6b2bfcSGreg Roach </div> 141dd6b2bfcSGreg Roach 142dd6b2bfcSGreg Roach <!-- SHOW_PRIVATE_RELATIONSHIPS --> 143dd6b2bfcSGreg Roach <div class="row form-group"> 144dd6b2bfcSGreg Roach <div class="col-form-label col-sm-4"> 145dd6b2bfcSGreg Roach <label for="SHOW_PRIVATE_RELATIONSHIPS"> 146dd6b2bfcSGreg Roach <?= /* I18N: A configuration setting */ I18N::translate('Show private relationships') ?> 147dd6b2bfcSGreg Roach </label> 148dd6b2bfcSGreg Roach <div class="hidden-xs"> 149dd6b2bfcSGreg Roach <span class="badge visitors"><?= I18N::translate('visitors') ?></span> 150dd6b2bfcSGreg Roach <span class="badge members"><?= I18N::translate('members') ?></span> 151dd6b2bfcSGreg Roach </div> 152dd6b2bfcSGreg Roach </div> 153dd6b2bfcSGreg Roach <div class="col-sm-8"> 154c9e11c2aSGreg Roach <?= view('components/select', ['name' => 'SHOW_PRIVATE_RELATIONSHIPS', 'selected' => $tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS'), 'options' => ['0' => I18N::translate('Hide from everyone'), '1' => I18N::translate('Show to visitors')]]) ?> 155dd6b2bfcSGreg Roach <p class="small text-muted"> 156dd6b2bfcSGreg Roach <?= /* I18N: Help text for the “Show private relationships” configuration setting */ I18N::translate('This option will retain family links in private records. This means that you will see empty “private” boxes on the pedigree chart and on other charts with private individuals.') ?> 157dd6b2bfcSGreg Roach </p> 158dd6b2bfcSGreg Roach </div> 159dd6b2bfcSGreg Roach </div> 160dd6b2bfcSGreg Roach <h2><?= /* I18N: Privacy restrictions are set by RESN tags in GEDCOM. */ I18N::translate('Privacy restrictions') ?></h2> 161dd6b2bfcSGreg Roach <p> 162dd6b2bfcSGreg Roach <?= /* I18N: Privacy restrictions are RESN tags in GEDCOM. */ I18N::translate('You can set the access for a specific record, fact, or event by adding a restriction to it. If a record, fact, or event does not have a restriction, the following default restrictions will be used.') ?> 163dd6b2bfcSGreg Roach </p> 164dd6b2bfcSGreg Roach 165dd6b2bfcSGreg Roach <script id="new-resn-template" type="text/html"> 166dd6b2bfcSGreg Roach <tr> 167dd6b2bfcSGreg Roach <td> 168269403b3SGreg Roach <select class="form-control record-type-selector"> 169ac5ee73fSGreg Roach <option value="all"><?= I18N::translate('All records') ?></option> 170dd6b2bfcSGreg Roach <option value="individual"><?= I18N::translate('Individual') ?></option> 171dd6b2bfcSGreg Roach <option value="family"><?= I18N::translate('Family') ?></option> 172dd6b2bfcSGreg Roach <option value="source"><?= I18N::translate('Source') ?></option> 173dd6b2bfcSGreg Roach <option value="repository"><?= I18N::translate('Repository') ?></option> 174dd6b2bfcSGreg Roach <option value="note"><?= I18N::translate('Note') ?></option> 175dd6b2bfcSGreg Roach <option value="media"><?= I18N::translate('Media object') ?></option> 176dd6b2bfcSGreg Roach </select> 177ac5ee73fSGreg Roach 178ac5ee73fSGreg Roach <div class="select-record select-all"> 179ac5ee73fSGreg Roach <input type="hidden" name="xref[]"> 180ac5ee73fSGreg Roach </div> 181ac5ee73fSGreg Roach 18264b4a654SGreg Roach <div class="select-record select-individual d-none"> 183ac5ee73fSGreg Roach <?= view('components/select-individual', ['name' => 'xref[]', 'id' => '', 'tree' => $tree, 'disabled' => true]) ?> 18464b4a654SGreg Roach </div> 185ac5ee73fSGreg Roach 18664b4a654SGreg Roach <div class="select-record select-family d-none"> 187ac5ee73fSGreg Roach <?= view('components/select-family', ['name' => 'xref[]', 'id' => '', 'tree' => $tree, 'disabled' => true]) ?> 18864b4a654SGreg Roach </div> 189ac5ee73fSGreg Roach 19064b4a654SGreg Roach <div class="select-record select-source d-none"> 191ac5ee73fSGreg Roach <?= view('components/select-source', ['name' => 'xref[]', 'id' => '', 'tree' => $tree, 'disabled' => true]) ?> 19264b4a654SGreg Roach </div> 193ac5ee73fSGreg Roach 19464b4a654SGreg Roach <div class="select-record select-repository d-none"> 195ac5ee73fSGreg Roach <?= view('components/select-repository', ['name' => 'xref[]', 'id' => '', 'tree' => $tree, 'disabled' => true]) ?> 19664b4a654SGreg Roach </div> 197ac5ee73fSGreg Roach 19864b4a654SGreg Roach <div class="select-record select-note d-none"> 199ac5ee73fSGreg Roach <?= view('components/select-note', ['name' => 'xref[]', 'id' => '', 'tree' => $tree, 'disabled' => true]) ?> 20064b4a654SGreg Roach </div> 201ac5ee73fSGreg Roach 20264b4a654SGreg Roach <div class="select-record select-media d-none"> 203ac5ee73fSGreg Roach <?= view('components/select-media', ['name' => 'xref[]', 'id' => '', 'tree' => $tree, 'disabled' => true]) ?> 20464b4a654SGreg Roach </div> 205dd6b2bfcSGreg Roach </td> 206ac5ee73fSGreg Roach 207dd6b2bfcSGreg Roach <td> 208ac5ee73fSGreg Roach <?= view('components/select', ['name' => 'tag_type[]', 'id' => '', 'selected' => '', 'options' => $all_tags]) ?> 209dd6b2bfcSGreg Roach </td> 210ac5ee73fSGreg Roach 211dd6b2bfcSGreg Roach <td> 212ac5ee73fSGreg Roach <?= view('components/select', ['name' => 'resn[]', 'id' => '', 'selected' => 'privacy', 'options' => $privacy_constants]) ?> 213dd6b2bfcSGreg Roach </td> 214ac5ee73fSGreg Roach 215dd6b2bfcSGreg Roach <td> 216dd6b2bfcSGreg Roach </td> 217dd6b2bfcSGreg Roach </tr> 218dd6b2bfcSGreg Roach </script> 219dd6b2bfcSGreg Roach 220dd6b2bfcSGreg Roach <table class="table table-bordered table-sm table-hover" id="default-resn"> 221dd6b2bfcSGreg Roach <caption class="sr-only"> 222dd6b2bfcSGreg Roach <?= I18N::translate('Privacy restrictions - these apply to records and facts that do not contain a GEDCOM RESN tag') ?> 223dd6b2bfcSGreg Roach </caption> 224dd6b2bfcSGreg Roach <thead> 225dd6b2bfcSGreg Roach <tr> 226dd6b2bfcSGreg Roach <th> 227dd6b2bfcSGreg Roach <?= I18N::translate('Record') ?> 228dd6b2bfcSGreg Roach </th> 229dd6b2bfcSGreg Roach <th> 230dd6b2bfcSGreg Roach <?= I18N::translate('Fact or event') ?> 231dd6b2bfcSGreg Roach </th> 232dd6b2bfcSGreg Roach <th> 233dd6b2bfcSGreg Roach <?= I18N::translate('Access level') ?> 234dd6b2bfcSGreg Roach </th> 235dd6b2bfcSGreg Roach <th> 236dd6b2bfcSGreg Roach <button class="btn btn-primary" id="add-resn" type="button"> 237dd6b2bfcSGreg Roach <?= view('icons/add') ?> 238dd6b2bfcSGreg Roach <?= /* I18N: A button label. */ I18N::translate('add') ?> 239dd6b2bfcSGreg Roach </button> 240dd6b2bfcSGreg Roach </th> 241dd6b2bfcSGreg Roach </tr> 242dd6b2bfcSGreg Roach </thead> 243dd6b2bfcSGreg Roach <tbody> 244dd6b2bfcSGreg Roach <?php foreach ($privacy_restrictions as $privacy_restriction) : ?> 245dd6b2bfcSGreg Roach <tr> 246dd6b2bfcSGreg Roach <td> 247dd6b2bfcSGreg Roach <?php if ($privacy_restriction->record) : ?> 24839ca88baSGreg Roach <a href="<?= e($privacy_restriction->record->url()) ?>"><?= $privacy_restriction->record->fullName() ?></a> 249dd6b2bfcSGreg Roach <?php elseif ($privacy_restriction->xref) : ?> 250dd6b2bfcSGreg Roach <div class="text-danger"> 251dd6b2bfcSGreg Roach <?= $privacy_restriction->xref ?> — <?= I18N::translate('This record does not exist.') ?> 252dd6b2bfcSGreg Roach </div> 253dd6b2bfcSGreg Roach <?php else : ?> 254dd6b2bfcSGreg Roach <div class="text-muted"> 255dd6b2bfcSGreg Roach <?= I18N::translate('All records') ?> 256dd6b2bfcSGreg Roach </div> 257dd6b2bfcSGreg Roach <?php endif ?> 258dd6b2bfcSGreg Roach </td> 259dd6b2bfcSGreg Roach <td> 260cd494761SGreg Roach <?php if ($privacy_restriction->tag_label === '') : ?> 261dd6b2bfcSGreg Roach <div class="text-muted"> 262dd6b2bfcSGreg Roach <?= I18N::translate('All facts and events') ?> 263dd6b2bfcSGreg Roach </div> 264cd494761SGreg Roach <?php else : ?> 265cd494761SGreg Roach <?= $privacy_restriction->tag_label ?> 266dd6b2bfcSGreg Roach <?php endif ?> 267dd6b2bfcSGreg Roach </td> 268dd6b2bfcSGreg Roach <td> 269138139c2SGreg Roach <?= Auth::privacyRuleNames()[$privacy_restriction->resn] ?> 270dd6b2bfcSGreg Roach </td> 271dd6b2bfcSGreg Roach <td> 272dd6b2bfcSGreg Roach <label for="delete-<?= $privacy_restriction->default_resn_id ?>"> 273dd6b2bfcSGreg Roach <input id="delete-<?= $privacy_restriction->default_resn_id ?>" name="delete[]" type="checkbox" value="<?= $privacy_restriction->default_resn_id ?>"> 274dd6b2bfcSGreg Roach <?= I18N::translate('Delete') ?> 275dd6b2bfcSGreg Roach </label> 276dd6b2bfcSGreg Roach </td> 277dd6b2bfcSGreg Roach </tr> 278dd6b2bfcSGreg Roach <?php endforeach ?> 279dd6b2bfcSGreg Roach </tbody> 280dd6b2bfcSGreg Roach </table> 281dd6b2bfcSGreg Roach 282dd6b2bfcSGreg Roach <div class="row form-group"> 283dd6b2bfcSGreg Roach <div class="offset-sm-4 col-sm-8"> 284dd6b2bfcSGreg Roach <button type="submit" class="btn btn-primary"> 285dd6b2bfcSGreg Roach <?= view('icons/save') ?> 286dd6b2bfcSGreg Roach <?= I18N::translate('save') ?> 287dd6b2bfcSGreg Roach </button> 2880c0910bfSGreg Roach 289*6fd01894SGreg Roach <a class="btn btn-secondary" href="<?= route(ManageTrees::class, ['tree' => $tree->name()]) ?>"> 290dd6b2bfcSGreg Roach <?= view('icons/cancel') ?> 291dd6b2bfcSGreg Roach <?= I18N::translate('cancel') ?> 292dd6b2bfcSGreg Roach </a> 293dd6b2bfcSGreg Roach <!-- Coming soon 294dd6b2bfcSGreg Roach <div class="form-check"> 295dd6b2bfcSGreg Roach <?php if ($count_trees > 1) : ?> 296dd6b2bfcSGreg Roach <label> 297dd6b2bfcSGreg Roach <input type="checkbox" name="all_trees"> 298dd6b2bfcSGreg Roach <?= /* I18N: Label for checkbox */ I18N::translate('Apply these preferences to all family trees') ?> 299dd6b2bfcSGreg Roach </label> 300dd6b2bfcSGreg Roach <?php endif ?> 301dd6b2bfcSGreg Roach </div> 302dd6b2bfcSGreg Roach <div class="form-check"> 303dd6b2bfcSGreg Roach <label> 304dd6b2bfcSGreg Roach <input type="checkbox" name="new_trees"> 305dd6b2bfcSGreg Roach <?= /* I18N: Label for checkbox */ I18N::translate('Apply these preferences to new family trees') ?> 306dd6b2bfcSGreg Roach </label> 307dd6b2bfcSGreg Roach </div> 308dd6b2bfcSGreg Roach </div> 309dd6b2bfcSGreg Roach --> 310dd6b2bfcSGreg Roach </div> 311dd6b2bfcSGreg Roach 312dd6b2bfcSGreg Roach</form> 313dd6b2bfcSGreg Roach 314dd6b2bfcSGreg Roach<?php View::push('javascript') ?> 315dd6b2bfcSGreg Roach<script> 316269403b3SGreg Roach "use strict"; 317dd6b2bfcSGreg Roach 318dd6b2bfcSGreg Roach /** 319dd6b2bfcSGreg Roach * Hide/show the feedback labels for a privacy option. 320dd6b2bfcSGreg Roach * 321dd6b2bfcSGreg Roach * @param sel the control to change 322dd6b2bfcSGreg Roach * @param who "visitors", "members" or "managers" 323dd6b2bfcSGreg Roach * @param access true or false 324dd6b2bfcSGreg Roach */ 325dd6b2bfcSGreg Roach function setPrivacyFeedback(sel, who, access) { 326269403b3SGreg Roach var formGroup = $(sel).closest(".form-group"); 327dd6b2bfcSGreg Roach 328dd6b2bfcSGreg Roach if (access) { 329269403b3SGreg Roach $("." + who, formGroup).addClass("badge-success").removeClass("badge-secondary"); 330269403b3SGreg Roach $("." + who + " i", formGroup).addClass("fa-check").removeClass("fa-times"); 331dd6b2bfcSGreg Roach } else { 332269403b3SGreg Roach $("." + who, formGroup).addClass("badge-secondary").removeClass("badge-success"); 333269403b3SGreg Roach $("." + who + " i", formGroup).addClass("fa-times").removeClass("fa-check"); 334dd6b2bfcSGreg Roach } 335dd6b2bfcSGreg Roach } 336dd6b2bfcSGreg Roach 337dd6b2bfcSGreg Roach /** 338dd6b2bfcSGreg Roach * Update all the privacy feedback labels. 339dd6b2bfcSGreg Roach */ 340dd6b2bfcSGreg Roach function updatePrivacyFeedback() { 341269403b3SGreg Roach var requireAuthentication = parseInt($("[name=REQUIRE_AUTHENTICATION]").val(), 10); 342269403b3SGreg Roach var showDeadPeople = parseInt($("[name=SHOW_DEAD_PEOPLE]").val(), 10); 343269403b3SGreg Roach var hideLivePeople = parseInt($("[name=HIDE_LIVE_PEOPLE]").val(), 10); 344269403b3SGreg Roach var showLivingNames = parseInt($("[name=SHOW_LIVING_NAMES]").val(), 10); 345269403b3SGreg Roach var showPrivateRelationships = parseInt($("[name=SHOW_PRIVATE_RELATIONSHIPS]").val(), 10); 346dd6b2bfcSGreg Roach 347269403b3SGreg Roach setPrivacyFeedback("[name=REQUIRE_AUTHENTICATION]", "visitors", requireAuthentication === 0); 348269403b3SGreg Roach setPrivacyFeedback("[name=REQUIRE_AUTHENTICATION]", "members", true); 349dd6b2bfcSGreg Roach 350269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_DEAD_PEOPLE]", "visitors", requireAuthentication === 0 && (showDeadPeople >= 2 || hideLivePeople === 0)); 351269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_DEAD_PEOPLE]", "members", showDeadPeople >= 1 || hideLivePeople === 0); 352dd6b2bfcSGreg Roach 353269403b3SGreg Roach setPrivacyFeedback("[name=HIDE_LIVE_PEOPLE]", "visitors", requireAuthentication === 0 && hideLivePeople === 0); 354269403b3SGreg Roach setPrivacyFeedback("[name=HIDE_LIVE_PEOPLE]", "members", true); 355dd6b2bfcSGreg Roach 356269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_LIVING_NAMES]", "visitors", requireAuthentication === 0 && showLivingNames >= 2); 357269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_LIVING_NAMES]", "members", showLivingNames >= 1); 358269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_LIVING_NAMES]", "managers", showLivingNames >= 0); 359dd6b2bfcSGreg Roach 360269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_PRIVATE_RELATIONSHIPS]", "visitors", requireAuthentication === 0 && showPrivateRelationships >= 1); 361269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_PRIVATE_RELATIONSHIPS]", "members", showPrivateRelationships >= 1); 362dd6b2bfcSGreg Roach } 363dd6b2bfcSGreg Roach 364dd6b2bfcSGreg Roach // Activate the privacy feedback labels. 365dd6b2bfcSGreg Roach updatePrivacyFeedback(); 366269403b3SGreg Roach $("[name=REQUIRE_AUTHENTICATION], [name=HIDE_LIVE_PEOPLE], [name=SHOW_DEAD_PEOPLE], [name=SHOW_LIVING_NAMES], [name=SHOW_PRIVATE_RELATIONSHIPS]").on("change", function () { 367dd6b2bfcSGreg Roach updatePrivacyFeedback(); 368dd6b2bfcSGreg Roach }); 369dd6b2bfcSGreg Roach 370dd6b2bfcSGreg Roach // Mute a line when it is marked for deletion 371dd6b2bfcSGreg Roach $("#default-resn").on("click", "input[type=checkbox]", function () { 372dd6b2bfcSGreg Roach if ($(this).prop("checked")) { 373dd6b2bfcSGreg Roach $($(this).closest("tr").addClass("text-muted")); 374dd6b2bfcSGreg Roach } else { 375dd6b2bfcSGreg Roach $($(this).closest("tr").removeClass("text-muted")); 376dd6b2bfcSGreg Roach } 377dd6b2bfcSGreg Roach }); 378dd6b2bfcSGreg Roach 379dd6b2bfcSGreg Roach // Add a new row to the table 380dd6b2bfcSGreg Roach $("#add-resn").on("click", function () { 381dd6b2bfcSGreg Roach $("#default-resn tbody").prepend($("#new-resn-template").html()); 382269403b3SGreg Roach 383269403b3SGreg Roach // Select2 - same as webtrees.js 384ac5ee73fSGreg Roach $("#default-resn tbody tr:first select.select2").select2({ 385ac5ee73fSGreg Roach width: '100%', 386269403b3SGreg Roach escapeMarkup: function (x) { 387269403b3SGreg Roach return x; 388269403b3SGreg Roach }, 389269403b3SGreg Roach }) 390269403b3SGreg Roach .on("select2:unselect", function (evt) { 391269403b3SGreg Roach $(evt.delegateTarget).append("<option value=\"\" selected=\"selected\"></option>"); 392269403b3SGreg Roach }); 393269403b3SGreg Roach 394269403b3SGreg Roach // Record type selector 395269403b3SGreg Roach $(".record-type-selector").change(function () { 396ac5ee73fSGreg Roach const container = $(this).closest("td"); 397ac5ee73fSGreg Roach $(".select-record", container).addClass('d-none'); 398ac5ee73fSGreg Roach $(".select-record select", container).prop( "disabled", true); 399ac5ee73fSGreg Roach $(".select-record input", container).prop( "disabled", true); 400ac5ee73fSGreg Roach $(".select-" + $(this).val(), container).removeClass('d-none'); 401ac5ee73fSGreg Roach $(".select-" + $(this).val() + " select", container).prop( "disabled", false); 402ac5ee73fSGreg Roach $(".select-" + $(this).val() + " input", container).prop( "disabled", false); 403269403b3SGreg Roach }); 404dd6b2bfcSGreg Roach }); 405dd6b2bfcSGreg Roach</script> 406dd6b2bfcSGreg Roach<?php View::endpush() ?> 407