summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2011-12-02 14:53:07 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2011-12-02 14:53:07 (GMT)
commitb0f7b6f9cce0b902dd6f8533fd41af9bdc279e9e (patch)
treeef12aa5c608368bc1f864b6a5d3ce497edce6b33
parentef52b1452bef344ec90f0d88f3f7642f3ef6347f (diff)
downloadtabellio.webviews-b0f7b6f9cce0b902dd6f8533fd41af9bdc279e9e.zip
tabellio.webviews-b0f7b6f9cce0b902dd6f8533fd41af9bdc279e9e.tar.gz
tabellio.webviews-b0f7b6f9cce0b902dd6f8533fd41af9bdc279e9e.tar.bz2
Turn "listen" link into a popup if a player is configured (#995)
-rw-r--r--tabellio/webviews/streaming.pt11
-rw-r--r--tabellio/webviews/streaming.py10
2 files changed, 20 insertions, 1 deletions
diff --git a/tabellio/webviews/streaming.pt b/tabellio/webviews/streaming.pt
index 52e466e..716f46f 100644
--- a/tabellio/webviews/streaming.pt
+++ b/tabellio/webviews/streaming.pt
@@ -15,8 +15,17 @@
tal:define="current_meeting view/current_meeting;
next_meeting view/next_meeting;">
<div id="seance-en-cours" tal:condition="python: current_meeting is not None">
- <a tal:attributes="href current_meeting/listen_url">Écoutez la séance en direct</a>
+ <a tal:attributes="href view/live_url">Écoutez la séance en direct</a>
</div>
+ <script>
+$('div#seance-en-cours a').click(function(event) {
+ if ($(this).attr('href').indexOf('.m3u') == -1) {
+ window.open($(this).attr('href'), 'streaming', 'width=220,height=220');
+ event.preventDefault();
+ }
+});
+ </script>
+
<div id="prochaine-seance" tal:condition="python: (next_meeting is not None and current_meeting is None)">
<a tal:attributes="href next_meeting/absolute_url">Prochaine séance :<br/>
<span tal:replace="next_meeting/longdatetime"/></a>
diff --git a/tabellio/webviews/streaming.py b/tabellio/webviews/streaming.py
index 47b1742..2f30ebc 100644
--- a/tabellio/webviews/streaming.py
+++ b/tabellio/webviews/streaming.py
@@ -1,5 +1,7 @@
import datetime
+from zope import component
+
from plone.portlets.interfaces import IPortletDataProvider
from zope.component import adapts, getMultiAdapter, queryUtility
from zope.formlib import form
@@ -8,6 +10,8 @@ from zope import schema
from Acquisition import aq_inner, aq_base, aq_parent
from Products.CMFCore.utils import getToolByName
+from plone.registry.interfaces import IRegistry
+from tabellio.config.interfaces import ITabellioSettings
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from plone.app.portlets.portlets import base
@@ -65,6 +69,12 @@ class Renderer(base.Renderer):
return event
return None
+ def live_url(self):
+ settings = component.getUtility(IRegistry).forInterface(ITabellioSettings, False)
+ if settings.embedded_audio_player_url:
+ return settings.embedded_audio_player_url
+ return self.current_meeting.absolute_url() + '/ecouter.m3u'
+
def next_meeting(self):
catalog = getToolByName(self.context, 'portal_catalog')
# do not go more than 30 days in the future