Merge with 4fea77d5154adb7f5d27f9dcc936d8433b4f70a5
authorcavaliet
Thu, 12 Jan 2012 16:18:47 +0100
changeset 365 033f944da5e2
parent 364 0d1a9d5922ed (diff)
parent 362 4fea77d5154a (current diff)
child 369 271e8d0e251b
Merge with 4fea77d5154adb7f5d27f9dcc936d8433b4f70a5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html	Thu Jan 12 16:18:47 2012 +0100
@@ -0,0 +1,30 @@
+{% extends "front/front_base.html" %}
+{% load i18n %}
+{% load thumbnail %}
+{% load front_tags %}
+
+{% block title %}Lignes de temps : groupe "{{group.name}}"{% endblock %}
+
+{% block css_import %}
+{{block.super}}
+<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/front_home.css" type="text/css"/>
+{% endblock %}
+
+{% block body %}
+{{block.super}}
+<!-- Last annotated contents -->
+<ul class="floatlist full_width" id="derniers_medias">
+    <li class="li_h2">
+        <h2>{% trans 'All medias' %}</h2>
+    </li>
+    {% for content in content_list %}
+    <li class="li_media">
+        <a href="{% url ldt.ldt_utils.views.front.annot_content content.iri_id %}">{% thumbnail content.image "294x165" format="PNG" crop="center" as im %}<img src="{{ im.url }}" class="img_media" width="{{ im.width }}" height="{{ im.height }}">{% endthumbnail %}</a>
+        <div class="bulle_annot">{{ content.nb_annotation }}</div>
+        <p><a href="{% url ldt.ldt_utils.views.front.annot_content content.iri_id %}"><b>{% if content.title|length > 69 %}{{content.title|slice:":69"}}...{% else %}{{content.title}}{% endif %}</b></a></p>
+        <p>{% trans 'by' %} IRI | {{content.duration|str_duration:"h"}}</p>
+    </li>
+    {% endfor %}
+</ul>
+{% endblock %}
+
--- a/src/ldt/ldt/ldt_utils/templates/front/front_home.html	Thu Jan 12 16:11:21 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_home.html	Thu Jan 12 16:18:47 2012 +0100
@@ -16,7 +16,12 @@
 <!-- Last annotated contents -->
 <ul class="floatlist full_width" id="derniers_medias">
     <li class="li_h2">
-        <h2>{% trans 'Last annotated medias' %}</h2>
+      <ul class="title_ul">
+        <li><h2>{% trans 'Last annotated medias' %}</h2></li>
+	    <li class="li_right">
+	        <a class="blue" href="{% url ldt.ldt_utils.views.front.all_contents %}"><img src="{{LDT_MEDIA_PREFIX}}img/little_plus.png" alt="" />&nbsp;{% trans 'All medias' %}</a>
+	    </li>
+      </ul>
     </li>
     {% for content in last_contents %}
     <li class="li_media">
@@ -30,7 +35,12 @@
 <!-- Most annotated contents -->
 <ul class="floatlist" id="plus_annotes">
     <li class="li_h2">
-        <h2>{% trans 'Most annotated medias' %}</h2>
+      <ul class="title_ul">
+        <li><h2>{% trans 'Most annotated medias' %}</h2></li>
+        <li class="li_right">
+            <a class="blue" href="{% url ldt.ldt_utils.views.front.all_contents %}"><img src="{{LDT_MEDIA_PREFIX}}img/little_plus.png" alt="" />&nbsp;{% trans 'All medias' %}</a>
+        </li>
+      </ul>
     </li>
     {% for content in most_contents %}
     <li class="li_media">
--- a/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html	Thu Jan 12 16:11:21 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html	Thu Jan 12 16:18:47 2012 +0100
@@ -18,11 +18,11 @@
 
 {% block body %}
 {{block.super}}
-
-
 <script type="text/javascript">
     $(document).ready(function () {
-    	
+        // We draw the annotation volume for each content
+        /* Use 'html' instead of an array of values to pass options 
+        to a sparkline with data in the tag */
         $('.graph_annotation').sparkline('html', {width: '340px',
         										  height:'25px',
         										  minSpotColor: false,
@@ -30,13 +30,29 @@
         										  spotColor: false,
         										  lineWidth: '0px',
         										  fillColor: '#adadad',
-        										  lineColor: '#adadad'}); 
-
-        /* Use 'html' instead of an array of values to pass options 
-        to a sparkline with data in the tag */
+        										  lineColor: '#adadad'});
+        
+        // We put the annotations into an object
+        var annots = [];
+        width_max = 340;
+        {% for res in results.object_list %}
+        // We get the canvas
+        var cnv = $('#{{ res.content.iri_id }}').children()[0];
+        var ctx = cnv.getContext("2d");
+        var content_dur = {{ res.content.duration }};
+            {% for segment in res.list %}
+            // We draw the segment in the canvas
+		    ctx.fillStyle = 'rgba(244,154,245,0.5)';
+            x = (width_max*{{segment.begin}})/content_dur;
+            y = 0;
+            w = (width_max*{{segment.duration}})/content_dur;;
+            h = 25;
+		    ctx.fillRect (x, y, w, h);
+            {% endfor %}
+        {% endfor %}
+        // We draw
     });
-</script>	
-
+</script>
 
 {% if msg %}
 {{ msg }}
@@ -76,10 +92,9 @@
                         <p>{{res.content.duration|str_duration:"::"}}</p>
                     </div>
                     <div class="graphe_result_media">
-                    	<span class="graph_annotation">
+                    	<span id="{{ res.content.iri_id }}" class="graph_annotation">
                     	{{ res.content.stat_annotation }}
                     	</span>
-                        <!--  <img src="img/placeholder_media_graph.png" width="340" height="25" alt="graph de volume" />-->
                     </div>
                 </div>
         
--- a/src/ldt/ldt/ldt_utils/urls.py	Thu Jan 12 16:11:21 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/urls.py	Thu Jan 12 16:18:47 2012 +0100
@@ -45,6 +45,7 @@
     url(r'^front/player/(?P<content_iri_id>.*)$', 'views.front.annot_content'),
     url(r'^front/search/$', 'views.front.search_index'),
     url(r'^front/searchListing', 'views.front.search_listing'),
+    url(r'^front/medias', 'views.front.all_contents'),
 )
 
 urlpatterns += patterns('',
--- a/src/ldt/ldt/ldt_utils/views/front.py	Thu Jan 12 16:11:21 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/front.py	Thu Jan 12 16:18:47 2012 +0100
@@ -48,6 +48,19 @@
 
 
 @login_required
+def all_contents(request):
+    # Get all the public contents group
+    content_list = add_change_attr(request.user, Content.safe_objects.all())
+    
+    is_gecko = ((request.META['HTTP_USER_AGENT'].lower().find("firefox")) > -1);
+
+    return render_to_response("front/front_all_contents.html",
+                              {'content_list':content_list, 
+                               'is_gecko': is_gecko},
+                              context_instance=RequestContext(request))
+
+
+@login_required
 def annot_content(request, content_iri_id):
     # Get the wanted content
     content = Content.objects.get(iri_id=content_iri_id)
--- a/src/ldt/ldt/static/ldt/css/front_home.css	Thu Jan 12 16:11:21 2012 +0100
+++ b/src/ldt/ldt/static/ldt/css/front_home.css	Thu Jan 12 16:18:47 2012 +0100
@@ -8,10 +8,20 @@
     width: 960px;
 }
 
+#derniers_medias .li_right {
+    float: right; margin-top:10px;
+}
+
 #derniers_medias .li_media {
+    height: 225px;
     width: 300px;
 }
 
+/* Communs */
+.title_ul {
+    list-style: none;
+}
+
 /* Plus annotés */
 
 #plus_annotes {
@@ -22,6 +32,10 @@
     width: 630px; margin-right: 10px;
 }
 
+#plus_annotes .li_right {
+    float: right; margin-top:10px;
+}
+
 #plus_annotes .li_media {
     width:  140px;
     height: 140px;