|
177 | 177 | Deselect All |
178 | 178 | </button> |
179 | 179 | <span class="stats"> |
180 | | - <strong i18n:translate="">Selected:</strong> |
| 180 | + <strong i18n:translate="">Selected:</strong> |
181 | 181 | <span id="selected-count">0</span> |
182 | 182 | / <span tal:content="python:len(all_users)">0</span> |
183 | 183 | </span> |
|
195 | 195 | </div> |
196 | 196 | </div> |
197 | 197 |
|
198 | | - <form id="users-form" method="post"> |
| 198 | + <form id="users-form" method="post" tal:attributes="action string:${context/absolute_url}/@@signing-users-csv"> |
| 199 | + <!-- Hidden inputs for form submission --> |
| 200 | + <input type="hidden" name="_authenticator" tal:attributes="value context/@@authenticator/token" /> |
| 201 | + <input type="hidden" name="action" id="form-action" value="" /> |
| 202 | + <input type="hidden" name="selected_users" id="selected-users" value="" /> |
| 203 | + |
199 | 204 | <table class="listing" id="users-table" style="width: 100%;"> |
200 | 205 | <thead> |
201 | 206 | <tr> |
|
217 | 222 | style python:'background-color: #ffe6e6' if user.get('has_duplicate_email') else ''"> |
218 | 223 | <td> |
219 | 224 | <input type="checkbox" |
220 | | - name="selected_users" |
| 225 | + name="user_checkbox" |
221 | 226 | class="user-checkbox" |
222 | 227 | tal:attributes="value user/userid; |
223 | 228 | checked python:'checked' if user['checked'] else None" /> |
|
286 | 291 | function updateSelectedCount() { |
287 | 292 | var count = document.querySelectorAll('.user-checkbox:checked').length; |
288 | 293 | selectedCount.textContent = count; |
289 | | - |
| 294 | +
|
290 | 295 | // Update select all checkbox state |
291 | 296 | var allChecked = Array.from(checkboxes).every(function(cb) { return cb.checked; }); |
292 | 297 | var someChecked = Array.from(checkboxes).some(function(cb) { return cb.checked; }); |
|
311 | 316 | return; |
312 | 317 | } |
313 | 318 |
|
314 | | - var url = window.location.href.split('?')[0]; |
315 | | - var params = 'action=' + action + '&selected_users=' + encodeURIComponent(JSON.stringify(selected)); |
316 | | - |
317 | 319 | if (action === 'download_csv') { |
318 | | - window.location.href = url + '?' + params; |
| 320 | + // For CSV download, set the action and selected users, then submit |
| 321 | + document.getElementById('form-action').value = action; |
| 322 | + document.getElementById('selected-users').value = JSON.stringify(selected); |
| 323 | + form.submit(); |
319 | 324 | } else if (action === 'send_emails') { |
320 | 325 | // Show confirmation modal |
321 | 326 | document.getElementById('email-count').textContent = selected.length; |
|
376 | 381 |
|
377 | 382 | confirmEmailBtn.addEventListener('click', function() { |
378 | 383 | var selected = getSelectedUserIds(); |
379 | | - var url = window.location.href.split('?')[0]; |
380 | | - var params = 'action=send_emails&selected_users=' + encodeURIComponent(JSON.stringify(selected)); |
381 | | - window.location.href = url + '?' + params; |
| 384 | + // Set the action and selected users in hidden inputs |
| 385 | + document.getElementById('form-action').value = 'send_emails'; |
| 386 | + document.getElementById('selected-users').value = JSON.stringify(selected); |
| 387 | + // Submit the form via POST |
| 388 | + form.submit(); |
382 | 389 | }); |
383 | 390 |
|
384 | 391 | // Close modal on outside click |
|
0 commit comments