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