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