blob: 7517d15f831b8f2999c3d47a34e76972fb7e5165 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001[define category_css]css/ph_list.css[end]
2[include "../framework/header.ezt" "showusertabs" "t1"]
3[include "../framework/js-placeholders.ezt"]
4<div id="colcontrol">
5
6<h2>
7 [if-any viewing_self][else]
8 [if-any user_stars_enabled]
9 [if-any logged_in_user]
10 [if-any read_only][else]
11 [if-any user_stars_enabled]
12 [if-any logged_in_user]
13 [if-any read_only][else]
14 <a id="user_star"
15 style="color:[if-any is_user_starred]cornflowerblue[else]gray[end]"
16 title="[if-any is_user_starred]Un-s[else]S[end]tar this user">
17 [if-any is_user_starred]&#9733;[else]&#9734;[end]
18 </a>
19 [end]
20 [end]
21 [end]
22 [end]
23 [end]
24 [end]
25 [end]
26
27 [viewed_user_display_name]
28</h2>
29
30<p>
31 <b>Last visit:</b>
32 [last_visit_str]
33</p>
34
35[if-any last_bounce_str]
36 <p>
37 <b>Email to this user bounced:</b>
38 [last_bounce_str]
39 [define offer_clear_bouncing]No[end]
40 [if-any viewing_self][define offer_clear_bouncing]Yes[end][end]
41 [if-any perms._EditOtherUsers][define offer_clear_bouncing]Yes[end][end]
42 [is offer_clear_bouncing "Yes"]
43 <a href="[viewed_user.profile_url]clearBouncing" style="margin-left:2em">Clear</a>
44 [end]
45 </p>
46[end]
47
48[if-any vacation_message]
49 <p>
50 <b>Vacation message:</b>
51 [vacation_message]
52 </p>
53[end]
54
55[if-any linked_parent]
56 <p>
57 <b>Linked parent account:</b>
58 [include "../framework/user-link.ezt" linked_parent]
59 [if-any offer_unlink perms._EditOtherUsers]
60 <input type="button" class="unlink_account secondary"
61 data-parent="[linked_parent.email]"
62 data-child="[viewed_user.email]"
63 value="Unlink">
64 [end]
65 </p>
66[end]
67
68[if-any linked_children]
69 <p>
70 <b>Linked child accounts:</b>
71 [for linked_children]
72 [include "../framework/user-link.ezt" linked_children]
73 [if-any offer_unlink perms._EditOtherUsers]
74 <input type="button" class="unlink_account secondary"
75 data-parent="[viewed_user.email]"
76 data-child="[linked_children.email]"
77 value="Unlink">
78 [end]
79 [end]
80 </p>
81[end]
82
83[if-any incoming_invite_users]
84 <b>Accept linked sub-account:</b>
85 [for incoming_invite_users]
86 <div>
87 [include "../framework/user-link.ezt" incoming_invite_users]
88 [if-any can_edit_invites][# TODO(jrobbins): allow site admin to accept invites for other users.]
89 <input type="button" class="incoming_invite" data-email="[incoming_invite_users.email]" value="Accept">
90 [# TODO(jrobbins): Button to decline invite.]
91 [end]
92 </div>
93 [end]
94[else][if-any outgoing_invite_users]
95 <b>Waiting for acceptance by parent-account:</b>
96 [for outgoing_invite_users]
97 <div>
98 [include "../framework/user-link.ezt" outgoing_invite_users]
99 </div>
100 [end]
101[else][if-any possible_parent_accounts]
102 <b>Link this account to:</b>
103 <select id="parent_to_invite">
104 <option value="" selected="selected">----</option>
105 [for possible_parent_accounts]
106 <option value="[possible_parent_accounts]">[possible_parent_accounts]</option>
107 [end]
108 </select>
109 [if-any can_edit_invites][# TODO(jrobbins): allow site admin to create invites for other users.]
110 <button id="create_linked_account_invite" disabled="disabled">Link</button>
111 [end]
112[end][end][end]
113
114
115[if-any user_stars_enabled]
116<p>
117<b>Starred developers:</b>
118[if-any starred_users]
119[for starred_users]
120 [include "../framework/user-link.ezt" starred_users][if-index starred_users last][else], [end]
121[end]
122[else]<i>None</i>[end]
123</p>
124[end]
125<br>
126
127<div class="list">
128 <table style="width: 100%;" cellspacing="0" cellpadding="0">
129 <tbody><tr>
130 <th style="text-align: left;">Projects
131 </th>
132 </tr></tbody>
133 </table>
134</div>
135
136<table cellspacing="0" cellpadding="2" border="0" class="results striped" id="projecttable" width="100%">
137 <tbody>
138 <tr id="headingrow">
139 [if-any logged_in_user]
140 <th style="white-space:nowrap; width:3%;"></th>
141 [end]
142 <th style="white-space:nowrap; width:15%;">Role</th>
143 <th style="white-space:nowrap; width:25%;">Project</th>
144 <th style="white-space:nowrap; width:57%;">Summary</th>
145 </tr>
146 [if-any owner_of_projects committer_of_projects contributor_to_projects]
147 [if-any owner_of_projects]
148 [for owner_of_projects]
149 <tr data-url="[owner_of_projects.relative_home_url]" data-project-name="[owner_of_projects.project_name]">
150 [if-any logged_in_user]
151 <td class="rowwidgets">
152 <a class="star"
153 style="color:[if-any owner_of_projects.starred]cornflowerblue[else]gray[end]"
154 title="[if-any owner_of_projects.starred]Un-s[else]S[end]tar this project"
155 data-project-name="[owner_of_projects.project_name]">
156 [if-any owner_of_projects.starred]&#9733;[else]&#9734;[end]
157 </a>
158 </td>
159 [end]
160 <td>Owner</td>
161 <td class="id" name="owner">
162 <a href="[owner_of_projects.relative_home_url]/">[owner_of_projects.project_name]</a>
163 [is owner_of_projects.state_name "HIDDEN"]<span style="color:red"> - hidden</span>[end]
164 </td>
165 <td>[owner_of_projects.summary]</td>
166 </tr>
167 [end]
168 [end]
169 [if-any committer_of_projects]
170 [for committer_of_projects]
171 <tr data-url="[committer_of_projects.relative_home_url]" data-project-name="[committer_of_projects.project_name]">
172 [if-any logged_in_user]
173 <td class="rowwidgets">
174 <a class="star"
175 style="color:[if-any committer_of_projects.starred]cornflowerblue[else]gray[end]"
176 title="[if-any committer_of_projects.starred]Un-s[else]S[end]tar this project"
177 data-project-name="[committer_of_projects.project_name]">
178 [if-any committer_of_projects.starred]&#9733;[else]&#9734;[end]
179 </a>
180 </td>
181 [end]
182 <td>Committer</td>
183 <td class="id" name="committer">
184 <a href="[committer_of_projects.relative_home_url]/">[committer_of_projects.project_name]
185 </a>
186 </td>
187 <td>
188 [committer_of_projects.summary]
189 </td>
190 </tr>
191 [end]
192 [end]
193
194 [if-any contributor_to_projects]
195 [for contributor_to_projects]
196 <tr data-url="[contributor_to_projects.relative_home_url]" data-project-name="[contributor_to_projects.project_name]">
197 [if-any logged_in_user]
198 <td class="rowwidgets">
199 <a class="star"
200 style="color:[if-any contributor_to_projects.starred]cornflowerblue[else]gray[end]"
201 title="[if-any contributor_to_projects.starred]Un-s[else]S[end]tar this project"
202 data-project-name="[contributor_to_projects.project_name]">
203 [if-any contributor_to_projects.starred]&#9733;[else]&#9734;[end]
204 </a>
205 </td>
206 [end]
207 <td>Contributor</td>
208 <td class="id" name="contributor">
209 <a href="[contributor_to_projects.relative_home_url]/">[contributor_to_projects.project_name]
210 </a>
211 [is contributor_to_projects.state_name "HIDDEN"]<span style="color:red"> - hidden</span>[end]</td>
212 <td>
213 [contributor_to_projects.summary]
214 </td>
215 </tr>
216 [end]
217 [end]
218
219 [else]
220 <tr>
221 <td colspan="4"><i>No projects.</i></td>
222 <tr>
223 [end]
224 </tbody>
225</table>
226
227
228[if-any starred_projects]
229<br>
230<div class="list">
231 <table style="width: 100%;" cellspacing="0" cellpadding="0">
232 <tbody><tr>
233 <th style="text-align: left;">
234 Starred by [if-any viewing_self]me[else]
235 [viewed_user_display_name]
236 [end]
237 </th>
238 </tr></tbody>
239 </table>
240</div>
241<table cellspacing="0" cellpadding="2" border="0" class="results striped" id="starredtable" width="100%">
242 <tbody>
243 <tr id="headingrow">
244 [if-any logged_in_user]
245 <th style="white-space:nowrap; width:3%;"></th>
246 [end]
247 <th style="white-space:nowrap; width:25%;">Name</th>
248 <th style="white-space:nowrap; width:57%;">Summary</th>
249 </tr>
250
251 [for starred_projects]
252 <tr data-url="[starred_projects.relative_home_url]" data-project-name="[starred_projects.project_name]">
253 [if-any logged_in_user]
254 <td class="rowwidgets">
255 <a class="star"
256 style="color:[if-any starred_projects.starred]cornflowerblue[else]gray[end]"
257 title="[if-any starred_projects.starred]Un-s[else]S[end]tar this project"
258 data-project-name="[starred_projects.project_name]">
259 [if-any starred_projects.starred]&#9733;[else]&#9734;[end]
260 </a>
261 </td>
262 [end]
263 <td class="id" name="starred_project">
264 <a href="[starred_projects.relative_home_url]/">[starred_projects.project_name]</a>
265 [is starred_projects.state_name "HIDDEN"]<span style="color:red"> - hidden</span>[end]
266 </td>
267 <td>
268 [starred_projects.summary]
269 </td>
270 </tr>
271 [end]
272
273</table>
274[end]
275
276[if-any owner_of_archived_projects]
277<br>
278<div class="list">
279 <table style="width: 100%;" cellspacing="0" cellpadding="0">
280 <tbody><tr>
281 <th style="text-align: left;">Archived projects
282 </th>
283 </tr></tbody>
284 </table>
285</div>
286<table cellspacing="0" cellpadding="2" border="0" class="results striped" id="archivedtable" width="100%">
287 <tbody>
288 <tr id="headingrow">
289 <th style="white-space:nowrap; width:25%;">Name</th>
290 <th style="white-space:nowrap; width:60%;">Summary</th>
291 </tr>
292 [for owner_of_archived_projects]
293 <tr data-url="[owner_of_archived_projects.relative_home_url]/adminAdvanced">
294 <td class="id" name="deleted_project">[owner_of_archived_projects.project_name] -
295 <a href="[owner_of_archived_projects.relative_home_url]/adminAdvanced">Unarchive or delete</a>
296 </td>
297 <td>
298 [owner_of_archived_projects.summary]
299 </td>
300 </tr>
301 [end]
302</table>
303[end]
304
305[if-any user_groups]
306<br>
307<div class="list">
308 <table style="width: 100%;" cellspacing="0" cellpadding="0">
309 <tbody><tr>
310 <th style="text-align: left;">User groups
311 </th>
312 </tr></tbody>
313 </table>
314</div>
315<table cellspacing="0" cellpadding="2" border="0" class="results striped" id="usergrouptable" width="100%">
316 <tbody>
317 <tr id="headingrow">
318 <th style="white-space:nowrap; width:25%;">Name</th>
319 </tr>
320 [for user_groups]
321 <tr data-url="[user_groups.profile_url]">
322 <td class="id">
323 <a href="[user_groups.profile_url]">[user_groups.email]</a>
324 </td>
325 </tr>
326 [end]
327 </tbody>
328</table>
329[end]
330
331[if-any can_ban]
332 <form action="ban.do" method="POST">
333 <input type="hidden" name="token" value="[ban_token]">
334 <h4>Banned for abuse</h4>
335 <div style="margin:0 0 2em 2em">
336 <input type="checkbox" name="banned" id="banned" value="1"
337 [if-any settings_user_is_banned]checked="checked"[end] >
338 <label for="banned">This user is banned because:</label>
339 <input type="text" size="50" name="banned_reason" id="banned_reason" value="[settings_user_pb.banned]">
340 </div>
341
342 <div style="margin:0 0 2em 2em">
343 <input id="submit_btn" type="submit" name="btn"
344 value="Update banned status">
345 </div>
346
347 </form>
348
349 [if-any viewed_user_is_spammer]
350 <form action="banSpammer.do" method="POST">
351 <input type="hidden" name="token" value="[ban_spammer_token]">
352 <input type="hidden" size="50" name="banned_reason" id="banned_reason" value="">
353 <input type="submit" name="undoBanSpammerButton" id="undo_ban_spammer_btn" value="Un-ban this user as a spammer">
354 </form>
355 [end]
356
357
358 [if-any viewed_user_may_be_spammer]
359 <form action="banSpammer.do" method="POST">
360 <input type="hidden" name="token" value="[ban_spammer_token]">
361 <input type="hidden" name="banned" value="True">
362 <input type="hidden" size="50" name="banned_reason" id="banned_reason" value="Spam">
363 <input type="submit" name="banSpammerButton" id="ban_spammer_btn" value="Ban this user as a spammer">
364 </form>
365 [end]
366
367[end]
368
369[if-any perms._EditOtherUsers]
370<h3 style="clear:both">Edit user</h3>
371 <form action="edit.do" method="POST">
372 <input type="hidden" name="token" value="[form_token]">
373 <h4>Site administration</h4>
374 <div style="margin:0 0 2em 2em">
375 <input type="checkbox" name="site_admin" id="site_admin" value="1" [if-any viewed_user_pb.is_site_admin_bool]checked="checked"[end] >
376 <label for="site_admin">This user is a site administrator (a super user)</label>
377 </div>
378
379 [include "unified-settings.ezt"]
380
381 <div style="margin:0 0 2em 2em">
382 <input id="submit_btn" type="submit" name="btn"
383 value="Save changes">
384 </div>
385
386 </form>
387[end]
388
389[if-any can_delete_user]
390<h3 style="clear:both">Delete user account</h3>
391 <p>Deleting a user account deletes the user and most user owned items from the site.
392 The user's email will be removed from any issues that the user participated in.
393 Hotlists owned by the user will either be transferred to another editor or get deleted.
394 Any Project Rules that the user is involved in will get deleted.
395 </p>
396 <div style="margin:0 0 2em 2em">
397 <input id="delete_btn" type="submit" name="btn" value="Delete user account">
398 <div id="delete_error" class="fielderror"></div>
399 </div>
400[end]
401
402</div>
403</div>
404
405<script type="text/javascript" nonce="[nonce]">
406runOnLoad(function() {
407 if ($("user_star")) {
408 [# The user viewing this page wants to star the user *on* this page]
409 $("user_star").addEventListener("click", function () {
410 _TKR_toggleStar($("user_star"), null, null, "[viewed_user_id]", null, null);
411 });
412 }
413
414 var stars = document.getElementsByClassName("star");
415 for (var i = 0; i < stars.length; ++i) {
416 var star = stars[[]i];
417 star.addEventListener("click", function (event) {
418 var projectName = event.target.getAttribute("data-project-name");
419 _TKR_toggleStar(event.target, projectName);
420 });
421 }
422
423 function _handleProjectClick(event) {
424 var target = event.target;
425 if (target.tagName == "A")
426 return;
427
428 if (target.classList.contains("rowwidgets") || target.parentNode.classList.contains("rowwidgets"))
429 return;
430 if (target.tagName != "TR") target = target.parentNode;
431 _go(target.attributes[[]"data-url"].value,
432 (event.metaKey || event.ctrlKey || event.button == 1));
433 };
434 $("projecttable").addEventListener("click", _handleProjectClick);
435 if ($("starredtable")) {
436 $("starredtable").addEventListener("click", _handleProjectClick);
437 }
438 if ($("archivedtable")) {
439 $("archivedtable").addEventListener("click", _handleProjectClick);
440 }
441
442 if ($("banned_reason")) {
443 $("banned_reason").addEventListener("keyup", function() {
444 $("banned").checked = $("banned_reason").value != "";
445 });
446 }
447
448 if ($("ban_spammer_btn")) {
449 $("ban_spammer_btn").addEventListener("click", function(evt) {
450 var ok = window.confirm("This will remove all issues and comments " +
451 "created by this user. Continue?");
452 if (!ok) {
453 evt.preventDefault();
454 }
455 });
456 }
457
458 if ($("delete_btn")) {
459 $("delete_btn").addEventListener("click", async function(event) {
460 const expungeCall = window.prpcClient.call(
461 'monorail.Users', 'ExpungeUser', {email: "[viewed_user_display_name]"});
462 expungeCall.then((resp) => {
463 location.replace(location.origin);
464 }).catch((reason) => {
465 $("delete_error").textContent = reason;
466 });
467 });
468 }
469});
470</script>
471<script type="module" defer src="[version_base]/static/js/sitewide/linked-accounts.js" nonce="[nonce]"></script>
472
473
474[include "../framework/footer.ezt"]