Merge with cb83b868164a4795345f7a87ad9291c97725740d
authorymh <ymh.work@gmail.com>
Wed, 23 Jan 2013 17:19:56 +0100
changeset 1081 2e086097cb5d
parent 1080 09c1d515b562 (current diff)
parent 1045 cb83b868164a (diff)
child 1082 28f591b96612
Merge with cb83b868164a4795345f7a87ad9291c97725740d
.settings/org.eclipse.core.resources.prefs
src/ldt/ldt/ldt_utils/models.py
src/ldt/ldt/ldt_utils/tests/ldt_tests.py
src/ldt/ldt/ldt_utils/tests/project_tests.py
src/ldt/ldt/ldt_utils/utils.py
src/ldt/ldt/ldt_utils/views/lignesdetemps.py
--- a/.settings/org.eclipse.core.resources.prefs	Tue Jan 22 13:07:37 2013 +0100
+++ b/.settings/org.eclipse.core.resources.prefs	Wed Jan 23 17:19:56 2013 +0100
@@ -33,6 +33,7 @@
 encoding//src/ldt/ldt/ldt_utils/migrations/0023_auto__add_field_segment_audio_src__add_field_segment_audio_href.py=utf-8
 encoding//src/ldt/ldt/ldt_utils/migrations/0024_auto__chg_field_tag_name.py=utf-8
 encoding//src/ldt/ldt/ldt_utils/migrations/0025_chg_site_domain.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0026_set_relative_ldtproject.py=utf-8
 encoding//src/ldt/ldt/ldt_utils/views/json.py=utf-8
 encoding//src/ldt/ldt/management/commands/synciri.py=utf-8
 encoding//src/ldt/ldt/management/utils.py=utf-8
--- a/src/ldt/ldt/ldt_utils/forms.py	Tue Jan 22 13:07:37 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/forms.py	Wed Jan 23 17:19:56 2013 +0100
@@ -84,7 +84,7 @@
         
     class Media:
         css = {
-            'all' : ('admin/css/forms.css', 'admin/css/base.css', 'admin/css/widgets.css')
+            'all' : ('admin/css/forms.css', 'admin/css/widgets.css')
                }
         
 class MediaForm(forms.ModelForm):
@@ -100,7 +100,7 @@
     
     class Media:
         css = {
-            'all' : ('admin/css/forms.css', 'admin/css/base.css', 'admin/css/widgets.css')
+            'all' : ('admin/css/forms.css', 'admin/css/widgets.css')
                }
         
 class GroupAddForm(ShareForm):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/ldt_utils/migrations/0026_set_relative_ldtproject.py	Wed Jan 23 17:19:56 2013 +0100
@@ -0,0 +1,151 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import DataMigration
+from django.db import models
+import lxml.etree
+from ldt.management.commands import set_projectldtiri
+from django.core.management import call_command
+
+
+class Migration(DataMigration):
+
+    def forwards(self, orm):
+        call_command('set_projectldtiri')
+
+    def backwards(self, orm):
+        #do nothing
+        pass
+
+    models = {
+        'auth.group': {
+            'Meta': {'object_name': 'Group'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        'auth.permission': {
+            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        },
+        'auth.user': {
+            'Meta': {'object_name': 'User'},
+            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+        },
+        'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        'ldt_utils.author': {
+            'Meta': {'object_name': 'Author'},
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
+            'firstname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
+            'handle': ('django.db.models.fields.CharField', [], {'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'lastname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'})
+        },
+        'ldt_utils.content': {
+            'Meta': {'ordering': "['title']", 'object_name': 'Content'},
+            'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Author']", 'symmetrical': 'False', 'blank': 'True'}),
+            'content_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+            'front_project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/contents/content_default_icon.png'", 'max_length': '200'}),
+            'iri_id': ('django.db.models.fields.CharField', [], {'default': "u'75d885e1-4446-11e2-a1e1-00161798aedb'", 'unique': 'True', 'max_length': '255'}),
+            'iriurl': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+            'media_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Media']", 'null': 'True', 'blank': 'True'}),
+            'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
+        },
+        'ldt_utils.contentstat': {
+            'Meta': {'object_name': 'ContentStat'},
+            'annotation_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'content': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'stat_annotation'", 'unique': 'True', 'to': "orm['ldt_utils.Content']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'last_annotated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'blank': 'True'}),
+            'nb_annotations': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}),
+            'polemics_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'})
+        },
+        'ldt_utils.media': {
+            'Meta': {'object_name': 'Media'},
+            'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+            'external_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'external_permalink': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'external_publication_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'external_src_url': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'media_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'mimetype_field': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
+            'src': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+            'src_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'videopath': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'})
+        },
+        'ldt_utils.project': {
+            'Meta': {'ordering': "['title']", 'object_name': 'Project'},
+            'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
+            'contents': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Content']", 'symmetrical': 'False'}),
+            'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
+            'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/projects/project_default_icon.png'", 'max_length': '200'}),
+            'ldt': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+            'ldt_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
+            'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+            'state': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '1024'})
+        },
+        'ldt_utils.segment': {
+            'Meta': {'object_name': 'Segment'},
+            'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'audio_href': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
+            'audio_src': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Content']"}),
+            'cutting_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}),
+            'date': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
+            'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+            'element_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}),
+            'ensemble_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'id_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
+            'iri_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
+            'polemics': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
+            'project_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}),
+            'project_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True'}),
+            'start_ts': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+            'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'})
+        }
+    }
+
+    complete_apps = ['ldt_utils']
+    symmetrical = True
--- a/src/ldt/ldt/ldt_utils/models.py	Tue Jan 22 13:07:37 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/models.py	Wed Jan 23 17:19:56 2013 +0100
@@ -311,6 +311,10 @@
             if not url_utils.is_absolute(res_url):
                 res_url = unicode(web_url) + res_url
             return res_url 
+        
+    def relative_iri_url(self): #this function is called when we create a project 
+        res_url =  u"ldt/" + unicode(self.iriurl)
+        return res_url 
     
     def iri_file_path(self):
         return os.path.join(os.path.join(os.path.join(settings.MEDIA_ROOT, "ldt"), self.iri_id), os.path.basename(self.iriurl))
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/publishedprojectslist.html	Tue Jan 22 13:07:37 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/publishedprojectslist.html	Wed Jan 23 17:19:56 2013 +0100
@@ -24,7 +24,11 @@
             <td class="cellimg"><div class="cellimgdiv"><a href="{% url index_project project.ldt_id %}" class="ldt_link_open_ldt"><img src='{% absstatic "ldt/img/page_eye.png" %}'  alt="{% trans 'open ldt' %}" title="{% trans 'open ldt' %}"/></a></div></td>
         {% endif %}
         <td class="cellimg"><div class="cellimgdiv"><img src='{% absstatic "ldt/img/page_copy.png" %}' href="{% url ldt.ldt_utils.views.project.copy_project project.ldt_id %}" class="ldt_link_copy_project" alt="{% trans 'copy the project' %}" title="{% trans 'copy the project' %}"/></div></td>
-        <td class="cellimg"><div class="cellimgdiv"><img src='{% absstatic "ldt/img/plugin.png" %}' href="{{WEB_URL}}{{json_url_id}}" id="player_project_{{project.ldt_id}}" class="ldt_link_embed" alt="{% trans 'link json by id' %}" title="{% trans 'link json by id' %}"/></div></td>
+        <td class="cellimg"><div class="cellimgdiv">
+        	<a href='{% url ldt.ldt_utils.views.workspace.popup_embed %}?json_url={{WEB_URL}}{{json_url_id}}&player_id=player_project_{{project.ldt_id}}&ldt_id={{project.ldt_id}}'>
+        		<img src='{% absstatic "ldt/img/plugin.png" %}' id="player_project_{{project.ldt_id}}" class="ldt_link_embed" alt="{% trans 'link json by id' %}" title="{% trans 'link json by id' %}"/></div>
+       	 	</a>
+        </td>
         <td class="cellimg">
         <img src='{% absstatic "ldt/img/icon-yes.gif" %}' alt="{% trans 'Project published' %}" id="project_{{project.ldt_id}}" />
         </td>
--- a/src/ldt/ldt/ldt_utils/tests/ldt_tests.py	Tue Jan 22 13:07:37 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/tests/ldt_tests.py	Wed Jan 23 17:19:56 2013 +0100
@@ -5,10 +5,12 @@
 Replace these with more appropriate tests for your application.
 """
 
+from ldt.ldt_utils.models import User, Project, Content
+from ldt.ldt_utils.utils import (LdtUtils, LdtAnnotation, create_ldt, 
+    create_empty_iri, copy_ldt)
+from ldt.test.client import Client
 from ldt.test.testcases import TestCase
-from ldt.ldt_utils.models import User, Project, Content
-from ldt.ldt_utils.utils import LdtUtils, LdtAnnotation, create_ldt, create_empty_iri, copy_ldt
-from ldt.test.client import Client
+import base64
 import lxml.etree
 import tempfile
 import uuid
@@ -73,11 +75,14 @@
         self.cont4.iri_id = "id4"
         self.cont4.save()
         
+        search=''
+        field='all'
+        query = base64.urlsafe_b64encode(search.encode('utf8'))
+
         self.project.contents.add(self.cont3, self.cont4)
-        ldoc = self.LU.generate_init([], 'ldt.ldt_utils.views.search_ldt')
+        ldoc = self.LU.generate_init([field, query], 'ldt.ldt_utils.views.lignesdetemps.search_ldt', 'ldt.ldt_utils.views.lignesdetemps.search_segments')
         self.assertEqual(ldoc.xpath("/iri/files/init")[0].tag, "init")
-        self.assertEqual(ldoc.xpath("/iri/files/library")[0].tag, "library")
-    
+        self.assertEqual(ldoc.xpath("/iri/files/library")[0].tag, "library")    
     def test_create_ldt(self):
         self.cont5 = Content(iriurl="id5/iriurl5", duration=111)
         self.cont5.iri_id = "id5"
@@ -93,7 +98,7 @@
         ldt = lxml.etree.fromstring(self.project.ldt_encoded)
         self.assertEqual(ldt.xpath("/iri")[0].tag, "iri")
         self.assertEqual(ldt.xpath("/iri/project")[0].get("title"), self.project.title)
-        self.assertEqual(ldt.xpath("/iri/medias/media")[0].get("src"), self.cont5.iri_url())
+        self.assertEqual(ldt.xpath("/iri/medias/media")[0].get("src"), self.cont5.relative_iri_url())
         self.assertEqual(ldt.xpath("/iri/medias/media")[1].get("id"), self.cont6.iri_id)
 
     def test_copy_ldt(self):
--- a/src/ldt/ldt/ldt_utils/tests/project_tests.py	Tue Jan 22 13:07:37 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/tests/project_tests.py	Wed Jan 23 17:19:56 2013 +0100
@@ -5,12 +5,15 @@
 Replace these with more appropriate tests for your application.
 """
 
-from django.test import TestCase
-from ldt.ldt_utils.models import User, Project
-from ldt.ldt_utils.utils import LdtAnnotation, create_ldt
+from django.core.management import call_command
+from ldt.ldt_utils.models import User, Project, Content
+from ldt.ldt_utils.utils import LdtUtils, LdtAnnotation, create_ldt
 from ldt.test.client import Client
+from ldt.test.testcases import TestCase
+import lxml.etree
 import uuid
 
+
 class ProjectTest(TestCase):
     
     fixtures = ['base_data.json', 'user_data.json']
@@ -20,13 +23,28 @@
         User.objects.create_superuser('blop', 'blop@blop.com', 'blop')
         
         _ = self.client.login(username='blop', password='blop')
-        
         self.user = User()
         self.user.username = 'blop'
+        self.LU = LdtUtils()
+        self.project = Project(title="titleproj1", owner=self.user)
+        self.project.ldt = '<iri ldtversion="1.0.3" xmlns:dc="http://dublincore.org/documents/dcmi-namespace/"><project id="af3b99e4-b695-11df-bfde-00145ea4a2be" user="admin" title="CA:reponse a TC" abstract=""/> <medias> <media extra="" id="laurentcantet_entrelesmurs" pict="" src="http://amateur.iri.centrepompidou.fr//atelier/static/media/ldt/laurentcantet_entrelesmurs/laurentcantet_entrelesmurs.iri" video="rtmp://media.iri.centrepompidou.fr/ddc_player/video/regardssignes/"/> </medias> <annotations> <content id="laurentcantet_entrelesmurs"> <ensemble id="ens_perso" idProject="fe0d5d4c-2201-11df-8a24-00145ea4a2be" title="Decoupages personnels" author="perso" abstract=""> <decoupage id="c_EFC3FFE7-0204-A086-EBEC-D2A03A0E56CB" author="perso"> <title>CA: prof et admin</title> <abstract/> <elements> <element id="s_442AAB3A-42DA-F9BF-75E7-D2A0663FD5FF" begin="985690" dur="373222" author="" date="2010/09/02" color="16711680" src=""> <title/> <abstract/> <audio source=""/> <tags/> </element> <element id="s_0050F043-3AD2-0A7C-6699-D2A03A1EBA02" begin="5052858" dur="124407" author="" date="2010/09/02" color="10053375" src=""> <title>conseil de classe</title> <abstract>Reprise de la figure precedente</abstract> <audio source="undefined"/> <tags/> </element> </elements> </decoupage> <decoupage id="c_EEEF5C29-86E1-4AAE-E068-04EB5B00E492" author="perso"> <title>TC: prof et admin</title> <abstract/> <elements> <element id="s_880D9D4B-8BC0-BA43-5ECA-04EBA9FC9E59" begin="2426894" dur="141478" author="" date="2010/02/25" color="10053375" src=""> <title>Conseil de classe</title> <abstract/> <audio source=""/> <tags> <tag>Argumentation</tag> </tags> </element> <element id="s_D568A57C-7110-DED2-3165-04EC54387060" begin="5052858" dur="124407" author="" date="2010/02/25" color="10053375" src=""> <title>conseil de classe</title> <abstract>Reprise de la figure precedente</abstract> <audio source="undefined"/> <tags/> </element> </elements> </decoupage> </ensemble> </content> </annotations> <displays> <display id="0" title="Init view" idsel="laurentcantet_entrelesmurs" tc="2426424" zoom="0" scroll="0" infoBAB=""> <audio source=""/> <content id="laurentcantet_entrelesmurs"> <decoupage idens="en_2" id="de_PPP" tagsSelect=""/> <decoupage idens="laurentcantet_entrelesmurs" id="c_14A2E638-1936-97DC-E303-2DBA6A82A8B3" tagsSelect=""/> <decoupage idens="ens_perso" id="c_EEEF5C29-86E1-4AAE-E068-04EB5B00E492" tagsSelect=""/> <decoupage idens="ens_perso" id="c_EFC3FFE7-0204-A086-EBEC-D2A03A0E56CB" tagsSelect=""/> </content> </display> </displays> <edits> <editing id="0" tags=""> <title>Bout a bout 1</title> <abstract/> <edit id="edit1" tags=""> <eList/> <caption/> <audio/> <mList/> </edit> <edit id="edit2" tags=""> <eList/> <caption/> <audio/> <mList/> </edit> </editing> </edits> </iri>'
+        self.project.id = "11321"
+        self.project.ldt_id = str(uuid.uuid1())
+        self.project.description = "proj1description"
+        self.project.save()
         
-    def test_create_project(self):       
+    def test_create_project(self):   
+        self.cont1 = Content(iriurl="cont1_id/iriurl1", duration=123)
+        self.cont1.iri_id = "cont1_id"
+        self.cont1.save()
+        
+        self.cont2 = Content(iriurl="cont2_id/iriurl2", duration=100)
+        self.cont2.iri_id = "cont2_id"
+        self.cont2.save()
+        
         self.project2 = Project(title="titleproj2", owner=self.user)
-        self.project2.ldt = '<iri ldtversion="1.0.3" xmlns:dc="http://dublincore.org/documents/dcmi-namespace/"><project id="af3b99e4-b695-11df-bfde-00145ea4a212" user="admin" title="CA:reponse a TC" abstract=""/> <medias> <media extra="" id="laurentcantet_entrelesmurs" pict="" src="http://amateur.iri.centrepompidou.fr//atelier/static/media/ldt/laurentcantet_entrelesmurs/laurentcantet_entrelesmurs.iri" video="rtmp://media.iri.centrepompidou.fr/ddc_player/video/regardssignes/"/> </medias> <annotations> <content id="laurentcantet_entrelesmurs"> <ensemble id="ens_perso" idProject="fe0d5d4c-2201-11df-8a24-00145ea4a2be" title="Decoupages personnels" author="perso" abstract=""> <decoupage id="c_EFC3FFE7-0204-A086-EBEC-D2A03A0E56CB" author="perso"> <title>CA: prof et admin</title> <abstract/> <elements> <element id="s_442AAB3A-42DA-F9BF-75E7-D2A0663FD5FF" begin="985690" dur="373222" author="" date="2010/09/02" color="16711680" src=""> <title/> <abstract/> <audio source=""/> <tags/> </element> <element id="s_0050F043-3AD2-0A7C-6699-D2A03A1EBA02" begin="5052858" dur="124407" author="" date="2010/09/02" color="10053375" src=""> <title>conseil de classe</title> <abstract>Reprise de la figure precedente</abstract> <audio source="undefined"/> <tags/> </element> </elements> </decoupage> <decoupage id="c_EEEF5C29-86E1-4AAE-E068-04EB5B00E492" author="perso"> <title>TC: prof et admin</title> <abstract/> <elements> <element id="s_880D9D4B-8BC0-BA43-5ECA-04EBA9FC9E59" begin="2426894" dur="141478" author="" date="2010/02/25" color="10053375" src=""> <title>Conseil de classe</title> <abstract/> <audio source=""/> <tags> <tag>Argumentation</tag> </tags> </element> <element id="s_D568A57C-7110-DED2-3165-04EC54387060" begin="5052858" dur="124407" author="" date="2010/02/25" color="10053375" src=""> <title>conseil de classe</title> <abstract>Reprise de la figure precedente</abstract> <audio source="undefined"/> <tags/> </element> </elements> </decoupage> </ensemble> </content> </annotations> <displays> <display id="0" title="Init view" idsel="laurentcantet_entrelesmurs" tc="2426424" zoom="0" scroll="0" infoBAB=""> <audio source=""/> <content id="laurentcantet_entrelesmurs"> <decoupage idens="en_2" id="de_PPP" tagsSelect=""/> <decoupage idens="laurentcantet_entrelesmurs" id="c_14A2E638-1936-97DC-E303-2DBA6A82A8B3" tagsSelect=""/> <decoupage idens="ens_perso" id="c_EEEF5C29-86E1-4AAE-E068-04EB5B00E492" tagsSelect=""/> <decoupage idens="ens_perso" id="c_EFC3FFE7-0204-A086-EBEC-D2A03A0E56CB" tagsSelect=""/> </content> </display> </displays> <edits> <editing id="0" tags=""> <title>Bout a bout 1</title> <abstract/> <edit id="edit1" tags=""> <eList/> <caption/> <audio/> <mList/> </edit> <edit id="edit2" tags=""> <eList/> <caption/> <audio/> <mList/> </edit> </editing> </edits> </iri>'
+    
+        self.project2.ldt = self.LU.generate_ldt(Content.objects.all())    
         self.project2.ldt_id = str(uuid.uuid1())
         self.project2.description = "proj2description"
         self.project2.save()
@@ -35,8 +53,12 @@
         
     #test deletion of project without annotation
     def test_del_project_v1(self):
+        self.cont3 = Content(iriurl="cont3_id/iriurl3", duration=100)
+        self.cont3.iri_id = "cont3_id"
+        self.cont3.save()
+        
         self.project3 = Project(title="titleproj3", owner=self.user)
-        self.project3.ldt = '<iri ldtversion="1.0.3" xmlns:dc="http://dublincore.org/documents/dcmi-namespace/"><project id="af3b99e4-b695-11df-bfde-00145ea4a333" user="admin" title="CA:reponse a TC" abstract=""/> <medias> <media extra="" id="laurentcantet_entrelesmurs" pict="" src="http://amateur.iri.centrepompidou.fr//atelier/static/media/ldt/laurentcantet_entrelesmurs/laurentcantet_entrelesmurs.iri" video="rtmp://media.iri.centrepompidou.fr/ddc_player/video/regardssignes/"/> </medias> <annotations> <content id="laurentcantet_entrelesmurs"> <ensemble id="ens_perso" idProject="fe0d5d4c-2201-11df-8a24-00145ea4a2be" title="Decoupages personnels" author="perso" abstract=""> <decoupage id="c_EFC3FFE7-0204-A086-EBEC-D2A03A0E56CB" author="perso"> <title>CA: prof et admin</title> <abstract/> <elements> <element id="s_442AAB3A-42DA-F9BF-75E7-D2A0663FD5FF" begin="985690" dur="373222" author="" date="2010/09/02" color="16711680" src=""> <title/> <abstract/> <audio source=""/> <tags/> </element> <element id="s_0050F043-3AD2-0A7C-6699-D2A03A1EBA02" begin="5052858" dur="124407" author="" date="2010/09/02" color="10053375" src=""> <title>conseil de classe</title> <abstract>Reprise de la figure precedente</abstract> <audio source="undefined"/> <tags/> </element> </elements> </decoupage> <decoupage id="c_EEEF5C29-86E1-4AAE-E068-04EB5B00E492" author="perso"> <title>TC: prof et admin</title> <abstract/> <elements> <element id="s_880D9D4B-8BC0-BA43-5ECA-04EBA9FC9E59" begin="2426894" dur="141478" author="" date="2010/02/25" color="10053375" src=""> <title>Conseil de classe</title> <abstract/> <audio source=""/> <tags> <tag>Argumentation</tag> </tags> </element> <element id="s_D568A57C-7110-DED2-3165-04EC54387060" begin="5052858" dur="124407" author="" date="2010/02/25" color="10053375" src=""> <title>conseil de classe</title> <abstract>Reprise de la figure precedente</abstract> <audio source="undefined"/> <tags/> </element> </elements> </decoupage> </ensemble> </content> </annotations> <displays> <display id="0" title="Init view" idsel="laurentcantet_entrelesmurs" tc="2426424" zoom="0" scroll="0" infoBAB=""> <audio source=""/> <content id="laurentcantet_entrelesmurs"> <decoupage idens="en_2" id="de_PPP" tagsSelect=""/> <decoupage idens="laurentcantet_entrelesmurs" id="c_14A2E638-1936-97DC-E303-2DBA6A82A8B3" tagsSelect=""/> <decoupage idens="ens_perso" id="c_EEEF5C29-86E1-4AAE-E068-04EB5B00E492" tagsSelect=""/> <decoupage idens="ens_perso" id="c_EFC3FFE7-0204-A086-EBEC-D2A03A0E56CB" tagsSelect=""/> </content> </display> </displays> <edits> <editing id="0" tags=""> <title>Bout a bout 1</title> <abstract/> <edit id="edit1" tags=""> <eList/> <caption/> <audio/> <mList/> </edit> <edit id="edit2" tags=""> <eList/> <caption/> <audio/> <mList/> </edit> </editing> </edits> </iri>'
+        self.project3.ldt = self.LU.generate_ldt(Content.objects.all())  
         self.project3.id = "333"
         self.project3.ldt_id = str(uuid.uuid1())
         self.project3.description = "proj3description"
@@ -49,9 +71,12 @@
     
     #test deletion of project with annotations  
     def test_del_project_v2(self):
+        self.cont4 = Content(iriurl="cont4_id/iriurl4", duration=100)
+        self.cont4.iri_id = "cont4_id"
+        self.cont4.save()
         
-        self.project4 = Project(title="titleproj3", owner=self.user)
-        self.project4.ldt = '<iri ldtversion="1.0.3" xmlns:dc="http://dublincore.org/documents/dcmi-namespace/"><project id="af3b99e4-b695-11df-bfde-00145ea4a333" user="admin" title="CA:reponse a TC" abstract=""/> <medias> <media extra="" id="laurentcantet_entrelesmurs" pict="" src="http://amateur.iri.centrepompidou.fr//atelier/static/media/ldt/laurentcantet_entrelesmurs/laurentcantet_entrelesmurs.iri" video="rtmp://media.iri.centrepompidou.fr/ddc_player/video/regardssignes/"/> </medias> <annotations> <content id="laurentcantet_entrelesmurs"> <ensemble id="ens_perso" idProject="fe0d5d4c-2201-11df-8a24-00145ea4a2be" title="Decoupages personnels" author="perso" abstract=""> <decoupage id="c_EFC3FFE7-0204-A086-EBEC-D2A03A0E56CB" author="perso"> <title>CA: prof et admin</title> <abstract/> <elements> <element id="s_442AAB3A-42DA-F9BF-75E7-D2A0663FD5FF" begin="985690" dur="373222" author="" date="2010/09/02" color="16711680" src=""> <title/> <abstract/> <audio source=""/> <tags/> </element> <element id="s_0050F043-3AD2-0A7C-6699-D2A03A1EBA02" begin="5052858" dur="124407" author="" date="2010/09/02" color="10053375" src=""> <title>conseil de classe</title> <abstract>Reprise de la figure precedente</abstract> <audio source="undefined"/> <tags/> </element> </elements> </decoupage> <decoupage id="c_EEEF5C29-86E1-4AAE-E068-04EB5B00E492" author="perso"> <title>TC: prof et admin</title> <abstract/> <elements> <element id="s_880D9D4B-8BC0-BA43-5ECA-04EBA9FC9E59" begin="2426894" dur="141478" author="" date="2010/02/25" color="10053375" src=""> <title>Conseil de classe</title> <abstract/> <audio source=""/> <tags> <tag>Argumentation</tag> </tags> </element> <element id="s_D568A57C-7110-DED2-3165-04EC54387060" begin="5052858" dur="124407" author="" date="2010/02/25" color="10053375" src=""> <title>conseil de classe</title> <abstract>Reprise de la figure precedente</abstract> <audio source="undefined"/> <tags/> </element> </elements> </decoupage> </ensemble> </content> </annotations> <displays> <display id="0" title="Init view" idsel="laurentcantet_entrelesmurs" tc="2426424" zoom="0" scroll="0" infoBAB=""> <audio source=""/> <content id="laurentcantet_entrelesmurs"> <decoupage idens="en_2" id="de_PPP" tagsSelect=""/> <decoupage idens="laurentcantet_entrelesmurs" id="c_14A2E638-1936-97DC-E303-2DBA6A82A8B3" tagsSelect=""/> <decoupage idens="ens_perso" id="c_EEEF5C29-86E1-4AAE-E068-04EB5B00E492" tagsSelect=""/> <decoupage idens="ens_perso" id="c_EFC3FFE7-0204-A086-EBEC-D2A03A0E56CB" tagsSelect=""/> </content> </display> </displays> <edits> <editing id="0" tags=""> <title>Bout a bout 1</title> <abstract/> <edit id="edit1" tags=""> <eList/> <caption/> <audio/> <mList/> </edit> <edit id="edit2" tags=""> <eList/> <caption/> <audio/> <mList/> </edit> </editing> </edits> </iri>'
+        self.project4 = Project(title="titleproj4", owner=self.user)
+        self.project4.ldt=self.LU.generate_ldt(Content.objects.all())  
         self.project4.id = "444"
         self.project4.ldt_id = str(uuid.uuid1())
         self.project4.description = "proj4description"
@@ -68,4 +93,76 @@
         self.project4.delete()
 
         with self.assertRaises(Project.DoesNotExist):
-            Project.objects.get(ldt_id=self.project4.ldt_id)
\ No newline at end of file
+            Project.objects.get(ldt_id=self.project4.ldt_id)
+    
+    def test_clean_database_project(self) :
+        self.cont5 = Content(iriurl="cont5_id/iriurl5", duration=123)
+        self.cont5.iri_id = "cont5_id"
+        self.cont5.save()
+        
+        self.cont6 = Content(iriurl="cont6_id/iriurl6", duration=100)
+        self.cont6.iri_id = "cont6_id"
+        self.cont6.save()
+        
+        self.cont7 = Content(iriurl="cont7_id/iriurl7", duration=100)
+        self.cont7.iri_id = "cont7_id"
+        self.cont7.save()
+        
+        self.project.contents.add(self.cont5, self.cont6)
+    
+        doc = self.LU.generate_ldt(Content.objects.all())
+        
+        #project5 : valid project
+        self.project5 = Project(title="titleproj5", owner=self.user)
+        ldt = lxml.etree.tostring(doc, pretty_print = False)
+        self.project5.ldt = ldt
+        self.project5.id = "555"
+        self.project5.ldt_id = str(uuid.uuid1())
+        self.project5.description = "proj5description"
+        self.project5.save()
+        
+        #project6 : project with empty ldt
+        self.project6 = Project(title="titleproj5", owner=self.user)
+        self.project6.id = "666"
+        self.project6.ldt_id = str(uuid.uuid1())
+        self.project6.description = "proj6description"
+        self.project6.save()
+        
+        #project7 : project with a non-existing media
+        
+        self.project7 = Project(title="titleproj7", owner=self.user)
+        self.project7.id = "777"
+        self.project7.ldt_id = str(uuid.uuid1())
+        self.project7.ldt = '<iri><project id="a18ec3de-49c1-11e2-8e5d-00161798aedb" title="" user="IRI Web" abstract=""/><medias><media id="non_existing_media" src="ldt/non_existing_media/non_existing_media_iri_url" video="%(stream_url)s" pict="" extra=""/></medias><annotations/><displays><display id="0" title="generated" idsel="cont5_id" tc="0"><content id="cont5_id"/><content id="cont6_id"/><content id="cont7_id"/></display></displays><edits/></iri>'
+        self.project7.description = "proj7description"
+        self.project7.save()
+        
+        #project8 : project with multiple medias some valid and some that don't exist
+        self.project8 = Project(title="titleproj8", owner=self.user)
+        self.project8.id = "888"
+        self.project8.ldt_id = str(uuid.uuid1())
+        self.project8.ldt = '<iri><project id="a18ec3de-49c1-11e2-8e5d-00161798aedb" title="" user="IRI Web" abstract=""/><medias><media id="cont5_id" src="ldt/cont5_id/iriurl5" video="%(stream_url)s" pict="" extra=""/><media id="non_existing_media" src="ldt/non_existing_media/non_existing_media_iri_url" video="%(stream_url)s" pict="" extra=""/><media id="cont6_id" src="ldt/cont6_id/iriurl6" video="%(stream_url)s" pict="" extra=""/><media id="cont7_id" src="ldt/cont7_id/iriurl7" video="%(stream_url)s" pict="" extra=""/></medias><annotations/><displays><display id="0" title="generated" idsel="cont5_id" tc="0"><content id="cont5_id"/><content id="cont6_id"/><content id="cont7_id"/></display></displays><edits/></iri>'
+        self.project8.description = "proj8description"
+        self.project8.save()
+        
+        #project9 : project without any media
+        self.project9 = Project(title="titleproj9", owner=self.user)
+        self.project9.id = "999"
+        self.project9.ldt_id = str(uuid.uuid1())
+        self.project9.ldt = '<iri><project id="a18ec3de-49c1-11e2-8e5d-00161798aedb" title="" user="IRI Web" abstract=""/><medias></medias><annotations/><displays><display id="0" title="generated" idsel="cont5_id" tc="0"><content id="cont5_id"/><content id="cont6_id"/><content id="cont7_id"/></display></displays><edits/></iri>'
+        self.project9.description = "proj9description"
+        self.project9.save()
+        
+        call_command('set_projectldtiri')
+
+        with self.assertRaises(Project.DoesNotExist):
+            Project.objects.get(ldt_id=self.project6.ldt_id)
+        
+        with self.assertRaises(Project.DoesNotExist):
+            Project.objects.get(ldt_id=self.project7.ldt_id)
+        
+        with self.assertRaises(Project.DoesNotExist):
+            Project.objects.get(ldt_id=self.project9.ldt_id)
+        
+        self.assertEqual(ldt, self.project5.ldt)    
+        
\ No newline at end of file
--- a/src/ldt/ldt/ldt_utils/utils.py	Tue Jan 22 13:07:37 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/utils.py	Wed Jan 23 17:19:56 2013 +0100
@@ -8,7 +8,6 @@
 import uuid
 from ldt.utils.url import request_with_auth
 from ldt.utils.url import absurl_norequest
-import logging
 
 __BOOLEAN_DICT = {
     'false':False,
@@ -58,7 +57,7 @@
                 videopath = unicode(content.videopath)
             media = lxml.etree.SubElement(medias, "media")
             media.set(u"id", content.iri_id)
-            media.set(u"src", content.iri_url(web_url))
+            media.set(u"src", content.relative_iri_url())
             media.set(u"video", videopath)
             media.set(u"pict", u"")
             media.set(u"extra", u"")
@@ -322,7 +321,7 @@
             idsel = content.iri_id
         elementMedia = lxml.etree.SubElement(elementMedias, 'media')
         elementMedia.set('id', content.iri_id)
-        elementMedia.set('src', content.iri_url())
+        elementMedia.set('src', content.relative_iri_url())
         
         if content.videopath != None :
             elementMedia.set('video', content.videopath)
--- a/src/ldt/ldt/ldt_utils/views/lignesdetemps.py	Tue Jan 22 13:07:37 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/views/lignesdetemps.py	Wed Jan 23 17:19:56 2013 +0100
@@ -4,17 +4,18 @@
 from django.http import HttpResponse, HttpResponseRedirect
 from django.shortcuts import render_to_response, get_object_or_404
 from django.template import RequestContext
+from ldt.indexation import SimpleSearch
 from ldt.ldt_utils.models import Content, Project, Media
+from ldt.ldt_utils.searchutils import search_generate_ldt
+from ldt.ldt_utils.stat import update_stat_project
 from ldt.ldt_utils.utils import LdtUtils, clean_description
-from ldt.indexation import SimpleSearch
 from ldt.security.utils import set_forbidden_stream
-from ldt.ldt_utils.stat import update_stat_project
-from ldt.ldt_utils.searchutils import search_generate_ldt
+from ldt.utils.projectldt_parser import absolute_src_xml, relative_src_xml
 from ldt.utils.url import absstatic, absurl
 from ldt.utils.web_url_management import get_web_url
 import base64
 import lxml.etree
-  
+
 def search_index_get(request, field, query):
     
     language_code = request.LANGUAGE_CODE[:2]
@@ -40,6 +41,7 @@
     
     resp = HttpResponse(mimetype="text/xml")
     doc, _ = search_generate_ldt(request, field, query)
+    doc = absolute_src_xml(doc)
     doc.write(resp, pretty_print=True)
     
     return resp
@@ -97,7 +99,6 @@
     
     ldtgen = LdtUtils()
     doc = ldtgen.generate_init([project_id, content_id, ensemble_id, cutting_id, segment_id], 'ldt.ldt_utils.views.lignesdetemps.ldt_segment', 'ldt.ldt_utils.views.lignesdetemps.highlight_segment')
-    
     return HttpResponse(lxml.etree.tostring(lxml.etree.ElementTree(doc), pretty_print=True), mimetype="text/xml;charset=utf-8")
 
 def highlight_segment(request, project_id, content_id, ensemble_id, cutting_id, segment_id):
@@ -127,6 +128,7 @@
     if project_id and project_id != "_" :
         project = Project.safe_objects.get(ldt_id=project_id) #@UndefinedVariable
         ldtdoc = lxml.etree.fromstring(project.ldt_encoded)
+        ldtdoc = absolute_src_xml(ldtdoc)
         ldtdoc = set_forbidden_stream(ldtdoc, request.user)
         displays_node = ldtdoc.find("displays")
         if not displays_node:
@@ -172,6 +174,7 @@
         }        
         
         doc = ldtgen.generate_ldt(content_list, "segment : ", author=username, startSegment=start_segment)
+        doc = absolute_src_xml(doc)
         doc = set_forbidden_stream(doc, request.user)
         doc.write(resp, pretty_print=('DEBUG' in dir(settings) and settings.DEBUG))
         
@@ -240,6 +243,7 @@
     
     doc = lxml.etree.fromstring(project.ldt_encoded)
     doc = set_forbidden_stream(doc, request.user)
+    doc = absolute_src_xml(doc)
     resp.write(lxml.etree.tostring(doc, pretty_print=True, xml_declaration=True, encoding="utf-8")) 
 
     return resp
@@ -249,10 +253,12 @@
 def save_ldt_project(request):
     if request.method == "POST":
         ldt = request.POST['ldt']
-        id = request.POST['id']
-        ldtproject = Project.safe_objects.select_related().get(ldt_id=id) #@UndefinedVariable
-
+        ldt_id = request.POST['id']
+        ldtproject = Project.safe_objects.select_related().get(ldt_id=ldt_id) #@UndefinedVariable
+        ldtxml=lxml.etree.fromstring(ldt)
         #save xml ldt
+        ldt, _, _ = relative_src_xml(ldtxml)
+        ldt = lxml.etree.tostring(ldt, pretty_print=True)          
         ldtproject.ldt = ldt
         
         doc = lxml.etree.fromstring(ldtproject.ldt_encoded)
@@ -265,11 +271,11 @@
         new_contents = []
         result = doc.xpath("/iri/medias/media")
         for medianode in result:
-            id = medianode.get("id")
-            new_contents.append(id)
+            media_id = medianode.get("id")
+            new_contents.append(media_id)
             #Put back the video fied from "forbidden_stream_url" to the video url
             if medianode.get("video") == settings.FORBIDDEN_STREAM_URL:
-                content = Content.objects.get(iri_id=id)
+                content = Content.objects.get(iri_id=media_id)
                 media = Media.objects.get(id=content.media_obj.id)
                 medianode.set('video', media.videopath)
                 ldtproject.ldt = lxml.etree.tostring(doc, pretty_print=True)
@@ -314,7 +320,7 @@
         ldt = ''
         new_contents = []
     
-    return render_to_response('ldt/ldt_utils/save_done.html', {'ldt': ldt, 'id':id, 'title':ldtproject.title, 'contents': new_contents}, context_instance=RequestContext(request))
+    return render_to_response('ldt/ldt_utils/save_done.html', {'ldt': ldt, 'id':ldt_id, 'title':ldtproject.title, 'contents': new_contents}, context_instance=RequestContext(request))
     
 
 def index(request, url):
@@ -337,6 +343,7 @@
     ldtgen = LdtUtils()
     doc = ldtgen.generate_ldt(contentList, title=contentList[0].title, startSegment=startSegment)
     doc = set_forbidden_stream(doc, request.user)
+    doc = absolute_src_xml(doc)
     doc.write(resp, pretty_print=True)
 
     return resp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/management/commands/set_projectldtiri.py	Wed Jan 23 17:19:56 2013 +0100
@@ -0,0 +1,26 @@
+from django.core.management.base import BaseCommand
+from ldt.ldt_utils.models import Content, Project
+from ldt.utils.projectldt_parser import relative_src_xml
+import lxml.etree
+
+class Command(BaseCommand):
+    help = 'set the .iri src in relative url'
+    
+    def handle(self, *args, **options):
+        project_list = Project.objects.all()
+        for p in project_list: #we check all the project in the database
+            no_more_media = False
+            modif = False
+            try : 
+                iri = lxml.etree.fromstring(p.ldt)
+            except :
+                iri = None
+                p.delete()
+            if iri is not None :
+                new_ldt, modif, no_more_media = relative_src_xml(iri)
+                if modif and not no_more_media:
+                    new_ldt = lxml.etree.tostring(new_ldt, pretty_print=True)
+                    p.ldt= new_ldt #we write the the new xml 
+                    p.save()
+                if no_more_media :
+                    p.delete()
\ No newline at end of file
--- a/src/ldt/ldt/static/ldt/css/ldtform.css	Tue Jan 22 13:07:37 2013 +0100
+++ b/src/ldt/ldt/static/ldt/css/ldtform.css	Wed Jan 23 17:19:56 2013 +0100
@@ -1,10 +1,26 @@
 @charset "UTF-8";
 
+input, textarea, select, .form-row p {
+    margin: 2px 0;
+    padding: 2px 3px;
+    vertical-align: middle;
+    font-family: "Lucida Grande", Verdana, Arial, sans-serif;
+    font-weight: normal;
+    font-size: 11px;
+}
+
+textarea {
+    vertical-align: top !important;
+}
+
+input[type=text], input[type=password], textarea, select, .vTextField {
+    border: 1px solid #ccc;
+}
 body {
 	min-width: 0;
 }
 
-#add_content, #add_contribution, #add_group {
+#add_contribution, #add_group {
 	padding: 10px;	
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/utils/projectldt_parser.py	Wed Jan 23 17:19:56 2013 +0100
@@ -0,0 +1,40 @@
+from ldt.utils.url import absolute_media_url, is_absolute
+from ldt.ldt_utils.models import Content, Project
+import lxml.etree
+
+def absolute_src_xml(doc):
+    media_list = doc.xpath("/iri/medias/media")
+    for element in media_list:
+        src = element.get("src") #we split to hate two parts, one with the src
+        if not is_absolute(src):
+            new_src = absolute_media_url()+src
+            element.set('src', new_src) #we replace the old value by the new one
+    return doc
+
+def relative_src_xml(ldt):
+    modif = False
+    no_more_media=False
+    media_list = ldt.xpath("/iri/medias/media")
+    if len(media_list) == 0 :
+        no_more_media = True
+    if not no_more_media :
+        for element in media_list:
+            src = element.get("src")
+            id_content=element.get("id")
+            content = None
+            try :
+                content = Content.objects.get(iri_id=id_content)
+            except :
+                element.getparent().remove(element)
+                modif = True
+                media_list = ldt.xpath("/iri/medias/media")
+                if len(media_list) == 0 :
+                    no_more_media =  True
+            if content is not None :
+                right_src = content.relative_iri_url()
+                if not src == right_src: #we will modify only the project that have an absolute url
+                    modif = True
+                    new_src = right_src
+                    element.set('src', new_src) #we replace the old value by the new one
+
+    return ldt, modif, no_more_media
\ No newline at end of file
--- a/src/ldt/ldt/utils/url.py	Tue Jan 22 13:07:37 2013 +0100
+++ b/src/ldt/ldt/utils/url.py	Wed Jan 23 17:19:56 2013 +0100
@@ -2,15 +2,22 @@
 from django.core.urlresolvers import reverse
 from ldt.utils.web_url_management import get_web_url
 from ldt import settings
+from django.conf import settings as djangosettings
 import httplib2
 import re
 import urlparse
+import logging
 
 def absstatic(request, path):
     domain=get_web_url(request)
     new_path = staticfiles_storage.url(path)
     return urlparse.urljoin(domain, new_path)
 
+def absolute_media_url():
+    domain=get_web_url()
+    
+    return urlparse.urljoin(domain, djangosettings.MEDIA_URL)
+
 def absurl(request, viewname, urlconf=None, args=None, kwargs=None, prefix=None, current_app=None):
     domain=get_web_url(request)
     path=reverse(viewname, urlconf, args, kwargs, prefix, current_app)