1b6c326d8SGreg Roach<?php 2b6c326d8SGreg Roach 3269403b3SGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsEdit; 40c0910bfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; 5269403b3SGreg Roachuse Fisharebest\Webtrees\I18N; 6269403b3SGreg Roachuse Fisharebest\Webtrees\Site; 7b6c326d8SGreg Roachuse Fisharebest\Webtrees\View; 8b6c326d8SGreg Roachuse Ramsey\Uuid\Uuid; 9b6c326d8SGreg Roach 10b6c326d8SGreg Roach?> 11dd6b2bfcSGreg Roach 12*5fb051e9SGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route('manage-trees', ['tree' => $tree->name()]) => I18N::translate('Manage family trees'), $title]]) ?> 13dd6b2bfcSGreg Roach 14dd6b2bfcSGreg Roach<h1><?= $title ?></h1> 15dd6b2bfcSGreg Roach 160c0910bfSGreg Roach<form method="post" action="<?= e(route('tree-privacy-update', ['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 <?php if (Site::getPreference('USE_REGISTRATION_MODULE') === '1') : ?> 36dd6b2bfcSGreg Roach <p class="small text-muted"> 37dd6b2bfcSGreg 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.') ?> 38dd6b2bfcSGreg Roach </p> 39dd6b2bfcSGreg Roach <?php endif ?> 40dd6b2bfcSGreg Roach </div> 41dd6b2bfcSGreg Roach </div> 42dd6b2bfcSGreg Roach 43dd6b2bfcSGreg Roach <!-- SHOW_DEAD_PEOPLE --> 44dd6b2bfcSGreg Roach <div class="row form-group"> 45dd6b2bfcSGreg Roach <div class="col-form-label col-sm-4"> 46dd6b2bfcSGreg Roach <label for="SHOW_DEAD_PEOPLE"> 47dd6b2bfcSGreg Roach <?= /* I18N: A configuration setting */ I18N::translate('Show dead individuals') ?> 48dd6b2bfcSGreg Roach </label> 49dd6b2bfcSGreg Roach <div class="hidden-xs"> 50dd6b2bfcSGreg Roach <span class="badge visitors"><?= I18N::translate('visitors') ?></span> 51dd6b2bfcSGreg Roach <span class="badge members"><?= I18N::translate('members') ?></span> 52dd6b2bfcSGreg Roach </div> 53dd6b2bfcSGreg Roach </div> 54dd6b2bfcSGreg Roach <div class="col-sm-8"> 55c9e11c2aSGreg Roach <?= view('components/select', ['name' => 'SHOW_DEAD_PEOPLE', 'selected' => $tree->getPreference('SHOW_DEAD_PEOPLE'), 'options' => array_slice(FunctionsEdit::optionsAccessLevels(), 0, 2, true)]) ?> 56dd6b2bfcSGreg Roach <p class="small text-muted"> 57dd6b2bfcSGreg Roach <?= /* I18N: Help text for the “Show dead individuals” configuration setting */ I18N::translate('Set the privacy access level for all dead individuals.') ?> 58dd6b2bfcSGreg Roach </p> 59dd6b2bfcSGreg Roach </div> 60dd6b2bfcSGreg Roach </div> 61dd6b2bfcSGreg Roach 62dd6b2bfcSGreg Roach 63dd6b2bfcSGreg Roach <!-- MAX_ALIVE_AGE --> 64dd6b2bfcSGreg Roach <div class="row form-group"> 65dd6b2bfcSGreg Roach <label class="col-form-label col-sm-4" for="MAX_ALIVE_AGE"> 66dd6b2bfcSGreg Roach <?= I18N::translate('Age at which to assume an individual is dead') ?> 67dd6b2bfcSGreg Roach </label> 68dd6b2bfcSGreg Roach <div class="col-sm-8"> 69dd6b2bfcSGreg Roach <input 70dd6b2bfcSGreg Roach class="form-control" 71dd6b2bfcSGreg Roach id="MAX_ALIVE_AGE" 72dd6b2bfcSGreg Roach maxlength="5" 73dd6b2bfcSGreg Roach name="MAX_ALIVE_AGE" 74dd6b2bfcSGreg Roach type="text" 75dd6b2bfcSGreg Roach value="<?= e($tree->getPreference('MAX_ALIVE_AGE')) ?>" 76dd6b2bfcSGreg Roach > 77dd6b2bfcSGreg Roach <p class="small text-muted"> 78dd6b2bfcSGreg 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.') ?> 79dd6b2bfcSGreg Roach </p> 80dd6b2bfcSGreg Roach </div> 81dd6b2bfcSGreg Roach </div> 82dd6b2bfcSGreg Roach 83dd6b2bfcSGreg Roach <!-- HIDE_LIVE_PEOPLE --> 84dd6b2bfcSGreg Roach <fieldset class="form-group"> 85dd6b2bfcSGreg Roach <div class="row"> 86dd6b2bfcSGreg Roach <div class="col-sm-4"> 87dd6b2bfcSGreg Roach <legend class="col-form-label"> 88dd6b2bfcSGreg Roach <?= /* I18N: A configuration setting */ I18N::translate('Show living individuals') ?> 89dd6b2bfcSGreg Roach <div class="hidden-xs"> 90dd6b2bfcSGreg Roach <span class="badge visitors"><?= I18N::translate('visitors') ?></span> 91dd6b2bfcSGreg Roach <span class="badge members"><?= I18N::translate('members') ?></span> 92dd6b2bfcSGreg Roach </div> 93dd6b2bfcSGreg Roach </legend> 94dd6b2bfcSGreg Roach </div> 95dd6b2bfcSGreg Roach <div class="col-sm-8"> 96c9e11c2aSGreg 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')]]) ?> 97dd6b2bfcSGreg Roach <p class="small text-muted"> 98dd6b2bfcSGreg 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.') ?> 99dd6b2bfcSGreg Roach </p> 100dd6b2bfcSGreg Roach </div> 101dd6b2bfcSGreg Roach </div> 102dd6b2bfcSGreg Roach </fieldset> 103dd6b2bfcSGreg Roach 104dd6b2bfcSGreg Roach <!-- KEEP_ALIVE_YEARS_BIRTH / KEEP_ALIVE_YEARS_DEATH --> 105dd6b2bfcSGreg Roach <fieldset class="form-group"> 106dd6b2bfcSGreg Roach <div class="row"> 107dd6b2bfcSGreg Roach <legend class="col-form-label col-sm-4"> 108dd6b2bfcSGreg 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') ?> 109dd6b2bfcSGreg Roach </legend> 110dd6b2bfcSGreg Roach <div class="col-sm-8"> 111dd6b2bfcSGreg Roach <?php 112dd6b2bfcSGreg Roach echo 113dd6b2bfcSGreg Roach /* I18N: Extend privacy to dead individuals who were… */ I18N::translate( 114dd6b2bfcSGreg Roach 'born in the last %1$s years or died in the last %2$s years', 115dd6b2bfcSGreg Roach '<input type="text" name="KEEP_ALIVE_YEARS_BIRTH" value="' . $tree->getPreference('KEEP_ALIVE_YEARS_BIRTH') . '" size="5" maxlength="3">', 116dd6b2bfcSGreg Roach '<input type="text" name="KEEP_ALIVE_YEARS_DEATH" value="' . $tree->getPreference('KEEP_ALIVE_YEARS_DEATH') . '" size="5" maxlength="3">' 117dd6b2bfcSGreg Roach ) ?> 118dd6b2bfcSGreg Roach <p class="small text-muted"> 119dd6b2bfcSGreg 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.') ?> 120dd6b2bfcSGreg Roach </p> 121dd6b2bfcSGreg Roach </div> 122dd6b2bfcSGreg Roach </div> 123dd6b2bfcSGreg Roach </fieldset> 124dd6b2bfcSGreg Roach 125dd6b2bfcSGreg Roach <!-- SHOW_LIVING_NAMES --> 126dd6b2bfcSGreg Roach <div class="row form-group"> 127dd6b2bfcSGreg Roach <div class="col-form-label col-sm-4"> 128dd6b2bfcSGreg Roach <label for="SHOW_LIVING_NAMES"> 129dd6b2bfcSGreg Roach <?= /* I18N: A configuration setting */ I18N::translate('Show names of private individuals') ?> 130dd6b2bfcSGreg Roach </label> 131dd6b2bfcSGreg Roach <div class="hidden-xs"> 132dd6b2bfcSGreg Roach <span class="badge visitors"><?= I18N::translate('visitors') ?></span> 133dd6b2bfcSGreg Roach <span class="badge members"><?= I18N::translate('members') ?></span> 134dd6b2bfcSGreg Roach <span class="badge managers"><?= I18N::translate('managers') ?></span> 135dd6b2bfcSGreg Roach </div> 136dd6b2bfcSGreg Roach </div> 137dd6b2bfcSGreg Roach <div class="col-sm-8"> 138c9e11c2aSGreg Roach <?= view('components/select', ['name' => 'SHOW_LIVING_NAMES', 'selected' => $tree->getPreference('SHOW_LIVING_NAMES'), 'options' => array_slice(FunctionsEdit::optionsAccessLevels(), 0, 3, true)]) ?> 139dd6b2bfcSGreg Roach <p class="small text-muted"> 140dd6b2bfcSGreg 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.') ?> 141dd6b2bfcSGreg Roach </p> 142dd6b2bfcSGreg Roach </div> 143dd6b2bfcSGreg Roach </div> 144dd6b2bfcSGreg Roach 145dd6b2bfcSGreg Roach <!-- SHOW_PRIVATE_RELATIONSHIPS --> 146dd6b2bfcSGreg Roach <div class="row form-group"> 147dd6b2bfcSGreg Roach <div class="col-form-label col-sm-4"> 148dd6b2bfcSGreg Roach <label for="SHOW_PRIVATE_RELATIONSHIPS"> 149dd6b2bfcSGreg Roach <?= /* I18N: A configuration setting */ I18N::translate('Show private relationships') ?> 150dd6b2bfcSGreg Roach </label> 151dd6b2bfcSGreg Roach <div class="hidden-xs"> 152dd6b2bfcSGreg Roach <span class="badge visitors"><?= I18N::translate('visitors') ?></span> 153dd6b2bfcSGreg Roach <span class="badge members"><?= I18N::translate('members') ?></span> 154dd6b2bfcSGreg Roach </div> 155dd6b2bfcSGreg Roach </div> 156dd6b2bfcSGreg Roach <div class="col-sm-8"> 157c9e11c2aSGreg 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')]]) ?> 158dd6b2bfcSGreg Roach <p class="small text-muted"> 159dd6b2bfcSGreg 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.') ?> 160dd6b2bfcSGreg Roach </p> 161dd6b2bfcSGreg Roach </div> 162dd6b2bfcSGreg Roach </div> 163dd6b2bfcSGreg Roach <h2><?= /* I18N: Privacy restrictions are set by RESN tags in GEDCOM. */ I18N::translate('Privacy restrictions') ?></h2> 164dd6b2bfcSGreg Roach <p> 165dd6b2bfcSGreg 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.') ?> 166dd6b2bfcSGreg Roach </p> 167dd6b2bfcSGreg Roach 168dd6b2bfcSGreg Roach <script id="new-resn-template" type="text/html"> 169dd6b2bfcSGreg Roach <tr> 170dd6b2bfcSGreg Roach <td> 171269403b3SGreg Roach <select class="form-control record-type-selector"> 172dd6b2bfcSGreg Roach <option value="individual"><?= I18N::translate('Individual') ?></option> 173dd6b2bfcSGreg Roach <option value="family"><?= I18N::translate('Family') ?></option> 174dd6b2bfcSGreg Roach <option value="source"><?= I18N::translate('Source') ?></option> 175dd6b2bfcSGreg Roach <option value="repository"><?= I18N::translate('Repository') ?></option> 176dd6b2bfcSGreg Roach <option value="note"><?= I18N::translate('Note') ?></option> 177dd6b2bfcSGreg Roach <option value="media"><?= I18N::translate('Media object') ?></option> 178dd6b2bfcSGreg Roach </select> 179dd6b2bfcSGreg Roach <span class="select-record select-individual"> 180b6c326d8SGreg Roach <?= view('components/select-individual', ['name' => 'xref[]', 'id' => Uuid::uuid4()->toString(), 'tree' => $tree]) ?> 181dd6b2bfcSGreg Roach </span> 182dd6b2bfcSGreg Roach <span class="select-record select-family d-none"> 183b6c326d8SGreg Roach <?= view('components/select-family', ['name' => 'xref[]', 'id' => Uuid::uuid4()->toString(), 'tree' => $tree, 'disabled' => true]) ?> 184dd6b2bfcSGreg Roach </span> 185dd6b2bfcSGreg Roach <span class="select-record select-source d-none"> 186b6c326d8SGreg Roach <?= view('components/select-source', ['name' => 'xref[]', 'id' => Uuid::uuid4()->toString(), 'tree' => $tree, 'disabled' => true]) ?> 187dd6b2bfcSGreg Roach </span> 188dd6b2bfcSGreg Roach <span class="select-record select-repository d-none"> 189b6c326d8SGreg Roach <?= view('components/select-repository', ['name' => 'xref[]', 'id' => Uuid::uuid4()->toString(), 'tree' => $tree, 'disabled' => true]) ?> 190dd6b2bfcSGreg Roach </span> 191dd6b2bfcSGreg Roach <span class="select-record select-note d-none"> 192b6c326d8SGreg Roach <?= view('components/select-note', ['name' => 'xref[]', 'id' => Uuid::uuid4()->toString(), 'tree' => $tree, 'disabled' => true]) ?> 193dd6b2bfcSGreg Roach </span> 194dd6b2bfcSGreg Roach <span class="select-record select-media d-none"> 195b6c326d8SGreg Roach <?= view('components/select-media', ['name' => 'xref[]', 'id' => Uuid::uuid4()->toString(), 'tree' => $tree, 'disabled' => true]) ?> 196dd6b2bfcSGreg Roach </span> 197dd6b2bfcSGreg Roach </td> 198dd6b2bfcSGreg Roach <td> 199c9e11c2aSGreg Roach <?= view('components/select', ['name' => 'tag_type[]', 'id' => Uuid::uuid4()->toString(), 'selected' => '', 'options' => $all_tags]) ?> 200dd6b2bfcSGreg Roach </td> 201dd6b2bfcSGreg Roach <td> 202c9e11c2aSGreg Roach <?= view('components/select', ['name' => 'resn[]', 'id' => Uuid::uuid4()->toString(), 'selected' => 'privacy', 'options' => $privacy_constants]) ?> 203dd6b2bfcSGreg Roach </td> 204dd6b2bfcSGreg Roach <td> 205dd6b2bfcSGreg Roach </td> 206dd6b2bfcSGreg Roach </tr> 207dd6b2bfcSGreg Roach </script> 208dd6b2bfcSGreg Roach 209dd6b2bfcSGreg Roach <table class="table table-bordered table-sm table-hover" id="default-resn"> 210dd6b2bfcSGreg Roach <caption class="sr-only"> 211dd6b2bfcSGreg Roach <?= I18N::translate('Privacy restrictions - these apply to records and facts that do not contain a GEDCOM RESN tag') ?> 212dd6b2bfcSGreg Roach </caption> 213dd6b2bfcSGreg Roach <thead> 214dd6b2bfcSGreg Roach <tr> 215dd6b2bfcSGreg Roach <th> 216dd6b2bfcSGreg Roach <?= I18N::translate('Record') ?> 217dd6b2bfcSGreg Roach </th> 218dd6b2bfcSGreg Roach <th> 219dd6b2bfcSGreg Roach <?= I18N::translate('Fact or event') ?> 220dd6b2bfcSGreg Roach </th> 221dd6b2bfcSGreg Roach <th> 222dd6b2bfcSGreg Roach <?= I18N::translate('Access level') ?> 223dd6b2bfcSGreg Roach </th> 224dd6b2bfcSGreg Roach <th> 225dd6b2bfcSGreg Roach <button class="btn btn-primary" id="add-resn" type="button"> 226dd6b2bfcSGreg Roach <?= view('icons/add') ?> 227dd6b2bfcSGreg Roach <?= /* I18N: A button label. */ I18N::translate('add') ?> 228dd6b2bfcSGreg Roach </button> 229dd6b2bfcSGreg Roach </th> 230dd6b2bfcSGreg Roach </tr> 231dd6b2bfcSGreg Roach </thead> 232dd6b2bfcSGreg Roach <tbody> 233dd6b2bfcSGreg Roach <?php foreach ($privacy_restrictions as $privacy_restriction) : ?> 234dd6b2bfcSGreg Roach <tr> 235dd6b2bfcSGreg Roach <td> 236dd6b2bfcSGreg Roach <?php if ($privacy_restriction->record) : ?> 23739ca88baSGreg Roach <a href="<?= e($privacy_restriction->record->url()) ?>"><?= $privacy_restriction->record->fullName() ?></a> 238dd6b2bfcSGreg Roach <?php elseif ($privacy_restriction->xref) : ?> 239dd6b2bfcSGreg Roach <div class="text-danger"> 240dd6b2bfcSGreg Roach <?= $privacy_restriction->xref ?> — <?= I18N::translate('This record does not exist.') ?> 241dd6b2bfcSGreg Roach </div> 242dd6b2bfcSGreg Roach <?php else : ?> 243dd6b2bfcSGreg Roach <div class="text-muted"> 244dd6b2bfcSGreg Roach <?= I18N::translate('All records') ?> 245dd6b2bfcSGreg Roach </div> 246dd6b2bfcSGreg Roach <?php endif ?> 247dd6b2bfcSGreg Roach </td> 248dd6b2bfcSGreg Roach <td> 249cd494761SGreg Roach <?php if ($privacy_restriction->tag_label === '') : ?> 250dd6b2bfcSGreg Roach <div class="text-muted"> 251dd6b2bfcSGreg Roach <?= I18N::translate('All facts and events') ?> 252dd6b2bfcSGreg Roach </div> 253cd494761SGreg Roach <?php else : ?> 254cd494761SGreg Roach <?= $privacy_restriction->tag_label ?> 255dd6b2bfcSGreg Roach <?php endif ?> 256dd6b2bfcSGreg Roach </td> 257dd6b2bfcSGreg Roach <td> 2580a758434SGreg Roach <?= FunctionsEdit::optionsRestrictionsRule()[$privacy_restriction->resn] ?> 259dd6b2bfcSGreg Roach </td> 260dd6b2bfcSGreg Roach <td> 261dd6b2bfcSGreg Roach <label for="delete-<?= $privacy_restriction->default_resn_id ?>"> 262dd6b2bfcSGreg Roach <input id="delete-<?= $privacy_restriction->default_resn_id ?>" name="delete[]" type="checkbox" value="<?= $privacy_restriction->default_resn_id ?>"> 263dd6b2bfcSGreg Roach <?= I18N::translate('Delete') ?> 264dd6b2bfcSGreg Roach </label> 265dd6b2bfcSGreg Roach </td> 266dd6b2bfcSGreg Roach </tr> 267dd6b2bfcSGreg Roach <?php endforeach ?> 268dd6b2bfcSGreg Roach </tbody> 269dd6b2bfcSGreg Roach </table> 270dd6b2bfcSGreg Roach 271dd6b2bfcSGreg Roach <div class="row form-group"> 272dd6b2bfcSGreg Roach <div class="offset-sm-4 col-sm-8"> 273dd6b2bfcSGreg Roach <button type="submit" class="btn btn-primary"> 274dd6b2bfcSGreg Roach <?= view('icons/save') ?> 275dd6b2bfcSGreg Roach <?= I18N::translate('save') ?> 276dd6b2bfcSGreg Roach </button> 2770c0910bfSGreg Roach 2780c0910bfSGreg Roach <a class="btn btn-secondary" href="<?= route('manage-trees', ['tree' => $tree->name()]) ?>"> 279dd6b2bfcSGreg Roach <?= view('icons/cancel') ?> 280dd6b2bfcSGreg Roach <?= I18N::translate('cancel') ?> 281dd6b2bfcSGreg Roach </a> 282dd6b2bfcSGreg Roach <!-- Coming soon 283dd6b2bfcSGreg Roach <div class="form-check"> 284dd6b2bfcSGreg Roach <?php if ($count_trees > 1) : ?> 285dd6b2bfcSGreg Roach <label> 286dd6b2bfcSGreg Roach <input type="checkbox" name="all_trees"> 287dd6b2bfcSGreg Roach <?= /* I18N: Label for checkbox */ I18N::translate('Apply these preferences to all family trees') ?> 288dd6b2bfcSGreg Roach </label> 289dd6b2bfcSGreg Roach <?php endif ?> 290dd6b2bfcSGreg Roach </div> 291dd6b2bfcSGreg Roach <div class="form-check"> 292dd6b2bfcSGreg Roach <label> 293dd6b2bfcSGreg Roach <input type="checkbox" name="new_trees"> 294dd6b2bfcSGreg Roach <?= /* I18N: Label for checkbox */ I18N::translate('Apply these preferences to new family trees') ?> 295dd6b2bfcSGreg Roach </label> 296dd6b2bfcSGreg Roach </div> 297dd6b2bfcSGreg Roach </div> 298dd6b2bfcSGreg Roach --> 299dd6b2bfcSGreg Roach </div> 300dd6b2bfcSGreg Roach 301dd6b2bfcSGreg Roach</form> 302dd6b2bfcSGreg Roach 303dd6b2bfcSGreg Roach<?php View::push('javascript') ?> 304dd6b2bfcSGreg Roach<script> 305269403b3SGreg Roach "use strict"; 306dd6b2bfcSGreg Roach 307dd6b2bfcSGreg Roach /** 308dd6b2bfcSGreg Roach * Hide/show the feedback labels for a privacy option. 309dd6b2bfcSGreg Roach * 310dd6b2bfcSGreg Roach * @param sel the control to change 311dd6b2bfcSGreg Roach * @param who "visitors", "members" or "managers" 312dd6b2bfcSGreg Roach * @param access true or false 313dd6b2bfcSGreg Roach */ 314dd6b2bfcSGreg Roach function setPrivacyFeedback(sel, who, access) { 315269403b3SGreg Roach var formGroup = $(sel).closest(".form-group"); 316dd6b2bfcSGreg Roach 317dd6b2bfcSGreg Roach if (access) { 318269403b3SGreg Roach $("." + who, formGroup).addClass("badge-success").removeClass("badge-secondary"); 319269403b3SGreg Roach $("." + who + " i", formGroup).addClass("fa-check").removeClass("fa-times"); 320dd6b2bfcSGreg Roach } else { 321269403b3SGreg Roach $("." + who, formGroup).addClass("badge-secondary").removeClass("badge-success"); 322269403b3SGreg Roach $("." + who + " i", formGroup).addClass("fa-times").removeClass("fa-check"); 323dd6b2bfcSGreg Roach } 324dd6b2bfcSGreg Roach } 325dd6b2bfcSGreg Roach 326dd6b2bfcSGreg Roach /** 327dd6b2bfcSGreg Roach * Update all the privacy feedback labels. 328dd6b2bfcSGreg Roach */ 329dd6b2bfcSGreg Roach function updatePrivacyFeedback() { 330269403b3SGreg Roach var requireAuthentication = parseInt($("[name=REQUIRE_AUTHENTICATION]").val(), 10); 331269403b3SGreg Roach var showDeadPeople = parseInt($("[name=SHOW_DEAD_PEOPLE]").val(), 10); 332269403b3SGreg Roach var hideLivePeople = parseInt($("[name=HIDE_LIVE_PEOPLE]").val(), 10); 333269403b3SGreg Roach var showLivingNames = parseInt($("[name=SHOW_LIVING_NAMES]").val(), 10); 334269403b3SGreg Roach var showPrivateRelationships = parseInt($("[name=SHOW_PRIVATE_RELATIONSHIPS]").val(), 10); 335dd6b2bfcSGreg Roach 336269403b3SGreg Roach setPrivacyFeedback("[name=REQUIRE_AUTHENTICATION]", "visitors", requireAuthentication === 0); 337269403b3SGreg Roach setPrivacyFeedback("[name=REQUIRE_AUTHENTICATION]", "members", true); 338dd6b2bfcSGreg Roach 339269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_DEAD_PEOPLE]", "visitors", requireAuthentication === 0 && (showDeadPeople >= 2 || hideLivePeople === 0)); 340269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_DEAD_PEOPLE]", "members", showDeadPeople >= 1 || hideLivePeople === 0); 341dd6b2bfcSGreg Roach 342269403b3SGreg Roach setPrivacyFeedback("[name=HIDE_LIVE_PEOPLE]", "visitors", requireAuthentication === 0 && hideLivePeople === 0); 343269403b3SGreg Roach setPrivacyFeedback("[name=HIDE_LIVE_PEOPLE]", "members", true); 344dd6b2bfcSGreg Roach 345269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_LIVING_NAMES]", "visitors", requireAuthentication === 0 && showLivingNames >= 2); 346269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_LIVING_NAMES]", "members", showLivingNames >= 1); 347269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_LIVING_NAMES]", "managers", showLivingNames >= 0); 348dd6b2bfcSGreg Roach 349269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_PRIVATE_RELATIONSHIPS]", "visitors", requireAuthentication === 0 && showPrivateRelationships >= 1); 350269403b3SGreg Roach setPrivacyFeedback("[name=SHOW_PRIVATE_RELATIONSHIPS]", "members", showPrivateRelationships >= 1); 351dd6b2bfcSGreg Roach } 352dd6b2bfcSGreg Roach 353dd6b2bfcSGreg Roach // Activate the privacy feedback labels. 354dd6b2bfcSGreg Roach updatePrivacyFeedback(); 355269403b3SGreg Roach $("[name=REQUIRE_AUTHENTICATION], [name=HIDE_LIVE_PEOPLE], [name=SHOW_DEAD_PEOPLE], [name=SHOW_LIVING_NAMES], [name=SHOW_PRIVATE_RELATIONSHIPS]").on("change", function () { 356dd6b2bfcSGreg Roach updatePrivacyFeedback(); 357dd6b2bfcSGreg Roach }); 358dd6b2bfcSGreg Roach 359dd6b2bfcSGreg Roach // Mute a line when it is marked for deletion 360dd6b2bfcSGreg Roach $("#default-resn").on("click", "input[type=checkbox]", function () { 361dd6b2bfcSGreg Roach if ($(this).prop("checked")) { 362dd6b2bfcSGreg Roach $($(this).closest("tr").addClass("text-muted")); 363dd6b2bfcSGreg Roach } else { 364dd6b2bfcSGreg Roach $($(this).closest("tr").removeClass("text-muted")); 365dd6b2bfcSGreg Roach } 366dd6b2bfcSGreg Roach }); 367dd6b2bfcSGreg Roach 368dd6b2bfcSGreg Roach // Add a new row to the table 369dd6b2bfcSGreg Roach $("#add-resn").on("click", function () { 370dd6b2bfcSGreg Roach $("#default-resn tbody").prepend($("#new-resn-template").html()); 371269403b3SGreg Roach 372269403b3SGreg Roach // Select2 - same as webtrees.js 373269403b3SGreg Roach $("select.select2").select2({ 374269403b3SGreg Roach escapeMarkup: function (x) { 375269403b3SGreg Roach return x; 376269403b3SGreg Roach }, 377269403b3SGreg Roach }) 378269403b3SGreg Roach .on("select2:unselect", function (evt) { 379269403b3SGreg Roach $(evt.delegateTarget).append("<option value=\"\" selected=\"selected\"></option>"); 380269403b3SGreg Roach }); 381269403b3SGreg Roach 382269403b3SGreg Roach // Record type selector 383269403b3SGreg Roach $(".record-type-selector").change(function () { 384269403b3SGreg Roach $(".select-record", $(this).parent()).addClass('d-none'); 385269403b3SGreg Roach $(".select-record select", $(this).parent()).prop( "disabled", true); 386269403b3SGreg Roach $(".select-" + $(this).val(), $(this).parent()).removeClass('d-none'); 387269403b3SGreg Roach $(".select-" + $(this).val() + " select", $(this).parent()).prop( "disabled", false); 388269403b3SGreg Roach }); 389dd6b2bfcSGreg Roach }); 390dd6b2bfcSGreg Roach</script> 391dd6b2bfcSGreg Roach<?php View::endpush() ?> 392