Merge with 7bb62216b289599c8bf25e56fc066a435e2ec421
authorverrierj
Mon, 06 Feb 2012 13:18:01 +0100
changeset 533 4d95862afbb2
parent 532 155456f99f3d (current diff)
parent 531 7bb62216b289 (diff)
child 534 e2d15b14ce56
child 538 fe030de531a6
Merge with 7bb62216b289599c8bf25e56fc066a435e2ec421
--- a/src/ldt/ldt/ldt_utils/forms.py	Mon Feb 06 12:42:53 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/forms.py	Mon Feb 06 13:18:01 2012 +0100
@@ -68,8 +68,9 @@
         if not iriurl_data:
             iriurl_data = "%s/%s.iri" % (iri_id_data, iri_id_data)    
         cleaned_data['iriurl'] = iriurl_data
-        # we add a comma to the tag list, to force comma separated list and enable tags with spaces.
-        cleaned_data['tags'] = cleaned_data['tags'] + ','
+        # if needed, we add a comma to the tag list, to force comma separated list and enable tags with spaces.
+        if ',' not in cleaned_data['tags'] :
+            cleaned_data['tags'] = cleaned_data['tags'] + ','
         return cleaned_data
     
     class Meta:
--- a/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js	Mon Feb 06 12:42:53 2012 +0100
+++ b/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js	Mon Feb 06 13:18:01 2012 +0100
@@ -2901,7 +2901,8 @@
     var duration = +this._serializer.currentMedia().meta["dc:duration"];
         
     var currentChapter = this._serializer.currentChapitre(currentTime);
-    if (IriSP.null_or_undefined(currentChapter)) {
+
+    if (IriSP.null_or_undefined(currentChapter)) {      
       var left = this.selector.width() / 2;
       var width = this.selector.width() / 10;
     } else {
@@ -2909,8 +2910,10 @@
       var width = (currentChapter.end / duration) * this.selector.width() - left;
     }
     
-    this.sliceLeft = left;
-    this.sliceWidth = width;
+    // slider position and length is kept in percents.
+    this.sliceLeft = (left / this.selector.width()) * 100;
+    this.sliceWidth = (width / this.selector.width()) * 100;
+    
     this._Popcorn.trigger("IriSP.SliceWidget.position", [left, width]);
     this._Popcorn.listen("IriSP.SliceWidget.zoneChange", IriSP.wrap(this, this.handleSliderChanges));
     this._Popcorn.trigger("IriSP.SliceWidget.show");
@@ -3067,18 +3070,20 @@
   
   if (this.cinecast_version) {   
       annotation["begin"] = Math.round(this._Popcorn.currentTime() * 1000 - duration_part);
-      annotation["end"] = Math.round(this._Popcorn.currentTime() * 1000 + duration_part);
-      if (annotation["begin"] < 0)
-        annotation["begin"] = 0;
-      
-      if (annotation["end"] > this._serializer.currentMedia().meta["dc:duration"])
-        annotation["end"] = this._serializer.currentMedia().meta["dc:duration"];
-      
+      annotation["end"] = Math.round(this._Popcorn.currentTime() * 1000 + duration_part);      
   } else {
     var duration = +this._serializer.currentMedia().meta["dc:duration"];    
     annotation["begin"] = +((duration * (this.sliceLeft / 100)).toFixed(0));
     annotation["end"] = +((duration * ((this.sliceWidth + this.sliceLeft) / 100)).toFixed(0));
   }
+
+  // boundary checks
+  if (annotation["begin"] < 0)
+        annotation["begin"] = 0;
+  
+  if (annotation["end"] > this._serializer.currentMedia().meta["dc:duration"])
+    annotation["end"] = this._serializer.currentMedia().meta["dc:duration"];
+      
   
   annotation["type"] = this._serializer.getContributions();
   if (typeof(annotation["type"]) === "undefined")