xref: /webtrees/resources/views/admin/users-edit.phtml (revision 6b9cb339562c8aa4681c7eff2bf3bdf401cc9edd)
1b6c326d8SGreg Roach<?php
2b6c326d8SGreg Roach
3b6c326d8SGreg Roachuse Fisharebest\Webtrees\Auth;
4*6b9cb339SGreg Roachuse Fisharebest\Webtrees\Registry;
50c0910bfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
6510d3f2fSGreg Roachuse Fisharebest\Webtrees\I18N;
77c4add84SGreg Roachuse Fisharebest\Webtrees\User;
8b6c326d8SGreg Roachuse Fisharebest\Webtrees\View;
9b6c326d8SGreg Roach
10b6c326d8SGreg Roach?>
11dd6b2bfcSGreg Roach
120c0910bfSGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route('admin-users') => I18N::translate('User administration'), $title]]) ?>
13dd6b2bfcSGreg Roach
14dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
15dd6b2bfcSGreg Roach
16f0c6c2cbSGreg Roach<form method="post" action="<?= e(route('admin-users-edit')) ?>" class="form-horizontal" autocomplete="off">
17dd6b2bfcSGreg Roach    <?= csrf_field() ?>
18895230eeSGreg Roach    <input type="hidden" name="user_id" value="<?= $user->id() ?>">
19dd6b2bfcSGreg Roach
20dd6b2bfcSGreg Roach    <!-- REAL NAME -->
21dd6b2bfcSGreg Roach    <div class="row form-group">
22dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="real_name">
23dd6b2bfcSGreg Roach            <?= I18N::translate('Real name') ?>
24dd6b2bfcSGreg Roach        </label>
25dd6b2bfcSGreg Roach        <div class="col-sm-9">
26e5a6b4d4SGreg Roach            <input class="form-control" type="text" id="real_name" name="real_name" required maxlength="64" value="<?= e($user->realName()) ?>" dir="auto">
27dd6b2bfcSGreg Roach            <p class="small text-muted">
28dd6b2bfcSGreg Roach                <?= I18N::translate('This is your real name, as you would like it displayed on screen.') ?>
29dd6b2bfcSGreg Roach            </p>
30dd6b2bfcSGreg Roach        </div>
31dd6b2bfcSGreg Roach    </div>
32dd6b2bfcSGreg Roach
33dd6b2bfcSGreg Roach    <!-- USER NAME -->
34dd6b2bfcSGreg Roach    <div class="row form-group">
35dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="username">
36dd6b2bfcSGreg Roach            <?= I18N::translate('Username') ?>
37dd6b2bfcSGreg Roach        </label>
38dd6b2bfcSGreg Roach        <div class="col-sm-9">
39c65e00b4SGreg Roach            <input class="form-control" type="text" id="username" name="username" required maxlength="32" value="<?= e($user->userName()) ?>" dir="auto">
40dd6b2bfcSGreg Roach            <p class="small text-muted">
41dd6b2bfcSGreg Roach                <?= I18N::translate('Usernames are case-insensitive and ignore accented letters, so that “chloe”, “chloë”, and “Chloe” are considered to be the same.') ?>
42dd6b2bfcSGreg Roach            </p>
43dd6b2bfcSGreg Roach        </div>
44dd6b2bfcSGreg Roach    </div>
45dd6b2bfcSGreg Roach
46dd6b2bfcSGreg Roach    <!-- PASSWORD -->
47dd6b2bfcSGreg Roach    <div class="row form-group">
48510d3f2fSGreg Roach        <label class="col-sm-3 col-form-label" for="password">
49dd6b2bfcSGreg Roach            <?= I18N::translate('Password') ?>
50dd6b2bfcSGreg Roach        </label>
51dd6b2bfcSGreg Roach        <div class="col-sm-9">
52510d3f2fSGreg Roach            <input class="form-control" type="password" id="password" name="password" pattern = ".{8,}" placeholder="<?= I18N::plural('Use at least %s character.', 'Use at least %s characters.', 8, I18N::number(8)) ?>" <?= $user->id() ? '' : 'required' ?> autocomplete="new-password">
53dd6b2bfcSGreg Roach            <p class="small text-muted">
5454bcf2f0SRico Sonntag                <?= I18N::translate('Passwords must be at least 8 characters long and are case-sensitive, so that “secret” is different from “SECRET”.') ?>
55dd6b2bfcSGreg Roach            </p>
56dd6b2bfcSGreg Roach        </div>
57dd6b2bfcSGreg Roach    </div>
58dd6b2bfcSGreg Roach
59dd6b2bfcSGreg Roach    <!-- EMAIL ADDRESS -->
60dd6b2bfcSGreg Roach    <div class="row form-group">
61dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="email">
62dd6b2bfcSGreg Roach            <?= I18N::translate('Email address') ?>
63dd6b2bfcSGreg Roach        </label>
64dd6b2bfcSGreg Roach        <div class="col-sm-9">
65e5a6b4d4SGreg Roach            <input class="form-control" type="email" id="email" name="email" required maxlength="64" value="<?= e($user->email()) ?>">
66dd6b2bfcSGreg Roach            <p class="small text-muted">
67dd6b2bfcSGreg 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.') ?>
68dd6b2bfcSGreg Roach            </p>
69dd6b2bfcSGreg Roach        </div>
70dd6b2bfcSGreg Roach    </div>
71dd6b2bfcSGreg Roach
72dd6b2bfcSGreg Roach    <!-- EMAIL VERIFIED -->
73dd6b2bfcSGreg Roach    <!-- ACCOUNT APPROVED -->
74dd6b2bfcSGreg Roach    <div class="row form-group">
75dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="verified">
76dd6b2bfcSGreg Roach            <?= I18N::translate('Account approval and email verification') ?>
77dd6b2bfcSGreg Roach        </label>
78dd6b2bfcSGreg Roach        <div class="col-sm-9">
79dd6b2bfcSGreg Roach            <div class="form-check">
80dd6b2bfcSGreg Roach                <label>
817c4add84SGreg Roach                    <input type="checkbox" name="verified" value="1" <?= $user->getPreference(User::PREF_IS_EMAIL_VERIFIED) === '1' ? 'checked' : '' ?>>
82dd6b2bfcSGreg Roach                    <?= I18N::translate('Email verified') ?>
83dd6b2bfcSGreg Roach                </label>
84dd6b2bfcSGreg Roach                <label>
857c4add84SGreg Roach                    <input type="checkbox" name="approved" value="1" <?= $user->getPreference(User::PREF_IS_ACCOUNT_APPROVED) === '1' ? 'checked' : '' ?>>
86dd6b2bfcSGreg Roach                    <?= I18N::translate('Approved by administrator') ?>
87dd6b2bfcSGreg Roach                </label>
88dd6b2bfcSGreg Roach                <p class="small text-muted">
89dd6b2bfcSGreg 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.') ?>
90dd6b2bfcSGreg Roach                </p>
91dd6b2bfcSGreg Roach                <p class="small text-muted">
92dd6b2bfcSGreg Roach                    <?= I18N::translate('If an administrator creates a user account, the verification email is not sent, and the email must be verified manually.') ?>
93dd6b2bfcSGreg Roach                </p>
94dd6b2bfcSGreg Roach                <p class="small text-muted">
95dd6b2bfcSGreg Roach                    <?= I18N::translate('You should not approve an account unless you know that the email address is correct.') ?>
96dd6b2bfcSGreg Roach                </p>
97dd6b2bfcSGreg Roach                <p class="small text-muted">
98dd6b2bfcSGreg Roach                    <?= I18N::translate('A user will not be able to sign in until both “email verified” and “approved by administrator” are selected.') ?>
99dd6b2bfcSGreg Roach                </p>
100dd6b2bfcSGreg Roach            </div>
101dd6b2bfcSGreg Roach        </div>
102dd6b2bfcSGreg Roach    </div>
103dd6b2bfcSGreg Roach
104dd6b2bfcSGreg Roach    <!-- LANGUAGE -->
105dd6b2bfcSGreg Roach    <div class="row form-group">
106dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="language">
107dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Language') ?>
108dd6b2bfcSGreg Roach        </label>
109dd6b2bfcSGreg Roach        <div class="col-sm-9">
110150f35adSGreg Roach            <?= view('components/select', ['name' => 'language', 'selected' => $user->getPreference(User::PREF_LANGUAGE, $default_language), 'options' => $languages]) ?>
111dd6b2bfcSGreg Roach        </div>
112dd6b2bfcSGreg Roach    </div>
113dd6b2bfcSGreg Roach
114dd6b2bfcSGreg Roach    <!-- TIMEZONE -->
115dd6b2bfcSGreg Roach    <div class="row form-group">
116dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="timezone">
117dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Time zone') ?>
118dd6b2bfcSGreg Roach        </label>
119dd6b2bfcSGreg Roach        <div class="col-sm-9">
1207c4add84SGreg Roach            <?= view('components/select', ['name' => 'timezone', 'selected' => $user->getPreference(User::PREF_TIME_ZONE, 'UTC'), 'options' => array_combine(DateTimeZone::listIdentifiers(), DateTimeZone::listIdentifiers())]) ?>
121dd6b2bfcSGreg Roach            <p class="small text-muted">
122dd6b2bfcSGreg Roach                <?= I18N::translate('The time zone is required for date calculations, such as knowing today’s date.') ?>
123dd6b2bfcSGreg Roach            </p>
124dd6b2bfcSGreg Roach        </div>
125dd6b2bfcSGreg Roach    </div>
126dd6b2bfcSGreg Roach
127dd6b2bfcSGreg Roach    <!-- AUTO ACCEPT -->
128dd6b2bfcSGreg Roach    <div class="row form-group">
129dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="auto_accept">
130dd6b2bfcSGreg Roach            <?= I18N::translate('Changes') ?>
131dd6b2bfcSGreg Roach        </label>
132dd6b2bfcSGreg Roach        <div class="col-sm-9">
133dd6b2bfcSGreg Roach            <div class="form-check">
134dd6b2bfcSGreg Roach                <label>
1357c4add84SGreg Roach                    <input type="checkbox" name="auto_accept" value="1" <?= $user->getPreference(User::PREF_AUTO_ACCEPT_EDITS) === '1' ? 'checked' : '' ?>>
136dd6b2bfcSGreg Roach                    <?= I18N::translate('Automatically accept changes made by this user') ?>
137dd6b2bfcSGreg Roach                </label>
138dd6b2bfcSGreg Roach                <p class="small text-muted">
139dd6b2bfcSGreg 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.') ?>
140dd6b2bfcSGreg Roach                </p>
141dd6b2bfcSGreg Roach            </div>
142dd6b2bfcSGreg Roach        </div>
143dd6b2bfcSGreg Roach    </div>
144dd6b2bfcSGreg Roach
145dd6b2bfcSGreg Roach    <!-- VISIBLE ONLINE -->
146dd6b2bfcSGreg Roach    <div class="row form-group">
1477c4add84SGreg Roach        <label class="col-sm-3 col-form-label" for="visible-online">
148dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Visible online') ?>
149dd6b2bfcSGreg Roach        </label>
150dd6b2bfcSGreg Roach        <div class="col-sm-9">
151dd6b2bfcSGreg Roach            <div class="form-check">
152dd6b2bfcSGreg Roach                <label>
1537c4add84SGreg Roach                    <input type="checkbox" id="visible-online" name="visible-online" value="1" <?= $user->getPreference(User::PREF_IS_VISIBLE_ONLINE) === '1' ? 'checked' : '' ?>>
154dd6b2bfcSGreg Roach                    <?= /* I18N: A configuration setting */ I18N::translate('Visible to other users when online') ?>
155dd6b2bfcSGreg Roach                </label>
156dd6b2bfcSGreg Roach                <p class="small text-muted">
157dd6b2bfcSGreg Roach                    <?= I18N::translate('You can choose whether to appear in the list of users who are currently signed-in.') ?>
158dd6b2bfcSGreg Roach                </p>
159dd6b2bfcSGreg Roach            </div>
160dd6b2bfcSGreg Roach        </div>
161dd6b2bfcSGreg Roach    </div>
162dd6b2bfcSGreg Roach
163dd6b2bfcSGreg Roach    <!-- CONTACT METHOD -->
164dd6b2bfcSGreg Roach    <div class="row form-group">
1657c4add84SGreg Roach        <label class="col-sm-3 col-form-label" for="contact-method">
166dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Preferred contact method') ?>
167dd6b2bfcSGreg Roach        </label>
168dd6b2bfcSGreg Roach        <div class="col-sm-9">
1697c4add84SGreg Roach            <?= view('components/select', ['id' => 'contact-method', 'name' => 'contact-method', 'selected' => $user->getPreference(User::PREF_CONTACT_METHOD), 'options' => $contact_methods]) ?>
170dd6b2bfcSGreg Roach            <p class="small text-muted">
171dd6b2bfcSGreg Roach                <?= /* I18N: Help text for the “Preferred contact method” configuration setting */
172dd6b2bfcSGreg 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.') ?>
173dd6b2bfcSGreg Roach            </p>
174dd6b2bfcSGreg Roach        </div>
175dd6b2bfcSGreg Roach    </div>
176dd6b2bfcSGreg Roach
177dd6b2bfcSGreg Roach    <!-- THEME -->
178dd6b2bfcSGreg Roach    <div class="row form-group">
179dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="theme">
180dd6b2bfcSGreg Roach            <?= I18N::translate('Theme') ?>
181dd6b2bfcSGreg Roach        </label>
182dd6b2bfcSGreg Roach        <div class="col-sm-9">
1837c4add84SGreg Roach            <?= view('components/select', ['name' => 'theme', 'selected' => $user->getPreference(User::PREF_THEME), 'options' => $theme_options]) ?>
184dd6b2bfcSGreg Roach        </div>
185dd6b2bfcSGreg Roach    </div>
186dd6b2bfcSGreg Roach
187dd6b2bfcSGreg Roach    <!-- COMMENTS -->
188dd6b2bfcSGreg Roach    <div class="row form-group">
189e4f0f6f0SGreg Roach        <label class="col-sm-3 col-form-label" for="comment">
190dd6b2bfcSGreg Roach            <?= I18N::translate('Administrator comments on user') ?>
191dd6b2bfcSGreg Roach        </label>
192dd6b2bfcSGreg Roach        <div class="col-sm-9">
193e4f0f6f0SGreg Roach            <textarea class="form-control" id="comment" name="comment" rows="4" dir="auto" maxlength="255"><?= e($user->getPreference(User::PREF_NEW_ACCOUNT_COMMENT)) ?></textarea>
194dd6b2bfcSGreg Roach        </div>
195dd6b2bfcSGreg Roach    </div>
196dd6b2bfcSGreg Roach
197dd6b2bfcSGreg Roach    <!-- ADMINISTRATOR -->
198dd6b2bfcSGreg Roach    <div class="row form-group">
199dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="admin">
200dd6b2bfcSGreg Roach        </label>
201dd6b2bfcSGreg Roach        <div class="col-sm-9">
202dd6b2bfcSGreg Roach            <div class="form-check">
203dd6b2bfcSGreg Roach                <label>
2047c4add84SGreg Roach                    <input type="checkbox" id="admin" name="canadmin" value="1" <?= $user->getPreference(User::PREF_IS_ADMINISTRATOR) === '1' ? 'checked' : '' ?>  <?= $user->id() === Auth::id() ? 'disabled' : '' ?>>
205dd6b2bfcSGreg Roach                    <?= I18N::translate('Administrator') ?>
206dd6b2bfcSGreg Roach                </label>
207dd6b2bfcSGreg Roach            </div>
208dd6b2bfcSGreg Roach        </div>
209dd6b2bfcSGreg Roach    </div>
210dd6b2bfcSGreg Roach
211dd6b2bfcSGreg Roach    <h3><?= I18N::translate('Access to family trees') ?></h3>
212dd6b2bfcSGreg Roach
213dd6b2bfcSGreg Roach    <p>
214dd6b2bfcSGreg 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.') ?>
215dd6b2bfcSGreg Roach    </p>
216dd6b2bfcSGreg Roach
217dd6b2bfcSGreg Roach    <div class="row">
2185197b5a1SGreg Roach        <div class="col-sm-4">
219dd6b2bfcSGreg Roach            <h4>
220dd6b2bfcSGreg Roach                <?= I18N::translate('Visitor') ?>
221dd6b2bfcSGreg Roach            </h4>
222dd6b2bfcSGreg Roach            <p class="small text-muted">
223dd6b2bfcSGreg Roach                <?= I18N::translate('Everybody has this role, including visitors to the website and search engines.') ?>
224dd6b2bfcSGreg Roach            </p>
225dd6b2bfcSGreg Roach            <h4>
226dd6b2bfcSGreg Roach                <?= I18N::translate('Member') ?>
227dd6b2bfcSGreg Roach            </h4>
228dd6b2bfcSGreg Roach            <p class="small text-muted">
229dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the visitor role, plus any additional access granted by the family tree configuration.') ?>
230dd6b2bfcSGreg Roach            </p>
231dd6b2bfcSGreg Roach        </div>
2325197b5a1SGreg Roach        <div class="col-sm-4">
233dd6b2bfcSGreg Roach            <h4>
234dd6b2bfcSGreg Roach                <?= I18N::translate('Editor') ?>
235dd6b2bfcSGreg Roach            </h4>
236dd6b2bfcSGreg Roach            <p class="small text-muted">
237dd6b2bfcSGreg 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.') ?>
238dd6b2bfcSGreg Roach            </p>
239dd6b2bfcSGreg Roach            <h4>
240dd6b2bfcSGreg Roach                <?= I18N::translate('Moderator') ?>
241dd6b2bfcSGreg Roach            </h4>
242dd6b2bfcSGreg Roach            <p class="small text-muted">
243dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the editor role, plus permission to accept/reject changes made by other users.') ?>
244dd6b2bfcSGreg Roach            </p>
245dd6b2bfcSGreg Roach        </div>
2465197b5a1SGreg Roach        <div class="col-sm-4">
247dd6b2bfcSGreg Roach            <h4>
248dd6b2bfcSGreg Roach                <?= I18N::translate('Manager') ?>
249dd6b2bfcSGreg Roach            </h4>
250dd6b2bfcSGreg Roach            <p class="small text-muted">
251dd6b2bfcSGreg 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.') ?>
252dd6b2bfcSGreg Roach            </p>
253dd6b2bfcSGreg Roach            <h4>
254dd6b2bfcSGreg Roach                <?= I18N::translate('Administrator') ?>
255dd6b2bfcSGreg Roach            </h4>
256dd6b2bfcSGreg Roach            <p class="small text-muted">
257dd6b2bfcSGreg 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.') ?>
258dd6b2bfcSGreg Roach            </p>
259dd6b2bfcSGreg Roach        </div>
260dd6b2bfcSGreg Roach    </div>
261dd6b2bfcSGreg Roach
262dd6b2bfcSGreg Roach    <table class="table table-bordered table-sm">
263dd6b2bfcSGreg Roach        <thead>
264dd6b2bfcSGreg Roach            <tr>
265dd6b2bfcSGreg Roach                <th>
266dd6b2bfcSGreg Roach                    <?= I18N::translate('Family tree') ?>
267dd6b2bfcSGreg Roach                </th>
268dd6b2bfcSGreg Roach                <th>
269dd6b2bfcSGreg Roach                    <?= I18N::translate('Role') ?>
270dd6b2bfcSGreg Roach                </th>
271dd6b2bfcSGreg Roach                <th>
272dd6b2bfcSGreg Roach                    <?= I18N::translate('Individual record') ?>
273dd6b2bfcSGreg Roach                </th>
274dd6b2bfcSGreg Roach                <th>
275dd6b2bfcSGreg Roach                    <?= I18N::translate('Restrict to immediate family') ?>
2760973b4d2SGreg Roach                    <?= view('help/link', ['topic' => 'relationship-privacy']) ?>
277dd6b2bfcSGreg Roach                </th>
278dd6b2bfcSGreg Roach            </tr>
279dd6b2bfcSGreg Roach            <tr>
280dd6b2bfcSGreg Roach                <td>
281dd6b2bfcSGreg Roach                </td>
282dd6b2bfcSGreg Roach                <td>
283dd6b2bfcSGreg Roach                </td>
284dd6b2bfcSGreg Roach                <td>
285dd6b2bfcSGreg Roach                    <p class="small text-muted">
286dd6b2bfcSGreg Roach                        <?= I18N::translate('Link this user to an individual in the family tree.') ?>
287dd6b2bfcSGreg Roach                    </p>
288dd6b2bfcSGreg Roach                </td>
289dd6b2bfcSGreg Roach                <td>
290dd6b2bfcSGreg Roach                </td>
291dd6b2bfcSGreg Roach            </tr>
292dd6b2bfcSGreg Roach        </thead>
293dd6b2bfcSGreg Roach        <tbody>
294dd6b2bfcSGreg Roach            <?php foreach ($trees as $tree) : ?>
295dd6b2bfcSGreg Roach                <tr>
296dd6b2bfcSGreg Roach                    <td>
2975c7ad034SGreg Roach                        <?= e($tree->title()) ?>
298dd6b2bfcSGreg Roach                    </td>
299dd6b2bfcSGreg Roach                    <td>
30072cf66d4SGreg Roach                        <select class="form-control" name="canedit<?= $tree->id() ?>">
301dd6b2bfcSGreg Roach                            <?php foreach ($roles as $role => $description) : ?>
302dd6b2bfcSGreg Roach                                <option value="<?= $role ?>"
3037c4add84SGreg Roach                                    <?= $role === $tree->getUserPreference($user, User::PREF_TREE_ROLE) ? 'selected' : '' ?>>
304dd6b2bfcSGreg Roach                                    <?= $description ?>
305dd6b2bfcSGreg Roach                                </option>
306dd6b2bfcSGreg Roach                            <?php endforeach ?>
307dd6b2bfcSGreg Roach                        </select>
308dd6b2bfcSGreg Roach                    </td>
309dd6b2bfcSGreg Roach                    <td>
310*6b9cb339SGreg Roach                        <?= view('components/select-individual', ['name' => 'gedcomid' . $tree->id(), 'individual' => Registry::individualFactory()->make($tree->getUserPreference($user, 'gedcomid'), $tree), 'tree' => $tree]) ?>
311dd6b2bfcSGreg Roach                    </td>
312dd6b2bfcSGreg Roach                    <td>
31372cf66d4SGreg Roach                        <select class="form-control" name="RELATIONSHIP_PATH_LENGTH<?= $tree->id() ?>" id="RELATIONSHIP_PATH_LENGTH<?= $tree->id() ?>" class="relpath">
314dd6b2bfcSGreg Roach                            <?php for ($n = 0; $n <= 10; ++$n) : ?>
3157c4add84SGreg Roach                                <option value="<?= $n ?>" <?= $tree->getUserPreference($user, User::PREF_TREE_PATH_LENGTH) == $n ? 'selected' : '' ?>>
316dd6b2bfcSGreg Roach                                    <?= $n ?: I18N::translate('No') ?>
317dd6b2bfcSGreg Roach                                </option>
318dd6b2bfcSGreg Roach                            <?php endfor ?>
319dd6b2bfcSGreg Roach                        </select>
320dd6b2bfcSGreg Roach                    </td>
321dd6b2bfcSGreg Roach                </tr>
322dd6b2bfcSGreg Roach            <?php endforeach ?>
323dd6b2bfcSGreg Roach        </tbody>
324dd6b2bfcSGreg Roach    </table>
325dd6b2bfcSGreg Roach
326dd6b2bfcSGreg Roach    <div class="row form-group">
327dd6b2bfcSGreg Roach        <div class="offset-sm-3 col-sm-9">
328dd6b2bfcSGreg Roach            <button type="submit" class="btn btn-primary">
329dd6b2bfcSGreg Roach                <?= I18N::translate('save') ?>
330dd6b2bfcSGreg Roach            </button>
331dd6b2bfcSGreg Roach        </div>
332dd6b2bfcSGreg Roach    </div>
333dd6b2bfcSGreg Roach</form>
334dd6b2bfcSGreg Roach
335c16be598SGreg Roach<?= view('modals/ajax') ?>
336c16be598SGreg Roach
337dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
338dd6b2bfcSGreg Roach<script>
339dd6b2bfcSGreg Roach    $(".relpath").change(function () {
340dd6b2bfcSGreg Roach        var fieldIDx = $(this).attr("id");
341dd6b2bfcSGreg Roach        var idNum    = fieldIDx.replace("RELATIONSHIP_PATH_LENGTH", "");
342dd6b2bfcSGreg Roach        var newIDx   = "gedcomid" + idNum;
343dd6b2bfcSGreg Roach        if ($("#" + newIDx).val() === "" && $("#".fieldIDx).val() !== "0") {
344dd6b2bfcSGreg Roach            alert("<?= I18N::translate('You must specify an individual record before you can restrict the user to their immediate family.') ?>");
345dd6b2bfcSGreg Roach            $(this).val("0");
346dd6b2bfcSGreg Roach        }
347dd6b2bfcSGreg Roach    });
348510d3f2fSGreg Roach
349510d3f2fSGreg Roach    $("#password").hideShowPassword('infer', true);
350dd6b2bfcSGreg Roach</script>
351dd6b2bfcSGreg Roach<?php View::endpush() ?>
352510d3f2fSGreg Roach
353