diff options
author | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-07-17 16:16:07 -0400 |
---|---|---|
committer | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-07-17 16:16:07 -0400 |
commit | 6bba33d7e6fbb0cedc39f9a11f816fe5bd372ae7 (patch) | |
tree | e72b59ff0f0b749739c3b38c84699fd43464343d /mediagoblin/templates | |
parent | 650a0aa90dacd97286a081b0b7c11abb04ba8767 (diff) | |
download | mediagoblin-6bba33d7e6fbb0cedc39f9a11f816fe5bd372ae7.tar.lz mediagoblin-6bba33d7e6fbb0cedc39f9a11f816fe5bd372ae7.tar.xz mediagoblin-6bba33d7e6fbb0cedc39f9a11f816fe5bd372ae7.zip |
Whew. This is a big update. I did some significant keeping work. I moved all of
the folders and enpoints labeled 'admin' to the more accurate term of 'moderat-
ion.' I also created the ability for admins and moderators to add or remove pr-
ivileges or to ban a user in response to a report. This also meant implementing
the UserBan class in various places. I also had to add a column called result
to the ReportBase table. This allows the moderator/admin to leave comments when
they respond to a report, allowing for archiving of what responses they do/n't
take.
--\ mediagoblin/db/migrations.py
--| Added result column to ReportBase
--\ mediagoblin/db/models.py
--| Added result column to ReportBase
--| Added documentation to tables I had made previously
--\ mediagoblin/decorators.py
--| Editted the user_has_privilege decorator to check whether a user has been
| banned or not
--| Created a seperate user_not_banned decorator to prevent banned users from
| accessing any pages
--| Changed require_admin_login into require_admin_or_moderator login
--\ mediagoblin/gmg_commands/users.py
--| Made the gmg command `adduser` create a user w/ the appropriate privileges
--\ mediagoblin/moderation/routing.py << formerly mediagoblin/admin/routing.py
--| Renamed all of the routes from admin -> moderation
--\ mediagoblin/routing.py
--| Renamed all of the routes from admin -> moderation
--\ mediagoblin/moderation/views.py << formerly mediagoblin/admin/views.py
--| Renamed all of the routes & functions from admin -> moderation
--| Expanded greatly on the moderation_reports_detail view and functionality
--| Added in the give_or_take_away_privilege form, however this might be a use-
| -less function which I could remove (because privilege changes should happe-
| n in response to a report so they can be archived and visible)
--\ mediagoblin/static/css/base.css
--| Added in a style for the reports_detail page
--\ mediagoblin/templates/mediagoblin/base.html
--| Renamed all of the routes from admin -> moderation
--\ mediagoblin/templates/mediagoblin/moderation/report.html
--| Added form to allow moderators and admins to respond to reports.
--\ mediagoblin/templates/mediagoblin/moderation/reports_panel.html
--| Fixed the table for closed reports
--\ mediagoblin/templates/mediagoblin/moderation/user.html
--| Added in a table w/ all of the user's privileges and the option to add or
| remove them. Again, this is probably vestigial
--| Renamed all of the routes from admin -> moderation
--\ mediagoblin/templates/mediagoblin/moderation/user_panel.html
--| Renamed all of the routes from admin -> moderation
--\ mediagoblin/tools/response.py
--| Added function render_user_banned, this is the view function for the redir-
| -ect that happens when a user tries to access the site whilst banned
--\ mediagoblin/user_pages/forms.py
--| Added important translate function where I had text
--\ mediagoblin/user_pages/lib.py
--| Renamed functiion for clarity
--\ mediagoblin/user_pages/views.py
--| Added the user_not_banned decorator to every view
--\ mediagoblin/views.py
--| Added the user_not_banned decorator
--\ mediagoblin/moderation/forms.py
--| Created this new file
--\ mediagoblin/templates/mediagoblin/banned.html
--| Created this new file
--| This is the page which people are redirected to when they access the site
| while banned
Diffstat (limited to 'mediagoblin/templates')
-rw-r--r-- | mediagoblin/templates/mediagoblin/banned.html | 28 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/base.html | 5 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/moderation/media_panel.html (renamed from mediagoblin/templates/mediagoblin/admin/media_panel.html) | 0 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/moderation/report.html (renamed from mediagoblin/templates/mediagoblin/admin/report.html) | 52 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/moderation/report_panel.html (renamed from mediagoblin/templates/mediagoblin/admin/report_panel.html) | 39 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/moderation/user.html (renamed from mediagoblin/templates/mediagoblin/admin/user.html) | 36 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/moderation/user_panel.html (renamed from mediagoblin/templates/mediagoblin/admin/user_panel.html) | 2 |
7 files changed, 134 insertions, 28 deletions
diff --git a/mediagoblin/templates/mediagoblin/banned.html b/mediagoblin/templates/mediagoblin/banned.html new file mode 100644 index 00000000..4eda0540 --- /dev/null +++ b/mediagoblin/templates/mediagoblin/banned.html @@ -0,0 +1,28 @@ +{# +# GNU MediaGoblin -- federated, autonomous media hosting +# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#} +{% extends "mediagoblin/base.html" %} + +{% block title %}You are Banned.{% endblock %} + +{% block mediagoblin_content %} + <img class="right_align" src="{{ request.staticdirect('/images/404.png') }}" + alt="{% trans %}Image of goblin stressing out{% endtrans %}" /> + <h1>You have been banned until {{ expiration_date }}</h1> + <p>{{ reason|safe }}</p> + <div class="clear"></div> +{% endblock %} diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html index e9a18f22..b52b65e7 100644 --- a/mediagoblin/templates/mediagoblin/base.html +++ b/mediagoblin/templates/mediagoblin/base.html @@ -104,9 +104,12 @@ {% if request.user.is_admin %} <p> <span class="dropdown_title">Admin powers:</span> - <a href="{{ request.urlgen('mediagoblin.admin.media_panel') }}"> + <a href="{{ request.urlgen('mediagoblin.moderation.media_panel') }}"> {%- trans %}Media processing panel{% endtrans -%} </a> + <a href="{{ request.urlgen('mediagoblin.moderation.users') }}"> + {%- trans %}User management panel{% endtrans -%} + </a> </p> {% endif %} </div> diff --git a/mediagoblin/templates/mediagoblin/admin/media_panel.html b/mediagoblin/templates/mediagoblin/moderation/media_panel.html index 1c3c866e..1c3c866e 100644 --- a/mediagoblin/templates/mediagoblin/admin/media_panel.html +++ b/mediagoblin/templates/mediagoblin/moderation/media_panel.html diff --git a/mediagoblin/templates/mediagoblin/admin/report.html b/mediagoblin/templates/mediagoblin/moderation/report.html index ef90df40..6938569d 100644 --- a/mediagoblin/templates/mediagoblin/admin/report.html +++ b/mediagoblin/templates/mediagoblin/moderation/report.html @@ -16,6 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. #} {%- extends "mediagoblin/base.html" %} +{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} {%- block mediagoblin_content %} {% if not report %} @@ -29,7 +30,7 @@ class="comment_wrapper"> <div class="comment_author"> <img src="{{ request.staticdirect('/images/icon_comment.png') }}" /> - <a href="{{ request.urlgen('mediagoblin.admin.users_detail', + <a href="{{ request.urlgen('mediagoblin.moderation.users_detail', user=comment.get_author.username) }}" class="comment_authorlink"> {{- reported_user.username -}} @@ -68,12 +69,12 @@ <div class="report_author"> <img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" alt="Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license. Distributed by the GNOME project http://www.gnome.org" /> - <a href="{{ request.urlgen('mediagoblin.admin.users_detail', + <a href="{{ request.urlgen('mediagoblin.moderation.users_detail', user=report.reporter.username) }}" class="report_authorlink"> {{- report.reporter.username -}} </a> - <a href="{{ request.urlgen('mediagoblin.admin.reports_detail', + <a href="{{ request.urlgen('mediagoblin.moderation.reports_detail', report_id=report.id) }}" class="report_whenlink"> <span title='{{- report.created.strftime("%I:%M%p %Y-%m-%d") -}}'> @@ -87,5 +88,50 @@ {{ report.report_content }} </div> </div> + {% if not report.resolved %} + <input type=button value=Resolve id=open_resolution_form /> + <form action="" method="POST" id=resolution_form> + {{ wtforms_util.render_divs(form) }} + {{ csrf_token }} + <input type=submit id="submit_this_report" value="Resolve This Report"/> + </form> + + + <script> + $(document).ready(function() { + $('form#resolution_form').hide() + $('#user_banned_until').val("YYYY-MM-DD") + $('#open_resolution_form').click(function() { + $('form#resolution_form').toggle(); + $('#user_banned_until').hide(); + $('label[for=user_banned_until]').hide(); + }); + $('#action_to_resolve').change(function() { + if ($('ul#action_to_resolve li input:checked').val() == "userban") { + $('#user_banned_until').show(); + $('label[for=user_banned_until]').show(); + } else { + $('#user_banned_until').hide(); + $('label[for=user_banned_until]').hide(); + } + }); + $("#user_banned_until").focus(function() { + $(this).val(""); + $(this).unbind('focus'); + }); + $("#submit_this_report").click(function(){ + if ($("#user_banned_until").val() == 'YYYY-MM-DD'){ + $("#user_banned_until").val(""); + } + }); + }); + </script> + {% else %} + <h2>Status:</h2> + RESOLVED on {{ report.resolved.strftime("%I:%M%p %Y-%m-%d") }} + {% autoescape False %} + <p>{{ report.result }}</p> + {% endautoescape %} + {% endif %} {% endif %} {% endblock %} diff --git a/mediagoblin/templates/mediagoblin/admin/report_panel.html b/mediagoblin/templates/mediagoblin/moderation/report_panel.html index 30194577..126b247c 100644 --- a/mediagoblin/templates/mediagoblin/admin/report_panel.html +++ b/mediagoblin/templates/mediagoblin/moderation/report_panel.html @@ -29,7 +29,7 @@ {% trans %}Here you can look up users in order to take punitive actions on them.{% endtrans %} </p> -<h2>{% trans %}Reports Filed on Comments{% endtrans %}</h2> +<h2>{% trans %}Reports Filed{% endtrans %}</h2> {% if report_list.count() %} <table class="admin_panel processing"> @@ -44,8 +44,10 @@ </tr> {% for report in report_list %} <tr> + + <td><a href="{{ request.urlgen('mediagoblin.moderation.reports_detail', + report_id=report.id) }}">{{ report.id }}</a></td> {% if report.discriminator == "comment_report" %} - <td>{{ report.id }}</td> <td>Comment Report</td> <td>{{ report.comment.get_author.username }}</td> <td>{{ report.created.strftime("%F %R") }}</td> @@ -53,7 +55,6 @@ <td>{{ report.report_content }}</td> <td><a href="{{ report.comment.get_media_entry.url_for_self(request.urlgen) }}">{{ report.comment.get_media_entry.title }}</a></td> {% elif report.discriminator == "media_report" %} - <td>{{ report.id }}</td> <td>Media Report</td> <td>{{ report.media_entry.get_uploader.username }}</td> <td>{{ report.created.strftime("%F %R") }}</td> @@ -67,26 +68,36 @@ {% else %} <p><em>{% trans %}No open reports found.{% endtrans %}</em></p> {% endif %} -<h2>{% trans %}Closed Reports on Comments{% endtrans %}</h2> +<h2>{% trans %}Closed Reports{% endtrans %}</h2> {% if closed_report_list.count() %} <table class="media_panel processing"> <tr> <th>ID</th> + <th>Resolved</th> <th>Offender</th> - <th>When Reported</th> + <th>Action Taken</th> <th>Reported By</th> <th>Reason</th> - <th>Comment Posted On</th> + <th>Reported Comment or Media Entry</th> </tr> {% for report in closed_report_list %} - <tr> - <td>{{ report.id }}</td> - <td>{{ report.comment.get_author.username }}</td> - <td>{{ report.created.strftime("%F %R") }}</td> - <td>{{ report.reporter.username }}</td> - <td>{{ report.report_content }}</td> - <td><a href="{{ report.comment.get_media_entry.url_for_self(request.urlgen) }}">{{ report.comment.get_media_entry.title }}</a></td> - </tr> + <td><a href="{{ request.urlgen('mediagoblin.moderation.reports_detail', + report_id=report.id) }}">{{ report.id }}</a></td> + {% if report.discriminator == "comment_report" %} + <td>{{ report.resolved.strftime("%F %R") }}</td> + <td>{{ report.comment.get_author.username }}</td> + <td>{{ report.created.strftime("%F %R") }}</td> + <td>{{ report.reporter.username }}</td> + <td>{{ report.report_content }}</td> + <td><a href="{{ report.comment.get_media_entry.url_for_self(request.urlgen) }}">{{ report.comment.get_media_entry.title }}</a></td> + {% elif report.discriminator == "media_report" %} + <td>{{ report.resolved.strftime("%F %R") }}</td> + <td>{{ report.media_entry.get_uploader.username }}</td> + <td>{{ report.created.strftime("%F %R") }}</td> + <td>{{ report.reporter.username }}</td> + <td>{{ report.report_content[0:20] }}...</td> + <td><a href="{{ report.media_entry.url_for_self(request.urlgen) }}">{{ report.media_entry.title }}</a></td> + {% endif %} {% endfor %} </table> {% else %} diff --git a/mediagoblin/templates/mediagoblin/admin/user.html b/mediagoblin/templates/mediagoblin/moderation/user.html index 90b3f583..f868aa8a 100644 --- a/mediagoblin/templates/mediagoblin/admin/user.html +++ b/mediagoblin/templates/mediagoblin/moderation/user.html @@ -85,7 +85,7 @@ </div> {% endif %} {% if user %} - <h2>{%- trans %}Active Reports on{% endtrans -%} {{ user.username }}</h2> + <h2>{%- trans %}Active Reports on {% endtrans -%}{{ user.username }}</h2> {% if reports.count() %} <table class="admin_side_panel"> <tr> @@ -97,7 +97,7 @@ <tr> <td> <img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" /> - <a href="{{ request.urlgen('mediagoblin.admin.reports_detail', + <a href="{{ request.urlgen('mediagoblin.moderation.reports_detail', report_id=report.id) }}"> {%- trans %}Report #{% endtrans -%}{{ report.id }} </a> @@ -116,7 +116,7 @@ <tr><td></td><td></td> </table> {% else %} - {%- trans %}No active reports filed on{% endtrans -%} {{ user.username }} + {%- trans %}No active reports filed on {% endtrans -%} {{ user.username }} {% endif %} <a class="right_align">{{ user.username }}'s report history</a> <span class=clear></span> @@ -125,13 +125,31 @@ <tr> <th>{% trans %}Privilege{% endtrans %}</th> <th>{% trans %}User Has Privilege{% endtrans %}</th> - {% for privilege in privileges %} - <tr> - <td>{{ privilege.privilege_name }}</td> - <td>{% if privilege in user.all_privileges %}Yes{% else %}No{% endif %}</td> - <td>{% if privilege in user.all_privileges and privilege.id < request.user.get_highest_privilege().id %}<a>{% trans %}Take Away{% endtrans %}</a>{% else %}<a>{% trans %}Give Privilege{% endtrans %}</a>{% endif %}</td> </tr> - {% endfor %} + {% for privilege in privileges %} + <tr> + <form action="{{ request.urlgen('mediagoblin.moderation.give_or_take_away_privilege', + user=user.username) }}" + method=post > + <td>{{ privilege.privilege_name }}</td> + <td> + {% if privilege in user.all_privileges %}Yes</td> + {% if (not privilege.is_admin_or_moderator() or request.user.is_admin) and not (user.is_admin and not request.user.is_admin) %} + <td><input type=submit value="{% trans %}Take Away{% endtrans %}" /> + <input type=hidden name=giving_privilege /> + {% endif %} + {% else %}No</td> + {% if (not privilege.is_admin_or_moderator() or request.user.is_admin) and not (user.is_admin and not request.user.is_admin) %} + <td><input type=submit value="{% trans %}Give Privilege{% endtrans %}" > + <input type=hidden name=giving_privilege value=True /> + {% endif %} + {% endif %} + <input type=hidden name=privilege_name value="{{ privilege.privilege_name }}" /> + </td> + {{ csrf_token }} + </form> + </tr> + {% endfor %} </table> {% endif %} {% endblock %} diff --git a/mediagoblin/templates/mediagoblin/admin/user_panel.html b/mediagoblin/templates/mediagoblin/moderation/user_panel.html index cc965b73..49877074 100644 --- a/mediagoblin/templates/mediagoblin/admin/user_panel.html +++ b/mediagoblin/templates/mediagoblin/moderation/user_panel.html @@ -42,7 +42,7 @@ {% for user in user_list %} <tr> <td>{{ user.id }}</td> - <td><a href="{{ request.urlgen('mediagoblin.admin.users_detail', + <td><a href="{{ request.urlgen('mediagoblin.moderation.users_detail', user= user.username) }}">{{ user.username }}</a></td> <td>{{ user.created.strftime("%F %R") }}</td> <td>{{ user.posted_comments.count() }}</td> |