]> git.parisson.com Git - telemeta.git/commitdiff
add a user desk tab
authorGuillaume Pellerin <yomguy@parisson.com>
Tue, 31 Jan 2012 02:10:25 +0000 (03:10 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Tue, 31 Jan 2012 02:10:25 +0000 (03:10 +0100)
telemeta/htdocs/css/telemeta.css
telemeta/templates/telemeta/base.html
telemeta/urls.py
telemeta/views/base.py

index 44b6b086af423fa495fccf8603a461f67989b106..4bec0d50a76aa286819897cdf809c6088bd50952 100644 (file)
@@ -508,7 +508,7 @@ color:#FFF;
     position:absolute;
     left:0;
     display:none;
-    margin:0 0 0 -1px;
+    margin:0 0 0 -2px;
     padding:0;
     list-style: none outside none;
     border-left:2px solid #6a0307;
index 22bbb8046aff7791adbfd597bebf3f39267d923d..d62557613b58e4907f5aa1bc799923d5b2f7694d 100644 (file)
 </ul>-->
 
 <ul id="nav">
- <li><a href="{% url telemeta-home %}" class="blue">{% trans "Home" %}</a></li>
-
+ {% if user.is_authenticated %}
+  <li><a href="{% url telemeta-lists %}" class="blue">{% trans "Desk" %}</a>
+   <ul>
+    <li><a href="{% url telemeta-lists %}">{% trans "Lists" %}</a></li>
+    <li><a href="{% url telemeta-profile-detail user.username %}">{% trans "Profile" %}</a></li>
+    <li><a href="{% url telemeta-home %}">{% trans "Home" %}</a></li>
+   </ul>
+  </li>
+ {% else %}
+  <li><a href="{% url telemeta-home %}" class="blue">{% trans "Home" %}</a></li>
+ {% endif %}
  <li><a href="{% url telemeta-archives %}" class="green">{% trans "Archives" %}</a>
   <ul>
      <li><a href="{% url telemeta-fonds %}">{% trans "Fonds" %}</a></li>
index 6654435909933c4227b99748f6eeeb8db4793914..643e872eb0fcdcd1dea72bb572c3087e6ef1cac1 100644 (file)
@@ -74,6 +74,7 @@ htdocs = os.path.dirname(__file__) + '/htdocs'
 
 urlpatterns = patterns('',
     url(r'^$', general_view.index, name="telemeta-home"),
+    url(r'^lists/$', general_view.lists, name="telemeta-lists"),
 
     # archives
     # TODO: make a real archives tree view
index 1a66c58c5770df94abb30236b2f4bdf318081b82..a0c35b27df544377509b5673a79adc9c61abd8d6 100644 (file)
@@ -212,43 +212,54 @@ class GeneralView(object):
     """Provide general web UI methods"""
 
     def index(self, request):
-        """Render the homepage"""
-        if not request.user.is_authenticated():
-            template = loader.get_template('telemeta/index.html')
-
-            sound_items = MediaItem.objects.sound()
-            _sound_pub_items = []
-            for item in sound_items:
-                if get_public_access(item.public_access,  str(item.recorded_from_date).split('-')[0],
-                                                str(item.recorded_to_date).split('-')[0]):
-                    _sound_pub_items.append(item)
-
-            random.shuffle(_sound_pub_items)
-            if len(_sound_pub_items) != 0:
-                sound_pub_item = _sound_pub_items[0]
-            else:
-                sound_pub_item = None
-            if len(_sound_pub_items) == 2:
-                sound_pub_items = [_sound_pub_items[1]]
-            elif len(_sound_pub_items) > 2:
-                sound_pub_items = _sound_pub_items[1:3]
-            else:
-                sound_pub_items = None
-
-            revisions = get_revisions(4)
-            context = RequestContext(request, {
-                        'page_content': pages.get_page_content(request, 'home', ignore_slash_issue=True),
-                        'revisions': revisions,  'sound_pub_items': sound_pub_items,
-                        'sound_pub_item': sound_pub_item })
-            return HttpResponse(template.render(context))
+        """Render the index page"""
+        
+        template = loader.get_template('telemeta/index.html')
+
+        sound_items = MediaItem.objects.sound()
+        _sound_pub_items = []
+        for item in sound_items:
+            if get_public_access(item.public_access,  str(item.recorded_from_date).split('-')[0],
+                                            str(item.recorded_to_date).split('-')[0]):
+                _sound_pub_items.append(item)
+
+        random.shuffle(_sound_pub_items)
+        if len(_sound_pub_items) != 0:
+            sound_pub_item = _sound_pub_items[0]
         else:
+            sound_pub_item = None
+        if len(_sound_pub_items) == 2:
+            sound_pub_items = [_sound_pub_items[1]]
+        elif len(_sound_pub_items) > 2:
+            sound_pub_items = _sound_pub_items[1:3]
+        else:
+            sound_pub_items = None
+
+        revisions = get_revisions(4)
+        context = RequestContext(request, {
+                    'page_content': pages.get_page_content(request, 'home', ignore_slash_issue=True),
+                    'revisions': revisions,  'sound_pub_items': sound_pub_items,
+                    'sound_pub_item': sound_pub_item })
+        return HttpResponse(template.render(context))
+
+    def lists(self, request):
+        """Render the home page"""
+        
+        if request.user.is_authenticated():
             template='telemeta/home.html'
             playlists = get_playlists(request)
-            revisions = get_revisions(50)
+            revisions = get_revisions(100)
             searches = Search.objects.filter(username=request.user)
             return render(request, template, {'playlists': playlists, 'searches': searches,
                                               'revisions': revisions,})
-
+        else:
+            template = 'telemeta/messages.html'
+            mess = ugettext('Access not allowed')
+            title = ugettext('Lists') + ' : ' + request.user + ' : ' + mess
+            description = ugettext('Please login or contact the website administator to get a private access.')
+            messages.error(request, title)
+            return render(request, template, {'description' : description})
+    
     def edit_search(self, request, criteria=None):
         year_min, year_max = MediaCollection.objects.all().recording_year_range()
         rec_years = year_min and year_max and range(year_min, year_max + 1) or []