# HG changeset patch # User ymh # Date 1286846613 -7200 # Node ID 9202807b4ceccd8031f647905b1a16c5b2f9bb1f # Parent 97b12f5f2c7a12a6faf487eddd037238001759c1 evolutions diff -r 97b12f5f2c7a -r 9202807b4cec web/franceculture/locale/fr/LC_MESSAGES/django.mo Binary file web/franceculture/locale/fr/LC_MESSAGES/django.mo has changed diff -r 97b12f5f2c7a -r 9202807b4cec web/franceculture/locale/fr/LC_MESSAGES/django.po --- a/web/franceculture/locale/fr/LC_MESSAGES/django.po Wed Sep 29 10:10:07 2010 +0200 +++ b/web/franceculture/locale/fr/LC_MESSAGES/django.po Tue Oct 12 03:23:33 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 \n" "Language-Team: LANGUAGE \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." "
Please resubmit the content form after making the following changes:" msgstr "" -"opération impossible à cause d'une ou plusieurs erreurs." -"
Veuillez resoumettre le formulaire contenu après avoir fait les " -"changements suivants:" +"opération impossible à cause d'une ou plusieurs erreurs.
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." "
Please resubmit the media form after making the following changes:" msgstr "" -"opération impossible à cause d'une ou plusieurs erreurs." -"
Veuillez resoumettre le formulaire media après avoir fait les " -"changements suivants:" +"opération impossible à cause d'une ou plusieurs erreurs.
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é" diff -r 97b12f5f2c7a -r 9202807b4cec web/franceculture/templates/franceculture/embed_popup.html --- a/web/franceculture/templates/franceculture/embed_popup.html Wed Sep 29 10:10:07 2010 +0200 +++ b/web/franceculture/templates/franceculture/embed_popup.html Tue Oct 12 03:23:33 2010 +0200 @@ -7,6 +7,10 @@ Ligne de Temps - IRI + + - + +
- {% include "franceculture/partial/embed.html" %} + {% include "franceculture/partial/embed_player.html" %}
 
- - -
-{{ player_embed_rendered }}
-
-
+ + +
+
+ +
+
- - {% trans 'clik here to see the project content' %} +
+ +
{{ embed_rendered.player }}
+
{{ embed_rendered.seo_body }}
+
{{ embed_rendered.seo_meta }}
+
+ + +
+ + {% trans 'clik here to see the project content' %} -
-		
-		
diff -r 97b12f5f2c7a -r 9202807b4cec web/franceculture/templates/franceculture/partial/contentslist.html --- a/web/franceculture/templates/franceculture/partial/contentslist.html Wed Sep 29 10:10:07 2010 +0200 +++ b/web/franceculture/templates/franceculture/partial/contentslist.html Tue Oct 12 03:23:33 2010 +0200 @@ -10,7 +10,7 @@
{% trans 'create project' %}
{% trans 'preview media'%}
- {{ content.title }} + {{ content.title|default:"_" }} {% endfor %} diff -r 97b12f5f2c7a -r 9202807b4cec web/franceculture/templates/franceculture/partial/embed.html --- a/web/franceculture/templates/franceculture/partial/embed.html Wed Sep 29 10:10:07 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -{% load i18n %} -
 
-
-
- - - \ No newline at end of file diff -r 97b12f5f2c7a -r 9202807b4cec web/franceculture/templates/franceculture/partial/embed_links.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/franceculture/templates/franceculture/partial/embed_links.html Tue Oct 12 03:23:33 2010 +0200 @@ -0,0 +1,9 @@ +{% spaceless %} + +{% endspaceless %} \ No newline at end of file diff -r 97b12f5f2c7a -r 9202807b4cec web/franceculture/templates/franceculture/partial/embed_player.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/franceculture/templates/franceculture/partial/embed_player.html Tue Oct 12 03:23:33 2010 +0200 @@ -0,0 +1,25 @@ +{% spaceless %} +{% load i18n %} +
 
+
+
+ +{% endspaceless %} \ No newline at end of file diff -r 97b12f5f2c7a -r 9202807b4cec web/franceculture/templates/franceculture/partial/embed_seo_body.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/franceculture/templates/franceculture/partial/embed_seo_body.html Tue Oct 12 03:23:33 2010 +0200 @@ -0,0 +1,9 @@ +{% spaceless %} + +{% endspaceless %} \ No newline at end of file diff -r 97b12f5f2c7a -r 9202807b4cec web/franceculture/templates/franceculture/partial/embed_seo_meta.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/franceculture/templates/franceculture/partial/embed_seo_meta.html Tue Oct 12 03:23:33 2010 +0200 @@ -0,0 +1,6 @@ +{% spaceless %} + {% for annotation in annotations %} +
  • {{annotation.title}}{{annotation.desc}}{{annotation.tags}}{% if annotation.uri %}{{annotation.uri}}{% endif %}
  • + {% endfor %} + +{% endspaceless %} \ No newline at end of file diff -r 97b12f5f2c7a -r 9202807b4cec web/franceculture/templates/franceculture/partial/projectslist.html --- a/web/franceculture/templates/franceculture/partial/projectslist.html Wed Sep 29 10:10:07 2010 +0200 +++ b/web/franceculture/templates/franceculture/partial/projectslist.html Tue Oct 12 03:23:33 2010 +0200 @@ -9,18 +9,23 @@ {% for project in projects %} {% url ldt.ldt_utils.views.project_json_id project.ldt_id as json_url_id %} -
    +
    {% trans 'open ldt' %}
    +
    {% trans 'copy project' %}
    +
    {% trans 'link json by id' %}
    + {% ifequal project.state 2 %} {% trans 'Project published, click to unpublish' %} {% else %} {% trans 'Project not published, click to publish' %} {% endifequal %} -
    -
    {% trans 'open ldt' %}
    -
    {% trans 'copy project' %}
    -
    {% trans 'link json by id' %}
    - {{ project.title }} + + {% ifequal project.state 2 %} + {{ project.title }} + {% else %} + {{ project.title }} + {% endifequal %} + {% endfor %} diff -r 97b12f5f2c7a -r 9202807b4cec web/franceculture/templates/ldt/ldt_utils/create_content.html --- a/web/franceculture/templates/ldt/ldt_utils/create_content.html Wed Sep 29 10:10:07 2010 +0200 +++ b/web/franceculture/templates/ldt/ldt_utils/create_content.html Tue Oct 12 03:23:33 2010 +0200 @@ -23,6 +23,13 @@ +{% endblock %} {% block body %}
    -
    {% trans "Create your project" %}
    +
    {% if ldt_id %}{% trans "Update your project" %}{% else %}{% trans "Create your project" %}{% endif %}
    {% csrf_token %} + - + {{form.title}}
    {% trans "name" %}
    @@ -34,7 +46,7 @@ {% for content in contents %} - + {{ content.title }} {% endfor %} @@ -43,8 +55,14 @@
    -
    - +
    + + {% if ldt_id %} + + + {% else %} + + {% endif %}
    diff -r 97b12f5f2c7a -r 9202807b4cec web/franceculture/templates/ldt/ldt_utils/error_confirm.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/franceculture/templates/ldt/ldt_utils/error_confirm.html Tue Oct 12 03:23:33 2010 +0200 @@ -0,0 +1,54 @@ +{% extends "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 }} + + +{% endblock %} + + +{% block js_declaration %} + +{% endblock %} + +{% block body %} + +
    +
    {% if errors|length > 0 %}{% trans "error" %}{% else %}{% trans "confirm" %}{% endif %}
    +
    + {{ message }} + {% if errors|length > 0 %} +
      + {% for error_msg in errors %} +
    • {{ error_msg }}
    • + {% endfor %} +
    + {% endif %} +
    + +
    +{% if errors|length > 0 %} + +{% else %} +
    + {% csrf_token %} + + +
    +{% endif %} +
    + +{% endblock %} diff -r 97b12f5f2c7a -r 9202807b4cec web/franceculture/views.py --- a/web/franceculture/views.py Wed Sep 29 10:10:07 2010 +0200 +++ b/web/franceculture/views.py Tue Oct 12 03:23:33 2010 +0200 @@ -9,6 +9,7 @@ from django.db.models import Q import logging import lxml.etree +from lxml.html import fromstring import ldt.auth @@ -112,7 +113,7 @@ uri = None if content.media_obj.external_publication_url: - uri = "%s#%d" % (content.media_obj.external_publication_url, begin) + uri = "%s#t=%d" % (content.media_obj.external_publication_url, begin) annotations.append({ 'begin': begin, @@ -124,12 +125,12 @@ 'uri':uri }) - - embed_rendered = escape(render_to_string('franceculture/partial/embed.html', {'json_url':json_url,'player_id':player_id, 'annotations':annotations}, context_instance=RequestContext(request))) - + embed_rendered = dict((typestr, + (lambda s:escape(lxml.etree.tostring(fromstring(render_to_string("franceculture/partial/embed_%s.html"%(s), {'json_url':json_url,'player_id':player_id, 'annotations':annotations}, context_instance=RequestContext(request))),pretty_print=True)))(typestr)) + for typestr in ('player','seo_body', 'seo_meta', 'links') ) return render_to_response("franceculture/embed_popup.html", - {'json_url':json_url,'player_id':player_id, 'player_embed_rendered':embed_rendered}, + {'json_url':json_url,'player_id':player_id, 'embed_rendered':embed_rendered, 'annotations':annotations}, context_instance=RequestContext(request)) diff -r 97b12f5f2c7a -r 9202807b4cec web/ldt/ldt_utils/forms.py --- a/web/ldt/ldt_utils/forms.py Wed Sep 29 10:10:07 2010 +0200 +++ b/web/ldt/ldt_utils/forms.py Tue Oct 12 03:23:33 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() diff -r 97b12f5f2c7a -r 9202807b4cec web/ldt/ldt_utils/models.py --- a/web/ldt/ldt_utils/models.py Wed Sep 29 10:10:07 2010 +0200 +++ b/web/ldt/ldt_utils/models.py Tue Oct 12 03:23:33 2010 +0200 @@ -22,7 +22,7 @@ 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, verify_exists=False, null=True, blank=True, verbose_name=_('media.external_permalink')) - external_publication_url = models.URLField(max_length=1024, verify_exists=False, null=True, blank=True, verbose_name=_('media.external_publication_url')) + 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')) diff -r 97b12f5f2c7a -r 9202807b4cec web/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm.html Tue Oct 12 03:23:33 2010 +0200 @@ -0,0 +1,28 @@ +{% load i18n %} {# form of creation of content #} +{% load adminmedia %} + + + + + {{title}} + + + + + + +
    +
    {% trans "error" %}
    +
    + {{ message }}: +
      + {% for error_msg in errors %} +
    • {{ error_msg }}
    • + {% endfor %} +
    + +
    +
    + + diff -r 97b12f5f2c7a -r 9202807b4cec web/ldt/ldt_utils/urls.py --- a/web/ldt/ldt_utils/urls.py Wed Sep 29 10:10:07 2010 +0200 +++ b/web/ldt/ldt_utils/urls.py Tue Oct 12 03:23:33 2010 +0200 @@ -18,6 +18,7 @@ url(r'^search/loading/$', 'views.loading'), url(r'^create/(?P.*)$', 'views.create_project'), url(r'^copy/(?P.*)$', 'views.copy_project'), + url(r'^update/(?P.*)$', 'views.update_project'), url(r'^cljson/id/(?P.*)$', 'views.project_json_id'), url(r'^cljson/externalid/(?P.*)$', 'views.project_json_externalid'), ) diff -r 97b12f5f2c7a -r 9202807b4cec web/ldt/ldt_utils/views.py --- a/web/ldt/ldt_utils/views.py Wed Sep 29 10:10:07 2010 +0200 +++ b/web/ldt/ldt_utils/views.py Tue Oct 12 03:23:33 2010 +0200 @@ -1,37 +1,40 @@ -import django.core.urlresolvers -from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden -from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404 +from Ft.Xml import MarkupWriter +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.forms.util import ErrorList +from django.http import HttpResponse, HttpResponseRedirect, \ + HttpResponseForbidden +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.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 models import * -from utils import * -from contentindexer import * from projectserializer import * from string import Template -from Ft.Xml import MarkupWriter +from urllib2 import urlparse +from utils import * +import base64 import cgi +import django.core.urlresolvers +import ldt.auth as ldt_auth +import ldt.utils.path as ldt_utils_path +import logging +import lucene +import tempfile +import urllib2 import uuid -import base64 -import lucene import xml.dom import xml.dom.ext import xml.dom.minidom -import tempfile -import urllib2 -from urllib2 import urlparse -from jogging import logging -import ldt.utils.path -import ldt.auth as ldt_auth -from django.utils.translation import ugettext as _ - def searchForm(request): @@ -159,11 +162,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/done.html', context_instance=RequestContext(request)) @@ -358,7 +365,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): @@ -377,6 +419,7 @@ def write_content_base(request, iri_id=None): + logging.debug(repr(request)) if iri_id: instance_content = Content.objects.get(iri_id=iri_id) instance_media = instance_content.media_obj @@ -408,59 +451,70 @@ elif media_input_type == "link": media = content_form.cleaned_data["media_obj"] created = False - elif media_input_type == "url" or media_input_type == "upload" or media_input_type == "create": + 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 - - 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 + 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: @@ -517,18 +571,61 @@ 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(write_content, kwargs={'iri_id':iri_id}) else: create_content_action = reverse(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() + \ No newline at end of file diff -r 97b12f5f2c7a -r 9202807b4cec web/ldt/locale/en/LC_MESSAGES/django.mo Binary file web/ldt/locale/en/LC_MESSAGES/django.mo has changed diff -r 97b12f5f2c7a -r 9202807b4cec web/ldt/locale/en/LC_MESSAGES/django.po --- a/web/ldt/locale/en/LC_MESSAGES/django.po Wed Sep 29 10:10:07 2010 +0200 +++ b/web/ldt/locale/en/LC_MESSAGES/django.po Tue Oct 12 03:23:33 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 \n" "Language-Team: LANGUAGE \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 (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 (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" diff -r 97b12f5f2c7a -r 9202807b4cec web/ldt/locale/fr/LC_MESSAGES/django.mo Binary file web/ldt/locale/fr/LC_MESSAGES/django.mo has changed diff -r 97b12f5f2c7a -r 9202807b4cec web/ldt/locale/fr/LC_MESSAGES/django.po --- a/web/ldt/locale/fr/LC_MESSAGES/django.po Wed Sep 29 10:10:07 2010 +0200 +++ b/web/ldt/locale/fr/LC_MESSAGES/django.po Tue Oct 12 03:23:33 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 \n" "Language-Team: LANGUAGE \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" @@ -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 (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" diff -r 97b12f5f2c7a -r 9202807b4cec web/static/css/embed_popup.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/static/css/embed_popup.css Tue Oct 12 03:23:33 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; +} + diff -r 97b12f5f2c7a -r 9202807b4cec web/static/css/ldtform.css --- a/web/static/css/ldtform.css Wed Sep 29 10:10:07 2010 +0200 +++ b/web/static/css/ldtform.css Tue Oct 12 03:23:33 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; +} + diff -r 97b12f5f2c7a -r 9202807b4cec web/static/css/workspace.css --- a/web/static/css/workspace.css Wed Sep 29 10:10:07 2010 +0200 +++ b/web/static/css/workspace.css Tue Oct 12 03:23:33 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; diff -r 97b12f5f2c7a -r 9202807b4cec web/static/img/ajax-loader-220x19.gif Binary file web/static/img/ajax-loader-220x19.gif has changed diff -r 97b12f5f2c7a -r 9202807b4cec web/static/js/embed_popup.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/static/js/embed_popup.js Tue Oct 12 03:23:33 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()); + }); + +}); diff -r 97b12f5f2c7a -r 9202807b4cec web/static/js/projectscontents.js --- a/web/static/js/projectscontents.js Wed Sep 29 10:10:07 2010 +0200 +++ b/web/static/js/projectscontents.js Tue Oct 12 03:23:33 2010 +0200 @@ -23,45 +23,24 @@ 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(); @@ -130,22 +109,30 @@ if(target.attr('timer')) { clearTimeout(target.attr('timer')); } - - target.attr('timer',setTimeout(function() { - target.next(".searchajaxloader").show(); - target.nextAll(".searchclear").hide(); - var filterVal = "_" + escape(target.realVal()); - url = url.replace('__FILTER__',filterVal); - $(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) + ); }; @@ -167,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(); } }); @@ -183,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(); } }); @@ -199,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); @@ -234,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) {