# HG changeset patch # User veltr # Date 1326389095 -3600 # Node ID 58d4c61d724bcd1ba7ecf2d81fade6310ba35461 # Parent 110454f3425f99f8bd9e781458c34a8105f0d7fd# Parent 0059750178bcb5255c9499bdd742242a3a476065 Merge issues diff -r 0059750178bc -r 58d4c61d724b src/ldt/ldt/ldt_utils/projectserializer.py --- a/src/ldt/ldt/ldt_utils/projectserializer.py Thu Jan 12 17:36:58 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/projectserializer.py Thu Jan 12 18:24:55 2012 +0100 @@ -1,3 +1,4 @@ +from django.conf import settings from datetime import datetime from django.utils.datastructures import SortedDict from ldt.ldt_utils.models import Content @@ -15,7 +16,7 @@ """ class ProjectSerializer: - def __init__(self, project, from_contents=True, from_display=True): + def __init__(self, project, from_contents=True, from_display=True, first_cutting=None, viewable_contents=[]): self.project = project self.parsed = False self.ldt_doc = None @@ -32,6 +33,8 @@ self.display_contents_list = [] self.display_cuttings_list = [] self.display_ensemble_list = [] + self.viewable_contents = viewable_contents + self.first_cutting = first_cutting def __parse_views(self, display_node_list): @@ -41,6 +44,7 @@ continue content_list = [] cuttings_list = [] + new_display = { "id": display_id, "contents": content_list, @@ -62,9 +66,23 @@ ensemble_id = cutting_node.get("idens") if ensemble_id not in self.display_ensemble_list: self.display_ensemble_list.append(ensemble_id) + + # sets cutting to display in first position for the metadataplayer + if self.first_cutting: + first_cutting = "c_%s" % self.first_cutting.upper() + + annotation_types = new_display['annotation_types'] + if len(annotation_types) > 1: + index = -1 + for i, s in enumerate(annotation_types): + if s == first_cutting: + index = i + break + if index >= 0: + annotation_types[0], annotation_types[index] = annotation_types[index], annotation_types[0] + self.views_dict[display_id] = new_display - - + def __parse_ensemble(self, ensemble_node, content): @@ -329,7 +347,9 @@ href = "" meta_item_value = "" - if content.videopath: + if content.iri_id not in self.viewable_contents: + href = settings.FORBIDDEN_STREAM_URL + elif content.videopath: href = content.videopath.rstrip('/') + "/" + content.src meta_item_value = content.videopath.rstrip('/') + "/" @@ -396,8 +416,19 @@ res['annotation-types'] = self.annotation_types_dict.values() if len(self.annotation_types_dict) > 0 else None res['annotations'] = self.annotations_dict.values() if len(self.annotations_dict) > 0 else None + + if self.first_cutting: + first_cutting = "c_%s" % self.first_cutting.upper() + + index = -1 + for i, ann in enumerate(res['annotation-types']): + if ann['id'] == first_cutting: + index = i + break + + if index > 0: + res['annotation-types'][0], res['annotation-types'][1] = res['annotation-types'][1], res['annotation-types'][0] - return res def get_annotations(self, first_cutting=True): diff -r 0059750178bc -r 58d4c61d724b src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html Thu Jan 12 18:24:55 2012 +0100 @@ -0,0 +1,57 @@ +{% extends "front/front_base.html" %} +{% load i18n %} +{% load thumbnail %} +{% load front_tags %} + +{% block title %}Lignes de temps : groupe "{{group.name}}"{% endblock %} + +{% block js_import %} +{{block.super}} + + +{% endblock %} + +{% block css_import %} +{{block.super}} + +{% endblock %} + +{% block js_declaration %} +{{block.super}} + + +{% endblock %} + +{% block body %} +{{block.super}} + + +{% endblock %} + diff -r 0059750178bc -r 58d4c61d724b src/ldt/ldt/ldt_utils/templates/front/front_home.html --- a/src/ldt/ldt/ldt_utils/templates/front/front_home.html Thu Jan 12 17:36:58 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/templates/front/front_home.html Thu Jan 12 18:24:55 2012 +0100 @@ -16,7 +16,12 @@