update project serializer for it to serialize the first bout à bout of a ldt project.
--- a/src/ldt/ldt/ldt_utils/projectserializer.py Fri Jun 22 11:05:07 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/projectserializer.py Fri Jun 22 13:34:17 2012 +0200
@@ -340,8 +340,49 @@
self.annotations_dict = new_annotations_dict
self.annotation_types_dict = new_annotation_types_dict
+
+ # We add the first "bout a bout". It is an "edit" in ldt format and list/listtype="mashup" in json format
+ self.__parse_edits()
self.parsed = True
+
+
+ def __parse_edits(self):
+ editings = self.ldt_doc.xpath("/iri/edits/editing")
+ if not editings:
+ return False
+ editing = self.ldt_doc.xpath("/iri/edits/editing[position()=1]")[0]
+ e_id = editing.get("id");
+ eList = editing.xpath("edit[position()=1]/eList")[0]
+ d = datetime.utcnow().isoformat()
+ e_title = ""
+ for txtRes in editing.xpath("title/text()", smart_strings=False):
+ e_title += txtRes
+ e_description = ""
+ for txtRes in editing.xpath("abstract/text()", smart_strings=False):
+ e_description += txtRes
+ list_items = []
+ for item in eList:
+ # ref is structured with contenated ids : id_content|;|id_ensemble|;|id_annot-type|;||;||;|id_SEG
+ ids = item.get("ref").split('|;|')
+ list_items.append(ids[-1])
+ # We build the jsonable object if necessary
+ if len(list_items)>0:
+ new_list = {
+ "id" : e_id,
+ "items" : list_items,
+ "meta" : {
+ "dc:creator":"IRI",
+ "dc:created": d,
+ "dc:contributor":"IRI",
+ "dc:modified": d,
+ "dc:title": e_title,
+ "dc:description": e_description,
+ "listtype":"mashup"
+ }
+ }
+ self.lists_dict[e_id] = new_list
+
def __parse_content(self, content):
--- a/src/ldt/ldt/ldt_utils/views/json.py Fri Jun 22 11:05:07 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/views/json.py Fri Jun 22 13:34:17 2012 +0200
@@ -3,6 +3,7 @@
from django.shortcuts import get_object_or_404, get_list_or_404
from django.utils import simplejson
from django.utils.html import escape
+from django.utils.translation import ugettext as _
from ldt.ldt_utils.models import Project
from ldt.ldt_utils.projectserializer import ProjectSerializer
import ldt.auth as ldt_auth
Binary file src/ldt/ldt/static/ldt/swf/ldt/LignesDeTempsFlex.swf has changed