Merge with 923429f142ea9ad56150466193551c2db7208826
authorrougeronj
Tue, 25 Sep 2012 11:13:51 +0200
changeset 796 7d1267aa2f55
parent 794 8d62f45fe393 (diff)
parent 795 923429f142ea (current diff)
child 797 b8a758761a59
child 798 10dedc9e975d
Merge with 923429f142ea9ad56150466193551c2db7208826
src/ldt/ldt/ldt_utils/views/content.py
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html	Tue Sep 25 11:13:51 2012 +0200
@@ -37,6 +37,7 @@
 							"{% url ldt.ldt_utils.views.content.get_duration %}");
 		
 	});
+	// the function stopRKey prevents from the validation of the form if the user tape enter button while entering a field 
 	function stopRKey(evt) {
 		  var evt = (evt) ? evt : ((event) ? event : null);
 		  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
@@ -51,11 +52,19 @@
 
 {% block css_import %}
 	{{ block.super }}
-	{#{ content_form.media.css }#}
+	{{ content_form.media.css }}
 	<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/ldtform.css" />
+	<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/style.css" />
+	<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/blueprint/screen.css" type="text/css" media="screen, projection" />
+	<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/blueprint/print.css" type="text/css" media="print" />
+	<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}/css/workspace.css" type="text/css"/>
+	
+	
 {% endblock %}
 
 {% block content %}
+
+	
 	{% if media_form.errors %}
 	<div id="media-form-error">
 		<p>{% trans "The operation could not be performed because one or more error(s) occurred.<br />Please resubmit the media form after making the following changes:" %}</p>
@@ -74,6 +83,7 @@
 	<div id="add_content" class="span-18 last">
 	<div class="projectscontentstitle">{% trans "Create content" %}</div>
 	<form action="{{create_content_action}}" enctype="multipart/form-data" id="my_form" method="POST" enctype="multipart/form-data" >
+	
 	<div id="contentformhidden">
 		{% csrf_token %}
 		<input type="hidden" name="form_status" value="{{form_status}}" id="content_form_status" />
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Tue Sep 25 11:13:51 2012 +0200
@@ -64,13 +64,6 @@
             type: "Segments",
             annotation_type: ["chap","découpage"]
         },{
-            type: "Slice",
-            start_visible : false,
-            live_update : true
-        },{
-            type: "Arrow",
-            base_height: 3
-        },{
             type: "Annotation",
             start_minimized: true,
             site_name : "Lignes de Temps",
@@ -86,7 +79,8 @@
             close_after_send: false,
             tag_titles: ["#amateur", "#digital-humanities"],
             creator_name: '{{request.user.username}}',
-            creator_avatar: '{% thumbnail request.user.get_profile.image "48x48" format="PNG" crop="center" as im %}{{WEB_URL}}{{ im.url }}{% endthumbnail %}' || "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png"
+            creator_avatar: '{% thumbnail request.user.get_profile.image "48x48" format="PNG" crop="center" as im %}{{WEB_URL}}{{ im.url }}{% endthumbnail %}' || "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png",
+            slice_annotation_type: ["chap","découpage"]
         },{
             type: "Slideshare",
             container: "Slideshare_ext",
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/picture.html	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/picture.html	Tue Sep 25 11:13:51 2012 +0200
@@ -33,6 +33,7 @@
         </td>
         <td>
             <input type="file" name="image" id="id_image" accept="image/jpeg, image/png" />
+             <input type="hidden" name="url_image" id="id_url_image" />
             {% for error in profile_picture_form.image.errors %}
             <span class="error">
                 {{ error }}                 
--- a/src/ldt/ldt/ldt_utils/views/content.py	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/views/content.py	Tue Sep 25 11:13:51 2012 +0200
@@ -3,6 +3,8 @@
 from django.contrib.auth.models import Group
 from django.core.urlresolvers import reverse
 from django.forms.models import model_to_dict
+from django.core.files import File
+#from django.core.files.temp import NamedTemporaryFile
 from django.forms.util import ErrorList
 from django.http import HttpResponse
 from django.shortcuts import render_to_response, redirect
@@ -18,7 +20,7 @@
 import ldt.utils.path as ldt_utils_path
 import logging
 import mimetypes
-import os
+import os, stat
 import urllib2
 import subprocess
 import re
@@ -26,8 +28,9 @@
 import math
 import requests
 import django.utils.simplejson as simplejson
-import urlparse   
-    
+import urlparse  
+import tempfile 
+
 def write_content_base(request, iri_id=None): 
     if iri_id:
         instance_content = Content.safe_objects.get(iri_id=iri_id) #@UndefinedVariable
@@ -59,7 +62,7 @@
         
         content_instance_val = add_prefix(content_instance_val, "content")
         media_instance_val= add_prefix(media_instance_val, "media")    
-        src_video=request.POST.get('media-src')
+                
         for k in request.POST.keys():
             value = request.POST.get(k)
             content_instance_val[k] = value
@@ -73,7 +76,6 @@
         media_form = MediaForm(media_instance_val, request.FILES, prefix="media", instance=instance_media)
         picture_form = PictureForm(None, request.POST, request.FILES)
         
-        
         if request.user.is_staff:
             content_form.fields['front_project'].queryset = Project.objects.filter(contents__in=[instance_content])
 
@@ -81,8 +83,18 @@
         media_valid = media_form.is_valid()
         content_valid = content_form.is_valid()
         picture_valid = picture_form.is_valid()
-        
-        logging.debug("write_content_base : valid form: for instance : " + repr(instance_media) + " -> media " + str(media_valid) + " content : for instance : " + repr(instance_content) + " : " + str(content_valid)) #@UndefinedVariable
+        image_link = request.POST.get('url_image')
+        if picture_valid and image_link!='':
+            try :
+                r = requests.get(image_link)
+                img_temp = tempfile.NamedTemporaryFile(suffix='.png')
+                if img_temp:
+                    img_temp.write(r.content)
+                    img_temp.flush()
+                    picture_form.cleaned_data["image"]=File(img_temp) 
+            except Exception as inst:
+                logging.debug("couldn't download video thumbnail from image_link : "+str(image_link))
+        logging.debug("write_content_base : valid form: for instance : " + repr(instance_media) + " -> media " + str(media_valid) + " content : for instance : " + repr(instance_content) + " : " + str(content_valid) + "picture : valid :" +str(picture_valid)+" loulou") #@UndefinedVariable
         
         if media_valid and content_valid and picture_valid:
 
@@ -221,10 +233,6 @@
                 cached_assign('view_content', request.user, content)
                 everyone = Group.objects.get(name=settings.PUBLIC_GROUP_NAME)
                 
-                # On separe la gestion des permissions du media et du content
-                # Si le media est public, alors le content l'est automatiquement
-                # Si le media n'est pas public, on veut pouvoir choisir si le content est liste ou non sur le front
-                
                 if media_form.cleaned_data['media_public']:
                     cached_assign('view_content', everyone, content)
                     if media:
@@ -281,7 +289,6 @@
 
 @login_required
 def write_content(request, iri_id=None):  
-    case=0  
     submit_action = request.REQUEST.get("submit_button", False) 
     member_list = admin_list = []
     current_front_project = None
@@ -329,9 +336,6 @@
                                                                     'elem_list': get_userlist(request.user), 'member_list': member_list, 'admin_list': admin_list,  'iri_id': iri_id, 'session_key':session_key,
                                                                     'cookie_name':cookie_name, 'img_container': img_container, 'profile_picture_form': picture_form,
                                                                     'current_front_project':current_front_project}, context_instance=RequestContext(request))
-    #else :
-    #    
-
 @login_required
 def prepare_delete_content(request, iri_id=None): 
     errors = []
@@ -465,27 +469,6 @@
     else :
         return Tag.objects.cloud_for_model(Content, steps=steps)[:limit]
         
-def get_json(src_video):
-    if 'youtube' in src_video:
-        url_data=urlparse.urlparse(src_video)
-        query=urlparse.parse_qs(url_data.query)
-        video_id=query['v'][0]
-        lien='http://gdata.youtube.com/feeds/api/videos/'+video_id+'?v=2&alt=jsonc'
-    elif 'vimeo' in src_video:
-        url_data=urlparse.urlparse(src_video)
-        url_path=url_data.path
-        video_id=(url_path.split('/'))[1]
-        lien='http://vimeo.com/api/v2/video/'+video_id+'.json'
-    elif 'dailymotion' in src_video:
-        url_data=urlparse.urlparse(src_video)
-        video_path=url_data.path
-        split_path=(video_path.split('/'))[2]
-        video_id=(split_path.split('_'))[0]
-        lien='https://api.dailymotion.com/video/'+video_id+'?fields=id,duration,title'
-    resp=requests.get(lien)
-    data=simplejson.loads(resp.content)
-    return data
-
 def get_duration_json(src_video, data):
     if 'youtube' in src_video:
         duration=data['data']['duration']*1000
@@ -504,11 +487,33 @@
         title=data['title']
     return title
 
+
+def get_json(src_video):
+    if 'youtube' in src_video:
+        url_data=urlparse.urlparse(src_video)
+        query=urlparse.parse_qs(url_data.query)
+        video_id=query['v'][0]
+        lien='http://gdata.youtube.com/feeds/api/videos/'+video_id+'?v=2&alt=jsonc'
+    elif 'vimeo' in src_video:
+        url_data=urlparse.urlparse(src_video)
+        url_path=url_data.path
+        video_id=(url_path.split('/'))[1]
+        lien='http://vimeo.com/api/v2/video/'+video_id+'.json'
+    elif 'dailymotion' in src_video:
+        url_data=urlparse.urlparse(src_video)
+        video_path=url_data.path
+        split_path=(video_path.split('/'))[2]
+        video_id=(split_path.split('_'))[0]
+        lien='https://api.dailymotion.com/video/'+video_id+'?fields=id,duration,title,thumbnail_medium_url'
+    resp=requests.get(lien)
+    data=simplejson.loads(resp.content)
+    return data
+    
 def get_image_json(src_video, data):
     if 'youtube' in src_video:
         lien=data['data']['thumbnail']['sqDefault']
         filename=""+data['data']['id']+".jpg"
-        download_path=settings.MEDIA_ROOT+"thumbnails/contents/"
+        download_path=settings.MEDIA_ROOT+"thumbnails\contents"
         file_path = "%s\%s" % (download_path, filename)
         video_thumbnail = file(file_path, "wb")
         image_web=urllib2.urlopen(lien)
@@ -519,6 +524,8 @@
             video_thumbnail.write(buf)
         video_thumbnail.close()
         image_web.close()
+        fileAtt=os.stat(file_path)[0]
+        if (not fileAtt & stat.S_IWRITE):
+            os.chmod(file_path, stat.S_IWRITE)
     return file_path
         
-
--- a/src/ldt/ldt/static/ldt/css/style.css	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/css/style.css	Tue Sep 25 11:13:51 2012 +0200
@@ -50,6 +50,7 @@
     padding: 0px;
     padding-left: 1em;
     height: 55px;
+    background: #FFF;
 }
 
 #header a
--- a/src/ldt/ldt/static/ldt/js/projectscontents.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/js/projectscontents.js	Tue Sep 25 11:13:51 2012 +0200
@@ -684,7 +684,8 @@
                          $('#id_content-title').val(data.entry.title.$t);
                     }
                     $('#media_field_create').append('<img id="external_thumbnail" src="'+data.entry.media$group.media$thumbnail[0].url+'" alt="Youtube Thumbnail"/>');
-                    $('#media_fields_div').height(150);                   
+                    $('#media_fields_div').height(150);  
+                    $('#id_url_image').val(data.entry.media$group.media$thumbnail[0].url)
                 }
             });
         }
@@ -708,6 +709,7 @@
                     }
                     $('#media_field_create').append('<img id="external_thumbnail" src="'+data[0].thumbnail_small+'" />');
                     $('#media_fields_div').height(150);
+                    $('#id_url_image').val(data[0].thumbnail_small);
                 }
             });
         }
@@ -732,6 +734,7 @@
                 }
                 $('#media_field_create').append('<img id="external_thumbnail" src="'+data.thumbnail_medium_url+'" />');
                 $('#media_fields_div').height(190);
+                $('#id_url_image').val(data.thumbnail_medium_url)
             }
         });
     }
--- a/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js	Tue Sep 25 11:13:51 2012 +0200
@@ -27,7 +27,8 @@
 }
 
 IriSP.Widgets.Annotation.prototype.template =
-    '<div class="Ldt-Annotation-Widget {{#show_top_border}}Ldt-Annotation-ShowTop{{/show_top_border}}">'
+    '{{#show_arrow}}<div class="Ldt-Annotation-Arrow"></div>{{/show_arrow}}'
+    + '<div class="Ldt-Annotation-Widget {{^show_arrow}}Ldt-Annotation-ShowTop{{/show_arrow}}">'
     + '<div class="Ldt-Annotation-Inner Ldt-Annotation-Empty{{#start_minimized}} Ldt-Annotation-Minimized{{/start_minimized}}">'
     + '<div class="Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-MaxMinButton"></div>'
     + '<div class="Ldt-Annotation-Social Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty"></div>'
@@ -43,40 +44,103 @@
 
 IriSP.Widgets.Annotation.prototype.defaults = {
     annotation_type : "chap",
-    start_minimized: true,
-    show_top_border : false,
-    site_name : "Lignes de Temps"
+    start_minimized: false,
+    show_arrow : true,
+    site_name : "Lignes de Temps",
+    search_on_tag_click: true
 }
 
 IriSP.Widgets.Annotation.prototype.draw = function() {
+    
+    var _this = this;
+    
+    function timeupdate(_time) {
+        var _list = _this.getWidgetAnnotationsAtTime();
+        if (!_list.length) {
+            _this.$.find(".Ldt-Annotation-Inner").addClass("Ldt-Annotation-Empty");
+            if (_this.arrow) {
+                _this.arrow.moveToTime(_time);
+            }
+            _this.bounds = [ _time, _time ];
+            _this.sendBounds();
+        }
+    }
+    
+    function drawAnnotation(_annotation) {
+        var _url = (typeof _annotation.url !== "undefined" 
+                ? _annotation.url
+                : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id)),
+            _text = _this.l10n.watching + _annotation.title + (_this.site_name ? _this.l10n.on_site + _this.site_name : ''),
+            _tags = _annotation.getTags(),
+            _tagblock = _this.$.find(".Ldt-Annotation-Tags");
+        if (_tags.length) {
+            _this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-EmptyBlock");
+            _tags.forEach(function(_tag) {
+                var _trimmedTitle =  _tag.title.replace(/(^\s+|\s+$)/g,'');
+                if (_trimmedTitle) {
+                    var _el = IriSP.jQuery('<li class="Ldt-Annotation-TagLabel"></li>').append(IriSP.jQuery('<span>').text(_trimmedTitle));
+                    _el.click(function() {
+                        if (_this.search_on_tag_click) {
+                            _this.player.trigger("search.triggeredSearch",_trimmedTitle);
+                        }
+                        _tag.trigger("click");
+                    });
+                    _tagblock.append(_el);
+                }
+            });
+        } else {
+            _this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-EmptyBlock");
+        }
+        _this.$.find(".Ldt-Annotation-Title").html(_annotation.title);
+        var _desc = _annotation.description.replace(/(^\s+|\s+$)/g,'');
+        if (_desc) {
+            _this.$.find(".Ldt-Annotation-Description-Block").removeClass("Ldt-Annotation-EmptyBlock");
+            _this.$.find(".Ldt-Annotation-Description").html(_desc);
+        } else {
+            _this.$.find(".Ldt-Annotation-Description-Block").addClass("Ldt-Annotation-EmptyBlock");
+        }
+        _this.$.find(".Ldt-Annotation-Begin").html(_annotation.begin.toString());
+        _this.$.find(".Ldt-Annotation-End").html(_annotation.end.toString());
+        if (_annotation.elementType === "mashedAnnotation") {
+            _this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-isMashup");
+            _this.$.find(".Ldt-Annotation-MashupMedia").html(_annotation.getMedia().title);
+            _this.$.find(".Ldt-Annotation-MashupBegin").html(_annotation.annotation.begin.toString());
+            _this.$.find(".Ldt-Annotation-MashupEnd").html(_annotation.annotation.end.toString());
+        } else {
+            _this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-isMashup");
+        }
+        if (typeof _this.socialWidget !== "undefined") {
+            _this.socialWidget.updateUrls(_url, _text);
+        } else {
+            setTimeout(function() {
+                if (typeof _this.socialWidget !== "undefined") {
+                    _this.socialWidget.updateUrls(_url, _text);
+                }
+            },800);
+        }
+        _this.$.find(".Ldt-Annotation-Inner").removeClass("Ldt-Annotation-Empty");
+        _this.bounds = [ _annotation.begin, _annotation.end ];
+        if (_this.arrow) {
+            _this.arrow.moveToTime((_annotation.begin + _annotation.end)/2);
+        }
+        _this.sendBounds();
+    }
+    
     this.renderTemplate();
     this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), { type: "Social" }, "socialWidget");
-    this.onMediaEvent("timeupdate","onTimeupdate");
+    this.insertSubwidget(this.$.find(".Ldt-Annotation-Arrow"), { type: "Arrow" }, "arrow");
+    this.onMediaEvent("timeupdate",timeupdate);
     this.onMdpEvent("Annotation.hide","hide");
     this.onMdpEvent("Annotation.show","show");
     this.onMdpEvent("Annotation.minimize","minimize");
     this.onMdpEvent("Annotation.maximize","maximize");
     this.onMdpEvent("Annotation.getBounds","sendBounds");
     this.$.find(".Ldt-Annotation-MaxMinButton").click(this.functionWrapper("toggleSize"));
-    this.onTimeupdate();
-}
-
-IriSP.Widgets.Annotation.prototype.onTimeupdate = function(_time) {
-    var _list = this.getWidgetAnnotationsAtTime();
-    if (_list.length) {
-        if (_list[0].id !== this.lastAnnotation) {
-            this.drawAnnotation(_list[0]);
-            this.bounds = [ _list[0].begin.valueOf(), _list[0].end.valueOf() ];
-        }
-        this.player.trigger("Arrow.updatePosition",{widget: this.type, time: ( _list[0].begin + _list[0].end ) / 2});
-    }
-    else {
-        this.lastAnnotation = false;
-        this.$.find(".Ldt-Annotation-Inner").addClass("Ldt-Annotation-Empty");
-        this.player.trigger("Arrow.updatePosition",{widget: this.type, time: _time});
-        this.bounds = [ _time, _time ];
-    }
-    this.sendBounds();
+    this.getWidgetAnnotations().forEach(function(_a) {
+        _a.on("enter", function() {
+            drawAnnotation(_a)
+        });
+    });
 }
 
 IriSP.Widgets.Annotation.prototype.sendBounds = function() {
@@ -85,61 +149,7 @@
 
 IriSP.Widgets.Annotation.prototype.drawAnnotation = function(_annotation) {
     this.lastAnnotation = _annotation.id;
-    var _url = (typeof _annotation.url !== "undefined" 
-            ? _annotation.url
-            : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id));
-    var _text = this.l10n.watching + _annotation.title + (this.site_name ? this.l10n.on_site + this.site_name : '');
-    var _tags = _annotation.getTagTexts();
-    if (_tags.length) {
-        var _html = IriSP._(_tags).map(function(_tag) {
-            return '<li class="Ldt-Annotation-TagLabel"><span>' + _tag + '</span></li>';
-        }).join("");
-        this.$.find(".Ldt-Annotation-Tags").html(_html);
-        this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-EmptyBlock");
-        
-        /* Correct the empty tag bug */
-        this.$.find('.Ldt-Annotation-TagLabel').each(function() {
-            var _el = IriSP.jQuery(this);
-            if (!_el.text().replace(/(^\s+|\s+$)/g,'')) {
-                _el.detach();
-            }
-        });
-    
-        this.$.find('.Ldt-Annotation-TagLabel').click(function() {
-            _this.player.trigger("search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,''));
-        });
-    } else {
-        this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-EmptyBlock");
-    }
-    this.$.find(".Ldt-Annotation-Title").html(_annotation.title);
-    var _desc = _annotation.description.replace(/(^\s+|\s+$)/g,'');
-    if (_desc) {
-        this.$.find(".Ldt-Annotation-Description-Block").removeClass("Ldt-Annotation-EmptyBlock");
-        this.$.find(".Ldt-Annotation-Description").html(_desc);
-    } else {
-        this.$.find(".Ldt-Annotation-Description-Block").addClass("Ldt-Annotation-EmptyBlock");
-    }
-    this.$.find(".Ldt-Annotation-Begin").html(_annotation.begin.toString());
-    this.$.find(".Ldt-Annotation-End").html(_annotation.end.toString());
-    if (_annotation.elementType === "mashedAnnotation") {
-        this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-isMashup");
-        this.$.find(".Ldt-Annotation-MashupMedia").html(_annotation.getMedia().title);
-        this.$.find(".Ldt-Annotation-MashupBegin").html(_annotation.annotation.begin.toString());
-        this.$.find(".Ldt-Annotation-MashupEnd").html(_annotation.annotation.end.toString());
-    } else {
-        this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-isMashup");
-    }
-    if (typeof this.socialWidget !== "undefined") {
-        this.socialWidget.updateUrls(_url, _text);
-    } else {
-        var _this = this;
-        setTimeout(function() {
-            if (typeof _this.socialWidget !== "undefined") {
-                _this.socialWidget.updateUrls(_url, _text);
-            }
-        },800);
-    }
-    this.$.find(".Ldt-Annotation-Inner").removeClass("Ldt-Annotation-Empty");
+
 }
 
 IriSP.Widgets.Annotation.prototype.hide = function() {
--- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js	Tue Sep 25 11:13:51 2012 +0200
@@ -129,7 +129,7 @@
     if (this.mashupMode) {
         var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime);
         if (typeof _currentAnnotation !== "undefined") {
-            _currentTime = _currentTime - _currentAnnotation.begin.getSeconds() + _currentAnnotation.annotation.begin.getSeconds();
+            _currentTime = _currentTime - _currentAnnotation.begin + _currentAnnotation.annotation.begin;
             var _mediaId = _currentAnnotation.getMedia().id;
             _list = _list.filter(function(_annotation) {
                 return _annotation.getMedia().id === _mediaId;
@@ -140,8 +140,9 @@
         _list = _list.searchByTextFields(this.searchString);
     }
     if (this.limit_count) {
+        /* Get the n annotations closest to current timecode */
         _list = _list.sortBy(function(_annotation) {
-            return Math.abs(_annotation.begin.getSeconds() - _currentTime);
+            return Math.abs((_annotation.begin + _annotation.end) / 2 - _currentTime);
         }).slice(0, this.limit_count)
     }
     if (this.newest_first) {
--- a/src/ldt/ldt/static/ldt/metadataplayer/Arrow.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Arrow.js	Tue Sep 25 11:13:51 2012 +0200
@@ -6,25 +6,25 @@
 IriSP.Widgets.Arrow.prototype = new IriSP.Widgets.Widget();
 
 IriSP.Widgets.Arrow.prototype.defaults = {
-    arrow_height : 16,
-    arrow_width : 24,
+    arrow_height : 12,
+    arrow_width : 20,
     base_height : 0,
     base_curve : 0,
     fill_url: IriSP.widgetsDir + '/img/pinstripe.png',
     fill_color: "#ffffff", //Gradients can be used, e.g. "90-#000-#fff" for vertical white-to-black
     stroke_color: "#b7b7b7",
     stroke_width: 1.5,
-    animation_speed: 20,
-    pilot_widget: "Annotation"
+    animation_speed: 20
 }
 
 IriSP.Widgets.Arrow.prototype.draw = function() {
     this.height = this.arrow_height + this.base_height;
     this.$.addClass("Ldt-Arrow").css({
-        height: this.height + "px",
-        "margin-top": "1px"
+        height: (1+this.height) + "px",
+        "margin-top": "1px",
+        overflow: "hidden"
     });
-    this.paper = new Raphael(this.container, this.width, this.height );
+    this.paper = new Raphael(this.container, this.width, 1+this.height );
     window.myArrow = this;
     this.svgArrow = this.paper.path('M0,' + this.height + 'L' + this.width + ',' + this.height);
     this.svgArrow.attr({
@@ -32,14 +32,11 @@
         "stroke-width": this.stroke_width,
         fill: this.fill_url ? ( 'url(' + this.fill_url + ')' ) : this.fill_color
     });
-    this.moveTo(0);
-    this.onMdpEvent("Arrow.updatePosition","onUpdatePosition");
-    this.onMdpEvent("Arrow.takeover","onTakeover");
-    this.onMdpEvent("Arrow.release","onRelease");
+    this.moveToX(0);
 }
 
 IriSP.Widgets.Arrow.prototype.drawAt = function(_x) {
-    _x = Math.floor(Math.max(0, Math.min(_x, this.width)));
+    _x = Math.max(0, Math.min(_x, this.width));
     var _d = 'M0,' + this.height
         + 'L0,' + Math.min( this.height, this.arrow_height + this.base_curve)
         + 'Q0,' + this.arrow_height
@@ -58,8 +55,8 @@
     });
 }
 
-IriSP.Widgets.Arrow.prototype.moveTo = function(_x) {
-    this.targetX = Math.floor(Math.max(0, Math.min(_x, this.width)));
+IriSP.Widgets.Arrow.prototype.moveToX = function(_x) {
+    this.targetX = Math.max(0, Math.min(_x, this.width));
     if (typeof this.animInterval === "undefined") {
         this.animInterval = window.setInterval(
             this.functionWrapper("increment"),
@@ -69,6 +66,10 @@
     this.increment();
 }
 
+IriSP.Widgets.Arrow.prototype.moveToTime = function(_t) {
+    this.moveToX(this.width * _t / this.media.duration);
+}
+
 IriSP.Widgets.Arrow.prototype.increment = function() {
     if (typeof this.currentX === "undefined") {
         this.currentX = this.targetX;
@@ -85,21 +86,3 @@
     }
     this.drawAt(this.currentX);
 }
-
-IriSP.Widgets.Arrow.prototype.onUpdatePosition = function(_param) {
-    if (_param.widget === this.current_pilot_widget) {
-        if (typeof _param.x !== "undefined") {
-            this.moveTo(_param.x);
-        } else {
-            this.moveTo(this.width * _param.time / this.source.getDuration());
-        }
-    }
-}
-
-IriSP.Widgets.Arrow.prototype.onTakeover = function(_widget) {
-    this.current_pilot_widget = _widget;
-}
-
-IriSP.Widgets.Arrow.prototype.onRelease = function(_widget) {
-    this.current_pilot_widget = this.pilot_widget;
-}
--- a/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.css	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.css	Tue Sep 25 11:13:51 2012 +0200
@@ -11,9 +11,7 @@
 }
 
 .Ldt-CreateAnnotation-Inner {
-    background: url(img/pinstripe.png);
-    padding: 5px;
-    margin: 0;
+    background: url(img/pinstripe.png); padding: 5px; margin: 0; position: relative;
 }
 
 .Ldt-CreateAnnotation-Inner h3 {
--- a/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js	Tue Sep 25 11:13:51 2012 +0200
@@ -1,4 +1,4 @@
-/* TODO: Add Social Network Sharing, Finish Current Timecode Sync & Arrow Takeover */
+/* TODO: Add Social Network Sharing */
 
 IriSP.Widgets.CreateAnnotation = function(player, config) {
     IriSP.Widgets.Widget.call(this, player, config);
@@ -11,8 +11,8 @@
     show_creator_field : true,
     start_visible : true,
     always_visible : false,
-    sync_on_slice_widget : true, /* If false, syncs on current timecode */
-    takeover_arrow : false,
+    show_slice : true,
+    show_arrow : true,
     minimize_annotation_widget : true,
     creator_name : "",
     creator_avatar : "",
@@ -37,6 +37,7 @@
         background_color: "#f0e000",
         text_color: "#000000"
     }],
+    slice_annotation_type: "chap",
     annotation_type: "Contributions",
     api_serializer: "ldt_annotate",
     api_endpoint_template: "",
@@ -91,12 +92,14 @@
 }
 
 IriSP.Widgets.CreateAnnotation.prototype.template =
-    '<div class="Ldt-CreateAnnotation"><div class="Ldt-CreateAnnotation-Inner">'
+    '{{#show_slice}}<div class="Ldt-CreateAnnotation-Slice"></div>{{/show_slice}}'
+    + '{{^show_slice}}{{#show_arrow}}<div class="Ldt-CreateAnnotation-Arrow"></div>{{/show_arrow}}{{/show_slice}}'
+    + '<div class="Ldt-CreateAnnotation"><div class="Ldt-CreateAnnotation-Inner">'
     + '<form class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Main">'
     + '<h3><span class="Ldt-CreateAnnotation-h3Left">{{#show_title_field}}<input class="Ldt-CreateAnnotation-Title" placeholder="{{l10n.type_title}}" />{{/show_title_field}}'
     + '{{^show_title_field}}<span class="Ldt-CreateAnnotation-NoTitle">{{l10n.no_title}} </span>{{/show_title_field}}'
-    + ' <span class="Ldt-CreateAnnotation-Times">{{#sync_on_slice_widget}}{{l10n.from_time}} {{/sync_on_slice_widget}}{{^sync_on_slice_widget}}{{l10n.at_time}} {{/sync_on_slice_widget}} <span class="Ldt-CreateAnnotation-Begin">00:00</span>'
-    + '{{#sync_on_slice_widget}} {{l10n.to_time}} <span class="Ldt-CreateAnnotation-End">00:00</span>{{/sync_on_slice_widget}}</span></span>'
+    + ' <span class="Ldt-CreateAnnotation-Times">{{#show_slice}}{{l10n.from_time}} {{/show_slice}}{{^show_slice}}{{l10n.at_time}} {{/show_slice}} <span class="Ldt-CreateAnnotation-Begin">00:00</span>'
+    + '{{#show_slice}} {{l10n.to_time}} <span class="Ldt-CreateAnnotation-End">00:00</span>{{/show_slice}}</span></span>'
     + '{{#show_creator_field}}{{l10n.your_name_}} <input class="Ldt-CreateAnnotation-Creator" value="{{creator_name}}" /></h3>{{/show_creator_field}}'
     + '<textarea class="Ldt-CreateAnnotation-Description" placeholder="{{l10n.type_description}}"></textarea>'
     + '<div class="Ldt-CreateAnnotation-Avatar"><img src="{{creator_avatar}}" title="{{creator_name}}"></img></div>'
@@ -138,6 +141,35 @@
         /* We have to use the map function because Mustache doesn't like our tags object */
     }
     this.renderTemplate();
+    if (this.show_slice) {
+        this.insertSubwidget(
+            this.$.find(".Ldt-CreateAnnotation-Slice"),
+            {
+                type: "Slice",
+                show_arrow: this.show_arrow,
+                annotation_type: this.slice_annotation_type,
+                onBoundsChanged: function(_from, _to) {
+                    _this.begin = new IriSP.Model.Time(_from || 0);
+                    _this.end = new IriSP.Model.Time(_to || 0);
+                    _this.$.find(".Ldt-CreateAnnotation-Begin").html(_this.begin.toString());
+                    _this.$.find(".Ldt-CreateAnnotation-End").html(_this.end.toString());
+                }
+            },
+            "slice"
+        );
+    } else {
+        if (this.show_arrow) {
+            this.insertSubwidget(this.$.find(".Ldt-CreateAnnotation-Arrow"), {type: "Arrow"},"arrow");
+        }
+        this.onMediaEvent("timeupdate", function(_time) {
+            _this.begin = new IriSP.Model.Time(_time || 0);
+            _this.end = new IriSP.Model.Time(_time || 0);
+            _this.$.find(".Ldt-CreateAnnotation-Begin").html(_this.begin.toString());
+            if (_this.arrow) {
+                _this.arrow.moveToTime(_time);
+            }
+        });
+    }
     this.$.find(".Ldt-CreateAnnotation-Close").click(function() {
         _this.close_after_send
         ? _this.hide()
@@ -164,7 +196,6 @@
     }
     
     this.onMdpEvent("CreateAnnotation.toggle","toggle");
-    this.onMdpEvent("Slice.boundsChanged","onBoundsChanged");
     this.begin = new IriSP.Model.Time();
     this.end = this.source.getDuration();
     this.$.find("form").submit(this.functionWrapper("onSubmit"));
@@ -190,7 +221,6 @@
     if (this.minimize_annotation_widget) {
         this.player.trigger("Annotation.minimize");
     }
-    this.player.trigger("Slice.show");
 }
 
 IriSP.Widgets.CreateAnnotation.prototype.hide = function() {
@@ -200,7 +230,6 @@
         if (this.minimize_annotation_widget) {
             this.player.trigger("Annotation.maximize");
         }
-        this.player.trigger("Slice.hide");
     }
 }
 
@@ -214,13 +243,6 @@
     }
 }
 
-IriSP.Widgets.CreateAnnotation.prototype.onBoundsChanged = function(_values) {
-    this.begin = new IriSP.Model.Time(_values[0] || 0);
-    this.end = new IriSP.Model.Time(_values[1] || 0);
-    this.$.find(".Ldt-CreateAnnotation-Begin").html(this.begin.toString());
-    this.$.find(".Ldt-CreateAnnotation-End").html(this.end.toString());
-}
-
 IriSP.Widgets.CreateAnnotation.prototype.addKeyword = function(_keyword) {
     var _field = this.$.find(".Ldt-CreateAnnotation-Description"),
         _rx = IriSP.Model.regexpFromTextOrArray(_keyword),
--- a/src/ldt/ldt/static/ldt/metadataplayer/JwpPlayer.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/JwpPlayer.js	Tue Sep 25 11:13:51 2012 +0200
@@ -23,7 +23,7 @@
         this.streamer = this.streamer(this.video);
     }
 
-    if (typeof this.streamer === "string") {
+    if (typeof this.streamer === "string" && (this.provider === "http" || this.provider === "rtmp")) {
         this.video = this.video.replace(this.streamer,"");
         _opts.streamer = this.streamer;
     }
--- a/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js	Tue Sep 25 11:13:51 2012 +0200
@@ -680,6 +680,21 @@
     this.elementType = 'media';
     this.duration = new IriSP.Model.Time();
     this.video = '';
+    var _this = this;
+    this.on("timeupdate", function(_time) {
+        _this.getAnnotations().filter(function(_a) {
+            return (_a.end <= _time || _a.begin > _time) && _a.playing
+        }).forEach(function(_a) {
+            _a.playing = false;
+            _a.trigger("leave");
+        });
+        _this.getAnnotations().filter(function(_a) {
+            return _a.begin <= _time && _a.end > _time && !_a.playing
+        }).forEach(function(_a) {
+            _a.playing = true;
+            _a.trigger("enter");
+        });
+    });
 }
 
 IriSP.Model.Media.prototype = new IriSP.Model.Element();
@@ -754,6 +769,11 @@
     this.elementType = 'annotation';
     this.begin = new IriSP.Model.Time();
     this.end = new IriSP.Model.Time();
+    this.playing = false;
+    var _this = this;
+    this.on("click", function() {
+        _this.getMedia().setCurrentTime(_this.begin);
+    });
 }
 
 IriSP.Model.Annotation.prototype = new IriSP.Model.Element(null);
@@ -809,6 +829,10 @@
     this.title = this.annotation.title;
     this.description = this.annotation.description;
     this.color = this.annotation.color;
+    var _this = this;
+    this.on("click", function() {
+        _mashup.setCurrentTime(_this.begin);
+    });
 }
 
 IriSP.Model.MashedAnnotation.prototype = new IriSP.Model.Element(null);
@@ -841,6 +865,30 @@
     this.duration = new IriSP.Model.Time();
     this.segments = new IriSP.Model.List(_source.directory);
     this.medias = new IriSP.Model.List(_source.directory);
+    var _currentMedia = null;
+    var _this = this;
+    this.on("timeupdate", function(_time) {
+        _this.getAnnotations().filter(function(_a) {
+            return (_a.end <= _time || _a.begin > _time) && _a.playing
+        }).forEach(function(_a) {
+            _a.playing = false;
+            _a.trigger("leave");
+        });
+        _this.getAnnotations().filter(function(_a) {
+            return _a.begin <= _time && _a.end > _time && !_a.playing
+        }).forEach(function(_a) {
+            _a.playing = true;
+            _a.trigger("enter");
+            var _m = _a.getMedia();
+            if (_m !== _currentMedia) {
+                if (_currentMedia) {
+                    _currentMedia.trigger("leave");
+                }
+                _m.trigger("enter");
+                _currentMedia = _m;
+            }
+        });
+    });
 }
 
 IriSP.Model.Mashup.prototype = new IriSP.Model.Element();
@@ -1139,7 +1187,8 @@
         backboneRelational: "backbone-relational.js",
         paper: "paper.js",
         jqueryMousewheel: "jquery.mousewheel.min.js",
-        renkanPublish: "renkan-publish.js"
+        renkanPublish: "renkan-publish.js",
+        processing: "processing-1.3.6.min.js"
     },
     locations : {
         // use to define locations outside default_dir
@@ -1172,6 +1221,12 @@
         noCss: true,
         requires: [ "swfObject" ]
     },
+    AutoPlayer: {
+        noCss: true
+    },
+    MashupPlayer: {
+        noCss: true
+    },
     Sparkline: {
         noCss: true,
         requires: [ "raphael" ]
@@ -1195,6 +1250,9 @@
     },
     Renkan: {
         requires: [ "backbone", "backboneRelational", "paper", "jqueryMousewheel", "renkanPublish" ]
+    },
+    KnowledgeConcierge: {
+        requires: [ "processing" ]
     }
 }
 
@@ -1302,7 +1360,7 @@
             return _function.apply(_this, Array.prototype.slice.call(arguments, 0));
         }
     } else {
-        console.log("Error, Unknown function IriSP.Widgets" + this.type + "." + _name)
+        console.log("Error, Unknown function IriSP.Widgets." + this.type + "." + _name)
     }
 }
 
--- a/src/ldt/ldt/static/ldt/metadataplayer/MediaList.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/MediaList.js	Tue Sep 25 11:13:51 2012 +0200
@@ -57,9 +57,16 @@
 }
 
 IriSP.Widgets.MediaList.prototype.draw = function() {
-    this.onMediaEvent("timeupdate","onTimeupdate");
     this.$.addClass("Ldt-MediaListWidget")
     this.renderTemplate();
+    var _this = this;
+    if (typeof this.media.getMedias === "function") {
+        this.media.getMedias().forEach(function(_m) {
+            _m.on("enter", function() {
+                _this.redraw(_m);
+            });
+        })
+    }
     this.redraw();
 };
 
@@ -123,14 +130,3 @@
         this.$.find('.Ldt-MediaList-Other').hide();
     }
 };
-
-IriSP.Widgets.MediaList.prototype.onTimeupdate = function(_time) {
-    var _media = this.source.currentMedia;
-    if (_media.elementType === "mashup") {
-        _media = _media.getMediaAtTime(_time);
-    }
-    if (typeof _media !== "undefined" && _media.id !== this.lastMedia) {
-        this.lastMedia = _media.id;
-        this.redraw(_media);
-    }
-}
--- a/src/ldt/ldt/static/ldt/metadataplayer/Mediafragment.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Mediafragment.js	Tue Sep 25 11:13:51 2012 +0200
@@ -20,6 +20,12 @@
     this.onMediaEvent("pause","setHashToTime");
     this.onMediaEvent("seeked","setHashToTime");
     this.goToHash();
+    var _this = this;
+    this.getWidgetAnnotations().forEach(function(_annotation) {
+        _annotation.on("click", function() {
+            _this.setHashToAnnotation(_annotation.id);
+        })
+    })
 }
 
 IriSP.Widgets.Mediafragment.prototype.setWindowHash = function(_hash) {
--- a/src/ldt/ldt/static/ldt/metadataplayer/Polemic.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Polemic.js	Tue Sep 25 11:13:51 2012 +0200
@@ -168,8 +168,7 @@
                 }).mouseout(function() {
                     _annotation.trigger("unselect");
                 }).click(function() {
-                    _this.player.trigger("Mediafragment.setHashToAnnotation", _annotation.id);
-                    _this.player.trigger("Tweet.show", _annotation.id);
+                    _annotation.trigger("click");
                 });
                 _annotation.on("select", function() {
                     _this.tooltip.show(
--- a/src/ldt/ldt/static/ldt/metadataplayer/Segments.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Segments.js	Tue Sep 25 11:13:51 2012 +0200
@@ -62,8 +62,7 @@
                 _annotation.trigger("unselect");
             })
             .click(function() {
-                _this.media.setCurrentTime(_annotation.begin);
-                _this.player.trigger("Mediafragment.setHashToAnnotation", _data.id);
+                _annotation.trigger("click");
             })
             .appendTo(_this.list_$)
         _annotation.on("select", function() {
--- a/src/ldt/ldt/static/ldt/metadataplayer/Slice.css	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Slice.css	Tue Sep 25 11:13:51 2012 +0200
@@ -1,7 +1,7 @@
 /* Slider Widget */
 
 .Ldt-Slice {
-    border-radius: 0; border: none; padding: 0; margin: 2px 0 12px; background: #B6B8B8; height: 8px;
+    border-radius: 0; border: none; padding: 0; margin: 12px 0 12px; background: #B6B8B8; height: 8px;
 }
 
 .Ldt-Slice .ui-slider-handle {
--- a/src/ldt/ldt/static/ldt/metadataplayer/Slice.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Slice.js	Tue Sep 25 11:13:51 2012 +0200
@@ -10,41 +10,41 @@
 IriSP.Widgets.Slice.prototype = new IriSP.Widgets.Widget();
 
 IriSP.Widgets.Slice.prototype.defaults = {
-    start_visible : false,
-    live_update : true,
-        /* Shall the bounds change each time
-        the Annotation Widget sends an update (true)
-        or only when "show" is triggered (false) ?
-        - true is to be recommended when the widget is permanently displayed.
-        */
-    override_bounds : true
-        /* Can the Annotation Widget bounds be overriden ? */
+    show_arrow: false
 };
 
+IriSP.Widgets.Slice.prototype.template =
+    '<div class="Ldt-Slice"></div>'
+    + '{{#show_arrow}}<div class="Ldt-Slice-Arrow"></div>{{/show_arrow}}'
+
 IriSP.Widgets.Slice.prototype.draw = function() {
     
-    this.$slider = IriSP.jQuery('<div>')
-        .addClass("Ldt-Slice")
+    this.renderTemplate();
+    
+    this.$slider = this.$.find(".Ldt-Slice");
     
-    this.$.append(this.$slider);
+    if (this.show_arrow) {
+        this.insertSubwidget(this.$.find(".Ldt-Slice-Arrow"), { type: "Arrow" },"arrow");
+    }
     
     this.min = 0;
-    this.max = this.source.getDuration().valueOf();
+    this.max = this.media.duration.valueOf();
     
     var _this = this,
         _currentTime;
     
     this.$slider.slider({
         range: true,
-        values: [0, 0],
+        values: [0, this.max],
         min: 0,
         max: this.max,
         change: function(event, ui) {
-            _this.player.trigger("Arrow.updatePosition",{
-                widget:_this.type,
-                time:Math.floor((ui.values[0]+ui.values[1])/2)
-            });
-            _this.player.trigger("Slice.boundsChanged",[ui.values[0], ui.values[1]]);
+            if (_this.arrow) {
+                _this.arrow.moveToTime((ui.values[0]+ui.values[1])/2)
+            }
+            if (_this.onBoundsChanged) {
+                _this.onBoundsChanged(ui.values[0],ui.values[1]);
+            }
         },
         start: function() {
             _this.sliding = true;
@@ -54,9 +54,6 @@
             _currentTime = _this.media.getCurrentTime();
         },
         slide: function(event, ui) {
-            if (!_this.override_bounds && (ui.value < _this.min || ui.value > _this.max)) {
-                return false;
-            }
             _this.media.setCurrentTime(ui.value);
         },
         stop: function() {
@@ -64,36 +61,21 @@
             _this.media.setCurrentTime(_currentTime);
         }
     });
+    
     this.$slider.find(".ui-slider-handle:first").addClass("Ldt-Slice-left-handle");
     this.$slider.find(".ui-slider-handle:last").addClass("Ldt-Slice-right-handle");
-    if (this.start_visible) {
-        this.show();
-    } else {
-        this.hide();
-    }
-    this.onMdpEvent("Slice.show","show");
-    this.onMdpEvent("Slice.hide","hide");
-    this.onMdpEvent("Annotation.boundsChanged","storeBounds");
-    this.player.trigger("Annotation.getBounds");
+    
+    this.getWidgetAnnotations().forEach(function(_a) {
+        _a.on("enter", function() {
+            _this.$slider.slider("values",[_a.begin, _a.end]);
+        });
+    });
 };
 
 IriSP.Widgets.Slice.prototype.show = function() {
     this.$slider.show();
-    this.player.trigger("Arrow.takeover",this.type);
-    this.$slider.slider("values", [this.min, this.max]);
 }
 
 IriSP.Widgets.Slice.prototype.hide = function() {
     this.$slider.hide();
-    this.player.trigger("Arrow.release");
 }
-
-IriSP.Widgets.Slice.prototype.storeBounds = function(_values) {
-    if (!this.media.getPaused() && (this.min != _values[0] || this.max != _values[1])) {
-        this.min = _values[0];
-        this.max = _values[1];
-        if (this.live_update && !this.sliding) {
-            this.$slider.slider("values", [this.min, this.max]);
-        }
-    }
-}
\ No newline at end of file
--- a/src/ldt/ldt/static/ldt/metadataplayer/Slider.css	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Slider.css	Tue Sep 25 11:13:51 2012 +0200
@@ -12,3 +12,8 @@
     background: #747474;
 }
 
+.Ldt-Slider-Time {
+    position: absolute; top: -16px; background: #ffffc0; color: #000000; border-radius: 3px; z-index: 8;
+    font-size: 9px; width: 34px; border: 1px solid #999999; padding: 1px; margin-left: -20px;
+    display: none; text-align: center; font-weight: bold;
+}
--- a/src/ldt/ldt/static/ldt/metadataplayer/Slider.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Slider.js	Tue Sep 25 11:13:51 2012 +0200
@@ -15,12 +15,16 @@
                                 set to zero for fixed slider */
 };
 
+IriSP.Widgets.Slider.prototype.template =
+    '<div class="Ldt-Slider"></div><div class="Ldt-Slider-Time">00:00</div>'
+
 IriSP.Widgets.Slider.prototype.draw = function() {
     
-    this.$slider = IriSP.jQuery('<div>')
-        .addClass("Ldt-Slider");
+    this.renderTemplate();
     
-    this.$.append(this.$slider);
+    this.$time = this.$.find(".Ldt-Slider-Time");
+    
+    this.$slider = this.$.find(".Ldt-Slider");
     
     var _this = this;
     
@@ -45,13 +49,21 @@
         this.$slider.css(this.calculateSliderCss(this.minimized_height));
         this.$handle.css(this.calculateHandleCss(this.minimized_height));
         
-        this.$
-            .mouseover(this.functionWrapper("onMouseover"))
-            .mouseout(this.functionWrapper("onMouseout"));
-        
         this.maximized = false;
         this.timeoutId = false;
     }
+    
+    this.$
+        .mouseover(function() {
+            _this.$time.show();
+            _this.onMouseover();
+        })
+        .mouseout(this.functionWrapper("onMouseout"))
+        .mousemove(function(_e) {
+            var _x = _e.pageX - _this.$.offset().left,
+                _t = new IriSP.Model.Time(_this.media.duration * _x / _this.width);
+            _this.$time.text(_t.toString()).css("left",_x);
+        });
 };
 
 IriSP.Widgets.Slider.prototype.onTimeupdate = function(_time) {
@@ -73,6 +85,7 @@
 }
 
 IriSP.Widgets.Slider.prototype.onMouseout = function() {
+    this.$time.hide();
     if (this.minimize_timeout) {
         if (this.timeoutId) {
             window.clearTimeout(this.timeoutId);
--- a/src/ldt/ldt/static/ldt/metadataplayer/Slideshare.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Slideshare.js	Tue Sep 25 11:13:51 2012 +0200
@@ -2,12 +2,6 @@
 
 IriSP.Widgets.Slideshare = function(player, config) {
     IriSP.Widgets.Widget.call(this, player, config);
-    this.lastSlide = {
-        presentation: "",
-        slide: 0
-    }
-    this.embedObject = null;
-    this.oembedCache = {}
 }
 
 IriSP.Widgets.Slideshare.prototype = new IriSP.Widgets.Widget();
@@ -32,99 +26,94 @@
     '<div class="Ldt-SlideShare"><h2>{{l10n.slides_}}</h2><hr /><div class="Ldt-SlideShare-Container"></div></div>';
 
 IriSP.Widgets.Slideshare.prototype.draw = function() {
-    var _hide = false;
-    if (typeof this.annotation_type !== "undefined" && this.annotation_type) {
-        var _annType = this.source.getAnnotationTypes().searchByTitle(this.annotation_type);
-        _hide = !_annType.length;
+    
+    var _embedObject = null,
+        $container,
+        _lastEmbedded = "",
+        _this = this;
+    
+    function insertSlideshare(_presentation, _slide) {
+        if (_lastEmbedded === _presentation) {
+            if (_.embedObject && typeof _embedObject.jumpTo === "function") {
+                _embedObject.jumpTo(parseInt(_slide));
+            }
+        } else {
+            _lastEmbedded = _presentation;
+            var _id = IriSP.Model.getUID(),
+                _params = {
+                    allowScriptAccess: "always"
+                }
+                _atts = {
+                    id: _id
+                },
+                _flashvars = {
+                    doc : _presentation,
+                    startSlide : _slide
+                };
+            $container.html('<div id="' + _id + '"></div>');
+            swfobject.embedSWF(
+                "http://static.slidesharecdn.com/swf/ssplayer2.swf",
+                _id,
+                _this.embed_width,
+                _this.embed_height,
+                "8",
+                null,
+                _flashvars,
+                _params,
+                _atts
+            );
+            _embedObject = document.getElementById(_id);
+        }
+        $container.show();
     }
-    if (_hide) {
+    
+    var _annotations = this.getWidgetAnnotations();
+    if (!_annotations.length) {
         this.$.hide();
     } else {
         this.renderTemplate();
-        this.$container = this.$.find(".Ldt-SlideShare-Container");
-        this.onMediaEvent("timeupdate","onTimeupdate");
-        this.onTimeupdate(0);
+        var _lastPres = "",
+            _embedObject = null,
+            _oembedCache = {},
+            _this = this;
+        $container = this.$.find(".Ldt-SlideShare-Container");
+        _annotations.forEach(function(_a) {
+            _a.on("leave", function() {
+                $container.hide();
+                _lastPres = "";
+            });
+            _a.on("enter", function() {
+                var _description = _a.description,
+                    _isurl = /^https?:\/\//.test(_description),
+                    _presentation = _description.replace(/#.*$/,''),
+                    _slidematch = _description.match(/(#|\?|&)id=(\d+)/),
+                    _slide = parseInt(_slidematch && _slidematch.length > 2 ? _slidematch[2] : 1);
+                if (_presentation !== _lastPres) {
+                    if (_isurl) {
+                        if (typeof _oembedCache[_presentation] === "undefined") {
+                            var _ajaxUrl = "http://www.slideshare.net/api/oembed/1?url="
+                                + encodeURIComponent(_presentation)
+                                + "&format=jsonp&callback=?";
+                            IriSP.jQuery.getJSON(_ajaxUrl, function(_oembedData) {
+                                var _presmatch = _oembedData.html.match(/doc=([a-z0-9\-_%]+)/i);
+                                if (_presmatch && _presmatch.length > 1) {
+                                    _oembedCache[_presentation] =  _presmatch[1];
+                                    insertSlideshare(_presmatch[1], _slide);
+                                }
+                            });
+                        } else {
+                            insertSlideshare(_oembedCache[_presentation], _slide);
+                        }
+                    } else {
+                        insertSlideshare(_presentation, _slide);
+                    }
+                }
+                if (_this.sync && _embedObject && typeof _embedObject.jumpTo === "function") {
+                    _embedObject.jumpTo(parseInt(_slide));
+                }
+                _lastPres = _presentation;
+                
+            })
+        })
     }
 }
-
-IriSP.Widgets.Slideshare.prototype.onTimeupdate = function(_time) {
-    var _list = this.getWidgetAnnotationsAtTime();
-    if (_list.length) {
-        var _description = _list[0].description,
-            _isurl = /^https?:\/\//.test(_description),
-            _presentation = _description.replace(/#.*$/,''),
-            _slidematch = _description.match(/(#|\?|&)id=(\d+)/),
-            _slide = parseInt(_slidematch && _slidematch.length > 2 ? _slidematch[2] : 1),
-            _this = this;
-        if (_presentation !== this.lastSlide.presentation) {
-            if (_isurl) {
-                if (typeof this.oembedCache[_presentation] === "undefined") {
-                    var _ajaxUrl = "http://www.slideshare.net/api/oembed/1?url="
-                        + encodeURIComponent(_presentation)
-                        + "&format=jsonp&callback=?";
-                    IriSP.jQuery.getJSON(_ajaxUrl, function(_oembedData) {
-                        var _presmatch = _oembedData.html.match(/doc=([a-z0-9\-_%]+)/i);
-                        if (_presmatch && _presmatch.length > 1) {
-                            _this.oembedCache[_presentation] =  _presmatch[1];
-                            _this.insertSlideshare(_presmatch[1], _slide);
-                        }
-                    });
-                } else {
-                    this.insertSlideshare(this.oembedCache[_presentation], _slide);
-                }
-            } else {
-                this.insertSlideshare(_presentation, _slide);
-            }
-        }
-        if (_slide != this.lastSlide.slide && this.sync && this.embedObject && typeof this.embedObject.jumpTo === "function") {
-            this.embedObject.jumpTo(parseInt(_slide));
-        }
-        this.lastSlide = {
-            presentation: _presentation,
-            slide: _slide
-        }
-    } else {
-        if (this.lastSlide.presentation) {
-            this.$container.hide();
-            this.lastSlide = {
-                presentation: "",
-                slide: 0
-            }
-        }
-    }
-}
-
-IriSP.Widgets.Slideshare.prototype.insertSlideshare = function(_presentation, _slide) {
-    if (this.lastEmbedded === _presentation) {
-        if (this.embedObject && typeof this.embedObject.jumpTo === "function") {
-            this.embedObject.jumpTo(parseInt(_slide));
-        }
-    } else {
-        this.lastEmbedded = _presentation;
-        var _id = IriSP.Model.getUID(),
-            _params = {
-                allowScriptAccess: "always"
-            }
-            _atts = {
-                id: _id
-            },
-            _flashvars = {
-                doc : _presentation,
-                startSlide : _slide
-            };
-        this.$container.html('<div id="' + _id + '"></div>');
-        swfobject.embedSWF(
-            "http://static.slidesharecdn.com/swf/ssplayer2.swf",
-            _id,
-            this.embed_width,
-            this.embed_height,
-            "8",
-            null,
-            _flashvars,
-            _params,
-            _atts
-        );
-        this.embedObject = document.getElementById(_id);
-    }
-    this.$container.show();
-}
--- a/src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js	Tue Sep 25 11:13:51 2012 +0200
@@ -44,35 +44,27 @@
     this.onMdpEvent("search.cleared", "onSearch");
     
     if (this.segment_annotation_type) {
-        this.onMediaEvent("timeupdate","onTimeupdate");
+        var _this = this;
+        this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).forEach(function(_a) {
+            _a.on("enter", function() {
+                _this.redraw(_a.begin, _a.end);
+            })
+        });
     } else {
         this.redraw();
     }
 }
 
-IriSP.Widgets.Tagcloud.prototype.onTimeupdate = function(_time) {
-    var _list = this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).filter(function(_annotation) {
-            return _annotation.begin <= _time && _annotation.end > _time;
-        });
-    if (_list.length) {
-        if (_list[0].begin !== this.begin_time || _list[0].end !== this.end_time) {
-            this.begin_time = _list[0].begin;
-            this.end_time = _list[0].end;
-            this.redraw();
-        }
-    }
-}
-
-IriSP.Widgets.Tagcloud.prototype.redraw = function() {
+IriSP.Widgets.Tagcloud.prototype.redraw = function(_from, _to) {
     var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g,
         _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g,
         _words = {},
         _this = this,
         _annotations = this.getWidgetAnnotations();
         
-    if (typeof this.begin_time !== "undefined" && typeof this.end_time !== "undefined") {
+    if (typeof _from !== "undefined" && typeof _to !== "undefined") {
         _annotations = _annotations.filter(function(_annotation) {
-            return _annotation.begin >= _this.begin_time && _annotation.end <= _this.end_time;
+            return _annotation.begin >= _from && _annotation.end <= _to;
         })
     }
     
--- a/src/ldt/ldt/static/ldt/metadataplayer/Tweet.js	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tweet.js	Tue Sep 25 11:13:51 2012 +0200
@@ -25,6 +25,7 @@
             "color" : "#05aae6"
         }
     ],
+    annotation_type: "tweet",
     pin_at_start: false
 }
 
@@ -66,7 +67,6 @@
 
 IriSP.Widgets.Tweet.prototype.draw = function() {
     this.renderTemplate();
-    this.onMdpEvent("Tweet.show","show");
     this.pinned = this.pin_at_start;
     var _this = this;
     this.$.find(".Ldt-Tweet-Pin").click(function() {
@@ -84,10 +84,14 @@
         _this.hide();
     });
     this.$.hide();
+    this.getWidgetAnnotations().forEach(function(_annotation) {
+        _annotation.on("click", function() {
+            _this.show(_annotation);
+        });
+    });
 }
 
-IriSP.Widgets.Tweet.prototype.show = function(_id) {
-    var _tweet = this.source.getElement(_id);
+IriSP.Widgets.Tweet.prototype.show = function(_tweet) {
     if (typeof _tweet !== "undefined" && typeof _tweet.source !== "undefined") {
         var _entities = [];
         for (var _i = 0; _i < _tweet.source.entities.hashtags.length; _i++) {
--- a/src/ldt/ldt/user/forms.py	Tue Sep 25 11:07:13 2012 +0200
+++ b/src/ldt/ldt/user/forms.py	Tue Sep 25 11:13:51 2012 +0200
@@ -120,7 +120,8 @@
         
            
 class PictureForm(forms.Form):
-    image = forms.ImageField(label=_("Profile picture"), required=False)
+    image=forms.ImageField(label=_("Profile picture"), required=False)
+    url_image=forms.CharField(max_length=1024, required=False)
     
     def __init__(self, model=None, *args, **kwargs):
         self.model = model