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