Whew. This is a big update. I did some significant keeping work. I moved all of
[mediagoblin:mediagoblin.git] / mediagoblin / templates / mediagoblin / moderation / report.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 mediagoblin_content %}
22 {% if not report %}
23   Sorry, no such report found.
24 {% else %}
25   <h2> Report #{{ report.id }}</h2>
26   {% if comment %}
27     Reported comment:
28     {% set reported_user = comment.get_author %}
29     <div id="comment-{{ comment.id }}"
30         class="comment_wrapper">
31       <div class="comment_author">
32         <img src="{{ request.staticdirect('/images/icon_comment.png') }}" />
33             <a href="{{ request.urlgen('mediagoblin.moderation.users_detail',
34                             user=comment.get_author.username) }}"
35                class="comment_authorlink">
36           {{- reported_user.username -}}
37         </a>
38         <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
39                         comment=comment.id,
40                         user=comment.get_media_entry.get_uploader.username,
41                         media=comment.get_media_entry.slug_or_id) }}#comment"
42            class="comment_whenlink">
43           <span title='{{- comment.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
44             {%- trans formatted_time=timesince(comment.created) -%}
45               {{ formatted_time }} ago
46             {%- endtrans -%}
47           </span></a>:
48       </div>
49       <div class=comment_content>
50         {% autoescape False %}
51           {{ comment.content_html }}
52         {% endautoescape %}
53       </div>
54     </div>
55   {% elif media_entry %}
56     <div class="media_thumbnail">
57       <a href="request.urlgen('mediagoblin.user_pages.media_home'),
58                                                               user=media_entry.get_uploader.username,
59                                                               media=media_entry.slug_or_id)"><img src="{{ media_entry.thumb_url}}"/></a>
60       <a href="request.urlgen('mediagoblin.user_pages.media_home'),
61                     user=media_entry.get_uploader.username,
62                     media=media_entry.slug_or_id)" class=thumb_entry_title>{{ media_entry.title }}</a>
63     </div>
64     <div class=clear></div>
65   {% endif %}
66   Reason for report:
67   <div id="report-{{ report.id }}"
68        class="report_wrapper">
69     <div class="report_author">
70         <img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" 
71              alt="Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license. Distributed by the GNOME project http://www.gnome.org" />
72         <a href="{{ request.urlgen('mediagoblin.moderation.users_detail',
73                         user=report.reporter.username) }}"
74            class="report_authorlink">
75         {{- report.reporter.username -}}
76         </a>
77         <a href="{{ request.urlgen('mediagoblin.moderation.reports_detail',
78                         report_id=report.id) }}"
79            class="report_whenlink">
80           <span title='{{- report.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
81             {%- trans formatted_time=timesince(report.created) -%}
82               {{ formatted_time }} ago
83             {%- endtrans -%}
84           </span>
85         </a>
86     </div>
87     <div class="report_content">
88       {{ report.report_content }}
89     </div>
90   </div>
91   {% if not report.resolved %}
92     <input type=button value=Resolve id=open_resolution_form />
93     <form action="" method="POST" id=resolution_form>
94       {{ wtforms_util.render_divs(form) }}
95       {{ csrf_token }}
96       <input type=submit id="submit_this_report" value="Resolve This Report"/>
97     </form>
98
99
100   <script>
101   $(document).ready(function() {
102       $('form#resolution_form').hide()
103       $('#user_banned_until').val("YYYY-MM-DD")
104       $('#open_resolution_form').click(function() {
105           $('form#resolution_form').toggle();
106           $('#user_banned_until').hide();
107           $('label[for=user_banned_until]').hide();
108       });
109       $('#action_to_resolve').change(function() {
110           if ($('ul#action_to_resolve li input:checked').val() == "userban") {
111               $('#user_banned_until').show();
112               $('label[for=user_banned_until]').show();
113           } else {
114               $('#user_banned_until').hide();
115               $('label[for=user_banned_until]').hide();
116           }
117       });
118       $("#user_banned_until").focus(function() {
119           $(this).val("");
120           $(this).unbind('focus');
121       });
122       $("#submit_this_report").click(function(){
123           if ($("#user_banned_until").val() == 'YYYY-MM-DD'){
124               $("#user_banned_until").val("");
125           }
126       });
127   });
128   </script>
129   {% else %}
130     <h2>Status:</h2>
131     RESOLVED on {{ report.resolved.strftime("%I:%M%p %Y-%m-%d") }}
132     {% autoescape False %}
133     <p>{{ report.result }}</p>
134     {% endautoescape %}
135   {% endif %}
136 {% endif %}
137 {% endblock %}