From 30a9fe7c1cf128fdf413797a2b2edac2d5439bc2 Mon Sep 17 00:00:00 2001 From: tilly-Q Date: Mon, 24 Jun 2013 16:35:31 -0700 Subject: This is the first stage of my project of implenting admin/moderator functiona- lity. At this point, I have finished all the of basic work with the models! I still need to do some tightening of their documentation, but they seem to be working well. Working with Models ======================================== --\ mediagoblin/db/models.py --| Added in the Report model and table. This model is strictly a parent ----| Added in the CommentReport model which holds information about a report | filed against a comment. This class inherits from Report. ----| Added in the MediaReport model which holds information about a report f- | -iled against a media entry. This class inherits from Report. --| Added in a UserBan model and table. This model is in a one to one relatio- | -nship with User. This object acts as a marker for whether a user is banned | or not. --| Added in a Group model. These objects are in a many-to-many relationship | with User to explain which privileges a User has. ----| Added in GroupUserAssociation which is a table used to hold this many to | many relationship between Group & User. --\ mediagoblin/db/migrations.py --| Added in the migrations for all of the additions to models --| Added UserBan_v0 --| Added Report_v0 ----| Added CommentReport_v0 ----| Added MediaReport_v0 --| Added Group_v0 ----| Added GroupUserAssociation_v0 Working with Templates, Views, and Routing =============================================== >>> Reporting a Comment or a MediaEntry --\ mediagoblin/user_pages/views.py --| Added in the function file_a_report to allow user to file reports against | MediaEntries or Comments. Handles GET and POST requests. --| Added in the function file_a_comment_report which uses file_a_report but | also catches appropriate information for comment_ids. I may be able to do | this more eloquently with decorators. --\ mediagoblin/user_pages/routing.py --| Added in route 'mediagoblin.user_pages.media_home.report_media' | (linked to address /u//m//report/ ) --| Added in route ''mediagoblin.user_pages.media_home.report_comment' | (linked to address /u//m//c//report/ ) --\ mediagoblin/templates/mediagoblin/user_pages/report.html --| I created this file to handle the filing of a report. --\ mediagoblin/templates/mediagoblin/user_pages/media.html --| Modified this file to add in links allowing users to report either media | or comments. --\ mediagoblin/user_pages/lib.py --| Added in build_report_form which processes data as either a CommentReport or | a MediaReport depending on which parameters are present --\ mediagoblin/user_pages/forms.py --| Added in CommentReportForm --| Added in MediaReportForm --| note: ReportForm is vestigial to an earlier strategy I used and I'll remove it | promptly --\ mediagoblin/decorators.py --| Added in 'get_media_comment_by_id' for use in mediagoblin/user_pages/views.py >>> New Admin Panels --\ mediagoblin/admin/views.py --| Added in the function admin_users_panel --| Added in the function admin_reports_panel --\ mediagoblin/admin/routing.py --| Added in route 'mediagoblin.admin.users' | (linked to address '/a/users') --| Added in route 'mediagoblin.admin.reports' | (linked to address '/a/reports/') --\ mediagoblin/templates/admin/user.html --| Created this file as a template for monitoring users --\ mediagoblin/templates/admin/report.html --| Created this file as a template for monitoring reports filed against media or | comments --- .../templates/mediagoblin/admin/report.html | 95 ++++++++++++++++++++++ mediagoblin/templates/mediagoblin/admin/user.html | 54 ++++++++++++ .../templates/mediagoblin/user_pages/media.html | 22 +++++ .../templates/mediagoblin/user_pages/report.html | 75 +++++++++++++++++ 4 files changed, 246 insertions(+) create mode 100644 mediagoblin/templates/mediagoblin/admin/report.html create mode 100644 mediagoblin/templates/mediagoblin/admin/user.html create mode 100644 mediagoblin/templates/mediagoblin/user_pages/report.html (limited to 'mediagoblin/templates') diff --git a/mediagoblin/templates/mediagoblin/admin/report.html b/mediagoblin/templates/mediagoblin/admin/report.html new file mode 100644 index 00000000..ff5cb427 --- /dev/null +++ b/mediagoblin/templates/mediagoblin/admin/report.html @@ -0,0 +1,95 @@ +{# +# 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 . +#} +{% extends "mediagoblin/base.html" %} + +{% block title -%} + {% trans %}Report panel{% endtrans %} — {{ super() }} +{%- endblock %} + +{% block mediagoblin_content %} + +

{% trans %}Report panel{% endtrans %}

+ +

+ {% trans %}Here you can look up users in order to take punitive actions on them.{% endtrans %} +

+ +

{% trans %}Reports Filed on Comments{% endtrans %}

+ +{% if report_list.count() %} + + + + + + + + + + + {% for report in report_list %} + + {% if report.discriminator == "comment_report" %} + + + + + + + + {% elif report.discriminator == "media_report" %} + + + + + + + + {% endif %} + + {% endfor %} +
IDReport TypeOffenderWhen ReportedReported ByReasonReported Comment or Media Entry
{{ report.id }}Comment Report{{ report.comment.get_author.username }}{{ report.created.strftime("%F %R") }}{{ report.reporter.username }}{{ report.report_content }}{{ report.comment.get_media_entry.title }}{{ report.id }}Media Report{{ report.media_entry.get_uploader.username }}{{ report.created.strftime("%F %R") }}{{ report.reporter.username }}{{ report.report_content[0:20] }}...{{ report.media_entry.title }}
+{% else %} +

{% trans %}No open reports found.{% endtrans %}

+{% endif %} +

{% trans %}Closed Reports on Comments{% endtrans %}

+{% if closed_report_list.count() %} + + + + + + + + + + {% for report in closed_report_list %} + + + + + + + + + {% endfor %} +
IDOffenderWhen ReportedReported ByReasonComment Posted On
{{ report.id }}{{ report.comment.get_author.username }}{{ report.created.strftime("%F %R") }}{{ report.reporter.username }}{{ report.report_content }}{{ report.comment.get_media_entry.title }}
+{% else %} +

{% trans %}No closed reports found.{% endtrans %}

+{% endif %} +{% endblock %} diff --git a/mediagoblin/templates/mediagoblin/admin/user.html b/mediagoblin/templates/mediagoblin/admin/user.html new file mode 100644 index 00000000..6b6d226a --- /dev/null +++ b/mediagoblin/templates/mediagoblin/admin/user.html @@ -0,0 +1,54 @@ +{# +# 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 . +#} +{% extends "mediagoblin/base.html" %} + +{% block title -%} + {% trans %}User panel{% endtrans %} — {{ super() }} +{%- endblock %} + +{% block mediagoblin_content %} + +

{% trans %}User panel{% endtrans %}

+ +

+ {% trans %}Here you can look up users in order to take punitive actions on them.{% endtrans %} +

+ +

{% trans %}Active Users{% endtrans %}

+ +{% if user_list.count() %} + + + + + + + + {% for user in user_list %} + + + + + + + {% endfor %} +
IDUsernameWhen Joined# of Comments Posted
{{ user.id }}{{ user.username }}{{ user.created.strftime("%F %R") }}{{ user.posted_comments.count() }}
+{% else %} +

{% trans %}No users found.{% endtrans %}

+{% endif %} +{% endblock %} diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index fb892fd7..134a80ad 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -95,6 +95,17 @@ {% trans %}Add a comment{% endtrans %} {% endif %} + + {% trans %}Report media{% endtrans %} + {% if request.user %}
+ {% trans %} Report {% endtrans %} + {% endfor %} diff --git a/mediagoblin/templates/mediagoblin/user_pages/report.html b/mediagoblin/templates/mediagoblin/user_pages/report.html new file mode 100644 index 00000000..9431efc0 --- /dev/null +++ b/mediagoblin/templates/mediagoblin/user_pages/report.html @@ -0,0 +1,75 @@ +{# +# 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 . +#} +{%- extends "mediagoblin/base.html" %} + +{%- block mediagoblin_content %} +

File a Report

+ + {% if comment is defined %} +

{% trans %}Reporting this Comment {% endtrans %}

+ {% set comment_author = comment.get_author %} + + + {% elif media is defined %} +

{% trans %}Reporting this Media Entry {% endtrans %}

+ {% trans %}published by {% endtrans %}{{ media.get_uploader.username }} + +
+ + {% endif %} +
+ + +
+ + + {{ csrf_token }} + +{% endblock %} -- cgit v1.2.3