1dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Bootstrap4; ?> 2dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Functions\FunctionsEdit; ?> 3dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\I18N; ?> 4dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Site; ?> 5dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\View; ?> 6dd6b2bfcSGreg Roach 7dd6b2bfcSGreg Roach<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('admin-trees') => I18N::translate('Manage family trees'), $title]]) ?> 8dd6b2bfcSGreg Roach 9dd6b2bfcSGreg Roach<h1><?= $title ?></h1> 10dd6b2bfcSGreg Roach 11dd6b2bfcSGreg Roach<form method="POST"> 12dd6b2bfcSGreg Roach <input type="hidden" name="route" value="tree-privacy"> 13*aa6f03bbSGreg Roach <input type="hidden" name="ged" value="<?= e($tree->name()) ?>"> 14dd6b2bfcSGreg Roach <?= csrf_field() ?> 15dd6b2bfcSGreg Roach 16dd6b2bfcSGreg Roach <!-- REQUIRE_AUTHENTICATION --> 17dd6b2bfcSGreg Roach <div class="row form-group"> 18dd6b2bfcSGreg Roach <div class="col-form-label col-sm-4"> 19dd6b2bfcSGreg Roach <label> 20dd6b2bfcSGreg Roach <?= /* I18N: A configuration setting */ I18N::translate('Show the family tree') ?> 21dd6b2bfcSGreg Roach </label> 22dd6b2bfcSGreg Roach <div class="hidden-xs"> 23dd6b2bfcSGreg Roach <span class="badge visitors"><?= I18N::translate('visitors') ?></span> 24dd6b2bfcSGreg Roach <span class="badge members"><?= I18N::translate('members') ?></span> 25dd6b2bfcSGreg Roach </div> 26dd6b2bfcSGreg Roach </div> 27dd6b2bfcSGreg Roach <div class="col-sm-8"> 28dd6b2bfcSGreg Roach <?= Bootstrap4::select(['0' => I18N::translate('Show to visitors'), '1' => I18N::translate('Show to members')], $tree->getPreference('REQUIRE_AUTHENTICATION'), ['id' => 'REQUIRE_AUTHENTICATION', 'name' => 'REQUIRE_AUTHENTICATION']) ?> 29dd6b2bfcSGreg Roach <p class="small text-muted"> 30dd6b2bfcSGreg 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.') ?> 31dd6b2bfcSGreg Roach </p> 32dd6b2bfcSGreg Roach <?php if (Site::getPreference('USE_REGISTRATION_MODULE') === '1') : ?> 33dd6b2bfcSGreg Roach <p class="small text-muted"> 34dd6b2bfcSGreg Roach <?= I18N::translate('If visitors can not see the family tree, they will not be able to sign up for an account. You will need to add their account manually.') ?> 35dd6b2bfcSGreg Roach </p> 36dd6b2bfcSGreg Roach <?php endif ?> 37dd6b2bfcSGreg Roach </div> 38dd6b2bfcSGreg Roach </div> 39dd6b2bfcSGreg Roach 40dd6b2bfcSGreg Roach <!-- SHOW_DEAD_PEOPLE --> 41dd6b2bfcSGreg Roach <div class="row form-group"> 42dd6b2bfcSGreg Roach <div class="col-form-label col-sm-4"> 43dd6b2bfcSGreg Roach <label for="SHOW_DEAD_PEOPLE"> 44dd6b2bfcSGreg Roach <?= /* I18N: A configuration setting */ I18N::translate('Show dead individuals') ?> 45dd6b2bfcSGreg Roach </label> 46dd6b2bfcSGreg Roach <div class="hidden-xs"> 47dd6b2bfcSGreg Roach <span class="badge visitors"><?= I18N::translate('visitors') ?></span> 48dd6b2bfcSGreg Roach <span class="badge members"><?= I18N::translate('members') ?></span> 49dd6b2bfcSGreg Roach </div> 50dd6b2bfcSGreg Roach </div> 51dd6b2bfcSGreg Roach <div class="col-sm-8"> 52dd6b2bfcSGreg Roach <?= Bootstrap4::select(array_slice(FunctionsEdit::optionsAccessLevels(), 0, 2, true), $tree->getPreference('SHOW_DEAD_PEOPLE'), ['id' => 'SHOW_DEAD_PEOPLE', 'name' => 'SHOW_DEAD_PEOPLE']) ?> 53dd6b2bfcSGreg Roach <p class="small text-muted"> 54dd6b2bfcSGreg Roach <?= /* I18N: Help text for the “Show dead individuals” configuration setting */ I18N::translate('Set the privacy access level for all dead individuals.') ?> 55dd6b2bfcSGreg Roach </p> 56dd6b2bfcSGreg Roach </div> 57dd6b2bfcSGreg Roach </div> 58dd6b2bfcSGreg Roach 59dd6b2bfcSGreg Roach 60dd6b2bfcSGreg Roach <!-- MAX_ALIVE_AGE --> 61dd6b2bfcSGreg Roach <div class="row form-group"> 62dd6b2bfcSGreg Roach <label class="col-form-label col-sm-4" for="MAX_ALIVE_AGE"> 63dd6b2bfcSGreg Roach <?= I18N::translate('Age at which to assume an individual is dead') ?> 64dd6b2bfcSGreg Roach </label> 65dd6b2bfcSGreg Roach <div class="col-sm-8"> 66dd6b2bfcSGreg Roach <input 67dd6b2bfcSGreg Roach class="form-control" 68dd6b2bfcSGreg Roach id="MAX_ALIVE_AGE" 69dd6b2bfcSGreg Roach maxlength="5" 70dd6b2bfcSGreg Roach name="MAX_ALIVE_AGE" 71dd6b2bfcSGreg Roach type="text" 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"> 93dd6b2bfcSGreg Roach <?= Bootstrap4::select(['0' => I18N::translate('Show to visitors'), '1' => I18N::translate('Show to members')], $tree->getPreference('HIDE_LIVE_PEOPLE'), ['id' => 'HIDE_LIVE_PEOPLE', 'name' => 'HIDE_LIVE_PEOPLE']) ?> 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"> 135dd6b2bfcSGreg Roach <?= Bootstrap4::select(array_slice(FunctionsEdit::optionsAccessLevels(), 0, 3, true), $tree->getPreference('SHOW_LIVING_NAMES'), ['id' => 'SHOW_LIVING_NAMES', 'name' => 'SHOW_LIVING_NAMES']) ?> 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"> 154dd6b2bfcSGreg Roach <?= Bootstrap4::select(['0' => I18N::translate('Hide from everyone'), '1' => I18N::translate('Show to visitors')], $tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS'), ['id' => 'SHOW_PRIVATE_RELATIONSHIPS', 'name' => 'SHOW_PRIVATE_RELATIONSHIPS']) ?> 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> 168dd6b2bfcSGreg Roach <select class="form-control" id="record-type"> 169dd6b2bfcSGreg Roach <option value="individual"><?= I18N::translate('Individual') ?></option> 170dd6b2bfcSGreg Roach <option value="family"><?= I18N::translate('Family') ?></option> 171dd6b2bfcSGreg Roach <option value="source"><?= I18N::translate('Source') ?></option> 172dd6b2bfcSGreg Roach <option value="repository"><?= I18N::translate('Repository') ?></option> 173dd6b2bfcSGreg Roach <option value="note"><?= I18N::translate('Note') ?></option> 174dd6b2bfcSGreg Roach <option value="media"><?= I18N::translate('Media object') ?></option> 175dd6b2bfcSGreg Roach </select> 176dd6b2bfcSGreg Roach <span class="select-record select-individual"> 177dd6b2bfcSGreg Roach <?= FunctionsEdit::formControlIndividual($tree, null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;']) ?> 178dd6b2bfcSGreg Roach </span> 179dd6b2bfcSGreg Roach <span class="select-record select-family d-none"> 180dd6b2bfcSGreg Roach <?= FunctionsEdit::formControlFamily($tree, null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?> 181dd6b2bfcSGreg Roach </span> 182dd6b2bfcSGreg Roach <span class="select-record select-source d-none"> 183dd6b2bfcSGreg Roach <?= FunctionsEdit::formControlSource($tree, null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?> 184dd6b2bfcSGreg Roach </span> 185dd6b2bfcSGreg Roach <span class="select-record select-repository d-none"> 186dd6b2bfcSGreg Roach <?= FunctionsEdit::formControlRepository($tree, null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?> 187dd6b2bfcSGreg Roach </span> 188dd6b2bfcSGreg Roach <span class="select-record select-note d-none"> 189dd6b2bfcSGreg Roach <?= FunctionsEdit::formControlNote($tree, null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?> 190dd6b2bfcSGreg Roach </span> 191dd6b2bfcSGreg Roach <span class="select-record select-media d-none"> 192dd6b2bfcSGreg Roach <?= FunctionsEdit::formControlMediaObject($tree, null, ['name' => 'xref', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?> 193dd6b2bfcSGreg Roach </span> 194dd6b2bfcSGreg Roach <input data-autocomplete-type="IFSRO" id="xref" maxlength="20" name="xref[]" type="text"> 195dd6b2bfcSGreg Roach </td> 196dd6b2bfcSGreg Roach <td> 197dd6b2bfcSGreg Roach <?= Bootstrap4::select($all_tags, '', ['name' => 'tag_type[]']) ?> 198dd6b2bfcSGreg Roach </td> 199dd6b2bfcSGreg Roach <td> 200dd6b2bfcSGreg Roach <?= Bootstrap4::select($privacy_constants, 'privacy', ['name' => 'resn[]']) ?> 201dd6b2bfcSGreg Roach </td> 202dd6b2bfcSGreg Roach <td> 203dd6b2bfcSGreg Roach </td> 204dd6b2bfcSGreg Roach </tr> 205dd6b2bfcSGreg Roach </script> 206dd6b2bfcSGreg Roach 207dd6b2bfcSGreg Roach <table class="table table-bordered table-sm table-hover" id="default-resn"> 208dd6b2bfcSGreg Roach <caption class="sr-only"> 209dd6b2bfcSGreg Roach <?= I18N::translate('Privacy restrictions - these apply to records and facts that do not contain a GEDCOM RESN tag') ?> 210dd6b2bfcSGreg Roach </caption> 211dd6b2bfcSGreg Roach <thead> 212dd6b2bfcSGreg Roach <tr> 213dd6b2bfcSGreg Roach <th> 214dd6b2bfcSGreg Roach <?= I18N::translate('Record') ?> 215dd6b2bfcSGreg Roach </th> 216dd6b2bfcSGreg Roach <th> 217dd6b2bfcSGreg Roach <?= I18N::translate('Fact or event') ?> 218dd6b2bfcSGreg Roach </th> 219dd6b2bfcSGreg Roach <th> 220dd6b2bfcSGreg Roach <?= I18N::translate('Access level') ?> 221dd6b2bfcSGreg Roach </th> 222dd6b2bfcSGreg Roach <th> 223dd6b2bfcSGreg Roach <button class="btn btn-primary" id="add-resn" type="button"> 224dd6b2bfcSGreg Roach <?= view('icons/add') ?> 225dd6b2bfcSGreg Roach <?= /* I18N: A button label. */ I18N::translate('add') ?> 226dd6b2bfcSGreg Roach </button> 227dd6b2bfcSGreg Roach </th> 228dd6b2bfcSGreg Roach </tr> 229dd6b2bfcSGreg Roach </thead> 230dd6b2bfcSGreg Roach <tbody> 231dd6b2bfcSGreg Roach <?php foreach ($privacy_restrictions as $privacy_restriction) : ?> 232dd6b2bfcSGreg Roach <tr> 233dd6b2bfcSGreg Roach <td> 234dd6b2bfcSGreg Roach <?php if ($privacy_restriction->record) : ?> 235dd6b2bfcSGreg Roach <a href="<?= e($privacy_restriction->record->url()) ?>"><?= $privacy_restriction->record->getFullName() ?></a> 236dd6b2bfcSGreg Roach <?php elseif ($privacy_restriction->xref) : ?> 237dd6b2bfcSGreg Roach <div class="text-danger"> 238dd6b2bfcSGreg Roach <?= $privacy_restriction->xref ?> — <?= I18N::translate('This record does not exist.') ?> 239dd6b2bfcSGreg Roach </div> 240dd6b2bfcSGreg Roach <?php else : ?> 241dd6b2bfcSGreg Roach <div class="text-muted"> 242dd6b2bfcSGreg Roach <?= I18N::translate('All records') ?> 243dd6b2bfcSGreg Roach </div> 244dd6b2bfcSGreg Roach <?php endif ?> 245dd6b2bfcSGreg Roach </td> 246dd6b2bfcSGreg Roach <td> 247cd494761SGreg Roach <?php if ($privacy_restriction->tag_label === '') : ?> 248dd6b2bfcSGreg Roach <div class="text-muted"> 249dd6b2bfcSGreg Roach <?= I18N::translate('All facts and events') ?> 250dd6b2bfcSGreg Roach </div> 251cd494761SGreg Roach <?php else : ?> 252cd494761SGreg Roach <?= $privacy_restriction->tag_label ?> 253dd6b2bfcSGreg Roach <?php endif ?> 254dd6b2bfcSGreg Roach </td> 255dd6b2bfcSGreg Roach <td> 256dd6b2bfcSGreg Roach <?= FunctionsEdit::optionsRestrictions(false)[$privacy_restriction->resn] ?> 257dd6b2bfcSGreg Roach </td> 258dd6b2bfcSGreg Roach <td> 259dd6b2bfcSGreg Roach <label for="delete-<?= $privacy_restriction->default_resn_id ?>"> 260dd6b2bfcSGreg Roach <input id="delete-<?= $privacy_restriction->default_resn_id ?>" name="delete[]" type="checkbox" value="<?= $privacy_restriction->default_resn_id ?>"> 261dd6b2bfcSGreg Roach <?= I18N::translate('Delete') ?> 262dd6b2bfcSGreg Roach </label> 263dd6b2bfcSGreg Roach </td> 264dd6b2bfcSGreg Roach </tr> 265dd6b2bfcSGreg Roach <?php endforeach ?> 266dd6b2bfcSGreg Roach </tbody> 267dd6b2bfcSGreg Roach </table> 268dd6b2bfcSGreg Roach 269dd6b2bfcSGreg Roach <div class="row form-group"> 270dd6b2bfcSGreg Roach <div class="offset-sm-4 col-sm-8"> 271dd6b2bfcSGreg Roach <button type="submit" class="btn btn-primary"> 272dd6b2bfcSGreg Roach <?= view('icons/save') ?> 273dd6b2bfcSGreg Roach <?= I18N::translate('save') ?> 274dd6b2bfcSGreg Roach </button> 275*aa6f03bbSGreg Roach <a class="btn btn-secondary" href="<?= route('admin-trees', ['ged' => $tree->name()]) ?>"> 276dd6b2bfcSGreg Roach <?= view('icons/cancel') ?> 277dd6b2bfcSGreg Roach <?= I18N::translate('cancel') ?> 278dd6b2bfcSGreg Roach </a> 279dd6b2bfcSGreg Roach <!-- Coming soon 280dd6b2bfcSGreg Roach <div class="form-check"> 281dd6b2bfcSGreg Roach <?php if ($count_trees > 1) : ?> 282dd6b2bfcSGreg Roach <label> 283dd6b2bfcSGreg Roach <input type="checkbox" name="all_trees"> 284dd6b2bfcSGreg Roach <?= /* I18N: Label for checkbox */ I18N::translate('Apply these preferences to all family trees') ?> 285dd6b2bfcSGreg Roach </label> 286dd6b2bfcSGreg Roach <?php endif ?> 287dd6b2bfcSGreg Roach </div> 288dd6b2bfcSGreg Roach <div class="form-check"> 289dd6b2bfcSGreg Roach <label> 290dd6b2bfcSGreg Roach <input type="checkbox" name="new_trees"> 291dd6b2bfcSGreg Roach <?= /* I18N: Label for checkbox */ I18N::translate('Apply these preferences to new family trees') ?> 292dd6b2bfcSGreg Roach </label> 293dd6b2bfcSGreg Roach </div> 294dd6b2bfcSGreg Roach </div> 295dd6b2bfcSGreg Roach --> 296dd6b2bfcSGreg Roach </div> 297dd6b2bfcSGreg Roach 298dd6b2bfcSGreg Roach</form> 299dd6b2bfcSGreg Roach 300dd6b2bfcSGreg Roach<?php View::push('javascript') ?> 301dd6b2bfcSGreg Roach<script> 302dd6b2bfcSGreg Roach 'use strict'; 303dd6b2bfcSGreg Roach 304dd6b2bfcSGreg Roach /** 305dd6b2bfcSGreg Roach * Hide/show the feedback labels for a privacy option. 306dd6b2bfcSGreg Roach * 307dd6b2bfcSGreg Roach * @param sel the control to change 308dd6b2bfcSGreg Roach * @param who "visitors", "members" or "managers" 309dd6b2bfcSGreg Roach * @param access true or false 310dd6b2bfcSGreg Roach */ 311dd6b2bfcSGreg Roach function setPrivacyFeedback (sel, who, access) { 312dd6b2bfcSGreg Roach var formGroup = $(sel).closest('.form-group'); 313dd6b2bfcSGreg Roach 314dd6b2bfcSGreg Roach if (access) { 315dd6b2bfcSGreg Roach $('.' + who, formGroup).addClass('badge-success').removeClass('badge-secondary'); 316dd6b2bfcSGreg Roach $('.' + who + ' i', formGroup).addClass('fa-check').removeClass('fa-times'); 317dd6b2bfcSGreg Roach } else { 318dd6b2bfcSGreg Roach $('.' + who, formGroup).addClass('badge-secondary').removeClass('badge-success'); 319dd6b2bfcSGreg Roach $('.' + who + ' i', formGroup).addClass('fa-times').removeClass('fa-check'); 320dd6b2bfcSGreg Roach } 321dd6b2bfcSGreg Roach } 322dd6b2bfcSGreg Roach 323dd6b2bfcSGreg Roach /** 324dd6b2bfcSGreg Roach * Update all the privacy feedback labels. 325dd6b2bfcSGreg Roach */ 326dd6b2bfcSGreg Roach function updatePrivacyFeedback () { 327dd6b2bfcSGreg Roach var requireAuthentication = parseInt($('[name=REQUIRE_AUTHENTICATION]').val(), 10); 328dd6b2bfcSGreg Roach var showDeadPeople = parseInt($('[name=SHOW_DEAD_PEOPLE]').val(), 10); 329dd6b2bfcSGreg Roach var hideLivePeople = parseInt($('[name=HIDE_LIVE_PEOPLE]').val(), 10); 330dd6b2bfcSGreg Roach var showLivingNames = parseInt($('[name=SHOW_LIVING_NAMES]').val(), 10); 331dd6b2bfcSGreg Roach var showPrivateRelationships = parseInt($('[name=SHOW_PRIVATE_RELATIONSHIPS]').val(), 10); 332dd6b2bfcSGreg Roach 333dd6b2bfcSGreg Roach setPrivacyFeedback('[name=REQUIRE_AUTHENTICATION]', 'visitors', requireAuthentication === 0); 334dd6b2bfcSGreg Roach setPrivacyFeedback('[name=REQUIRE_AUTHENTICATION]', 'members', true); 335dd6b2bfcSGreg Roach 336dd6b2bfcSGreg Roach setPrivacyFeedback('[name=SHOW_DEAD_PEOPLE]', 'visitors', requireAuthentication === 0 && (showDeadPeople >= 2 || hideLivePeople === 0)); 337dd6b2bfcSGreg Roach setPrivacyFeedback('[name=SHOW_DEAD_PEOPLE]', 'members', showDeadPeople >= 1 || hideLivePeople === 0); 338dd6b2bfcSGreg Roach 339dd6b2bfcSGreg Roach setPrivacyFeedback('[name=HIDE_LIVE_PEOPLE]', 'visitors', requireAuthentication === 0 && hideLivePeople === 0); 340dd6b2bfcSGreg Roach setPrivacyFeedback('[name=HIDE_LIVE_PEOPLE]', 'members', true); 341dd6b2bfcSGreg Roach 342dd6b2bfcSGreg Roach setPrivacyFeedback('[name=SHOW_LIVING_NAMES]', 'visitors', requireAuthentication === 0 && showLivingNames >= 2); 343dd6b2bfcSGreg Roach setPrivacyFeedback('[name=SHOW_LIVING_NAMES]', 'members', showLivingNames >= 1); 344dd6b2bfcSGreg Roach setPrivacyFeedback('[name=SHOW_LIVING_NAMES]', 'managers', showLivingNames >= 0); 345dd6b2bfcSGreg Roach 346dd6b2bfcSGreg Roach setPrivacyFeedback('[name=SHOW_PRIVATE_RELATIONSHIPS]', 'visitors', requireAuthentication === 0 && showPrivateRelationships >= 1); 347dd6b2bfcSGreg Roach setPrivacyFeedback('[name=SHOW_PRIVATE_RELATIONSHIPS]', 'members', showPrivateRelationships >= 1); 348dd6b2bfcSGreg Roach } 349dd6b2bfcSGreg Roach 350dd6b2bfcSGreg Roach // Activate the privacy feedback labels. 351dd6b2bfcSGreg Roach updatePrivacyFeedback(); 352dd6b2bfcSGreg Roach $('[name=REQUIRE_AUTHENTICATION], [name=HIDE_LIVE_PEOPLE], [name=SHOW_DEAD_PEOPLE], [name=SHOW_LIVING_NAMES], [name=SHOW_PRIVATE_RELATIONSHIPS]').on('change', function () { 353dd6b2bfcSGreg Roach updatePrivacyFeedback(); 354dd6b2bfcSGreg Roach }); 355dd6b2bfcSGreg Roach 356dd6b2bfcSGreg Roach // Mute a line when it is marked for deletion 357dd6b2bfcSGreg Roach $("#default-resn").on("click", "input[type=checkbox]", function() { 358dd6b2bfcSGreg Roach if ($(this).prop("checked")) { 359dd6b2bfcSGreg Roach $($(this).closest("tr").addClass("text-muted")); 360dd6b2bfcSGreg Roach } else { 361dd6b2bfcSGreg Roach $($(this).closest("tr").removeClass("text-muted")); 362dd6b2bfcSGreg Roach } 363dd6b2bfcSGreg Roach }); 364dd6b2bfcSGreg Roach 365dd6b2bfcSGreg Roach // Add a new row to the table 366dd6b2bfcSGreg Roach $("#add-resn").on("click", function() { 367dd6b2bfcSGreg Roach $("#default-resn tbody").prepend($("#new-resn-template").html()); 368dd6b2bfcSGreg Roach }); 369dd6b2bfcSGreg Roach</script> 370dd6b2bfcSGreg Roach<?php View::endpush() ?> 371