{% block tools %}
<!-- <a href="{% url telemeta-item-detail item.public_id %}">
<img src="images/edit_cancel.png" /></a>-->
- <a href="{% url telemeta-item-detail item.public_id %}"
+ <a href="{% url telemeta-items %}"
class="roundBorder6 mediaitem_button mediaitem_button_cancel">{% trans "Cancel" %}</a>
{% endblock tools %}
{% endfor %}
</table>
<div align="center">
- <a href="{% url telemeta-item-detail item.public_id %}"
+ <a href="{% url telemeta-items %}"
class="mediaitem_button mediaitem_button_cancel">{% trans "Cancel" %}</a>
<a href="#" class="mediaitem_button mediaitem_button_save"
onclick="document.getElementById('_addItemForm').submit(); return false;">{% trans "Save" %}</a>
{% block content %}
<h3><img src="images/item.png" style="vertical-align:middle" /> Item : {{ item }}</h3>
-<div class="{% if item.file %}with-rightcol{% endif %}">
- {% if item.file %}
+<div class="{% if item.file and item.public_access == 'full' %}with-rightcol{% endif %}">
+ {% if item.file and item.public_access == 'full' %}
<div id="player_maximized" class="ts-skin-lab">
<a href="#" class="toggle">Minimize</a>
<div class="wazing"></div>
url(r'^markers/(?P<marker_id>[A-Za-z0-9]+)/$', web_view.item_detail, name="telemeta-item-detail-marker"),
# RSS feeds
- url(r'rss/$', web_view.rss, name="telemeta-rss"),
+ url(r'^rss/$', web_view.rss, name="telemeta-rss"),
+
+ # Not allowed
+ url(r'^not_allowed/$', web_view.not_allowed, name="telemeta-not-allowed"),
)
from django.views.generic import list_detail
from django.conf import settings
from django.contrib import auth
+from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from django.core.context_processors import csrf
from django.forms.models import modelformset_factory
def item_export(self, request, public_id, extension):
"""Export a given media item in the specified format (OGG, FLAC, ...)"""
-
- if extension != 'mp3' and not getattr(settings, 'TELEMETA_DOWNLOAD_ENABLED', False):
- raise Http404 # FIXME: should be some sort of permissions denied error
+
+ item = MediaItem.objects.get(public_id=public_id)
+
+ if extension != 'mp3' and not getattr(settings, 'TELEMETA_DOWNLOAD_ENABLED', False) or item.public_access != 'full':
+ return HttpResponseRedirect('/not_allowed/')
for encoder in self.encoders:
if encoder.file_extension() == extension:
mime_type = encoder.mime_type()
file = public_id + '.' + encoder.file_extension()
- item = MediaItem.objects.get(public_id=public_id)
audio = item.file.path
decoder = timeside.decoder.FileDecoder(audio)
feed = rss.to_xml(encoding='utf-8')
response = HttpResponse(feed, mimetype='application/rss+xml')
-
return response
-
+ def not_allowed(self, request):
+ messages.error(request, 'Not allowed')
+ return render(request, 'telemeta/messages.html')