forked from leftypol/leftypol
parent
3725d27e72
commit
bf4fb6d0e8
6 changed files with 68 additions and 2 deletions
|
@ -669,6 +669,19 @@
|
|||
// a link to an email address or IRC chat room to appeal the ban.
|
||||
$config['ban_page_extra'] = '';
|
||||
|
||||
// Pre-configured ban reasons that pre-fill the ban form when clicked.
|
||||
// To disable, set $config['ban_reasons'] = false;
|
||||
$config['ban_reasons'] = array(
|
||||
array( 'reason' => 'Low-quality posting',
|
||||
'length' => '1d'),
|
||||
array( 'reason' => 'Off-topic',
|
||||
'length' => '1d'),
|
||||
array( 'reason' => 'Ban evasion',
|
||||
'length' => '30d'),
|
||||
array( 'reason' => 'Illegal content',
|
||||
'length' => ''),
|
||||
);
|
||||
|
||||
// Allow users to appeal bans through Tinyboard.
|
||||
$config['ban_appeals'] = false;
|
||||
|
||||
|
|
|
@ -1872,6 +1872,7 @@ function mod_ban_post($board, $delete, $post, $token = false) {
|
|||
'board' => $board,
|
||||
'delete' => (bool)$delete,
|
||||
'boards' => listBoards(),
|
||||
'reasons' => $config['ban_reasons'],
|
||||
'token' => $security_token
|
||||
);
|
||||
|
||||
|
|
12
js/mod/mod_snippets.js
Normal file
12
js/mod/mod_snippets.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* mod_snippets.js
|
||||
*
|
||||
* Javascript snippets to be loaded when in mod mode
|
||||
*
|
||||
*/
|
||||
|
||||
function populateFormJQuery(frm, data) {
|
||||
$.each(data, function(key, value){
|
||||
$('[name='+key+']', frm).val(value);
|
||||
});
|
||||
}
|
|
@ -1958,6 +1958,16 @@ div.mix {
|
|||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
.ban-reason-table .warning-reason-table tr td:first-child {
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
}
|
||||
.ban-reason-table .warning-reason-table tr:hover td {
|
||||
cursor: pointer;
|
||||
background-color: rgba(100%,100%,100%,0.2);
|
||||
}
|
||||
|
||||
footer {
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
{% for javascript in config.additional_javascript_defer %}<script defer type="text/javascript" src="{{ config.additional_javascript_url }}{{ javascript }}"></script>{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if mod %}
|
||||
<script type="text/javascript" src="/js/mod/mod_snippets.js"></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if config.recaptcha %}
|
||||
<script src="//www.google.com/recaptcha/api.js"></script>
|
||||
|
|
|
@ -4,7 +4,17 @@
|
|||
{% set action = '?/ban' %}
|
||||
{% endif %}
|
||||
|
||||
<form action="{{ action }}" method="post">
|
||||
{% if reasons %}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
{% for key, reason in reasons %}
|
||||
var data_{{ key }} = '{"reason":"{{ reason.reason|escape('js') }}","message":"{{ reason.reason|escape('js') }}","length":"{{ reason.length|escape('js') }}"}';
|
||||
$('#reason-selector-id-{{ key }}').click(function() { populateFormJQuery('#ban-form-id', $.parseJSON(data_{{ key }})); });
|
||||
{% endfor %}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
<form action="{{ action }}" method="post" id="ban-form-id">
|
||||
<input type="hidden" name="token" value="{{ token }}">
|
||||
{% if redirect %}
|
||||
<input type="hidden" name="redirect" value="{{ redirect|e }}">
|
||||
|
@ -41,7 +51,7 @@
|
|||
{% if post and board and not delete %}
|
||||
<tr>
|
||||
<th>
|
||||
<label for="reason">{% trans 'Message' %}</label>
|
||||
<label for="message">{% trans 'Message' %}</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="checkbox" id="public_message" name="public_message"{% if config.mod.check_ban_message %} checked{% endif %}>
|
||||
|
@ -93,3 +103,20 @@
|
|||
</table>
|
||||
</form>
|
||||
|
||||
{% if reasons %}
|
||||
<center>
|
||||
<h3>Predefined Reasons:</h3>
|
||||
<table class="ban-reason-table">
|
||||
<tr id="reason-selector-heading">
|
||||
<th><b>Length</b></th>
|
||||
<th><b>Reason</b></th>
|
||||
</tr>
|
||||
{% for key, reason in reasons %}
|
||||
<tr id="reason-selector-id-{{ key }}">
|
||||
<td>{% if not reason.length %}forever{% else %}{{ reason.length|e }}{% endif %}</td>
|
||||
<td>{{ reason.reason|e }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</center>
|
||||
{% endif %}
|
Loading…
Add table
Add a link
Reference in a new issue