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