leftypol_vichan/templates/mod/ban_form.html

122 lines
3.9 KiB
HTML
Raw Normal View History

{% if post and board %}
{% set action = '?/' ~ board ~ '/ban/' ~ post %}
{% elseif edit_ban %}
{% set action = '' %}
{% else %}
{% set action = '?/ban' %}
{% endif %}
{% 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">
2012-08-27 05:19:05 +00:00
<input type="hidden" name="token" value="{{ token }}">
2012-04-12 23:29:08 +00:00
{% if redirect %}
<input type="hidden" name="redirect" value="{{ redirect|e }}">
{% endif %}
{% if post and board %}
<input type="hidden" name="delete" value="{% if delete %}1{% else %}0{% endif %}">
{% endif %}
2012-04-12 23:29:08 +00:00
<table>
{% if not edit_ban %}
2012-04-12 23:29:08 +00:00
<tr>
<th>
2012-05-05 15:33:10 +00:00
<label for="ip">{% trans 'IP' %} <span class="unimportant">{% trans '(or subnet)' %}</span></label>
2012-04-12 23:29:08 +00:00
</th>
<td>
{% if not hide_ip %}
<input type="text" name="ip" id="ip" size="30" maxlength="43" value="{{ ip|cloak_ip|e }}">
{% else %}
2012-05-05 15:33:10 +00:00
<em>{% trans 'hidden' %}</em>
{% endif %}
2012-04-12 23:29:08 +00:00
</td>
</tr>
{% endif %}
2012-04-12 23:29:08 +00:00
<tr>
<th>
2012-05-05 15:33:10 +00:00
<label for="reason">{% trans 'Reason' %}</label>
2012-04-12 23:29:08 +00:00
</th>
<td>
<textarea name="reason" id="reason" rows="3" cols="30">{{ reason|e }}</textarea>
2012-04-12 23:29:08 +00:00
</td>
</tr>
{% if post and board and not delete %}
<tr>
<th>
<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 %}>
<input type="text" name="message" id="message" size="35" maxlength="200" value="{{ config.mod.default_ban_message|e }}">
2012-05-05 15:33:10 +00:00
<span class="unimportant">({% trans 'public; attached to post' %})</span>
<script type="text/javascript">
document.getElementById('message').disabled = !document.getElementById('public_message').checked;
document.getElementById('public_message').onchange = function() {
document.getElementById('message').disabled = !this.checked;
}
</script>
</td>
</tr>
{% endif %}
2012-04-12 23:29:08 +00:00
<tr>
<th>
2012-05-05 15:33:10 +00:00
<label for="length">{% trans 'Length' %}</label>
2012-04-12 23:29:08 +00:00
</th>
<td>
<input type="text" name="length" id="length" size="20" maxlength="20" value="1h">
<span class="unimportant">(eg. "2d1h30m" or "2 days", empty is permaban)</span></td>
2012-04-12 23:29:08 +00:00
</tr>
<tr>
2012-05-05 15:33:10 +00:00
<th>{% trans 'Board' %}</th>
2012-04-12 23:29:08 +00:00
<td>
<ul style="list-style:none;padding:2px 5px">
<li>
<input type="radio" name="board" value="*" id="ban-allboards" {% if (edit_ban and not current_board) or not edit_ban %}checked{% endif %}>
2012-04-12 23:29:08 +00:00
<label style="display:inline" for="ban-allboards">
2012-05-05 15:33:10 +00:00
<em>{% trans 'all boards' %}</em>
2012-04-12 23:29:08 +00:00
</label>
</li>
{% for board in boards %}
2012-04-12 23:29:08 +00:00
<li>
<input type="radio" name="board" value="{{ board.uri }}" id="ban-board-{{ board.uri }}" {% if edit_ban and current_board == board.uri %}checked{% endif %}>
<label style="display:inline" for="ban-board-{{ board.uri }}">
{{ config.board_abbreviation|sprintf(board.uri) }} - {{ board.title|e }}
2012-04-12 23:29:08 +00:00
</label>
</li>
{% endfor %}
</ul>
</td>
</tr>
<tr>
<td></td>
<td><input name="new_ban" type="submit" value="{% if edit_ban %}{% trans 'Edit Ban' %}{% else %}{% trans 'New Ban' %}{% endif %}"></td>
2012-04-12 23:29:08 +00:00
</tr>
</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 %}