summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chimere/migrations/0006_auto__add_multimediatype__add_field_picturefile_order__del_field_multi.py28
-rw-r--r--chimere/models.py39
-rw-r--r--chimere/static/chimere/css/styles.css35
-rw-r--r--chimere/static/chimere/img/8thNote.pngbin0 -> 1988 bytes
-rw-r--r--chimere/static/chimere/img/images_licences7
-rw-r--r--chimere/templates/chimere/blocks/head_jme.html13
-rw-r--r--chimere/templates/chimere/detail.html102
-rw-r--r--chimere/templates/chimere/main_map.html7
-rw-r--r--chimere/templatetags/chimere_tags.py10
-rw-r--r--chimere/views.py3
10 files changed, 165 insertions, 79 deletions
diff --git a/chimere/migrations/0006_auto__add_multimediatype__add_field_picturefile_order__del_field_multi.py b/chimere/migrations/0006_auto__add_multimediatype__add_field_picturefile_order__del_field_multi.py
index 9e369f7..908e868 100644
--- a/chimere/migrations/0006_auto__add_multimediatype__add_field_picturefile_order__del_field_multi.py
+++ b/chimere/migrations/0006_auto__add_multimediatype__add_field_picturefile_order__del_field_multi.py
@@ -13,7 +13,7 @@ class Migration(SchemaMigration):
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('media_type', self.gf('django.db.models.fields.CharField')(max_length=1)),
('name', self.gf('django.db.models.fields.CharField')(max_length=150)),
- ('mime_type', self.gf('django.db.models.fields.CharField')(max_length=50)),
+ ('mime_type', self.gf('django.db.models.fields.CharField')(max_length=50, null=True, blank=True)),
('available', self.gf('django.db.models.fields.BooleanField')(default=True)),
))
db.send_create_signal('chimere', ['MultimediaType'])
@@ -25,7 +25,7 @@ class Migration(SchemaMigration):
db.delete_column('chimere_multimediafile', 'file_type')
# Adding field 'MultimediaFile.iframe'
- db.add_column('chimere_multimediafile', 'iframe', self.gf('django.db.models.fields.CharField')(max_length=1000, null=True, blank=True), keep_default=False)
+ db.add_column('chimere_multimediafile', 'iframe', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False)
# Adding field 'MultimediaFile.order'
db.add_column('chimere_multimediafile', 'order', self.gf('django.db.models.fields.IntegerField')(default=1), keep_default=False)
@@ -33,12 +33,6 @@ class Migration(SchemaMigration):
# Adding field 'MultimediaFile.multimedia_type'
db.add_column('chimere_multimediafile', 'multimedia_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['chimere.MultimediaType'], null=True, blank=True), keep_default=False)
- # Changing field 'MultimediaFile.url'
- db.alter_column('chimere_multimediafile', 'url', self.gf('django.db.models.fields.CharField')(max_length=200, null=True))
-
- # Removing M2M table for field multimedia_files on 'Marker'
- db.delete_table('chimere_marker_multimedia_files')
-
def backwards(self, orm):
@@ -60,17 +54,6 @@ class Migration(SchemaMigration):
# Deleting field 'MultimediaFile.multimedia_type'
db.delete_column('chimere_multimediafile', 'multimedia_type_id')
- # User chose to not deal with backwards NULL issues for 'MultimediaFile.url'
- raise RuntimeError("Cannot reverse this migration. 'MultimediaFile.url' and its values cannot be restored.")
-
- # Adding M2M table for field multimedia_files on 'Marker'
- db.create_table('chimere_marker_multimedia_files', (
- ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
- ('marker', models.ForeignKey(orm['chimere.marker'], null=False)),
- ('multimediafile', models.ForeignKey(orm['chimere.multimediafile'], null=False))
- ))
- db.create_unique('chimere_marker_multimedia_files', ['marker_id', 'multimediafile_id'])
-
models = {
'chimere.area': {
@@ -117,6 +100,7 @@ class Migration(SchemaMigration):
'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}),
'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'multimedia_files': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['chimere.MultimediaFile']", 'null': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}),
'pictures': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['chimere.PictureFile']", 'null': 'True', 'blank': 'True'}),
'point': ('chimere.widgets.PointField', [], {}),
@@ -131,18 +115,18 @@ class Migration(SchemaMigration):
'chimere.multimediafile': {
'Meta': {'object_name': 'MultimediaFile'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'iframe': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'null': 'True', 'blank': 'True'}),
+ 'iframe': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.MultimediaType']", 'null': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '150', 'null': 'True', 'blank': 'True'}),
'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
- 'url': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})
+ 'url': ('django.db.models.fields.CharField', [], {'max_length': '200'})
},
'chimere.multimediatype': {
'Meta': {'object_name': 'MultimediaType'},
'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'media_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
- 'mime_type': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'mime_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '150'})
},
'chimere.news': {
diff --git a/chimere/models.py b/chimere/models.py
index 5282fca..52b13f4 100644
--- a/chimere/models.py
+++ b/chimere/models.py
@@ -238,16 +238,11 @@ class Marker(GeographicItem):
return self.name
@property
- def multimedia_pictures(self):
- pict = self.pictures.filter(miniature=False)
- if pict.count():
- return pict.all()
-
- @property
- def multimedia_files(self):
- mm = self.multimedia_files.filter()
- if mm.count():
- return mm.all()
+ def multimedia_items(self):
+ pict = list(self.pictures.filter(miniature=False).all())
+ mm = list(self.multimedia_files.all())
+ items = [(item.order, item) for item in pict + mm]
+ return [item for order, item in sorted(items)]
@property
def default_picture(self):
@@ -359,7 +354,8 @@ class MultimediaType(models.Model):
media_type = models.CharField(_(u"Media type"), max_length=1,
choices=MEDIA_TYPES)
name = models.CharField(_(u"Name"), max_length=150)
- mime_type = models.CharField(_(u"Mime type"), max_length=50)
+ mime_type = models.CharField(_(u"Mime type"), max_length=50, blank=True,
+ null=True)
available = models.BooleanField(_(u"Available"), default=True)
def __unicode__(self):
@@ -367,9 +363,8 @@ class MultimediaType(models.Model):
class MultimediaFile(models.Model):
name = models.CharField(_(u"Name"), max_length=150, blank=True, null=True)
- url = models.CharField(_(u"Url"), max_length=200, blank=True, null=True)
- iframe = models.CharField(_(u"Iframe"), max_length=1000, blank=True,
- null=True)
+ url = models.CharField(_(u"Url"), max_length=200)
+ iframe = models.BooleanField(u"Iframe", default=False)
order = models.IntegerField(_(u"Order"), default=1)
multimedia_type = models.ForeignKey(MultimediaType, blank=True,
null=True)
@@ -378,16 +373,12 @@ class MultimediaFile(models.Model):
return self.name
def clean(self):
- if self.url and not self.multimedia_type:
- raise ValidationError(_(u"Multimedia type is mandatory if you "\
- u"provide an url."))
- if not self.url and not self.iframe:
- raise ValidationError(_(u"You must provide at least provide an "\
- u" url or an iframe."))
- if self.url and self.iframe:
- raise ValidationError(_(u"You must provide an url OR an"\
- u"iframe."))
-
+ if self.url and not self.iframe:
+ raise ValidationError(_(u"Multimedia type is mandatory if is "\
+ u"not an iframe."))
+ if self.multimedia_type and self.iframe:
+ raise ValidationError(_(u"There is no multimedia type associated "\
+ u"to an iframe."))
class PictureFile(models.Model):
miniature = models.BooleanField(_(u"Miniature"))
diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css
index ef13e7d..8239a45 100644
--- a/chimere/static/chimere/css/styles.css
+++ b/chimere/static/chimere/css/styles.css
@@ -524,5 +524,38 @@ a#welcome_button{
.simple .cloud img{display:None;}
#gallery{
- display:none;
+ width:700px;
+ height:400px;
+}
+
+
+
+/** jme **/
+
+/*overlay controls*/
+.media-controls-wrapper {
+ position: absolute;
+ bottom: 0;
+ width: 100%;
+}
+/* position the fullscreen-button */
+div.volume-slider {
+ right: 46px;
+ width: 60px;
+}
+.fullscreen {
+ right: 8px;
+}
+/* prepare fullscreen-button for flash fullscreen in modern browsers */
+html > body .media-state {
+ height: auto;
+ top: 0;
+ bottom: 2em;
+}
+.jme-flashbutton-wrapper .media-controls-wrapper {
+ pointer-events: none;
+}
+
+.jme-flashbutton-wrapper .media-controls > *:not(.fullscreen) {
+ pointer-events: auto;
}
diff --git a/chimere/static/chimere/img/8thNote.png b/chimere/static/chimere/img/8thNote.png
new file mode 100644
index 0000000..1351aa3
--- /dev/null
+++ b/chimere/static/chimere/img/8thNote.png
Binary files differ
diff --git a/chimere/static/chimere/img/images_licences b/chimere/static/chimere/img/images_licences
index 6dc68fd..0e732fc 100644
--- a/chimere/static/chimere/img/images_licences
+++ b/chimere/static/chimere/img/images_licences
@@ -23,3 +23,10 @@ Author: The Tango! Desktop Project
Licence: Public domain
Url: http://commons.wikimedia.org/wiki/File:Edit-find-replace.svg
Url 2: http://commons.wikimedia.org/wiki/File:Internet-web-browser.svg
+
+* Quaver image credit
+
+ * An 8th-note.
+Author: Sbrools
+Licence: Public domain
+Url: https://commons.wikimedia.org/wiki/File:8thNote.svg
diff --git a/chimere/templates/chimere/blocks/head_jme.html b/chimere/templates/chimere/blocks/head_jme.html
new file mode 100644
index 0000000..f2b6767
--- /dev/null
+++ b/chimere/templates/chimere/blocks/head_jme.html
@@ -0,0 +1,13 @@
+<script class="jwPlayer" type="application/swf" src="{{STATIC_URL}}jme/packages/player.swf"></script>
+<script src="{{STATIC_URL}}jme/packages/mm.full.min.js"></script>
+<script src="{{STATIC_URL}}jme/utils/jmeEmbedControls.js"></script>
+<link rel="stylesheet" href="{{STATIC_URL}}jme/css/player-controls.css" />
+<!-- a11y-slider -->
+<script src="{{STATIC_URL}}jme/utils/a11y-slider.ext.js"></script>
+<!-- workaround for flash bug in ie -->
+<script src="{{STATIC_URL}}jme/utils/reinitjme.js"></script>
+<!-- fullwindow plugin -->
+<script class="jme-jwPlayer" type="application/swf" src="{{STATIC_URL}}jme/packages/jmefs.swf"></script>
+<script src="{{STATIC_URL}}jme/plugins/fullwindow.js"></script>
+<!-- useractivity -->
+<script src="{{STATIC_URL}}jme/utils/useractivity.js"></script>
diff --git a/chimere/templates/chimere/detail.html b/chimere/templates/chimere/detail.html
index 3218d63..e9c061c 100644
--- a/chimere/templates/chimere/detail.html
+++ b/chimere/templates/chimere/detail.html
@@ -10,7 +10,7 @@
{% for property in marker.getProperties %}
<p id='{{property.propertymodel.getNamedId}}'>{{ property.value|sanitize:"p b i br hr strong em span:style a:href:target ul li ol h1 h2 h3 h4"|safe}}</p>
{% endfor %}
- {% if multimedia_files or multimedia_pictures %}
+ {% if marker.multimedia_items %}
<a href='#' id='show_gallery_link'>{% trans "Show multimedia gallery" %}</a>
{% endif %}
</div>{% if share_networks %}
@@ -26,34 +26,80 @@
</a>
{% endif %}
</div>
-{% if multimedia_files or multimedia_pictures %}
+{% if marker.multimedia_items %}
<div id='gallery'>
- <ul>{% for multimedia_picture in multimedia_pictures %}
- <li><a href="#tab-picture-{% forloop.counter0 %}">{{ multimedia_picture.name }}</a></li>{% endfor %}
- {% for multimedia_file in multimedia_files %}
- <li><a href="#tab-multi-{% forloop.counter0 %}">{{ multimedia_file.name }}</a></li>{% endfor %}
- </ul>
- {% for multimedia_picture in multimedia_pictures %}
- <div id="tab-picture-{% forloop.counter0 %}">
- <img alt="{{multimedia_picture.name}}" src='{{MEDIA_URL}}{{multimedia_picture}}'/>
- </div>{% endfor %}
- {% for multimedia_file in multimedia_files %}
- <div id="tab-multi-{% forloop.counter0 %}">
- <div class="media-player">
- <span class="media-label">{{multimedia_file.name}}</span>
-
- <video preload="none" controls="controls">
- <source src="{{multimedia_file.url}}" type="video/mp4" />
- <div class="fallback">
- <div class="fallback-text">
- <p>{% trans "Please use a modern browser or install the non free Flash-Plugin."}</p>
- <ul>
- <li><a class="source" href="{{multimedia_file.url}}">{{multimedia_file.name}}</a></li>
- </ul>
+ <div class='tabs'>
+ <ul>{% for item in marker.multimedia_items %}
+ <li><a href="#tab-{{ forloop.counter }}">{{ item.name }}</a></li>{% endfor %}
+ </ul>
+ {% for multimedia_item in marker.multimedia_items %}
+ <div id="tab-{{ forloop.counter }}">
+ {% if multimedia_item.picture %}
+ <img alt="{{multimedia_picture.name}}" src='{{MEDIA_URL}}{{multimedia_picture}}'/>{% endif %}
+ {% if multimedia_item.url and not multimedia_item.iframe %}
+ <div class="media-player">
+ <span class="media-label">{{multimedia_item.name}}</span>
+ <video preload="none" controls="controls"{% ifequal multimedia_item.multimedia_type.media_type 'A' %} poster="{{STATIC_URL}}chimere/img/8thNote.png"{% endifequal %}>
+ <source src="{{multimedia_item.url}}" type="{{multimedia_item.multimedia_type.mime_type}}" />
+ <div class="fallback">
+ <div class="fallback-text">
+ <p>{% trans "Please use a modern browser or install the non free Flash-Plugin."%}</p>
+ <ul>
+ <li><a class="source" href="{{multimedia_item.url}}">{{multimedia_item.name}}</a></li>
+ </ul>
+ </div>
</div>
- </div>
- </video>
- </div>
- </div>{% endfor %}
+ </video>
+ </div>{% endif %}
+ {% if multimedia_item.iframe %}
+ <iframe class='video' src='{{multimedia_item.url}}'>
+ </iframe>{% endif %}
+ </div>{% endfor %}
+ </div>
</div>
+<script language='javascript' type='text/javascript'>
+$('html').addClass('js-on');
+$(function(){
+ $("#gallery").dialog({title:"{{marker.name}}", autoOpen: false,
+ height: "auto", width: "auto"});
+ $('div.media-player').jmeEmbedControls();
+ $('.tabs').tabs({
+ select: function(event, ui) {
+ //pause all medias
+ $('video').each(function(index){$(this).pause()});
+ $('audio').each(function(index){$(this).pause()});
+ //start current tabvideo
+ $('ui.panel video').each(function(index){
+ //prevents a Flash-Bug in IE with newest Flash-Player
+ $(this).reinitMedia({queue: true})
+ .play()
+ ;});
+ $('ui.panel audio').each(function(index){
+ //prevents a Flash-Bug in IE with newest Flash-Player
+ $(this).reinitMedia({queue: true})
+ .play()
+ ;});
+ }
+ });
+ $('div.media-player').bind('useractive', function(){
+ $('div.media-controls', this).stop().animate({opacity: 1});
+ }).bind('userinactive', function(){
+ $('div.media-controls', this).stop().animate({opacity: 0});
+ });
+});
+$("#gallery").bind( "dialogopen", function(event, ui) {
+ $("#gallery").dialog("option", "height", 'auto');
+ $("#gallery").dialog("option", "width", 'auto');
+ $("#gallery").dialog("option", "position", ['center', 'center']);
+});
+$("#gallery").bind( "dialogclose", function(event, ui) {
+ //pause all medias
+ $('video').each(function(index){$(this).pause()});
+ $('audio').each(function(index){$(this).pause()});
+});
+$('#show_gallery_link').click(function(){
+ $("#gallery").dialog('open');
+ return false;
+});
+</script>
{% endif %}
diff --git a/chimere/templates/chimere/main_map.html b/chimere/templates/chimere/main_map.html
index 7ae0d9f..348a9dd 100644
--- a/chimere/templates/chimere/main_map.html
+++ b/chimere/templates/chimere/main_map.html
@@ -1,9 +1,10 @@
{% extends "chimere/base.html" %}
{% load i18n unlocalize_point chimere_tags %}
{% block extra_head %}
- {{ block.super }}
- {% head_jquery %}
- {% head_chimere %}
+{{ block.super }}
+{% head_jquery %}
+{% head_jme %}
+{% head_chimere %}
{% endblock %}
{% block message_edit %}{% endblock %}
{% block sidebar %}
diff --git a/chimere/templatetags/chimere_tags.py b/chimere/templatetags/chimere_tags.py
index 0df8100..21e1fb0 100644
--- a/chimere/templatetags/chimere_tags.py
+++ b/chimere/templatetags/chimere_tags.py
@@ -54,6 +54,16 @@ def head_jquery(context):
}
return context_data
+@register.inclusion_tag('chimere/blocks/head_jme.html', takes_context=True)
+def head_jme(context):
+ """
+ Create context and display head elements (js, css, etc.) for jme.
+ """
+ context_data = {
+ "STATIC_URL": settings.STATIC_URL,
+ }
+ return context_data
+
@register.inclusion_tag('chimere/blocks/head_chimere.html', takes_context=True)
def head_chimere(context):
"""
diff --git a/chimere/views.py b/chimere/views.py
index a34fb57..0f662ba 100644
--- a/chimere/views.py
+++ b/chimere/views.py
@@ -376,7 +376,8 @@ def getDetail(request, area_name, marker_id):
for network in settings.SHARE_NETWORKS:
share_networks.append((network[0], network[1] % net_dct, network[2]))
response_dct['share_networks'] = share_networks
- response_dct['dated'] = settings.CHIMERE_DAYS_BEFORE_EVENT and marker.start_date
+ response_dct['dated'] = settings.CHIMERE_DAYS_BEFORE_EVENT \
+ and marker.start_date
return render_to_response('chimere/detail.html', response_dct,
context_instance=RequestContext(request))