Merge with latest upstream
authorhamidouk
Fri, 13 Jan 2012 16:24:16 +0100
changeset 381 af6e95605934
parent 380 ae8ab8763cfd (current diff)
parent 377 a1f9f7583925 (diff)
child 385 64a187532417
child 388 454bd3bd6ffd
child 395 557cefc119e9
Merge with latest upstream
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html
--- a/.project	Fri Jan 13 16:21:50 2012 +0100
+++ b/.project	Fri Jan 13 16:24:16 2012 +0100
@@ -6,13 +6,12 @@
 	</projects>
 	<buildSpec>
 		<buildCommand>
-			<name>org.python.pydev.PyDevBuilder</name>
+			<name>com.aptana.ide.core.unifiedBuilder</name>
 			<arguments>
 			</arguments>
 		</buildCommand>
 	</buildSpec>
 	<natures>
-		<nature>org.python.pydev.pythonNature</nature>
-		<nature>org.python.pydev.django.djangoNature</nature>
+		<nature>com.aptana.projects.webnature</nature>
 	</natures>
 </projectDescription>
--- a/src/ldt/ldt/ldt_utils/projectserializer.py	Fri Jan 13 16:21:50 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/projectserializer.py	Fri Jan 13 16:24:16 2012 +0100
@@ -352,6 +352,8 @@
         elif content.videopath:
             href = content.videopath.rstrip('/') + "/" + content.src
             meta_item_value = content.videopath.rstrip('/') + "/"
+        else:
+            href = content.src
 
         new_media = {
              "http://advene.liris.cnrs.fr/ns/frame_of_reference/ms" : "o=0",
--- a/src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html	Fri Jan 13 16:21:50 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html	Fri Jan 13 16:24:16 2012 +0100
@@ -8,7 +8,7 @@
 {% block js_import %}
 {{block.super}}
 <script src="{{LDT_MEDIA_PREFIX}}js/jquery.min.js" type="text/javascript"/></script>
-<script src="{{LDT_MEDIA_PREFIX}}js/jquery.sparkline.min.js" type="text/javascript"/></script>
+<script src="{{LDT_MEDIA_PREFIX}}js/raphael.js" type="text/javascript"/></script>
 {% endblock %}
 
 {% block css_import %}
@@ -19,18 +19,42 @@
 {% block js_declaration %}
 {{block.super}}
 <script type="text/javascript">
+	var _width = 293,
+		_height = 20;
+    var _medias = [ {% for content in content_list %}
+        {
+            "iri_id" : '{{ content.iri_id }}',
+            "stats" : [{{ content.stat_annotation }}],
+        },{% endfor %}
+    ];
     $(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: '293px',
-                                                  height:'20px',
-                                                  minSpotColor: false,
-                                                  maxSpotColor: false,
-                                                  spotColor: false,
-                                                  lineWidth: '0px',
-                                                  fillColor: '#adadad',
-                                                  lineColor: '#adadad'});
+        $('.graph_annotation').each(function(_i) {
+            var _values = _medias[_i].stats,
+                _nb = _values.length,
+                _max = _values.reduce(function(_a,_b) {
+                    return Math.max(_a,_b);
+                }, 1),
+                _x = function(_p) {
+                    return _p * _width / _nb;
+                },
+                _y = function(_p) {
+                    return _height * ( 1 - _p / _max );
+                },
+                _d = _values.map(function(_v,_k) {
+                    return ( _k == 0 ?
+                        "M" + _x(_k) + " " + _y(_v) :
+                        "C" + _x(_k-.5) + " " + _y(_values[_k - 1])
+                        + " " + + _x(_k-.5) + " " + _y(_v)
+                        + " " + + _x(_k) + " " + _y(_v)
+                        ) ;
+                }).join("") + "L" + _width + " " + _height + "L0 " + _height;
+            this.innerHTML = '';
+            var _paper = new Raphael(this,_width,_height);
+            _paper.path(_d).attr({
+                "fill" : "#adadad",
+                "stroke" : "#808080"
+            });
+        });
     });
 </script>
 
@@ -46,7 +70,7 @@
     {% 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 %}
-        <span class="graph_annotation">{{ content.stat_annotation }}</span></a>
+        <span class="graph_annotation"></span></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>
--- a/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html	Fri Jan 13 16:21:50 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html	Fri Jan 13 16:24:16 2012 +0100
@@ -19,6 +19,8 @@
 {% block body %}
 {{block.super}}
 <script type="text/javascript">
+	var _width = 340,
+		_height = 25;
     var _medias = [ {% for res in results.object_list %}
         {
             "iri_id" : '{{ res.content.iri_id }}',
@@ -49,12 +51,12 @@
                 _nb = _values.length,
                 _max = _values.reduce(function(_a,_b) {
                     return Math.max(_a,_b);
-                }, 0),
+                }, 1),
                 _x = function(_p) {
-                    return _p * 340 / _nb;
+                    return _p * _width / _nb;
                 },
                 _y = function(_p) {
-                    return 25 * ( 1 - _p / _max );
+                    return _height * ( 1 - _p / _max );
                 },
                 _d = _values.map(function(_v,_k) {
                     return ( _k == 0 ?
@@ -63,9 +65,9 @@
                         + " " + + _x(_k-.5) + " " + _y(_v)
                         + " " + + _x(_k) + " " + _y(_v)
                         ) ;
-                }).join("") + "L340 25L0 25";
+                }).join("") + "L" + _width + " " + _height + "L0 " + _height;
             this.innerHTML = '';
-            var _paper = new Raphael(this,340,25);
+            var _paper = new Raphael(this,_width,_height);
             _paper.path(_d).attr({
                 "fill" : "#adadad",
                 "stroke" : "none"
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Fri Jan 13 16:21:50 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Fri Jan 13 16:24:16 2012 +0100
@@ -113,13 +113,22 @@
             }      
             ]
         },
+      {% if youtube_url %}
       player:{
-      type:'jwplayer', // player type
-              live: true, 
-              height: 300, 
-              width: {{ player_width }}, 
-              provider: "rtmp" 
+    	  type:'youtube', // player type
+          height: 300, 
+          width: {{ player_width }}, 
+          video: '{{ youtube_url }}'
       },
+      {% else %}
+      player:{
+          type:'jwplayer', // player type
+          live: true, 
+          height: 300, 
+          width: {{ player_width }}, 
+          provider: "rtmp" 
+      },
+      {% endif %}
       modules: [
                { type: "MediaFragment",
                   metadata:{
--- a/src/ldt/ldt/ldt_utils/views/front.py	Fri Jan 13 16:21:50 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/front.py	Fri Jan 13 16:24:16 2012 +0100
@@ -64,6 +64,10 @@
 def annot_content(request, content_iri_id):
     # Get the wanted content
     content = Content.objects.get(iri_id=content_iri_id)
+    # Get the content src to see if it is a youtube video
+    youtube_url = None
+    if content.src is not None and "youtube.com" in content.src:
+        youtube_url = content.src
     # The main project for the content
     proj = Project.objects.filter(contents__in=[content])[0]
     # Vars for player
@@ -81,7 +85,7 @@
 
     return render_to_response("front/front_player.html",
                               {'content': content, 'project':proj, 'player_id': player_id, 
-                              'json_url': json_url, 'player_width':player_width, 'player_height':player_height, 'stream_mode':stream_mode,
+                              'json_url': json_url, 'player_width':player_width, 'player_height':player_height, 'stream_mode':stream_mode, 'youtube_url':youtube_url,
                                'is_gecko': is_gecko},
                               context_instance=RequestContext(request))
 
--- a/src/ldt/ldt/static/ldt/css/front_home.css	Fri Jan 13 16:21:50 2012 +0100
+++ b/src/ldt/ldt/static/ldt/css/front_home.css	Fri Jan 13 16:24:16 2012 +0100
@@ -22,7 +22,7 @@
     list-style: none;
 }
 .graph_annotation {
-    background: url(./imgs/whitealpha.png); margin:148px -297px; position:absolute;
+    background: url(./imgs/whitealpha.png); margin:148px -296px; position:absolute;
 }
 
 /* Plus annotés */