xref: /webtrees/resources/views/admin/users-edit.phtml (revision c65e00b470019e0b73635183058194c217d3035f)
1dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Auth; ?>
2dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Bootstrap4; ?>
3dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Functions\FunctionsEdit; ?>
4c16be598SGreg Roach<?php use Fisharebest\Webtrees\Functions\FunctionsPrint; ?>
5dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\I18N; ?>
6dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Individual; ?>
7dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\View; ?>
8dd6b2bfcSGreg Roach
9dd6b2bfcSGreg Roach<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('admin-users') => I18N::translate('User administration'), $title]]) ?>
10dd6b2bfcSGreg Roach
11dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
12dd6b2bfcSGreg Roach
13dd6b2bfcSGreg Roach<form class="form-horizontal" name="newform" method="post" autocomplete="off" action="<?= e(route('admin-users-edit')) ?>">
14dd6b2bfcSGreg Roach    <?= csrf_field() ?>
15895230eeSGreg Roach    <input type="hidden" name="user_id" value="<?= $user->id() ?>">
16dd6b2bfcSGreg Roach
17dd6b2bfcSGreg Roach    <!-- REAL NAME -->
18dd6b2bfcSGreg Roach    <div class="row form-group">
19dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="real_name">
20dd6b2bfcSGreg Roach            <?= I18N::translate('Real name') ?>
21dd6b2bfcSGreg Roach        </label>
22dd6b2bfcSGreg Roach        <div class="col-sm-9">
23e5a6b4d4SGreg Roach            <input class="form-control" type="text" id="real_name" name="real_name" required maxlength="64" value="<?= e($user->realName()) ?>" dir="auto">
24dd6b2bfcSGreg Roach            <p class="small text-muted">
25dd6b2bfcSGreg Roach                <?= I18N::translate('This is your real name, as you would like it displayed on screen.') ?>
26dd6b2bfcSGreg Roach            </p>
27dd6b2bfcSGreg Roach        </div>
28dd6b2bfcSGreg Roach    </div>
29dd6b2bfcSGreg Roach
30dd6b2bfcSGreg Roach    <!-- USER NAME -->
31dd6b2bfcSGreg Roach    <div class="row form-group">
32dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="username">
33dd6b2bfcSGreg Roach            <?= I18N::translate('Username') ?>
34dd6b2bfcSGreg Roach        </label>
35dd6b2bfcSGreg Roach        <div class="col-sm-9">
36*c65e00b4SGreg Roach            <input class="form-control" type="text" id="username" name="username" required maxlength="32" value="<?= e($user->userName()) ?>" dir="auto">
37dd6b2bfcSGreg Roach            <p class="small text-muted">
38dd6b2bfcSGreg Roach                <?= I18N::translate('Usernames are case-insensitive and ignore accented letters, so that “chloe”, “chloë”, and “Chloe” are considered to be the same.') ?>
39dd6b2bfcSGreg Roach            </p>
40dd6b2bfcSGreg Roach        </div>
41dd6b2bfcSGreg Roach    </div>
42dd6b2bfcSGreg Roach
43dd6b2bfcSGreg Roach    <!-- PASSWORD -->
44dd6b2bfcSGreg Roach    <div class="row form-group">
45dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="pass1">
46dd6b2bfcSGreg Roach            <?= I18N::translate('Password') ?>
47dd6b2bfcSGreg Roach        </label>
48dd6b2bfcSGreg Roach        <div class="col-sm-9">
49895230eeSGreg Roach            <input class="form-control" type="password" id="pass1" name="pass1" pattern = "<?= WT_REGEX_PASSWORD ?>" placeholder="<?= I18N::plural('Use at least %s character.', 'Use at least %s characters.', WT_MINIMUM_PASSWORD_LENGTH, I18N::number(WT_MINIMUM_PASSWORD_LENGTH)) ?>" <?= $user->id() ? '' : 'required' ?> onchange="form.pass2.pattern = regex_quote(this.value);" autocomplete="new-password">
50dd6b2bfcSGreg Roach            <p class="small text-muted">
51dd6b2bfcSGreg Roach                <?= I18N::translate('Passwords must be at least 6 characters long and are case-sensitive, so that “secret” is different from “SECRET”.') ?>
52dd6b2bfcSGreg Roach            </p>
53dd6b2bfcSGreg Roach        </div>
54dd6b2bfcSGreg Roach    </div>
55dd6b2bfcSGreg Roach
56dd6b2bfcSGreg Roach    <!-- CONFIRM PASSWORD -->
57dd6b2bfcSGreg Roach    <div class="row form-group">
58dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="pass2">
59dd6b2bfcSGreg Roach            <?= I18N::translate('Confirm password') ?>
60dd6b2bfcSGreg Roach        </label>
61dd6b2bfcSGreg Roach        <div class="col-sm-9">
62895230eeSGreg Roach            <input class="form-control" type="password" id="pass2" name="pass2" pattern = "<?= WT_REGEX_PASSWORD ?>" placeholder="<?= I18N::translate('Type the password again.') ?>" <?= $user->id() ? '' : 'required' ?> autocomplete="new-password">
63dd6b2bfcSGreg Roach        </div>
64dd6b2bfcSGreg Roach    </div>
65dd6b2bfcSGreg Roach
66dd6b2bfcSGreg Roach    <!-- EMAIL ADDRESS -->
67dd6b2bfcSGreg Roach    <div class="row form-group">
68dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="email">
69dd6b2bfcSGreg Roach            <?= I18N::translate('Email address') ?>
70dd6b2bfcSGreg Roach        </label>
71dd6b2bfcSGreg Roach        <div class="col-sm-9">
72e5a6b4d4SGreg Roach            <input class="form-control" type="email" id="email" name="email" required maxlength="64" value="<?= e($user->email()) ?>">
73dd6b2bfcSGreg Roach            <p class="small text-muted">
74dd6b2bfcSGreg Roach                <?= I18N::translate('This email address will be used to send password reminders, website notifications, and messages from other family members who are registered on the website.') ?>
75dd6b2bfcSGreg Roach            </p>
76dd6b2bfcSGreg Roach        </div>
77dd6b2bfcSGreg Roach    </div>
78dd6b2bfcSGreg Roach
79dd6b2bfcSGreg Roach    <!-- EMAIL VERIFIED -->
80dd6b2bfcSGreg Roach    <!-- ACCOUNT APPROVED -->
81dd6b2bfcSGreg Roach    <div class="row form-group">
82dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="verified">
83dd6b2bfcSGreg Roach            <?= I18N::translate('Account approval and email verification') ?>
84dd6b2bfcSGreg Roach        </label>
85dd6b2bfcSGreg Roach        <div class="col-sm-9">
86dd6b2bfcSGreg Roach            <div class="form-check">
87dd6b2bfcSGreg Roach                <label>
88dd6b2bfcSGreg Roach                    <input type="checkbox" name="verified" value="1" <?= $user->getPreference('verified') ? 'checked' : '' ?>>
89dd6b2bfcSGreg Roach                    <?= I18N::translate('Email verified') ?>
90dd6b2bfcSGreg Roach                </label>
91dd6b2bfcSGreg Roach                <label>
92dd6b2bfcSGreg Roach                    <input type="checkbox" name="approved" value="1" <?= $user->getPreference('verified_by_admin') ? 'checked' : '' ?>>
93dd6b2bfcSGreg Roach                    <?= I18N::translate('Approved by administrator') ?>
94dd6b2bfcSGreg Roach                </label>
95dd6b2bfcSGreg Roach                <p class="small text-muted">
96dd6b2bfcSGreg Roach                    <?= I18N::translate('When a user registers for an account, an email is sent to their email address with a verification link. When they follow this link, we know the email address is correct, and the “email verified” option is selected automatically.') ?>
97dd6b2bfcSGreg Roach                </p>
98dd6b2bfcSGreg Roach                <p class="small text-muted">
99dd6b2bfcSGreg Roach                    <?= I18N::translate('If an administrator creates a user account, the verification email is not sent, and the email must be verified manually.') ?>
100dd6b2bfcSGreg Roach                </p>
101dd6b2bfcSGreg Roach                <p class="small text-muted">
102dd6b2bfcSGreg Roach                    <?= I18N::translate('You should not approve an account unless you know that the email address is correct.') ?>
103dd6b2bfcSGreg Roach                </p>
104dd6b2bfcSGreg Roach                <p class="small text-muted">
105dd6b2bfcSGreg Roach                    <?= I18N::translate('A user will not be able to sign in until both “email verified” and “approved by administrator” are selected.') ?>
106dd6b2bfcSGreg Roach                </p>
107dd6b2bfcSGreg Roach            </div>
108dd6b2bfcSGreg Roach        </div>
109dd6b2bfcSGreg Roach    </div>
110dd6b2bfcSGreg Roach
111dd6b2bfcSGreg Roach    <!-- LANGUAGE -->
112dd6b2bfcSGreg Roach    <div class="row form-group">
113dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="language">
114dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Language') ?>
115dd6b2bfcSGreg Roach        </label>
116dd6b2bfcSGreg Roach        <div class="col-sm-9">
117dd6b2bfcSGreg Roach            <select id="language" name="language" class="form-control">
118dd6b2bfcSGreg Roach                <?php foreach ($locales as $locale) : ?>
119dd6b2bfcSGreg Roach                    <option value="<?= $locale->languageTag() ?>" <?= $user->getPreference('language', $default_locale) === $locale->languageTag() ? 'selected' : '' ?>>
120dd6b2bfcSGreg Roach                        <?= $locale->endonym() ?>
121dd6b2bfcSGreg Roach                    </option>
122dd6b2bfcSGreg Roach                <?php endforeach ?>
123dd6b2bfcSGreg Roach            </select>
124dd6b2bfcSGreg Roach        </div>
125dd6b2bfcSGreg Roach    </div>
126dd6b2bfcSGreg Roach
127dd6b2bfcSGreg Roach    <!-- TIMEZONE -->
128dd6b2bfcSGreg Roach    <div class="row form-group">
129dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="timezone">
130dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Time zone') ?>
131dd6b2bfcSGreg Roach        </label>
132dd6b2bfcSGreg Roach        <div class="col-sm-9">
133dd6b2bfcSGreg Roach            <?= Bootstrap4::select(array_combine(\DateTimeZone::listIdentifiers(), \DateTimeZone::listIdentifiers()), $user->getPreference('TIMEZONE', 'UTC'), ['id' => 'timezone', 'name' => 'timezone']) ?>
134dd6b2bfcSGreg Roach            <p class="small text-muted">
135dd6b2bfcSGreg Roach                <?= I18N::translate('The time zone is required for date calculations, such as knowing today’s date.') ?>
136dd6b2bfcSGreg Roach            </p>
137dd6b2bfcSGreg Roach        </div>
138dd6b2bfcSGreg Roach    </div>
139dd6b2bfcSGreg Roach
140dd6b2bfcSGreg Roach    <!-- AUTO ACCEPT -->
141dd6b2bfcSGreg Roach    <div class="row form-group">
142dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="auto_accept">
143dd6b2bfcSGreg Roach            <?= I18N::translate('Changes') ?>
144dd6b2bfcSGreg Roach        </label>
145dd6b2bfcSGreg Roach        <div class="col-sm-9">
146dd6b2bfcSGreg Roach            <div class="form-check">
147dd6b2bfcSGreg Roach                <label>
148dd6b2bfcSGreg Roach                    <input type="checkbox" name="auto_accept" value="1" <?= $user->getPreference('auto_accept') ? 'checked' : '' ?>>
149dd6b2bfcSGreg Roach                    <?= I18N::translate('Automatically accept changes made by this user') ?>
150dd6b2bfcSGreg Roach                </label>
151dd6b2bfcSGreg Roach                <p class="small text-muted">
152dd6b2bfcSGreg Roach                    <?= I18N::translate('Normally, any changes made to a family tree need to be reviewed by a moderator. This option allows a user to make changes without needing a moderator.') ?>
153dd6b2bfcSGreg Roach                </p>
154dd6b2bfcSGreg Roach            </div>
155dd6b2bfcSGreg Roach        </div>
156dd6b2bfcSGreg Roach    </div>
157dd6b2bfcSGreg Roach
158dd6b2bfcSGreg Roach    <!-- VISIBLE ONLINE -->
159dd6b2bfcSGreg Roach    <div class="row form-group">
160dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="visible_online">
161dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Visible online') ?>
162dd6b2bfcSGreg Roach        </label>
163dd6b2bfcSGreg Roach        <div class="col-sm-9">
164dd6b2bfcSGreg Roach            <div class="form-check">
165dd6b2bfcSGreg Roach                <label>
166dd6b2bfcSGreg Roach                    <input type="checkbox" id="visible_online" name="visible_online" value="1" <?= $user->getPreference('visibleonline') ? 'checked' : '' ?>>
167dd6b2bfcSGreg Roach                    <?= /* I18N: A configuration setting */ I18N::translate('Visible to other users when online') ?>
168dd6b2bfcSGreg Roach                </label>
169dd6b2bfcSGreg Roach                <p class="small text-muted">
170dd6b2bfcSGreg Roach                    <?= I18N::translate('You can choose whether to appear in the list of users who are currently signed-in.') ?>
171dd6b2bfcSGreg Roach                </p>
172dd6b2bfcSGreg Roach            </div>
173dd6b2bfcSGreg Roach        </div>
174dd6b2bfcSGreg Roach    </div>
175dd6b2bfcSGreg Roach
176dd6b2bfcSGreg Roach    <!-- CONTACT METHOD -->
177dd6b2bfcSGreg Roach    <div class="row form-group">
178dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="contactmethod">
179dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Preferred contact method') ?>
180dd6b2bfcSGreg Roach        </label>
181dd6b2bfcSGreg Roach        <div class="col-sm-9">
182dd6b2bfcSGreg Roach            <?= Bootstrap4::select($contact_methods, $user->getPreference('contactmethod'), ['id' => 'contact_method', 'name' => 'contact_method']) ?>
183dd6b2bfcSGreg Roach            <p class="small text-muted">
184dd6b2bfcSGreg Roach                <?= /* I18N: Help text for the “Preferred contact method” configuration setting */
185dd6b2bfcSGreg Roach                I18N::translate('Site members can send each other messages. You can choose to how these messages are sent to you, or choose not receive them at all.') ?>
186dd6b2bfcSGreg Roach            </p>
187dd6b2bfcSGreg Roach        </div>
188dd6b2bfcSGreg Roach    </div>
189dd6b2bfcSGreg Roach
190dd6b2bfcSGreg Roach    <!-- THEME -->
191dd6b2bfcSGreg Roach    <div class="row form-group">
192dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="theme">
193dd6b2bfcSGreg Roach            <?= I18N::translate('Theme') ?>
194dd6b2bfcSGreg Roach        </label>
195dd6b2bfcSGreg Roach        <div class="col-sm-9">
196dd6b2bfcSGreg Roach            <?= Bootstrap4::select($theme_options, $user->getPreference('theme'), ['id' => 'theme', 'name' => 'theme']) ?>
197dd6b2bfcSGreg Roach        </div>
198dd6b2bfcSGreg Roach    </div>
199dd6b2bfcSGreg Roach
200dd6b2bfcSGreg Roach    <!-- COMMENTS -->
201dd6b2bfcSGreg Roach    <div class="row form-group">
202dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="comment">
203dd6b2bfcSGreg Roach            <?= I18N::translate('Administrator comments on user') ?>
204dd6b2bfcSGreg Roach        </label>
205dd6b2bfcSGreg Roach        <div class="col-sm-9">
206dd6b2bfcSGreg Roach            <textarea class="form-control" id="comment" name="comment" rows="5" maxlength="255"><?= e($user->getPreference('comment')) ?></textarea>
207dd6b2bfcSGreg Roach        </div>
208dd6b2bfcSGreg Roach    </div>
209dd6b2bfcSGreg Roach
210dd6b2bfcSGreg Roach    <!-- ADMINISTRATOR -->
211dd6b2bfcSGreg Roach    <div class="row form-group">
212dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="admin">
213dd6b2bfcSGreg Roach        </label>
214dd6b2bfcSGreg Roach        <div class="col-sm-9">
215dd6b2bfcSGreg Roach            <div class="form-check">
216dd6b2bfcSGreg Roach                <label>
217895230eeSGreg Roach                    <input type="checkbox" id="admin" name="canadmin" value="1" <?= $user->getPreference('canadmin') ? 'checked' : '' ?>  <?= $user->id() === Auth::id() ? 'disabled' : '' ?>>
218dd6b2bfcSGreg Roach                    <?= I18N::translate('Administrator') ?>
219dd6b2bfcSGreg Roach                </label>
220dd6b2bfcSGreg Roach            </div>
221dd6b2bfcSGreg Roach        </div>
222dd6b2bfcSGreg Roach    </div>
223dd6b2bfcSGreg Roach
224dd6b2bfcSGreg Roach    <h3><?= I18N::translate('Access to family trees') ?></h3>
225dd6b2bfcSGreg Roach
226dd6b2bfcSGreg Roach    <p>
227dd6b2bfcSGreg Roach        <?= I18N::translate('A role is a set of access rights, which give permission to view data, change preferences, etc. Access rights are assigned to roles, and roles are granted to users. Each family tree can assign different access to each role, and users can have a different role in each family tree.') ?>
228dd6b2bfcSGreg Roach    </p>
229dd6b2bfcSGreg Roach
230dd6b2bfcSGreg Roach    <div class="row">
231dd6b2bfcSGreg Roach        <div class="col-xs-4">
232dd6b2bfcSGreg Roach            <h4>
233dd6b2bfcSGreg Roach                <?= I18N::translate('Visitor') ?>
234dd6b2bfcSGreg Roach            </h4>
235dd6b2bfcSGreg Roach            <p class="small text-muted">
236dd6b2bfcSGreg Roach                <?= I18N::translate('Everybody has this role, including visitors to the website and search engines.') ?>
237dd6b2bfcSGreg Roach            </p>
238dd6b2bfcSGreg Roach            <h4>
239dd6b2bfcSGreg Roach                <?= I18N::translate('Member') ?>
240dd6b2bfcSGreg Roach            </h4>
241dd6b2bfcSGreg Roach            <p class="small text-muted">
242dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the visitor role, plus any additional access granted by the family tree configuration.') ?>
243dd6b2bfcSGreg Roach            </p>
244dd6b2bfcSGreg Roach        </div>
245dd6b2bfcSGreg Roach        <div class="col-xs-4">
246dd6b2bfcSGreg Roach            <h4>
247dd6b2bfcSGreg Roach                <?= I18N::translate('Editor') ?>
248dd6b2bfcSGreg Roach            </h4>
249dd6b2bfcSGreg Roach            <p class="small text-muted">
250dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the member role, plus permission to add/change/delete data. Any changes will need to be reviewed by a moderator, unless the user has the “automatically accept changes” option enabled.') ?>
251dd6b2bfcSGreg Roach            </p>
252dd6b2bfcSGreg Roach            <h4>
253dd6b2bfcSGreg Roach                <?= I18N::translate('Moderator') ?>
254dd6b2bfcSGreg Roach            </h4>
255dd6b2bfcSGreg Roach            <p class="small text-muted">
256dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the editor role, plus permission to accept/reject changes made by other users.') ?>
257dd6b2bfcSGreg Roach            </p>
258dd6b2bfcSGreg Roach        </div>
259dd6b2bfcSGreg Roach        <div class="col-xs-4">
260dd6b2bfcSGreg Roach            <h4>
261dd6b2bfcSGreg Roach                <?= I18N::translate('Manager') ?>
262dd6b2bfcSGreg Roach            </h4>
263dd6b2bfcSGreg Roach            <p class="small text-muted">
264dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the moderator role, plus any additional access granted by the family tree configuration, plus permission to change the settings/configuration of a family tree.') ?>
265dd6b2bfcSGreg Roach            </p>
266dd6b2bfcSGreg Roach            <h4>
267dd6b2bfcSGreg Roach                <?= I18N::translate('Administrator') ?>
268dd6b2bfcSGreg Roach            </h4>
269dd6b2bfcSGreg Roach            <p class="small text-muted">
270dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the manager role in all family trees, plus permission to change the settings/configuration of the website, users, and modules.') ?>
271dd6b2bfcSGreg Roach            </p>
272dd6b2bfcSGreg Roach        </div>
273dd6b2bfcSGreg Roach    </div>
274dd6b2bfcSGreg Roach
275dd6b2bfcSGreg Roach    <table class="table table-bordered table-sm">
276dd6b2bfcSGreg Roach        <thead>
277dd6b2bfcSGreg Roach            <tr>
278dd6b2bfcSGreg Roach                <th>
279dd6b2bfcSGreg Roach                    <?= I18N::translate('Family tree') ?>
280dd6b2bfcSGreg Roach                </th>
281dd6b2bfcSGreg Roach                <th>
282dd6b2bfcSGreg Roach                    <?= I18N::translate('Role') ?>
283dd6b2bfcSGreg Roach                </th>
284dd6b2bfcSGreg Roach                <th>
285dd6b2bfcSGreg Roach                    <?= I18N::translate('Individual record') ?>
286dd6b2bfcSGreg Roach                </th>
287dd6b2bfcSGreg Roach                <th>
288dd6b2bfcSGreg Roach                    <?= I18N::translate('Restrict to immediate family') ?>
289c16be598SGreg Roach                    <?= FunctionsPrint::helpLink('relationship-privacy') ?>
290dd6b2bfcSGreg Roach                </th>
291dd6b2bfcSGreg Roach            </tr>
292dd6b2bfcSGreg Roach            <tr>
293dd6b2bfcSGreg Roach                <td>
294dd6b2bfcSGreg Roach                </td>
295dd6b2bfcSGreg Roach                <td>
296dd6b2bfcSGreg Roach                </td>
297dd6b2bfcSGreg Roach                <td>
298dd6b2bfcSGreg Roach                    <p class="small text-muted">
299dd6b2bfcSGreg Roach                        <?= I18N::translate('Link this user to an individual in the family tree.') ?>
300dd6b2bfcSGreg Roach                    </p>
301dd6b2bfcSGreg Roach                </td>
302dd6b2bfcSGreg Roach                <td>
303dd6b2bfcSGreg Roach                </td>
304dd6b2bfcSGreg Roach            </tr>
305dd6b2bfcSGreg Roach        </thead>
306dd6b2bfcSGreg Roach        <tbody>
307dd6b2bfcSGreg Roach            <?php foreach ($trees as $tree) : ?>
308dd6b2bfcSGreg Roach                <tr>
309dd6b2bfcSGreg Roach                    <td>
3105c7ad034SGreg Roach                        <?= e($tree->title()) ?>
311dd6b2bfcSGreg Roach                    </td>
312dd6b2bfcSGreg Roach                    <td>
31372cf66d4SGreg Roach                        <select class="form-control" name="canedit<?= $tree->id() ?>">
314dd6b2bfcSGreg Roach                            <?php foreach ($roles as $role => $description) : ?>
315dd6b2bfcSGreg Roach                                <option value="<?= $role ?>"
316dd6b2bfcSGreg Roach                                    <?= $role === $tree->getUserPreference($user, 'canedit') ? 'selected' : '' ?>>
317dd6b2bfcSGreg Roach                                    <?= $description ?>
318dd6b2bfcSGreg Roach                                </option>
319dd6b2bfcSGreg Roach                            <?php endforeach ?>
320dd6b2bfcSGreg Roach                        </select>
321dd6b2bfcSGreg Roach                    </td>
322dd6b2bfcSGreg Roach                    <td>
32372cf66d4SGreg Roach                        <?= FunctionsEdit::formControlIndividual($tree, Individual::getInstance($tree->getUserPreference($user, 'gedcomid'), $tree), ['id' => 'gedcomid' . $tree->id(), 'name' => 'gedcomid' . $tree->id()]) ?>
324dd6b2bfcSGreg Roach                    </td>
325dd6b2bfcSGreg Roach                    <td>
32672cf66d4SGreg Roach                        <select class="form-control" name="RELATIONSHIP_PATH_LENGTH<?= $tree->id() ?>" id="RELATIONSHIP_PATH_LENGTH<?= $tree->id() ?>" class="relpath">
327dd6b2bfcSGreg Roach                            <?php for ($n = 0; $n <= 10; ++$n) : ?>
328dd6b2bfcSGreg Roach                                <option value="<?= $n ?>" <?= $tree->getUserPreference($user, 'RELATIONSHIP_PATH_LENGTH') == $n ? 'selected' : '' ?>>
329dd6b2bfcSGreg Roach                                    <?= $n ?: I18N::translate('No') ?>
330dd6b2bfcSGreg Roach                                </option>
331dd6b2bfcSGreg Roach                            <?php endfor ?>
332dd6b2bfcSGreg Roach                        </select>
333dd6b2bfcSGreg Roach                    </td>
334dd6b2bfcSGreg Roach                </tr>
335dd6b2bfcSGreg Roach            <?php endforeach ?>
336dd6b2bfcSGreg Roach        </tbody>
337dd6b2bfcSGreg Roach    </table>
338dd6b2bfcSGreg Roach
339dd6b2bfcSGreg Roach    <div class="row form-group">
340dd6b2bfcSGreg Roach        <div class="offset-sm-3 col-sm-9">
341dd6b2bfcSGreg Roach            <button type="submit" class="btn btn-primary">
342dd6b2bfcSGreg Roach                <?= I18N::translate('save') ?>
343dd6b2bfcSGreg Roach            </button>
344dd6b2bfcSGreg Roach        </div>
345dd6b2bfcSGreg Roach    </div>
346dd6b2bfcSGreg Roach</form>
347dd6b2bfcSGreg Roach
348c16be598SGreg Roach<?= view('modals/ajax') ?>
349c16be598SGreg Roach
350dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
351dd6b2bfcSGreg Roach<script>
352dd6b2bfcSGreg Roach  $(".relpath").change(function() {
353dd6b2bfcSGreg Roach    var fieldIDx = $(this).attr("id");
354dd6b2bfcSGreg Roach    var idNum = fieldIDx.replace("RELATIONSHIP_PATH_LENGTH","");
355dd6b2bfcSGreg Roach    var newIDx = "gedcomid"+idNum;
356dd6b2bfcSGreg Roach    if ($("#"+newIDx).val() === "" && $("#".fieldIDx).val() !== "0") {
357dd6b2bfcSGreg Roach      alert("<?= I18N::translate('You must specify an individual record before you can restrict the user to their immediate family.') ?>");
358dd6b2bfcSGreg Roach      $(this).val("0");
359dd6b2bfcSGreg Roach    }
360dd6b2bfcSGreg Roach  });
361dd6b2bfcSGreg Roach  function regex_quote(str) {
362dd6b2bfcSGreg Roach    return str.replace(/[\\.?+*()[\](){}|]/g, "\\$&");
363dd6b2bfcSGreg Roach  }
364dd6b2bfcSGreg Roach</script>
365dd6b2bfcSGreg Roach<?php View::endpush() ?>
366