# HG changeset patch # User wakimd # Date 1287139132 -7200 # Node ID 9bae869b2146c41d7d890cff6f397bed8fe59df0 # Parent 9927a619d2b59d8621ba2554fba05dfc3d84bbe7# Parent 0325a0a8b9971f94c0db8e900bd0c62bb08cd75e Merge diff -r 9927a619d2b5 -r 9bae869b2146 .hgtags --- a/.hgtags Fri Oct 15 12:36:43 2010 +0200 +++ b/.hgtags Fri Oct 15 12:38:52 2010 +0200 @@ -23,3 +23,4 @@ d2c2d9e8523ed24d830501b8b8fc3fc4cdaf4e96 V00.19 de326ccbad7d068054879417a83ef95f9e904dde V00.20 9bee2e1e34b9d48096acf5bd849cfacc0179ade5 V00.21 +30c6e597a7def695a580035931584daf99490adb V00.22 diff -r 9927a619d2b5 -r 9bae869b2146 web/franceculture/__init__.py --- a/web/franceculture/__init__.py Fri Oct 15 12:36:43 2010 +0200 +++ b/web/franceculture/__init__.py Fri Oct 15 12:38:52 2010 +0200 @@ -1,4 +1,4 @@ -VERSION = (0, 21, 0, "final", 0) +VERSION = (0, 22, 0, "final", 0) VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION[:2]))) diff -r 9927a619d2b5 -r 9bae869b2146 web/franceculture/locale/fr/LC_MESSAGES/django.mo Binary file web/franceculture/locale/fr/LC_MESSAGES/django.mo has changed diff -r 9927a619d2b5 -r 9bae869b2146 web/franceculture/locale/fr/LC_MESSAGES/django.po --- a/web/franceculture/locale/fr/LC_MESSAGES/django.po Fri Oct 15 12:36:43 2010 +0200 +++ b/web/franceculture/locale/fr/LC_MESSAGES/django.po Fri Oct 15 12:38:52 2010 +0200 @@ -58,11 +58,11 @@ #: templates/franceculture/embed_popup.html:42 msgid "popup_seo_body" -msgstr "Code lecteur et seo" +msgstr "Code SEO" #: templates/franceculture/embed_popup.html:42 msgid "popup_seo_meta" -msgstr "Code lecteur et seo balise meta" +msgstr "Code balise meta header" #: templates/franceculture/embed_popup.html:42 msgid "popup_links" diff -r 9927a619d2b5 -r 9bae869b2146 web/ldt/ldt_utils/fileimport.py --- a/web/ldt/ldt_utils/fileimport.py Fri Oct 15 12:36:43 2010 +0200 +++ b/web/ldt/ldt_utils/fileimport.py Fri Oct 15 12:38:52 2010 +0200 @@ -138,10 +138,7 @@ def saveContent(self): - #if 'http' in self.src: - # url = self.src - #else: - # url = self.id + u"/" + os.path.basename(self.src) + defaults_media = {'src':unicode(self.videourl), 'title':unicode(self.title), 'description':unicode(self.desc), 'videopath': unicode(self.videopath.rstrip("/") + "/")} media, media_created = Media.objects.get_or_create(src=unicode(self.videourl), defaults = defaults_media) if not media_created: diff -r 9927a619d2b5 -r 9bae869b2146 web/ldt/ldt_utils/projectserializer.py --- a/web/ldt/ldt_utils/projectserializer.py Fri Oct 15 12:36:43 2010 +0200 +++ b/web/ldt/ldt_utils/projectserializer.py Fri Oct 15 12:38:52 2010 +0200 @@ -15,12 +15,16 @@ self.parsed = False self.ldt_doc = None self.medias = [] + self.medias_by_id = {} self.annotations = [] + self.annotations_by_annotation_type = {} self.tags = {} self.tags_by_id = {} self.annotation_types = [] + self.annotation_types_by_id = {} self.views = [] self.lists = [] + self.lists_by_id = {} self.serialize_contents = from_contents self.from_display = from_display @@ -95,7 +99,11 @@ "dc:description":decoupage_description } - self.annotation_types.append(new_annotation_types) + self.annotation_types.append(new_annotation_types) + self.annotation_types_by_id[decoupage_id] = new_annotation_types + annotations_list = [] + + self.annotations_by_annotation_type[decoupage_id] = annotations_list res = decoupage_node.xpath("elements/element") for element_node in res: @@ -188,10 +196,12 @@ } self.annotations.append(new_annotation) + annotations_list.append(new_annotation) if not list_items: new_list["items"] = None self.lists.append(new_list) + self.lists_by_id[ensemble_id] = new_list def __parse_ldt(self): @@ -212,10 +222,46 @@ if ensemble_node.tag != "ensemble" : continue self.__parse_ensemble(ensemble_node, content) - -# res = self.ldt_doc.xpath("/iri/displays/display") -# for display_node in res: -# pass + + if self.from_display : + annotations = [] + annotation_types = [] + ensembles = [] + medias = [] + tags = [] + xpath_str = "/iri/displays/display[position()=1]/content" + if isinstance(self.from_display, basestring): + xpath_str = "/iri/displays/display[id='%s']/content" % self.from_display + + for content_node in self.ldt_doc.xpath(xpath_str): + content_id = content_node.get("id") + if content_id not in medias: + medias.append(content_id) + for node in content_node.xpath("decoupage"): + annotation_type_id = node.get('id') + ensemble_id = node.get('idens') + if annotation_type_id in self.annotations_by_annotation_type: + annot_list = self.annotations_by_annotation_type[annotation_type_id] + annotations.extend(annot_list) + for annot in annot_list: + if annot['tags']: + for tag in annot['tags']: + tag_id = tag['id-ref'] + if tag_id not in tags: + tags.append(tag_id) + if annotation_type_id not in annotation_types: + annotation_types.append(annotation_type_id) + if ensemble_id not in ensembles: + ensembles.append(ensemble_id) + + self.annotations = annotations + self.annotation_types = map(lambda id: self.annotation_types_by_id[id], annotation_types) + self.lists = map(lambda id: self.lists_by_id[id], ensembles) + self.medias = map(lambda id: self.medias_by_id[id], medias) + self.tags = {} + for tag_id in tags: + tag_inst = self.tags_by_id[tag_id] + self.tags[tag_inst['meta']['dc:title']] = tag_inst self.parsed = True @@ -278,6 +324,7 @@ } self.medias.append(new_media) + self.medias_by_id[content.iri_id] = new_media if self.serialize_contents: res = doc.xpath("/iri/body/ensembles/ensemble") diff -r 9927a619d2b5 -r 9bae869b2146 web/ldt/ldt_utils/views.py --- a/web/ldt/ldt_utils/views.py Fri Oct 15 12:36:43 2010 +0200 +++ b/web/ldt/ldt_utils/views.py Fri Oct 15 12:38:52 2010 +0200 @@ -386,7 +386,7 @@ resp['Cache-Control']='no-cache, must-revalidate' resp['Pragma']='no-cache' - ps = ProjectSerializer(project, from_content=False, from_display=True) + ps = ProjectSerializer(project, from_contents=False, from_display=True) annotations = project.getAnnotations(first_cutting=True) rdf_ns = u"http://www.w3.org/1999/02/22-rdf-syntax-ns#"