margin: 0px 5px 0px 0px;
padding: 0px;
}
+
+
+/* media processing panel */
+
+table.media_panel {
+ width: 100%;
+}
+
+table.media_panel th {
+ font-weight: bold;
+ padding-bottom: 4px;
+}
\ No newline at end of file
--- /dev/null
+{#
+# GNU MediaGoblin -- federated, autonomous media hosting
+# Copyright (C) 2011 Free Software Foundation, Inc
+#
+# 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 mediagoblin_content %}
+
+<h1>{% trans %}Media processing panel{% endtrans %}</h1>
+
+<p>
+ {% trans %}You can track the state of media being processed for your gallery here.{% endtrans %}
+</p>
+
+<h2>{% trans %}Media in-processing{% endtrans %}</h2>
+
+{% if processing_entries.count() %}
+ <table class="media_panel processing">
+ <tr>
+ <th>Title</th>
+ <th>When submitted</th>
+ <th>Status</th>
+ </tr>
+ {% for media_entry in processing_entries %}
+ <tr>
+ <td>{{ media_entry['title'] }}</td>
+ <td>{{ media_entry['created'].strftime("%m-%d-%Y %I:%M %p") }}</td>
+ <td></td>
+ </tr>
+ {% endfor %}
+ </table>
+{% else %}
+ <p><i>{% trans %}No media in-processing{% endtrans %}</i></p>
+{% endif %}
+
+{% if failed_entries.count() %}
+ <h2>{% trans %}These uploads failed to process:{% endtrans %}</h2>
+
+ <table class="media_panel failed">
+ <tr>
+ <th>Title</th>
+ <th>When submitted</th>
+ <th>Reason for failure</th>
+ </tr>
+ {% for media_entry in failed_entries %}
+ <tr>
+ <td>{{ media_entry['title'] }}</td>
+ <td>{{ media_entry['created'].strftime("%m-%d-%Y %I:%M %p") }}</td>
+ <td>{{ media_entry.get_fail_exception().general_message }}</td>
+ </tr>
+ {% endfor %}
+ </table>
+{% endif %}
+{% endblock %}
controller="mediagoblin.user_pages.views:atom_feed"),
Route('mediagoblin.user_pages.media_post_comment',
'/{user}/m/{media}/comment/add/',
- controller="mediagoblin.user_pages.views:media_post_comment")]
+ controller="mediagoblin.user_pages.views:media_post_comment"),
+ Route('mediagoblin.user_pages.processing_panel',
+ '/{user}/panel/',
+ controller="mediagoblin.user_pages.views:processing_panel"),
+ ]
-# GNU MediaGoblin -- federated, autonomous media hosting
+# MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2011 Free Software Foundation, Inc
#
# This program is free software: you can redistribute it and/or modify
url=entry.url_for_self(request.urlgen))
return feed.get_response()
+
+
+@require_active_login
+def processing_panel(request):
+ """
+ Show to the user what media is still in conversion/processing...
+ and what failed, and why!
+ """
+ # Get the user
+ user = request.db.User.find_one(
+ {'username': request.matchdict['user'],
+ 'status': 'active'})
+
+ # Make sure the user exists and is active
+ if not user:
+ return exc.HTTPNotFound()
+ elif user['status'] != u'active':
+ return render_to_response(
+ request,
+ 'mediagoblin/user_pages/user.html',
+ {'user': user})
+
+ # XXX: Should this be a decorator?
+ #
+ # Make sure we have permission to access this user's panel. Only
+ # admins and this user herself should be able to do so.
+ if not (user[u'_id'] == request.user[u'_id']
+ or request.user.is_admin):
+ # No? Let's simply redirect to this user's homepage then.
+ return redirect(
+ request, 'mediagoblin.user_pages.user_home',
+ user=request.matchdict['user'])
+
+ # Get media entries which are in-processing
+ processing_entries = request.db.MediaEntry.find(
+ {'uploader': user['_id'],
+ 'state': 'processing'}).sort('created', DESCENDING)
+
+ # Get media entries which have failed to process
+ failed_entries = request.db.MediaEntry.find(
+ {'uploader': user['_id'],
+ 'state': 'failed'}).sort('created', DESCENDING)
+
+ # Render to response
+ return render_to_response(
+ request,
+ 'mediagoblin/user_pages/processing_panel.html',
+ {'user': user,
+ 'processing_entries': processing_entries,
+ 'failed_entries': failed_entries})