# HG changeset patch # User ymh # Date 1349476842 -7200 # Node ID 0ffe58cb50bfafe1d32b73fd912a81f7bb0f0199 # Parent 1df9868d8e16eff35397e0e16cb2c7b632292ed2# Parent c8126f9ce2b18d7be3f5491af69fb85bbc5df063 Merge with c8126f9ce2b18d7be3f5491af69fb85bbc5df063 diff -r 1df9868d8e16 -r 0ffe58cb50bf .hgtags --- a/.hgtags Thu Sep 20 17:06:25 2012 +0900 +++ b/.hgtags Sat Oct 06 00:40:42 2012 +0200 @@ -100,3 +100,9 @@ dfc0cb4355f4c62d62f9183809436c4510798011 V01.21 dfc0cb4355f4c62d62f9183809436c4510798011 V01.21 623bc24bee49c821af8db5318894343b0c071248 V01.21 +ce22eaa7f2e39f662284246e8117ec56f1f2bfea V01.22 +ca8127a4cdd5ff3d3d62021a59d413c04c136358 V01.23 +ca8127a4cdd5ff3d3d62021a59d413c04c136358 V01.23 +0000000000000000000000000000000000000000 V01.23 +0000000000000000000000000000000000000000 V01.23 +626573ed450f361c429b5208011f4285b689646f V01.23 diff -r 1df9868d8e16 -r 0ffe58cb50bf .settings/org.eclipse.core.resources.prefs --- a/.settings/org.eclipse.core.resources.prefs Thu Sep 20 17:06:25 2012 +0900 +++ b/.settings/org.eclipse.core.resources.prefs Sat Oct 06 00:40:42 2012 +0200 @@ -1,3 +1,4 @@ +#Fri Sep 28 10:36:06 CEST 2012 eclipse.preferences.version=1 encoding//src/ldt/ldt/core/migrations/0001_initial.py=utf-8 encoding//src/ldt/ldt/core/migrations/0002_auto__del_owner.py=utf-8 @@ -12,17 +13,24 @@ encoding//src/ldt/ldt/ldt_utils/migrations/0003_auto__chg_field_project_owner.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0004_auto__add_field_project_description.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0005_add_permissions.py=utf-8 +encoding//src/ldt/ldt/ldt_utils/migrations/0006_auto__add_field_media_image.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0007_auto__add_field_content_image__del_field_media_image.py=utf-8 +encoding//src/ldt/ldt/ldt_utils/migrations/0008_auto__add_field_project_image.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0009_auto__chg_field_content_image__chg_field_project_image.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0010_auto__add_annotationstat.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0011_gen_stat_annotation.py=utf-8 +encoding//src/ldt/ldt/ldt_utils/migrations/0012_auto__add_field_content_last_annotated.py=utf-8 +encoding//src/ldt/ldt/ldt_utils/migrations/0013_auto__add_field_content_front_project__chg_field_content_last_annotate.py=utf-8 +encoding//src/ldt/ldt/ldt_utils/migrations/0014_auto__del_annotationstat__chg_field_content_last_annotated.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0015_auto__add_contentstat__del_field_content_last_annotated__del_field_con.py=utf-8 +encoding//src/ldt/ldt/ldt_utils/migrations/0016_one_to_one_stat_annotation.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0017_correct_image_path.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0018_auto__chg_field_content_iri_id__chg_field_project_ldt_id__chg_field_au.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0019_recalculate_media_hash_src.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0020_auto__add_field_segment_id_hash__chg_field_segment_iri_id__chg_field_s.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0021_recalculate_segment_id_hash_script.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0022_auto__add_unique_media_src_hash__chg_field_segment_cutting_id__chg_fie.py=utf-8 +encoding//src/ldt/ldt/ldt_utils/migrations/0023_auto__add_field_segment_audio_src__add_field_segment_audio_href.py=utf-8 encoding//src/ldt/ldt/ldt_utils/views/json.py=utf-8 encoding//src/ldt/ldt/management/utils.py=utf-8 encoding//src/ldt/ldt/test/test_runner.py=utf-8 diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/__init__.py --- a/src/ldt/ldt/__init__.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/__init__.py Sat Oct 06 00:40:42 2012 +0200 @@ -1,4 +1,4 @@ -VERSION = (1, 21, 0, "final", 0) +VERSION = (1, 23, 0, "final", 0) def get_version(): diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/api/ldt/handlers.py --- a/src/ldt/ldt/api/ldt/handlers.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/api/ldt/handlers.py Sat Oct 06 00:40:42 2012 +0200 @@ -281,9 +281,9 @@ content = content[0] segments = Segment.objects.filter(content=content).filter( - Q(start_ts__gt=begin, start_ts__lt=end) | # segment starts between begin and end - Q(start_ts__gt=begin-F('duration'), start_ts__lt=end-F('duration')) |# segment ends between begin and end - Q(start_ts__lt=begin, start_ts__gt=end-F('duration')) # period [begin:end] is included in the segment + Q(start_ts__gte=begin, start_ts__lte=end) | # segment starts between begin and end + Q(start_ts__gte=begin-F('duration'), start_ts__lte=end-F('duration')) |# segment ends between begin and end + Q(start_ts__lte=begin, start_ts__gte=end-F('duration')) # period [begin:end] is included in the segment ) a = SegmentSerializer(content, segments) diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/forms/__init__.py --- a/src/ldt/ldt/forms/__init__.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/forms/__init__.py Sat Oct 06 00:40:42 2012 +0200 @@ -1,1 +1,7 @@ +from __future__ import absolute_import +from django.core.exceptions import ValidationError +from django.forms.fields import * +from django.forms.forms import * +from django.forms.models import * +from django.forms.widgets import * \ No newline at end of file diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/forms/fields.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/forms/fields.py Sat Oct 06 00:40:42 2012 +0200 @@ -0,0 +1,34 @@ +""" +Field classes. +""" + +from django import forms +from django.utils.translation import ugettext_lazy as _ +import logging +import time +import math + +__all__ = ( + 'LdtDurationField' +) + +class LdtDurationField (forms.TimeField): + default_error_messages = { + 'invalid': _(u'Enter a valid duration format'), + } + + def __init__(self, formats, *args, **kwargs): + self.formats = formats + super(LdtDurationField, self).__init__(*args, **kwargs) + + def clean(self, data): + dur = data + for format in self.formats: + try: + dur = time.strptime(dur, format) + dur = dur.tm_hour*3600 + dur.tm_min*60 + dur.tm_sec + dur = dur*1000 + break + except: + logging.debug("trying next format") + return dur \ No newline at end of file diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/forms/widgets.py --- a/src/ldt/ldt/forms/widgets.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/forms/widgets.py Sat Oct 06 00:40:42 2012 +0200 @@ -23,7 +23,7 @@ class LdtParseVideoDuration(TimeInput): """ - A widget allowing to enter the duration format : XhMM, XXhMM, XXXs, XXXsec, HH:MM, HH:MM:SS, HH:MM:SS.SS + A widget allowing to enter the duration format (eg: XhMM, XXhMM, HH:MM:SS) """ def value_from_datadict(self, data, files, name): @@ -33,7 +33,7 @@ dur = time.strptime(dur, format) dur = dur.tm_hour*3600 + dur.tm_min*60 + dur.tm_sec dur = dur*1000 + break except: logging.debug("trying next format") - data['content-duration']=dur - return data['content-duration'] \ No newline at end of file + return dur \ No newline at end of file diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/contentindexer.py --- a/src/ldt/ldt/ldt_utils/contentindexer.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/contentindexer.py Sat Oct 06 00:40:42 2012 +0200 @@ -83,6 +83,13 @@ ldt_id = u"" if project: ldt_id = project.ldt_id + # audio annotation management + audio_src = u"" + audio_href = u"" + audio_node = elementNode.xpath('audio') + if audio_node: + audio_src = audio_node[0].get(u"source", u"") + audio_href = audio_node[0].text seg = Segment(content=content, iri_id=content.iri_id, @@ -97,7 +104,9 @@ start_ts=start_ts, date=date_str, project_obj=project, - project_id=ldt_id) + project_id=ldt_id, + audio_src=audio_src, + audio_href=audio_href) seg.polemics = seg.get_polemic(polemics) seg.save() diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/forms.py --- a/src/ldt/ldt/ldt_utils/forms.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/forms.py Sat Oct 06 00:40:42 2012 +0200 @@ -1,7 +1,7 @@ from django import forms from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import Group -from ldt.forms import widgets as ldt_widgets +from ldt.forms import widgets as ldt_widgets, fields as ldt_fields from ldt.security.forms import ShareForm from models import Project, Content, Media from utils import generate_uuid @@ -54,7 +54,7 @@ groups = forms.ModelMultipleChoiceField(Group.objects.all(), required=False) is_public = forms.BooleanField(required=False) front_project = forms.ModelChoiceField(queryset=Project.objects.none(), required=False, label=_("content.front_project")) - duration = forms.IntegerField(required=True, label=_("content.duration")+" (Ms, H:M, H:M:S, HhM, Ss, Ssec)", widget=ldt_widgets.LdtParseVideoDuration(format=["%H:%M", "%H:%M:%S", "%Hh%M", "%Ss", "%Ssec"])) + duration = ldt_fields.LdtDurationField(required=True, label=_("content.duration")+" (Ms, M:S, H:M:S, HhM, Ss, Ssec)", formats=["%M:%S", "%H:%M:%S", "%Hh%M", "%Ss", "%Ssec"]) def clean_iri_id(self): data = self.cleaned_data.get('iri_id') @@ -92,6 +92,7 @@ media_creation_date = forms.SplitDateTimeField(widget=ldt_widgets.LdtSplitDateTime, required=False) media_file = forms.FileField(required=False); src = forms.CharField(required=False, max_length=1024) + media_public = forms.BooleanField(required=False) class Meta: model = Media diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/migrations/0023_auto__add_field_segment_audio_src__add_field_segment_audio_href.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/migrations/0023_auto__add_field_segment_audio_src__add_field_segment_audio_href.py Sat Oct 06 00:40:42 2012 +0200 @@ -0,0 +1,165 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.core.management import call_command +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'Segment.audio_src' + db.add_column('ldt_utils_segment', 'audio_src', + self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True), + keep_default=False) + + # Adding field 'Segment.audio_href' + db.add_column('ldt_utils_segment', 'audio_href', + self.gf('django.db.models.fields.CharField')(max_length=512, null=True, blank=True), + keep_default=False) + + # Reindex all contents and projects + call_command('reindex', projects=True) + + + def backwards(self, orm): + # Deleting field 'Segment.audio_src' + db.delete_column('ldt_utils_segment', 'audio_src') + + # Deleting field 'Segment.audio_href' + db.delete_column('ldt_utils_segment', 'audio_href') + + + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'ldt_utils.author': { + 'Meta': {'object_name': 'Author'}, + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'firstname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'handle': ('django.db.models.fields.CharField', [], {'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.content': { + 'Meta': {'ordering': "['title']", 'object_name': 'Content'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Author']", 'symmetrical': 'False', 'blank': 'True'}), + 'content_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'front_project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/contents/content_default_icon.png'", 'max_length': '200'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'default': "u'ac7c8438-08ba-11e2-a905-c8bcc896c290'", 'unique': 'True', 'max_length': '255'}), + 'iriurl': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'media_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Media']", 'null': 'True', 'blank': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) + }, + 'ldt_utils.contentstat': { + 'Meta': {'object_name': 'ContentStat'}, + 'annotation_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'stat_annotation'", 'unique': 'True', 'to': "orm['ldt_utils.Content']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_annotated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'blank': 'True'}), + 'nb_annotations': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}), + 'polemics_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.media': { + 'Meta': {'object_name': 'Media'}, + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_permalink': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_publication_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_src_url': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'media_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'mimetype_field': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'src': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'src_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'videopath': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + 'ldt_utils.project': { + 'Meta': {'ordering': "['title']", 'object_name': 'Project'}, + 'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'contents': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Content']", 'symmetrical': 'False'}), + 'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/projects/project_default_icon.png'", 'max_length': '200'}), + 'ldt': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'ldt_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024'}) + }, + 'ldt_utils.segment': { + 'Meta': {'object_name': 'Segment'}, + 'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'audio_href': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'audio_src': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'author': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Content']"}), + 'cutting_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}), + 'date': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'element_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}), + 'ensemble_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'id_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'polemics': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}), + 'project_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'project_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True'}), + 'start_ts': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['ldt_utils'] \ No newline at end of file diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/models.py --- a/src/ldt/ldt/ldt_utils/models.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/models.py Sat Oct 06 00:40:42 2012 +0200 @@ -95,6 +95,27 @@ stream_src = property(**stream_src()) + def is_public(): #@NoSelf + + def fget(self): + if self.pk: + everyone = Group.objects.get(name=settings.PUBLIC_GROUP_NAME) + if 'view_media' in get_perms(everyone, self): + return True + return False + + def fset(self, value): + if self.pk: + everyone = Group.objects.get(name=settings.PUBLIC_GROUP_NAME) + if value: + assign('ldt_utils.view_media', everyone, self.media_obj) + else: + remove_perm('ldt_utils.view_media', everyone, self.media_obj) + + return locals() + + is_public = property(**is_public()) + def save(self, *args, **kwargs): self.src_hash = generate_hash(self.src) super(Media, self).save(*args, **kwargs) @@ -343,11 +364,9 @@ if self.pk: everyone = Group.objects.get(name=settings.PUBLIC_GROUP_NAME) if value: - assign('ldt_utils.view_content', everyone, self) - assign('ldt_utils.view_media', everyone, self.media_obj) + assign('ldt_utils.view_content', everyone, self) else: remove_perm('ldt_utils.view_content', everyone, self) - remove_perm('ldt_utils.view_media', everyone, self.media_obj) return locals() @@ -681,6 +700,8 @@ abstract = models.TextField(null=True, blank=True) polemics = models.IntegerField(null=True, blank=True, default=0) id_hash = models.CharField(max_length=128, unique=True, blank=True) + audio_src = models.CharField(max_length=255, unique=False, null=True, blank=True) + audio_href = models.CharField(max_length=512, unique=False, null=True, blank=True) # All combinations of polemic hashtags can be represented by a combination of diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/projectserializer.py --- a/src/ldt/ldt/ldt_utils/projectserializer.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/projectserializer.py Sat Oct 06 00:40:42 2012 +0200 @@ -196,7 +196,7 @@ res = element_node.xpath("audio") if len(res) > 0: element_audio_src = res[0].get(u"source", u"") - element_audio_href = res[0].text + element_audio_href = res[0].text element_tags = [] diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/segmentserializer.py --- a/src/ldt/ldt/ldt_utils/segmentserializer.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/segmentserializer.py Sat Oct 06 00:40:42 2012 +0200 @@ -171,8 +171,8 @@ 'polemics': [ ], 'audio': { 'mimetype': 'audio/mp3', - 'src': '', - 'href': 'null' + 'src': seg.audio_src, + 'href': seg.audio_href } }, diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html Sat Oct 06 00:40:42 2012 +0200 @@ -1,16 +1,16 @@ -{% extends "ldt/ldt_raw_base.html" %} +{% extends "ldt/ldt_utils/workspace_base.html" %} +{% load i18n %} -{% load i18n %} {# form of creation of content #} + {# form of creation of content #} {% load adminmedia %} {% block js_import %} {{ block.super }} + - - @@ -18,15 +18,6 @@ {{ content_form.media.js }} {% endblock %} -{% block css_import %} - {{ block.super }} - {{ content_form.media.css }} - - - - -{% endblock %} - {% block js_declaration %} {% endblock %} -{% block body %} +{% block css_import %} + {{ block.super }} + {{ content_form.media.css }} + + + + + + + +{% endblock %} +{% block content %} + + {% if media_form.errors %}

{% trans "The operation could not be performed because one or more error(s) occurred.
Please resubmit the media form after making the following changes:" %}

@@ -85,6 +84,7 @@
{% trans "Create content" %}
+
{% csrf_token %} @@ -121,19 +121,18 @@
-
{% trans 'More options' %}
- + {% else %}
{{ content_form.front_project }}
{% endif %} {% include "ldt/ldt_utils/partial/picture.html"%} {% include "ldt/ldt_utils/partial/permissions.html" %} -
- +
@@ -142,7 +141,7 @@  
- + {% if iri_id %}{% endif %}
diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_group.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_group.html Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_group.html Sat Oct 06 00:40:42 2012 +0200 @@ -6,8 +6,8 @@ {% block js_import %} {{ block.super }} - - + + {{ content_form.media.js }} diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_iframe.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_iframe.html Sat Oct 06 00:40:42 2012 +0200 @@ -0,0 +1,25 @@ +{% load i18n %} +{% load analytics %} + + + + + + + + + + Ligne de Temps - IRI - Metadata Player + + +
+ {% include "ldt/ldt_utils/partial/embed_player.html" %} +
+ {% if annotations_list %} +
+ {% endif %} +{% analytics %} + + + diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html Sat Oct 06 00:40:42 2012 +0200 @@ -37,7 +37,6 @@
{% trans 'project id' %} ({% trans 'Select' %}) :
-
{% include "ldt/ldt_utils/partial/embed_player.html" %}
diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm.html Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm.html Sat Oct 06 00:40:42 2012 +0200 @@ -1,4 +1,4 @@ -{% extends "ldt/ldt_raw_base.html" %} +{% extends "ldt/ldt_utils/workspace_base.html" %} {% load i18n %} {# form of creation of content #} @@ -11,24 +11,11 @@ {% block css_import %} {{ block.super }} {{ content_form.media.css }} - {% endblock %} -{% block js_declaration %} - -{% endblock %} - -{% block body %} +{% block content %}
{% if errors|length > 0 %}{% trans "error" %}{% else %}{% trans "confirm" %}{% endif %}
@@ -45,15 +32,12 @@
- {% if errors|length > 0 %} - - {% else %} {% csrf_token %} - - + + {% if errors|length <= 0 %}{% endif %} - {% endif %} +
diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm_popup.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm_popup.html Sat Oct 06 00:40:42 2012 +0200 @@ -0,0 +1,61 @@ +{% 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 }} + + +{% 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 %} \ No newline at end of file diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/groups.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/groups.html Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/groups.html Sat Oct 06 00:40:42 2012 +0200 @@ -98,7 +98,7 @@
-
loader
+
loader
@@ -110,7 +110,7 @@
{% trans "The group's projects" %}
-
loader
+
loader
diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html Sat Oct 06 00:40:42 2012 +0200 @@ -9,6 +9,7 @@ IriSP.libFiles.defaultDir = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}js/"; IriSP.libFiles.locations.jwPlayerSWF = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}swf/player.swf"; +IriSP.libFiles.locations.recordMicSwf = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}swf/record_mic.swf"; IriSP.libFiles.locations.zeroClipboardSwf = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}swf/ZeroClipboard10.swf"; IriSP.libFiles.locations.cssjQueryUI = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}css/jq-css/themes/base/jquery-ui.css" IriSP.language = '{{LANGUAGE_CODE}}'; @@ -48,29 +49,31 @@ }, { type: "Polemic" - },{ + {% if polemic == 'all' %} + ,annotation_type: false + {% endif %} + }, + {% if polemic != 'all' %} + { type: "Sparkline" - },{ + }, + {% endif %} + { type: "Slider" },{ type: "AnnotationsList", container: "AnnotationsList_ext", - ajax_url: "{% url segment_api_empty %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}", + ajax_url: "{{WEB_URL}}{% url segment_api_empty %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}", ajax_granularity : 300000, - default_thumbnail : "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}css/imgs/video_sequence.png" + default_thumbnail : "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}css/imgs/video_sequence.png", + show_audio: true, + rtmp_streamer: "rtmp://media.iri.centrepompidou.fr/ddc_micro_record/" },{ type: "Controller" },{ type: "Segments", annotation_type: ["chap","découpage"] },{ - type: "Slice", - start_visible : false, - live_update : true - },{ - type: "Arrow", - base_height: 3 - },{ type: "Annotation", start_minimized: true, site_name : "Lignes de Temps", @@ -80,11 +83,12 @@ hide_timeout: 5000 },{ type: "CreateAnnotation", - api_endpoint_template: "{% url annotation_api_empty %}{% templatetag openvariable %}id{% templatetag closevariable %}.json", + api_endpoint_template: "{{WEB_URL}}{% url annotation_api_empty %}{% templatetag openvariable %}id{% templatetag closevariable %}.json", api_method: "PUT", after_send_timeout: 8000, + show_mic_record: {% if show_mic_record %}true{% else %}false{% endif %}, close_after_send: false, - tag_titles: ["#amateur", "#digital-humanities"], + slice_annotation_type: ["chap","découpage"], creator_name: '{{request.user.username}}', creator_avatar: '{% thumbnail request.user.get_profile.image "48x48" format="PNG" crop="center" as im %}{{WEB_URL}}{{ im.url }}{% endthumbnail %}' || "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png" },{ diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/permissions.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/permissions.html Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/permissions.html Sat Oct 06 00:40:42 2012 +0200 @@ -31,16 +31,21 @@ ]; searchFieldInit(input_list_init); - $("#public input[type=checkbox]").change(function () { + $("#media_public input[type=checkbox]").change(function () { if ($(this).is(':checked')) { $("#permissioncontainer").hide(); } else { $("#permissioncontainer").show(); } - resize_modal_window("#add_content"); }); - + $("#content_public input[type=checkbox]").change(function () { + if ($(this).is(':checked')) { + $("#media_public input[type=checkbox]").attr('disabled', false) + } else { + $("#media_public input[type=checkbox]").attr('disabled', true) + } + }); $(".can_edit").live('click', function () { $(this).attr('src', can_view); @@ -110,15 +115,21 @@
- {% if content_form %} -
{{ content_form.is_public }}
+ {% if media_form %} +
{{ media_form.media_public }}
{% endif %} -
+
+
{{ content_form.is_public }}
+
{% trans "User and group list" %}
-
loader
+
+ + loader + +


@@ -136,7 +147,7 @@
- +

{% trans "Members list" %} diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/picture.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/picture.html Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/picture.html Sat Oct 06 00:40:42 2012 +0200 @@ -33,6 +33,7 @@ + {% for error in profile_picture_form.image.errors %} {{ error }} diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/reset_confirm.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/reset_confirm.html Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/reset_confirm.html Sat Oct 06 00:40:42 2012 +0200 @@ -1,4 +1,4 @@ -{% extends "ldt/ldt_raw_base.html" %} +{% extends "ldt/ldt_utils/workspace_base.html" %} {% load i18n %} {# form of creation of content #} @@ -16,19 +16,7 @@ {% endblock %} -{% block js_declaration %} - -{% endblock %} - -{% block body %} +{% block content %}
{% if errors|length > 0 %}{% trans "error" %}{% else %}{% trans "confirm_reset" %}{% endif %}
@@ -45,15 +33,12 @@
- {% if errors|length > 0 %} - - {% else %}
{% csrf_token %} - - + + {% if errors|length <= 0 %}{% endif %}
- {% endif %} +
diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/reset_confirm_popup.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/reset_confirm_popup.html Sat Oct 06 00:40:42 2012 +0200 @@ -0,0 +1,61 @@ +{% 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 }} + + +{% 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 %} \ No newline at end of file diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/workspace_base.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/workspace_base.html Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/workspace_base.html Sat Oct 06 00:40:42 2012 +0200 @@ -52,7 +52,11 @@
{% trans "content list" %} {% trans 'Create content' %}
-
loader
+
+ + loader + +
diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/urls.py --- a/src/ldt/ldt/ldt_utils/urls.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/urls.py Sat Oct 06 00:40:42 2012 +0200 @@ -25,7 +25,7 @@ url(r'^update/(?P.*)$', 'views.project.update_project'), url(r'^cljson/id/(?P.*)$', 'views.json.project_json_id', name="projectjson_id"), url(r'^cljson/externalid/(?P.*)$', 'views.json.project_json_externalid', name="projectjson_externalid"), - url(r'cljson/idcutting/(?P.*)/(?P.*)$', 'views.json.project_json_cutting_id'), + url(r'^cljson/idcutting/(?P.*)/(?P.*)$', 'views.json.project_json_cutting_id'), url(r'^rdf/id/(?P.*)$', 'views.rdf.project_annotations_rdf'), url(r'^workspace/?$', "views.workspace.home", name="root-view"), url(r'^filterprojects/_(?P[\w\%\_\-\+]*?)/(?Ptrue|false)/(?P\d)$', "views.project.projects_filter",), @@ -33,7 +33,8 @@ url(r'^filtercontents/_(?P[\w\%\_\-\+]*?)/$', "views.content.contents_filter",), url(r'^filtergroups/_(?P[\w\%\_\-\+]*?)/$', "views.group.groups_filter",), url(r'filtershare/_(?P[\w\%\_\-\+]*?)/(?Ptrue|false)$', "views.workspace.share_filter"), - (r'^embedpopup/?$', "views.workspace.popup_embed"), + url(r'^embedpopup/?$', "views.workspace.popup_embed"), + url(r'^embediframe/?$', "views.workspace.iframe_embed"), url(r'^segment/(?P.*)/(?P.*)/(?P.*)/(?P.*)/(?P.*)/$', 'views.lignesdetemps.index_segment'), url(r'^segmentInit/(?P.*)/(?P.*)/(?P.*)/(?P.*)/(?P.*)/$', 'views.lignesdetemps.init_segment'), url(r'^segmentLdt/(?P.*)/(?P.*)/(?P.*)/(?P.*)/(?P.*)/$', 'views.lignesdetemps.ldt_segment'), diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/views/content.py --- a/src/ldt/ldt/ldt_utils/views/content.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/views/content.py Sat Oct 06 00:40:42 2012 +0200 @@ -3,9 +3,11 @@ from django.contrib.auth.models import Group from django.core.urlresolvers import reverse from django.forms.models import model_to_dict +from django.core.files import File +#from django.core.files.temp import NamedTemporaryFile from django.forms.util import ErrorList -from django.http import HttpResponse -from django.shortcuts import render_to_response +from django.http import HttpResponse, HttpResponseRedirect +from django.shortcuts import render_to_response, redirect from django.template import RequestContext from django.utils.translation import ugettext as _, ungettext from ldt.ldt_utils.forms import ContentForm, MediaForm @@ -18,7 +20,7 @@ import ldt.utils.path as ldt_utils_path import logging import mimetypes -import os +import os, stat import urllib2 import subprocess import re @@ -26,10 +28,11 @@ import math import requests import django.utils.simplejson as simplejson -import urlparse +import urlparse +import tempfile def write_content_base(request, iri_id=None): - if iri_id: + if iri_id: instance_content = Content.safe_objects.get(iri_id=iri_id) #@UndefinedVariable instance_media = instance_content.media_obj logging.debug("write_content_base : valid form: for instance : media -> " + repr(instance_media) + " content : for instance : " + repr(instance_content)) #@UndefinedVariable @@ -40,8 +43,7 @@ current_front_project = None if instance_content: current_front_project = instance_content.front_project - - form_status = 'none' + form_status = 'none' if request.method == "POST": if instance_content is not None: @@ -59,8 +61,8 @@ return dict([('%s-%s' % (prefix, key), value) for key,value in _dict.items()]) content_instance_val = add_prefix(content_instance_val, "content") - media_instance_val= add_prefix(media_instance_val, "media") - + media_instance_val= add_prefix(media_instance_val, "media") + for k in request.POST.keys(): value = request.POST.get(k) content_instance_val[k] = value @@ -69,11 +71,11 @@ content_instance_val['read_list'] = request.POST.getlist('read_list') content_instance_val['write_list'] = request.POST.getlist('write_list') content_instance_val['share'] = request.POST.get('share', True) - + content_form = ContentForm(content_instance_val, prefix="content", instance=instance_content) media_form = MediaForm(media_instance_val, request.FILES, prefix="media", instance=instance_media) picture_form = PictureForm(None, request.POST, request.FILES) - + if request.user.is_staff: content_form.fields['front_project'].queryset = Project.objects.filter(contents__in=[instance_content]) @@ -81,14 +83,26 @@ media_valid = media_form.is_valid() content_valid = content_form.is_valid() picture_valid = picture_form.is_valid() - - logging.debug("write_content_base : valid form: for instance : " + repr(instance_media) + " -> media " + str(media_valid) + " content : for instance : " + repr(instance_content) + " : " + str(content_valid)) #@UndefinedVariable + if 'image' in request.POST.keys(): + image_link = request.POST.get('url_image') + if picture_valid and image_link!='' : + try : + r = requests.get(image_link) + img_temp = tempfile.NamedTemporaryFile(suffix='.png') + if img_temp: + img_temp.write(r.content) + img_temp.flush() + picture_form.cleaned_data["image"]=File(img_temp) + except Exception as inst: + logging.debug("couldn't download video thumbnail from image_link : "+str(image_link)) + logging.debug("write_content_base : valid form: for instance : " + repr(instance_media) + " -> media " + str(media_valid) + " content : for instance : " + repr(instance_content) + " : " + str(content_valid) + "picture : valid :" +str(picture_valid)+" loulou") #@UndefinedVariable if media_valid and content_valid and picture_valid: # see if media must be created cleaned_data = {} cleaned_data.update(media_form.cleaned_data) + cleaned_data.pop("media_public") media_input_type = content_form.cleaned_data["media_input_type"] @@ -221,16 +235,20 @@ cached_assign('view_content', request.user, content) everyone = Group.objects.get(name=settings.PUBLIC_GROUP_NAME) - if content_form.cleaned_data['is_public']: + if media_form.cleaned_data['media_public']: cached_assign('view_content', everyone, content) if media: cached_assign('view_media', everyone, media) else: - remove_perm('ldt_utils.view_content', everyone, content) remove_perm('ldt_utils.view_media', everyone, media) - assign_perm_to_obj(content, content_form.cleaned_data['read_list'], content_form.cleaned_data['write_list'], request.user) if media: assign_perm_to_obj(media, content_form.cleaned_data['read_list'], content_form.cleaned_data['write_list'], request.user) + assign_perm_to_obj(content, content_form.cleaned_data['read_list'], content_form.cleaned_data['write_list'], request.user) + if content_form.cleaned_data['is_public']: + cached_assign('view_content', everyone, content) + else: + remove_perm('ldt_utils.view_content', everyone, content) + if not created: for attribute in ('iriurl', 'title', 'description', 'duration', 'content_creation_date', 'tags', 'media_obj'): setattr(content, attribute, content_defaults[attribute]) @@ -241,7 +259,6 @@ content.save() picture_form.model = content picture_form.save() - form_status = 'saved' media_form = MediaForm(instance=media, prefix="media") content_form = ContentForm(instance=content, prefix="content") @@ -250,14 +267,18 @@ form_status = 'error' else: form_status = 'empty' - initial = { 'media_input_type':"link"} - if instance_content: - initial['is_public'] = instance_content.is_public + initial_c = { 'media_input_type':"link"} + initial_m = {} + if instance_media: + initial_m['media_public'] = instance_media.is_public else: - initial['is_public'] = True - - content_form = ContentForm(prefix="content", instance=instance_content, initial=initial) - media_form = MediaForm(prefix="media", instance=instance_media) + initial_m['media_public'] = True + if instance_content: + initial_c['is_public'] = instance_content.is_public + else: + initial_c['is_public'] = True + content_form = ContentForm(prefix="content", instance=instance_content, initial=initial_c) + media_form = MediaForm(prefix="media", instance=instance_media, initial=initial_m) picture_form = PictureForm() if instance_content is not None: @@ -269,7 +290,7 @@ return content_form, media_form, picture_form, form_status, current_front_project @login_required -def write_content(request, iri_id=None): +def write_content(request, iri_id=None): submit_action = request.REQUEST.get("submit_button", False) member_list = admin_list = [] current_front_project = None @@ -289,15 +310,42 @@ content_form = ContentForm() media_form = MediaForm() picture_form = PictureForm() + elif submit_action == "prepare_reset": + errors=[] + content_temp = Content.objects.get(iri_id=iri_id) + if content_temp.front_project.state==2: + errors.append(_("Please unpublish the front project %(title)s") % {'title':content_temp.front_project.title}) + message=_("The front project is published") + title = _("confirm reset") + else: + message = _("please confirm reseting project %(title)s") % {'title':content_temp.front_project.title} + title = _("confirm reset") + return render_to_response('ldt/ldt_utils/reset_confirm.html', {'errors':errors, 'message':message, 'title': title}, context_instance=RequestContext(request)) + elif submit_action == "reset": + #TODO : verifier index de la recherche maj + content = Content.objects.get(iri_id=iri_id) + project_temp = content.front_project + content.create_front_project() + content.save() + project_temp.delete() + form_status= 'saved' + return HttpResponseRedirect(reverse('ldt.ldt_utils.views.content.write_content', kwargs={'iri_id':iri_id})) + elif submit_action=="close": + return redirect("root-view") else: content_form, media_form, picture_form, form_status, current_front_project = write_content_base(request, iri_id) if iri_id: - member_list, admin_list = get_userlist_model(Content.objects.get(iri_id=iri_id), request.user) - + content_temp = Content.objects.get(iri_id=iri_id) + media_temp = content_temp.media_obj + if media_temp: + member_list, admin_list = get_userlist_model(media_temp, request.user) + else: + member_list, admin_list = get_userlist_model(content_temp, request.user) if iri_id: create_content_action = reverse('ldt.ldt_utils.views.content.write_content', kwargs={'iri_id':iri_id}) img_container = content_form.instance - else: + + else: create_content_action = reverse('ldt.ldt_utils.views.content.write_content') img_container = '' @@ -306,11 +354,17 @@ # Media.safe_objects.all() does not return the good list of media, so we get them from the Content.safe_objects content_form.fields["media_obj"].queryset = Media.objects.filter(id__in=Content.safe_objects.values_list('media_obj', flat=True)) - 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, - 'elem_list': get_userlist(request.user), 'member_list': member_list, 'admin_list': admin_list, 'iri_id': iri_id, 'session_key':session_key, + if form_status=='saved' or form_status=='deleted': + return redirect("root-view") + else: + group_list = Group.objects.all() + group_list = group_list.exclude(name=settings.PUBLIC_GROUP_NAME) + group_list = [{'name': u.name, 'id': u.id, 'type': 'group'} for u in group_list[0:settings.MAX_USERS_SEARCH]] + elem_list = get_userlist(request.user) + group_list + return render_to_response('ldt/ldt_utils/create_content.html', {'content_form': content_form, 'media_form': media_form, 'form_status': form_status, 'create_content_': create_content_action, + 'elem_list':elem_list, 'member_list': member_list, 'admin_list': admin_list, 'iri_id': iri_id, 'session_key':session_key, 'cookie_name':cookie_name, 'img_container': img_container, 'profile_picture_form': picture_form, 'current_front_project':current_front_project}, context_instance=RequestContext(request)) - @login_required def prepare_delete_content(request, iri_id=None): errors = [] @@ -444,41 +498,3 @@ else : return Tag.objects.cloud_for_model(Content, steps=steps)[:limit] -def get_json(src_video): - if 'youtube' in src_video: - url_data=urlparse.urlparse(src_video) - query=urlparse.parse_qs(url_data.query) - video_id=query['v'][0] - lien='http://gdata.youtube.com/feeds/api/videos/'+video_id+'?v=2&alt=jsonc' - elif 'vimeo' in src_video: - url_data=urlparse.urlparse(src_video) - url_path=url_data.path - video_id=(url_path.split('/'))[1] - lien='http://vimeo.com/api/v2/video/'+video_id+'.json' - elif 'dailymotion' in src_video: - url_data=urlparse.urlparse(src_video) - video_path=url_data.path - split_path=(video_path.split('/'))[2] - video_id=(split_path.split('_'))[0] - lien='https://api.dailymotion.com/video/'+video_id+'?fields=id,duration,title' - resp=requests.get(lien) - data=simplejson.loads(resp.content) - return data - -def get_duration_json(src_video, data): - if 'youtube' in src_video: - duration=data['data']['duration']*1000 - elif 'vimeo' in src_video: - duration=data[0]['duration']*1000 - else: - duration=data['duration']*1000 - return duration - -def get_title_json(src_video, data): - if 'youtube' in src_video: - title=data['data']['title'] - elif 'vimeo' in src_video: - title=data[0]['title'] - else: - title=data['title'] - return title diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/views/front.py --- a/src/ldt/ldt/ldt_utils/views/front.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/views/front.py Sat Oct 06 00:40:42 2012 +0200 @@ -17,9 +17,9 @@ def front_home(request): # Get the 3 last annotated contents - last_contents = Content.objects.order_by('-stat_annotation__last_annotated').exclude(stat_annotation__nb_annotations=0)[:3] + last_contents = Content.safe_objects.order_by('-stat_annotation__last_annotated').exclude(stat_annotation__nb_annotations=0)[:3] # Get the most annotated contents - most_contents = Content.objects.order_by('-stat_annotation__nb_annotations')[:8] + most_contents = Content.safe_objects.order_by('-stat_annotation__nb_annotations')[:8] # Get the active groups active_groups = Group.objects.exclude(name=settings.PUBLIC_GROUP_NAME)[:5] # Get the main tag list @@ -65,11 +65,11 @@ tag_label = request.GET.get("tag") # Get all the public contents group if tag_label is None : - content_list = Content.objects.all() + content_list = Content.safe_objects.all() else : - content_list = TaggedItem.objects.get_by_model(Content.objects.all(), '"'+tag_label+'"') + content_list = TaggedItem.objects.get_by_model(Content.safe_objects.all(), '"'+tag_label+'"') else : - content_list = Content.objects.filter(title__icontains=media_title) + content_list = Content.safe_objects.filter(title__icontains=media_title) nb = settings.LDT_FRONT_MEDIA_PER_PAGE diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/views/group.py --- a/src/ldt/ldt/ldt_utils/views/group.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/views/group.py Sat Oct 06 00:40:42 2012 +0200 @@ -33,7 +33,7 @@ @login_required def create_group(request): - if not request.user.has_perm('add_group'): + if not request.user.has_perm('auth.add_group'): return HttpResponseServerError('

User %s can not create a group.

' % request.user.username) form_status = '' @@ -65,7 +65,6 @@ elem.groups.add(group) if elem in admin_list: cached_assign('change_group', elem, group) - form_status = 'saved' else: group.delete() diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/views/project.py --- a/src/ldt/ldt/ldt_utils/views/project.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/views/project.py Sat Oct 06 00:40:42 2012 +0200 @@ -103,11 +103,11 @@ contents = project.contents.all() groups = request.user.groups.exclude(name=settings.PUBLIC_GROUP_NAME) member_list, admin_list = get_userlist_model(project, request.user) + display_reset= False - if contents[0].front_project.ldt_id == ldt_id: - display_reset = True - else: - display_reset= False + if contents[0].front_project != None: + if contents[0].front_project.ldt_id == ldt_id: + display_reset = True if request.method == "POST" : submit_action = request.REQUEST.get("submit_button", False) @@ -124,7 +124,7 @@ 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)) + return render_to_response('ldt/ldt_utils/error_confirm_popup.html', {'errors':errors, 'message':message, 'title': title}, context_instance=RequestContext(request)) elif submit_action == "delete": if project.state != 2: project.delete() @@ -135,7 +135,7 @@ errors=[] message = _("please confirm reseting project %(title)s") % {'title':project.title} title = _("confirm reset") - return render_to_response('ldt/ldt_utils/reset_confirm.html', {'errors':errors, 'message':message, 'title': title}, context_instance=RequestContext(request)) + return render_to_response('ldt/ldt_utils/reset_confirm_popup.html', {'errors':errors, 'message':message, 'title': title}, context_instance=RequestContext(request)) elif submit_action == "reset": #TODO : verifier index de la recher maj contents[0].create_front_project() diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/ldt_utils/views/workspace.py --- a/src/ldt/ldt/ldt_utils/views/workspace.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/ldt_utils/views/workspace.py Sat Oct 06 00:40:42 2012 +0200 @@ -24,6 +24,7 @@ import django.core.urlresolvers import ldt.auth as ldt_auth import lxml.etree +import logging @login_required @@ -100,9 +101,61 @@ json_url = request.GET.get("json_url") player_id = request.GET.get("player_id") ldt_id = request.GET.get("ldt_id") + + rend_dict = get_datas_for_embed(request, json_url, player_id, ldt_id) + + embed_rendered = dict((typestr, + (lambda s:escape(render_to_string("ldt/ldt_utils/partial/embed_%s.html" % (s), rend_dict, context_instance=RequestContext(request))))(typestr)) + for typestr in ('player', 'seo_body', 'seo_meta', 'links')) + rend_dict['embed_rendered'] = embed_rendered + return render_to_response("ldt/ldt_utils/embed_popup.html", rend_dict, context_instance=RequestContext(request)) + + +def iframe_embed(request): + + project_id = request.GET.get("project_id") + if not project_id: + content_id = request.GET.get("content_id") + try: + content = Content.safe_objects.get(iri_id=content_id) + except: + return HttpResponseForbidden(_("The content does not exists or you are not allowed to access this content")) + project = content.get_or_create_front_project() + project_id = project.ldt_id + if not project_id : + return HttpResponseForbidden(_("Parameters project_id or content_id must be given in the url")) + + json_url = reverse("projectjson_id", args=[project_id]) + player_id = "player_project_" + project_id + ldt_id = project_id + rend_dict = get_datas_for_embed(request, json_url, player_id, ldt_id) + + # Manage iframe options + if request.GET.has_key("polemic"): + rend_dict["polemic"] = request.GET.get("polemic") + if request.GET.has_key("show_mic_record"): + rend_dict["show_mic_record"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_mic_record").lower()) + if request.GET.has_key("annotations_list"): + rend_dict["annotations_list"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("annotations_list").lower()) + rend_dict["player_width"] = 550 + + + return render_to_response("ldt/ldt_utils/embed_iframe.html", rend_dict, context_instance=RequestContext(request)) + + +def get_datas_for_embed(request, json_url, player_id, ldt_id): + project = Project.safe_objects.get(ldt_id=ldt_id); #@UndefinedVariable - + project_contents = project.contents.all() + content=project_contents[0] + external_url = None + if content.src is not None: + for external_src in settings.EXTERNAL_STREAM_SRC: + if external_src in content.src: + external_url = content.src + break + stream_mode = project.stream_mode if stream_mode != "video": stream_mode = 'radio' @@ -116,21 +169,13 @@ if not ldt_auth.check_access(request.user, project): return HttpResponseForbidden(_("You can not access this project")) - ps = ProjectSerializer(project, from_contents=False, from_display=True) + ps = ProjectSerializer(project, from_contents=True, from_display=True) annotations = ps.get_annotations(first_cutting=True) + rend_dict = {'json_url':json_url, 'player_id':player_id, 'annotations':annotations, 'ldt_id': ldt_id, 'stream_mode': stream_mode, + 'player_width': player_width, 'player_height': player_height, 'external_url': external_url, + 'polemic':False, 'show_mic_record':False, 'annotations_list':False} - rend_dict = {'json_url':json_url, 'player_id':player_id, 'annotations':annotations, 'ldt_id': ldt_id, 'stream_mode': stream_mode, 'player_width': player_width, 'player_height': player_height} - - embed_rendered = dict((typestr, - (lambda s:escape(lxml.etree.tostring(fragment_fromstring(render_to_string("ldt/ldt_utils/partial/embed_%s.html" % (s), rend_dict, context_instance=RequestContext(request))), pretty_print=True)))(typestr)) - for typestr in ('player', 'seo_body', 'seo_meta', 'links')) - - rend_dict['embed_rendered'] = embed_rendered - - return render_to_response("ldt/ldt_utils/embed_popup.html", - rend_dict, - context_instance=RequestContext(request)) - + return rend_dict @@ -257,4 +302,3 @@ return render_to_response('ldt/ldt_utils/loading.html', context_instance=RequestContext(request)) - diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/locale/fr/LC_MESSAGES/django.mo Binary file src/ldt/ldt/locale/fr/LC_MESSAGES/django.mo has changed diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/locale/fr/LC_MESSAGES/django.po --- a/src/ldt/ldt/locale/fr/LC_MESSAGES/django.po Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/locale/fr/LC_MESSAGES/django.po Sat Oct 06 00:40:42 2012 +0200 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-09-18 13:45+0200\n" +"POT-Creation-Date: 2012-10-01 11:26+0200\n" "PO-Revision-Date: 2010-03-09 15:52+0100\n" "Last-Translator: Yves-Marie Haussonne \n" "Language-Team: LANGUAGE \n" @@ -58,7 +58,7 @@ msgid "Content Tag" msgstr "Catégorie de contenu" -#: .\ldt_utils\forms.py:52 .\ldt_utils\models.py:134 +#: .\ldt_utils\forms.py:52 .\ldt_utils\models.py:155 msgid "content.content_creation_date" msgstr "Date de création du contenu" @@ -90,7 +90,7 @@ msgid "content.front_project" msgstr "Choisir le front project" -#: .\ldt_utils\forms.py:57 .\ldt_utils\models.py:133 +#: .\ldt_utils\forms.py:57 .\ldt_utils\models.py:154 msgid "content.duration" msgstr "Durée" @@ -150,59 +150,59 @@ msgid "media.mimetype" msgstr "mimetype" -#: .\ldt_utils\models.py:126 +#: .\ldt_utils\models.py:147 msgid "content.iri_id" msgstr "iri id" -#: .\ldt_utils\models.py:127 +#: .\ldt_utils\models.py:148 msgid "content.iriurl" msgstr "iri url" -#: .\ldt_utils\models.py:128 +#: .\ldt_utils\models.py:149 msgid "content.creation_date" msgstr "date de création" -#: .\ldt_utils\models.py:129 +#: .\ldt_utils\models.py:150 msgid "content.update_date" msgstr "Date de maj" -#: .\ldt_utils\models.py:130 +#: .\ldt_utils\models.py:151 msgid "content.title" msgstr "titre" -#: .\ldt_utils\models.py:131 +#: .\ldt_utils\models.py:152 msgid "content.description" msgstr "Description" -#: .\ldt_utils\models.py:132 +#: .\ldt_utils\models.py:153 msgid "content.authors" msgstr "Auteurs" -#: .\ldt_utils\models.py:453 +#: .\ldt_utils\models.py:472 msgid "content_stat.content" msgstr "statistiques d'annotation" -#: .\ldt_utils\models.py:454 +#: .\ldt_utils\models.py:473 msgid "content_stat.annotations_volume" msgstr "Volume d'annotations" -#: .\ldt_utils\models.py:455 +#: .\ldt_utils\models.py:474 msgid "content_stat.polemics_volume" msgstr "Volume d'annotations" -#: .\ldt_utils\models.py:456 +#: .\ldt_utils\models.py:475 msgid "content.nb_annotation" msgstr "nombre d'annotations" -#: .\ldt_utils\models.py:457 +#: .\ldt_utils\models.py:476 msgid "content.last_annotated" msgstr "annoté pour la dernière foiss" -#: .\ldt_utils\models.py:512 +#: .\ldt_utils\models.py:531 msgid "created by" msgstr "créé par" -#: .\ldt_utils\models.py:513 +#: .\ldt_utils\models.py:532 msgid "changed by" msgstr "modifié par" @@ -309,7 +309,7 @@ msgstr "Lignes de temps" #: .\ldt_utils\templates\front\front_base.html.py:59 -#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:64 +#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:68 msgid "My projects" msgstr "Mes projets" @@ -408,9 +408,9 @@ #: .\ldt_utils\templates\ldt\ldt_utils\groups.html.py:113 #: .\ldt_utils\templates\ldt\ldt_utils\ldt_list.html.py:80 #: .\ldt_utils\templates\ldt\ldt_utils\published_projects.html.py:70 -#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:55 -#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:67 -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:121 +#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:56 +#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:71 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:129 #: .\templates\ldt\ldt_base.html.py:127 msgid "search" msgstr "Recherche" @@ -508,33 +508,23 @@ msgid "Copy" msgstr "Copier" -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:44 +#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:33 msgid "Browse" msgstr "Parcourir" -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:45 +#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:34 msgid "File uploaded" msgstr "Fichier téléversé" -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:46 +#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:35 msgid "Please wait, the upload is not finished yet" msgstr "Veuillez patienter, le téléversement est en cours" -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:47 +#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:36 msgid "Cancel upload" msgstr "Annuler le téléversement" -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:56 -#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:48 -msgid "more options" -msgstr "Plus d'options" - -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:60 -#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:52 -msgid "hide" -msgstr "Réduire" - -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:74 +#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:71 msgid "" "The operation could not be performed because one or more error(s) occurred." "
Please resubmit the media form after making the following changes:" @@ -542,37 +532,39 @@ "opération impossible à cause d'une ou plusieurs erreurs.
Veuillez " "resoumettre le formulaire media après avoir fait les changements suivants:" -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:88 +#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:85 #: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:53 msgid "Create content" msgstr "Créer un contenu" -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:129 -#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:128 -msgid "More options" -msgstr "Plus d'options" - -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:133 +#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:126 msgid "Actual front project" msgstr "Front project actuel" -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:146 +#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:127 +#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:141 +#: .\ldt_utils\templates\ldt\ldt_utils\reset_confirm.html.py:54 +msgid "reset_front_project" +msgstr "Réinitialiser" + +#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:141 msgid "media file is being processed please wait." msgstr "Le fichier média est en cours de traitement. Veuillez patienter." -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:150 +#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:145 #: .\ldt_utils\templates\ldt\ldt_utils\create_group.html.py:101 #: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:137 -#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm.html.py:53 +#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm.html.py:37 +#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm_popup.html.py:53 #: .\ldt_utils\templates\ldt\ldt_utils\reset_confirm.html.py:53 msgid "close_cancel" msgstr "Fermer" -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:151 +#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:146 msgid "delete" msgstr "Effacer" -#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:152 +#: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:147 msgid "write" msgstr "Enregistrer" @@ -609,6 +601,14 @@ msgid "create_group" msgstr "Créer un nouveau groupe" +#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:48 +msgid "more options" +msgstr "Plus d'options" + +#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:52 +msgid "hide" +msgstr "Réduire" + #: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:82 msgid "Update your project" msgstr "Mettre à jour votre projet Lignes de Temps" @@ -632,15 +632,14 @@ msgid "name" msgstr "Nom" +#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:128 +msgid "More options" +msgstr "Plus d'options" + #: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:139 msgid "delete_project" msgstr "Effacer" -#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:141 -#: .\ldt_utils\templates\ldt\ldt_utils\reset_confirm.html.py:54 -msgid "reset_front_project" -msgstr "Réinitialiser" - #: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:143 msgid "update_project" msgstr "Mettre à jour" @@ -657,44 +656,47 @@ msgid "Select" msgstr "Sélectionner" -#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:47 +#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:46 msgid "popup_player" msgstr "Code Lecteur métadata" -#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:47 +#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:46 msgid "popup_seo_body" msgstr "Code SEO" -#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:47 +#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:46 msgid "popup_seo_meta" msgstr "Code balise meta en-tête" -#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:47 +#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:46 msgid "popup_links" msgstr "Liste de liens" -#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:61 +#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:60 msgid "clik here to see the project content" msgstr "cliquer ici pour voir le contenu du projet" -#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm.html.py:34 +#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm.html.py:21 +#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm_popup.html.py:34 #: .\ldt_utils\templates\ldt\ldt_utils\reset_confirm.html.py:34 msgid "error" msgstr "Erreur" -#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm.html.py:34 +#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm.html.py:21 +#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm_popup.html.py:34 msgid "confirm" msgstr "Confirmation d'effacement" -#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm.html.py:49 +#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm.html.py:38 +#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm_popup.html.py:54 +msgid "do_delete" +msgstr "Effacer" + +#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm_popup.html.py:49 #: .\ldt_utils\templates\ldt\ldt_utils\reset_confirm.html.py:49 msgid "close_error" msgstr "Fermer" -#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm.html.py:54 -msgid "do_delete" -msgstr "Effacer" - #: .\ldt_utils\templates\ldt\ldt_utils\groups.html.py:68 msgid "Do you want to leave this group ?" msgstr "Voulez-vous quitter ce groupe ?" @@ -734,7 +736,7 @@ msgstr "Projets publiés" #: .\ldt_utils\templates\ldt\ldt_utils\published_projects.html.py:68 -#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:65 +#: .\ldt_utils\templates\ldt\ldt_utils\workspace_base.html.py:69 msgid "Create project" msgstr "Créer un nouveau projet d'indexation" @@ -801,56 +803,60 @@ msgid "Projects shared with me only" msgstr "Projets partagés avec moi uniquement" -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:47 -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:74 -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:163 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:52 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:79 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:174 msgid "share.eye" msgstr "Cet utilisateur ou ce groupe a le droit de voir cet élement" -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:55 -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:161 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:60 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:172 msgid "share.pencil" msgstr "cet utilisateur ou ce groupe a le droit de modifier cet élement" -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:105 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:110 msgid "share" msgstr "partager avec d'autres utilisateurs" -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:114 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:119 msgid "publish for everyone" msgstr "publier pour tout le monde" -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:120 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:124 +msgid "publish the title on the front" +msgstr "publier le titre sur le front" + +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:127 msgid "User and group list" msgstr "Liste des groupes et des utilisateurs" -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:131 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:142 msgid "select all displayed elements" msgstr "ajouter tous les élements affichés" -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:136 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:147 msgid "select users" msgstr "choisir des utilisateurs" -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:137 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:148 msgid "remove users" msgstr "enlever des utilisateurs" -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:142 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:153 msgid "Members list" msgstr "liste des membres" -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:152 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:163 #: .\ldt_utils\templates\ldt\ldt_utils\partial\sharewith.html.py:7 msgid "user" msgstr "utilisateur" -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:154 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:165 #: .\ldt_utils\templates\ldt\ldt_utils\partial\sharewith.html.py:9 msgid "group" msgstr "groupe" -#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:174 +#: .\ldt_utils\templates\ldt\ldt_utils\partial\permissions.html.py:185 msgid "remove all" msgstr "tout enlever" @@ -900,35 +906,54 @@ msgid "Project published" msgstr "Projet publié" -#: .\ldt_utils\views\content.py:174 +#: .\ldt_utils\views\content.py:183 msgid "Problem when downloading file from url : " msgstr "Problème lors du téléchargement du fichier : " -#: .\ldt_utils\views\content.py:177 +#: .\ldt_utils\views\content.py:186 msgid "Problem when uploading file : " msgstr "Problème lors de l'upload du fichier : " -#: .\ldt_utils\views\content.py:285 +#: .\ldt_utils\views\content.py:301 #, 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\content.py:286 +#: .\ldt_utils\views\content.py:302 msgid "title error deleting content" msgstr "Erreur lors de l'effacement du contenu" -#: .\ldt_utils\views\content.py:288 +#: .\ldt_utils\views\content.py:304 #, python-format msgid "Confirm delete content %(titles)s" msgstr "Veuillez confirmer l'effacement du contenu %(titles)s" -#: .\ldt_utils\views\content.py:289 +#: .\ldt_utils\views\content.py:305 msgid "confirm delete content" msgstr "Confirmation effacement contenu" -#: .\ldt_utils\views\content.py:333 +#: .\ldt_utils\views\content.py:317 +#, python-format +msgid "Please unpublish the front project %(title)s" +msgstr "Veuillez dépublier le projet : %(title)s" + +#: .\ldt_utils\views\content.py:318 +msgid "The front project is published" +msgstr "Projet publié" + +#: .\ldt_utils\views\content.py:319 .\ldt_utils\views\content.py:322 +#: .\ldt_utils\views\project.py:137 +msgid "confirm reset" +msgstr "Confirmer la réinitialisation" + +#: .\ldt_utils\views\content.py:321 .\ldt_utils\views\project.py:136 +#, python-format +msgid "please confirm reseting project %(title)s" +msgstr "Veuillez confirmer la réinitialisation du projet %(title)s" + +#: .\ldt_utils\views\content.py:382 #, python-format msgid "" "Content '%(title)s' is referenced by this project : %(project_titles)s. " @@ -944,7 +969,7 @@ "(project_titles)s'.Veuillez les effacer préalablement." #: .\ldt_utils\views\json.py:40 .\ldt_utils\views\rdf.py:15 -#: .\ldt_utils\views\workspace.py:117 +#: .\ldt_utils\views\workspace.py:127 msgid "You can not access this project" msgstr "vous n'avez pas l'autorisation d'accéder à ce projet" @@ -980,15 +1005,6 @@ msgid "confirm deletion" msgstr "Confirmation d'effacement" -#: .\ldt_utils\views\project.py:136 -#, python-format -msgid "please confirm reseting project %(title)s" -msgstr "Veuillez confirmer la réinitialisation du projet %(title)s" - -#: .\ldt_utils\views\project.py:137 -msgid "confirm reset" -msgstr "Confirmer la réinitialisation" - #: .\templates\admin\cms_change_form.html.py:30 msgid "Approve page deletion" msgstr "Accepter l'effacement de la page" @@ -1331,7 +1347,7 @@ msgid "Profile picture" msgstr "Image de profil" -#: .\user\forms.py:133 +#: .\user\forms.py:134 #, python-format msgid "Image size is limited to %s" msgstr "La taille de l'image est limitée à %s" diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/management/commands/reindex.py --- a/src/ldt/ldt/management/commands/reindex.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/management/commands/reindex.py Sat Oct 06 00:40:42 2012 +0200 @@ -19,16 +19,15 @@ ) def handle(self, *args, **options): - parser = self.create_parser("reindex", "") - options, _ = parser.parse_args() - - if options.content_id: - self.stdout.write('Creating index for %s\n' % options.content_id) - contentList = Content.objects.filter(iri_id=options.content_id) + content_id = options.get("content_id") + projects = options.get("projects") + + if content_id: + self.stdout.write('Creating index for %s\n' % content_id) + contentList = Content.objects.filter(iri_id=content_id) else: self.stdout.write('Creating contents index...\n') contentList = Content.objects.all() - count = contentList.count() c = lambda i,o: show_progress(i+1, count, o.title, 50) @@ -36,7 +35,7 @@ indexer = ContentIndexer(contentList, callback=c) indexer.index_all() - if options.projects: + if projects: self.stdout.write('Creating projects index...\n') projectList = Project.objects.filter(contents__in=contentList, state=2).distinct() count = projectList.count() diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/security/utils.py --- a/src/ldt/ldt/security/utils.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/security/utils.py Sat Oct 06 00:40:42 2012 +0200 @@ -29,19 +29,22 @@ for elem in xml.xpath('/iri/medias/media'): content = cls.safe_objects.filter(iri_id=elem.get('id')) - if not content: + if content and use_forbidden_url(content[0]) : elem.set('video', settings.FORBIDDEN_STREAM_URL) - return xml def use_forbidden_url(content): - cls = ContentType.objects.get(model='content') - cls = cls.model_class() - - new_content = cls.safe_objects.filter(iri_id=content.iri_id) + c_cls = ContentType.objects.get(model='content') + c_cls = c_cls.model_class() + m_cls = ContentType.objects.get(model='media') + m_cls = m_cls.model_class() + + new_content = c_cls.safe_objects.filter(iri_id=content.iri_id) if new_content: - return False - return True + media = m_cls.safe_objects.filter(id=new_content[0].media_obj.id) + if not media: + return True + return False def add_change_attr(user, obj_list): """ diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/css/ldtform.css --- a/src/ldt/ldt/static/ldt/css/ldtform.css Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/css/ldtform.css Sat Oct 06 00:40:42 2012 +0200 @@ -104,7 +104,7 @@ .ldtdate,.ldttime { float: left; - width: 150px; + width: 140px; } .ldtdatetitle,.ldttimetitle { @@ -160,7 +160,7 @@ font-weight: bold; } -#elemslistcontainer, #selectors, #public input { +#elemslistcontainer, #selectors, #media_public input, #content_public input { float: left; } diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/css/style.css --- a/src/ldt/ldt/static/ldt/css/style.css Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/css/style.css Sat Oct 06 00:40:42 2012 +0200 @@ -50,6 +50,7 @@ padding: 0px; padding-left: 1em; height: 55px; + background: #FFF; } #header a diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/js/projectscontents.js --- a/src/ldt/ldt/static/ldt/js/projectscontents.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/js/projectscontents.js Sat Oct 06 00:40:42 2012 +0200 @@ -210,73 +210,6 @@ searchCallback($("#searchcontentsinput"),"#contentslistcontainer",content_filter_url,0,0); }); - $('.content_link_create').each(function(i){ - $(this).attr("target","_blank"); - }); - $('.content_link_create').nyroModal({ - filters: ['iframe'], - sizes: { - minW: 740, - minH: 490 - }, - closeOnClick:false, - callbacks: { - afterClose: function(nm) { - searchCallback($('#searchcontentsinput'), "#contentslistcontainer", content_filter_url, 0); - if (project_filter_url != 'undefined') { - // Used when an admin creates a content, the list of project has to be refreshed for the front project - searchCallback($('#searchprojectsinput'), "#projectslistcontainer", project_filter_url, 0); - } - }, - afterShowCont: function(nm) { - nm.store.iframe.load(function() { - var form_status = $(this).contents().find("#content_form_status").val(); - if(form_status === 'saved' || form_status === 'deleted' ) { - $.nmTop().close(); - } - }); - - nm.store.iframe.width(730); - nm.store.iframe.height(480); - } - } - }); - $('.content_link_create',base_node).each(function(i, e) { - nm = $(e).data('nmObj'); - $(e).data('nmObj', $.extend(true, nm, { - close: testCreateAndClose(nm, nm.close) - })); - }); - - $('.contenttitlelink').each(function(i){ - $(this).attr("target","_blank"); - }); - - $('.contenttitlelink').nyroModal({ - filters: ['iframe'], - sizes: { - minW: 740, - minH: 490 - }, - closeOnClick:false, - callbacks: { - afterClose: function(nm) { - searchCallback($("#searchcontentsinput"),"#contentslistcontainer",content_filter_url,0); - }, - afterShowCont: function(nm) { - nm.store.iframe.load(function() { - var form_status = $(this).contents().find("#content_form_status").val(); - if(form_status === 'saved' || form_status === 'deleted') { - $.nmTop().close(); - } - }); - - nm.store.iframe.width(730); - nm.store.iframe.height(480); - } - } - }); - } function init_modal_window (class_name, windowW, windowH, frameW, frameH, base_node, searchprojectfilterurl) { @@ -751,10 +684,10 @@ $('#id_content-title').val(data.entry.title.$t); } $('#media_field_create').append('Youtube Thumbnail'); - $('#media_fields_div').height(150); + $('#media_fields_div').height(150); + $('#id_url_image').val(data.entry.media$group.media$thumbnail[0].url) } }); - } } else if(url.match("vimeo")){ @@ -776,6 +709,7 @@ } $('#media_field_create').append(''); $('#media_fields_div').height(150); + $('#id_url_image').val(data[0].thumbnail_small); } }); } @@ -800,6 +734,7 @@ } $('#media_field_create').append(''); $('#media_fields_div').height(190); + $('#id_url_image').val(data.thumbnail_medium_url) } }); } diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/AdaptivePlayer.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/static/ldt/metadataplayer/AdaptivePlayer.js Sat Oct 06 00:40:42 2012 +0200 @@ -0,0 +1,33 @@ +IriSP.Widgets.AdaptivePlayer = function(player, config) { + IriSP.Widgets.Widget.call(this, player, config); +}; + +IriSP.Widgets.AdaptivePlayer.prototype = new IriSP.Widgets.Widget(); + +IriSP.Widgets.AdaptivePlayer.prototype.defaults = { + mime_type: "video/mp4", + normal_player: "PopcornPlayer", + fallback_player: "JwpPlayer" +} + +IriSP.Widgets.AdaptivePlayer.prototype.draw = function() { + + if (typeof this.video === "undefined") { + this.video = this.media.video; + } + + var _props = [ "autostart", "video", "height", "width", "url_transform" ], + _opts = {}, + _canPlayType = document.createElement('video').canPlayType(this.mime_type); + + _opts.type = (_canPlayType == "maybe" || _canPlayType == "probably") ? this.normal_player : this.fallback_player; + + for (var i = 0; i < _props.length; i++) { + if (typeof this[_props[i]] !== "undefined") { + _opts[_props[i]] = this[_props[i]]; + } + } + + this.insertSubwidget(this.$, _opts); + +} \ No newline at end of file diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/Annotation.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js Sat Oct 06 00:40:42 2012 +0200 @@ -27,7 +27,8 @@ } IriSP.Widgets.Annotation.prototype.template = - '
' + '{{#show_arrow}}
{{/show_arrow}}' + + '
' + '
' + '
' + '
' @@ -43,40 +44,103 @@ IriSP.Widgets.Annotation.prototype.defaults = { annotation_type : "chap", - start_minimized: true, - show_top_border : false, - site_name : "Lignes de Temps" + start_minimized: false, + show_arrow : true, + site_name : "Lignes de Temps", + search_on_tag_click: true } IriSP.Widgets.Annotation.prototype.draw = function() { + + var _this = this; + + function timeupdate(_time) { + var _list = _this.getWidgetAnnotationsAtTime(); + if (!_list.length) { + _this.$.find(".Ldt-Annotation-Inner").addClass("Ldt-Annotation-Empty"); + if (_this.arrow) { + _this.arrow.moveToTime(_time); + } + _this.bounds = [ _time, _time ]; + _this.sendBounds(); + } + } + + function drawAnnotation(_annotation) { + var _url = (typeof _annotation.url !== "undefined" + ? _annotation.url + : (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id)), + _text = _this.l10n.watching + _annotation.title + (_this.site_name ? _this.l10n.on_site + _this.site_name : ''), + _tags = _annotation.getTags(), + _tagblock = _this.$.find(".Ldt-Annotation-Tags"); + if (_tags.length) { + _this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-EmptyBlock"); + _tags.forEach(function(_tag) { + var _trimmedTitle = _tag.title.replace(/(^\s+|\s+$)/g,''); + if (_trimmedTitle) { + var _el = IriSP.jQuery('
  • ').append(IriSP.jQuery('').text(_trimmedTitle)); + _el.click(function() { + if (_this.search_on_tag_click) { + _this.player.trigger("search.triggeredSearch",_trimmedTitle); + } + _tag.trigger("click"); + }); + _tagblock.append(_el); + } + }); + } else { + _this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-EmptyBlock"); + } + _this.$.find(".Ldt-Annotation-Title").html(_annotation.title); + var _desc = _annotation.description.replace(/(^\s+|\s+$)/g,''); + if (_desc) { + _this.$.find(".Ldt-Annotation-Description-Block").removeClass("Ldt-Annotation-EmptyBlock"); + _this.$.find(".Ldt-Annotation-Description").html(_desc); + } else { + _this.$.find(".Ldt-Annotation-Description-Block").addClass("Ldt-Annotation-EmptyBlock"); + } + _this.$.find(".Ldt-Annotation-Begin").html(_annotation.begin.toString()); + _this.$.find(".Ldt-Annotation-End").html(_annotation.end.toString()); + if (_annotation.elementType === "mashedAnnotation") { + _this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-isMashup"); + _this.$.find(".Ldt-Annotation-MashupMedia").html(_annotation.getMedia().title); + _this.$.find(".Ldt-Annotation-MashupBegin").html(_annotation.annotation.begin.toString()); + _this.$.find(".Ldt-Annotation-MashupEnd").html(_annotation.annotation.end.toString()); + } else { + _this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-isMashup"); + } + if (typeof _this.socialWidget !== "undefined") { + _this.socialWidget.updateUrls(_url, _text); + } else { + setTimeout(function() { + if (typeof _this.socialWidget !== "undefined") { + _this.socialWidget.updateUrls(_url, _text); + } + },800); + } + _this.$.find(".Ldt-Annotation-Inner").removeClass("Ldt-Annotation-Empty"); + _this.bounds = [ _annotation.begin, _annotation.end ]; + if (_this.arrow) { + _this.arrow.moveToTime((_annotation.begin + _annotation.end)/2); + } + _this.sendBounds(); + } + this.renderTemplate(); this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), { type: "Social" }, "socialWidget"); - this.onMediaEvent("timeupdate","onTimeupdate"); + this.insertSubwidget(this.$.find(".Ldt-Annotation-Arrow"), { type: "Arrow" }, "arrow"); + this.onMediaEvent("timeupdate",timeupdate); this.onMdpEvent("Annotation.hide","hide"); this.onMdpEvent("Annotation.show","show"); this.onMdpEvent("Annotation.minimize","minimize"); this.onMdpEvent("Annotation.maximize","maximize"); this.onMdpEvent("Annotation.getBounds","sendBounds"); this.$.find(".Ldt-Annotation-MaxMinButton").click(this.functionWrapper("toggleSize")); - this.onTimeupdate(); -} - -IriSP.Widgets.Annotation.prototype.onTimeupdate = function(_time) { - var _list = this.getWidgetAnnotationsAtTime(); - if (_list.length) { - if (_list[0].id !== this.lastAnnotation) { - this.drawAnnotation(_list[0]); - this.bounds = [ _list[0].begin.valueOf(), _list[0].end.valueOf() ]; - } - this.player.trigger("Arrow.updatePosition",{widget: this.type, time: ( _list[0].begin + _list[0].end ) / 2}); - } - else { - this.lastAnnotation = false; - this.$.find(".Ldt-Annotation-Inner").addClass("Ldt-Annotation-Empty"); - this.player.trigger("Arrow.updatePosition",{widget: this.type, time: _time}); - this.bounds = [ _time, _time ]; - } - this.sendBounds(); + this.getWidgetAnnotations().forEach(function(_a) { + _a.on("enter", function() { + drawAnnotation(_a) + }); + }); } IriSP.Widgets.Annotation.prototype.sendBounds = function() { @@ -85,61 +149,7 @@ IriSP.Widgets.Annotation.prototype.drawAnnotation = function(_annotation) { this.lastAnnotation = _annotation.id; - var _url = (typeof _annotation.url !== "undefined" - ? _annotation.url - : (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id)); - var _text = this.l10n.watching + _annotation.title + (this.site_name ? this.l10n.on_site + this.site_name : ''); - var _tags = _annotation.getTagTexts(); - if (_tags.length) { - var _html = IriSP._(_tags).map(function(_tag) { - return '
  • ' + _tag + '
  • '; - }).join(""); - this.$.find(".Ldt-Annotation-Tags").html(_html); - this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-EmptyBlock"); - - /* Correct the empty tag bug */ - this.$.find('.Ldt-Annotation-TagLabel').each(function() { - var _el = IriSP.jQuery(this); - if (!_el.text().replace(/(^\s+|\s+$)/g,'')) { - _el.detach(); - } - }); - - this.$.find('.Ldt-Annotation-TagLabel').click(function() { - _this.player.trigger("search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); - }); - } else { - this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-EmptyBlock"); - } - this.$.find(".Ldt-Annotation-Title").html(_annotation.title); - var _desc = _annotation.description.replace(/(^\s+|\s+$)/g,''); - if (_desc) { - this.$.find(".Ldt-Annotation-Description-Block").removeClass("Ldt-Annotation-EmptyBlock"); - this.$.find(".Ldt-Annotation-Description").html(_desc); - } else { - this.$.find(".Ldt-Annotation-Description-Block").addClass("Ldt-Annotation-EmptyBlock"); - } - this.$.find(".Ldt-Annotation-Begin").html(_annotation.begin.toString()); - this.$.find(".Ldt-Annotation-End").html(_annotation.end.toString()); - if (_annotation.elementType === "mashedAnnotation") { - this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-isMashup"); - this.$.find(".Ldt-Annotation-MashupMedia").html(_annotation.getMedia().title); - this.$.find(".Ldt-Annotation-MashupBegin").html(_annotation.annotation.begin.toString()); - this.$.find(".Ldt-Annotation-MashupEnd").html(_annotation.annotation.end.toString()); - } else { - this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-isMashup"); - } - if (typeof this.socialWidget !== "undefined") { - this.socialWidget.updateUrls(_url, _text); - } else { - var _this = this; - setTimeout(function() { - if (typeof _this.socialWidget !== "undefined") { - _this.socialWidget.updateUrls(_url, _text); - } - },800); - } - this.$.find(".Ldt-Annotation-Inner").removeClass("Ldt-Annotation-Empty"); + } IriSP.Widgets.Annotation.prototype.hide = function() { diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css --- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css Sat Oct 06 00:40:42 2012 +0200 @@ -8,6 +8,11 @@ .Ldt-AnnotationsListWidget a { text-decoration: none; } + +.Ldt-AnnotationsList-Audio { + width: 1px; height: 1px; +} + ul.Ldt-AnnotationsList-ul { list-style: none; padding: 2px; @@ -84,4 +89,14 @@ .Ldt-AnnotationsList-Tag-Li:hover span { background-position: right -23px; +} + +.Ldt-AnnotationsList-Play { + width: 125px; height: 20px; margin: 2px 0 2px 82px; text-align: center; + padding: 3px 5px 0 20px; font-size: 12px; cursor: pointer; + background: url(img/voiceannotation.png); color: #333333; +} + +.Ldt-AnnotationsList-Play:hover { + background-position: 0 bottom; } \ No newline at end of file diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js --- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js Sat Oct 06 00:40:42 2012 +0200 @@ -17,7 +17,7 @@ ajax_url : false, /* number of milliseconds before/after the current timecode when calling the segment API */ - ajax_granularity : 300000, + ajax_granularity : 600000, default_thumbnail : "", /* URL when the annotation is not in the current project, * e.g. http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/{{project}}/{{annotationType}}#id={{annotation}} @@ -25,8 +25,9 @@ foreign_url : "", annotation_type : false, refresh_interval : 0, - limit_count : 10, + limit_count : 20, newest_first : false, + show_audio: true, polemics : [{ keyword: "++", background_color: "#c9ecc6" @@ -42,8 +43,20 @@ }] }; +IriSP.Widgets.AnnotationsList.prototype.messages = { + en: { + voice_annotation: "Voice Annotation", + now_playing: "Now playing..." + }, + fr: { + voice_annotation: "Annotation Vocale", + now_playing: "Lecture en cours..." + } +} + IriSP.Widgets.AnnotationsList.prototype.template = '
    ' + + '{{#show_audio}}
    {{/show_audio}}' + '
      ' + '
    ' + '
    '; @@ -71,6 +84,7 @@ + '{{/tags}}' + '' + '{{/tags.length}}' + + '{{#audio}}
    {{l10n.voice_annotation}}
    {{/audio}}' + ''; IriSP.Widgets.AnnotationsList.prototype.onSearch = function(searchString) { @@ -129,7 +143,7 @@ if (this.mashupMode) { var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime); if (typeof _currentAnnotation !== "undefined") { - _currentTime = _currentTime - _currentAnnotation.begin.getSeconds() + _currentAnnotation.annotation.begin.getSeconds(); + _currentTime = _currentTime - _currentAnnotation.begin + _currentAnnotation.annotation.begin; var _mediaId = _currentAnnotation.getMedia().id; _list = _list.filter(function(_annotation) { return _annotation.getMedia().id === _mediaId; @@ -140,8 +154,9 @@ _list = _list.searchByTextFields(this.searchString); } if (this.limit_count) { + /* Get the n annotations closest to current timecode */ _list = _list.sortBy(function(_annotation) { - return Math.abs(_annotation.begin.getSeconds() - _currentTime); + return Math.abs((_annotation.begin + _annotation.end) / 2 - _currentTime); }).slice(0, this.limit_count) } if (this.newest_first) { @@ -204,7 +219,9 @@ thumbnail : typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail, url : _url, tags : _annotation.getTagTexts(), - specific_style : (typeof _bgcolor !== "undefined" ? "background-color: " + _bgcolor : "") + specific_style : (typeof _bgcolor !== "undefined" ? "background-color: " + _bgcolor : ""), + audio : (_this.show_audio && _annotation.audio && _annotation.audio.href && _annotation.audio.href != "null" ? _annotation.audio.href : undefined), + l10n: _this.l10n }; var _html = Mustache.to_html(_this.annotationTemplate, _data); var _el = IriSP.jQuery(_html); @@ -236,7 +253,20 @@ this.$.find('.Ldt-AnnotationsList-Tag-Li').click(function() { _this.player.trigger("search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); - }) + }); + + this.$.find(".Ldt-AnnotationsList-Play").click(function() { + var _el = IriSP.jQuery(this), + _audiofile = _el.attr("data-audio").replace(_this.rtmp_streamer,""); + _el.text(_this.l10n.now_playing); + _this.jwplayer.load({ + file: _audiofile, + streamer: _this.rtmp_streamer + }); + _this.jwplayer.play(true); + _this.media.pause(); + _this.jw_paused_media = true; + }); if(this.searchString) { var _searchRe = IriSP.Model.regexpFromTextOrArray(this.searchString); @@ -265,14 +295,46 @@ this.renderTemplate(); + var _this = this; + + if (this.show_audio) { + var _tmpId = "jwplayer-" + IriSP.Model.getUID(); + this.$.find(".Ldt-AnnotationsList-Audio").attr("id", _tmpId); + this.jwplayer = jwplayer(_tmpId); + this.jwplayer.setup({ + flashplayer: IriSP.getLib("jwPlayerSWF"), + width: 1, + height: 1, + provider: "rtmp", + events: { + onIdle: function() { + if (_this.jw_paused_media) { + _this.jw_paused_media = false; + _this.media.play(); + } + _this.$.find(".Ldt-AnnotationsList-Play").text(_this.l10n.voice_annotation) + } + } + }); + this.jw_paused_media = false; + } + this.list_$ = this.$.find(".Ldt-AnnotationsList-ul"); + this.onMdpEvent("search", "onSearch"); this.onMdpEvent("search.closed", "onSearch"); this.onMdpEvent("search.cleared", "onSearch"); - this.onMdpEvent("AnnotationsList.refresh","refresh"); - - var _this = this; + this.onMdpEvent("AnnotationsList.refresh", function() { + if (_this.ajax_url) { + if (_this.mashupMode) { + _this.ajaxMashup(); + } else { + _this.ajaxSource(); + } + } + _this.throttledRefresh(); + }); if (this.ajax_url) { if (this.mashupMode) { diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/Arrow.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Arrow.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Arrow.js Sat Oct 06 00:40:42 2012 +0200 @@ -6,25 +6,25 @@ IriSP.Widgets.Arrow.prototype = new IriSP.Widgets.Widget(); IriSP.Widgets.Arrow.prototype.defaults = { - arrow_height : 16, - arrow_width : 24, + arrow_height : 12, + arrow_width : 20, base_height : 0, base_curve : 0, fill_url: IriSP.widgetsDir + '/img/pinstripe.png', fill_color: "#ffffff", //Gradients can be used, e.g. "90-#000-#fff" for vertical white-to-black stroke_color: "#b7b7b7", stroke_width: 1.5, - animation_speed: 20, - pilot_widget: "Annotation" + animation_speed: 20 } IriSP.Widgets.Arrow.prototype.draw = function() { this.height = this.arrow_height + this.base_height; this.$.addClass("Ldt-Arrow").css({ - height: this.height + "px", - "margin-top": "1px" + height: (1+this.height) + "px", + "margin-top": "1px", + overflow: "hidden" }); - this.paper = new Raphael(this.container, this.width, this.height ); + this.paper = new Raphael(this.container, this.width, 1+this.height ); window.myArrow = this; this.svgArrow = this.paper.path('M0,' + this.height + 'L' + this.width + ',' + this.height); this.svgArrow.attr({ @@ -32,14 +32,11 @@ "stroke-width": this.stroke_width, fill: this.fill_url ? ( 'url(' + this.fill_url + ')' ) : this.fill_color }); - this.moveTo(0); - this.onMdpEvent("Arrow.updatePosition","onUpdatePosition"); - this.onMdpEvent("Arrow.takeover","onTakeover"); - this.onMdpEvent("Arrow.release","onRelease"); + this.moveToX(0); } IriSP.Widgets.Arrow.prototype.drawAt = function(_x) { - _x = Math.floor(Math.max(0, Math.min(_x, this.width))); + _x = Math.max(0, Math.min(_x, this.width)); var _d = 'M0,' + this.height + 'L0,' + Math.min( this.height, this.arrow_height + this.base_curve) + 'Q0,' + this.arrow_height @@ -58,8 +55,8 @@ }); } -IriSP.Widgets.Arrow.prototype.moveTo = function(_x) { - this.targetX = Math.floor(Math.max(0, Math.min(_x, this.width))); +IriSP.Widgets.Arrow.prototype.moveToX = function(_x) { + this.targetX = Math.max(0, Math.min(_x, this.width)); if (typeof this.animInterval === "undefined") { this.animInterval = window.setInterval( this.functionWrapper("increment"), @@ -69,6 +66,10 @@ this.increment(); } +IriSP.Widgets.Arrow.prototype.moveToTime = function(_t) { + this.moveToX(this.width * _t / this.media.duration); +} + IriSP.Widgets.Arrow.prototype.increment = function() { if (typeof this.currentX === "undefined") { this.currentX = this.targetX; @@ -85,21 +86,3 @@ } this.drawAt(this.currentX); } - -IriSP.Widgets.Arrow.prototype.onUpdatePosition = function(_param) { - if (_param.widget === this.current_pilot_widget) { - if (typeof _param.x !== "undefined") { - this.moveTo(_param.x); - } else { - this.moveTo(this.width * _param.time / this.source.getDuration()); - } - } -} - -IriSP.Widgets.Arrow.prototype.onTakeover = function(_widget) { - this.current_pilot_widget = _widget; -} - -IriSP.Widgets.Arrow.prototype.onRelease = function(_widget) { - this.current_pilot_widget = this.pilot_widget; -} diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.css --- a/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.css Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.css Sat Oct 06 00:40:42 2012 +0200 @@ -11,9 +11,7 @@ } .Ldt-CreateAnnotation-Inner { - background: url(img/pinstripe.png); - padding: 5px; - margin: 0; + background: url(img/pinstripe.png); padding: 5px; margin: 0; position: relative; } .Ldt-CreateAnnotation-Inner h3 { @@ -86,11 +84,11 @@ border: 1px solid #bbbbbb; } -.Ldt-CreateAnnotation-Tags, .Ldt-CreateAnnotation-Polemics { - width: 520px; +.Ldt-CreateAnnotation-RecBlock { + width: 220px; float: left; } -.Ldt-CreateAnnotation-TagTitle, .Ldt-CreateAnnotation-PolemicTitle { +.Ldt-CreateAnnotation-TagTitle, .Ldt-CreateAnnotation-PolemicTitle, .Ldt-CreateAnnotation-RecLabel { display: block; margin: 5px 0 2px; font-size: 12px; } diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js --- a/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js Sat Oct 06 00:40:42 2012 +0200 @@ -1,4 +1,4 @@ -/* TODO: Add Social Network Sharing, Finish Current Timecode Sync & Arrow Takeover */ +/* TODO: Add Social Network Sharing */ IriSP.Widgets.CreateAnnotation = function(player, config) { IriSP.Widgets.Widget.call(this, player, config); @@ -11,8 +11,10 @@ show_creator_field : true, start_visible : true, always_visible : false, - sync_on_slice_widget : true, /* If false, syncs on current timecode */ - takeover_arrow : false, + show_slice : true, + show_arrow : true, + show_mic_record: false, + show_mic_play: false, minimize_annotation_widget : true, creator_name : "", creator_avatar : "", @@ -37,6 +39,7 @@ background_color: "#f0e000", text_color: "#000000" }], + slice_annotation_type: "chap", annotation_type: "Contributions", api_serializer: "ldt_annotate", api_endpoint_template: "", @@ -65,7 +68,11 @@ share_on: "Share on", more_tags: "More tags", cancel: "Cancel", - close_widget: "Cacher la zone de création d'annotations" + close_widget: "Cacher la zone de création d'annotations", + "polemic++": "Agree", + "polemic--": "Disagree", + "polemic??": "Question", + "polemic==": "Reference" }, fr: { from_time: "de", @@ -86,21 +93,51 @@ share_on: "Partager sur", more_tags: "Plus de mots-clés", cancel: "Cancel", - close_widget: "Hide the annotation creating block" + close_widget: "Hide the annotation creating block", + "polemic++": "Accord", + "polemic--": "Désaccord", + "polemic??": "Question", + "polemic==": "Référence" } } IriSP.Widgets.CreateAnnotation.prototype.template = - '
    ' + '{{#show_slice}}
    {{/show_slice}}' + + '{{^show_slice}}{{#show_arrow}}
    {{/show_arrow}}{{/show_slice}}' + + '
    ' + '
    ' + '

    {{#show_title_field}}{{/show_title_field}}' + '{{^show_title_field}}{{l10n.no_title}} {{/show_title_field}}' - + ' {{#sync_on_slice_widget}}{{l10n.from_time}} {{/sync_on_slice_widget}}{{^sync_on_slice_widget}}{{l10n.at_time}} {{/sync_on_slice_widget}} 00:00' - + '{{#sync_on_slice_widget}} {{l10n.to_time}} 00:00{{/sync_on_slice_widget}}' + + ' {{#show_slice}}{{l10n.from_time}} {{/show_slice}}{{^show_slice}}{{l10n.at_time}} {{/show_slice}} 00:00' + + '{{#show_slice}} {{l10n.to_time}} {{end}}{{/show_slice}}' + '{{#show_creator_field}}{{l10n.your_name_}}

    {{/show_creator_field}}' + '' + '
    ' + '' + + '{{#show_mic_record}}
    Add voice annotation
    ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '
    {{/show_mic_record}}' + '{{#tags.length}}
    {{l10n.add_keywords_}}
      ' + '{{#tags}}
    • {{title}}
    • {{/tags}}
    {{/tags.length}}' + '{{#polemics.length}}
    {{l10n.add_polemic_keywords_}}
      ' @@ -113,6 +150,10 @@ IriSP.Widgets.CreateAnnotation.prototype.draw = function() { var _this = this; + + this.begin = new IriSP.Model.Time(); + this.end = this.source.getDuration(); + if (this.tag_titles && !this.tags) { this.tags = IriSP._(this.tag_titles).map(function(_tag_title) { var _tag, @@ -137,7 +178,44 @@ }); /* We have to use the map function because Mustache doesn't like our tags object */ } + this.record_swf = IriSP.getLib("recordMicSwf"); this.renderTemplate(); + if (this.show_mic_record) { + this.recorder = this.$.find("embed")[0]; + + window.setAudioUrl = function(_url) { + _this.audio_url = _url; + } + } + if (this.show_slice) { + this.insertSubwidget( + this.$.find(".Ldt-CreateAnnotation-Slice"), + { + type: "Slice", + show_arrow: this.show_arrow, + annotation_type: this.slice_annotation_type, + onBoundsChanged: function(_from, _to) { + _this.begin = new IriSP.Model.Time(_from || 0); + _this.end = new IriSP.Model.Time(_to || 0); + _this.$.find(".Ldt-CreateAnnotation-Begin").html(_this.begin.toString()); + _this.$.find(".Ldt-CreateAnnotation-End").html(_this.end.toString()); + } + }, + "slice" + ); + } else { + if (this.show_arrow) { + this.insertSubwidget(this.$.find(".Ldt-CreateAnnotation-Arrow"), {type: "Arrow"},"arrow"); + } + this.onMediaEvent("timeupdate", function(_time) { + _this.begin = new IriSP.Model.Time(_time || 0); + _this.end = new IriSP.Model.Time(_time || 0); + _this.$.find(".Ldt-CreateAnnotation-Begin").html(_this.begin.toString()); + if (_this.arrow) { + _this.arrow.moveToTime(_time); + } + }); + } this.$.find(".Ldt-CreateAnnotation-Close").click(function() { _this.close_after_send ? _this.hide() @@ -148,6 +226,14 @@ _this.addKeyword(IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); return false; }); + this.$.find(".Ldt-CreateAnnotation-PolemicLi").each(function() { + var _el = IriSP.jQuery(this), + _kw = _el.text().replace(/(^\s+|\s+$)/g,''), + _msg = _this.l10n["polemic" + _kw]; + if (_msg) { + _el.attr("title",_msg); + } + }); this.$.find(".Ldt-CreateAnnotation-Description").bind("change keyup input paste", this.functionWrapper("onDescriptionChange")); if (this.show_title_field) { this.$.find(".Ldt-CreateAnnotation-Title").bind("change keyup input paste", this.functionWrapper("onTitleChange")); @@ -164,9 +250,6 @@ } this.onMdpEvent("CreateAnnotation.toggle","toggle"); - this.onMdpEvent("Slice.boundsChanged","onBoundsChanged"); - this.begin = new IriSP.Model.Time(); - this.end = this.source.getDuration(); this.$.find("form").submit(this.functionWrapper("onSubmit")); } @@ -190,17 +273,18 @@ if (this.minimize_annotation_widget) { this.player.trigger("Annotation.minimize"); } - this.player.trigger("Slice.show"); } IriSP.Widgets.CreateAnnotation.prototype.hide = function() { + if (this.recorder) { + this.recorder.stopRecord(); + } if (!this.always_visible) { this.visible = false; this.$.slideUp(); if (this.minimize_annotation_widget) { this.player.trigger("Annotation.maximize"); } - this.player.trigger("Slice.hide"); } } @@ -214,13 +298,6 @@ } } -IriSP.Widgets.CreateAnnotation.prototype.onBoundsChanged = function(_values) { - this.begin = new IriSP.Model.Time(_values[0] || 0); - this.end = new IriSP.Model.Time(_values[1] || 0); - this.$.find(".Ldt-CreateAnnotation-Begin").html(this.begin.toString()); - this.$.find(".Ldt-CreateAnnotation-End").html(this.end.toString()); -} - IriSP.Widgets.CreateAnnotation.prototype.addKeyword = function(_keyword) { var _field = this.$.find(".Ldt-CreateAnnotation-Description"), _rx = IriSP.Model.regexpFromTextOrArray(_keyword), @@ -276,7 +353,11 @@ IriSP.Widgets.CreateAnnotation.prototype.onSubmit = function() { /* Si les champs obligatoires sont vides, on annule l'envoi */ if (!this.onDescriptionChange() || (this.show_title_field && !this.onTitleChange()) || (this.show_creator_field && !this.onCreatorChange())) { - return; + return false; + } + + if (this.recorder) { + this.recorder.stopRecord(); } var _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* Création d'une liste d'annotations contenant une annotation afin de l'envoyer au serveur */ @@ -312,6 +393,14 @@ _annotation.setTags(this.$.find(".Ldt-CreateAnnotation-TagLi.selected") .map(function() { return IriSP.jQuery(this).attr("tag-id")})); /*Liste des ids de tags */ + if (this.audio_url) { + _annotation.audio = { + src: "mic", + mimetype: "audio/mp3", + href: this.audio_url + }; + } + /* Les données créateur/date de création sont envoyées non pas dans l'annotation, mais dans le projet */ if (this.show_creator_field) { _export.creator = this.$.find(".Ldt-CreateAnnotation-Creator").val(); diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/JwpPlayer.js --- a/src/ldt/ldt/static/ldt/metadataplayer/JwpPlayer.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/JwpPlayer.js Sat Oct 06 00:40:42 2012 +0200 @@ -19,11 +19,15 @@ this.video = this.media.video; } + if (typeof this.streamer === "undefined") { + this.streamer = this.media.streamer; + } + if (typeof this.streamer === "function") { this.streamer = this.streamer(this.video); } - if (typeof this.streamer === "string") { + if (typeof this.streamer === "string" && (this.provider === "http" || this.provider === "rtmp")) { this.video = this.video.replace(this.streamer,""); _opts.streamer = this.streamer; } diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js --- a/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js Sat Oct 06 00:40:42 2012 +0200 @@ -680,6 +680,21 @@ this.elementType = 'media'; this.duration = new IriSP.Model.Time(); this.video = ''; + var _this = this; + this.on("timeupdate", function(_time) { + _this.getAnnotations().filter(function(_a) { + return (_a.end <= _time || _a.begin > _time) && _a.playing + }).forEach(function(_a) { + _a.playing = false; + _a.trigger("leave"); + }); + _this.getAnnotations().filter(function(_a) { + return _a.begin <= _time && _a.end > _time && !_a.playing + }).forEach(function(_a) { + _a.playing = true; + _a.trigger("enter"); + }); + }); } IriSP.Model.Media.prototype = new IriSP.Model.Element(); @@ -754,6 +769,11 @@ this.elementType = 'annotation'; this.begin = new IriSP.Model.Time(); this.end = new IriSP.Model.Time(); + this.playing = false; + var _this = this; + this.on("click", function() { + _this.getMedia().setCurrentTime(_this.begin); + }); } IriSP.Model.Annotation.prototype = new IriSP.Model.Element(null); @@ -809,6 +829,10 @@ this.title = this.annotation.title; this.description = this.annotation.description; this.color = this.annotation.color; + var _this = this; + this.on("click", function() { + _mashup.setCurrentTime(_this.begin); + }); } IriSP.Model.MashedAnnotation.prototype = new IriSP.Model.Element(null); @@ -841,6 +865,30 @@ this.duration = new IriSP.Model.Time(); this.segments = new IriSP.Model.List(_source.directory); this.medias = new IriSP.Model.List(_source.directory); + var _currentMedia = null; + var _this = this; + this.on("timeupdate", function(_time) { + _this.getAnnotations().filter(function(_a) { + return (_a.end <= _time || _a.begin > _time) && _a.playing + }).forEach(function(_a) { + _a.playing = false; + _a.trigger("leave"); + }); + _this.getAnnotations().filter(function(_a) { + return _a.begin <= _time && _a.end > _time && !_a.playing + }).forEach(function(_a) { + _a.playing = true; + _a.trigger("enter"); + var _m = _a.getMedia(); + if (_m !== _currentMedia) { + if (_currentMedia) { + _currentMedia.trigger("leave"); + } + _m.trigger("enter"); + _currentMedia = _m; + } + }); + }); } IriSP.Model.Mashup.prototype = new IriSP.Model.Element(); @@ -1139,7 +1187,9 @@ backboneRelational: "backbone-relational.js", paper: "paper.js", jqueryMousewheel: "jquery.mousewheel.min.js", - renkanPublish: "renkan-publish.js" + renkanPublish: "renkan-publish.js", + processing: "processing-1.3.6.min.js", + recordMicSwf: "record_mic.swf" }, locations : { // use to define locations outside default_dir @@ -1172,6 +1222,15 @@ noCss: true, requires: [ "swfObject" ] }, + AutoPlayer: { + noCss: true + }, + MashupPlayer: { + noCss: true + }, + AnnotationsList: { + requires: [ "jwplayer" ] + }, Sparkline: { noCss: true, requires: [ "raphael" ] @@ -1195,6 +1254,9 @@ }, Renkan: { requires: [ "backbone", "backboneRelational", "paper", "jqueryMousewheel", "renkanPublish" ] + }, + KnowledgeConcierge: { + requires: [ "processing" ] } } @@ -1302,7 +1364,7 @@ return _function.apply(_this, Array.prototype.slice.call(arguments, 0)); } } else { - console.log("Error, Unknown function IriSP.Widgets" + this.type + "." + _name) + console.log("Error, Unknown function IriSP.Widgets." + this.type + "." + _name) } } diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/MediaList.js --- a/src/ldt/ldt/static/ldt/metadataplayer/MediaList.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/MediaList.js Sat Oct 06 00:40:42 2012 +0200 @@ -57,9 +57,16 @@ } IriSP.Widgets.MediaList.prototype.draw = function() { - this.onMediaEvent("timeupdate","onTimeupdate"); this.$.addClass("Ldt-MediaListWidget") this.renderTemplate(); + var _this = this; + if (typeof this.media.getMedias === "function") { + this.media.getMedias().forEach(function(_m) { + _m.on("enter", function() { + _this.redraw(_m); + }); + }) + } this.redraw(); }; @@ -123,14 +130,3 @@ this.$.find('.Ldt-MediaList-Other').hide(); } }; - -IriSP.Widgets.MediaList.prototype.onTimeupdate = function(_time) { - var _media = this.source.currentMedia; - if (_media.elementType === "mashup") { - _media = _media.getMediaAtTime(_time); - } - if (typeof _media !== "undefined" && _media.id !== this.lastMedia) { - this.lastMedia = _media.id; - this.redraw(_media); - } -} diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/Mediafragment.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Mediafragment.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Mediafragment.js Sat Oct 06 00:40:42 2012 +0200 @@ -20,6 +20,12 @@ this.onMediaEvent("pause","setHashToTime"); this.onMediaEvent("seeked","setHashToTime"); this.goToHash(); + var _this = this; + this.getWidgetAnnotations().forEach(function(_annotation) { + _annotation.on("click", function() { + _this.setHashToAnnotation(_annotation.id); + }) + }) } IriSP.Widgets.Mediafragment.prototype.setWindowHash = function(_hash) { diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/Polemic.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Polemic.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Polemic.js Sat Oct 06 00:40:42 2012 +0200 @@ -168,8 +168,7 @@ }).mouseout(function() { _annotation.trigger("unselect"); }).click(function() { - _this.player.trigger("Mediafragment.setHashToAnnotation", _annotation.id); - _this.player.trigger("Tweet.show", _annotation.id); + _annotation.trigger("click"); }); _annotation.on("select", function() { _this.tooltip.show( diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/PopcornPlayer.js --- a/src/ldt/ldt/static/ldt/metadataplayer/PopcornPlayer.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/PopcornPlayer.js Sat Oct 06 00:40:42 2012 +0200 @@ -46,6 +46,9 @@ } _params.controls = 0; _params.modestbranding = 1; + if (this.autostart || this.autoplay) { + _params.autoplay = 1; + } _url = _urlparts[0] + '?' + IriSP.jQuery.param(_params); var _popcorn = Popcorn.youtube(this.container, _url); @@ -75,7 +78,11 @@ } this.$.html(_videoEl); var _popcorn = Popcorn("#" + _tmpId); + if (this.autostart || this.autoplay) { + _popcorn.autoplay(true); + } } + // Binding functions to Popcorn diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/Segments.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Segments.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Segments.js Sat Oct 06 00:40:42 2012 +0200 @@ -62,8 +62,7 @@ _annotation.trigger("unselect"); }) .click(function() { - _this.media.setCurrentTime(_annotation.begin); - _this.player.trigger("Mediafragment.setHashToAnnotation", _data.id); + _annotation.trigger("click"); }) .appendTo(_this.list_$) _annotation.on("select", function() { diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/Slice.css --- a/src/ldt/ldt/static/ldt/metadataplayer/Slice.css Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Slice.css Sat Oct 06 00:40:42 2012 +0200 @@ -1,7 +1,7 @@ /* Slider Widget */ .Ldt-Slice { - border-radius: 0; border: none; padding: 0; margin: 2px 0 12px; background: #B6B8B8; height: 8px; + border-radius: 0; border: none; padding: 0; margin: 12px 0 12px; background: #B6B8B8; height: 8px; } .Ldt-Slice .ui-slider-handle { diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/Slice.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Slice.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Slice.js Sat Oct 06 00:40:42 2012 +0200 @@ -10,41 +10,41 @@ IriSP.Widgets.Slice.prototype = new IriSP.Widgets.Widget(); IriSP.Widgets.Slice.prototype.defaults = { - start_visible : false, - live_update : true, - /* Shall the bounds change each time - the Annotation Widget sends an update (true) - or only when "show" is triggered (false) ? - - true is to be recommended when the widget is permanently displayed. - */ - override_bounds : true - /* Can the Annotation Widget bounds be overriden ? */ + show_arrow: false }; +IriSP.Widgets.Slice.prototype.template = + '
      ' + + '{{#show_arrow}}
      {{/show_arrow}}' + IriSP.Widgets.Slice.prototype.draw = function() { - this.$slider = IriSP.jQuery('
      ') - .addClass("Ldt-Slice") + this.renderTemplate(); + + this.$slider = this.$.find(".Ldt-Slice"); - this.$.append(this.$slider); + if (this.show_arrow) { + this.insertSubwidget(this.$.find(".Ldt-Slice-Arrow"), { type: "Arrow" },"arrow"); + } this.min = 0; - this.max = this.source.getDuration().valueOf(); + this.max = this.media.duration.valueOf(); var _this = this, _currentTime; this.$slider.slider({ range: true, - values: [0, 0], + values: [0, this.max], min: 0, max: this.max, change: function(event, ui) { - _this.player.trigger("Arrow.updatePosition",{ - widget:_this.type, - time:Math.floor((ui.values[0]+ui.values[1])/2) - }); - _this.player.trigger("Slice.boundsChanged",[ui.values[0], ui.values[1]]); + if (_this.arrow) { + _this.arrow.moveToTime((ui.values[0]+ui.values[1])/2) + } + if (_this.onBoundsChanged) { + _this.onBoundsChanged(ui.values[0],ui.values[1]); + } }, start: function() { _this.sliding = true; @@ -54,9 +54,6 @@ _currentTime = _this.media.getCurrentTime(); }, slide: function(event, ui) { - if (!_this.override_bounds && (ui.value < _this.min || ui.value > _this.max)) { - return false; - } _this.media.setCurrentTime(ui.value); }, stop: function() { @@ -64,36 +61,21 @@ _this.media.setCurrentTime(_currentTime); } }); + this.$slider.find(".ui-slider-handle:first").addClass("Ldt-Slice-left-handle"); this.$slider.find(".ui-slider-handle:last").addClass("Ldt-Slice-right-handle"); - if (this.start_visible) { - this.show(); - } else { - this.hide(); - } - this.onMdpEvent("Slice.show","show"); - this.onMdpEvent("Slice.hide","hide"); - this.onMdpEvent("Annotation.boundsChanged","storeBounds"); - this.player.trigger("Annotation.getBounds"); + + this.getWidgetAnnotations().forEach(function(_a) { + _a.on("enter", function() { + _this.$slider.slider("values",[_a.begin, _a.end]); + }); + }); }; IriSP.Widgets.Slice.prototype.show = function() { this.$slider.show(); - this.player.trigger("Arrow.takeover",this.type); - this.$slider.slider("values", [this.min, this.max]); } IriSP.Widgets.Slice.prototype.hide = function() { this.$slider.hide(); - this.player.trigger("Arrow.release"); } - -IriSP.Widgets.Slice.prototype.storeBounds = function(_values) { - if (!this.media.getPaused() && (this.min != _values[0] || this.max != _values[1])) { - this.min = _values[0]; - this.max = _values[1]; - if (this.live_update && !this.sliding) { - this.$slider.slider("values", [this.min, this.max]); - } - } -} \ No newline at end of file diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/Slider.css --- a/src/ldt/ldt/static/ldt/metadataplayer/Slider.css Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Slider.css Sat Oct 06 00:40:42 2012 +0200 @@ -12,3 +12,8 @@ background: #747474; } +.Ldt-Slider-Time { + position: absolute; top: -16px; background: #ffffc0; color: #000000; border-radius: 3px; z-index: 8; + font-size: 9px; width: 34px; border: 1px solid #999999; padding: 1px; margin-left: -20px; + display: none; text-align: center; font-weight: bold; +} diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/Slider.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Slider.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Slider.js Sat Oct 06 00:40:42 2012 +0200 @@ -15,12 +15,16 @@ set to zero for fixed slider */ }; +IriSP.Widgets.Slider.prototype.template = + '
      00:00
      ' + IriSP.Widgets.Slider.prototype.draw = function() { - this.$slider = IriSP.jQuery('
      ') - .addClass("Ldt-Slider"); + this.renderTemplate(); - this.$.append(this.$slider); + this.$time = this.$.find(".Ldt-Slider-Time"); + + this.$slider = this.$.find(".Ldt-Slider"); var _this = this; @@ -45,13 +49,21 @@ this.$slider.css(this.calculateSliderCss(this.minimized_height)); this.$handle.css(this.calculateHandleCss(this.minimized_height)); - this.$ - .mouseover(this.functionWrapper("onMouseover")) - .mouseout(this.functionWrapper("onMouseout")); - this.maximized = false; this.timeoutId = false; } + + this.$ + .mouseover(function() { + _this.$time.show(); + _this.onMouseover(); + }) + .mouseout(this.functionWrapper("onMouseout")) + .mousemove(function(_e) { + var _x = _e.pageX - _this.$.offset().left, + _t = new IriSP.Model.Time(_this.media.duration * _x / _this.width); + _this.$time.text(_t.toString()).css("left",_x); + }); }; IriSP.Widgets.Slider.prototype.onTimeupdate = function(_time) { @@ -73,6 +85,7 @@ } IriSP.Widgets.Slider.prototype.onMouseout = function() { + this.$time.hide(); if (this.minimize_timeout) { if (this.timeoutId) { window.clearTimeout(this.timeoutId); diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/Slideshare.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Slideshare.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Slideshare.js Sat Oct 06 00:40:42 2012 +0200 @@ -2,12 +2,6 @@ IriSP.Widgets.Slideshare = function(player, config) { IriSP.Widgets.Widget.call(this, player, config); - this.lastSlide = { - presentation: "", - slide: 0 - } - this.embedObject = null; - this.oembedCache = {} } IriSP.Widgets.Slideshare.prototype = new IriSP.Widgets.Widget(); @@ -32,99 +26,94 @@ '

      {{l10n.slides_}}


      '; IriSP.Widgets.Slideshare.prototype.draw = function() { - var _hide = false; - if (typeof this.annotation_type !== "undefined" && this.annotation_type) { - var _annType = this.source.getAnnotationTypes().searchByTitle(this.annotation_type); - _hide = !_annType.length; + + var _embedObject = null, + $container, + _lastEmbedded = "", + _this = this; + + function insertSlideshare(_presentation, _slide) { + if (_lastEmbedded === _presentation) { + if (_.embedObject && typeof _embedObject.jumpTo === "function") { + _embedObject.jumpTo(parseInt(_slide)); + } + } else { + _lastEmbedded = _presentation; + var _id = IriSP.Model.getUID(), + _params = { + allowScriptAccess: "always" + } + _atts = { + id: _id + }, + _flashvars = { + doc : _presentation, + startSlide : _slide + }; + $container.html('
      '); + swfobject.embedSWF( + "http://static.slidesharecdn.com/swf/ssplayer2.swf", + _id, + _this.embed_width, + _this.embed_height, + "8", + null, + _flashvars, + _params, + _atts + ); + _embedObject = document.getElementById(_id); + } + $container.show(); } - if (_hide) { + + var _annotations = this.getWidgetAnnotations(); + if (!_annotations.length) { this.$.hide(); } else { this.renderTemplate(); - this.$container = this.$.find(".Ldt-SlideShare-Container"); - this.onMediaEvent("timeupdate","onTimeupdate"); - this.onTimeupdate(0); + var _lastPres = "", + _embedObject = null, + _oembedCache = {}, + _this = this; + $container = this.$.find(".Ldt-SlideShare-Container"); + _annotations.forEach(function(_a) { + _a.on("leave", function() { + $container.hide(); + _lastPres = ""; + }); + _a.on("enter", function() { + var _description = _a.description, + _isurl = /^https?:\/\//.test(_description), + _presentation = _description.replace(/#.*$/,''), + _slidematch = _description.match(/(#|\?|&)id=(\d+)/), + _slide = parseInt(_slidematch && _slidematch.length > 2 ? _slidematch[2] : 1); + if (_presentation !== _lastPres) { + if (_isurl) { + if (typeof _oembedCache[_presentation] === "undefined") { + var _ajaxUrl = "http://www.slideshare.net/api/oembed/1?url=" + + encodeURIComponent(_presentation) + + "&format=jsonp&callback=?"; + IriSP.jQuery.getJSON(_ajaxUrl, function(_oembedData) { + var _presmatch = _oembedData.html.match(/doc=([a-z0-9\-_%]+)/i); + if (_presmatch && _presmatch.length > 1) { + _oembedCache[_presentation] = _presmatch[1]; + insertSlideshare(_presmatch[1], _slide); + } + }); + } else { + insertSlideshare(_oembedCache[_presentation], _slide); + } + } else { + insertSlideshare(_presentation, _slide); + } + } + if (_this.sync && _embedObject && typeof _embedObject.jumpTo === "function") { + _embedObject.jumpTo(parseInt(_slide)); + } + _lastPres = _presentation; + + }) + }) } } - -IriSP.Widgets.Slideshare.prototype.onTimeupdate = function(_time) { - var _list = this.getWidgetAnnotationsAtTime(); - if (_list.length) { - var _description = _list[0].description, - _isurl = /^https?:\/\//.test(_description), - _presentation = _description.replace(/#.*$/,''), - _slidematch = _description.match(/(#|\?|&)id=(\d+)/), - _slide = parseInt(_slidematch && _slidematch.length > 2 ? _slidematch[2] : 1), - _this = this; - if (_presentation !== this.lastSlide.presentation) { - if (_isurl) { - if (typeof this.oembedCache[_presentation] === "undefined") { - var _ajaxUrl = "http://www.slideshare.net/api/oembed/1?url=" - + encodeURIComponent(_presentation) - + "&format=jsonp&callback=?"; - IriSP.jQuery.getJSON(_ajaxUrl, function(_oembedData) { - var _presmatch = _oembedData.html.match(/doc=([a-z0-9\-_%]+)/i); - if (_presmatch && _presmatch.length > 1) { - _this.oembedCache[_presentation] = _presmatch[1]; - _this.insertSlideshare(_presmatch[1], _slide); - } - }); - } else { - this.insertSlideshare(this.oembedCache[_presentation], _slide); - } - } else { - this.insertSlideshare(_presentation, _slide); - } - } - if (_slide != this.lastSlide.slide && this.sync && this.embedObject && typeof this.embedObject.jumpTo === "function") { - this.embedObject.jumpTo(parseInt(_slide)); - } - this.lastSlide = { - presentation: _presentation, - slide: _slide - } - } else { - if (this.lastSlide.presentation) { - this.$container.hide(); - this.lastSlide = { - presentation: "", - slide: 0 - } - } - } -} - -IriSP.Widgets.Slideshare.prototype.insertSlideshare = function(_presentation, _slide) { - if (this.lastEmbedded === _presentation) { - if (this.embedObject && typeof this.embedObject.jumpTo === "function") { - this.embedObject.jumpTo(parseInt(_slide)); - } - } else { - this.lastEmbedded = _presentation; - var _id = IriSP.Model.getUID(), - _params = { - allowScriptAccess: "always" - } - _atts = { - id: _id - }, - _flashvars = { - doc : _presentation, - startSlide : _slide - }; - this.$container.html('
      '); - swfobject.embedSWF( - "http://static.slidesharecdn.com/swf/ssplayer2.swf", - _id, - this.embed_width, - this.embed_height, - "8", - null, - _flashvars, - _params, - _atts - ); - this.embedObject = document.getElementById(_id); - } - this.$container.show(); -} diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js Sat Oct 06 00:40:42 2012 +0200 @@ -44,35 +44,27 @@ this.onMdpEvent("search.cleared", "onSearch"); if (this.segment_annotation_type) { - this.onMediaEvent("timeupdate","onTimeupdate"); + var _this = this; + this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).forEach(function(_a) { + _a.on("enter", function() { + _this.redraw(_a.begin, _a.end); + }) + }); } else { this.redraw(); } } -IriSP.Widgets.Tagcloud.prototype.onTimeupdate = function(_time) { - var _list = this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).filter(function(_annotation) { - return _annotation.begin <= _time && _annotation.end > _time; - }); - if (_list.length) { - if (_list[0].begin !== this.begin_time || _list[0].end !== this.end_time) { - this.begin_time = _list[0].begin; - this.end_time = _list[0].end; - this.redraw(); - } - } -} - -IriSP.Widgets.Tagcloud.prototype.redraw = function() { +IriSP.Widgets.Tagcloud.prototype.redraw = function(_from, _to) { var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g, _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g, _words = {}, _this = this, _annotations = this.getWidgetAnnotations(); - if (typeof this.begin_time !== "undefined" && typeof this.end_time !== "undefined") { + if (typeof _from !== "undefined" && typeof _to !== "undefined") { _annotations = _annotations.filter(function(_annotation) { - return _annotation.begin >= _this.begin_time && _annotation.end <= _this.end_time; + return _annotation.begin >= _from && _annotation.end <= _to; }) } diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/Tweet.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Tweet.js Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Tweet.js Sat Oct 06 00:40:42 2012 +0200 @@ -25,6 +25,7 @@ "color" : "#05aae6" } ], + annotation_type: "tweet", pin_at_start: false } @@ -66,7 +67,6 @@ IriSP.Widgets.Tweet.prototype.draw = function() { this.renderTemplate(); - this.onMdpEvent("Tweet.show","show"); this.pinned = this.pin_at_start; var _this = this; this.$.find(".Ldt-Tweet-Pin").click(function() { @@ -84,10 +84,14 @@ _this.hide(); }); this.$.hide(); + this.getWidgetAnnotations().forEach(function(_annotation) { + _annotation.on("click", function() { + _this.show(_annotation); + }); + }); } -IriSP.Widgets.Tweet.prototype.show = function(_id) { - var _tweet = this.source.getElement(_id); +IriSP.Widgets.Tweet.prototype.show = function(_tweet) { if (typeof _tweet !== "undefined" && typeof _tweet.source !== "undefined") { var _entities = []; for (var _i = 0; _i < _tweet.source.entities.hashtags.length; _i++) { diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/metadataplayer/img/voiceannotation.png Binary file src/ldt/ldt/static/ldt/metadataplayer/img/voiceannotation.png has changed diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/static/ldt/swf/record_mic.swf Binary file src/ldt/ldt/static/ldt/swf/record_mic.swf has changed diff -r 1df9868d8e16 -r 0ffe58cb50bf src/ldt/ldt/user/forms.py --- a/src/ldt/ldt/user/forms.py Thu Sep 20 17:06:25 2012 +0900 +++ b/src/ldt/ldt/user/forms.py Sat Oct 06 00:40:42 2012 +0200 @@ -120,7 +120,8 @@ class PictureForm(forms.Form): - image = forms.ImageField(label=_("Profile picture"), required=False) + image=forms.ImageField(label=_("Profile picture"), required=False) + url_image=forms.CharField(max_length=1024, required=False) def __init__(self, model=None, *args, **kwargs): self.model = model