Commit | Line | Data |
---|---|---|
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 -%} | |
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 %} |
eedb6d1f | 62 | — {% trans expiration_date=user_banned.expiration_date -%} |
0b1fcaeb | 63 | BANNED until {{ expiration_date }} |
eedb6d1f | 64 | {%- endtrans %} |
3aa3871b | 65 | {% elif user_banned %} |
0b1fcaeb | 66 | — {% 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> |
eedb6d1f | 97 | {%- trans username=user.username -%} |
0b1fcaeb | 98 | Active Reports on {{ username }} |
eedb6d1f | 99 | {%- endtrans -%} |
0b1fcaeb | 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) }}"> |
eedb6d1f | 114 | {%- trans report_number=report.id -%} |
0b1fcaeb | 115 | Report #{{ report_number }} |
eedb6d1f | 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 %} | |
eedb6d1f CAW |
134 | {%- trans username=user.username -%} |
135 | 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 | · | |
144 | <a href="{{ request.urlgen( | |
145 | 'mediagoblin.moderation.reports') }}?reporter={{user.id}}"> | |
eedb6d1f CAW |
146 | {%- trans username=user.username -%} |
147 | All reports that {{ username }} has filed | |
148 | {%- endtrans %}</a> | |
6acf4ee6 | 149 | </span> |
3ce0c611 | 150 | <span class=clear></span> |
50ee6576 | 151 | <h2>{% trans username=user.username -%} |
152 | {{ username }}'s Privileges{% endtrans %}</h2> | |
1bb367f6 | 153 | <form method=POST action="{{ request.urlgen( |
154 | 'mediagoblin.moderation.ban_or_unban', | |
155 | user=user.username) }}" class="right_align"> | |
156 | {{ csrf_token }} | |
157 | {% if request.user.has_privilege('admin') and not user_banned and | |
e1561d04 | 158 | not user.id == request.user.id %} |
1bb367f6 | 159 | {{ wtforms_util.render_divs(ban_form) }} |
160 | <input type=submit class="button_action" | |
161 | value="{% trans %}Ban User{% endtrans %}" | |
162 | id="ban_user_submit" /> | |
163 | {% elif request.user.has_privilege('admin') and | |
164 | not user.id == request.user.id %} | |
165 | <input type=submit class="button_action right_align" | |
daf91e37 | 166 | value="{% trans %}UnBan User{% endtrans %}" /> |
1bb367f6 | 167 | {% endif %} |
168 | </form> | |
3aa3871b | 169 | <form action="{{ request.urlgen('mediagoblin.moderation.give_or_take_away_privilege', |
170 | user=user.username) }}" | |
e1561d04 | 171 | method=post > |
3aa3871b | 172 | <table class="admin_side_panel"> |
3ce0c611 | 173 | <tr> |
174 | <th>{% trans %}Privilege{% endtrans %}</th> | |
175 | <th>{% trans %}User Has Privilege{% endtrans %}</th> | |
3ce0c611 | 176 | </tr> |
6bba33d7 | 177 | {% for privilege in privileges %} |
178 | <tr> | |
6bba33d7 | 179 | <td>{{ privilege.privilege_name }}</td> |
3aa3871b | 180 | {% if privilege in user.all_privileges %} |
181 | <td class="user_with_privilege"> | |
0b1fcaeb | 182 | {% trans %}Yes{% endtrans %}{% else %} |
3aa3871b | 183 | <td class="user_without_privilege"> |
0b1fcaeb | 184 | {% trans %}No{% endtrans %}{% endif %} |
3aa3871b | 185 | </td> |
8394febb | 186 | {% if request.user.has_privilege('admin') %} |
187 | <td> | |
188 | {% if privilege in user.all_privileges %} | |
189 | <input type=submit id="{{ privilege.privilege_name }}" | |
190 | class="submit_button button_action" | |
191 | value =" -" /> | |
192 | {% else %} | |
193 | <input type=submit id="{{ privilege.privilege_name }}" | |
194 | class="submit_button button_action" | |
195 | value ="+" /> | |
196 | {% endif %} | |
3aa3871b | 197 | </td> |
198 | {% endif %} | |
3aa3871b | 199 | </tr> |
6bba33d7 | 200 | {% endfor %} |
3ce0c611 | 201 | </table> |
1bb367f6 | 202 | {{ csrf_token }} |
3aa3871b | 203 | <input type=hidden name=privilege_name id=hidden_privilege_name /> |
204 | </form> | |
3ce0c611 | 205 | {% endif %} |
3aa3871b | 206 | <script> |
207 | $(document).ready(function(){ | |
208 | $('.submit_button').click(function(){ | |
209 | $('#hidden_privilege_name').val($(this).attr('id')); | |
210 | }); | |
dc31cd1b | 211 | init_user_banned_form(); |
8e91df87 | 212 | $('#ban_user_submit').click(function(){ |
213 | submit_user_banned_form() | |
214 | }); | |
3aa3871b | 215 | }); |
216 | </script> | |
30a9fe7c | 217 | {% endblock %} |