This update I mostly did work on the templates for the admin pages. I did a co-
-uple other small changes. I changed the information around the media processi- ng panel to be more specific, since it was written when it was the only admin page. Git didn't catch this, but I renamed the templates, so mediagoblin/templ- ates/admin/user.html now referrs to the page which shows the details of a spec- ific user. The list view pages are now named ELEMENT_panel.html(ie. user_panel) I also added a column reported_user_id to the ReportBase table, and had to add to Report filing to make sure that column gets created. Also I moved the report media button (on a media page) to the sidebar, though it still needs some form- atting --\ mediagoblin/static/images/icon_clipboard.png --| Added this image for use in template mediagoblin/admin/report.html. --| Distributed by the GNOME project http://www.gnome.org --| Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license. --| I'm still trying to figure out the appropriate way to attribute this in | the code --\ mediagoblin/templates/mediagoblin/admin/media_panel.html --| This template is actually the template formerly know as media.html. I | renamed it for clarity --\ mediagoblin/templates/mediagoblin/admin/report_panel.html --| This template is actually the template formerly know as report.html. I | renamed it for clarity --\ mediagoblin/templates/mediagoblin/admin/user_panel.html --| This template is actually the template formerly know as user.html. I renam- | -ed it for clarity --\ mediagoblin/templates/mediagoblin/utils/report.html --| This template is included in the media_home page. It is the report media | button. I figured I'd write it like this in case it got more complicated. --\ mediagoblin/admin/routing.py --| I changed the routing path /a/panel to /a/media for specificity --\ mediagoblin/admin/views.py --| I renamed admin_processing_panel to admin_media_processing_panel --| I wrote a new view function admin_reports_detail --| I wrote a new view function admin_users_detail --\ mediagoblin/db/migrations.py --| I added in the column reported_user_id to the ReportBase_v0 class --\ mediagoblin/db/models.py --| I added in the column reported_user_id to the ReportBase class --\ mediagoblin/static/css/base.css --| I added in css classes to display a report. Right now, they are just echo- | -ing the ways comments are displayed, but with the link in another color --\ mediagoblin/templates/mediagoblin/admin/report.html --| Created this new template (although git doesn't realize it) to show the de- | -tails of a specific report, indicated in the URL --\ mediagoblin/templates/mediagoblin/admin/user.html --| Created this new template (although git doesn't realize it) to show the de- | -tails of a specific user, indicated in the URL --\ mediagoblin/templates/mediagoblin/base.html --| Redirected the link from /a/panel to /a/media --\ mediagoblin/templates/mediagoblin/user_pages/media.html --| Moved the media report button to the sidebar --\ mediagoblin/user_pages/lib.py --| Changed the creation of reports, so that they also assign a column for rep- | -orted_user_id.
This commit is contained in:
parent
3fb96fc978
commit
3ce0c6113e
@ -15,12 +15,18 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
admin_routes = [
|
||||
('mediagoblin.admin.panel',
|
||||
'/panel',
|
||||
'mediagoblin.admin.views:admin_processing_panel'),
|
||||
('mediagoblin.admin.media_panel',
|
||||
'/media',
|
||||
'mediagoblin.admin.views:admin_media_processing_panel'),
|
||||
('mediagoblin.admin.users',
|
||||
'/users',
|
||||
'mediagoblin.admin.views:admin_users_panel'),
|
||||
('mediagoblin.admin.reports',
|
||||
'/reports',
|
||||
'mediagoblin.admin.views:admin_reports_panel')]
|
||||
'mediagoblin.admin.views:admin_reports_panel'),
|
||||
('mediagoblin.admin.users_detail',
|
||||
'/users/<string:user>',
|
||||
'mediagoblin.admin.views:admin_users_detail'),
|
||||
('mediagoblin.admin.reports_detail',
|
||||
'/reports/<int:report_id>',
|
||||
'mediagoblin.admin.views:admin_reports_detail')]
|
||||
|
@ -16,12 +16,13 @@
|
||||
|
||||
from werkzeug.exceptions import Forbidden
|
||||
|
||||
from mediagoblin.db.models import MediaEntry, User, MediaComment, CommentReport, ReportBase
|
||||
from mediagoblin.db.models import (MediaEntry, User, MediaComment, \
|
||||
CommentReport, ReportBase, Privilege)
|
||||
from mediagoblin.decorators import require_admin_login
|
||||
from mediagoblin.tools.response import render_to_response
|
||||
|
||||
@require_admin_login
|
||||
def admin_processing_panel(request):
|
||||
def admin_media_processing_panel(request):
|
||||
'''
|
||||
Show the global media processing panel for this instance
|
||||
'''
|
||||
@ -38,7 +39,7 @@ def admin_processing_panel(request):
|
||||
# Render to response
|
||||
return render_to_response(
|
||||
request,
|
||||
'mediagoblin/admin/panel.html',
|
||||
'mediagoblin/admin/media_panel.html',
|
||||
{'processing_entries': processing_entries,
|
||||
'failed_entries': failed_entries,
|
||||
'processed_entries': processed_entries})
|
||||
@ -50,11 +51,29 @@ def admin_users_panel(request):
|
||||
'''
|
||||
user_list = User.query
|
||||
|
||||
# Render to response
|
||||
return render_to_response(
|
||||
request,
|
||||
'mediagoblin/admin/user_panel.html',
|
||||
{'user_list': user_list})
|
||||
|
||||
@require_admin_login
|
||||
def admin_users_detail(request):
|
||||
'''
|
||||
Shows details about a particular user.
|
||||
'''
|
||||
user = User.query.filter_by(username=request.matchdict['user']).first()
|
||||
privileges = Privilege.query
|
||||
active_reports = user.reports_filed_on.filter(
|
||||
ReportBase.resolved==None).limit(5)
|
||||
closed_reports = user.reports_filed_on.filter(
|
||||
ReportBase.resolved!=None).all()
|
||||
|
||||
return render_to_response(
|
||||
request,
|
||||
'mediagoblin/admin/user.html',
|
||||
{'user_list': user_list})
|
||||
{'user':user,
|
||||
'privileges':privileges,
|
||||
'reports':active_reports})
|
||||
|
||||
@require_admin_login
|
||||
def admin_reports_panel(request):
|
||||
@ -72,7 +91,25 @@ def admin_reports_panel(request):
|
||||
# Render to response
|
||||
return render_to_response(
|
||||
request,
|
||||
'mediagoblin/admin/report.html',
|
||||
'mediagoblin/admin/report_panel.html',
|
||||
{'report_list':report_list,
|
||||
'closed_report_list':closed_report_list})
|
||||
|
||||
@require_admin_login
|
||||
def admin_reports_detail(request):
|
||||
report = ReportBase.query.get(request.matchdict['report_id'])
|
||||
if report.discriminator == 'comment_report':
|
||||
comment = MediaComment.query.get(report.comment_id)
|
||||
media_entry = None
|
||||
elif report.discriminator == 'media_report':
|
||||
media_entry = MediaEntry.query.get(report.media_entry_id)
|
||||
comment = None
|
||||
|
||||
return render_to_response(
|
||||
request,
|
||||
'mediagoblin/admin/report.html',
|
||||
{'report':report,
|
||||
'media_entry':media_entry,
|
||||
'comment':comment})
|
||||
|
||||
|
||||
|
@ -26,7 +26,8 @@ from sqlalchemy.sql import and_
|
||||
from migrate.changeset.constraint import UniqueConstraint
|
||||
|
||||
from mediagoblin.db.migration_tools import RegisterMigration, inspect_table
|
||||
from mediagoblin.db.models import MediaEntry, Collection, User, MediaComment, Privilege
|
||||
from mediagoblin.db.models import (MediaEntry, Collection, User,
|
||||
MediaComment, Privilege, ReportBase)
|
||||
|
||||
MIGRATIONS = {}
|
||||
|
||||
@ -296,6 +297,7 @@ class ReportBase_v0(declarative_base()):
|
||||
id = Column(Integer, primary_key=True)
|
||||
reporter_id = Column(Integer, ForeignKey(User.id), nullable=False)
|
||||
report_content = Column(UnicodeText)
|
||||
reported_user_id = Column(Integer, ForeignKey(User.id), nullable=False)
|
||||
created = Column(DateTime, nullable=False, default=datetime.datetime.now)
|
||||
resolved = Column(DateTime)
|
||||
discriminator = Column('type', Unicode(50))
|
||||
@ -357,5 +359,3 @@ def create_moderation_tables(db):
|
||||
Privilege_v0.__table__.create(db.bind)
|
||||
PrivilegeUserAssociation_v0.__table__.create(db.bind)
|
||||
db.commit()
|
||||
|
||||
|
||||
|
@ -45,7 +45,6 @@ class UserMixin(object):
|
||||
def bio_html(self):
|
||||
return cleaned_markdown_conversion(self.bio)
|
||||
|
||||
|
||||
class GenerateSlugMixin(object):
|
||||
"""
|
||||
Mixin to add a generate_slug method to objects.
|
||||
|
@ -496,8 +496,16 @@ class ReportBase(Base):
|
||||
User,
|
||||
backref=backref("reports_filed_by",
|
||||
lazy="dynamic",
|
||||
cascade="all, delete-orphan"))
|
||||
cascade="all, delete-orphan"),
|
||||
primaryjoin="User.id==ReportBase.reporter_id")
|
||||
report_content = Column(UnicodeText)
|
||||
reported_user_id = Column(Integer, ForeignKey(User.id), nullable=False)
|
||||
reported_user = relationship(
|
||||
User,
|
||||
backref=backref("reports_filed_on",
|
||||
lazy="dynamic",
|
||||
cascade="all, delete-orphan"),
|
||||
primaryjoin="User.id==ReportBase.reported_user_id")
|
||||
created = Column(DateTime, nullable=False, default=datetime.datetime.now())
|
||||
resolved = Column(DateTime)
|
||||
discriminator = Column('type', Unicode(50))
|
||||
@ -590,7 +598,7 @@ class PrivilegeUserAssociation(Base):
|
||||
primary_key=True)
|
||||
|
||||
|
||||
privilege_foundations = [[u'admin'], [u'moderator'], [u'commenter'], [u'uploader'],[u'reporter'],[u'active']]
|
||||
privilege_foundations = [[u'admin'], [u'moderator'], [u'uploader'],[u'reporter'], [u'commenter'] ,[u'active']]
|
||||
|
||||
MODELS = [
|
||||
User, MediaEntry, Tag, MediaTag, MediaComment, Collection, CollectionItem,
|
||||
|
@ -64,7 +64,6 @@ def active_user_from_url(controller):
|
||||
return wrapper
|
||||
|
||||
def user_has_privilege(privilege_name):
|
||||
#TODO handle possible errors correctly
|
||||
def user_has_privilege_decorator(controller):
|
||||
@wraps(controller)
|
||||
def wrapper(request, *args, **kwargs):
|
||||
|
@ -346,40 +346,40 @@ textarea#description, textarea#bio {
|
||||
|
||||
/* comments */
|
||||
|
||||
.comment_wrapper {
|
||||
.comment_wrapper, .report_wrapper {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.comment_wrapper p {
|
||||
.comment_wrapper p, .report_wrapper p {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.comment_author {
|
||||
.comment_author, .report_author {
|
||||
padding-top: 4px;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
a.comment_authorlink {
|
||||
a.comment_authorlink, a.report_authorlink {
|
||||
text-decoration: none;
|
||||
padding-right: 5px;
|
||||
font-weight: bold;
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
a.comment_authorlink:hover {
|
||||
a.comment_authorlink:hover, a.report_authorlink:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a.comment_whenlink {
|
||||
a.comment_whenlink, a.report_whenlink {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.comment_whenlink:hover {
|
||||
a.comment_whenlink:hover, a.report_whenlink:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.comment_content {
|
||||
.comment_content, .report_content {
|
||||
margin-left: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
@ -397,6 +397,11 @@ textarea#comment_content {
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
|
||||
a.report_authorlink, a.report_whenlink {
|
||||
color: #D486B1;
|
||||
}
|
||||
|
||||
/* media galleries */
|
||||
|
||||
.media_thumbnail {
|
||||
@ -597,6 +602,21 @@ table.media_panel th {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* admin panels */
|
||||
|
||||
table.admin_panel {
|
||||
width: 100%
|
||||
}
|
||||
|
||||
table.admin_side_panel {
|
||||
width: 60%
|
||||
}
|
||||
|
||||
table.admin_panel th, table.admin_side_panel th {
|
||||
font-weight: bold;
|
||||
padding-bottom: 4px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* Delete panel */
|
||||
|
||||
|
BIN
mediagoblin/static/images/icon_clipboard.png
Normal file
BIN
mediagoblin/static/images/icon_clipboard.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 682 B |
@ -15,81 +15,76 @@
|
||||
# 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" %}
|
||||
{%- extends "mediagoblin/base.html" %}
|
||||
|
||||
{% block title -%}
|
||||
{% trans %}Report panel{% endtrans %} — {{ super() }}
|
||||
{%- endblock %}
|
||||
|
||||
{% block mediagoblin_content %}
|
||||
|
||||
<h1>{% trans %}Report panel{% endtrans %}</h1>
|
||||
|
||||
<p>
|
||||
{% 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>
|
||||
|
||||
{% if report_list.count() %}
|
||||
<table class="media_panel processing">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Report Type</th>
|
||||
<th>Offender</th>
|
||||
<th>When Reported</th>
|
||||
<th>Reported By</th>
|
||||
<th>Reason</th>
|
||||
<th>Reported Comment or Media Entry</th>
|
||||
</tr>
|
||||
{% for report in report_list %}
|
||||
<tr>
|
||||
{% 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>
|
||||
<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.id }}</td>
|
||||
<td>Media Report</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 %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{%- block mediagoblin_content %}
|
||||
{% if not report %}
|
||||
Sorry, no such report found.
|
||||
{% else %}
|
||||
<p><em>{% trans %}No open reports found.{% endtrans %}</em></p>
|
||||
{% endif %}
|
||||
<h2>{% trans %}Closed Reports on Comments{% endtrans %}</h2>
|
||||
{% if closed_report_list.count() %}
|
||||
<table class="media_panel processing">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Offender</th>
|
||||
<th>When Reported</th>
|
||||
<th>Reported By</th>
|
||||
<th>Reason</th>
|
||||
<th>Comment Posted On</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>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<p><em>{% trans %}No closed reports found.{% endtrans %}</em></p>
|
||||
<h2> Report #{{ report.id }}</h2>
|
||||
{% if comment %}
|
||||
Reported comment:
|
||||
{% set reported_user = comment.get_author %}
|
||||
<div id="comment-{{ comment.id }}"
|
||||
class="comment_wrapper">
|
||||
<div class="comment_author">
|
||||
<img src="{{ request.staticdirect('/images/icon_comment.png') }}" />
|
||||
<a href="{{ request.urlgen('mediagoblin.admin.users_detail',
|
||||
user=comment.get_author.username) }}"
|
||||
class="comment_authorlink">
|
||||
{{- reported_user.username -}}
|
||||
</a>
|
||||
<a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
|
||||
comment=comment.id,
|
||||
user=comment.get_media_entry.get_uploader.username,
|
||||
media=comment.get_media_entry.slug_or_id) }}#comment"
|
||||
class="comment_whenlink">
|
||||
<span title='{{- comment.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
|
||||
{%- trans formatted_time=timesince(comment.created) -%}
|
||||
{{ formatted_time }} ago
|
||||
{%- endtrans -%}
|
||||
</span></a>:
|
||||
</div>
|
||||
<div class=comment_content>
|
||||
{% autoescape False %}
|
||||
{{ comment.content_html }}
|
||||
{% endautoescape %}
|
||||
</div>
|
||||
</div>
|
||||
{% elif media_entry %}
|
||||
<div class="media_thumbnail">
|
||||
<a href="request.urlgen('mediagoblin.user_pages.media_home'),
|
||||
user=media_entry.get_uploader.username,
|
||||
media=media_entry.slug_or_id)"><img src="{{ media_entry.thumb_url}}"/></a>
|
||||
<a href="request.urlgen('mediagoblin.user_pages.media_home'),
|
||||
user=media_entry.get_uploader.username,
|
||||
media=media_entry.slug_or_id)" class=thumb_entry_title>{{ media_entry.title }}</a>
|
||||
</div>
|
||||
<div class=clear></div>
|
||||
{% endif %}
|
||||
Reason for report:
|
||||
<div id="report-{{ report.id }}"
|
||||
class="report_wrapper">
|
||||
<div class="report_author">
|
||||
<img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" />
|
||||
<a href="{{ request.urlgen('mediagoblin.admin.users_detail',
|
||||
user=report.reporter.username) }}"
|
||||
class="report_authorlink">
|
||||
{{- report.reporter.username -}}
|
||||
</a>
|
||||
<a href="{{ request.urlgen('mediagoblin.admin.reports_detail',
|
||||
report_id=report.id) }}"
|
||||
class="report_whenlink">
|
||||
<span title='{{- report.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
|
||||
{%- trans formatted_time=timesince(report.created) -%}
|
||||
{{ formatted_time }} ago
|
||||
{%- endtrans -%}
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="report_content">
|
||||
{{ report.report_content }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
95
mediagoblin/templates/mediagoblin/admin/report_panel.html
Normal file
95
mediagoblin/templates/mediagoblin/admin/report_panel.html
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
{% extends "mediagoblin/base.html" %}
|
||||
|
||||
{% block title -%}
|
||||
{% trans %}Report panel{% endtrans %} — {{ super() }}
|
||||
{%- endblock %}
|
||||
|
||||
{% block mediagoblin_content %}
|
||||
|
||||
<h1>{% trans %}Report panel{% endtrans %}</h1>
|
||||
|
||||
<p>
|
||||
{% 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>
|
||||
|
||||
{% if report_list.count() %}
|
||||
<table class="admin_panel processing">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Report Type</th>
|
||||
<th>Offender</th>
|
||||
<th>When Reported</th>
|
||||
<th>Reported By</th>
|
||||
<th>Reason</th>
|
||||
<th>Reported Comment or Media Entry</th>
|
||||
</tr>
|
||||
{% for report in report_list %}
|
||||
<tr>
|
||||
{% 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>
|
||||
<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.id }}</td>
|
||||
<td>Media Report</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 %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<p><em>{% trans %}No open reports found.{% endtrans %}</em></p>
|
||||
{% endif %}
|
||||
<h2>{% trans %}Closed Reports on Comments{% endtrans %}</h2>
|
||||
{% if closed_report_list.count() %}
|
||||
<table class="media_panel processing">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Offender</th>
|
||||
<th>When Reported</th>
|
||||
<th>Reported By</th>
|
||||
<th>Reason</th>
|
||||
<th>Comment Posted On</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>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<p><em>{% trans %}No closed reports found.{% endtrans %}</em></p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
@ -17,38 +17,121 @@
|
||||
#}
|
||||
{% extends "mediagoblin/base.html" %}
|
||||
|
||||
{% block title -%}
|
||||
{% trans %}User panel{% endtrans %} — {{ super() }}
|
||||
{%- endblock %}
|
||||
|
||||
{% block mediagoblin_content %}
|
||||
|
||||
<h1>{% trans %}User panel{% endtrans %}</h1>
|
||||
|
||||
<p>
|
||||
{% trans %}Here you can look up users in order to take punitive actions on them.{% endtrans %}
|
||||
</p>
|
||||
|
||||
<h2>{% trans %}Active Users{% endtrans %}</h2>
|
||||
|
||||
{% if user_list.count() %}
|
||||
<table class="media_panel processing">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Username</th>
|
||||
<th>When Joined</th>
|
||||
<th># of Comments Posted</th>
|
||||
</tr>
|
||||
{% for user in user_list %}
|
||||
<tr>
|
||||
<td>{{ user.id }}</td>
|
||||
<td>{{ user.username }}</td>
|
||||
<td>{{ user.created.strftime("%F %R") }}</td>
|
||||
<td>{{ user.posted_comments.count() }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<p><em>{% trans %}No users found.{% endtrans %}</em></p>
|
||||
{% endif %}
|
||||
{% block title %}
|
||||
{%- if user -%}
|
||||
{%- trans username=user.username -%}
|
||||
User: {{ username }}
|
||||
{%- endtrans %} — {{ super() }}
|
||||
{%- else -%}
|
||||
{{ super() }}
|
||||
{%- endif -%}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block mediagoblin_content -%}
|
||||
{# If no user... #}
|
||||
{% if not user %}
|
||||
<p>{% trans %}Sorry, no such user found.{% endtrans %}</p>
|
||||
|
||||
{# User exists, but needs verification #}
|
||||
{% elif user.status == "needs_email_verification" %}
|
||||
<div class="form_box">
|
||||
<h1>{% trans %}Email verification needed{% endtrans %}</h1>
|
||||
|
||||
<p>
|
||||
{% trans -%}
|
||||
Someone has registered an account with this username, but it still has to be activated.
|
||||
{%- endtrans %}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{% trans login_url=request.urlgen('mediagoblin.auth.login') -%}
|
||||
If you are that person but you've lost your verification email, you can <a href="{{ login_url }}">log in</a> and resend it.
|
||||
{%- endtrans %}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{# Active(?) (or at least verified at some point) user, horray! #}
|
||||
{% else %}
|
||||
<h1>
|
||||
{%- trans username=user.username %}{{ username }}'s profile{% endtrans -%}
|
||||
</h1>
|
||||
|
||||
{% if not user.url and not user.bio %}
|
||||
<div class="profile_sidebar empty_space">
|
||||
<p>
|
||||
{% trans -%}
|
||||
This user hasn't filled in their profile (yet).
|
||||
{%- endtrans %}
|
||||
</p>
|
||||
{% else %}
|
||||
<div class="profile_sidebar">
|
||||
{% include "mediagoblin/utils/profile.html" %}
|
||||
{% if request.user and
|
||||
(request.user.id == user.id or request.user.is_admin) %}
|
||||
<a href="{{ request.urlgen('mediagoblin.edit.profile',
|
||||
user=user.username) }}">
|
||||
{%- trans %}Edit profile{% endtrans -%}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<p>
|
||||
<a href="{{ request.urlgen('mediagoblin.user_pages.collection_list',
|
||||
user=user.username) }}">
|
||||
{%- trans %}Browse collections{% endtrans -%}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if user %}
|
||||
<h2>{%- trans %}Active Reports on{% endtrans -%} {{ user.username }}</h2>
|
||||
{% if reports.count() %}
|
||||
<table class="admin_side_panel">
|
||||
<tr>
|
||||
<th>{%- trans %}Report ID{% endtrans -%}</th>
|
||||
<th>{%- trans %}Reported Content{% endtrans -%}</th>
|
||||
<th>{%- trans %}Description of Report{% endtrans -%}</th>
|
||||
</tr>
|
||||
{% for report in reports %}
|
||||
<tr>
|
||||
<td>
|
||||
<img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" />
|
||||
<a href="{{ request.urlgen('mediagoblin.admin.reports_detail',
|
||||
report_id=report.id) }}">
|
||||
{%- trans %}Report #{% endtrans -%}{{ report.id }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{% if report.discriminator == "comment_report" %}
|
||||
<a>{%- trans %}Reported Comment{% endtrans -%}</a>
|
||||
{% elif report.discriminator == "media_report" %}
|
||||
<a>{%- trans %}Reported Media Entry{% endtrans -%}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ report.report_content[:21] }}{% if report.report_content|count >20 %}...{% endif %}</td>
|
||||
<td>{%- trans %}Resolve{% endtrans -%}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr><td></td><td></td>
|
||||
</table>
|
||||
{% else %}
|
||||
{%- trans %}No active reports filed on{% endtrans -%} {{ user.username }}
|
||||
{% endif %}
|
||||
<a class="right_align">{{ user.username }}'s report history</a>
|
||||
<span class=clear></span>
|
||||
<h2>{{ user.username }}'s Privileges</h2>
|
||||
<table class="admin_panel">
|
||||
<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 %}
|
||||
</table>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
55
mediagoblin/templates/mediagoblin/admin/user_panel.html
Normal file
55
mediagoblin/templates/mediagoblin/admin/user_panel.html
Normal file
@ -0,0 +1,55 @@
|
||||
{#
|
||||
# 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 -%}
|
||||
{% trans %}User panel{% endtrans %} — {{ super() }}
|
||||
{%- endblock %}
|
||||
|
||||
{% block mediagoblin_content %}
|
||||
|
||||
<h1>{% trans %}User panel{% endtrans %}</h1>
|
||||
|
||||
<p>
|
||||
{% trans %}Here you can look up users in order to take punitive actions on them.{% endtrans %}
|
||||
</p>
|
||||
|
||||
<h2>{% trans %}Active Users{% endtrans %}</h2>
|
||||
|
||||
{% if user_list.count() %}
|
||||
<table class="admin_panel processing">
|
||||
<tr>
|
||||
<th>{% trans %}ID{% endtrans %}</th>
|
||||
<th>{% trans %}Username{% endtrans %}</th>
|
||||
<th>{% trans %}When Joined{% endtrans %}</th>
|
||||
<th>{% trans %}# of Comments Posted{% endtrans %}</th>
|
||||
</tr>
|
||||
{% for user in user_list %}
|
||||
<tr>
|
||||
<td>{{ user.id }}</td>
|
||||
<td><a href="{{ request.urlgen('mediagoblin.admin.users_detail',
|
||||
user= user.username) }}">{{ user.username }}</a></td>
|
||||
<td>{{ user.created.strftime("%F %R") }}</td>
|
||||
<td>{{ user.posted_comments.count() }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<p><em>{% trans %}No users found.{% endtrans %}</em></p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
@ -104,7 +104,7 @@
|
||||
{% if request.user.is_admin %}
|
||||
<p>
|
||||
<span class="dropdown_title">Admin powers:</span>
|
||||
<a href="{{ request.urlgen('mediagoblin.admin.panel') }}">
|
||||
<a href="{{ request.urlgen('mediagoblin.admin.media_panel') }}">
|
||||
{%- trans %}Media processing panel{% endtrans -%}
|
||||
</a>
|
||||
</p>
|
||||
|
@ -95,17 +95,6 @@
|
||||
{% trans %}Add a comment{% endtrans %}
|
||||
</a>
|
||||
{% endif %}
|
||||
<a
|
||||
{% if not request.user -%}
|
||||
href="{{ request.urlgen('mediagoblin.auth.login') }}"
|
||||
{% else %}
|
||||
href="{{ request.urlgen('mediagoblin.user_pages.media_home.report_media',
|
||||
user=media.get_uploader.username,
|
||||
media=media.slug_or_id) }}"
|
||||
{% endif %}
|
||||
class="button_action" id="button_reportmedia" title="Report media">
|
||||
{% trans %}Report media{% endtrans %}
|
||||
</a>
|
||||
{% if request.user %}
|
||||
<form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
|
||||
user= media.get_uploader.username,
|
||||
@ -185,6 +174,8 @@
|
||||
|
||||
{% include "mediagoblin/utils/collections.html" %}
|
||||
|
||||
{% include "mediagoblin/utils/report.html" %}
|
||||
|
||||
{% include "mediagoblin/utils/license.html" %}
|
||||
|
||||
{% include "mediagoblin/utils/exif.html" %}
|
||||
|
33
mediagoblin/templates/mediagoblin/utils/report.html
Normal file
33
mediagoblin/templates/mediagoblin/utils/report.html
Normal file
@ -0,0 +1,33 @@
|
||||
{#
|
||||
# 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/>.
|
||||
#}
|
||||
|
||||
{% block report_content -%}
|
||||
<p>
|
||||
<a
|
||||
{% if not request.user -%}
|
||||
href="{{ request.urlgen('mediagoblin.auth.login') }}"
|
||||
{% else %}
|
||||
href="{{ request.urlgen('mediagoblin.user_pages.media_home.report_media',
|
||||
user=media.get_uploader.username,
|
||||
media=media.slug_or_id) }}"
|
||||
{% endif %}
|
||||
class="button_action" id="button_reportmedia" title="Report media">
|
||||
{% trans %}Report media{% endtrans %}
|
||||
</a>
|
||||
</p>
|
||||
{% endblock %}
|
@ -19,7 +19,8 @@ from mediagoblin.tools.template import render_template
|
||||
from mediagoblin.tools.translate import pass_to_ugettext as _
|
||||
from mediagoblin import mg_globals
|
||||
from mediagoblin.db.base import Session
|
||||
from mediagoblin.db.models import CollectionItem, MediaReport, CommentReport
|
||||
from mediagoblin.db.models import (CollectionItem, MediaReport, CommentReport,
|
||||
MediaComment, MediaEntry)
|
||||
from mediagoblin.user_pages import forms as user_forms
|
||||
|
||||
|
||||
@ -99,9 +100,13 @@ def build_report_form(form_dict):
|
||||
if report_form.validate() and 'comment_id' in form_dict.keys():
|
||||
report_model = CommentReport()
|
||||
report_model.comment_id = report_form.comment_id.data
|
||||
report_model.reported_user_id = MediaComment.query.get(
|
||||
report_model.comment_id).get_author.id
|
||||
elif report_form.validate() and 'media_entry_id' in form_dict.keys():
|
||||
report_model = MediaReport()
|
||||
report_model.media_entry_id = report_form.media_entry_id.data
|
||||
report_model.reported_user_id = MediaEntry.query.get(
|
||||
report_model.media_entry_id).get_uploader.id
|
||||
else:
|
||||
return None
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user