mourningdove/views/manage/banusers.tt
2026-05-24 01:03:05 +00:00

104 lines
No EOL
3.2 KiB
Text

[%# manage/banusers.tt
Ban and unban users, and edit ban notes.
Conversion of htdocs/manage/banusers.bml
Authors:
Momiji <momijizukamori@gmail.com>
Copyright (c) 2015-2022 by Dreamwidth Studios, LLC.
This program is free software; you may redistribute it and/or modify it under
the same terms as Perl itself. For a copy of the license, please reference
'perldoc perlartistic' or 'perldoc perlgpl'.
%]
[%- sections.title = ".title" | ml -%]
[%- CALL dw.active_resource_group( "foundation" ) -%]
[%- dw.need_res( { group => "foundation" }
"stc/css/components/tables-as-list.css"
"js/components/jquery.select-all.js"
"stc/css/components/select-all.css"
) -%]
<form method="get">
[%- authas_html -%]
</form>
<form name='ban_users_form' method="post">
[% dw.form_auth() %]
[%# ban users %]
<h2>[% dw.ml('.header.ban') %]</h2>
<p>[% u.is_community ? dw.ml('.intro.ban.comm') : dw.ml('.intro.ban.self') %]</p>
[% form.textarea(
name => "ban_list",
rows => 3,
cols => 50,
value => editvals.user,
) %]
[%# add note if desired %]
<h2>[% dw.ml('.header.bannote') %]</h2>
<p>[% u.is_community ? dw.ml('.intro.bannote.comm') : dw.ml('.intro.bannote.self') %]</p>
<p>[% dw.ml('.editwarn') %]</p>
[% form.textarea(
name => "ban_note",
rows => 3,
cols => 50,
value => $separate_add_from_edit ? "" : editvals.note,
) %]
[% IF separate_add_from_edit %]
[% form.textarea(
label = dw.ml( '.note.previous' )
name => "ban_note_previous",
id => "ban_note_previous",
rows => 3,
cols => 50,
value => editvals.note,
) %]
[% END %]
[%# unban users %]
<h2>[% dw.ml('.header.unban') %]</h2>
[% IF banned %]
<p>[% u.is_community ? dw.ml('.intro.unban.comm') : dw.ml('.intro.unban.self') %]</p>
<table class="table table-as-list select-all">
<thead>
<tr>
<th scope="row"><span id="select-all" class="select-all-label">[% 'select_all.label' | ml %]</span>
<input type="checkbox" id="header_unban_user" data-select-all="unban_user" aria-labelledby="select-all" /></th>
<th>[% dw.ml('.key.user') %]</th>
<th colspan='2'>[% dw.ml('.note') %]</th>
</tr>
</thead>
<tbody>
[%- FOREACH ban = banned_array -%]
<tr>
<td>
[%- form.checkbox_nested( name='unban_user', value=ban.banuid, remember_old_state = 1 ) -%]
</td>
<td>[% ban.user.ljuser_display %]</td>
<td>[% ban.note %]</td>
[%# encourage the user to edit the existing note %]
<td>[% IF ban.note %] [% form.submit(name = "edit_ban_${ban.banuid}", value = dw.ml('.btn.edit') ) %][% END %]</td>
</tr>
[%- END -%]
</tbody>
</table>
[% ELSE %]
<p>[% u.is_community ? dw.ml('.intro.unban.comm.none') : dw.ml('.intro.unban.self.none') %]</p>
[% END %]
<p>[% form.submit(value = dw.ml('.btn.banunban') ) %]</p>
</form>