src/js/widgets/createAnnotationWidget.js
branchpopcorn-port
changeset 630 7c53857650b1
parent 627 13b9f14bf49a
child 643 3e522b6f7bd0
equal deleted inserted replaced
629:b13bcfd2f9b1 630:7c53857650b1
   243     this.sendLdtData(contents, function() {
   243     this.sendLdtData(contents, function() {
   244                     if (_this.cinecast_version) {
   244                     if (_this.cinecast_version) {
   245                         if (_this._Popcorn.media.paused)
   245                         if (_this._Popcorn.media.paused)
   246                           _this._Popcorn.play();
   246                           _this._Popcorn.play();
   247                     }
   247                     }
   248                     debugger;
   248 
   249                     _this.showEndScreen();
   249                     _this.showEndScreen();
   250                     window.setTimeout(IriSP.wrap(_this, function() { this.showStartScreen(); }), 5000);
   250                     window.setTimeout(IriSP.wrap(_this, function() { this.showStartScreen(); }), 5000);
   251                     });
   251                     });
   252   }
   252   }
   253 };
   253 };
   305       url: url,
   305       url: url,
   306       type: 'PUT',
   306       type: 'PUT',
   307       contentType: 'application/json',
   307       contentType: 'application/json',
   308       data: jsonString,               
   308       data: jsonString,               
   309       //dataType: 'json',
   309       //dataType: 'json',
   310       success: function(json, textStatus, XMLHttpRequest) {
   310       success: IriSP.wrap(this, function(json, textStatus, XMLHttpRequest) {                   
   311 
   311                     /* add the annotation to the annotation and tell the world */
   312                     /* add the annotation to the annotations and tell the world */
   312                     
       
   313                     /* if the media doesn't have a contributions line, we need to add one */
       
   314                     if (typeof(this._serializer.getContributions()) === "undefined") {
       
   315                       /* set up a basic view */
       
   316                       var tmp_view = {"dc:contributor": "perso", "dc:creator": "perso", "dc:title": "Contributions",
       
   317                                       "id": json.annotations[0].type}
       
   318                       console.log(tmp_view);
       
   319                       this._serializer._data["annotation-types"].push(tmp_view);
       
   320                     }
       
   321                     annotation["type"] = "";
       
   322                     
   313                     delete annotation.tags;
   323                     delete annotation.tags;
   314                     annotation.content.description = annotation.content.data;
   324                     annotation.content.description = annotation.content.data;
       
   325                     annotation.content.title = "";
   315                     delete annotation.content.data;
   326                     delete annotation.content.data;
   316                     annotation.id = json.annotations[0].id;
   327                     annotation.id = json.annotations[0].id;
   317                     annotation.title = "";
   328 
   318                     annotation.meta = meta;
   329                     annotation.meta = meta;
   319                     annotation.meta["id-ref"] = annotation["type"];
   330                     annotation.meta["id-ref"] = annotation["type"];
   320                     // everything is shared so there's no need to propagate the change
   331                     // everything is shared so there's no need to propagate the change
   321                     _this._serializer._data.annotations.push(annotation);
   332                     _this._serializer._data.annotations.push(annotation);
       
   333                     console.log(_this._serializer._data);
   322                     _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation");
   334                     _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation");
   323                     callback();
   335                     callback();
   324       }, 
   336       }), 
   325       error: 
   337       error: 
   326               function(jqXHR, textStatus, errorThrown) { 
   338               function(jqXHR, textStatus, errorThrown) { 
   327                             console.log("an error occured while contacting " 
   339                             console.log("an error occured while contacting " 
   328                             + url + " and sending " + jsonString + textStatus ); } });
   340                             + url + " and sending " + jsonString + textStatus ); } });
   329 };
   341 };