user_moderate.html 4.59 KB
Newer Older
Matthew Mongeau committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
{% extends "user_profile/user.html" %}
<!-- user_moderate.html -->
{% block profilesection %}
    {% trans %}moderation{% endtrans %}
{% endblock %}
{% block usercontent %}
{% if request.user != view_user %}
    <h3>{% trans username=view_user.username, status=view_user.get_status_display() %}{{username}}'s current status is "{{status}}"{% endtrans %}
    </h3>
    {% if user_status_changed %}
        <p class="action-status"><span>{% trans %}User status changed{% endtrans %}</span></p>
    {% endif %}
    <form method="post">{% csrf_token %}
        <input type="hidden" name="sort" value="moderate"/>
        <table class="form-as-table">
        {{ change_user_status_form.as_table() }}
        </table>
        <p id="id_user_status_info">
        </p>
        <input type="submit" class="submit" name="change_status" value="{% trans %}Save{% endtrans %}" />
    </form>
{% endif %}
<h3>
{% if request.user == view_user %}
    {% trans reputation=view_user.reputation %}Your current reputation is {{reputation}} points{% endtrans %}
{% else %}
    {% trans reputation=view_user.reputation %}User's current reputation is {{reputation}} points{% endtrans %}
{% endif %}
</h3>
{% if user_rep_changed %}
    <p class="action-status"><span>{% trans %}User reputation changed{% endtrans %}</span></p>
{% endif %}
<form method="post">{% csrf_token %}
    <input type="hidden" name="sort" value="moderate"/>
    <table class="form-as-table">
    {{ change_user_reputation_form.as_table() }}
    </table>
    <input type="submit" class="submit" name="subtract_reputation" value="{% trans %}Subtract{% endtrans %}" />&nbsp;
    <input type="submit" class="submit" name="add_reputation" value="{% trans %}Add{% endtrans %}" />
</form>
{% if request.user != view_user %}
<hr/>
<h3>{% trans username=view_user.username %}Send message to {{username}}{% endtrans %}</h3>
<p>{% trans %}An email will be sent to the user with 'reply-to' field set to your email address. Please make sure that your address is entered correctly.{% endtrans %}</p>
    {% if message_sent %}
        <p class="action-status"><span>{% trans %}Message sent{% endtrans %}</span></p>
    {% endif %}
<form method="post">{% csrf_token %}
    <input type="hidden" name="sort" value="moderate"/>
    <div class="form-row-vertical">
    <label for="id_subject_line">{{ send_message_form.subject_line.label}}</label>
    {% if send_message_form.subject_line.errors %}
        <p class="error">{{send_message_form.subject_line.errors|join(', ')}}</p>
    {% endif %}
    {{ send_message_form.subject_line}}
    </div>
    <div class="form-row-vertical">
    <label for="id_body_text">{{ send_message_form.body_text.label}}</label>
    {% if send_message_form.body_text.errors %}
        <p class="error">{{send_message_form.body_text.errors|join(', ')}}</p>
    {% endif %}
    {{ send_message_form.body_text}}
    </div>
    <input type="submit" class="submit" name="send_message" value="{% trans %}Send message{% endtrans %}" />
</form>
{% endif %}
{% endblock %}
{% block endjs %}
    <script type="text/javascript" >
        $("#id_user_status_info").hide();
        $("#id_user_status").change(function () {
            var optionValue = $(this).attr('value');
            if (optionValue == "d") {
                $('#id_user_status_info').html("{% trans %}Administrators have privileges of normal users, but in addition they can assign/revoke any status to any user, and are exempt from the reputation limits.{% endtrans %}");
                $('#id_user_status_info').show('slow');
            } else if (optionValue == "m"){
                $('#id_user_status_info').html("{% trans %}Moderators have the same privileges as administrators, but cannot add or remove user status of 'moderator' or 'administrator'.{% endtrans %}");
                $('#id_user_status_info').show('slow');
            } else if (optionValue == "a"){
                $('#id_user_status_info').html("{% trans %}'Approved' status means the same as regular user.{% endtrans %}");
                $('#id_user_status_info').show('slow');
            } else if (optionValue == "s"){
                $('#id_user_status_info').html("{% trans %}Suspended users can only edit or delete their own posts.{% endtrans %}");
                $('#id_user_status_info').show('slow');
            } else if (optionValue == "b"){
                $('#id_user_status_info').html("{% trans %}Blocked users can only login and send feedback to the site administrators.{% endtrans %}");
                $('#id_user_status_info').show('slow');
            } else {
                $('#id_user_status_info').hide('slow');
            }
        })
    </script>
{% endblock %}