From 3ce0c6113eee9d291a8cba7d398a3d3114792cc9 Mon Sep 17 00:00:00 2001 From: tilly-Q Date: Mon, 8 Jul 2013 14:20:28 -0400 Subject: [PATCH] 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. --- mediagoblin/admin/routing.py | 14 +- mediagoblin/admin/views.py | 49 +++++- mediagoblin/db/migrations.py | 6 +- mediagoblin/db/mixin.py | 1 - mediagoblin/db/models.py | 12 +- mediagoblin/decorators.py | 1 - mediagoblin/static/css/base.css | 36 ++++- mediagoblin/static/images/icon_clipboard.png | Bin 0 -> 682 bytes .../admin/{panel.html => media_panel.html} | 0 .../templates/mediagoblin/admin/report.html | 143 ++++++++--------- .../mediagoblin/admin/report_panel.html | 95 +++++++++++ .../templates/mediagoblin/admin/user.html | 147 ++++++++++++++---- .../mediagoblin/admin/user_panel.html | 55 +++++++ mediagoblin/templates/mediagoblin/base.html | 2 +- .../mediagoblin/user_pages/media.html | 13 +- .../templates/mediagoblin/utils/report.html | 33 ++++ mediagoblin/user_pages/lib.py | 7 +- 17 files changed, 470 insertions(+), 144 deletions(-) create mode 100644 mediagoblin/static/images/icon_clipboard.png rename mediagoblin/templates/mediagoblin/admin/{panel.html => media_panel.html} (100%) create mode 100644 mediagoblin/templates/mediagoblin/admin/report_panel.html create mode 100644 mediagoblin/templates/mediagoblin/admin/user_panel.html create mode 100644 mediagoblin/templates/mediagoblin/utils/report.html diff --git a/mediagoblin/admin/routing.py b/mediagoblin/admin/routing.py index d5edac0f..c7ca5b92 100644 --- a/mediagoblin/admin/routing.py +++ b/mediagoblin/admin/routing.py @@ -15,12 +15,18 @@ # along with this program. If not, see . 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/', + 'mediagoblin.admin.views:admin_users_detail'), + ('mediagoblin.admin.reports_detail', + '/reports/', + 'mediagoblin.admin.views:admin_reports_detail')] diff --git a/mediagoblin/admin/views.py b/mediagoblin/admin/views.py index 7a4dfbd4..97970577 100644 --- a/mediagoblin/admin/views.py +++ b/mediagoblin/admin/views.py @@ -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,12 +51,30 @@ def admin_users_panel(request): ''' user_list = User.query - # Render to response return render_to_response( request, - 'mediagoblin/admin/user.html', + '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':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}) + + diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index 053f3db2..a32f5932 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -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() - - diff --git a/mediagoblin/db/mixin.py b/mediagoblin/db/mixin.py index 9f566e36..70c9dd41 100644 --- a/mediagoblin/db/mixin.py +++ b/mediagoblin/db/mixin.py @@ -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. diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index e0419c92..e4c97a2c 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -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, diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py index 206957fa..fefbccef 100644 --- a/mediagoblin/decorators.py +++ b/mediagoblin/decorators.py @@ -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): diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 5b8226e6..1cded530 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -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 */ diff --git a/mediagoblin/static/images/icon_clipboard.png b/mediagoblin/static/images/icon_clipboard.png new file mode 100644 index 0000000000000000000000000000000000000000..6f94498b61f597a96617b8a8f85a88b193af4fe6 GIT binary patch literal 682 zcmV;b0#*HqP)Px#24YJ`L;&Rg;{eOPWrh&|000SaNLh0L01ejw01ejxLMWSf00007bV*G`2i*q+ z5f}(|u25e900JsWL_t(I%Y~B7OO-(s#(y*K+-rqt3sY?2qD4Zh7A*rI>iThY+b%)~ zr7oI_AWDL8R}0IJThRaDvLtO26)oCCn>G=lM2Li>_Ho~tIj6;YeQ##ez`($q^PA^+ z<{196W~z6mVhA@xBr(Q>Vxehrta9bf-)haXdp%W&aYUjxP*jzdwbP7`UBy~UjFI{3 zG$-{DqS?J-LXwzj`R1Dm=WDgm6K6&f>xuxZtZlKm{EiPF-y04{is zB6)FZ;XAjcruKO4?koZsKoNrXSq2N&k7>`jNxrSV0$^k7C#&%&>)L?`pxW@Rii*_F zf^&u0Oo2pH6@Wv{O}zfn#>L?g{_RPKzRUbY}QK#*eUfP;Jo*U z#N8I^3X;UJ^kfNR4F*#OKwp1v_K^3P0{KIM4;jE(OL?%2wF%bR%!(>eq@f_jxF^K? zkBwpR@nY6&EklDtD3WIqyvG4ZjJrduD-aQS`+DoITYT{OTu=b-JteflFg(0)7z z=-YJw4mP*^a}Go#nA!9D=VMGSp=x(7w%X3JQS3(YscURe&D5%DVPA3X7u{-03R6w& QBLDyZ07*qoM6N<$f<&G%od5s; literal 0 HcmV?d00001 diff --git a/mediagoblin/templates/mediagoblin/admin/panel.html b/mediagoblin/templates/mediagoblin/admin/media_panel.html similarity index 100% rename from mediagoblin/templates/mediagoblin/admin/panel.html rename to mediagoblin/templates/mediagoblin/admin/media_panel.html diff --git a/mediagoblin/templates/mediagoblin/admin/report.html b/mediagoblin/templates/mediagoblin/admin/report.html index ff5cb427..2e802198 100644 --- a/mediagoblin/templates/mediagoblin/admin/report.html +++ b/mediagoblin/templates/mediagoblin/admin/report.html @@ -15,81 +15,76 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . #} -{% extends "mediagoblin/base.html" %} +{%- 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 }}
+{%- block mediagoblin_content %} +{% if not report %} + Sorry, no such report found. {% else %} -

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

+

Report #{{ report.id }}

+ {% if comment %} + Reported comment: + {% set reported_user = comment.get_author %} + + {% elif media_entry %} + +
+ {% endif %} + Reason for report: + {% 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/report_panel.html b/mediagoblin/templates/mediagoblin/admin/report_panel.html new file mode 100644 index 00000000..30194577 --- /dev/null +++ b/mediagoblin/templates/mediagoblin/admin/report_panel.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 index 6b6d226a..90b3f583 100644 --- a/mediagoblin/templates/mediagoblin/admin/user.html +++ b/mediagoblin/templates/mediagoblin/admin/user.html @@ -17,38 +17,121 @@ #} {% 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 %} + +{% 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 %} +

{% trans %}Sorry, no such user found.{% endtrans %}

+ + {# User exists, but needs verification #} + {% elif user.status == "needs_email_verification" %} +
+

{% trans %}Email verification needed{% endtrans %}

+ +

+ {% trans -%} + Someone has registered an account with this username, but it still has to be activated. + {%- endtrans %} +

+ +

+ {% trans login_url=request.urlgen('mediagoblin.auth.login') -%} + If you are that person but you've lost your verification email, you can log in and resend it. + {%- endtrans %} +

+
+ + {# Active(?) (or at least verified at some point) user, horray! #} + {% else %} +

+ {%- trans username=user.username %}{{ username }}'s profile{% endtrans -%} +

+ + {% if not user.url and not user.bio %} +
+

+ {% trans -%} + This user hasn't filled in their profile (yet). + {%- endtrans %} +

+ {% else %} +
+ {% include "mediagoblin/utils/profile.html" %} + {% if request.user and + (request.user.id == user.id or request.user.is_admin) %} + + {%- trans %}Edit profile{% endtrans -%} + + {% endif %} + {% endif %} +

+ + {%- trans %}Browse collections{% endtrans -%} + +

+
+ {% endif %} + {% if user %} +

{%- trans %}Active Reports on{% endtrans -%} {{ user.username }}

+ {% if reports.count() %} +
IDUsernameWhen Joined# of Comments Posted
- - - - + + + - {% endfor %} -
{{ user.id }}{{ user.username }}{{ user.created.strftime("%F %R") }}{{ user.posted_comments.count() }}{%- trans %}Report ID{% endtrans -%}{%- trans %}Reported Content{% endtrans -%}{%- trans %}Description of Report{% endtrans -%}
-{% else %} -

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

-{% endif %} + {% for report in reports %} + + + + + {%- trans %}Report #{% endtrans -%}{{ report.id }} + + + + {% if report.discriminator == "comment_report" %} + {%- trans %}Reported Comment{% endtrans -%} + {% elif report.discriminator == "media_report" %} + {%- trans %}Reported Media Entry{% endtrans -%} + {% endif %} + + {{ report.report_content[:21] }}{% if report.report_content|count >20 %}...{% endif %} + {%- trans %}Resolve{% endtrans -%} + + {% endfor %} + + + {% else %} + {%- trans %}No active reports filed on{% endtrans -%} {{ user.username }} + {% endif %} + {{ user.username }}'s report history + +

{{ user.username }}'s Privileges

+ + + + + {% for privilege in privileges %} + + + + + + {% endfor %} +
{% trans %}Privilege{% endtrans %}{% trans %}User Has Privilege{% endtrans %}
{{ privilege.privilege_name }}{% if privilege in user.all_privileges %}Yes{% else %}No{% endif %}{% if privilege in user.all_privileges and privilege.id < request.user.get_highest_privilege().id %}{% trans %}Take Away{% endtrans %}{% else %}{% trans %}Give Privilege{% endtrans %}{% endif %}
+ {% endif %} {% endblock %} diff --git a/mediagoblin/templates/mediagoblin/admin/user_panel.html b/mediagoblin/templates/mediagoblin/admin/user_panel.html new file mode 100644 index 00000000..cc965b73 --- /dev/null +++ b/mediagoblin/templates/mediagoblin/admin/user_panel.html @@ -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 . +#} +{% 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 %} +
{% trans %}ID{% endtrans %}{% trans %}Username{% endtrans %}{% trans %}When Joined{% endtrans %}{% trans %}# of Comments Posted{% endtrans %}
{{ 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/base.html b/mediagoblin/templates/mediagoblin/base.html index 6c7c07d0..e9a18f22 100644 --- a/mediagoblin/templates/mediagoblin/base.html +++ b/mediagoblin/templates/mediagoblin/base.html @@ -104,7 +104,7 @@ {% if request.user.is_admin %}

Admin powers: - + {%- trans %}Media processing panel{% endtrans -%}

diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index 134a80ad..1e64ae07 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -95,17 +95,6 @@ {% trans %}Add a comment{% endtrans %} {% endif %} - - {% trans %}Report media{% endtrans %} - {% if request.user %}
. +#} + +{% block report_content -%} +

+ + {% trans %}Report media{% endtrans %} + +

+{% endblock %} diff --git a/mediagoblin/user_pages/lib.py b/mediagoblin/user_pages/lib.py index 557c4853..2558b066 100644 --- a/mediagoblin/user_pages/lib.py +++ b/mediagoblin/user_pages/lib.py @@ -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 -- 2.25.1