--- a/.hgtags Thu Oct 14 12:17:31 2010 +0200
+++ b/.hgtags Fri Oct 15 12:36:43 2010 +0200
@@ -22,3 +22,4 @@
fa03084f5fea9327a34f5cb6e2823d1bd7a8778c V00.18
d2c2d9e8523ed24d830501b8b8fc3fc4cdaf4e96 V00.19
de326ccbad7d068054879417a83ef95f9e904dde V00.20
+9bee2e1e34b9d48096acf5bd849cfacc0179ade5 V00.21
--- a/web/franceculture/__init__.py Thu Oct 14 12:17:31 2010 +0200
+++ b/web/franceculture/__init__.py Fri Oct 15 12:36:43 2010 +0200
@@ -1,4 +1,4 @@
-VERSION = (0, 20, 0, "final", 0)
+VERSION = (0, 21, 0, "final", 0)
VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION[:2])))
Binary file web/franceculture/locale/fr/LC_MESSAGES/django.mo has changed
--- a/web/franceculture/locale/fr/LC_MESSAGES/django.po Thu Oct 14 12:17:31 2010 +0200
+++ b/web/franceculture/locale/fr/LC_MESSAGES/django.po Fri Oct 15 12:36:43 2010 +0200
@@ -7,7 +7,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-09-20 22:09-0500\n"
+"POT-Creation-Date: 2010-10-12 03:19+0200\n"
"PO-Revision-Date: 2010-02-17 02:57+0100\n"
"Last-Translator: Yves-Marie Haussonne <ymh.work@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -20,9 +20,13 @@
msgid "French"
msgstr "Français"
+#: views.py:88
+msgid "You can not access this project"
+msgstr "Vous n'avez pas accès à ce projet"
+
#: templates/base.html:44
msgid "home"
-msgstr "acceuil"
+msgstr "accueil"
#: templates/base.html:45
msgid "contents"
@@ -48,30 +52,46 @@
msgid "Langue"
msgstr "Langue"
-#: templates/franceculture/embed_popup.html:51
+#: templates/franceculture/embed_popup.html:42
+msgid "popup_player"
+msgstr "Code du lecteur"
+
+#: templates/franceculture/embed_popup.html:42
+msgid "popup_seo_body"
+msgstr "Code lecteur et seo"
+
+#: templates/franceculture/embed_popup.html:42
+msgid "popup_seo_meta"
+msgstr "Code lecteur et seo balise meta"
+
+#: templates/franceculture/embed_popup.html:42
+msgid "popup_links"
+msgstr "Liste de liens"
+
+#: templates/franceculture/embed_popup.html:56
msgid "clik here to see the project content"
msgstr "cliquer ici pour voir le contenu du projet"
-#: templates/franceculture/workspace.html:49
+#: templates/franceculture/workspace.html:52
#: templates/ldt/ldt_utils/content_list.html:50
msgid "content list"
msgstr "Liste des contenus"
-#: templates/franceculture/workspace.html:51
-#: templates/franceculture/workspace.html:62
+#: templates/franceculture/workspace.html:54
+#: templates/franceculture/workspace.html:65
#: templates/ldt/ldt_utils/content_list.html:52
#: templates/ldt/ldt_utils/ldt_list.html:79
msgid "search"
msgstr "Recherche"
-#: templates/franceculture/workspace.html:60
+#: templates/franceculture/workspace.html:63
#: templates/ldt/ldt_utils/ldt_list.html:77
msgid "project list"
msgstr "Liste des projets"
#: templates/franceculture/partial/contentslist.html:3
#: templates/franceculture/partial/projectslist.html:3
-#: templates/ldt/ldt_utils/create_ldt.html:30
+#: templates/ldt/ldt_utils/create_ldt.html:42
msgid "name"
msgstr "Nom"
@@ -84,70 +104,112 @@
msgstr "preview"
#: templates/franceculture/partial/contentslist.html:21
-#: templates/ldt/ldt_utils/create_content.html:61
+#: templates/ldt/ldt_utils/create_content.html:68
msgid "Create content"
msgstr "Créer un Contenu"
+#: templates/franceculture/partial/projectslist.html:12
+msgid "open ldt"
+msgstr "Ouvrir sous Lignes de Temps"
+
+#: templates/franceculture/partial/projectslist.html:13
+msgid "copy project"
+msgstr "Copier projet"
+
#: templates/franceculture/partial/projectslist.html:14
+msgid "link json by id"
+msgstr "Ouvrir le lecteur augmenté"
+
+#: templates/franceculture/partial/projectslist.html:17
msgid "Project published, click to unpublish"
msgstr "Projet publié, cliquer pour de-publier"
-#: templates/franceculture/partial/projectslist.html:16
+#: templates/franceculture/partial/projectslist.html:19
msgid "Project not published, click to publish"
msgstr "Projet non publié, cliquer pour publier"
-#: templates/franceculture/partial/projectslist.html:20
-msgid "open ldt"
-msgstr "Ouvrir sous Lignes de Temps"
-
-#: templates/franceculture/partial/projectslist.html:21
-msgid "copy project"
-msgstr "Copier projet"
-
-#: templates/franceculture/partial/projectslist.html:22
-msgid "link json by id"
-msgstr "Ouvrir le lecteur augmenté"
-
-#: templates/franceculture/partial/projectslist.html:31
+#: templates/franceculture/partial/projectslist.html:36
msgid "Create project"
msgstr "Créer un projet"
-#: templates/ldt/ldt_utils/create_content.html:40
+#: templates/ldt/ldt_utils/create_content.html:47
msgid ""
"The operation could not be performed because one or more error(s) occurred."
"<br />Please resubmit the content form after making the following changes:"
msgstr ""
-"opération impossible à cause d'une ou plusieurs erreurs."
-"<br />Veuillez resoumettre le formulaire contenu après avoir fait les "
-"changements suivants:"
+"opération impossible à cause d'une ou plusieurs erreurs.<br />Veuillez "
+"resoumettre le formulaire contenu après avoir fait les changements suivants:"
-
-#: templates/ldt/ldt_utils/create_content.html:51
+#: templates/ldt/ldt_utils/create_content.html:58
msgid ""
"The operation could not be performed because one or more error(s) occurred."
"<br />Please resubmit the media form after making the following changes:"
msgstr ""
-"opération impossible à cause d'une ou plusieurs erreurs."
-"<br />Veuillez resoumettre le formulaire media après avoir fait les "
-"changements suivants:"
+"opération impossible à cause d'une ou plusieurs erreurs.<br />Veuillez "
+"resoumettre le formulaire media après avoir fait les changements suivants:"
+
+#: templates/ldt/ldt_utils/create_content.html:105
+msgid "media file is being processed please wait."
+msgstr "Le fichier média est en cours de traitement. Veullez patienter."
+
+#: templates/ldt/ldt_utils/create_content.html:109
+#: templates/ldt/ldt_utils/create_ldt.html:59
+#: templates/ldt/ldt_utils/error_confirm.html:48
+msgid "close_cancel"
+msgstr "Annuler"
+#: templates/ldt/ldt_utils/create_content.html:110
+msgid "delete"
+msgstr "Effacer"
-#: templates/ldt/ldt_utils/create_ldt.html:23
+#: templates/ldt/ldt_utils/create_content.html:111
+msgid "write"
+msgstr "Enregistrer"
+
+#: templates/ldt/ldt_utils/create_ldt.html:34
+msgid "Update your project"
+msgstr "Mettre à jour un projet"
+
+#: templates/ldt/ldt_utils/create_ldt.html:34
msgid "Create your project"
msgstr "Créer un projet"
-#: templates/ldt/ldt_utils/create_ldt.html:26
+#: templates/ldt/ldt_utils/create_ldt.html:38
msgid "Title"
msgstr "Titre"
-#: templates/ldt/ldt_utils/create_ldt.html:28
+#: templates/ldt/ldt_utils/create_ldt.html:40
msgid "List of contents"
msgstr "Liste des Médias"
-#: templates/ldt/ldt_utils/create_ldt.html:47
-msgid "Create"
+#: templates/ldt/ldt_utils/create_ldt.html:61
+msgid "delete_project"
+msgstr "Effacer"
+
+#: templates/ldt/ldt_utils/create_ldt.html:62
+msgid "update_project"
+msgstr "Mettre à jour"
+
+#: templates/ldt/ldt_utils/create_ldt.html:64
+msgid "create_project"
msgstr "Créer"
+#: templates/ldt/ldt_utils/error_confirm.html:30
+msgid "error"
+msgstr "Erreurs"
+
+#: templates/ldt/ldt_utils/error_confirm.html:30
+msgid "confirm"
+msgstr "Confirmer"
+
+#: templates/ldt/ldt_utils/error_confirm.html:44
+msgid "close_error"
+msgstr "fermer"
+
+#: templates/ldt/ldt_utils/error_confirm.html:49
+msgid "do_delete"
+msgstr "Effacer"
+
#: templates/ldt/user/login_form.html:33 templates/registration/login.html:14
msgid "Log in"
msgstr "Connexion"
@@ -188,6 +250,9 @@
msgid "Forget password?"
msgstr "Mot de passe oublié ?"
+#~ msgid "Create"
+#~ msgstr "Créer"
+
#~ msgid "link json by externalid"
#~ msgstr "ouvrir le lecteur augmenté"
--- a/web/franceculture/settings.py Thu Oct 14 12:17:31 2010 +0200
+++ b/web/franceculture/settings.py Fri Oct 15 12:36:43 2010 +0200
@@ -144,5 +144,5 @@
LOGIN_REDIRECT_URL = BASE_URL + 'franceculture'
GLOBAL_LOG_LEVEL = LOG_LEVEL
-GLOBAL_LOG_HANDLERS = [logging.FileHandler(LOG_FILE)]
+GLOBAL_LOG_HANDLERS = [{'handler':logging.FileHandler(LOG_FILE), 'format':"%(asctime)s - %(levelname)s : %(message)s"}]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/franceculture/templates/ldt/ldt_utils/workspace.html Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,4 @@
+{% extends "ldt/ldt_utils/workspace_base.html" %}
+
+{% block title %}France Culture{% endblock %}
+{% block base_title %}France Culture{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/auth/__init__.py Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,7 @@
+
+def checkAccess(user, obj):
+ check_meth = getattr(obj, 'checkAccess', False)
+ if check_meth:
+ return check_meth(user)
+ else:
+ return user.is_staff
\ No newline at end of file
--- a/web/ldt/ldt_utils/contentindexer.py Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/ldt_utils/contentindexer.py Fri Oct 15 12:36:43 2010 +0200
@@ -8,19 +8,13 @@
import ldt.utils.xml
from django.conf import settings
from models import Content
-import xml
-import xml.dom
-import xml.dom.minidom
-import xml.dom.ext
-import xml.xpath
import fnmatch
-import Ft
import uuid
import shutil
import lucene
from ldt.ldt_utils import STORE
from ldt.ldt_utils import ANALYZER
-## import lxml.etree
+import lxml.etree
def Property(func):
return property(**func())
@@ -57,52 +51,50 @@
def index_content(self, content):
url =content.iri_url()
filepath = urllib.urlopen(url)
- doc = xml.dom.minidom.parse(filepath)
- doc = Ft.Xml.Domlette.ConvertDocument(doc)
-
+ doc = lxml.etree.fromstring(filepath)
+
self.__writer.deleteDocuments(lucene.Term("iri_id", content.iri_id))
- con = xml.xpath.Context.Context(doc, 1, 1, None)
- res = xml.xpath.Evaluate("/iri/body/ensembles/ensemble", context=con)
+ res = doc.xpath("/iri/body/ensembles/ensemble")
for ensemble in res:
- ensembleId = ensemble.getAttributeNS(None,u"id")
+ ensembleId = ensemble.get(None,u"id")
- for decoupageNode in ensemble.childNodes:
- if decoupageNode.nodeType != xml.dom.Node.ELEMENT_NODE or decoupageNode.tagName != "decoupage" or decoupageNode.getAttributeNS(None,u"id") in self.decoupage_blacklist:
+ for decoupageNode in ensemble.getchildren():
+ if decoupageNode.tag != "decoupage" or decoupageNode.get(None,u"id") in self.decoupage_blacklist:
continue
- decoupId = decoupageNode.getAttributeNS(None,u"id")
- res = xml.xpath.Evaluate("elements/element", decoupageNode)
+ decoupId = decoupageNode.get(None,u"id")
+ res = decoupageNode.xpath("elements/element")
for elementNode in res:
doc = lucene.Document()
- elementId = elementNode.getAttributeNS(None,u"id")
- tags = elementNode.getAttributeNS(None,u"tags")
+ elementId = elementNode.get(None,u"id")
+ tags = elementNode.get(None,u"tags")
if tags is not None:
tags.replace(",", ";")
if tags is None or len(tags) == 0:
tags = ""
- restagnode = xml.xpath.Evaluate("tag/text()", elementNode)
+ restagnode = elementNode.xpath("tag/text()")
for tagnode in restagnode:
- tags = tags + " ; " + tagnode.data
+ tags = tags + " ; " + tagnode.text()
if tags is None or len(tags) == 0:
tags = ""
- restagnode = xml.xpath.Evaluate("tags/tag/text()", elementNode)
+ restagnode = elementNode.xpath("tags/tag/text()")
for tagnode in restagnode:
- tags = tags + " ; " + tagnode.data
+ tags = tags + " ; " + tagnode.text()
title = ""
- for txtRes in xml.xpath.Evaluate("title/text()", elementNode):
- title = title + txtRes.data
+ for txtRes in elementNode.xpath("title/text()"):
+ title = title + txtRes.text()
abstract = ""
- for txtRes in xml.xpath.Evaluate("abstract/text()", elementNode):
- abstract = abstract + txtRes.data
+ for txtRes in elementNode.xpath("abstract/text()"):
+ abstract = abstract + txtRes.text()
doc.add(lucene.Field("iri_id", content.iri_id, lucene.Field.Store.YES, lucene.Field.Index.NOT_ANALYZED))
doc.add(lucene.Field("ensemble_id", ensembleId, lucene.Field.Store.YES, lucene.Field.Index.NO))
@@ -164,53 +156,51 @@
def index_project(self, project):
# pocketfilms.utils.log.debug("Indexing project : "+str(project.iri_id))
- doc = xml.dom.minidom.parseString(project.ldt)
- doc = Ft.Xml.Domlette.ConvertDocument(doc)
+ doc = lxml.etree.fromstring(project.ldt)
self.__writer.deleteDocuments(lucene.Term("iri_id", project.iri_id))
- con = xml.xpath.Context.Context(doc, 1, 1, None)
- res = xml.xpath.Evaluate("/iri/annotations/content", context=con)
+ res = doc.xpath("/iri/annotations/content")
for content in res:
- contentId = content.getAttributeNS(None,u"id")
+ contentId = content.get(None,u"id")
ensembleId = "ens_perso"
- for decoupageNode in content.childNodes:
+ for decoupageNode in content.getchildren():
# pocketfilms.utils.log.debug("Indexing content decoupage : "+ repr(decoupageNode.nodeType) + " in " + repr(self.decoupage_blacklist))
- if decoupageNode.nodeType != xml.dom.Node.ELEMENT_NODE or decoupageNode.tagName != "decoupage" or decoupageNode.getAttributeNS(None,"id") in self.decoupage_blacklist:
- continue
+ if decoupageNode.tag != "decoupage" or decoupageNode.get(None,"id") in self.decoupage_blacklist:
+ continue
- decoupId = decoupageNode.getAttributeNS(None,u"id")
- res = xml.xpath.Evaluate("elements/element", decoupageNode)
+ decoupId = decoupageNode.get(None,u"id")
+ res = decoupageNode.xpath("elements/element")
for elementNode in res:
doc = lucene.Document()
- elementId = elementNode.getAttributeNS(None,u"id")
- tags = elementNode.getAttributeNS(None,u"tags")
+ elementId = elementNode.get(None,u"id")
+ tags = elementNode.get(None,u"tags")
if tags is not None:
tags.replace(",", ";")
if tags is None or len(tags) == 0:
tags = ""
- restagnode = xml.xpath.Evaluate("tag/text()", elementNode)
+ restagnode = elementNode.xpath("tag/text()")
for tagnode in restagnode:
- tags = tags + " ; " + tagnode.data
+ tags = tags + " ; " + tagnode.text()
if tags is None or len(tags) == 0:
tags = ""
- restagnode = xml.xpath.Evaluate("tags/tag/text()", elementNode)
+ restagnode = elementNode.xpath("tags/tag/text()")
for tagnode in restagnode:
- tags = tags + " ; " + tagnode.data
+ tags = tags + " ; " + tagnode.text()
title = ""
- for txtRes in xml.xpath.Evaluate("title/text()", elementNode):
- title = title + txtRes.data
+ for txtRes in elementNode.xpath("title/text()"):
+ title = title + txtRes.text()
abstract = ""
- for txtRes in xml.xpath.Evaluate("abstract/text()", elementNode):
- abstract = abstract + txtRes.data
+ for txtRes in elementNode.xpath("abstract/text()"):
+ abstract = abstract + txtRes.text()
doc.add(lucene.Field("project_id", project.iri_id, lucene.Field.Store.YES, lucene.Field.Index.NOT_ANALYZED))
doc.add(lucene.Field("iri_id", contentId, lucene.Field.Store.YES, lucene.Field.Index.NOT_ANALYZED))
--- a/web/ldt/ldt_utils/forms.py Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/ldt_utils/forms.py Fri Oct 15 12:36:43 2010 +0200
@@ -30,7 +30,7 @@
field = forms.ChoiceField([(u"all", u"all"), (u"title", u"title"), (u"abstract", u"resume"), (u"tags", u"tags")])
class AddProjectForm (forms.Form):
- title = forms.CharField()
+ title = forms.CharField(widget=forms.TextInput(attrs={'class':'inputbox required'}))
class CopyProjectForm (forms.Form):
title = forms.CharField()
--- a/web/ldt/ldt_utils/models.py Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/ldt_utils/models.py Fri Oct 15 12:36:43 2010 +0200
@@ -23,9 +23,9 @@
class Media(models.Model):
external_id = models.CharField(max_length=1024, null=True, blank=True, verbose_name=_('media.external_id'))
- external_permalink = models.URLField(max_length=1024, null=True, blank=True, verbose_name=_('content.external_permalink'))
- external_publication_url = models.URLField(max_length=1024, null=True, blank=True, verbose_name=_('content.external_publication_url'))
- external_src_url = models.URLField(max_length=1024, null=True, blank=True, verbose_name=_('content.external_publication_url'))
+ external_permalink = models.URLField(max_length=1024, verify_exists=False, null=True, blank=True, verbose_name=_('media.external_permalink'))
+ external_publication_url = models.URLField(max_length=1024, verify_exists=True, null=True, blank=True, verbose_name=_('media.external_publication_url'))
+ external_src_url = models.URLField(max_length=1024, verify_exists=False, null=True, blank=True, verbose_name=_('media.external_src_url'))
creation_date = models.DateTimeField(auto_now_add=True, verbose_name=_('media.creation_date'))
media_creation_date = models.DateTimeField(null=True, blank=True, verbose_name=_('media.media_creation_date'))
update_date = models.DateTimeField(auto_now=True, verbose_name=_('media.update_date'))
@@ -47,7 +47,7 @@
'mp3': lambda s: "%s:%s" %("mp3",res_src[:-4]),
'mp4': lambda s: "%s:%s" %("mp4",res_src[:-4]),
'f4v': lambda s: "%s:%s" %("mp4",res_src[:-4]),
- }.get(extension, lambda s:s)(res_src)
+ }.get(extension, lambda s:s)(res_src.lower())
return res_src
return locals()
@@ -82,12 +82,21 @@
content_creation_date = models.DateTimeField(null=True, blank=True, verbose_name=_('content.content_creation_date'))
tags = tagging.fields.TagField(max_length=2048, null=True, blank=True )
media_obj = models.ForeignKey('Media', blank=True, null=True )
+
+ class Meta:
+ ordering = ["title"]
def get_duration(self):
if self.duration is None:
doc = lxml.etree.parse(self.iri_file_path())
res = doc.xpath("/iri/body/medias/media[@id='video']/video")
- self.duration = int(res[0].get(u'dur') or 0)
+ if len(res) > 0:
+ try:
+ self.duration = int(res[0].get(u'dur',0) or 0)
+ except:
+ self.duration = 0
+ else:
+ self.duration = 0
self.save()
return self.duration
@@ -248,6 +257,10 @@
changed_by = models.CharField(_("changed by"), max_length=70)
state = models.IntegerField(choices=STATE_CHOICES, default=1)
+ class Meta:
+ ordering = ["title"]
+
+
def __unicode__(self):
return unicode(self.id) + u": " + unicode(self.ldt_id)
@@ -286,6 +299,13 @@
project.contents.add(content)
project.save()
return project
+
+ def checkAccess(self, user):
+ if (user and user.is_staff) or self.state == 2:
+ return True
+ else:
+ return False
+
class Segment(models.Model):
--- a/web/ldt/ldt_utils/projectindexer.py Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/ldt_utils/projectindexer.py Fri Oct 15 12:36:43 2010 +0200
@@ -4,15 +4,10 @@
import shutil
import ldt.utils.xml
from ldt import settings
-import xml
-import xml.dom
-import xml.dom.minidom
-import xml.dom.ext
-import xml.xpath
import lucene
from ldt.ldt_utils import STORE
from ldt.ldt_utils import ANALYZER
-
+import lxml.etree
def Property(func):
return property(**func())
@@ -47,68 +42,67 @@
def index_project(self, project):
# ldt.utils.log.debug("Indexing project : "+str(project.ldt_id))
- ldt=project.ldt
- doc = xml.dom.minidom.parseString(ldt.encode( "utf-8" ))
+ ldt=project.ldt
+ doc = lxml.etree.fromstring(ldt.encode( "utf-8" ))
self.__writer.deleteDocuments(lucene.Term("ldt_id", project.ldt_id))
- con = xml.xpath.Context.Context(doc, 1, 1, None)
- res = xml.xpath.Evaluate("/iri/annotations/content", context=con)
+ res = doc.xpath("/iri/annotations/content")
project.ldt.encode( "utf-8 " )
for content in res:
- contentId = content.getAttribute("id")
+ contentId = content.get("id")
- res =xml.xpath.Evaluate("ensemble", content)
+ res =content.xpath("ensemble")
for ensemble in res:
- ensembleId = ensemble.getAttribute("id")
+ ensembleId = ensemble.get("id")
- for decoupageNode in ensemble.childNodes:
+ for decoupageNode in ensemble.getchildren():
# ldt.utils.log.debug("Indexing project decoupage : "+ repr(decoupageNode.nodeType) + " in " + repr(self.decoupage_blacklist))
- if decoupageNode.nodeType != xml.dom.Node.ELEMENT_NODE or decoupageNode.tagName != "decoupage" or decoupageNode.getAttribute("id") in self.decoupage_blacklist:
+ if decoupageNode.tag != "decoupage" or decoupageNode.get("id") in self.decoupage_blacklist:
continue
- decoupId = decoupageNode.getAttribute("id")
- res = xml.xpath.Evaluate("elements/element", decoupageNode)
+ decoupId = decoupageNode.get("id")
+ res = decoupageNode.xpath("elements/element")
for elementNode in res:
doc = lucene.Document()
- elementId = elementNode.getAttribute("id")
- tags = elementNode.getAttribute("tags")
+ elementId = elementNode.get("id")
+ tags = elementNode.get("tags")
if tags is not None:
tags.replace(",", ";")
if tags is None or len(tags) == 0:
tags = ""
- restagnode = xml.xpath.Evaluate("tag/text()", elementNode)
+ restagnode = elementNode.xpath("tag/text()")
for tagnode in restagnode:
- tags = tags + " ; " + tagnode.data
+ tags = tags + " ; " + tagnode.text()
if tags is None or len(tags) == 0:
tags = ""
- restagnode = xml.xpath.Evaluate("tags/tag/text()", elementNode)
+ restagnode = elementNode.xpath("tags/tag/text()")
for tagnode in restagnode:
- tags = tags + " ; " + tagnode.data
+ tags = tags + " ; " + tagnode.text()
title = ""
- for txtRes in xml.xpath.Evaluate("title/text()", elementNode):
- title = title + txtRes.data
+ for txtRes in elementNode.xpath("title/text()"):
+ title = title + txtRes.text()
abstract = ""
- for txtRes in xml.xpath.Evaluate("abstract/text()", elementNode):
- abstract = abstract + txtRes.data
+ for txtRes in elementNode.xpath("abstract/text()"):
+ abstract = abstract + txtRes.text()
- doc.add(lucene.Field("ldt_id", project.ldt_id, lucene.Field.Store.YES, lucene.Field.Index.UN_TOKENIZED))
- doc.add(lucene.Field("iri_id", contentId, lucene.Field.Store.YES, lucene.Field.Index.UN_TOKENIZED))
+ doc.add(lucene.Field("ldt_id", project.ldt_id, lucene.Field.Store.YES, lucene.Field.Index.NOT_ANALYZED))
+ doc.add(lucene.Field("iri_id", contentId, lucene.Field.Store.YES, lucene.Field.Index.NOT_ANALYZED))
doc.add(lucene.Field("ensemble_id", ensembleId, lucene.Field.Store.YES, lucene.Field.Index.NO))
doc.add(lucene.Field("decoupage_id", decoupId, lucene.Field.Store.YES, lucene.Field.Index.NO))
doc.add(lucene.Field("element_id", elementId, lucene.Field.Store.YES, lucene.Field.Index.NO))
- doc.add(lucene.Field("tags", tags, lucene.Field.Store.NO, lucene.Field.Index.TOKENIZED))
- doc.add(lucene.Field("title", title, lucene.Field.Store.NO, lucene.Field.Index.TOKENIZED))
- doc.add(lucene.Field("abstract", abstract, lucene.Field.Store.NO, lucene.Field.Index.TOKENIZED))
- doc.add(lucene.Field("all", " ".join([tags, title, abstract]), lucene.Field.Store.NO, lucene.Field.Index.TOKENIZED))
+ doc.add(lucene.Field("tags", tags, lucene.Field.Store.NO, lucene.Field.Index.ANALYZED))
+ doc.add(lucene.Field("title", title, lucene.Field.Store.NO, lucene.Field.Index.ANALYZED))
+ doc.add(lucene.Field("abstract", abstract, lucene.Field.Store.NO, lucene.Field.Index.ANALYZED))
+ doc.add(lucene.Field("all", " ".join([tags, title, abstract]), lucene.Field.Store.NO, lucene.Field.Index.ANALYZED))
self.__writer.addDocument(doc)
- self.__writer.flush()
+ self.__writer.commit()
--- a/web/ldt/ldt_utils/projectserializer.py Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/ldt_utils/projectserializer.py Fri Oct 15 12:36:43 2010 +0200
@@ -10,15 +10,19 @@
"""
class ProjectSerializer:
- def __init__(self, project):
+ def __init__(self, project, from_contents=True, from_display=True):
self.project = project
+ self.parsed = False
self.ldt_doc = None
self.medias = []
self.annotations = []
self.tags = {}
+ self.tags_by_id = {}
self.annotation_types = []
self.views = []
self.lists = []
+ self.serialize_contents = from_contents
+ self.from_display = from_display
def __parse_ensemble(self, ensemble_node, content):
@@ -151,6 +155,7 @@
}
}
self.tags[tag_title] = new_tag
+ self.tags_by_id[tag_id] = new_tag
element_tags.append({"id-ref":tag_id})
if not element_tags:
@@ -199,8 +204,7 @@
content = Content.objects.get(iri_id=iri_id)
self.__parse_content(content)
- res = self.ldt_doc.xpath("/iri/annotations/content")
-
+ res = self.ldt_doc.xpath("/iri/annotations/content")
for content_node in res:
content_id = content_node.attrib[u"id"]
content = Content.objects.get(iri_id=content_id)
@@ -209,6 +213,11 @@
continue
self.__parse_ensemble(ensemble_node, content)
+# res = self.ldt_doc.xpath("/iri/displays/display")
+# for display_node in res:
+# pass
+
+ self.parsed = True
def __parse_content(self, content):
@@ -239,11 +248,16 @@
if len(res) > 0:
content_date = res[0]
-
+ href = ""
+ meta_item_value = ""
+ if content.videopath:
+ href = content.videopath.rstrip('/') + "/" + content.src
+ meta_item_value = content.videopath.rstrip('/') + "/"
+
new_media = {
"http://advene.liris.cnrs.fr/ns/frame_of_reference/ms" : "o=0",
"id" : content.iri_id,
- "href" : content.videopath.rstrip('/') + "/" + content.src,
+ "href" : href,
"unit" : "ms",
"origin" : "0",
"meta": {
@@ -258,25 +272,25 @@
"dc:duration" : content.get_duration(),
"item": {
"name" : "streamer",
- "value": content.videopath.rstrip('/') + "/"
+ "value": meta_item_value,
},
}
}
self.medias.append(new_media)
-
- res = doc.xpath("/iri/body/ensembles/ensemble")
-
- for ensemble_node in res:
- self.__parse_ensemble(ensemble_node, content)
+ if self.serialize_contents:
+ res = doc.xpath("/iri/body/ensembles/ensemble")
+ for ensemble_node in res:
+ self.__parse_ensemble(ensemble_node, content)
def serialize_to_cinelab(self):
res = {}
- self.__parse_ldt()
+ if not self.parsed:
+ self.__parse_ldt()
project_main_media = ""
if len(self.medias) > 0:
@@ -321,4 +335,42 @@
res['views'] = self.views # ignored for the moment
return res
+
+ def getAnnotations(self, first_cutting=True):
+ if not self.parsed:
+ self.__parse_ldt()
+
+ annotations = []
+
+ current_cutting = None
+ uri = None
+ for annot in self.annotations:
+ if first_cutting and current_cutting and current_cuttings != annot['meta']['id-ref'] :
+ break
+ current_cuttings = annot['meta']['id-ref']
+ content_id = annot['media']
+ content = Content.objects.get(iri_id=content_id)
+ if annot['tags']:
+ tags_list = map(lambda tag_entry: self.tags_by_id[tag_entry['id-ref']]['meta']['dc:title'],annot['tags'])
+ else:
+ tags_list = []
+ begin = int(annot['begin'])
+ duration = int(annot['end'])-begin
+ if content.media_obj and content.media_obj.external_publication_url:
+ uri = "%s#t=%d" % (content.media_obj.external_publication_url, begin)
+
+
+ annotations.append({
+ 'begin': begin,
+ 'duration':duration,
+ 'title':annot['content']['title'],
+ 'desc':annot['content']['description'],
+ 'tags': tags_list,
+ 'id':annot['id'],
+ 'uri':uri
+ })
+
+ return annotations
+
+
--- a/web/ldt/ldt_utils/templates/ldt/embed_popup.html Thu Oct 14 12:17:31 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-{% load i18n %}
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Cache" content="no store" />
- <meta http-equiv="Expires" content="-1" />
- <title>Ligne de Temps - IRI</title>
- <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/LdtPlayer.min.js"></script>
- <script type="text/javascript">
- __IriSP.lib = {
- jQuery:"{{LDT_MEDIA_PREFIX}}js/jquery.min.js",
- jQueryUI:"{{LDT_MEDIA_PREFIX}}js/jquery-ui.min.js",
- jQueryToolTip:"{{LDT_MEDIA_PREFIX}}js/jquery.tools.min.js",
- swfObject:"{{LDT_MEDIA_PREFIX}}js/swfobject.js",
- cssjQueryUI:"{{LDT_MEDIA_PREFIX}}css/jq-css/themes/base/jquery-ui.css"
- };
- </script>
- <script type="text/javascript">
- $(document).ready(function(){
- $('.ldt_json_link').click(function(e) {
- e.preventDefault();
- link = $(e.target);
- $("#res_link_{{player_id}}").load(link.attr("href"));
- $("#res_link_{{player_id}}").show();
- return false;
- });
- });
- </script>
-
-
- <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/workspace.css" type="text/css"/>
- </head>
-
- <body id="init_embed_popup">
-
- <div class="ldt_player" id="wrapper_{{player_id}}">
- {% include "ldt/ldt_utils/embed.html" %}
- </div>
-
- <div style="height: 100px"> </div>
-
- <code id ="code_{{player_id}}" >
- <div class="ldt_player_code"><pre>
-{{ player_embed_rendered }}<br/>
- </pre></div>
- </code>
-
-
- <a href="{{json_url}}?escape=true&mimetype=text/plain" class="ldt_json_link" >{% trans 'clik here to see the project content' %}</a>
-
- <code id ="json_{{player_id}}" ><pre>
- <div id="res_link_{{player_id}}" class="ldt_player_code" style="display: none;">
- </div>
- </pre></code>
- </body>
-</html>
-
--- a/web/ldt/ldt_utils/templates/ldt/ldt_utils/contentslist.html Thu Oct 14 12:17:31 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-{% load i18n %}
-<div class="projectscontentsheader span-12 last" id="contentsheader">
-{% trans "name" %}
-</div>
-<div class="span-12 last projectscontentstablewrapperdiv">
-<div class="span-12 last projectscontentstablediv" id="contentstablediv">
- <table class="projectscontentstable">
- <tbody class="projectscontentsbody">
- {% for content in contents %}
- <tr class="imageline {% cycle 'projectscontentsoddline' 'projectscontentsevenline'%}">
- <td class="cellimg"><div class="cellimgdiv"><img src="{{LDT_MEDIA_PREFIX}}/img/document_add.gif" title="{% trans 'create project' %}" alt="{% trans 'create project' %}" href="{% url ldt.ldt_utils.views.create_project content.iri_id %}" class="ldt_link_create"/></div></td>
- <td class="cellimg"><div class="cellimgdiv"><img alt="{% trans 'preview media'%}" title="{% trans 'preview media'%}" src="{{LDT_MEDIA_PREFIX}}/img/control_play.gif" href="{% url ldt.ldt_utils.views.index content.iri_id %}" class="ldt_link"/></div></td>
- <td class="contenttitle"><a class="contenttitlelink" href="{% url ldt.ldt_utils.views.write_content iri_id=content.iri_id %}">{{ content.title }}</a></td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
-</div>
-</div>
-<div class="projectscontentsfooter span-12 last">
-+ <a class='content_link_create' href="{% url ldt.ldt_utils.views.write_content %}">{% trans "Create content" %}</a>
-</div>
-
--- a/web/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html Fri Oct 15 12:36:43 2010 +0200
@@ -1,4 +1,4 @@
-{% extends "ldt_raw_base.html" %}
+{% extends "ldt/ldt_raw_base.html" %}
{% load i18n %} {# form of creation of content #}
{% load adminmedia %}
@@ -23,6 +23,13 @@
<script type="text/javascript">
window.__admin_media_prefix__ = "{% filter escapejs %}{% admin_media_prefix %}{% endfilter %}";
$(document).ready(function() {
+ $("#close_button").click(function (e) {
+ e.preventDefault();
+ parent.$.nyroModalRemove();
+ });
+ $("#submit_button_write").click(function(e) {
+ $(".submitcontent-loader-content").show();
+ });
$(".media_fields").hide();
$("#media_field_"+$("#id_content-media_input_type").val()).show();
$("#id_content-media_input_type").change(function(e) {
@@ -93,7 +100,16 @@
</div>
</div>
<div id="submitcontent" class="span-18 last">
- <input type="submit"/>
+ <div id="submitcontent-loader" class="span-10">
+ <div id="submitcontent-loader-img" class="submitcontent-loader-content span-10 last"><img alt="loader" src="{{LDT_MEDIA_PREFIX}}img/ajax-loader-220x19.gif"/></div>
+ <div id="submitcontent-loader-msg" class="submitcontent-loader-content span-10 last">{% trans "media file is being processed please wait." %}</div>
+ <span> </span>
+ </div>
+ <div id="submitcontent-buttons" class="span-8 last">
+ <button id="close_button" value="close">{% trans 'close_cancel' %}</button>
+ {% if iri_id %}<button type="submit" value="prepare_delete" name="submit_button">{% trans "delete" %}</button>{% endif %}
+ <button type="submit" value="write" name="submit_button" id="submit_button_write">{% trans "write" %}</button>
+ </div>
</div>
</form>
</div>
--- a/web/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html Fri Oct 15 12:36:43 2010 +0200
@@ -1,4 +1,4 @@
-{% extends "ldt_raw_base.html" %}
+{% extends "ldt/ldt_raw_base.html" %}
{% load i18n %} {# form of creation of content #}
{% load adminmedia %}
@@ -17,14 +17,26 @@
<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/workspace.css" />
{% endblock %}
+{% block js_declaration %}
+ {{ block.super }}
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $("#close_button").click(function (e) {
+ e.preventDefault();
+ parent.$.nyroModalRemove();
+ });
+ });
+ </script>
+{% endblock %}
{% block body %}
<div id="add_contribution" class="span-12 last">
- <div class="projectscontentstitle span-12 last">{% trans "Create your project" %}</div>
+ <div class="projectscontentstitle span-12 last">{% if ldt_id %}{% trans "Update your project" %}{% else %}{% trans "Create your project" %}{% endif %}</div>
<form action="{{create_project_action}}" method="POST">
{% csrf_token %}
+ <input type="hidden" name="form_status" value="{{form_status}}" id="project_form_status" />
<label for="title">{% trans "Title" %}:</label>
- <input class="inputbox required" type="text" name="title" size="80" ; value="" id="title" />
+ {{form.title}}
<label>{% trans "List of contents" %}</label>
<div class="span-12 last projectscontentsdiv" id="ldtcreatecontentslistcontainer">
<div class="projectscontentsheader span-12 last" id="contentslistheader">{% trans "name" %}</div>
@@ -34,7 +46,7 @@
<tbody class="projectscontentsbody">
{% for content in contents %}
<tr class="imageline {% cycle 'projectscontentsoddline' 'projectscontentsevenline'%}">
- <td class="cellcheckbox"><input type="checkbox" name="contents" value="{{ content.id }}" checked="true" /></td>
+ <td class="cellcheckbox"><input type="checkbox" name="contents" value="{{ content.id }}" checked="true" {% if ldt_id %}disabled="disabled"{% endif %} /></td>
<td class="contenttitle">{{ content.title }}</td>
</tr>
{% endfor %}
@@ -43,8 +55,14 @@
</div>
</div>
</div>
- <div id="submitcontent" class="span-12 last">
- <input class="button" id="ldt_submit" type="submit" value="{% trans 'Create' %}" />
+ <div id="submitcontent-buttons" class="span-12 last">
+ <button type="button" id="close_button" value="close">{% trans 'close_cancel' %}</button>
+ {% if ldt_id %}
+ <button class="button" id="ldt_submit" type="submit" value="prepare_delete" name="submit_button">{% trans "delete_project" %}</button>
+ <button class="button" id="ldt_submit" type="submit" value="update" name="submit_button">{% trans "update_project" %}</button>
+ {% else %}
+ <button class="button" id="ldt_submit" type="submit" value="create" name="submit_button">{% trans "create_project" %}</button>
+ {% endif %}
</div>
</form>
</div>
--- a/web/ldt/ldt_utils/templates/ldt/ldt_utils/embed.html Thu Oct 14 12:17:31 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-<div style="height: 80px"> </div>
-<div id="{{ player_id }}">
-</div>
-<script type="text/javascript">
- var config = {
- metadata:{
- format:'cinelab',
- src:'{{ json_url }}',
- load:'jsonp'},
- gui:{
- width:650,
- height:1,
- mode:'radio',
- container:'{{ player_id }}',
- debug:false,
- css:'{{LDT_MEDIA_PREFIX}}/css/LdtPlayer.css'},
- player:{
- type:'jwplayer',
- src:'{{LDT_MEDIA_PREFIX}}/swf/player.swf'}
- };
- __IriSP.init(config);
-</script>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,60 @@
+{% load i18n %}
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
+ <meta http-equiv="Pragma" content="no-cache" />
+ <meta http-equiv="Cache" content="no store" />
+ <meta http-equiv="Expires" content="-1" />
+ <title>Ligne de Temps - IRI</title>
+ <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.min.js"></script>
+ <script type="text/javascript">
+ var $j = jQuery.noConflict();
+ </script>
+ <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/LdtPlayer.min.js"></script>
+ <script type="text/javascript">
+ __IriSP.lib = {
+ jQuery:"{{LDT_MEDIA_PREFIX}}js/jquery.min.js",
+ jQueryUI:"{{LDT_MEDIA_PREFIX}}js/jquery-ui.min.js",
+ jQueryToolTip:"{{LDT_MEDIA_PREFIX}}js/jquery.tools.min.js",
+ swfObject:"{{LDT_MEDIA_PREFIX}}js/swfobject.js",
+ cssjQueryUI:"{{LDT_MEDIA_PREFIX}}css/jq-css/themes/base/jquery-ui.css"
+ };
+ </script>
+ <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/embed_popup.js"></script>
+
+
+ <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/workspace.css" type="text/css"/>
+ <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/embed_popup.css" type="text/css"/>
+ </head>
+
+ <body id="init_embed_popup">
+
+ <div class="ldt_player" id="wrapper_{{player_id}}">
+ {% include "ldt/ldt_utils/partial/embed_player.html" %}
+ </div>
+
+ <div style="height: 100px"> </div>
+
+
+ <div id="button_row">
+ <div id="display_select">
+ <input type="button" value="{% trans 'popup_player'%}" id="player_button"/><input id="seo_body_button" type="button" value="{% trans 'popup_seo_body' %}"/><input id="seo_meta_button" type="button" value="{% trans 'popup_seo_meta' %}"/><input id="links_button" type="button" value="{% trans 'popup_links' %}"/>
+ </div>
+ </div>
+
+ <div class="ldt_player_code">
+ <code id ="code_{{player_id}}" >
+ <div id="player_code"><pre>{{ embed_rendered.player }}</pre></div>
+ <div id="seo_body_code"><pre>{{ embed_rendered.seo_body }}</pre></div>
+ <div id="seo_meta_code"><pre>{{ embed_rendered.seo_meta }}</pre></div>
+ </code>
+
+ <div id="links_code">{% include "ldt/ldt_utils/partial/embed_links.html" %}</div>
+ </div>
+
+ <a href="{{json_url}}?escape=true&mimetype=text/plain" class="ldt_json_link" >{% trans 'clik here to see the project content' %}</a>
+
+ </body>
+</html>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm.html Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,54 @@
+{% extends "ldt/ldt_raw_base.html" %}
+
+{% load i18n %} {# form of creation of content #}
+
+{% block js_import %}
+ {{ block.super }}
+{% endblock %}
+
+{% block css_import %}
+ {{ block.super }}
+ {{ content_form.media.css }}
+ <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}ldt/css/ldt.css" />
+ <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/ldtform.css" />
+{% endblock %}
+
+
+{% block js_declaration %}
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $("#close_button").click(function(e) {
+ parent.$.nyroModalRemove();
+ });
+ });
+ </script>
+{% endblock %}
+
+{% block body %}
+
+<div id="error">
+<div class="projectscontentstitle">{% if errors|length > 0 %}{% trans "error" %}{% else %}{% trans "confirm" %}{% endif %}</div>
+<div class="error_message">
+ {{ message }}
+ {% if errors|length > 0 %}
+ <ul>
+ {% for error_msg in errors %}
+ <li>{{ error_msg }}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+</div>
+
+<div id="submitcontent" >
+{% if errors|length > 0 %}
+ <button id="close_button" value="close">{% trans 'close_error' %}</button>
+{% else %}
+ <form method="post" enctype="application/x-www-form-urlencoded" action="{{ delete_action }}">
+ {% csrf_token %}
+ <button id="close_button" value="close">{% trans 'close_cancel' %}</button>
+ <button type="submit" value="delete" name="submit_button" id="submit_button">{% trans "do_delete" %}</button>
+ </form>
+{% endif %}
+</div>
+
+{% endblock %}
--- a/web/ldt/ldt_utils/templates/ldt/ldt_utils/ldt_list.html Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/ldt_list.html Fri Oct 15 12:36:43 2010 +0200
@@ -1,4 +1,4 @@
-{% extends "ldt_base.html" %}
+{% extends "ldt/ldt_base.html" %}
{% load i18n %}
{% block js_import %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/partial/contentslist.html Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,23 @@
+{% load i18n %}
+<div class="projectscontentsheader span-12 last" id="contentsheader">
+{% trans "name" %}
+</div>
+<div class="span-12 last projectscontentstablewrapperdiv">
+<div class="span-12 last projectscontentstablediv" id="contentstablediv">
+ <table class="projectscontentstable">
+ <tbody class="projectscontentsbody">
+ {% for content in contents %}
+ <tr class="imageline {% cycle 'projectscontentsoddline' 'projectscontentsevenline'%}">
+ <td class="cellimg"><div class="cellimgdiv"><img src="{{LDT_MEDIA_PREFIX}}/img/document_add.gif" title="{% trans 'create project' %}" alt="{% trans 'create project' %}" href="{% url ldt.ldt_utils.views.create_project content.iri_id %}" class="ldt_link_create"/></div></td>
+ <td class="cellimg"><div class="cellimgdiv"><img alt="{% trans 'preview media'%}" title="{% trans 'preview media'%}" src="{{LDT_MEDIA_PREFIX}}/img/control_play.gif" href="{% url ldt.ldt_utils.views.index content.iri_id %}" class="ldt_link"/></div></td>
+ <td class="contenttitle"><a class="contenttitlelink" href="{% url ldt.ldt_utils.views.write_content iri_id=content.iri_id %}">{{ content.title|default:"_" }}</a></td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+</div>
+</div>
+<div class="projectscontentsfooter span-12 last">
++ <a class='content_link_create' href="{% url ldt.ldt_utils.views.write_content %}">{% trans "Create content" %}</a>
+</div>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_links.html Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,9 @@
+{% spaceless %}
+<div id="{{ player_id }}_link_list">
+ <ul>
+ {% for annotation in annotations %}
+ <li><span class="title">{% firstof annotation.title annotation.desc %}</span>: <span class="uri">{% if annotation.uri %}<a href="{{annotation.uri}}">{{annotation.uri}}</a>{% endif %}</span></li>
+ {% endfor %}
+ </ul>
+</div>
+{% endspaceless %}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,27 @@
+{% spaceless %}
+{% load i18n %}
+<div>
+<div style="height: 80px"> </div>
+<div id="{{ player_id }}_embed" class="iri_player_embed">
+</div>
+<script type="text/javascript">
+ var config = {
+ metadata:{
+ format:'cinelab',
+ src:'{{ json_url }}',
+ load:'jsonp'},
+ gui:{
+ width:650,
+ height:1,
+ mode:'radio',
+ container:'{{ player_id }}_embed',
+ debug:false,
+ css:'{{WEB_URL}}{{LDT_MEDIA_PREFIX}}css/LdtPlayer.css'},
+ player:{
+ type:'jwplayer',
+ src:'{{WEB_URL}}{{LDT_MEDIA_PREFIX}}swf/player.swf'}
+ };
+ __IriSP.init(config);
+</script>
+</div>
+{% endspaceless %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_seo_body.html Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,9 @@
+{% spaceless %}
+<div id="{{ player_id }}_seo_body" style="display: none">
+ <ul>
+ {% for annotation in annotations %}
+ <li><span class="title">{{annotation.title}}</span><span class="desc">{{annotation.desc}}</span><span class="tags">{{annotation.tags|join:','}}</span><span class="uri">{% if annotation.uri %}<a href="{{annotation.uri}}">{{annotation.uri}}</a>{% endif %}</span></li>
+ {% endfor %}
+ </ul>
+</div>
+{% endspaceless %}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_seo_meta.html Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,3 @@
+{% spaceless %}
+<link rel="meta" href="{% url ldt.ldt_utils.views.project_annotations_rdf ldt_id=ldt_id %}"/>
+{% endspaceless %}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,37 @@
+{% load i18n %}
+<div class="projectscontentsheader span-12 last" id="projectsheader">
+{% trans "name" %}
+</div>
+<div class="span-12 last projectscontentstablewrapperdiv">
+<div class="span-12 last projectscontentstablediv" id="projectstablediv">
+<table class="projectscontentstable">
+ <tbody class="projectscontentsbody">
+{% for project in projects %}
+ <tr class="imageline {% cycle 'projectscontentsoddline' 'projectscontentsevenline'%}" >
+ {% url ldt.ldt_utils.views.project_json_id project.ldt_id as json_url_id %}
+ <td class="cellimg"><div class="cellimgdiv"><img src="{{LDT_MEDIA_PREFIX}}img/document_edit.gif" href="{% url ldt.ldt_utils.views.indexProject project.ldt_id %}" class="ldt_link" alt="{% trans 'open ldt' %}" title="{% trans 'open ldt' %}"/></div></td>
+ <td class="cellimg"><div class="cellimgdiv"><img src="{{LDT_MEDIA_PREFIX}}img/documents_duplicate.gif" href="{% url ldt.ldt_utils.views.copy_project project.ldt_id %}" class="ldt_link_create" alt="{% trans 'copy project' %}" title="{% trans 'copy project' %}"/></div></td>
+ <td class="cellimg"><div class="cellimgdiv"><img src="{{LDT_MEDIA_PREFIX}}img/plugin.gif" 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">
+ {% ifequal project.state 2 %}
+ <img src="{{BASE_URL}}static/admin/img/admin/icon-yes.gif" alt="{% trans 'Project published, click to unpublish' %}" title="{% trans 'Project published, click to unpublish' %}" class="publishedproject" id="project_{{project.ldt_id}}" />
+ {% else %}
+ <img src="{{BASE_URL}}static/admin/img/admin/icon-no.gif" alt="{% trans 'Project not published, click to publish' %}" title="{% trans 'Project not published, click to publish' %}" class="unpublishedproject" id="project_{{project.ldt_id}}" />
+ {% endifequal %}
+ </td>
+ <td class="projecttitle">
+ {% ifequal project.state 2 %}
+ {{ project.title }}
+ {% else %}
+ <a class="projecttitlelink" href="{% url ldt.ldt_utils.views.update_project ldt_id=project.ldt_id %}">{{ project.title }}</a>
+ {% endifequal %}
+ </td>
+ </tr>
+{% endfor %}
+ </tbody>
+</table>
+</div>
+</div>
+<div class="projectscontentsfooter span-12 last">
++ <a class='ldt_link_create' href="{% url ldt.ldt_utils.views.create_ldt_view %}" >{% trans "Create project" %}</a>
+</div>
--- a/web/ldt/ldt_utils/templates/ldt/ldt_utils/projectslist.html Thu Oct 14 12:17:31 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-{% load i18n %}
-<div class="projectscontentsheader span-12 last" id="projectsheader">
-{% trans "name" %}
-</div>
-<div class="span-12 last projectscontentstablewrapperdiv">
-<div class="span-12 last projectscontentstablediv" id="projectstablediv">
-<table class="projectscontentstable">
- <tbody class="projectscontentsbody">
-{% for project in projects %}
- <tr class="imageline {% cycle 'projectscontentsoddline' 'projectscontentsevenline'%}" >
- {% url ldt.ldt_utils.views.project_json_id project.ldt_id as json_url_id %}
- <td class="cellimg"><div class="cellimgdiv">
- {% ifequal project.state 2 %}
- <img src="{{BASE_URL}}static/admin/img/admin/icon-yes.gif" alt="{% trans 'Project published, click to unpublish' %}" title="{% trans 'Project published, click to unpublish' %}" class="publishedproject" id="project_{{project.ldt_id}}" />
- {% else %}
- <img src="{{BASE_URL}}static/admin/img/admin/icon-no.gif" alt="{% trans 'Project not published, click to publish' %}" title="{% trans 'Project not published, click to publish' %}" class="unpublishedproject" id="project_{{project.ldt_id}}" />
- {% endifequal %}
- </div>
- </td>
- <td class="cellimg"><div class="cellimgdiv"><img src="{{LDT_MEDIA_PREFIX}}/img/document_edit.gif" href="{% url ldt.ldt_utils.views.indexProject project.ldt_id %}" class="ldt_link" alt="{% trans 'open ldt' %}" title="{% trans 'open ldt' %}"/></div></td>
- <td class="cellimg"><div class="cellimgdiv"><img src="{{LDT_MEDIA_PREFIX}}/img/documents_duplicate.gif" href="{% url ldt.ldt_utils.views.copy_project project.ldt_id %}" class="ldt_link_create" alt="{% trans 'copy project' %}" title="{% trans 'copy project' %}"/></div></td>
- <td class="cellimg"><div class="cellimgdiv"><img src="{{LDT_MEDIA_PREFIX}}/img/plugin.gif" 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="projecttitle">{{ project.title }}</td>
- </tr>
-{% endfor %}
- </tbody>
-</table>
-</div>
-</div>
-<div class="projectscontentsfooter span-12 last">
-+ <a class='ldt_link_create' href="{% url ldt.ldt_utils.views.create_ldt_view %}" >{% trans "Create project" %}</a>
-</div>
--- a/web/ldt/ldt_utils/templates/ldt/ldt_utils/search_form.html Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/search_form.html Fri Oct 15 12:36:43 2010 +0200
@@ -1,4 +1,4 @@
-{% extends "base.html" %} {% block content %}
+{% extends "ldt/base.html" %} {% block content %}
<form method="post"
action="{{WEB_URL}}{% url ldt.ldt_utils.views.searchIndex %}"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/workspace.html Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,1 @@
+{% extends "ldt/ldt_utils/workspace_base.html" %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/workspace_base.html Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,73 @@
+{% extends "ldt/ldt_base.html" %}
+{% load i18n %}
+
+{% block js_import %}
+{{block.super}}
+ <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}/js/projectscontents.js" ></script>
+{% endblock %}
+
+
+{% block js_declaration %}
+{{block.super}}
+<script type="text/javascript">
+
+var content_filter_url = "{% url ldt.ldt_utils.views.contentsfilter filter='__FILTER__' %}";
+var project_filter_url = "{% url ldt.ldt_utils.views.projectsfilter filter='__FILTER__' is_owner='false' status='0' %}";
+var publish_project_url = "{% url ldt.ldt_utils.views.publish '__PROJECT_ID__' 'false' %}";
+var unpublish_project_url = "{% url ldt.ldt_utils.views.unpublish '__PROJECT_ID__' 'false' %}";
+
+
+function init_events(base_node) {
+
+ init_events_all(base_node, "{% url ldt.ldt_utils.views.popup_embed %}", content_filter_url, project_filter_url, publish_project_url, unpublish_project_url);
+
+}
+
+$(document).ready(function(){
+
+ input_list_init = [
+ {'input_selector':"#searchcontentsinput", 'container_selector':"#contentslistcontainer", 'url':content_filter_url},
+ {'input_selector':"#searchprojectsinput", 'container_selector':"#projectslistcontainer", 'url':project_filter_url}
+ ];
+
+ searchFieldInit(input_list_init);
+
+ init_events(document);
+
+
+});
+</script>
+
+{% endblock %}
+
+{% block css_import %}
+{{block.super}}
+ <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}/css/workspace.css" type="text/css"/>
+{% endblock %}
+
+{% block content %}
+<div class="span-24 last" id="allcontentsdiv">
+ <div class="span-12" id="contentsdiv">
+ <div class="span-12 last titlediv" >
+ <div class="span-8 projectscontentstitle">{% trans "content list" %}</div>
+ <div class="span-4 last searchfielddiv" >
+ <div class="searchfield rounded"><input id="searchcontentsinput" class="searchfieldinput searchfieldinputbase" value="{% trans 'search' %}" type="text" /><img id="contentsajaxloader" class="searchajaxloader" src="{{LDT_MEDIA_PREFIX}}/img/ajax-loader-16x16.gif" alt="loader"/><img id="contentsclear" class="searchclear" src="{{LDT_MEDIA_PREFIX}}img/clear-left.png"/></div>
+ </div>
+ </div>
+ <div class="span-12 last projectscontentsdiv" id="contentslistcontainer">
+ {% include "ldt/ldt_utils/partial/contentslist.html" %}
+ </div>
+ </div>
+ <div class="span-12 last" id="projectsdiv">
+ <div class="span-12 last titlediv" >
+ <div class="span-8 projectscontentstitle" >{% trans "project list" %}</div>
+ <div class="span-4 last searchfielddiv" >
+ <div class="searchfield rounded"><input id="searchprojectsinput" class="searchfieldinput searchfieldinputbase" value="{% trans 'search' %}" type="text" /><img id="projectsajaxloader" class="searchajaxloader" src="{{LDT_MEDIA_PREFIX}}/img/ajax-loader-16x16.gif" alt="loader"/><img id="projecsclear" class="searchclear" src="{{LDT_MEDIA_PREFIX}}img/clear-left.png"/></div>
+ </div>
+ </div>
+ <div class="span-12 last projectscontentsdiv" id="projectslistcontainer">
+ {% include "ldt/ldt_utils/partial/projectslist.html" %}
+ </div>
+ </div>
+</div>
+{% endblock %}
--- a/web/ldt/ldt_utils/templates/ldt/workspace.html Thu Oct 14 12:17:31 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-{% extends "ldt_base.html" %}
-{% load i18n %}
-
-{% block js_import %}
-{{block.super}}
- <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}/js/projectscontents.js" ></script>
-{% endblock %}
-
-
-{% block js_declaration %}
-{{block.super}}
-<script type="text/javascript">
-
-var content_filter_url = "{% url ldt.ldt_utils.views.contentsfilter filter='__FILTER__' %}";
-var project_filter_url = "{% url ldt.ldt_utils.views.projectsfilter filter='__FILTER__' is_owner='false' status='0' %}";
-var publish_project_url = "{% url ldt.ldt_utils.views.publish '__PROJECT_ID__' 'false' %}";
-var unpublish_project_url = "{% url ldt.ldt_utils.views.unpublish '__PROJECT_ID__' 'false' %}";
-
-
-function init_events(base_node) {
-
- init_events_all(base_node, "{% url ldt.ldt_utils.views.popup_embed %}", content_filter_url, project_filter_url, publish_project_url, unpublish_project_url);
-
-}
-
-$(document).ready(function(){
-
- input_list_init = [
- {'input_selector':"#searchcontentsinput", 'container_selector':"#contentslistcontainer", 'url':content_filter_url},
- {'input_selector':"#searchprojectsinput", 'container_selector':"#projectslistcontainer", 'url':project_filter_url}
- ];
-
- searchFieldInit(input_list_init);
-
- init_events(document);
-
-
-});
-</script>
-
-{% endblock %}
-
-{% block css_import %}
-{{block.super}}
- <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}/css/workspace.css" type="text/css"/>
-{% endblock %}
-
-{% block content %}
-<div class="span-24 last" id="allcontentsdiv">
- <div class="span-12" id="contentsdiv">
- <div class="span-12 last titlediv" >
- <div class="span-8 projectscontentstitle">{% trans "content list" %}</div>
- <div class="span-4 last searchfielddiv" >
- <div class="searchfield rounded"><input id="searchcontentsinput" class="searchfieldinput searchfieldinputbase" value="{% trans 'search' %}" type="text" /><img id="contentsajaxloader" class="searchajaxloader" src="{{LDT_MEDIA_PREFIX}}/img/ajax-loader-16x16.gif" alt="loader"/><img id="contentsclear" class="searchclear" src="{{LDT_MEDIA_PREFIX}}img/clear-left.png"/></div>
- </div>
- </div>
- <div class="span-12 last projectscontentsdiv" id="contentslistcontainer">
- {% include "ldt/ldt_utils/contentslist.html" %}
- </div>
- </div>
- <div class="span-12 last" id="projectsdiv">
- <div class="span-12 last titlediv" >
- <div class="span-8 projectscontentstitle" >{% trans "project list" %}</div>
- <div class="span-4 last searchfielddiv" >
- <div class="searchfield rounded"><input id="searchprojectsinput" class="searchfieldinput searchfieldinputbase" value="{% trans 'search' %}" type="text" /><img id="projectsajaxloader" class="searchajaxloader" src="{{LDT_MEDIA_PREFIX}}/img/ajax-loader-16x16.gif" alt="loader"/><img id="projecsclear" class="searchclear" src="{{LDT_MEDIA_PREFIX}}img/clear-left.png"/></div>
- </div>
- </div>
- <div class="span-12 last projectscontentsdiv" id="projectslistcontainer">
- {% include "ldt/ldt_utils/projectslist.html" %}
- </div>
- </div>
-</div>
-{% endblock %}
--- a/web/ldt/ldt_utils/tests.py Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/ldt_utils/tests.py Fri Oct 15 12:36:43 2010 +0200
@@ -38,142 +38,142 @@
class UtilsTest(unittest.TestCase):
def setUp(self):
- self.user = Owner()
- self.user.username = "toto"
- 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 = "11"
- self.project.ldt_id = str(uuid.uuid1())
- self.project.save()
-
- self.projectcopy = Project(title="the2ndproject")
- self.projectcopy.id="22"
+ self.user = Owner()
+ self.user.username = "toto"
+ 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 = "11"
+ self.project.ldt_id = str(uuid.uuid1())
+ self.project.save()
+
+ self.projectcopy = Project(title="the2ndproject")
+ self.projectcopy.id="22"
def tearDown(self):
- self.project.delete()
- self.projectcopy.delete()
- #self.cont1.delete()
- #self.cont2.delete()
+ self.project.delete()
+ self.projectcopy.delete()
+ #self.cont1.delete()
+ #self.cont2.delete()
def test_generate_ldt(self):
- self.cont1 = Content(iriurl="id1/iriurl1")
- self.cont1.iri_id = "id1"
- self.cont1.save()
-
- self.cont2 = Content(iriurl="id2/iriurl2")
- self.cont2.iri_id = "id2"
- self.cont2.save()
-
- self.project.contents.add(self.cont1,self.cont2)
-
- f=tempfile.TemporaryFile(mode='r+')
- self.LU.generateLdt(Content.objects.all(),f)
- f.seek(0)
- ldoc = lxml.etree.parse(f)
- self.assertEqual(ldoc.xpath("/iri/displays/display/content")[9].get("id"),self.cont2.iri_id)
- self.assertEqual(ldoc.xpath("/iri/medias/media")[8].get("id"), self.cont1.iri_id)
- f.close()
+ self.cont1 = Content(iriurl="id1/iriurl1")
+ self.cont1.iri_id = "id1"
+ self.cont1.save()
+
+ self.cont2 = Content(iriurl="id2/iriurl2")
+ self.cont2.iri_id = "id2"
+ self.cont2.save()
+
+ self.project.contents.add(self.cont1,self.cont2)
+
+ f=tempfile.TemporaryFile(mode='r+')
+ self.LU.generateLdt(Content.objects.all(),f)
+ f.seek(0)
+ ldoc = lxml.etree.parse(f)
+ self.assertEqual(ldoc.xpath("/iri/displays/display/content")[9].get("id"),self.cont2.iri_id)
+ self.assertEqual(ldoc.xpath("/iri/medias/media")[8].get("id"), self.cont1.iri_id)
+ f.close()
def test_generate_init(self):
- self.cont3 = Content(iriurl="id3/iriurl1")
- self.cont3.iri_id = "id3"
- self.cont3.save()
-
- self.cont4 = Content(iriurl="id4/iriurl2")
- self.cont4.iri_id = "id4"
- self.cont4.save()
-
- self.project.contents.add(self.cont3,self.cont4)
- ldoc = self.LU.generateInit(None,None)
- 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/init/file")[0].get("video"), settings.STREAM_URL)
+ self.cont3 = Content(iriurl="id3/iriurl1")
+ self.cont3.iri_id = "id3"
+ self.cont3.save()
+
+ self.cont4 = Content(iriurl="id4/iriurl2")
+ self.cont4.iri_id = "id4"
+ self.cont4.save()
+
+ self.project.contents.add(self.cont3,self.cont4)
+ ldoc = self.LU.generateInit(None,None)
+ 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/init/file")[0].get("video"), settings.STREAM_URL)
def test_create_ldt(self):
- self.cont5 = Content(iriurl="id5/iriurl1")
- self.cont5.iri_id = "id5"
- self.cont5.save()
-
- self.cont6 = Content(iriurl="id6/iriurl2")
- self.cont6.iri_id = "id6"
- self.cont6.save()
-
- self.project.contents.add(self.cont5,self.cont6)
- self.project.ldt=""
- create_ldt(self.project, self.user)
- ldt = lxml.etree.fromstring(self.project.ldt)
- 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")[1].get("id"), self.cont6.iri_id)
+ self.cont5 = Content(iriurl="id5/iriurl1")
+ self.cont5.iri_id = "id5"
+ self.cont5.save()
+
+ self.cont6 = Content(iriurl="id6/iriurl2")
+ self.cont6.iri_id = "id6"
+ self.cont6.save()
+
+ self.project.contents.add(self.cont5,self.cont6)
+ self.project.ldt=""
+ create_ldt(self.project, self.user)
+ ldt = lxml.etree.fromstring(self.project.ldt)
+ 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")[1].get("id"), self.cont6.iri_id)
def test_copy_ldt(self):
- self.cont7 = Content(iriurl="id7/iriurl1")
- self.cont7.iri_id = "id7"
- self.cont7.save()
-
- self.cont8 = Content(iriurl="id8/iriurl2")
- self.cont8.iri_id = "id8"
- self.cont8.save()
-
- self.project.contents.add(self.cont7,self.cont8)
- copy_ldt(self.project, self.projectcopy, self.user)
- ldt1=lxml.etree.fromstring(self.project.ldt)
- ldt2=lxml.etree.fromstring(self.projectcopy.ldt)
- self.assertTrue(ldt1.xpath("/iri/project")[0].get("id")!= ldt2.xpath("/iri/project")[0].get("id"))
- self.assertEqual(ldt1.xpath("/iri/medias/media")[0].get("id"),ldt2.xpath("/iri/medias/media")[0].get("id"))
- self.assertEqual(ldt1.xpath("/iri/annotations/content/ensemble")[0].get("title"),ldt2.xpath("/iri/annotations/content/ensemble")[0].get("title"))
- self.assertEqual(ldt1.xpath("/iri/annotations/content/ensemble/decoupage")[0].get("id"),ldt2.xpath("/iri/annotations/content/ensemble/decoupage")[0].get("id"))
- self.assertEqual(ldt1.xpath("/iri/annotations/content/ensemble/decoupage/title")[1].text,ldt2.xpath("/iri/annotations/content/ensemble/decoupage/title")[1].text.strip("\n\t"))
+ self.cont7 = Content(iriurl="id7/iriurl1")
+ self.cont7.iri_id = "id7"
+ self.cont7.save()
+
+ self.cont8 = Content(iriurl="id8/iriurl2")
+ self.cont8.iri_id = "id8"
+ self.cont8.save()
+
+ self.project.contents.add(self.cont7,self.cont8)
+ copy_ldt(self.project, self.projectcopy, self.user)
+ ldt1=lxml.etree.fromstring(self.project.ldt)
+ ldt2=lxml.etree.fromstring(self.projectcopy.ldt)
+ self.assertTrue(ldt1.xpath("/iri/project")[0].get("id")!= ldt2.xpath("/iri/project")[0].get("id"))
+ self.assertEqual(ldt1.xpath("/iri/medias/media")[0].get("id"),ldt2.xpath("/iri/medias/media")[0].get("id"))
+ self.assertEqual(ldt1.xpath("/iri/annotations/content/ensemble")[0].get("title"),ldt2.xpath("/iri/annotations/content/ensemble")[0].get("title"))
+ self.assertEqual(ldt1.xpath("/iri/annotations/content/ensemble/decoupage")[0].get("id"),ldt2.xpath("/iri/annotations/content/ensemble/decoupage")[0].get("id"))
+ self.assertEqual(ldt1.xpath("/iri/annotations/content/ensemble/decoupage/title")[1].text,ldt2.xpath("/iri/annotations/content/ensemble/decoupage/title")[1].text.strip("\n\t"))
def test_create_empty_iri(self):
- self.cont9 = Content(iriurl="id9/iriurl1")
- self.cont9.iri_id = "id9"
- self.cont9.save()
-
- self.cont10 = Content(iriurl="id10/iriurl2")
- self.cont10.iri_id = "id10"
- self.cont10.save()
-
- self.project.contents.add(self.cont9,self.cont10)
- tmp = tempfile.TemporaryFile(mode='r+')
- create_empty_iri(tmp, self.cont9, "admin")
- tmp.seek(0)
- ldoc = lxml.etree.parse(tmp)
- self.assertEqual(ldoc.xpath("/iri/head/meta")[0].get("content"), self.cont9.iri_id)
- self.assertEqual(ldoc.xpath("/iri/body/medias/media/video")[0].get("id"), self.cont9.iri_id)
- tmp.close()
-
+ self.cont9 = Content(iriurl="id9/iriurl1")
+ self.cont9.iri_id = "id9"
+ self.cont9.save()
+
+ self.cont10 = Content(iriurl="id10/iriurl2")
+ self.cont10.iri_id = "id10"
+ self.cont10.save()
+
+ self.project.contents.add(self.cont9,self.cont10)
+ tmp = tempfile.TemporaryFile(mode='r+')
+ create_empty_iri(tmp, self.cont9, "admin")
+ tmp.seek(0)
+ ldoc = lxml.etree.parse(tmp)
+ self.assertEqual(ldoc.xpath("/iri/head/meta")[0].get("content"), self.cont9.iri_id)
+ self.assertEqual(ldoc.xpath("/iri/body/medias/media/video")[0].get("id"), self.cont9.iri_id)
+ tmp.close()
+
class ViewsTest(unittest.TestCase):
def setUp(self):
- self.project = Project()
- self.project.id = "121"
- self.project.save()
+ self.project = Project()
+ self.project.id = "121"
+ self.project.save()
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.cont1 = Content(iriurl="/laurentcantet_entrelesmurs/iriurl1")
- self.cont1.iri_id = 'laurentcantet_entrelesmurs'
- self.cont1.save()
-
- self.cont2 = Content(iriurl="/content_notinldt/iriurl2")
- self.cont2.iri_id = 'content_notinldt'
- self.cont2.save()
-
- self.project.contents.add(self.cont1, self.cont2)
+
+ self.cont1 = Content(iriurl="/laurentcantet_entrelesmurs/iriurl1")
+ self.cont1.iri_id = 'laurentcantet_entrelesmurs'
+ self.cont1.save()
+
+ self.cont2 = Content(iriurl="/content_notinldt/iriurl2")
+ self.cont2.iri_id = 'content_notinldt'
+ self.cont2.save()
+
+ self.project.contents.add(self.cont1, self.cont2)
def tearDown(self):
- self.project.delete()
- ##self.cont1.delete()
- ##self.cont2.delete()
+ self.project.delete()
+ ##self.cont1.delete()
+ ##self.cont2.delete()
- def test_get_attrib(self):
- get_attrib(self.project)
- ldoc = lxml.etree.fromstring(self.project.ldt)
- self.assertEqual(self.project.title, ldoc.xpath("/iri/project")[0].get("title"))
- self.assertEqual(ldoc.xpath("/iri/medias/media")[0].get('id'), self.cont1.iri_id)
- self.assertTrue(self.cont2.iri_id not in self.project.contents.all())
+# def test_get_attrib(self):
+# get_attrib(self.project)
+# ldoc = lxml.etree.fromstring(self.project.ldt)
+# self.assertEqual(self.project.title, ldoc.xpath("/iri/project")[0].get("title"))
+# self.assertEqual(ldoc.xpath("/iri/medias/media")[0].get('id'), self.cont1.iri_id)
+# self.assertTrue(self.cont2.iri_id not in self.project.contents.all())
--- a/web/ldt/ldt_utils/urls.py Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/ldt_utils/urls.py Fri Oct 15 12:36:43 2010 +0200
@@ -18,11 +18,13 @@
url(r'^search/loading/$', 'views.loading'),
url(r'^create/(?P<iri_id>.*)$', 'views.create_project'),
url(r'^copy/(?P<ldt_id>.*)$', 'views.copy_project'),
+ url(r'^update/(?P<ldt_id>.*)$', 'views.update_project'),
url(r'^cljson/id/(?P<id>.*)$', 'views.project_json_id'),
url(r'^cljson/externalid/(?P<id>.*)$', 'views.project_json_externalid'),
- url(r'^filterprojects/(?P<filter>\w*)/(?P<is_owner>true|false)/(?P<status>\d)$', "views.projectsfilter", ),
+ url(r'^rdf/id/(?P<ldt_id>.*)$', 'views.project_annotations_rdf'),
url(r'^/?$', "views.workspace", name="root-view"),
- url(r'^filtercontents/(?P<filter>\w*)/$', "views.contentsfilter", ),
+ url(r'^filterprojects/_(?P<filter>[\w\%\_\-\+]*?)/(?P<is_owner>true|false)/(?P<status>\d)$', "views.projectsfilter", ),
+ url(r'^filtercontents/_(?P<filter>[\w\%\_\-\+]*?)/$', "views.contentsfilter", ),
(r'^embedpopup/?$', "views.popup_embed"),
)
--- a/web/ldt/ldt_utils/utils.py Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/ldt_utils/utils.py Fri Oct 15 12:36:43 2010 +0200
@@ -36,7 +36,7 @@
queryParser.setDefaultOperator(lucene.QueryParser.Operator.AND)
queryObj = queryParser.parse(query)
hits = indexSearcher.search(queryObj, settings.LDT_MAX_SEARCH_NUMBER)
-
+
res = []
for hit in hits.scoreDocs:
doc = indexSearcher.doc(hit.doc)
@@ -44,146 +44,146 @@
indexSearcher.close()
return res
- def queryAll(self, query):
+ def queryAll(self, query):
return self.query("all", query)
class LdtUtils(object):
def generateLdt(self, contentList, file, title = u"", author=u"IRI Web", web_url=u"", media_url="", startSegment = None, contributions=None):
- iri = lxml.etree.Element(u'iri')
- doc = lxml.etree.ElementTree(iri)
-
- project = lxml.etree.SubElement(iri, u'project')
- project.set(u"id",unicode(str(uuid.uuid1())))
+ iri = lxml.etree.Element(u'iri')
+ doc = lxml.etree.ElementTree(iri)
+
+ project = lxml.etree.SubElement(iri, u'project')
+ project.set(u"id",unicode(str(uuid.uuid1())))
project.set(u"title",unicode(title))
- project.set(u"user",author)
- project.set(u"abstract",u"")
-
- medias = lxml.etree.SubElement(iri, u"medias")
- for content in contentList:
- videopath = unicode(settings.STREAM_URL)
- if content.videopath :
- 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"video",videopath)
+ project.set(u"user",author)
+ project.set(u"abstract",u"")
+
+ medias = lxml.etree.SubElement(iri, u"medias")
+ for content in contentList:
+ videopath = unicode(settings.STREAM_URL)
+ if content.videopath :
+ 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"video",videopath)
media.set(u"pict",u"")
media.set(u"extra",u"")
-
- if contributions is None:
- contributions = []
- annotations_nodes = {}
- for contrib in contributions:
- ldtdoc = lxml.etree.fromstring(contrib.ldtproject.ldt.encode("utf-8"))
- res = ldtdoc.xpath("/iri/annotations/content")
-
- for content in res:
- contentid = content.get("id")
- if annotations_nodes.has_key(contentid):
- contentnode = annotations_nodes[contentid]
- else:
- contentnode = {"id":contentid, "ensembles":[]}
- annotations_nodes[contentid]=contentnode
- for ens in content.childNodes:
- if ens.tag.endswith("ensemble"):
- contentnode["ensembles"].append(ens.tag)
-
-
- if len(annotations_nodes) > 0:
- annotations = lxml.etree.SubElement(iri, "annotations")
+
+ if contributions is None:
+ contributions = []
+ annotations_nodes = {}
+ for contrib in contributions:
+ ldtdoc = lxml.etree.fromstring(contrib.ldtproject.ldt.encode("utf-8"))
+ res = ldtdoc.xpath("/iri/annotations/content")
+
+ for content in res:
+ contentid = content.get("id")
+ if annotations_nodes.has_key(contentid):
+ contentnode = annotations_nodes[contentid]
+ else:
+ contentnode = {"id":contentid, "ensembles":[]}
+ annotations_nodes[contentid]=contentnode
+ for ens in content.childNodes:
+ if ens.tag.endswith("ensemble"):
+ contentnode["ensembles"].append(ens.tag)
+
+
+ if len(annotations_nodes) > 0:
+ annotations = lxml.etree.SubElement(iri, "annotations")
+ for content in contentList:
+ if content.content_base.iri_id in annotations_nodes:
+ contentnode = annotations_nodes[content.content_base.iri_id]
+ if contentnode is not None:
+ if len(contentnode["ensembles"])>0:
+ content = lxml.etree.SubElement(annotation, "content")
+ content.set("id",contentnode["id"])
+ content.text = u""
+ else:
+ content = lxml.etree.SubElement(annotation, "content")
+ content.set("id",contentnode["id"])
+
+ else:
+ annotations = lxml.etree.SubElement(iri, "annotations")
+
+
+ displays = lxml.etree.SubElement(iri, "displays")
+ if len(contentList) > 0:
+ display = lxml.etree.SubElement(displays, "display")
+ display.set(u"id",u"0")
+ display.set(u"title",u"generated")
+ display.set(u"idsel",contentList[0].iri_id)
+ display.set(u"tc",u"0")
for content in contentList:
- if content.content_base.iri_id in annotations_nodes:
- contentnode = annotations_nodes[content.content_base.iri_id]
- if contentnode is not None:
- if len(contentnode["ensembles"])>0:
- content = lxml.etree.SubElement(annotation, "content")
- content.set("id",contentnode["id"])
- content.text = u""
- else:
- content = lxml.etree.SubElement(annotation, "content")
- content.set("id",contentnode["id"])
-
- else:
- annotations = lxml.etree.SubElement(iri, "annotations")
-
-
- displays = lxml.etree.SubElement(iri, "displays")
- if len(contentList) > 0:
- display = lxml.etree.SubElement(displays, "display")
- display.set(u"id",u"0")
- display.set(u"title",u"generated")
- display.set(u"idsel",contentList[0].iri_id)
- display.set(u"tc",u"0")
- for content in contentList:
- contentd = lxml.etree.SubElement(display,"content")
- contentd.set(u"id",content.iri_id)
+ contentd = lxml.etree.SubElement(display,"content")
+ contentd.set(u"id",content.iri_id)
filepath = urllib.urlopen(content.iri_url())
-
- udoc = lxml.etree.parse(filepath)
- res = udoc.xpath("/iri/body/ensembles/ensemble/decoupage")
+
+ udoc = lxml.etree.parse(filepath)
+ res = udoc.xpath("/iri/body/ensembles/ensemble/decoupage")
for decoupagenode in res:
- decoupage_id = decoupagenode.getAttribute(u"id")
- ensemble_id = decoupagenode.parentNode.getAttribute(u"id")
- decoupage_id = decoupagenode.get(u"id")
- ensemble_id = decoupagenode.getparent().get(u"id")
- decoupage = lxml.etree.SubElement(content,"decoupage")
- decoupage.set(u"id",decoupage_id)
- decoupage.set(u"idens",ensemble_id)
+ decoupage_id = decoupagenode.get(u"id")
+ ensemble_id = decoupagenode.getparent().get(u"id")
+ decoupage_id = decoupagenode.get(u"id")
+ ensemble_id = decoupagenode.getparent().get(u"id")
+ decoupage = lxml.etree.SubElement(contentd,"decoupage")
+ decoupage.set(u"id",decoupage_id)
+ decoupage.set(u"idens",ensemble_id)
if startSegment is not None:
- activeSegment = lxml.etree.SubElement(display,"activeSegment")
- idas = lxml.etree.SubElement(activeSegment,"id")
- idas.set(u"idctt",startSegment["idcontent"])
+ activeSegment = lxml.etree.SubElement(display,"activeSegment")
+ idas = lxml.etree.SubElement(activeSegment,"id")
+ idas.set(u"idctt",startSegment["idcontent"])
idas.set(u"idens" ,startSegment["idgroup"])
idas.set(u"idcut",startSegment["idcutting"])
idas.set(u"idseg",startSegment["idsegment"])
-
- edits = lxml.etree.SubElement(iri, "edits")
-
- doc.write(file, pretty_print=True)
+
+ edits = lxml.etree.SubElement(iri, "edits")
+
+ doc.write(file, pretty_print=True)
def generateInit(self, url, method, search=None):
-
- iri = lxml.etree.Element('iri')
- impl = lxml.etree.ElementTree(iri)
+
+ iri = lxml.etree.Element('iri')
+ impl = lxml.etree.ElementTree(iri)
- elementFiles = lxml.etree.SubElement(iri,'files')
- elementInit = lxml.etree.SubElement(elementFiles, 'init')
- elementfile = lxml.etree.SubElement(elementInit, 'file')
+ elementFiles = lxml.etree.SubElement(iri,'files')
+ elementInit = lxml.etree.SubElement(elementFiles, 'init')
+ elementfile = lxml.etree.SubElement(elementInit, 'file')
- elementfile.set('src',settings.WEB_URL + django.core.urlresolvers.reverse(method, args=url))
- elementfile.set('display', '1')
- if(search):
- elementfile.set("segsel",settings.WEB_URL + django.core.urlresolvers.reverse(search, args=url))
+ elementfile.set('src',settings.WEB_URL + django.core.urlresolvers.reverse(method, args=url))
+ elementfile.set('display', '1')
+ if(search):
+ elementfile.set("segsel",settings.WEB_URL + django.core.urlresolvers.reverse(search, args=url))
# /*chemin video : tant que le serveur de media n'est pas up, */
- elementfile.set('video', settings.STREAM_URL)
- elementfile.set('pict', "")
- elementfile.set('extra', "")
+ elementfile.set('video', settings.STREAM_URL)
+ elementfile.set('pict', "")
+ elementfile.set('extra', "")
- elementRecent = lxml.etree.SubElement(elementFiles, 'recent')
- elementLibrary = lxml.etree.SubElement(elementFiles, 'library')
+ elementRecent = lxml.etree.SubElement(elementFiles, 'recent')
+ elementLibrary = lxml.etree.SubElement(elementFiles, 'library')
username = ''
id = ''
- elementUser = lxml.etree.SubElement(iri, 'user')
- elementUser.set('name', username)
- elementUser.set('id', id)
+ elementUser = lxml.etree.SubElement(iri, 'user')
+ elementUser.set('name', username)
+ elementUser.set('id', id)
return iri
def create_ldt(project, user):
+ """create xml"""
+
contentList = project.contents.all()
- """create xml"""
-
# create a dom
iri = lxml.etree.Element('iri')
doc = lxml.etree.ElementTree(iri)
@@ -203,16 +203,16 @@
for content in contentList:
if not idsel:
idsel = content.iri_id
- elementMedia = lxml.etree.SubElement(elementMedias, 'media')
- elementMedia.set('id', content.iri_id)
- elementMedia.set('src', content.iri_url())
+ elementMedia = lxml.etree.SubElement(elementMedias, 'media')
+ elementMedia.set('id', content.iri_id)
+ elementMedia.set('src', content.iri_url())
if content.videopath and content.videopath !="":
- elementMedia.set('video', content.videopath)
+ elementMedia.set('video', content.videopath)
else:
- elementMedia.set('video', settings.STREAM_URL)
- elementMedia.set('pict', "")
- elementMedia.set('extra', "")
+ elementMedia.set('video', settings.STREAM_URL)
+ elementMedia.set('pict', "")
+ elementMedia.set('extra', "")
if not idsel:
idsel = ""
@@ -234,8 +234,8 @@
#node content
for content in contentList:
- elementContent = lxml.etree.SubElement(elementDisplay, 'content')
- elementContent.set('id', content.iri_id)
+ elementContent = lxml.etree.SubElement(elementDisplay, 'content')
+ elementContent.set('id', content.iri_id)
if not 'http' in content.iriurl:
#eg: "iiiielizabethrosse/ENMI08-III_elizabethrosse.iri"
@@ -243,18 +243,17 @@
else:
url =content.iriurl
file = urllib.urlopen(url)
- doc = lxml.etree.parse(file)
- res = doc.xpath("/iri/body/ensembles/ensemble/decoupage")
+ doc = lxml.etree.parse(file)
+ res = doc.xpath("/iri/body/ensembles/ensemble/decoupage")
-
- #node decoupage
+ #node decoupage
for decoupagenode in res:
- decoupage_id = decoupagenode.attrib(u"id")
- parent= decoupagenode.getparent()
- ensemble_id = parent.attrib(u"id")
- elementDecoupage = etree.SubElement(elementContent, 'decoupage')
- elementDecoupage.set('idens', ensemble_id)
- elementDecoupage.set('id', decoupage_id)
+ decoupage_id = decoupagenode.get(u"id")
+ parent= decoupagenode.getparent()
+ ensemble_id = parent.get(u"id")
+ elementDecoupage = lxml.etree.SubElement(elementContent, 'decoupage')
+ elementDecoupage.set('idens', ensemble_id)
+ elementDecoupage.set('id', decoupage_id)
#node edits
elementEdits = lxml.etree.SubElement(iri, 'edits')
@@ -280,10 +279,10 @@
ldt = lxml.etree.fromstring(project.ldt.encode("utf-8"))
res = ldt.xpath("/iri/project")
for elementProject in res:
- elementProject.set('abstract', "")
- elementProject.set('title', new_project.title)
- elementProject.set('user', user.username)
- elementProject.set('id', new_project.ldt_id)
+ elementProject.set('abstract', "")
+ elementProject.set('title', new_project.title)
+ elementProject.set('user', user.username)
+ elementProject.set('id', new_project.ldt_id)
new_project.ldt = lxml.etree.tostring(ldt, pretty_print=True)
--- a/web/ldt/ldt_utils/views.py Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/ldt_utils/views.py Fri Oct 15 12:36:43 2010 +0200
@@ -1,32 +1,45 @@
-import django.core.urlresolvers
-from django.http import HttpResponse, HttpResponseRedirect
-from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
+from contentindexer import *
+from django.conf import settings
+from django.contrib.auth.decorators import login_required
+from django.core import serializers
+from django.core.urlresolvers import reverse
+from django.db.models import Q
+from django.forms.util import ErrorList
+from django.http import HttpResponse, HttpResponseRedirect, \
+ HttpResponseForbidden, HttpResponseServerError
+from django.shortcuts import render_to_response, get_object_or_404, \
+ get_list_or_404
from django.template import RequestContext
-from django.core.urlresolvers import reverse
-from django.contrib.auth.decorators import login_required
-from django.conf import settings
-from django.core import serializers
+from django.template.loader import render_to_string
from django.utils import simplejson
from django.utils.html import escape
+from django.utils.translation import ugettext as _, ungettext
from fileimport import *
-from forms import LdtImportForm, LdtAddForm, SearchForm, AddProjectForm, CopyProjectForm, ContentForm, MediaForm
+from forms import LdtImportForm, LdtAddForm, SearchForm, AddProjectForm, \
+ CopyProjectForm, ContentForm, MediaForm
from ldt.core.models import Owner
+from ldt.ldt_utils.models import Content, Project, Owner
+from ldt.ldt_utils.projectserializer import ProjectSerializer
+from ldt.ldt_utils.utils import boolean_convert
+from lxml import etree
+from lxml.html import fromstring, fragment_fromstring
from models import *
-from utils import *
-from contentindexer import *
from projectserializer import *
from string import Template
+from urllib2 import urlparse
+from utils import *
+import StringIO
+import base64
import cgi
-import uuid
-import base64
+import django.core.urlresolvers
+import ldt.auth as ldt_auth
+import ldt.utils.path as ldt_utils_path
+import logging
import lucene
+import lxml.etree
import tempfile
import urllib2
-from urllib2 import urlparse
-from jogging import logging
-import lxml.etree
-from django.db.models import Q
-from django.template.loader import render_to_string
+import uuid
@login_required
@@ -39,24 +52,36 @@
project_list = Project.objects.all()
# render list
- return render_to_response("ldt/workspace.html",
+ return render_to_response("ldt/ldt_utils/workspace.html",
{'contents': content_list, 'projects': project_list},
context_instance=RequestContext(request))
+
def popup_embed(request):
json_url = request.GET.get("json_url")
player_id = request.GET.get("player_id")
+ ldt_id = request.GET.get("ldt_id")
- embed_rendered = escape(render_to_string('ldt/ldt_utils/embed.html', {'json_url':json_url,'player_id':player_id}, context_instance=RequestContext(request)))
+ project = Project.objects.get(ldt_id=ldt_id);
+ if not ldt_auth.checkAccess(request.user, project):
+ return HttpResponseForbidden(_("You can not access this project"))
+
+ ps = ProjectSerializer(project, from_contents=False, from_display=True)
+ annotations = ps.getAnnotations(first_cutting=True)
- return render_to_response("ldt/embed_popup.html",
- {'json_url':json_url,'player_id':player_id, 'player_embed_rendered':embed_rendered},
+ embed_rendered = dict((typestr,
+ (lambda s:escape(lxml.etree.tostring(fragment_fromstring(render_to_string("ldt/ldt_utils/partial/embed_%s.html"%(s), {'json_url':json_url,'player_id':player_id, 'annotations':annotations, 'ldt_id': ldt_id}, context_instance=RequestContext(request))),pretty_print=True)))(typestr))
+ for typestr in ('player','seo_body', 'seo_meta', 'links') )
+
+ return render_to_response("ldt/ldt_utils/embed_popup.html",
+ {'json_url':json_url,'player_id':player_id, 'embed_rendered':embed_rendered, 'annotations':annotations},
context_instance=RequestContext(request))
+
@login_required
def projectsfilter(request, filter, is_owner=False, status=0):
@@ -76,34 +101,39 @@
if status > 0:
query &= Q(state=status)
- if filter and filter != "_":
+ if filter:
+ if len(filter) > 0 and filter[0] == '_':
+ filter = filter[1:]
query &= Q(title__icontains=filter)
project_list = Project.objects.filter(query)
- return render_to_response("ldt/ldt_utils/projectslist.html",
+ return render_to_response("ldt/ldt_utils/partial/projectslist.html",
{'projects': project_list},
context_instance=RequestContext(request))
+
+
+
+
@login_required
def contentsfilter(request, filter):
- if filter == "_":
- filter = ""
+ if filter and len(filter) > 0 and filter[0] == '_':
+ filter = filter[1:]
+
if filter:
content_list = Content.objects.filter(title__icontains=filter)
else:
content_list = Content.objects.all()
- return render_to_response("ldt/ldt_utils/contentslist.html",
+ return render_to_response("ldt/ldt_utils/partial/contentslist.html",
{'contents': content_list},
context_instance=RequestContext(request))
-
-
def searchForm(request):
form = SearchForm()
- return render_to_response('ldt/ldt_utils_utils/search_form.html',{'form': form} , context_instance=RequestContext(request))
+ return render_to_response('ldt/ldt_utils/search_form.html',{'form': form} , context_instance=RequestContext(request))
def searchIndex(request):
@@ -126,7 +156,7 @@
language_code = request.LANGUAGE_CODE[:2]
url = settings.WEB_URL + django.core.urlresolvers.reverse("ldt.ldt_utils.views.searchInit", args=[field, query])
- return render_to_response('irisuser/ldt/init_ldt.html', {'LDT_MEDIA_PREFIX': settings.LDT_MEDIA_PREFIX, 'colorurl': settings.LDT_MEDIA_PREFIX+'swf/ldt/pkg/color.xml', 'i18nurl': settings.LDT_MEDIA_PREFIX+'swf/ldt/pkg/i18n', 'language': language_code, 'baseurl': settings.LDT_MEDIA_PREFIX+'swf/ldt/', 'url': url}, context_instance=RequestContext(request))
+ return render_to_response('ldt/ldt_utils/init_ldt.html', {'LDT_MEDIA_PREFIX': settings.LDT_MEDIA_PREFIX, 'colorurl': settings.LDT_MEDIA_PREFIX+'swf/ldt/pkg/color.xml', 'i18nurl': settings.LDT_MEDIA_PREFIX+'swf/ldt/pkg/i18n', 'language': language_code, 'baseurl': settings.LDT_MEDIA_PREFIX+'swf/ldt/', 'url': url}, context_instance=RequestContext(request))
def searchInit(request, field, query):
@@ -230,11 +260,15 @@
if form.is_valid():
user = request.user
Project.create_project(title=form.cleaned_data['title'], user=user, contents=form.cleaned_data['contents'])
- return HttpResponseRedirect(reverse("ldt.ldt_utils.views.list_ldt"))
+ form_status = "saved"
+ contents=[]
+ #return HttpResponseRedirect(reverse("ldt.ldt_utils.views.list_ldt"))
else:
form = LdtAddForm()
- contents = Content.objects.all()
- return render_to_response('ldt/ldt_utils/create_ldt.html', {'contents': contents, 'form': form,'create_project_action':reverse(create_ldt_view)}, context_instance=RequestContext(request))
+ contents = Content.objects.all()
+ form_status = "none"
+
+ return render_to_response('ldt/ldt_utils/create_ldt.html', {'contents': contents, 'form': form, 'form_status':form_status,'create_project_action':reverse(create_ldt_view)}, context_instance=RequestContext(request))
def created_ldt(request):
return render_to_response('ldt/ldt_utils/save_done.html', context_instance=RequestContext(request))
@@ -261,7 +295,8 @@
resp = HttpResponse(mimetype="text/xml")
resp['Cache-Control']='no-cache, must-revalidate'
resp['Pragma']='no-cache'
- doc.write(resp, pretty_print=True)
+
+ resp.write( etree.tostring(doc, pretty_print=True, xml_declaration=True, encoding="utf-8"))
return resp
def ldtProject(request, id):
@@ -278,19 +313,22 @@
project = get_object_or_404(Project,ldt_id=id)
- return project_json(request, project)
+ return project_json(request, project, False)
def project_json_externalid(request, id):
res_proj = get_list_or_404(Project.objects.order_by('-modification_date'),contents__external_id = id)
- return project_json(request, res_proj[0])
+ return project_json(request, res_proj[0], False)
-def project_json(request, project):
-
+def project_json(request, project, serialize_contents = True):
+
+ if not ldt_auth.checkAccess(request.user, project):
+ return HttpResponseForbidden(_("You can not access this project"))
+
mimetype = request.REQUEST.get("mimetype")
if mimetype is None:
mimetype = "application/json; charset=utf-8"
@@ -315,7 +353,7 @@
escape_bool = {'true': True, 'false': False, "0": False, "1": True}.get(escape_str.lower())
- ps = ProjectSerializer(project)
+ ps = ProjectSerializer(project, serialize_contents)
project_dict = ps.serialize_to_cinelab()
json_str = simplejson.dumps(project_dict, ensure_ascii=False, indent=indent)
@@ -330,49 +368,96 @@
return resp
+def project_annotations_rdf(request, ldt_id):
+
+ project = Project.objects.get(ldt_id=ldt_id);
+
+ if not ldt_auth.checkAccess(request.user, project):
+ return HttpResponseForbidden(_("You can not access this project"))
+
+ mimetype = request.REQUEST.get("mimetype")
+ if mimetype is None:
+ mimetype = "application/rdf+xml; charset=utf-8"
+ else:
+ mimetype = mimetype.encode("utf-8")
+ if "charset" not in mimetype:
+ mimetype += "; charset=utf-8"
+ resp = HttpResponse(mimetype=mimetype)
+ resp['Cache-Control']='no-cache, must-revalidate'
+ resp['Pragma']='no-cache'
+
+ ps = ProjectSerializer(project, from_content=False, from_display=True)
+ annotations = project.getAnnotations(first_cutting=True)
+
+ rdf_ns = u"http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ dc_ns = u"http://purl.org/dc/elements/1.1/"
+ rdf = u"{%s}" % rdf_ns
+ dc = u"{%s}" % dc_ns
+ nsmap = {u'rdf' : rdf_ns, u'dc':dc_ns}
+
+ rdf_root = etree.Element(rdf+u"RDF", nsmap=nsmap)
+
+ logging.debug("RDF annotations : " + repr(annotations))
+
+ for annotation in annotations:
+ uri = u""
+ if 'uri' in annotation and annotation['uri']:
+ uri = unicode(annotation['uri'])
+ annot_desc = etree.SubElement(rdf_root, rdf+u"Description")
+ annot_desc.set(rdf+u'about',uri)
+ if annotation['title']:
+ etree.SubElement(annot_desc, dc+'title').text = etree.CDATA(unicode(annotation['title']))
+ if annotation['desc']:
+ etree.SubElement(annot_desc, dc+'description').text = etree.CDATA(unicode(annotation['desc']))
+ if annotation['tags']:
+ for tag in annotation['tags']:
+ etree.SubElement(annot_desc, dc+'subject').text = etree.CDATA(unicode(tag))
+ etree.SubElement(annot_desc,dc+'coverage').text = u"start=%s, duration=%s" % (annotation['begin'], annotation['duration'])
+
+ resp.write(u"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
+ resp.write(u"<!DOCTYPE rdf:RDF PUBLIC \"-//DUBLIN CORE//DCMES DTD 2002/07/31//EN\" \"http://dublincore.org/documents/2002/07/31/dcmes-xml/dcmes-xml-dtd.dtd\">\n")
+
+ resp.write(etree.tostring(rdf_root, xml_declaration=False, encoding="utf-8", pretty_print=True))
+
+ return resp
def save_ldtProject(request):
if request.method=="POST":
ldt = request.POST['ldt']
id = request.POST['id']
ldtproject=Project.objects.get(ldt_id=id)
-
- #save xml ldt
+
+ #save xml ldt
ldtproject.ldt=ldt
- ldtproj = get_attrib(ldtproject)
- ldtproj.save()
- else:
- ldt = ''
-
- return render_to_response('ldt/ldt_utils/save_done.html', {'ldt': ldt, 'id':id, 'title':title, 'contents': new_contents}, context_instance=RequestContext(request))
-
+ doc = lxml.etree.fromstring(ldtproject.ldt.encode( "utf-8" ))
+ result = doc.xpath("/iri/project")
+
+ #set new title
+ ldtproject.title = result[0].get("title")
+
+ #get new content list
+ new_contents=[]
+ result = doc.xpath("/iri/medias/media")
+ for medianode in result:
+ id = medianode.get("id")
+ new_contents.append(id)
-def get_attrib(ldtproject):
- doc = lxml.etree.fromstring(ldtproject.ldt.encode( "utf-8" ))
- result = doc.xpath("/iri/project")
-
- for pnode in result:
- title = pnode.get("title")
- break
-
- #set new title
- ldtproject.title=title
-
- #get new content list
- new_contents=[]
- result = doc.xpath("/iri/medias/media")
- for medianode in result:
- id = medianode.get("id")
- new_contents.append(id)
-
#set new content list
for c in ldtproject.contents.all():
if not c.iri_id in new_contents:
ldtproject.contents.remove(c)
+
+ ldtproject.save()
+ else:
+ 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 ldtproject
+
+
@@ -437,7 +522,42 @@
return HttpResponseRedirect(reverse('ldt.ldt_utils.views.indexProject', args=[project.ldt_id]))
else:
form = AddProjectForm()
- return render_to_response('ldt/ldt_utils/create_ldt.html', {'form':form, 'contents':contents, 'iri_id':iri_id, 'create_project_action':reverse("ldt.ldt_utils.views.create_project",args=[iri_id])}, context_instance=RequestContext(request))
+ return render_to_response('ldt/ldt_utils/create_ldt.html', {'form':form, 'contents':contents, 'create_project_action':reverse("ldt.ldt_utils.views.create_project",args=[iri_id])}, context_instance=RequestContext(request))
+
+@login_required
+def update_project(request, ldt_id):
+
+ project = get_object_or_404(Project, ldt_id=ldt_id)
+ contents = project.contents.all()
+ if request.method == "POST" :
+ submit_action = request.REQUEST.get("submit_button",False)
+ if submit_action == "prepare_delete":
+ errors = []
+ if project.state == 2:
+ errors.append(_("the project %(title)s is published. please unpublish before deleting.")%{'title':project.title})
+ message = _("can not delete the project. Please correct the following error")
+ title = _('title error deleting project')
+ else:
+ message = _("please confirm deleting project %(title)s")%{'title':project.title}
+ title = _("confirm deletion")
+ return render_to_response('ldt/ldt_utils/error_confirm.html', {'errors':errors, 'message':message, 'title': title}, context_instance=RequestContext(request))
+ elif submit_action == "delete":
+ if project.state != 2:
+ project.delete()
+ form_status= 'deleted'
+ form = AddProjectForm()
+ else:
+ form_status= 'saved'
+ form = AddProjectForm(request.POST)
+ if form.is_valid():
+ project.title=form.cleaned_data['title']
+ project.save()
+ else:
+ form = AddProjectForm({'title':unicode(project.title)})
+ form_status= 'none'
+
+ return render_to_response('ldt/ldt_utils/create_ldt.html', {'form':form, 'form_status':form_status, 'ldt_id': ldt_id, 'contents':contents, 'create_project_action':reverse("ldt.ldt_utils.views.update_project",args=[ldt_id])}, context_instance=RequestContext(request))
+
@login_required
def copy_project(request, ldt_id):
@@ -486,53 +606,71 @@
media = None
elif media_input_type == "link":
media = content_form.cleaned_data["media_obj"]
- elif media_input_type == "url" or media_input_type == "upload" or media_input_type == "create":
+ created = False
+ elif media_input_type == "create":
+ del cleaned_data["media_file"]
+ if not cleaned_data['videopath']:
+ cleaned_data['videopath'] = settings.STREAM_URL
+ media, created = Media.objects.get_or_create(src=cleaned_data['src'], defaults=cleaned_data)
+ elif media_input_type == "url" or media_input_type == "upload" :
# copy file
#complet src
destination_file = None
source_file = None
destination_file_path = None
- if media_input_type != "create":
- try:
- if media_input_type == "url":
- url = cleaned_data["external_src_url"]
- source_file = urllib2.urlopen(url)
- source_filename = source_file.info().get('Content-Disposition', None)
- if not source_filename:
- source_filename = urlparse.urlparse(url).path.rstrip("/").split('/')[-1]
- elif media_input_type == "upload":
- source_file = request.FILES['media-media_file']
- source_filename = source_file.name
-
-
- destination_filepath = os.path.join(settings.STREAM_PATH, source_filename)
- base_source_filename = source_filename
- i = 0
- while os.path.exists(destination_filepath):
- base_source_filename = source_filename+"(%d)" % (i)
- destination_filepath = os.path.join(settings.STREAM_PATH, base_source_filename)
- i += 1
-
- destination_file = open(destination_filepath, "w")
- src_prefix = settings.STREAM_SRC_PREFIX.rstrip("/")
- if len(src_prefix) > 0:
- cleaned_data["src"] = src_prefix + "/" + base_source_filename
- else:
- cleaned_data["src"] = base_source_filename
+ try:
+ if media_input_type == "url":
+ url = cleaned_data["external_src_url"]
+ source_file = urllib2.urlopen(url)
+ source_filename = source_file.info().get('Content-Disposition', None)
+ if not source_filename:
+ source_filename = urlparse.urlparse(url).path.rstrip("/").split('/')[-1]
+ elif media_input_type == "upload":
+ source_file = request.FILES['media-media_file']
+ source_filename = source_file.name
+
+ source_filename = ldt_utils_path.sanitize_filename(source_filename)
+ destination_filepath = os.path.join(settings.STREAM_PATH, source_filename)
+ base_source_filename = source_filename
+ extension = base_source_filename.split(".")[-1]
+ if extension == base_source_filename:
+ extension = ""
+ base_basename_filename = base_source_filename
+ else:
+ base_basename_filename = base_source_filename[:-1 *(len(extension)+1)]
+ i = 0
+ while os.path.exists(destination_filepath):
+ base_source_filename = "%s.%d.%s" % (base_basename_filename,i,extension)
+ destination_filepath = os.path.join(settings.STREAM_PATH, base_source_filename)
+ i += 1
+ destination_file = open(destination_filepath, "w")
+ src_prefix = settings.STREAM_SRC_PREFIX.rstrip("/")
+ if len(src_prefix) > 0:
+ cleaned_data["src"] = src_prefix + "/" + base_source_filename
+ else:
+ cleaned_data["src"] = base_source_filename
+
+ chunck = source_file.read(2048)
+ while chunck:
+ destination_file.write(chunck)
chunck = source_file.read(2048)
- while chunck:
- destination_file.write(chunck)
- chunck = source_file.read(2048)
-
- except Exception as inst:
- logging.debug("write_content_base : POST error when processing file:" + str(inst))
- form_status = "error"
- finally:
- if destination_file:
- destination_file.close()
- if source_file:
- source_file.close()
+
+ except Exception as inst:
+ logging.debug("write_content_base : POST error when processing file:" + str(inst))
+ form_status = "error"
+ #set error for form
+ if media_input_type == "url":
+ errors = media_form._errors.setdefault("external_src_url", ErrorList())
+ errors.append(_("Problem when downloading file from url : ")+str(inst))
+ elif media_input_type == "upload":
+ errors = media_form._errors.setdefault("media_file", ErrorList())
+ errors.append(_("Problem when uploading file : ") + str(inst))
+ finally:
+ if destination_file:
+ destination_file.close()
+ if source_file:
+ source_file.close()
if form_status != "error":
#try:
@@ -540,10 +678,13 @@
if not cleaned_data['videopath']:
cleaned_data['videopath'] = settings.STREAM_URL
media, created = Media.objects.get_or_create(src=cleaned_data['src'], defaults=cleaned_data)
- if not created:
- for attribute in ('external_id', 'external_permalink', 'external_publication_url', 'external_src_url', 'media_creation_date', 'videopath', 'duration', 'description', 'title'):
- setattr(media, attribute, cleaned_data.get(attribute))
- media.save()
+ else:
+ media = None
+
+ if media and not created:
+ for attribute in ('external_id', 'external_permalink', 'external_publication_url', 'external_src_url', 'media_creation_date', 'videopath', 'duration', 'description', 'title'):
+ setattr(media, attribute, cleaned_data.get(attribute))
+ media.save()
#except Exception as inst:
# logging.debug("write_content_base : POST error when saving media:" + str(inst))
# form_status = "error"
@@ -586,18 +727,59 @@
return content_form, media_form, form_status
-
+@login_required
def write_content(request, iri_id=None):
- logging.debug("write_content : " + str(iri_id) )
- content_form, media_form, form_status = write_content_base(request, iri_id)
-
+ submit_action = request.REQUEST.get("submit_button",False)
+
+ if submit_action == "prepare_delete":
+ errors, titles = prepare_delete_content(request, iri_id)
+ if errors and len(errors) > 0:
+ message = ungettext("There is %(count)d error when deleting content", "There are %(count)d errors when deleting content", len(errors)) % { 'count': len(errors)}
+ title_msg = _('title error deleting content')
+ else:
+ message = _("Confirm delete content %(titles)s") % { 'titles' : ",".join(titles) }
+ title_msg = _("confirm delete content")
+ return render_to_response('ldt/ldt_utils/error_confirm.html', {'errors':errors, 'message':message, 'title': title_msg}, context_instance=RequestContext(request))
+ elif submit_action == "delete":
+ delete_content(request, iri_id)
+ form_status = "deleted"
+ content_form = ContentForm()
+ media_form = MediaForm()
+ else:
+ content_form, media_form, form_status = write_content_base(request, iri_id)
+
if iri_id:
create_content_action = reverse('ldt.ldt_utils.views.write_content', kwargs={'iri_id':iri_id})
else:
create_content_action = reverse('ldt.ldt_utils.views.write_content')
- return render_to_response('ldt/ldt_utils/create_content.html', {'content_form': content_form, 'media_form': media_form,'form_status': form_status,'create_content_action': create_content_action}, context_instance=RequestContext(request))
+ return render_to_response('ldt/ldt_utils/create_content.html', {'content_form': content_form, 'media_form': media_form,'form_status': form_status,'create_content_action': create_content_action, 'iri_id': iri_id}, context_instance=RequestContext(request))
+
+@login_required
+def prepare_delete_content(request, iri_id=None):
+ errors = []
+ titles = []
+ if not iri_id:
+ iri_id = request.REQUEST.get("iri_id", None)
+
+ if iri_id:
+ for content in Content.objects.filter(iri_id=iri_id):
+ titles.append(unicode(content.title))
+ projects = Content.objects.all()[0].project_set.all()
+ projects_nb = len(projects)
+ if projects_nb > 0:
+ project_titles = [lambda p: p.title for p in projects]
+ errors.append(ungettext("Content '%(title)s' is referenced by this project : %(project_titles)s. Please delete it beforehand.", "Content '%(title)s' is referenced by %(count)d projects: %(project_titles)s. Please delete them beforehand.", projects_nb)%{'title':content.title,'count':projects_nb, 'project_titles': ",".join(project_titles)})
+
+ return errors, titles
+@login_required
+def delete_content(request, iri_id=None):
+ if not iri_id:
+ iri_id = request.REQUEST.get("iri_id", None)
+
+ if iri_id:
+ Content.objects.filter(iri_id=iri_id).delete()
Binary file web/ldt/locale/en/LC_MESSAGES/django.mo has changed
--- a/web/ldt/locale/en/LC_MESSAGES/django.po Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/locale/en/LC_MESSAGES/django.po Fri Oct 15 12:36:43 2010 +0200
@@ -7,7 +7,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-09-21 05:10+0200\n"
+"POT-Creation-Date: 2010-10-12 03:19+0200\n"
"PO-Revision-Date: 2010-02-17 03:53+0100\n"
"Last-Translator: Yves-Marie Haussonne <ymh.work@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,15 +18,15 @@
#: forms/widgets.py:17
msgid "Date"
-msgstr ""
+msgstr "Date"
#: forms/widgets.py:17
msgid "Time"
-msgstr ""
+msgstr "Time"
-#: ldt_utils/forms.py:43 ldt_utils/models.py:59
+#: ldt_utils/forms.py:43 ldt_utils/models.py:80
msgid "content.content_creation_date"
-msgstr ""
+msgstr "content creation date"
#: ldt_utils/forms.py:44
msgid "content.media_input_type"
@@ -34,66 +34,67 @@
#: ldt_utils/forms.py:44
msgid "file_upload"
-msgstr ""
+msgstr "file upload"
#: ldt_utils/forms.py:44
msgid "url"
-msgstr ""
+msgstr "url"
#: ldt_utils/forms.py:44
msgid "existing_media"
-msgstr ""
+msgstr "existing media"
#: ldt_utils/forms.py:44
-#, fuzzy
msgid "create_media"
-msgstr "created by"
+msgstr "create media"
#: ldt_utils/forms.py:44
msgid "none_media"
-msgstr ""
+msgstr "no media"
#: ldt_utils/models.py:23
msgid "media.external_id"
-msgstr ""
+msgstr "external id"
#: ldt_utils/models.py:24
-msgid "content.external_permalink"
-msgstr ""
+msgid "media.external_permalink"
+msgstr "media permalink"
-#: ldt_utils/models.py:25 ldt_utils/models.py:26
-msgid "content.external_publication_url"
-msgstr ""
+#: ldt_utils/models.py:25
+msgid "media.external_publication_url"
+msgstr "media publication url"
+
+#: ldt_utils/models.py:26
+msgid "media.external_src_url"
+msgstr "media external source url"
#: ldt_utils/models.py:27
msgid "media.creation_date"
-msgstr ""
+msgstr "media object creation date"
#: ldt_utils/models.py:28
msgid "media.media_creation_date"
-msgstr ""
+msgstr "media creation date"
#: ldt_utils/models.py:29
msgid "media.update_date"
-msgstr ""
+msgstr "update date"
#: ldt_utils/models.py:30
msgid "media.videopath"
-msgstr ""
+msgstr "videopath"
#: ldt_utils/models.py:31
-#, fuzzy
msgid "media.duration"
-msgstr "duration"
+msgstr "duration (ms)"
#: ldt_utils/models.py:32
msgid "media.creator"
-msgstr ""
+msgstr "media creator"
#: ldt_utils/models.py:33
-#, fuzzy
msgid "description"
-msgstr "Login"
+msgstr "description"
#: ldt_utils/models.py:34
#: ldt_utils/templates/ldt/ldt_utils/content_list.html:69
@@ -103,48 +104,117 @@
#: ldt_utils/models.py:35
msgid "media.src"
-msgstr ""
+msgstr "media source"
-#: ldt_utils/models.py:48
+#: ldt_utils/models.py:72
msgid "content.iri_id"
-msgstr ""
+msgstr "iri id"
-#: ldt_utils/models.py:49
+#: ldt_utils/models.py:73
msgid "content.iriurl"
-msgstr ""
+msgstr "iri url"
-#: ldt_utils/models.py:52
+#: ldt_utils/models.py:74
msgid "content.creation_date"
-msgstr ""
+msgstr "content creation date"
-#: ldt_utils/models.py:53
+#: ldt_utils/models.py:75
msgid "content.update_date"
-msgstr ""
+msgstr "content update date"
-#: ldt_utils/models.py:54
+#: ldt_utils/models.py:76
msgid "content.title"
-msgstr ""
+msgstr "title"
-#: ldt_utils/models.py:55
+#: ldt_utils/models.py:77
msgid "content.description"
msgstr "description"
-#: ldt_utils/models.py:57
+#: ldt_utils/models.py:78
msgid "content.authors"
msgstr "authors"
-#: ldt_utils/models.py:58
+#: ldt_utils/models.py:79
msgid "content.duration"
-msgstr "duration"
+msgstr "duration (ms)"
-#: ldt_utils/models.py:209
+#: ldt_utils/models.py:248
msgid "created by"
msgstr "created by"
-#: ldt_utils/models.py:210
+#: ldt_utils/models.py:249
msgid "changed by"
msgstr "changed by"
+#: ldt_utils/views.py:231
+msgid "You can not access this project"
+msgstr "You can not access this project"
+
+#: ldt_utils/views.py:380
+#, python-format
+msgid "the project %(title)s is published. please unpublish before deleting."
+msgstr "the project %(title)s is published. please unpublish before deleting."
+
+#: ldt_utils/views.py:381
+msgid "can not delete the project. Please correct the following error"
+msgstr "can not delete the project. Please correct the following error"
+
+#: ldt_utils/views.py:382
+msgid "title error deleting project"
+msgstr "Error when deleting project"
+
+#: ldt_utils/views.py:384
+#, python-format
+msgid "please confirm deleting project %(title)s"
+msgstr "Please confirm deleting project %(title)s"
+
+#: ldt_utils/views.py:385
+msgid "confirm deletion"
+msgstr "Confirm deletion"
+
+#: ldt_utils/views.py:509
+msgid "Problem when downloading file from url : "
+msgstr "Problem when downloading file from url: "
+
+#: ldt_utils/views.py:512
+msgid "Problem when uploading file : "
+msgstr "Problem when uploading file: "
+
+#: ldt_utils/views.py:582
+#, python-format
+msgid "There is %(count)d error when deleting content"
+msgid_plural "There are %(count)d errors when deleting content"
+msgstr[0] "There is %(count)d error when deleting content"
+msgstr[1] "There are %(count)d errors when deleting content"
+
+#: ldt_utils/views.py:583
+msgid "title error deleting content"
+msgstr "Error when deleting content"
+
+#: ldt_utils/views.py:585
+#, python-format
+msgid "Confirm delete content %(titles)s"
+msgstr "Confirm delete content %(titles)s"
+
+#: ldt_utils/views.py:586
+msgid "confirm delete content"
+msgstr "Confirm delete content"
+
+#: ldt_utils/views.py:618
+#, python-format
+msgid ""
+"Content '%(title)s' is referenced by this project : %(project_titles)s. "
+"Please delete it beforehand."
+msgid_plural ""
+"Content '%(title)s' is referenced by %(count)d projects: %(project_titles)s. "
+"Please delete them beforehand."
+msgstr[0] ""
+"Content '%(title)s' is referenced by this project : %(project_titles)s. "
+"Please delete it beforehand."
+msgstr[1] ""
+"Content '%(title)s' is referenced by %(count)d projects: %(project_titles)s. "
+"Please delete them beforehand."
+
#: ldt_utils/templates/admin/ldt_utils/app_action.html:4
#: templates/admin/cms_change_list.html:7
#: templates/admin/page_app_index.html:8
@@ -214,6 +284,14 @@
msgid "Create"
msgstr "Create"
+#: ldt_utils/templates/ldt/ldt_utils/error_confirm.html:16
+msgid "error"
+msgstr "Error"
+
+#: ldt_utils/templates/ldt/ldt_utils/error_confirm.html:25
+msgid "close_error"
+msgstr "Close"
+
#: ldt_utils/templates/ldt/ldt_utils/ldt_list.html:59
msgid "Create new project"
msgstr "Create new project"
Binary file web/ldt/locale/fr/LC_MESSAGES/django.mo has changed
--- a/web/ldt/locale/fr/LC_MESSAGES/django.po Thu Oct 14 12:17:31 2010 +0200
+++ b/web/ldt/locale/fr/LC_MESSAGES/django.po Fri Oct 15 12:36:43 2010 +0200
@@ -7,7 +7,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-09-21 05:10+0200\n"
+"POT-Creation-Date: 2010-10-12 03:19+0200\n"
"PO-Revision-Date: 2010-03-09 15:52+0100\n"
"Last-Translator: Yves-Marie Haussonne <ymh.work@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -24,7 +24,7 @@
msgid "Time"
msgstr "Time"
-#: ldt_utils/forms.py:43 ldt_utils/models.py:59
+#: ldt_utils/forms.py:43 ldt_utils/models.py:80
msgid "content.content_creation_date"
msgstr "Date de creation du contenu"
@@ -46,7 +46,7 @@
#: ldt_utils/forms.py:44
msgid "create_media"
-msgstr "créé par"
+msgstr "source serveur de stream"
#: ldt_utils/forms.py:44
msgid "none_media"
@@ -57,13 +57,17 @@
msgstr "id externe"
#: ldt_utils/models.py:24
-msgid "content.external_permalink"
+msgid "media.external_permalink"
msgstr "permalien externe"
-#: ldt_utils/models.py:25 ldt_utils/models.py:26
-msgid "content.external_publication_url"
+#: ldt_utils/models.py:25
+msgid "media.external_publication_url"
msgstr "url de publication externe"
+#: ldt_utils/models.py:26
+msgid "media.external_src_url"
+msgstr "url source"
+
#: ldt_utils/models.py:27
msgid "media.creation_date"
msgstr "Date de création"
@@ -82,7 +86,7 @@
#: ldt_utils/models.py:31
msgid "media.duration"
-msgstr "Durée du contenu"
+msgstr "Durée du contenu (ms)"
#: ldt_utils/models.py:32
msgid "media.creator"
@@ -102,46 +106,116 @@
msgid "media.src"
msgstr "Sources"
-#: ldt_utils/models.py:48
+#: ldt_utils/models.py:72
msgid "content.iri_id"
msgstr "iri id"
-#: ldt_utils/models.py:49
+#: ldt_utils/models.py:73
msgid "content.iriurl"
msgstr "iri url"
-#: ldt_utils/models.py:52
+#: ldt_utils/models.py:74
msgid "content.creation_date"
msgstr "date de création"
-#: ldt_utils/models.py:53
+#: ldt_utils/models.py:75
msgid "content.update_date"
msgstr "Date de maj"
-#: ldt_utils/models.py:54
+#: ldt_utils/models.py:76
msgid "content.title"
msgstr "titre"
-#: ldt_utils/models.py:55
+#: ldt_utils/models.py:77
msgid "content.description"
msgstr "Description"
-#: ldt_utils/models.py:57
+#: ldt_utils/models.py:78
msgid "content.authors"
msgstr "Autheurs"
-#: ldt_utils/models.py:58
+#: ldt_utils/models.py:79
msgid "content.duration"
-msgstr "Durée"
+msgstr "Durée (ms)"
-#: ldt_utils/models.py:209
+#: ldt_utils/models.py:248
msgid "created by"
msgstr "créé par"
-#: ldt_utils/models.py:210
+#: ldt_utils/models.py:249
msgid "changed by"
msgstr "modifié par"
+#: ldt_utils/views.py:231
+msgid "You can not access this project"
+msgstr "vous n'avez pas l'autorisation d'accéder à ce projet"
+
+#: ldt_utils/views.py:380
+#, python-format
+msgid "the project %(title)s is published. please unpublish before deleting."
+msgstr "Le projet %(title)s est publié. Déplublier le avant de l'effacer."
+
+#: ldt_utils/views.py:381
+msgid "can not delete the project. Please correct the following error"
+msgstr ""
+"Le projet ne peut pas être effacé. Veuillez corriger les erreurs suivantes."
+
+#: ldt_utils/views.py:382
+msgid "title error deleting project"
+msgstr "Erreur lors de l'effacement du projet"
+
+#: ldt_utils/views.py:384
+#, python-format
+msgid "please confirm deleting project %(title)s"
+msgstr "Confirmer l'efaccement du projet intitulé %(title)s"
+
+#: ldt_utils/views.py:385
+msgid "confirm deletion"
+msgstr "Confirmation d'effacement"
+
+#: ldt_utils/views.py:509
+msgid "Problem when downloading file from url : "
+msgstr "Problème lors du téléchargement du fichier : "
+
+#: ldt_utils/views.py:512
+msgid "Problem when uploading file : "
+msgstr "Problème lors de l'upload du fichier : "
+
+#: ldt_utils/views.py:582
+#, python-format
+msgid "There is %(count)d error when deleting content"
+msgid_plural "There are %(count)d errors when deleting content"
+msgstr[0] "Il y a %(count)d erreur lors de l'effacement du contenu"
+msgstr[1] "Il y a %(count)d erreurs lors de l'effacement du contenu"
+
+#: ldt_utils/views.py:583
+msgid "title error deleting content"
+msgstr "Erreur lors de l'effacement du contenu"
+
+#: ldt_utils/views.py:585
+#, python-format
+msgid "Confirm delete content %(titles)s"
+msgstr "Veuillez confirmer l'effacement du contenu %(titles)s"
+
+#: ldt_utils/views.py:586
+msgid "confirm delete content"
+msgstr "Confirmation effacement contenu"
+
+#: ldt_utils/views.py:618
+#, python-format
+msgid ""
+"Content '%(title)s' is referenced by this project : %(project_titles)s. "
+"Please delete it beforehand."
+msgid_plural ""
+"Content '%(title)s' is referenced by %(count)d projects: %(project_titles)s. "
+"Please delete them beforehand."
+msgstr[0] ""
+"Le contenu '%(title)s' est référencé par le projet '%(project_titles)s'."
+"Veuillez l'effacer préalablement."
+msgstr[1] ""
+"Le contenu '%(title)s' est référencé par les projets suivants : "
+"'%(project_titles)s'.Veuillez les effacer préalablement."
+
#: ldt_utils/templates/admin/ldt_utils/app_action.html:4
#: templates/admin/cms_change_list.html:7
#: templates/admin/page_app_index.html:8
@@ -170,7 +244,6 @@
msgstr "Liste des contenus"
#: ldt_utils/templates/ldt/ldt_utils/content_list.html:63
-#, fuzzy
msgid "Create new content"
msgstr "Créer un nouveau contenu"
@@ -180,7 +253,6 @@
#: ldt_utils/templates/ldt/ldt_utils/content_list.html:70
#: ldt_utils/templates/ldt/ldt_utils/content_list.html:77
-#, fuzzy
msgid "create project"
msgstr "Créer un nouveau projet Ligne de Temps"
@@ -213,6 +285,14 @@
msgid "Create"
msgstr "Créer"
+#: ldt_utils/templates/ldt/ldt_utils/error_confirm.html:16
+msgid "error"
+msgstr "Erreur"
+
+#: ldt_utils/templates/ldt/ldt_utils/error_confirm.html:25
+msgid "close_error"
+msgstr "Fermer"
+
#: ldt_utils/templates/ldt/ldt_utils/ldt_list.html:59
msgid "Create new project"
msgstr "Créer un nouveau projet Ligne de Temps"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/templates/ldt/ldt_base.html Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,87 @@
+{% extends "ldt/ldt_raw_base.html" %}
+{% load i18n %}
+{% load logintag %}
+{% load navigation %}
+
+{% block js_import %}
+ {{ block.super }}
+ <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.nyroModal.min.js"></script>
+ <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.qtip.min.js"></script>
+ <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.validate.js" ></script>
+{% endblock %}
+
+{% block css_import %}
+ {{ block.super }}
+ <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}/css/tabs.css" type="text/css" media="screen, projection" />
+ <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}/css/nyroModal.css" type="text/css"/>
+ <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}/js/login_ajax/login_ajax.css" type="text/css"/>
+{% endblock %}
+
+{% block body %}
+ {{ block.super }}
+ <div class="container">
+ <div id="header" class="span-24 last">
+ {% block header %}
+ <div id="header_left" class="span-24 last">
+ <a href="{% url ldt.ldt_utils.views.workspace %}">{% block base_title %}Ldt Platform{% endblock %}</a>
+ </div>
+ {% endblock %}
+ </div>
+
+
+ <div id="content" class="span-24 last">
+
+ <div id="toolbar" class="span-24 last">
+ {% block toolbar %}
+ <div class="block span-24 last">
+ <div id="tabsdiv" class="block span-20">
+ {% if user.is_authenticated %}
+ {% url ldt.ldt_utils.views.workspace as workspace_url %}
+ {% url ldt.ldt_utils.views.list_ldt as space_url %}
+ {% url ldt.ldt_utils.views.list_content as content_url %}
+ {% url ldt.user.views.profile as profile_url %}
+ <ul class="tabs">
+ <li class='{% active request "active" workspace_url %}'><a href="{{ workspace_url }}" >{% trans "home" %}</a></li>
+ <!--li class='{% active request "active" content_url %}'><a href="{{ content_url }}">{% trans "contents" %}</a></li>
+ <li class='{% active request "active" space_url %}'><a href="{{ space_url }}">{% trans "indexation projects" %}</a></li>
+ <li class='{% active request "active" "" %}'><a href="#">{% trans "accounts" %}</a></li>
+ <li class='{% active request "active" profile_url %}'><a href="{{ profile_url }}" >{% trans "Profiles" %}</a> </li-->
+ </ul>
+ {% endif %}
+ </div>
+ <div id="loginstate" class="block span-4 last">
+ {% if user.is_authenticated %}
+ {{user.username}} | <a href="{% url ldt.user.views.logout_view %}" >{% trans "Log out" %}</a>
+ {% endif %}
+ </div>
+ </div>
+ {% if LANGUAGES.1 %}
+ <div id="language_chooser">
+ <form action="{{BASE_URL}}enmi/i18n/setlang/" method="post">
+ <input name="next" type="hidden" value="" />
+ <label >{% trans "Langue" %} : </label>
+ <select name="language" onchange="submit()">
+ {% for lang in LANGUAGES %}
+ <option value="{{ lang.0 }}"{% ifequal lang.0 LANGUAGE_CODE %} selected="selected"{% endifequal %}>{% trans lang.1 %}</option>
+ {% endfor %}
+ </select>
+ </form>
+ </div>
+ {% endif %}
+ {% endblock %}
+ </div>
+ <div id="inner_content" class="span-24 last">
+ {% block content %}{% endblock %}
+ </div>
+ </div>
+ <div id="footer" class="span-24 last">
+ {% block footer %}
+ <div class="footer_img">
+ <a href="http://www.iri.centrepompidou.fr"><img src="{{LDT_MEDIA_PREFIX}}/img/logo_IRI_footer.png" alt="Logo IRI" /></a>
+ </div>
+ <div class="version" id="version"><a>{{VERSION}}</a></div>
+ <div style="float: right;" class="small">©2010 <a style="text-decoration: none; color: #4F5155;" href="http://www.iri.centrepompidou.fr">IRI / Centre Pompidou</a></div>
+ {% endblock %}
+ </div>
+ </div>
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/templates/ldt/ldt_raw_base.html Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,45 @@
+{% load i18n %}
+{% load logintag %}
+{% load navigation %}
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{LANGUAGE_CODE}}" lang="{{LANGUAGE_CODE}}">
+<head>
+{% block head %}
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
+ <meta http-equiv="content-language" content="{{LANGUAGE_CODE}}" />
+ <link rel="SHORTCUT ICON" href="{{LDT_MEDIA_PREFIX}}/img/favicon.ico" />
+ <title>{% block title %}France Culture{% endblock %}</title>
+ {% block js_import %}
+ <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.min.js"></script>
+ {% endblock %}
+
+ {% block css_declaration %}
+ <style type="text/css">
+ .rounded {
+ behavior:url("{{LDT_MEDIA_PREFIX}}css/border-radius.htc");
+ }
+ </style>
+ {% endblock %}
+
+ {% block css_import %}
+
+ <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/blueprint/screen.css" type="text/css" media="screen, projection" />
+ <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/blueprint/print.css" type="text/css" media="print" />
+ <!--[if lt IE 8]>
+ <link rel="stylesheet" href="{{BASE_URL}}static/css/blueprint/ie.css" type="text/css" media="screen, projection" />
+ <![endif]-->
+ <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/style_bis.css" type="text/css"/>
+ <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/style.css" type="text/css"/>
+ {% endblock %}
+
+ {% block js_declaration %}
+ {% endblock %}
+{% endblock %}
+</head>
+<body>
+{% block body %}
+{% endblock %}
+</body>
+</html>
--- a/web/ldt/templates/ldt_base.html Thu Oct 14 12:17:31 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-{% extends "ldt_raw_base.html" %}
-{% load i18n %}
-{% load logintag %}
-{% load navigation %}
-
-{% block js_import %}
- {{ block.super }}
- <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.nyroModal.min.js"></script>
- <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.qtip.min.js"></script>
- <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.validate.js" ></script>
-{% endblock %}
-
-{% block css_import %}
- {{ block.super }}
- <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}/css/tabs.css" type="text/css" media="screen, projection" />
- <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}/css/nyroModal.css" type="text/css"/>
- <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}/js/login_ajax/login_ajax.css" type="text/css"/>
-{% endblock %}
-
-{% block body %}
- {{ block.super }}
- <div class="container">
- <div id="header" class="span-24 last">
- {% block header %}
- <div id="header_left" class="span-24 last">
- <a href="{% url ldt.ldt_utils.views.workspace %}">France Culture</a>
- </div>
- {% endblock %}
- </div>
-
-
- <div id="content" class="span-24 last">
-
- <div id="toolbar" class="span-24 last">
- {% block toolbar %}
- <div class="block span-24 last">
- <div id="tabsdiv" class="block span-20">
- {% if user.is_authenticated %}
- {% url ldt.ldt_utils.views.workspace as workspace_url %}
- {% url ldt.ldt_utils.views.list_ldt as space_url %}
- {% url ldt.ldt_utils.views.list_content as content_url %}
- {% url ldt.user.views.profile as profile_url %}
- <ul class="tabs">
- <li class='{% active request "active" workspace_url %}'><a href="{{ workspace_url }}" >{% trans "home" %}</a></li>
- <!--li class='{% active request "active" content_url %}'><a href="{{ content_url }}">{% trans "contents" %}</a></li>
- <li class='{% active request "active" space_url %}'><a href="{{ space_url }}">{% trans "indexation projects" %}</a></li>
- <li class='{% active request "active" "" %}'><a href="#">{% trans "accounts" %}</a></li>
- <li class='{% active request "active" profile_url %}'><a href="{{ profile_url }}" >{% trans "Profiles" %}</a> </li-->
- </ul>
- {% endif %}
- </div>
- <div id="loginstate" class="block span-4 last">
- {% if user.is_authenticated %}
- {{user.username}} | <a href="{% url ldt.user.views.logout_view %}" >{% trans "Log out" %}</a>
- {% endif %}
- </div>
- </div>
- {% if LANGUAGES.1 %}
- <div id="language_chooser">
- <form action="{{BASE_URL}}enmi/i18n/setlang/" method="post">
- <input name="next" type="hidden" value="" />
- <label >{% trans "Langue" %} : </label>
- <select name="language" onchange="submit()">
- {% for lang in LANGUAGES %}
- <option value="{{ lang.0 }}"{% ifequal lang.0 LANGUAGE_CODE %} selected="selected"{% endifequal %}>{% trans lang.1 %}</option>
- {% endfor %}
- </select>
- </form>
- </div>
- {% endif %}
- {% endblock %}
- </div>
- <div id="inner_content" class="span-24 last">
- {% block content %}{% endblock %}
- </div>
- </div>
- <div id="footer" class="span-24 last">
- {% block footer %}
- <div class="footer_img">
- <a href="http://www.iri.centrepompidou.fr"><img src="{{LDT_MEDIA_PREFIX}}/img/logo_IRI_footer.png" alt="Logo IRI" /></a>
- </div>
- <div class="version" id="version"><a>{{VERSION}}</a></div>
- <div style="float: right;" class="small">©2010 <a style="text-decoration: none; color: #4F5155;" href="http://www.iri.centrepompidou.fr">IRI / Centre Pompidou</a></div>
- {% endblock %}
- </div>
- </div>
-{% endblock %}
--- a/web/ldt/templates/ldt_raw_base.html Thu Oct 14 12:17:31 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-{% load i18n %}
-{% load logintag %}
-{% load navigation %}
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{LANGUAGE_CODE}}" lang="{{LANGUAGE_CODE}}">
-<head>
-{% block head %}
- <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
- <meta http-equiv="content-language" content="{{LANGUAGE_CODE}}" />
- <link rel="SHORTCUT ICON" href="{{LDT_MEDIA_PREFIX}}/img/favicon.ico" />
- <title>{% block title %}France Culture{% endblock %}</title>
- {% block js_import %}
- <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.min.js"></script>
- {% endblock %}
-
- {% block css_declaration %}
- <style type="text/css">
- .rounded {
- behavior:url("{{LDT_MEDIA_PREFIX}}css/border-radius.htc");
- }
- </style>
- {% endblock %}
-
- {% block css_import %}
-
- <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/blueprint/screen.css" type="text/css" media="screen, projection" />
- <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/blueprint/print.css" type="text/css" media="print" />
- <!--[if lt IE 8]>
- <link rel="stylesheet" href="{{BASE_URL}}static/css/blueprint/ie.css" type="text/css" media="screen, projection" />
- <![endif]-->
- <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/style_bis.css" type="text/css"/>
- <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/style.css" type="text/css"/>
- {% endblock %}
-
- {% block js_declaration %}
- {% endblock %}
-{% endblock %}
-</head>
-<body>
-{% block body %}
-{% endblock %}
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldt/utils/path.py Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,14 @@
+"""
+Some small file related utilities
+"""
+
+import unicodedata
+import string
+
+validFilenameChars = "-_.() %s%s" % (string.ascii_letters, string.digits)
+
+
+def sanitize_filename(filename):
+ cleanedFilename = unicodedata.normalize('NFKD', filename).encode('ASCII', 'ignore').lower()
+ return ''.join(c for c in cleanedFilename if c in validFilenameChars).replace(' ','_')
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/static/ldt/css/embed_popup.css Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,33 @@
+pre {
+white-space: pre-wrap; /* css-3 */
+white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
+white-space: -pre-wrap; /* Opera 4-6 */
+white-space: -o-pre-wrap; /* Opera 7 */
+word-wrap: break-word; /* Internet Explorer 5.5+ */
+}
+
+input
+{
+ background: #ededed;
+}
+
+input[type="button"] {
+ background-color: #656565;
+ color: white;
+ width: auto;
+ font-weight: bold;
+ padding: 5px 10px;
+}
+
+#button_row input {
+ margin: 10px;
+}
+
+#display_select {
+ float: left;
+}
+
+#copy_div {
+ float: right;
+}
+
--- a/web/static/ldt/css/ldtform.css Thu Oct 14 12:17:31 2010 +0200
+++ b/web/static/ldt/css/ldtform.css Fri Oct 15 12:36:43 2010 +0200
@@ -47,10 +47,27 @@
#submitcontent {
border-top: 1px solid black;
padding-top : 10px;
+}
+
+#submitcontent-buttons {
text-align: right;
}
-#add_content input[type="submit"], #add_contribution input[type="submit"] {
+#submitcontent-loader {
+ text-align: left;
+}
+
+.submitcontent-loader-content {
+ display: none;
+}
+
+
+#submitcontent-loader-msg {
+ padding-left: 6px;
+}
+
+
+#submitcontent-buttons input[type="submit"], #submitcontent-buttons button {
background-color: #656565;
color: white;
width:auto;
@@ -114,3 +131,9 @@
border: 1px solid #DDD;
}
+.error_message {
+ padding: 3em 2em;
+ font-size: larger;
+ font-weight: bold;
+}
+
--- a/web/static/ldt/css/workspace.css Thu Oct 14 12:17:31 2010 +0200
+++ b/web/static/ldt/css/workspace.css Fri Oct 15 12:36:43 2010 +0200
@@ -109,6 +109,12 @@
color: #4F5155;
}
+.projecttitlelink,.projecttitlelink:link,.projecttitlelink:hover,.projecttitlelink:visited {
+ text-decoration: none;
+ color: #4F5155;
+}
+
+
.projecttitle {
width: 367px;
padding: 4px 10px 4px 5px;
Binary file web/static/ldt/img/ajax-loader-220x19.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/static/ldt/js/embed_popup.js Fri Oct 15 12:36:43 2010 +0200
@@ -0,0 +1,49 @@
+var display_state = "player";
+
+function toggle_display() {
+ $j.each(["player","seo_body","seo_meta","links"], function(i,display_str) {
+
+ var div_selector = "#"+display_str+"_code";
+ if(display_str == display_state) {
+ $j(div_selector).show();
+ }
+ else {
+ $j(div_selector).hide();
+ }
+ });
+}
+
+$j(document).ready(function(){
+
+ toggle_display();
+
+ $j('.ldt_json_link').click(function(e) {
+ e.preventDefault();
+ link = $j(e.target);
+ $j("#res_link_{{player_id}}").load(link.attr("href"));
+ $j("#res_link_{{player_id}}").show();
+ return false;
+ });
+
+ $j('#player_button').click(function(e) {
+ display_state = "player";
+ toggle_display();
+ });
+ $j('#seo_body_button').click(function(e) {
+ display_state = "seo_body";
+ toggle_display();
+ });
+ $j('#seo_meta_button').click(function(e) {
+ display_state = "seo_meta";
+ toggle_display();
+ });
+ $j('#links_button').click(function(e) {
+ display_state = "links";
+ toggle_display();
+ });
+
+ $j("#copy_button").click(function(e) {
+ alert($j("#"+display_state+"_code").html());
+ });
+
+});
--- a/web/static/ldt/js/projectscontents.js Thu Oct 14 12:17:31 2010 +0200
+++ b/web/static/ldt/js/projectscontents.js Fri Oct 15 12:36:43 2010 +0200
@@ -23,51 +23,31 @@
width:1022,
bgColor: 'rgb(239, 239, 239)',
padding: 5,
- titleFromIframe: false
+ titleFromIframe: false,
+ beforeHideContent: function(elts, settings, callback){
+ try {
+ var res = $('#ldtInitSwf',$('#nyroModalIframe').contents());
+ if(res.length > 0)
+ {
+ res.get(0).forceSave();
+ }
+ }
+ catch(err)
+ {
+ // do nothing
+ }
+ callback();
+ },
+
});
- $('.ldt_link_create',base_node).nyroModal({
- type: 'iframe',
- forceType: 'iframe',
- windowResize: false,
- height:680,
- width:500,
- bgColor: 'rgb(239, 239, 239)',
- padding: 5,
- titleFromIframe: false,
- beforeHideContent: function(elts, settings, callback){
- try {
- var res = $('#ldtInitSwf',$('#nyroModalIframe').contents());
- if(res.length > 0)
- {
- res.get(0).forceSave();
- }
- }
- catch(err)
- {
- // do nothing
- }
- callback();
- },
- endShowContent: function(elts, settings){
- var iframe = $('#nyroModalIframe', elts.content);
- iframe.load(function(){
- var swfobject = $(this).contents().find("#ldtInitSwf");
- if (swfobject.length) {
- $.nyroModalSettings({
- height: swfobject.height() + 31,
- width: swfobject.width() + 21
- });
- }
- });
- }
- });
$('.ldt_link_embed',base_node).click(function(e) {
e.preventDefault();
var link = $(e.target);
var json_url = link.attr("href");
var player_id = link.attr("id");
+ var ldt_id = player_id.substring(15);
/*$.nyroModalSettings({
ajax: { data: ({ json_url:json_url, player_id:player_id }) }
});*/
@@ -79,7 +59,7 @@
width:750,
bgColor: 'rgb(239, 239, 239)',
padding: 5,
- url: embed_url+'?json_url='+escape(json_url)+'&player_id='+escape(player_id),
+ url: embed_url+'?json_url='+escape(json_url)+'&player_id='+escape(player_id)+'&ldt_id='+escape(ldt_id),
});
return false;
});
@@ -129,25 +109,30 @@
if(target.attr('timer')) {
clearTimeout(target.attr('timer'));
}
-
- target.attr('timer',setTimeout(function() {
- target.next(".searchajaxloader").show();
- target.nextAll(".searchclear").hide();
- var realVal = target.realVal();
- if(realVal.length == 0) {
- realVal = "_";
- }
- url = url.replace('__FILTER__',escape(realVal));
- $(container_selector).load(url, null, function() {
- target.next(".searchajaxloader").hide();
- if(target.realVal().length > 0) {
- target.nextAll(".searchclear").show();
- }
- init_events($(container_selector));
- target.removeAttr('timer');
- });
- },
- 300));
+
+ target.attr(
+ 'timer',
+ setTimeout(function() {
+ target.next(".searchajaxloader").show();
+ target.nextAll(".searchclear").hide();
+ var filterVal = "_" + escape(target.realVal());
+ url = url.replace('__FILTER__',filterVal);
+ $.ajax({
+ url: url,
+ cache: false,
+ success: function(data, status, request) {
+ $(container_selector).html(data);
+ target.next(".searchajaxloader").hide();
+ if(target.realVal().length > 0) {
+ target.nextAll(".searchclear").show();
+ }
+ init_events($(container_selector));
+ target.removeAttr('timer');
+ }
+ });
+ },
+ 300)
+ );
};
@@ -169,7 +154,7 @@
endShowContent: function(elts, settings) {
$('#nyroModalIframe', elts.content).load(function() {
var form_status = $(this).contents().find("#content_form_status").val();
- if(form_status == 'saved') {
+ if(form_status == 'saved' || form_status == 'deleted' ) {
$.nyroModalRemove();
}
});
@@ -185,12 +170,12 @@
padding: 5,
titleFromIframe: false,
endRemove: function(elts, settings) {
- searchCallback($("#searchcontentsinput"),"#contentslistcontainer",content_filter_url)
+ searchCallback($("#searchcontentsinput"),"#contentslistcontainer",content_filter_url,0);
},
endShowContent: function(elts, settings) {
$('#nyroModalIframe', elts.content).load(function() {
var form_status = $(this).contents().find("#content_form_status").val();
- if(form_status == 'saved') {
+ if(form_status == 'saved' || form_status == 'deleted') {
$.nyroModalRemove();
}
});
@@ -201,7 +186,52 @@
}
function init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) {
-
+
+ $('.ldt_link_create',base_node).nyroModal({
+ type: 'iframe',
+ forceType: 'iframe',
+ windowResize: false,
+ height:680,
+ width:500,
+ bgColor: 'rgb(239, 239, 239)',
+ padding: 5,
+ titleFromIframe: false,
+ endRemove: function(elts, settings) {
+ searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0);
+ },
+ beforeHideContent: function(elts, settings, callback){
+ try {
+ var res = $('#ldtInitSwf',$('#nyroModalIframe').contents());
+ if(res.length > 0)
+ {
+ res.get(0).forceSave();
+ }
+ }
+ catch(err)
+ {
+ // do nothing
+ }
+ callback();
+ },
+ endShowContent: function(elts, settings){
+ var iframe = $('#nyroModalIframe', elts.content);
+ iframe.load(function(){
+ var form_status = $(this).contents().find("#project_form_status").val();
+ if(form_status == 'saved' || form_status == 'deleted' ) {
+ $.nyroModalRemove();
+ }
+ var swfobject = $(this).contents().find("#ldtInitSwf");
+ if (swfobject.length) {
+ $.nyroModalSettings({
+ height: swfobject.height() + 31,
+ width: swfobject.width() + 21
+ });
+ }
+ });
+ }
+ });
+
+
$('.publishedproject', base_node).click(function(e) {
e.preventDefault();
var target = $(e.target);
@@ -236,6 +266,27 @@
});
});
+ $('.projecttitlelink').nyroModal({
+ type: 'iframe',
+ forceType: 'iframe',
+ height:680,
+ width:500,
+ bgColor: 'rgb(239, 239, 239)',
+ padding: 5,
+ titleFromIframe: false,
+ endRemove: function(elts, settings) {
+ searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0);
+ },
+ endShowContent: function(elts, settings) {
+ $('#nyroModalIframe', elts.content).load(function() {
+ var form_status = $(this).contents().find("#project_form_status").val();
+ if(form_status == 'saved' || form_status == 'deleted') {
+ $.nyroModalRemove();
+ }
+ });
+ }
+ });
+
}
function init_events_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) {
Binary file web/static/ldt/swf/ldt/LignesDeTempsFlex.swf has changed