Merge branch 'master' into OPW-Moderation-Update
[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
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
32 {% block mediagoblin_content -%}
33 {# If no user... #}
34 {% if not user %}
35 <p>{% trans %}Sorry, no such user found.{% endtrans %}</p>
36 {# User exists, but needs verification #}
37 {% elif user.status == "needs_email_verification" %}
38 <div class="form_box">
39 <h1>{% trans %}Email verification needed{% endtrans %}</h1>
40 <p>
41 {% trans -%}
42 Someone has registered an account with this username, but it still has
43 to be activated.
44 {%- endtrans %}
45 </p>
46
47 <p>
48 {% trans login_url=request.urlgen('mediagoblin.auth.login') -%}
49 If you are that person but you've lost your verification email, you can
50 <a href="{{ login_url }}">log in</a> and resend it.
51 {%- endtrans %}
52 </p>
53 </div>
54
55 {# Active(?) (or at least verified at some point) user, horray! #}
56 {% else %}
57 <a href="{{ request.urlgen('mediagoblin.moderation.users') }}"
58 class="return_to_panel button_action"
59 title="Return to Users Panel">
60 {% trans %}Return to Users Panel{% endtrans %}</a>
61 <h1>
62 {%- trans username=user.username %}{{ username }}'s profile{% endtrans -%}
63 {% if user_banned and user_banned.expiration_date %}
64 &mdash; BANNED until {{ user_banned.expiration_date }}
65 {% elif user_banned %}
66 &mdash; Banned Indefinitely
67 {% endif %}
68 </h1>
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
80 (request.user.id == user.id or request.user.has_privilege('admin')) %}
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 %}
96 <h2>{%- trans %}Active Reports on {% endtrans -%}{{ user.username }}</h2>
97 {% if reports.count() %}
98 <table class="admin_side_panel">
99 <tr>
100 <th>{%- trans %}Report ID{% endtrans -%}</th>
101 <th>{%- trans %}Reported Content{% endtrans -%}</th>
102 <th>{%- trans %}Description of Report{% endtrans -%}</th>
103 </tr>
104 {% for report in reports %}
105 <tr>
106 <td>
107 <img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" />
108 <a href="{{ request.urlgen('mediagoblin.moderation.reports_detail',
109 report_id=report.id) }}">
110 {%- trans %}Report #{% endtrans -%}{{ report.id }}
111 </a>
112 </td>
113 <td>
114 {% if report.discriminator == "comment_report" %}
115 <a>{%- trans %}Reported Comment{% endtrans -%}</a>
116 {% elif report.discriminator == "media_report" %}
117 <a>{%- trans %}Reported Media Entry{% endtrans -%}</a>
118 {% endif %}
119 </td>
120 <td>{{ report.report_content[:21] }}
121 {% if report.report_content|count >20 %}...{% endif %}</td>
122 <td>{%- trans %}Resolve{% endtrans -%}</td>
123 </tr>
124 {% endfor %}
125 <tr><td></td><td></td>
126 </table>
127 {% else %}
128 {%- trans %}No active reports filed on {% endtrans -%} {{ user.username }}
129 {% endif %}
130 <a class="right_align">{{ user.username }}'s report history</a>
131 <span class=clear></span>
132 <h2>{{ user.username }}'s Privileges</h2>
133 {% if request.user.has_privilege('admin') and not user_banned and
134 not user.id == request.user.id %}
135 <input type=button class="button_action right_align"
136 value="Ban User" />
137 {% elif request.user.has_privilege('admin') and
138 not user.id == request.user.id %}
139 <input type=button class="button_action right_align"
140 value="UnBan User" />
141 {% endif %}
142 <form action="{{ request.urlgen('mediagoblin.moderation.give_or_take_away_privilege',
143 user=user.username) }}"
144 method=post >
145 <table class="admin_side_panel">
146 <tr>
147 <th>{% trans %}Privilege{% endtrans %}</th>
148 <th>{% trans %}User Has Privilege{% endtrans %}</th>
149 </tr>
150 {% for privilege in privileges %}
151 <tr>
152 <td>{{ privilege.privilege_name }}</td>
153 {% if privilege in user.all_privileges %}
154 <td class="user_with_privilege">
155 Yes{% else %}
156 <td class="user_without_privilege">
157 No{% endif %}
158 </td>
159 {% if request.user.has_privilege('admin') %}
160 <td>
161 {% if privilege in user.all_privileges %}
162 <input type=submit id="{{ privilege.privilege_name }}"
163 class="submit_button button_action"
164 value =" -" />
165 {% else %}
166 <input type=submit id="{{ privilege.privilege_name }}"
167 class="submit_button button_action"
168 value ="+" />
169 {% endif %}
170 </td>
171 {% endif %}
172 </tr>
173 {% endfor %}
174 </table>
175 {{ csrf_token }}
176 <input type=hidden name=privilege_name id=hidden_privilege_name />
177 </form>
178 {% endif %}
179 <script>
180 $(document).ready(function(){
181 $('.submit_button').click(function(){
182 $('#hidden_privilege_name').val($(this).attr('id'));
183 });
184 });
185 </script>
186 {% endblock %}