Add new cuttings of front project to tag displays + minor bugs
authorverrierj
Tue, 17 Jan 2012 11:04:50 +0100
changeset 406 c0c4cd87daf2
parent 405 b0e13a70a57f
child 408 b7662f1c13da
Add new cuttings of front project to tag displays + minor bugs
src/ldt/ldt/ldt_utils/templates/front/front_player.html
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html
src/ldt/ldt/ldt_utils/utils.py
src/ldt/ldt/ldt_utils/views/group.py
src/ldt/ldt/user/models.py
--- a/src/ldt/ldt/ldt_utils/templates/front/front_player.html	Mon Jan 16 17:15:54 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_player.html	Tue Jan 17 11:04:50 2012 +0100
@@ -48,8 +48,6 @@
 {% block body %}
 {{block.super}}
 
------->{{ project }}
-
 <!-- Player column -->
 <div id="player_col_g">
     <ul class="floatlist" id="top_media">
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Mon Jan 16 17:15:54 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Tue Jan 17 11:04:50 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	Mon Jan 16 17:15:54 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/utils.py	Tue Jan 17 11:04:50 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/group.py	Mon Jan 16 17:15:54 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/group.py	Tue Jan 17 11:04:50 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/user/models.py	Mon Jan 16 17:15:54 2012 +0100
+++ b/src/ldt/ldt/user/models.py	Tue Jan 17 11:04:50 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):