src/js/widgets/createAnnotationWidget.js
branchpopcorn-port
changeset 608 2fb4eda4dcd2
parent 606 13675511a01a
child 611 d931a7d12519
equal deleted inserted replaced
607:0b94ae49efbd 608:2fb4eda4dcd2
   173       return;
   173       return;
   174     }
   174     }
   175     
   175     
   176     var apiJson = {annotations : [{}], meta: {}};
   176     var apiJson = {annotations : [{}], meta: {}};
   177     var annotation = apiJson["annotations"][0];
   177     var annotation = apiJson["annotations"][0];
   178     //annotation["type_title"] = "Contributions";
   178     
   179     annotation["type_title"] = "";
       
   180     annotation["media"] = this._serializer.currentMedia()["id"];
   179     annotation["media"] = this._serializer.currentMedia()["id"];
   181     annotation["begin"] = this._currentAnnotation.begin;
   180     annotation["begin"] = this._currentAnnotation.begin;
   182     annotation["end"] = this._currentAnnotation.end;
   181     annotation["end"] = this._currentAnnotation.end;
   183     annotation["type"] = this._serializer.getContributions();
   182     annotation["type"] = this._serializer.getContributions();
       
   183     if (typeof(annotation["type"]) === "undefined")
       
   184       annotation["type"] = "";
       
   185     
       
   186     annotation["type_title"] = "Contributions";
   184     annotation.content = {};
   187     annotation.content = {};
   185     annotation.content["data"] = contents;
   188     annotation.content["data"] = contents;
   186     
   189     
   187     var meta = apiJson["meta"];
   190     var meta = apiJson["meta"];
   188     meta.creator = "An User";    
   191     meta.creator = "An User";    
   199     var jsonString = JSON.stringify(apiJson);
   202     var jsonString = JSON.stringify(apiJson);
   200     var project_id = this._serializer._data.meta.id;
   203     var project_id = this._serializer._data.meta.id;
   201     
   204     
   202     var url = Mustache.to_html("{{platf_url}}/ldtplatform/api/ldt/projects/{{id}}.json",
   205     var url = Mustache.to_html("{{platf_url}}/ldtplatform/api/ldt/projects/{{id}}.json",
   203                                 {platf_url: IriSP.platform_url, id: project_id});
   206                                 {platf_url: IriSP.platform_url, id: project_id});
   204     console.log(url);
   207     console.log(url, jsonString);
   205     IriSP.jQuery.ajax({
   208     IriSP.jQuery.ajax({
   206                 url: url,
   209                 url: url,
   207                 type: 'PUT',
   210                 type: 'PUT',
   208                 contentType: 'application/json',
   211                 contentType: 'application/json',
   209                 data: jsonString,
   212                 data: jsonString,