src/js/widgets/annotationsListWidget.js
branchpopcorn-port
changeset 836 526f91f5253e
parent 835 a8af9da7c622
child 838 03b03865eb9b
--- a/src/js/widgets/annotationsListWidget.js	Tue Mar 20 21:17:48 2012 +0100
+++ b/src/js/widgets/annotationsListWidget.js	Wed Mar 21 16:43:25 2012 +0100
@@ -123,7 +123,7 @@
      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
+  var platf_url = IriSP.widgetsDefaults.AnnotationsListWidget.ajax_url
                                       .replace(/\{/g, '{{').replace(/\}/g, '}}');
   var media_id = this._serializer.currentMedia()["id"];
   var duration = this._serializer.getDuration();
@@ -161,19 +161,19 @@
   
   for (i = 0; i < annotations.length; i++) {
     var obj = this.transformAnnotation(annotations[i])
-
-      /* only if the annotation isn't present in the document create an
-         external link */
-      if (!this.annotations_ids.indexOf(obj["id"]) != -1) {
-        // braindead url; jacques didn't want to create a new one in the platform,
-        // so we append the cutting id to the url.
-        obj["url"] = this.project_url + "/" + media + "/" + 
-                     annotation.meta["project"] + "/" +
-                     annotation.meta["id-ref"];
-        
-        // obj["url"] = document.location.href.split("#")[0] + "/" + annotation.meta["project"];
-      }
-      
+      if (typeof obj.url == "undefined" || !obj.url) {
+          /* only if the annotation isn't present in the document create an
+             external link */
+          if (!this.annotations_ids.indexOf(obj.id) != -1) {
+            // braindead url; jacques didn't want to create a new one in the platform,
+            // so we append the cutting id to the url.
+            obj.url = this.project_url + "/" + media + "/" + 
+                         annotations[i].meta.project + "/" +
+                         annotations[i].meta["id-ref"] + '#id=' + annotations[i].id;
+            
+            // obj.url = document.location.href.split("#")[0] + "/" + annotation.meta.project;
+          }
+          }
       l.push(obj);
   }