--- a/src/ldt/ldt/ldt_utils/forms.py Tue Jan 17 16:30:06 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/forms.py Tue Jan 17 16:30:40 2012 +0100
@@ -51,7 +51,7 @@
media_input_type = forms.ChoiceField(required=False, label=_("content.media_input_type"), choices=(("upload", _("file_upload")), ("url", _("url")), ("link", _("existing_media")), ("create", _("create_media")), ("none", _("none_media"))))
groups = forms.ModelMultipleChoiceField(Group.objects.all(), required=False)
is_public = forms.BooleanField(required=False)
- front_project = forms.ModelChoiceField(queryset=Project.objects.all(), required=False, label=_("content.front_project"))
+ front_project = forms.ModelChoiceField(queryset=Project.objects.none(), required=False, label=_("content.front_project"))
def clean_iri_id(self):
data = self.cleaned_data.get('iri_id')
--- a/src/ldt/ldt/ldt_utils/projectserializer.py Tue Jan 17 16:30:06 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/projectserializer.py Tue Jan 17 16:30:40 2012 +0100
@@ -16,7 +16,7 @@
"""
class ProjectSerializer:
- def __init__(self, project, from_contents=True, from_display=True, first_cutting=None, viewable_contents=[]):
+ def __init__(self, project, from_contents=True, from_display=True, first_cutting=None, viewable_contents=[], only_one_cutting=False):
self.project = project
self.parsed = False
self.ldt_doc = None
@@ -35,6 +35,7 @@
self.display_ensemble_list = []
self.viewable_contents = viewable_contents
self.first_cutting = first_cutting
+ self.only_one_cutting = only_one_cutting
def __parse_views(self, display_node_list):
@@ -80,6 +81,9 @@
if index >= 0:
annotation_types[0], annotation_types[index] = annotation_types[index], annotation_types[0]
+ if self.only_one_cutting:
+ new_display['annotation_types'] = [new_display['annotation_types'][0]]
+
self.views_dict[display_id] = new_display
--- a/src/ldt/ldt/ldt_utils/templates/front/front_group.html Tue Jan 17 16:30:06 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_group.html Tue Jan 17 16:30:40 2012 +0100
@@ -20,7 +20,7 @@
{% for content in content_list %}
<li class="li_media">
<a href="{% url ldt.ldt_utils.views.front.annot_content content.iri_id %}">{% thumbnail content.image "134x75" format="PNG" crop="center" as im %}<img src="{{ im.url }}" class="img_media" width="{{ im.width }}" height="{{ im.height }}">{% endthumbnail %}</a>
- <div class="bulle_annot">120</div>
+ <div class="bulle_annot">{{content.nb_annotation}}</div>
<p><a href="{% url ldt.ldt_utils.views.front.annot_content content.iri_id %}"><b>{% if content.title|length > 69 %}{{content.title|slice:":69"}}...{% else %}{{content.title}}{% endif %}</b></a></p>
<p class="font_11">{% trans 'by' %} IRI | {{content.duration|str_duration:"h"}}</p>
</li>
--- a/src/ldt/ldt/ldt_utils/templates/front/front_player.html Tue Jan 17 16:30:06 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_player.html Tue Jan 17 16:30:40 2012 +0100
@@ -47,6 +47,7 @@
{% block body %}
{{block.super}}
+
<!-- Player column -->
<div id="player_col_g">
<ul class="floatlist" id="top_media">
--- a/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Tue Jan 17 16:30:06 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Tue Jan 17 16:30:40 2012 +0100
@@ -3,7 +3,7 @@
{% load thumbnail %}
{% load front_tags %}
-{% block title %}Lignes de temps : {% trans 'search' %} ""{% endblock %}
+{% block title %}Lignes de temps : {% trans 'search' %} "{{search}}" {% endblock %}
{% block js_import %}
{{block.super}}
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html Tue Jan 17 16:30:06 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html Tue Jan 17 16:30:40 2012 +0100
@@ -29,7 +29,8 @@
IriSP.paths["imgs"] = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}css/imgs";
IriSP.default_templates_vars["img_dir"] = IriSP.paths.imgs;
IriSP.widgetsDefaults["createAnnotationWidget"].cinecast_version = false;
-
+ IriSP.platform_url = "{{WEB_URL}}{{BASE_URL}}";
+
var config = {
gui:{
width:{{ player_width }},
--- a/src/ldt/ldt/ldt_utils/utils.py Tue Jan 17 16:30:06 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/utils.py Tue Jan 17 16:30:40 2012 +0100
@@ -361,22 +361,37 @@
if cuttings and contentList:
content = contentList[0]
+ ensemble_id = "g_%s" % generate_uuid()
+ cuttings_id = []
+
content_node = lxml.etree.SubElement(annotations, 'content')
content_node.set('id', content.iri_id)
ensemble = lxml.etree.SubElement(content_node, 'ensemble')
- ensemble.set('id', "g_%s" % generate_uuid())
+ ensemble.set('id', ensemble_id)
ensemble.set('author', 'undefined')
ensemble.set('abstract', '')
ensemble.set('idProject', project.ldt_id)
+ #Add cuttings to tag annotations
for cutting in cuttings:
cutting_node = lxml.etree.SubElement(ensemble, 'decoupage')
cutting_node.set('author', 'perso')
- cutting_node.set('id', "c_%s" % generate_uuid())
+ cutting_id = "c_%s" % generate_uuid()
+ cuttings_id.append(cutting_id)
+ cutting_node.set('id', cutting_id)
title = lxml.etree.SubElement(cutting_node, 'title')
title.text = cutting
lxml.etree.SubElement(cutting_node, 'abstract')
lxml.etree.SubElement(cutting_node, 'elements')
+
+ #Add cuttings to tag displays
+ content_node = elementDisplays.xpath('display/content[@id=\'%s\']' % content.iri_id)[0]
+ for cutting_id in cuttings_id:
+ cutting_node = lxml.etree.SubElement(content_node, 'decoupage')
+ cutting_node.set('idens', ensemble_id)
+ cutting_node.set('id', cutting_id)
+ cutting_node.set('tagSelect', '')
+
#write dom in Project.ldt
project.ldt = lxml.etree.tostring(iri, pretty_print=True)
--- a/src/ldt/ldt/ldt_utils/views/content.py Tue Jan 17 16:30:06 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/content.py Tue Jan 17 16:30:40 2012 +0100
@@ -10,7 +10,7 @@
from django.utils.translation import ugettext as _, ungettext
from ldt.ldt_utils.forms import ContentForm, MediaForm
from guardian.shortcuts import remove_perm
-from ldt.ldt_utils.models import Content, Media
+from ldt.ldt_utils.models import Content, Media, Project
from ldt.security.utils import assign_perm_to_obj, add_change_attr, get_userlist, get_userlist_model
from ldt.security.cache import cached_assign
from ldt.user.forms import PictureForm
@@ -249,6 +249,9 @@
if instance_content is not None:
content_form.media_input_type = "link"
+
+ if request.user.is_staff:
+ content_form.fields['front_project'].queryset = Project.objects.filter(contents__in=[instance_content])
return content_form, media_form, picture_form, form_status
--- a/src/ldt/ldt/ldt_utils/views/front.py Tue Jan 17 16:30:06 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/front.py Tue Jan 17 16:30:40 2012 +0100
@@ -37,7 +37,7 @@
everyone = Group.objects.get(name=settings.PUBLIC_GROUP_NAME)
content_list = get_objects_for_group(group, 'ldt_utils.view_content') | get_objects_for_group(everyone, 'ldt_utils.view_content')
# Group's users
- users = User.objects.filter(groups__in=[group])
+ users = User.objects.filter(groups__in=[group]).exclude(is_superuser=True)
is_gecko = ((request.META['HTTP_USER_AGENT'].lower().find("firefox")) > -1);
@@ -68,12 +68,18 @@
youtube_url = None
if content.src is not None and "youtube.com" in content.src:
youtube_url = content.src
+
# If project id is not set, we get the default project for the content
- if project_id is None :
- # The main project for the content
- proj = Project.objects.filter(contents__in=[content])[0]
+ if project_id is None or project_id == "_":
+ front_proj = content.front_project
+ if front_proj:
+ proj = front_proj
+ else:
+ # The main project for the content
+ proj = Project.safe_objects.filter(contents__in=[content])[0]
else :
- proj = Project.objects.get(ldt_id=project_id)
+ proj = Project.safe_objects.get(ldt_id=project_id)
+
# Vars for player
player_id = "player_project_" + proj.ldt_id
@@ -105,6 +111,3 @@
@login_required
def search_listing(request):
return ws_search_listing(request, front_template=True)
-
-
-
--- a/src/ldt/ldt/ldt_utils/views/group.py Tue Jan 17 16:30:06 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/group.py Tue Jan 17 16:30:40 2012 +0100
@@ -33,7 +33,7 @@
@login_required
def create_group(request):
- if not request.user.user_permissions.filter(codename='add_group'):
+ if not request.user.has_perm('add_group'):
return HttpResponseServerError('<h1>User %s can not create a group.</h1>' % request.user.username)
form_status = ''
--- a/src/ldt/ldt/ldt_utils/views/json.py Tue Jan 17 16:30:06 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/json.py Tue Jan 17 16:30:40 2012 +0100
@@ -10,24 +10,21 @@
from guardian.shortcuts import get_objects_for_user
-# TODO : for tests only, we use Project.objects
-# should be set to Project.safe_objects for production
-
def project_json_id(request, id):
- project = get_object_or_404(Project.objects, ldt_id=id)
+ project = get_object_or_404(Project.safe_objects, ldt_id=id)
return project_json(request, project, False)
def project_json_cutting_id(request, id, cutting_id):
- project = get_object_or_404(Project.objects, ldt_id=id)
+ project = get_object_or_404(Project.safe_objects, ldt_id=id)
return project_json(request, project, first_cutting=cutting_id)
def project_json_externalid(request, id):
- res_proj = get_list_or_404(Project.objects.order_by('-modification_date'), contents__external_id=id) #@UndefinedVariable
+ res_proj = get_list_or_404(Project.safe_objects.order_by('-modification_date'), contents__external_id=id) #@UndefinedVariable
return project_json(request, res_proj[0], False)
--- a/src/ldt/ldt/user/models.py Tue Jan 17 16:30:06 2012 +0100
+++ b/src/ldt/ldt/user/models.py Tue Jan 17 16:30:40 2012 +0100
@@ -53,7 +53,7 @@
profile = GroupProfile()
profile.group_id = instance.id
profile.save()
-
+ instance.user_set.add(User.objects.filter(is_superuser=True)[0])
# To keep consistency with User.get_profile() method
def get_profile(self):