]> git.parisson.com Git - telemeta.git/commitdiff
add rolling publishing date property (overidden bty staff or full public access
authoryomguy <yomguy@parisson.com>
Thu, 24 Mar 2011 15:05:14 +0000 (16:05 +0100)
committeryomguy <yomguy@parisson.com>
Thu, 24 Mar 2011 15:05:14 +0000 (16:05 +0100)
telemeta/locale/fr/LC_MESSAGES/django.mo
telemeta/locale/fr/LC_MESSAGES/django.po
telemeta/templates/telemeta_default/mediaitem_detail.html
telemeta/web/base.py

index 9c9544b9a7115fbc8f90e6dcf0ec03f9d9dfd720..f33603410fde314e57e2d1166a2ebd272e7b81fe 100644 (file)
Binary files a/telemeta/locale/fr/LC_MESSAGES/django.mo and b/telemeta/locale/fr/LC_MESSAGES/django.mo differ
index e736ada35f58a0734c20f6dc1a991bb49fd12de4..1766ebc57f761da441d38332b4257f35c8ff9013 100644 (file)
@@ -834,5 +834,5 @@ msgid "Enumerations"
 msgstr "Énumérations"
 
 #: web.base.py:955
-msgid "Not allowed"
-msgstr "Non autorisé"
+msgid "Access not allowed"
+msgstr "Accès non autorisé"
index 0da5cc22bd8a94c479dbe4a10b20b3c06dad7cb6..f5d6bef24b197a12afa0ab683d2d513f64cdb315 100644 (file)
@@ -61,8 +61,8 @@
 
 {% block content %}
 <h3><img src="images/item.png" style="vertical-align:middle" /> Item : {{ item }}</h3>
-<div class="{% if item.file and item.public_access == 'full' %}with-rightcol{% endif %}">
-    {% if item.file and item.public_access == 'full' %}
+<div class="{% if item.file and item.public_access == 'full' or public_access or user.is_staff %}with-rightcol{% endif %}">
+    {% if item.file and item.public_access == 'full' or public_access or user.is_staff %}
     <div id="player_maximized" class="ts-skin-lab">
         <a href="#" class="toggle">Minimize</a>
         <div class="wazing"></div>
index 9e3093566dbf96bb2e1c5a56ed0c500f668e8eef..6ac1e52b0e9c5dfa5b5bada60641f766e8d98333 100644 (file)
@@ -245,12 +245,30 @@ class WebView(object):
         previous, next = self.item_previous_next(item)
         analyzers = self.item_analyze(item)
         playlists = self.get_playlists(request)
-   
+        
+        # Rrolling publishing date : Public access when time between recorded year 
+        # and currant year is over settings value PUBLIC_ACCESS_PERIOD
+        date_from = item.recorded_from_date
+        date_to = item.recorded_to_date
+        if date_to:
+            date = date_to
+        elif date_from:
+            date = date_from
+        else:
+            date = None
+        public_access = True
+        if date:
+            year = str(date).split('-')
+            year_now = datetime.datetime.now().strftime("%Y")
+            if int(year_now) - int(year[0]) < settings.PUBLIC_ACCESS_PERIOD:
+                public_access = False
+            
         return render(request, template,
                     {'item': item, 'export_formats': formats,
                     'visualizers': graphers, 'visualizer_id': grapher_id,'analysers': analyzers,
                     'audio_export_enabled': getattr(settings, 'TELEMETA_DOWNLOAD_ENABLED', True),
                     'previous' : previous, 'next' : next, 'marker': marker_id, 'playlists' : playlists, 
+                    'public_access': public_access, 
                     })
 
     @method_decorator(permission_required('telemeta.change_mediaitem'))
@@ -952,5 +970,5 @@ class WebView(object):
         return response
         
     def not_allowed(self, request):
-        messages.error(request, ugettext('Not allowed'))
+        messages.error(request, ugettext('Access not allowed'))
         return render(request, 'telemeta/messages.html')