src/js/serializers/JSONSerializer.js
branchpopcorn-port
changeset 693 6328901da7bf
parent 666 08d1656c608a
child 783 591b117c19ca
equal deleted inserted replaced
692:4eca4ee558a3 693:6328901da7bf
   363 
   363 
   364 /** return the id of the ligne de temps which contains name
   364 /** return the id of the ligne de temps which contains name
   365     @param name of the ligne de temps
   365     @param name of the ligne de temps
   366 */
   366 */
   367 IriSP.JSONSerializer.prototype.getId = function(name) {
   367 IriSP.JSONSerializer.prototype.getId = function(name) {
   368   if (typeof(this._data.lists) === "undefined" || this._data.lists === null)
   368   if (IriSP.null_or_undefined(this._data["annotation-types"]))
   369     return;
   369     return;
   370 
   370 
   371   name = name.toUpperCase();
   371   name = name.toUpperCase();
   372   var e;  
   372   var e;  
   373   e = IriSP.underscore.find(this._data["annotation-types"], 
   373   e = IriSP.underscore.find(this._data["annotation-types"], 
   379   var id = e.id;
   379   var id = e.id;
   380 
   380 
   381   return id;
   381   return id;
   382 };
   382 };
   383 
   383 
       
   384 /** return the list of id's of the ligne de temps which contains name
       
   385     @param name of the ligne de temps
       
   386 */
       
   387 IriSP.JSONSerializer.prototype.getIds = function(name) {
       
   388   if (IriSP.null_or_undefined(this._data["annotation-types"]))
       
   389     return;
       
   390 
       
   391   name = name.toUpperCase();
       
   392   var e = [];  
       
   393   e = IriSP.underscore.filter(this._data["annotation-types"], 
       
   394                                   function(entry) { return (entry["dc:title"].toUpperCase().indexOf(name) !== -1) });
       
   395   return IriSP.underscore.pluck(e, "id");  
       
   396 };
       
   397 
   384 /** return the id of the ligne de temps named "Chapitrage" */
   398 /** return the id of the ligne de temps named "Chapitrage" */
   385 IriSP.JSONSerializer.prototype.getChapitrage = function() {
   399 IriSP.JSONSerializer.prototype.getChapitrage = function() {
   386   var val = this.getId("Chapitrage");
   400   var val = this.getId("Chapitrage");
   387   if (typeof(val) === "undefined")
   401   if (typeof(val) === "undefined")
   388     val = this.getId("Chapter");   
   402     val = this.getId("Chapter");