Merge with 10ec59f061981e71e3118c21e0f9f4455b12288c
authorymh <ymh.work@gmail.com>
Thu, 02 Feb 2012 12:39:13 +0100
changeset 502 d6371bde0c13
parent 501 5b198be85d50 (current diff)
parent 500 10ec59f06198 (diff)
child 507 9b3ad1aa1868
Merge with 10ec59f061981e71e3118c21e0f9f4455b12288c
--- a/src/ldt/ldt/ldt_utils/models.py	Thu Feb 02 12:36:05 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/models.py	Thu Feb 02 12:39:13 2012 +0100
@@ -6,7 +6,7 @@
 from ldt.core.models import Document
 from guardian.shortcuts import assign, remove_perm, get_perms
 import ldt.indexation
-from ldt.security import get_current_user_or_admin, set_current_user
+from ldt.security import get_current_user_or_admin, set_current_user, get_current_user
 from ldt.security.models import SafeModel
 from ldt.security.manager import SafeManager
 from sorl.thumbnail import ImageField
@@ -234,6 +234,8 @@
             # We need a primary key for self in create_project, so
             # save() has to be called first
             self.create_front_project()
+            assign('ldt_utils.change_content', get_current_user(), self)
+
             
     def __unicode__(self):
         return str(self.id) + ": " + self.iri_id
@@ -364,19 +366,18 @@
     is_public = property(**is_public())
     
     def create_front_project(self):
-        request_user = get_current_user_or_admin()
+        old_user = get_current_user_or_admin()
             
-        if request_user.is_superuser:
-            admin = request_user
+        if old_user.is_superuser:
+            admin = old_user
         else:
             admin = User.objects.filter(is_superuser=True)[0]
             
         set_current_user(admin)
         self.front_project = Project.create_project(admin, 'front project : %s' % self.title, [self], cuttings=['chapitrage', 'contributions'] )
         self.front_project.publish(allow_write=True)
-        set_current_user(request_user)
+        set_current_user(old_user)
             
-        assign('ldt_utils.change_content', request_user, self)
         self.save()
     
     # Tag management
--- a/src/ldt/ldt/ldt_utils/stat.py	Thu Feb 02 12:36:05 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/stat.py	Thu Feb 02 12:39:13 2012 +0100
@@ -41,18 +41,16 @@
  
    
 def update_stat_project(project, contents_only=[]):
-        if project.state != 2:
-            return None
     
-        if contents_only:
-            contents = contents_only
-        else:
-            contents = project.contents.all()
+    if contents_only:
+        contents = contents_only
+    else:
+        contents = project.contents.all()
             
-        for c in contents:
-            update_stat_content(c)
+    for c in contents:
+        update_stat_content(c)
             
-        return True
+    return True
     
 
 def add_annotation_to_stat(content, begin, end, polemics=[]):
--- a/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html	Thu Feb 02 12:36:05 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html	Thu Feb 02 12:39:13 2012 +0100
@@ -26,6 +26,10 @@
             "segments" : [ {% for segment in res.list %}
                 {
                     "id" : '{{segment.element_id}}',
+                    "project_id": '{{segment.project_id}}',
+                    "ensemble_id": '{{segment.ensemble_id}}',
+                    "cutting_id": '{{segment.cutting_id}}',
+                    "iri_id": '{{segment.iri_id}}',
                     "begin" : {{segment.start_ts}},
                     "duration" : {{segment.duration}},
                 },{% endfor %}
@@ -85,7 +89,7 @@
             <!-- Segments du média -->
                 <ul class="floatlist list_segments">
                 {% for segment in res.list %}
-                    <li class="li_segment" id="li_{{segment.element_id}}">
+                    <li class="li_segment" id="li_{{segment.project_id}}_{{segment.iri_id}}_{{segment.ensemble_id}}_{{segment.cutting_id}}_{{segment.element_id}}">
                         <div class="left_segment">
                             <div class="color_zone"></div>
                             <a href="{% url ldt.ldt_utils.views.front.annot_content segment.iri_id segment.project_id segment.cutting_id %}#id={{segment.element_id}}"><img src="{{LDT_MEDIA_PREFIX}}img/annot_icon_80x45.png" width="80" height="45" alt="" /></a>
@@ -99,8 +103,10 @@
                             <h4><a class="pink under b" href="{% url ldt.ldt_utils.views.front.annot_content segment.iri_id segment.project_id segment.cutting_id %}#id={{segment.element_id}}" title="{% trans 'view this annotation in the player' %}">
                             {% if segment.title %}{{ segment.title }}{% else %}{% trans "No title" %}{% endif %}</a></h4>
                             <p class="bigmargin">{{ segment.abstract }}</p>
-                            <h5>Tags:</h5>
-                            <p class="result_taglist b fl">{{ segment.tags }}</p>
+                            {% if segment.tags %}
+                            	<h5>Tags:</h5>
+                            	<p class="result_taglist b fl">{{ segment.tags }}</p>
+                            {% endif %}
                         </div>
                     </li>
                 {% endfor %}
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Thu Feb 02 12:36:05 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Thu Feb 02 12:39:13 2012 +0100
@@ -15,7 +15,7 @@
   IriSP.widgetsDefaults["createAnnotationWidget"].cinecast_version = false;
   
   IriSP.widgetsDefaults["AnnotationsListWidget"] = {};
-  IriSP.widgetsDefaults["AnnotationsListWidget"].project_url = "{{WEB_URL}}{% url segment_api iri_id='{content}' begin='{begin}' end='{end}' %}";
+  IriSP.widgetsDefaults["AnnotationsListWidget"].platform_url = "{{WEB_URL}}{% url segment_api iri_id='{content}' begin='{begin}' end='{end}' %}";
   
   IriSP.platform_url = "{{WEB_URL}}{{BASE_URL}}"; 
   
--- a/src/ldt/ldt/ldt_utils/utils.py	Thu Feb 02 12:36:05 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/utils.py	Thu Feb 02 12:39:13 2012 +0100
@@ -241,11 +241,11 @@
                     content_display = lxml.etree.SubElement(path_view[0], 'content')
                     content_display.set('id', media)
                     content_display = [content_display]
-                # We add the decoupage node to the content node
-                dec = lxml.etree.SubElement(content_display[0], 'decoupage')
-                dec.set('idens', ensemble_id)
-                dec.set('id', cutting_id)
-                dec.set('tagsSelect', '')
+                    # We add the decoupage node to the content node
+                    dec = lxml.etree.SubElement(content_display[0], 'decoupage')
+                    dec.set('idens', ensemble_id)
+                    dec.set('id', cutting_id)
+                    dec.set('tagsSelect', '')
         
         # We add the annotation/element node
         element = lxml.etree.SubElement(decoupage_elements[0], 'element')
--- a/src/ldt/ldt/ldt_utils/views/front.py	Thu Feb 02 12:36:05 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/front.py	Thu Feb 02 12:39:13 2012 +0100
@@ -7,7 +7,6 @@
 from guardian.shortcuts import get_objects_for_group
 from ldt.ldt_utils.models import Content, Project
 from ldt.ldt_utils.views.workspace import search_index as ws_search_index, search_listing as ws_search_listing
-from ldt.security.utils import add_change_attr
 from tagging.models import Tag, TaggedItem
 
 
@@ -55,9 +54,9 @@
     tag_label = request.GET.get("tag")
     # Get all the public contents group
     if tag_label is None :
-        content_list = add_change_attr(request.user, Content.safe_objects.all())
+        content_list = Content.safe_objects.all()
     else :
-        content_list = TaggedItem.objects.get_by_model(add_change_attr(request.user, Content.safe_objects.all()), '"'+tag_label+'"')
+        content_list = TaggedItem.objects.get_by_model(Content.safe_objects.all(), '"'+tag_label+'"')
     # Get the main tag list
     front_tags = settings.FRONT_TAG_LIST
     # Get the all tags list
@@ -87,7 +86,12 @@
             proj = front_proj
         else:
             # The main project for the content
-            proj = Project.safe_objects.filter(contents__in=[content], state=2)[0]
+            proj = Project.safe_objects.filter(contents__in=[content], state=2)
+            if not proj:
+                content.create_front_project()
+                proj = content.front_project
+            else:
+                proj = proj[0]           
     else:
         proj = Project.safe_objects.get(ldt_id=project_id)
     
--- a/src/ldt/ldt/ldt_utils/views/workspace.py	Thu Feb 02 12:36:05 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/workspace.py	Thu Feb 02 12:39:13 2012 +0100
@@ -185,7 +185,7 @@
                 
                 valid_segments = []
                 for s in all_related_segments:
-                    segment = filter(lambda e: e.element_id == s['element_id'] , all_segments)[0]
+                    segment = [seg for seg in all_segments if seg.element_id == s['element_id'] and seg.project_id == s['project_id'] and seg.iri_id == s['iri_id'] and seg.cutting_id == s['decoupage_id'] and seg.ensemble_id == s['ensemble_id'] ][0]
                     
                     segment.score = s['score']
                     segment.lucene_id = s['lucene_id']
@@ -193,7 +193,7 @@
                     segment.context_tags = s['tags']
                                         
                     if not s['project_id']:
-                        s['project_id'] = '_'
+                        segment.project_id = '_'
                         valid_segments.append(segment)
                     elif s['project_id'] in viewable_projects_id:
                         valid_segments.append(segment)
--- a/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js	Thu Feb 02 12:36:05 2012 +0100
+++ b/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js	Thu Feb 02 12:39:13 2012 +0100
@@ -1092,7 +1092,7 @@
 IriSP.annotation_loading_template = "{{! template shown while the annotation widget is loading }}<div id='Ldt-load-container'><div id='Ldt-loader'>&nbsp;</div> Chargement... </div>";
 IriSP.annotationsListWidget_template = "{{! template for the annotation list widget }}<div class='Ldt-AnnotationsListWidget'>  <!-- ugly div because we want to have a double border -->  <div class='Ldt-Annotation-DoubleBorder'>    <ul>    {{#annotations}}      <li>        {{! if the url is not present, it means that the annotation exists             in the current project }}        {{^url}}        <a href='#id={{id}}'>        {{/url}}        {{! otherwise link to url }}        {{#url}}        <a href='{{url}}#id={{id}}'>        {{/url}}          <div style='overflow: auto; margin-top: 5px; margin-bottom: 5px;'>            <div class='Ldt-AnnotationsList-Caption'>              <img src='http://i.imgur.com/aoUlC.jpg'></img>            </div>            <div class='Ldt-AnnotationsList-Duration'>{{begin}} - {{end}}</div>            <div class='Ldt-AnnotationsList-Title'>{{title}}</div>            <div class='Ldt-AnnotationsList-Description'>{{desc}}</div>          </div>        </a>      </li>    {{/annotations}}    </ul>  </div></div>";
 IriSP.arrowWidget_template = "<div class='Ldt-arrowWidget'></div>";
-IriSP.createAnnotationWidget_template = "{{! template for the annotation creation widget }}<div class='Ldt-createAnnotationWidget'>  <!-- ugly div because we want to have a double border -->  <div class='Ldt-createAnnotation-DoubleBorder'>    <div class='Ldt-createAnnotation-startScreen'>      <div style='margin-bottom: 7px; overflow: auto;'>        <div class='Ldt-createAnnotation-Title'></div>        <div class='Ldt-createAnnotation-TimeFrame'></div>        {{^cinecast_version}}          <img src='{{img_dir}}/minimize.png' class='Ldt-createAnnotation-Minimize' alt='Cancel'></img>        {{/cinecast_version}}      </div>            <div class='Ldt-createAnnotation-Container'>        <textarea class='Ldt-createAnnotation-Description'></textarea>        <div class='Ldt-createAnnotation-profileArrow'>          <img src='{{img_dir}}/annotate_arrow.png'></img>        </div>        <div class='Ldt-createAnnotation-userAvatar'>                  <img src='https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png'></img>        </div>      </div>            <div class='Ldt-createAnnotation-keywords'>        Add keywords :             </div>      {{#polemic_mode}}      <div class='Ldt-createAnnotation-polemics'>        Add polemic keywords           </div>      {{/polemic_mode}}      <div class='Ldt-createAnnotation-submitButton'>        <div style='position: absolute; bottom: 10pt; right: 11pt;'>Submit</div>      </div>    </div>    <div class='Ldt-createAnnotation-waitScreen' style='display: none; text-align: center'>      <img src='{{img_dir}}/spinner.gif'></img>      Please wait while your request is being processed...    </div>        <div class='Ldt-createAnnotation-endScreen' style='display: none'>      Thank you, your annotation has been saved.<br>      Would you like to share it on social networks ?      <div style='margin-top: 12px; text-align: center;'>          <a target='_blank' class='Ldt-createAnnotation-endScreen-TweetLink'><img src='{{img_dir}}/tweet_button.png' style='margin-right: 20px;'></img></a>          <a target='_blank' class='Ldt-createAnnotation-endScreen-FbLink'><img src='{{img_dir}}/facebook_button.png' style='margin-right: 20px;'></img></a>          <a target='_blank' class='Ldt-createAnnotation-endScreen-GplusLink'><img src='{{img_dir}}/gplus_button.png' style='margin-right: 20px;'></img></a>                          </div>    </div>  </div></div>";
+IriSP.createAnnotationWidget_template = "{{! template for the annotation creation widget }}<div class='Ldt-createAnnotationWidget'>  <!-- ugly div because we want to have a double border -->  <div class='Ldt-createAnnotation-DoubleBorder'>    <div class='Ldt-createAnnotation-startScreen'>      <div style='margin-bottom: 7px; overflow: auto;'>        <div class='Ldt-createAnnotation-Title'></div>        <div class='Ldt-createAnnotation-TimeFrame'></div>        {{^cinecast_version}}          <img src='{{img_dir}}/minimize.png' class='Ldt-createAnnotation-Minimize' alt='Cancel'></img>        {{/cinecast_version}}      </div>            <div class='Ldt-createAnnotation-Container'>        <textarea class='Ldt-createAnnotation-Description'></textarea>        <div class='Ldt-createAnnotation-profileArrow'>          <img src='{{img_dir}}/annotate_arrow.png'></img>        </div>        <div class='Ldt-createAnnotation-userAvatar'>                  <img src='https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png'></img>        </div>      </div>      <div class='Ldt-createAnnotation-submitButton'>        <div style='position: absolute; bottom: 17px; right: 13px;'>Submit</div>      </div>      <div class='Ldt-createAnnotation-keywords'>        Add keywords :             </div>      {{#polemic_mode}}      <div class='Ldt-createAnnotation-polemics'>        Add polemic keywords           </div>      {{/polemic_mode}}    </div>    <div class='Ldt-createAnnotation-waitScreen' style='display: none; text-align: center'>      <img src='{{img_dir}}/spinner.gif'></img>      Please wait while your request is being processed...    </div>        <div class='Ldt-createAnnotation-endScreen' style='display: none'>      Thank you, your annotation has been saved.<br>      Would you like to share it on social networks ?      <div style='margin-top: 12px; text-align: center;'>          <a target='_blank' class='Ldt-createAnnotation-endScreen-TweetLink'><img src='{{img_dir}}/tweet_button.png' style='margin-right: 20px;'></img></a>          <a target='_blank' class='Ldt-createAnnotation-endScreen-FbLink'><img src='{{img_dir}}/facebook_button.png' style='margin-right: 20px;'></img></a>          <a target='_blank' class='Ldt-createAnnotation-endScreen-GplusLink'><img src='{{img_dir}}/gplus_button.png' style='margin-right: 20px;'></img></a>                          </div>    </div>  </div></div>";
 IriSP.createAnnotationWidget_festivalCinecast_template = "{{! template for the annotation creation widget specific for the cinecast festival}}<div class='Ldt-createAnnotationWidget'>  <!-- ugly div because we want to have a double border -->  <div class='Ldt-createAnnotation-DoubleBorder'>    <div style='margin-bottom: 7px; overflow: auto;'>      <div class='Ldt-createAnnotation-Title'></div>      <div class='Ldt-createAnnotation-TimeFrame'></div>    </div>        <div class='Ldt-createAnnotation-Container'>      <textarea class='Ldt-createAnnotation-Description'></textarea>      <div class='Ldt-createAnnotation-profileArrow'>        <img src='{{img_dir}}/annotate_arrow.png'></img>      </div>      <div class='Ldt-createAnnotation-userAvatar'>                <img src='https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png'></img>      </div>    </div>        <div class='Ldt-createAnnotation-keywords'>      Add keywords :           </div>              <div class='Ldt-createAnnotation-submitButton'>      <div style='position: absolute; bottom: 10pt; right: 11pt;'>Submit</div>    </div>        <div class='Ldt-createAnnotation-endScreen' style='display: none'>      Thank you, your annotation has been saved.<br>      Would you like to share it on social networks ?      <div style='margin-top: 12px; text-align: center;'>          <a target='_blank' class='Ldt-createAnnotation-endScreen-TweetLink'><img src='{{img_dir}}/tweet_button.png' style='margin-right: 20px;'></img></a>          <a target='_blank' class='Ldt-createAnnotation-endScreen-FbLink'><img src='{{img_dir}}/facebook_button.png' style='margin-right: 20px;'></img></a>          <a target='_blank' class='Ldt-createAnnotation-endScreen-GplusLink'><img src='{{img_dir}}/gplus_button.png' style='margin-right: 20px;'></img></a>                          </div>    </div>  </div></div>";
 IriSP.createAnnotation_errorMessage_template = "<p class='Ldt-createAnnotation-errorMessage'>  You must enter text to submit an annotation</p>";
 IriSP.overlay_marker_template = "{{! the template for the small bars which is z-indexed over our segment widget }}<div class='Ldt-SegmentPositionMarker' style='background-color: #F7268E;'></div>";
@@ -1486,7 +1486,9 @@
      
    }
   
-  this.trigger("seeked");  
+  /* this signal sends as an extra argument the position in the video.
+     As far as I know, this argument is not provided by popcorn */
+  this.trigger("seeked", event.offset);  
 };
 
 IriSP.PopcornReplacement.player.prototype.__playHandler = function(event) {
@@ -1705,11 +1707,13 @@
         ajax_mode: true, /* use ajax to get information about the annotations.
                            if set to false, only search in the annotations for the
                            current project. */
-        ajax_url: platform_url + "/ldtplatform/api/ldt/segments/", /* partial
-                                                                           url of 
-                                                                           where to
-                                                                           get the 
-                                                                           ajax */
+                           
+        /* the platform generates some funky urls. We replace them afterwards to point to the
+           correct place - this setting will probably be overwritten by the platform 
+           implementers.
+           Note that the player has to replace the variables between {{ and }} by its own values.
+        */
+        ajax_url: platform_url + "/ldtplatform/api/ldt/segments/{media}/{begin}/{end}", 
         ajax_granularity: 10000, /* how much ms should we look before and after the
                                    current timecode */
         
@@ -2268,8 +2272,7 @@
               var widgets = IriSP.configureWidgets(pop, layoutManager, config.gui); 
               var modules = IriSP.configureModules(pop, config.modules); 
       });
-};
-/* To wrap a player the develop should create a new class derived from 
+};/* To wrap a player the develop should create a new class derived from 
    the IriSP.PopcornReplacement.player and defining the correct functions */
 
 /** jwplayer player wrapper */
@@ -2324,7 +2327,11 @@
                     // timecode 
                     if ( pageoffset.substring( 2 ) != null ) {
                     var offsettime = pageoffset.substring( 2 );
-                    this._Popcorn.currentTime( parseFloat( offsettime ) );
+                    this._Popcorn.currentTime( parseFloat(offsettime) );
+                    
+                    /* we have to trigger this signal manually because of a
+                     bug in the jwplayer */
+                    this._Popcorn.trigger("seeked", parseFloat(offsettime));
                     }
                   } else if ( pageoffset.substring(0, 3) === "id=") {
                     // annotation
@@ -2334,11 +2341,14 @@
                     this._serializer.sync(IriSP.wrap(this, function() {
                           this.lookupAnnotation.call(this, annotationId); 
                           }));
-                  }
+                  }                                    
               }
 };
 
-IriSP.MediaFragment.prototype.updateTime = function() {
+/** handler for the seeked signal. It may have or may have not an argument.
+    @param time if not undefined, the time we're seeking to 
+*/
+IriSP.MediaFragment.prototype.updateTime = function(time) {
   if (this.mutex === true) {
     return;
   }
@@ -2347,9 +2357,15 @@
   if ( !history.pushState ) {
     return false;
   }
+    
+  if (IriSP.null_or_undefined(time) || typeof(time) != "number") {
+    var ntime = this._Popcorn.currentTime().toFixed(2)
+  } else {
+    var ntime = time.toFixed(2);
+  }
   
   splitArr = window.location.href.split( "#" )
-  history.replaceState( {}, "", splitArr[0] + "#t=" + this._Popcorn.currentTime().toFixed( 2 ) );
+  history.replaceState( {}, "", splitArr[0] + "#t=" + ntime );
 };
 
 
@@ -2365,6 +2381,7 @@
   splitArr = window.location.href.split( "#" )
   history.replaceState( {}, "", splitArr[0] + "#id=" + annotationId);
  
+  // reset the mutex afterwards to prevent the module from reacting to his own changes.
   window.setTimeout(function() { _this.mutex = false }, 50);
 };
 
@@ -2386,6 +2403,10 @@
 
   if (typeof(annotation) !== "undefined") {
     this._Popcorn.currentTime(annotation.begin / 1000);
+
+    /* we have to trigger this signal manually because of a
+     bug in the jwplayer */
+    this._Popcorn.trigger("seeked", annotation.begin / 1000);
     this._Popcorn.trigger("IriSP.Mediafragment.showAnnotation", annotationId);
   }
   
@@ -2484,22 +2505,38 @@
 };
 
 IriSP.AnnotationsListWidget.prototype.ajaxRedraw = function(timecode) {
-  var pre_url = IriSP.widgetsDefaults["AnnotationsListWidget"].ajax_url;
+
+  /* the seeked signal sometimes passes an argument - depending on if we're using
+     our popcorn lookalike or the real thing - if it's the case, use it as it's
+     more precise than currentTime which sometimes contains the place we where at */
+  if (IriSP.null_or_undefined(timecode) || typeof(timecode) != "number") {
+     var tcode = this._Popcorn.currentTime();     
+   } else {
+     var tcode = timecode;     
+  }
+   
+  
+  /* the platform gives us a special url - of the type : http://path/{media}/{begin}/{end}
+     we double the braces using regexps and we feed it to mustache to build the correct url
+     we have to do that because the platform only knows at run time what view it's displaying.
+  */
+     
+  var platf_url = IriSP.widgetsDefaults["AnnotationsListWidget"].ajax_url
+                                      .replace(/\{/g, '{{').replace(/\}/g, '}}');
   var media_id = this._serializer.currentMedia()["id"];
   var duration = +this._serializer.currentMedia().meta["dc:duration"];
   
-  var begin_timecode = (Math.floor(this._Popcorn.currentTime()) - 300) * 1000;
+  var begin_timecode = (Math.floor(tcode) - 300) * 1000;
   if (begin_timecode < 0)
     begin_timecode = 0;
     
-  var end_timecode = (Math.floor(this._Popcorn.currentTime()) + 300) * 1000;
+  var end_timecode = (Math.floor(tcode) + 300) * 1000;
   if (end_timecode > duration)
     end_timecode = duration;
   
-  var templ = Mustache.to_html("{{pre_url}}/{{media_id}}/{{begin_timecode}}/{{end_timecode}}",
-                                {pre_url: pre_url, media_id: media_id, begin_timecode: begin_timecode,
-                                 end_timecode: end_timecode});
-  
+  var templ = Mustache.to_html(platf_url, {media: media_id, begin: begin_timecode,
+                                 end: end_timecode});
+
   /* we create on the fly a serializer to get the ajax */
   var serializer = new IriSP.JSONSerializer(IriSP.__dataloader, templ);
   serializer.sync(IriSP.wrap(this, function(json) { this.processJson(json, serializer) }));                  
@@ -2543,7 +2580,7 @@
         // so we append the cutting id to the url.
         obj["url"] = this.project_url + "/" + media + "/" + 
                      annotation.meta["project"] + "/" +
-                     annotation.meta["id-ref"] + "/";
+                     annotation.meta["id-ref"];
         
         // obj["url"] = document.location.href.split("#")[0] + "/" + annotation.meta["project"];
       }
@@ -2716,9 +2753,14 @@
   
   var currentTime = this._Popcorn.currentTime();
   var currentAnnotation = this._serializer.currentChapitre(currentTime);
-  if (IriSP.null_or_undefined(currentAnnotation))
-    var currentAnnotation = this._serializer.currentAnnotation(currentTime)[0]; // FIXME : use the others ?
-
+  if (IriSP.null_or_undefined(currentAnnotation)) {
+    var c_annots = this._serializer.currentAnnotation(currentTime)
+    if (c_annots.length != 0)
+      var currentAnnotation = c_annots[0]; // FIXME : use the others ?
+    else
+      return;
+  }
+  
   /* move the arrow only if the current annotation changes */
   if (currentAnnotation != this._oldAnnotation) {
     var begin = (+ currentAnnotation.begin) / 1000;
@@ -2907,7 +2949,6 @@
       
       code = {start: annotation.begin / 1000, end: annotation.end / 1000,
               onStart: function(annotation) { return function() {
-                      console.log("runned ?", annotation);
                       if (typeof(annotation.content) !== "undefined")
                         _this.selector.find(".Ldt-createAnnotation-Title").html(annotation.content.title);
 
@@ -3138,7 +3179,11 @@
   annotation.content["data"] = contents;
   
   var meta = apiJson["meta"];
-  meta.creator = "An User";    
+  if (!IriSP.null_or_undefined(IriSP.user) && !IriSP.null_or_undefined(IriSP.user.name))
+    meta.creator = IriSP.user.name;    
+  else 
+    meta.creator = "An User";
+  
   meta.created = Date().toString();
   
   annotation["tags"] = [];
--- a/src/ldt/ldt/static/ldt/js/Ldt_front_search_results.js	Thu Feb 02 12:36:05 2012 +0100
+++ b/src/ldt/ldt/static/ldt/js/Ldt_front_search_results.js	Thu Feb 02 12:39:13 2012 +0100
@@ -40,8 +40,9 @@
 	                    "opacity" : .5,
 	                    "stroke" : "none",
 	                });
-	                _rect.node.id = "re_" + _s.id;
-                $("#li_" + _s.id + " .color_zone").css({
+                id_str = _s.project_id + '_' + _s.iri_id + '_' + _s.ensemble_id + '_' + _s.cutting_id + '_' + _s.id; 
+                _rect.node.id = "re_" + id_str;
+                $("#li_" + id_str+ " .color_zone").css({
                 	"background" : _coul,
                 	"opacity" : .5,
                	});