blob: f3756e8579fb844c11375e3093331270f2390b0f [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001[define title]People[end]
2[define category_css]css/ph_list.css[end]
3[if-any is_hotlist][define category2_css]css/ph_detail.css[end][end]
4[include "../framework/header.ezt" "hidetabs"]
5[include "../framework/js-placeholders.ezt"]
6
7<form method="POST" action=[if-any is_hotlist]"people.do"[else]"list.do"[end] id="membership_form">
8<input type="hidden" name="token" value="[form_token]">
9[if-any newly_added_views]
10 <br/>
11 The following new members were successfully added:
12 <br/>
13 [for newly_added_views]
14 <a href="[newly_added_views.detail_url]">[newly_added_views.user.display_name]</a> ([newly_added_views.role])
15 <br/>
16 [end]
17 <br/>
18[end]
19
20<div id="colcontrol">
21 <div class="list">
22 [if-any pagination.visible]
23 <div class="pagination">
24 [if-any pagination.prev_url]<a href="[pagination.prev_url]"><b>&lsaquo;</b> Prev</a>[end]
25 Members [pagination.start] - [pagination.last] of [pagination.total_count]
26 [if-any pagination.next_url]<a href="[pagination.next_url]">Next <b>&rsaquo;</b></a>[end]
27 </div>
28 [end]
29
30 <h4 style="display: inline">[if-any is_hotlist]Hotlist[else]Project[end] People</h4>
31
32 [if-any read_only][else]
33 [if-any offer_membership_editing]
34 <input type="button" value="Add members"
35 id="add_members_button" class="primary">
36 <input type="submit" value="Remove members"
37 id="removebtn" class="secondary" name="removebtn" disabled="disabled">
38 [# TOOD(jrobbins): extra confirmation when removing yourself as owner.]
39 [if-any is_hotlist]
40 <a id="transfer-ownership" class="buttonify">Transfer ownership</a>
41 [include "../features/transfer-hotlist-form.ezt"]
42 [end]
43 [end]
44 [if-any is_hotlist]
45 [if-any offer_remove_self]
46 <a id="remove-self" class="buttonify">Remove myself</a>
47 [include "../features/remove-self-hotlist-form.ezt"]
48 [end]
49 [end]
50 [end]
51 </div>
52
53 <table cellspacing="0" cellpadding="2" border="0" class="results striped vt" id="resultstable" width="100%">
54 <tbody>
55 [if-any pagination.visible_results]
56
57 <tr id="headingrow">
58 [if-any offer_membership_editing]
59 <th style="border-right:0; padding-right:2px">&nbsp;</th>
60 [end]
61
62 <th style="white-space:nowrap">Name</th>
63 <th style="white-space:nowrap">Role</th>
64 [if-any is_hotlist]
65 [else]
66 <th style="white-space:nowrap">Autocomplete</th>
67 <th style="white-space:nowrap">Notes</th>
68 [end]
69 </tr>
70
71 [for pagination.visible_results]
72 [if-any is_hotlist]
73 [include "people-list-row-part.ezt" "hotlist"]
74 [else]
75 [include "people-list-row-part.ezt" "project"]
76 [end]
77 [end]
78
79 [else]
80 <tr>
81 <td colspan="40" class="id">
82 <div style="padding: 3em; text-align: center">
83 This [if-any is_hotlist]hotlist[else]project[end] does not have any members.
84 </div>
85 </td>
86 </tr>
87 [end]
88
89
90 </tbody>
91 </table>
92 <div class="list-foot">
93 <div class="pagination">
94 [if-any pagination.prev_url]<a href="[pagination.prev_url]"><b>&lsaquo;</b> Prev</a>[end]
95 [pagination.start] - [pagination.last] of [pagination.total_count]
96 [if-any pagination.next_url]<a href="[pagination.next_url]">Next <b>&rsaquo;</b></a>[end]
97 </div>
98 </div>
99</div>
100
101[if-any untrusted_user_groups]
102 <div style="width:45em">
103 [include "untrusted-user-groups-part.ezt"]
104 </div>
105[end]
106
107[if-any read_only][else]
108 [if-any is_hotlist]
109 [include "people-add-members-form.ezt" "hotlist"]
110 [else]
111 [include "people-add-members-form.ezt" "project"]
112 [end]
113 [# TODO(jojwang): make more elegant later, just one line]
114[end]
115
116</form>
117
118[if-any offer_membership_editing]
119 <script type="text/javascript" nonce="[nonce]">
120runOnLoad(function() {
121 $("add_members_button").addEventListener("click", _openAddMembersForm);
122
123 function _countChecked(opt_className) {
124 var numChecked = 0;
125 var inputs = document.getElementsByTagName('input');
126 for (var i = 0; i < inputs.length; i++) {
127 var el = inputs[[]i];
128 if (el.type == 'checkbox' && el.name == 'remove' && el.checked &&
129 (!opt_className || opt_className == el.className)) {
130 numChecked++;
131 }
132 }
133 return numChecked;
134 }
135
136 function _enableRemoveButton() {
137 var removeButton = document.getElementById('removebtn');
138 if (_countChecked() > 0) {
139 removeButton.disabled = false;
140 } else {
141 removeButton.disabled = true;
142 }
143 }
144
145 setInterval(_enableRemoveButton, 700);
146
147 function _preventAbandonment(event) {
148 var meCheckbox = document.getElementById("me_checkbox");
149 if (meCheckbox && meCheckbox.checked) {
150 numOwnersChecked = _countChecked("owner");
151 if (numOwnersChecked == [total_num_owners]) {
152 alert("You cannot remove all project owners.");
153 event.preventDefault();
154 } else {
155 if (!confirm("Remove yourself as project owner?\n" +
156 "You will be locked out of making further changes.")) {
157 event.preventDefault();
158 }
159 }
160 }
161 return true;
162 }
163 [if-any check_abandonment]
164 $("membership_form").addEventListener("submit", _preventAbandonment);
165 [end]
166
167 [if-any is_hotlist]
168 initializeDialogBox("[hotlist_id]");
169 [end]
170});
171 </script>
172[end]
173[if-any is_hotlist][if-any offer_remove_self]
174 <script type="text/javascript" nonce="[nonce]">
175 runOnLoad(function () {initializeDialogBoxRemoveSelf()});
176 </script>
177[end][end]
178
179<script type="text/javascript" nonce="[nonce]">
180runOnLoad(function() {
181 function _handleResultsClick(event) {
182 var target = event.target;
183 if (target.tagName == "A")
184 return;
185 if (target.classList.contains("rowwidgets") || target.parentNode.classList.contains("rowwidgets"))
186 return;
187 if (target.tagName != "TR") target = target.parentNode;
188 _go(target.attributes[[]"data-url"].value,
189 (event.metaKey || event.ctrlKey || event.button == 1));
190 };
191 _addClickListener($("resultstable"), _handleResultsClick);
192
193});
194</script>
195
196
197[include "../framework/footer.ezt"]