realign the user admin page
[mediagoblin.git] / mediagoblin / templates / mediagoblin / moderation / user.html
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" %}
19 {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
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
31 {%- block mediagoblin_head %}
32 <script src="{{ request.staticdirect('/js/setup_report_forms.js') }}">
33 </script>
34 {% endblock %}
35
36 {% block mediagoblin_content -%}
37 <div class="row">
38 <a href="{{ request.urlgen('mediagoblin.moderation.users') }}"
39 class="return_to_panel button_action"
40 title="Return to Users Panel">
41 {% trans %}Return to Users Panel{% endtrans %}</a>
42 </div>
43 <div class="row">
44 <div class="eight columns">
45 {# If no user... #}
46 {% if not user %}
47 <p>{% trans %}Sorry, no such user found.{% endtrans %}</p>
48 {# User exists, but needs verification #}
49 {% elif not user.has_privilege('active') %}
50 <div class="profile_sidebar empty_space">
51 <h1>{% trans %}Email verification needed{% endtrans %}</h1>
52 <p>
53 {% trans -%}
54 Someone has registered an account with this username, but it still has
55 to be activated.
56 {%- endtrans %}
57 </p>
58
59 </div>
60
61 {# Active(?) (or at least verified at some point) user, horray! #}
62 {% else %}
63 <h1>
64 {%- trans username=user.username %}{{ username }}'s profile{% endtrans -%}
65 {% if user_banned and user_banned.expiration_date %}
66 &mdash; {% trans expiration_date=user_banned.expiration_date -%}
67 BANNED until {{ expiration_date }}
68 {%- endtrans %}
69 {% elif user_banned %}
70 &mdash; {% trans %}Banned Indefinitely{% endtrans %}
71 {% endif %}
72 </h1>
73 {% if not user.url and not user.bio %}
74 <div class="profile_sidebar empty_space">
75 <p>
76 {% trans -%}
77 This user hasn't filled in their profile (yet).
78 {%- endtrans %}
79 </p>
80 {% else %}
81 <div class="profile_sidebar">
82 {% include "mediagoblin/utils/profile.html" %}
83 {% if request.user and
84 (request.user.id == user.id or request.user.has_privilege('admin')) %}
85 <a href="{{ request.urlgen('mediagoblin.edit.profile',
86 user=user.username) }}">
87 {%- trans %}Edit profile{% endtrans -%}
88 </a>
89 {% endif %}
90 {% endif %}
91 <p>
92 <a href="{{ request.urlgen('mediagoblin.user_pages.collection_list',
93 user=user.username) }}">
94 {%- trans %}Browse collections{% endtrans -%}
95 </a>
96 </p>
97 </div>
98 {% endif %}
99 </div>
100 {% if user %}
101 <div class="eight columns">
102 <h2>
103 {%- trans username=user.username -%}
104 Active Reports on {{ username }}
105 {%- endtrans -%}
106 </h2>
107 {% if reports.count() %}
108 <table class="admin_side_panel">
109 <tr>
110 <th>{%- trans %}Report ID{% endtrans -%}</th>
111 <th>{%- trans %}Reported Content{% endtrans -%}</th>
112 <th>{%- trans %}Description of Report{% endtrans -%}</th>
113 </tr>
114 {% for report in reports %}
115 <tr>
116 <td>
117 <img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" />
118 <a href="{{ request.urlgen('mediagoblin.moderation.reports_detail',
119 report_id=report.id) }}">
120 {%- trans report_number=report.id -%}
121 Report #{{ report_number }}
122 {%- endtrans -%}
123 </a>
124 </td>
125 <td>
126 {% if report.discriminator == "comment_report" %}
127 <a>{%- trans %}Reported Comment{% endtrans -%}</a>
128 {% elif report.discriminator == "media_report" %}
129 <a>{%- trans %}Reported Media Entry{% endtrans -%}</a>
130 {% endif %}
131 </td>
132 <td>{{ report.report_content[:21] }}
133 {% if report.report_content|count >20 %}...{% endif %}</td>
134 <td>{%- trans %}Resolve{% endtrans -%}</td>
135 </tr>
136 {% endfor %}
137 <tr><td></td><td></td>
138 </table>
139 {% else %}
140 {%- trans username=user.username -%}
141 No active reports filed on {{ username }}
142 {%- endtrans -%}
143 {% endif %}
144 <p>
145 <span>
146 <a href="{{ request.urlgen(
147 'mediagoblin.moderation.reports') }}?reported_user={{user.id}}">
148 {%- trans
149 username=user.username %}All reports on {{ username }}{% endtrans %}</a>
150 &middot;
151 <a href="{{ request.urlgen(
152 'mediagoblin.moderation.reports') }}?reporter={{user.id}}">
153 {%- trans username=user.username -%}
154 All reports that {{ username }} has filed
155 {%- endtrans %}</a>
156 </span>
157 <span class=clear></span>
158 </p>
159 </div>
160 </div>
161 <div class="row hell">
162 <h2>{% trans username=user.username -%}
163 {{ username }}'s Privileges{% endtrans %}</h2>
164 <div class="eight columns">
165 <form action="{{ request.urlgen('mediagoblin.moderation.give_or_take_away_privilege',
166 user=user.username) }}"
167 method=post >
168 <table class="admin_side_panel">
169 <tr>
170 <th>{% trans %}Privilege{% endtrans %}</th>
171 <th>{% trans %}User Has Privilege{% endtrans %}</th>
172 </tr>
173 {% for privilege in privileges %}
174 <tr>
175 <td>{{ privilege.privilege_name }}</td>
176 {% if privilege in user.all_privileges %}
177 <td class="user_with_privilege">
178 {% trans %}Yes{% endtrans %}{% else %}
179 <td class="user_without_privilege">
180 {% trans %}No{% endtrans %}{% endif %}
181 </td>
182 {% if request.user.has_privilege('admin') %}
183 <td>
184 {% if privilege in user.all_privileges %}
185 <input type=submit id="{{ privilege.privilege_name }}"
186 class="submit_button button_action"
187 value =" -" />
188 {% else %}
189 <input type=submit id="{{ privilege.privilege_name }}"
190 class="submit_button button_action"
191 value ="+" />
192 {% endif %}
193 </td>
194 {% endif %}
195 </tr>
196 {% endfor %}
197 </table>
198 {{ csrf_token }}
199 <input type=hidden name=privilege_name id=hidden_privilege_name />
200 </form>
201 </div>
202 <div class="eight columns">
203 <form method=POST action="{{ request.urlgen(
204 'mediagoblin.moderation.ban_or_unban',
205 user=user.username) }}">
206 {{ csrf_token }}
207 {% if request.user.has_privilege('admin') and not user_banned and
208 not user.id == request.user.id %}
209 {{ wtforms_util.render_divs(ban_form) }}
210 <input type=submit class="button_action"
211 value="{% trans %}Ban User{% endtrans %}"
212 id="ban_user_submit" />
213 {% elif request.user.has_privilege('admin') and
214 not user.id == request.user.id %}
215 <input type=submit class="button_action"
216 value="{% trans %}UnBan User{% endtrans %}" />
217 {% endif %}
218 </form>
219 </div>
220 {% endif %}
221 <script>
222 $(document).ready(function(){
223 $('.submit_button').click(function(){
224 $('#hidden_privilege_name').val($(this).attr('id'));
225 });
226 init_user_banned_form();
227 $('#ban_user_submit').click(function(){
228 submit_user_banned_form()
229 });
230 });
231 </script>
232 </div><!--whoami-->
233 {% endblock %}