',
- 'mediagoblin.meta.views:public_reports_details')
-]
diff --git a/mediagoblin/meta/views.py b/mediagoblin/meta/views.py
deleted file mode 100644
index 79940a22..00000000
--- a/mediagoblin/meta/views.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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 .
-
-from mediagoblin.tools.response import render_to_response
-
-
-def terms_of_service(request):
- return render_to_response(request,
- 'mediagoblin/meta/terms_of_service.html',
- {})
-
-def public_reports_panel(request):
- return render_to_response(request,
- 'mediagoblin/meta/reports_panel.html',
- {})
-
-def public_reports_details(request):
- return render_to_response(request,
- 'mediagoblin/meta/reports_details.html',
- {})
diff --git a/mediagoblin/moderation/forms.py b/mediagoblin/moderation/forms.py
index 7e225fb6..78e9fcdc 100644
--- a/mediagoblin/moderation/forms.py
+++ b/mediagoblin/moderation/forms.py
@@ -130,27 +130,12 @@ class ReportPanelSortingForm(wtforms.Form):
This form is used for sorting and filtering through different reports in
the mediagoblin.moderation.reports_panel view.
- Parameters that start with 'active_' refer to a sort/filter for the active
- reports.
- Parameters that start with 'closed_' refer to a sort/filter for the closed
- reports.
"""
active_p = wtforms.IntegerField(
- _(u'Page'),
- validators=[wtforms.validators.optional()])
- active_reported_user = wtforms.IntegerField(
- _(u'Reported User'),
- validators=[wtforms.validators.optional()])
- active_reporter = wtforms.IntegerField(
- _(u'Reporter'),
validators=[wtforms.validators.optional()])
closed_p = wtforms.IntegerField(
- _(u'Page'),
validators=[wtforms.validators.optional()])
- closed_reported_user = wtforms.IntegerField(
- _(u'Reported User'),
+ reported_user = wtforms.IntegerField(
validators=[wtforms.validators.optional()])
- closed_reporter = wtforms.IntegerField(
- _(u'Reporter'),
+ reporter = wtforms.IntegerField(
validators=[wtforms.validators.optional()])
-
diff --git a/mediagoblin/moderation/tools.py b/mediagoblin/moderation/tools.py
index 355ffa99..2d680c15 100644
--- a/mediagoblin/moderation/tools.py
+++ b/mediagoblin/moderation/tools.py
@@ -229,5 +229,21 @@ def unban_user(user_id):
user_ban.first().delete()
return True
+def parse_report_panel_settings(form):
+ """
+ This function parses the url arguments to which are used to filter reports
+ in the reports panel view. More filters can be added to make a usuable
+ search function.
+ :returns A dictionary of sqlalchemy-usable filters.
+ """
+ filters = {}
+ if form.validate():
+ filters['reported_user_id'] = form.reported_user.data
+ filters['reporter_id'] = form.reporter.data
+
+ filters = dict((k, v)
+ for k, v in filters.iteritems() if v)
+
+ return filters
diff --git a/mediagoblin/moderation/views.py b/mediagoblin/moderation/views.py
index f09f4c99..6a23ddd6 100644
--- a/mediagoblin/moderation/views.py
+++ b/mediagoblin/moderation/views.py
@@ -24,7 +24,9 @@ from mediagoblin.decorators import (require_admin_or_moderator_login, \
from mediagoblin.tools.response import render_to_response, redirect
from mediagoblin.moderation import forms as moderation_forms
from mediagoblin.moderation.tools import (take_punitive_actions, \
- take_away_privileges, give_privileges, ban_user, unban_user)
+ take_away_privileges, give_privileges, ban_user, unban_user, \
+ parse_report_panel_settings)
+from werkzeug.datastructures import ImmutableMultiDict
from datetime import datetime
from math import ceil
@@ -92,37 +94,35 @@ def moderation_reports_panel(request):
Show the global panel for monitoring reports filed against comments or
media entries for this instance.
'''
+ filters = []
+ active_settings, closed_settings = {'current_page':1}, {'current_page':1}
- form = moderation_forms.ReportPanelSortingForm(request.args)
- active_settings = {'start_page':1, 'filters':{}}
- closed_settings = {'start_page':1, 'filters':{}}
- if form.validate():
- active_settings['start_page'] = form.active_p.data or 1
- active_settings['filters']['reported_user_id'] = form.active_reported_user.data
- active_settings['filters']['reporter_id'] = form.active_reporter.data
- closed_settings['start_page'] = form.closed_p.data or 1
- closed_settings['filters']['reported_user_id'] = form.closed_reported_user.data
- closed_settings['filters']['reporter_id'] = form.closed_reporter.data
-
- active_settings['filters']=dict((k, v) for k, v in active_settings['filters'].iteritems() if v)
- closed_settings['filters']=dict((k, v) for k, v in closed_settings['filters'].iteritems() if v)
- active_filter = [
- getattr(ReportBase,key)==val \
-for key,val in active_settings['filters'].viewitems()]
- closed_filter = [
- getattr(ReportBase,key)==val \
-for key,val in active_settings['filters'].viewitems()]
+ if len(request.args) > 0:
+ form = moderation_forms.ReportPanelSortingForm(request.args)
+ if form.validate():
+ filters = parse_report_panel_settings(form)
+ active_settings['current_page'] = form.active_p.data or 1
+ closed_settings['current_page'] = form.closed_p.data or 1
+ filters = [
+ getattr(ReportBase,key)==val
+ for key,val in filters.viewitems()]
all_active = ReportBase.query.filter(
ReportBase.discriminator!="archived_report").filter(
- *active_filter)
+ *filters)
all_closed = ReportBase.query.filter(
ReportBase.discriminator=="archived_report").filter(
- *closed_filter)
+ *filters)
+
+ # report_list and closed_report_list are the two lists of up to 10
+ # items which are actually passed to the user in this request
report_list = all_active.order_by(
- ReportBase.created.desc()).offset((active_settings['start_page']-1)*10).limit(10)
+ ReportBase.created.desc()).offset(
+ (active_settings['current_page']-1)*10).limit(10)
closed_report_list = all_closed.order_by(
- ReportBase.created.desc()).offset((closed_settings['start_page']-1)*10).limit(10)
+ ReportBase.created.desc()).offset(
+ (closed_settings['current_page']-1)*10).limit(10)
+
active_settings['last_page'] = int(ceil(all_active.count()/10.))
closed_settings['last_page'] = int(ceil(all_closed.count()/10.))
# Render to response
diff --git a/mediagoblin/routing.py b/mediagoblin/routing.py
index a9809c44..c2c6d284 100644
--- a/mediagoblin/routing.py
+++ b/mediagoblin/routing.py
@@ -20,7 +20,6 @@ from mediagoblin.tools.routing import add_route, mount, url_map
from mediagoblin.tools.pluginapi import PluginManager
from mediagoblin.moderation.routing import moderation_routes
from mediagoblin.auth.routing import auth_routes
-from mediagoblin.meta.routing import meta_routes
_log = logging.getLogger(__name__)
@@ -28,9 +27,10 @@ _log = logging.getLogger(__name__)
def get_url_map():
add_route('index', '/', 'mediagoblin.views:root_view')
+ add_route('terms_of_service','/terms_of_service',
+ 'mediagoblin.views:terms_of_service')
mount('/auth', auth_routes)
mount('/mod', moderation_routes)
- mount('/meta', meta_routes)
import mediagoblin.submit.routing
import mediagoblin.user_pages.routing
diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css
index d9610675..b9b806f9 100644
--- a/mediagoblin/static/css/base.css
+++ b/mediagoblin/static/css/base.css
@@ -156,6 +156,10 @@ a.logo {
margin: 6px 8px 6px 0;
}
+.fine_print {
+ font-size: 0.8em;
+}
+
.mediagoblin_content {
width: 100%;
padding-bottom: 74px;
@@ -665,6 +669,10 @@ table td.user_without_privilege {
#code_of_conduct_list li {
margin:5px 0 15px 25px;
}
+#code_of_conduct_list strong{
+ color:#fff;
+}
+
.nested_sublist {
margin: 5px 0 10px 25px;
font-size:80%;
diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html
index 40cec5f7..938dac75 100644
--- a/mediagoblin/templates/mediagoblin/base.html
+++ b/mediagoblin/templates/mediagoblin/base.html
@@ -89,6 +89,12 @@
"javascript:;"
{% endif %}
>{% trans %}log out{% endtrans %}
+
+ {%- trans %}Create new collection{% endtrans -%}
+
+
+ Terms of Service
+
{% endif %}
{%- elif auth %}
{%- trans %}Add media{% endtrans -%}
-
- {%- trans %}Create new collection{% endtrans -%}
-
{% if request.user.has_privilege('admin','moderator') %}
Moderation powers:
{%- trans %}Media processing panel{% endtrans -%}
+ ·
{%- trans %}User management panel{% endtrans -%}
+ ·
{%- trans %}Report management panel{% endtrans -%}
{% endif %}
+
+ {%- trans %}Create new collection{% endtrans -%}
+
+
+ Terms of Service
+
{% include 'mediagoblin/fragments/header_notifications.html' %}
{% endif %}
diff --git a/mediagoblin/templates/mediagoblin/meta/code_of_conduct.html b/mediagoblin/templates/mediagoblin/meta/code_of_conduct.html
deleted file mode 100644
index e8233ad3..00000000
--- a/mediagoblin/templates/mediagoblin/meta/code_of_conduct.html
+++ /dev/null
@@ -1,46 +0,0 @@
-{#
-# 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 %}
- Code of Conduct
-{% endblock %}
-
-{% block mediagoblin_content -%}
-{% trans %}Code of Conduct for this Website{% endtrans %}
-
-{# Suggested layout for this page:
-
- - Item #1
- -
- Item #2
-
- - Sub-Item #1
- - Sub-Item #2
- -
- Sub-Item #3
-
- - Sub-Subitem #1
-
-
-
-
- - Item #3
-
-#}
-{% endblock -%}
diff --git a/mediagoblin/templates/mediagoblin/meta/reports_details.html b/mediagoblin/templates/mediagoblin/meta/reports_details.html
deleted file mode 100644
index 6fa5ae59..00000000
--- a/mediagoblin/templates/mediagoblin/meta/reports_details.html
+++ /dev/null
@@ -1,17 +0,0 @@
-{#
-# 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 .
-#}
diff --git a/mediagoblin/templates/mediagoblin/meta/reports_panel.html b/mediagoblin/templates/mediagoblin/meta/reports_panel.html
deleted file mode 100644
index 6fa5ae59..00000000
--- a/mediagoblin/templates/mediagoblin/meta/reports_panel.html
+++ /dev/null
@@ -1,17 +0,0 @@
-{#
-# 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 .
-#}
diff --git a/mediagoblin/templates/mediagoblin/moderation/report_panel.html b/mediagoblin/templates/mediagoblin/moderation/report_panel.html
index a72e2e77..988dd292 100644
--- a/mediagoblin/templates/mediagoblin/moderation/report_panel.html
+++ b/mediagoblin/templates/mediagoblin/moderation/report_panel.html
@@ -16,6 +16,7 @@
# along with this program. If not, see .
#}
{% extends "mediagoblin/base.html" %}
+{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
{% block title -%}
{% trans %}Report panel{% endtrans %} — {{ super() }}
@@ -33,34 +34,40 @@
{% trans %}Active Reports Filed{% endtrans %}
{% if not active_settings.last_page == 1 %}
- {% if 'active_p='~active_settings.start_page in request.query_string %}
+ {% if 'active_p='~active_settings.current_page in request.query_string %}
{% set query_string = request.query_string %}{% else %}
{% set query_string =
-'active_p='~active_settings.start_page~"&"+request.query_string %}
+'active_p='~active_settings.current_page~"&"+request.query_string %}
{% endif %}
- {% set first_vis = active_settings.start_page-3 %}
- {% set last_vis = active_settings.start_page+3 %}
- {% set curr_page = active_settings.start_page %}
+ {% set first_vis = active_settings.current_page-3 %}
+ {% set last_vis = active_settings.current_page+3 %}
+ {% set curr_page = active_settings.current_page %}
{% if 1 == curr_page %}
1{% else %}
- {{ 1 }}{% endif %}
+ 1{% endif %}
{% if first_vis > 1 %}...{% endif %}
{% for p in range(first_vis,last_vis+1) %}
- {% if p > 1 and p < active_settings.last_page %}
+ {% if p > 1 and p < active_settings.last_page and
+curr_page !=p %}
{{ p }}
+ {% elif p > 1 and p < active_settings.last_page %}
+
{{ p }}
{% endif %}
{% endfor %}
{% if last_vis < active_settings.last_page %}...{% endif %}
+ {% if active_settings.last_page != curr_page %}
{{ active_settings.last_page }}
+ {% else %}
{{ active_settings.last_page }}
+ {% endif %}
{% endif %}
{% if report_list.count() %}
@@ -115,32 +122,43 @@
{% endif %}
{% trans %}Closed Reports{% endtrans %}
{% if not closed_settings.last_page == 1 %}
- {% if 'closed_p='~closed_settings.start_page in request.query_string %}
+ {% if 'closed_p='~closed_settings.current_page in request.query_string %}
{% set query_string = request.query_string %}{% else %}
{% set query_string =
-'closed_p='~closed_settings.start_page~"&"+request.query_string %}
+'closed_p='~closed_settings.current_page~"&"+request.query_string %}
{% endif %}
- {% set first_vis = closed_settings.start_page-3 %}
- {% set last_vis = closed_settings.start_page+3 %}
+ {% set first_vis = closed_settings.current_page-3 %}
+ {% set last_vis = closed_settings.current_page+3 %}
+ {% set curr_page = closed_settings.current_page %}
+ {% if not curr_page==1 %}
- {{ 1 }}
+ 'closed_p='~closed_settings.current_page,
+ 'closed_p='~1) }}">1
+ {% else %}
+
1
+ {% endif %}
{% if first_vis > 1 %}...{% endif %}
{% for p in range(first_vis,last_vis+1) %}
- {% if p > 1 and p < closed_settings.last_page %}
+ {% if p > 1 and p < closed_settings.last_page and
+curr_page !=p %}
{{ p }}
+
+ {% elif p > 1 and p < closed_settings.last_page %}
+
{{ p }}
{% endif %}
{% endfor %}
{% if last_vis < closed_settings.last_page %}...{% endif %}
-
- {{ closed_settings.last_page }}
+ {{ closed_settings.last_page }}
+ {% else %}
{{ closed_settings.last_page }}
+ {% endif %}
{% endif %}
{% if closed_report_list.count() %}
@@ -178,4 +196,5 @@
{% else %}
{% trans %}No closed reports found.{% endtrans %}
{% endif %}
+
{% endblock %}
diff --git a/mediagoblin/templates/mediagoblin/moderation/user.html b/mediagoblin/templates/mediagoblin/moderation/user.html
index 17a08603..36ba42ac 100644
--- a/mediagoblin/templates/mediagoblin/moderation/user.html
+++ b/mediagoblin/templates/mediagoblin/moderation/user.html
@@ -38,7 +38,7 @@
{% trans %}Sorry, no such user found.{% endtrans %}
{# User exists, but needs verification #}
{% elif not user.has_privilege('active') %}
-