added a method to get a list of lignes with a specified name. popcorn-port
authorhamidouk
Mon, 23 Jan 2012 17:26:07 +0100
branchpopcorn-port
changeset 693 6328901da7bf
parent 692 4eca4ee558a3
child 694 528626981afe
added a method to get a list of lignes with a specified name.
src/js/serializers/JSONSerializer.js
--- a/src/js/serializers/JSONSerializer.js	Mon Jan 23 11:19:47 2012 +0100
+++ b/src/js/serializers/JSONSerializer.js	Mon Jan 23 17:26:07 2012 +0100
@@ -365,7 +365,7 @@
     @param name of the ligne de temps
 */
 IriSP.JSONSerializer.prototype.getId = function(name) {
-  if (typeof(this._data.lists) === "undefined" || this._data.lists === null)
+  if (IriSP.null_or_undefined(this._data["annotation-types"]))
     return;
 
   name = name.toUpperCase();
@@ -381,6 +381,20 @@
   return id;
 };
 
+/** return the list of id's of the ligne de temps which contains name
+    @param name of the ligne de temps
+*/
+IriSP.JSONSerializer.prototype.getIds = function(name) {
+  if (IriSP.null_or_undefined(this._data["annotation-types"]))
+    return;
+
+  name = name.toUpperCase();
+  var e = [];  
+  e = IriSP.underscore.filter(this._data["annotation-types"], 
+                                  function(entry) { return (entry["dc:title"].toUpperCase().indexOf(name) !== -1) });
+  return IriSP.underscore.pluck(e, "id");  
+};
+
 /** return the id of the ligne de temps named "Chapitrage" */
 IriSP.JSONSerializer.prototype.getChapitrage = function() {
   var val = this.getId("Chapitrage");