This was a quick update to clean up some of my templates and fix the formatting
[mediagoblin.git] / mediagoblin / templates / mediagoblin / moderation / user.html
CommitLineData
30a9fe7c 1{#
2# GNU MediaGoblin -- federated, autonomous media hosting
3# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU Affero General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU Affero General Public License for more details.
14#
15# You should have received a copy of the GNU Affero General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17#}
18{% extends "mediagoblin/base.html" %}
1bb367f6 19{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
3ce0c611 20
21{% block title %}
22 {%- if user -%}
23 {%- trans username=user.username -%}
24 User: {{ username }}
25 {%- endtrans %} &mdash; {{ super() }}
26 {%- else -%}
27 {{ super() }}
28 {%- endif -%}
29{% endblock %}
30
dc31cd1b 31{%- block mediagoblin_head %}
0b1fcaeb 32 <script src="{{ request.staticdirect('/js/setup_report_forms.js') }}">
33 </script>
dc31cd1b 34{% endblock %}
3ce0c611 35
36{% block mediagoblin_content -%}
37 {# If no user... #}
38 {% if not user %}
39 <p>{% trans %}Sorry, no such user found.{% endtrans %}</p>
3ce0c611 40 {# User exists, but needs verification #}
25625107 41 {% elif not user.has_privilege('active') %}
6acf4ee6 42 <div class="profile_sidebar empty_space">
3ce0c611 43 <h1>{% trans %}Email verification needed{% endtrans %}</h1>
3ce0c611 44 <p>
45 {% trans -%}
3aa3871b 46 Someone has registered an account with this username, but it still has
47 to be activated.
3ce0c611 48 {%- endtrans %}
49 </p>
3aa3871b 50
3ce0c611 51 </div>
52
53 {# Active(?) (or at least verified at some point) user, horray! #}
54 {% else %}
8394febb 55 <a href="{{ request.urlgen('mediagoblin.moderation.users') }}"
56 class="return_to_panel button_action"
57 title="Return to Users Panel">
58 {% trans %}Return to Users Panel{% endtrans %}</a>
3ce0c611 59 <h1>
60 {%- trans username=user.username %}{{ username }}'s profile{% endtrans -%}
3aa3871b 61 {% if user_banned and user_banned.expiration_date %}
0b1fcaeb 62 &mdash; {% trans expiration_date=user_banned.expiration_date %}
63 BANNED until {{ expiration_date }}
64 {% endtrans %}
3aa3871b 65 {% elif user_banned %}
0b1fcaeb 66 &mdash; {% trans %}Banned Indefinitely{% endtrans %}
3aa3871b 67 {% endif %}
3ce0c611 68 </h1>
3ce0c611 69 {% if not user.url and not user.bio %}
70 <div class="profile_sidebar empty_space">
71 <p>
72 {% trans -%}
73 This user hasn't filled in their profile (yet).
74 {%- endtrans %}
75 </p>
76 {% else %}
77 <div class="profile_sidebar">
78 {% include "mediagoblin/utils/profile.html" %}
79 {% if request.user and
8394febb 80 (request.user.id == user.id or request.user.has_privilege('admin')) %}
3ce0c611 81 <a href="{{ request.urlgen('mediagoblin.edit.profile',
82 user=user.username) }}">
83 {%- trans %}Edit profile{% endtrans -%}
84 </a>
85 {% endif %}
86 {% endif %}
87 <p>
88 <a href="{{ request.urlgen('mediagoblin.user_pages.collection_list',
89 user=user.username) }}">
90 {%- trans %}Browse collections{% endtrans -%}
91 </a>
92 </p>
93 </div>
94 {% endif %}
95 {% if user %}
0b1fcaeb 96 <h2>
97 {%- trans username=user.username %}
98 Active Reports on {{ username }}
99 {% endtrans -%}
100 </h2>
3ce0c611 101 {% if reports.count() %}
102 <table class="admin_side_panel">
30a9fe7c 103 <tr>
3ce0c611 104 <th>{%- trans %}Report ID{% endtrans -%}</th>
105 <th>{%- trans %}Reported Content{% endtrans -%}</th>
106 <th>{%- trans %}Description of Report{% endtrans -%}</th>
30a9fe7c 107 </tr>
3ce0c611 108 {% for report in reports %}
109 <tr>
110 <td>
111 <img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" />
6bba33d7 112 <a href="{{ request.urlgen('mediagoblin.moderation.reports_detail',
3ce0c611 113 report_id=report.id) }}">
0b1fcaeb 114 {%- trans report_number=report.id %}
115 Report #{{ report_number }}
116 {% endtrans -%}
3ce0c611 117 </a>
118 </td>
119 <td>
120 {% if report.discriminator == "comment_report" %}
121 <a>{%- trans %}Reported Comment{% endtrans -%}</a>
122 {% elif report.discriminator == "media_report" %}
123 <a>{%- trans %}Reported Media Entry{% endtrans -%}</a>
124 {% endif %}
125 </td>
e1561d04 126 <td>{{ report.report_content[:21] }}
127 {% if report.report_content|count >20 %}...{% endif %}</td>
3ce0c611 128 <td>{%- trans %}Resolve{% endtrans -%}</td>
129 </tr>
130 {% endfor %}
131 <tr><td></td><td></td>
132 </table>
133 {% else %}
0b1fcaeb 134 {%- trans
135 username=user.username %}No active reports filed on {{ username }}
136 {% endtrans -%}
3ce0c611 137 {% endif %}
6acf4ee6 138 <span class="right_align">
139 <a href="{{ request.urlgen(
140 'mediagoblin.moderation.reports') }}?reported_user={{user.id}}">
141 {%- trans
142 username=user.username %}All reports on {{ username }}{% endtrans %}</a>
143 &middot;
144 <a href="{{ request.urlgen(
145 'mediagoblin.moderation.reports') }}?reporter={{user.id}}">
146 {%- trans
0b1fcaeb 147 username=user.username %}All reports that {{ username }} has filed
148 {% endtrans %}</a>
6acf4ee6 149 </span>
3ce0c611 150 <span class=clear></span>
151 <h2>{{ user.username }}'s Privileges</h2>
1bb367f6 152 <form method=POST action="{{ request.urlgen(
153 'mediagoblin.moderation.ban_or_unban',
154 user=user.username) }}" class="right_align">
155 {{ csrf_token }}
156 {% if request.user.has_privilege('admin') and not user_banned and
e1561d04 157 not user.id == request.user.id %}
1bb367f6 158 {{ wtforms_util.render_divs(ban_form) }}
159 <input type=submit class="button_action"
160 value="{% trans %}Ban User{% endtrans %}"
161 id="ban_user_submit" />
162 {% elif request.user.has_privilege('admin') and
163 not user.id == request.user.id %}
164 <input type=submit class="button_action right_align"
165 value="{% trans %}UnBan User{% endtrans %}" />
166 {% endif %}
167 </form>
3aa3871b 168 <form action="{{ request.urlgen('mediagoblin.moderation.give_or_take_away_privilege',
169 user=user.username) }}"
e1561d04 170 method=post >
3aa3871b 171 <table class="admin_side_panel">
3ce0c611 172 <tr>
173 <th>{% trans %}Privilege{% endtrans %}</th>
174 <th>{% trans %}User Has Privilege{% endtrans %}</th>
3ce0c611 175 </tr>
6bba33d7 176 {% for privilege in privileges %}
177 <tr>
6bba33d7 178 <td>{{ privilege.privilege_name }}</td>
3aa3871b 179 {% if privilege in user.all_privileges %}
180 <td class="user_with_privilege">
0b1fcaeb 181 {% trans %}Yes{% endtrans %}{% else %}
3aa3871b 182 <td class="user_without_privilege">
0b1fcaeb 183 {% trans %}No{% endtrans %}{% endif %}
3aa3871b 184 </td>
8394febb 185 {% if request.user.has_privilege('admin') %}
186 <td>
187 {% if privilege in user.all_privileges %}
188 <input type=submit id="{{ privilege.privilege_name }}"
189 class="submit_button button_action"
190 value =" -" />
191 {% else %}
192 <input type=submit id="{{ privilege.privilege_name }}"
193 class="submit_button button_action"
194 value ="+" />
195 {% endif %}
3aa3871b 196 </td>
197 {% endif %}
3aa3871b 198 </tr>
6bba33d7 199 {% endfor %}
3ce0c611 200 </table>
1bb367f6 201 {{ csrf_token }}
3aa3871b 202 <input type=hidden name=privilege_name id=hidden_privilege_name />
203 </form>
3ce0c611 204 {% endif %}
3aa3871b 205 <script>
206$(document).ready(function(){
207 $('.submit_button').click(function(){
208 $('#hidden_privilege_name').val($(this).attr('id'));
209 });
dc31cd1b 210 init_user_banned_form();
8e91df87 211 $('#ban_user_submit').click(function(){
212 submit_user_banned_form()
213 });
3aa3871b 214});
215 </script>
30a9fe7c 216{% endblock %}