imported event views from tabellio.agenda

This commit is contained in:
Frédéric Péters 2011-11-25 15:14:17 +01:00
parent 60faca44a0
commit 51c4eb0930
6 changed files with 226 additions and 0 deletions

View File

@ -0,0 +1,8 @@
from five import grok
from parlevent import ParlEventBaseView
from tabellio.agenda.comevent import IComEvent
class View(grok.View, ParlEventBaseView):
grok.context(IComEvent)
grok.require('zope2.View')

View File

@ -0,0 +1,61 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
lang="en"
metal:use-macro="context/main_template/macros/master"
i18n:domain="tabellio.agenda">
<body>
<metal:main fill-slot="main">
<tal:main-macro metal:define-macro="main"
tal:define="toLocalizedTime nocall:context/@@plone/toLocalizedTime">
<div tal:replace="structure provider:plone.abovecontenttitle" />
<h1 class="documentFirstHeading"><span tal:content="context/aq_parent/Title"/></h1>
<div tal:replace="structure provider:plone.belowcontenttitle" />
<div class="blocdate">
<a href="#" class="previous" tal:attributes="href view/previous_event_url">←</a>
<div class="date">
<span class="day" tal:content="context/start/day">30</span>
<span class="month" tal:content="context/start_month">mars</span>
<a href="." class="open-calendar" tal:attributes="href string:./?year=${context/start/year}&month=${context/start/month}">Ouvrir le calendrier</a>
</div>
<a href="#" class="next" tal:attributes="href view/next_event_url">→</a>
</div>
<h1 class="parlevent-title"><span tal:content="context/title">title</span><br/><span tal:content="string: (${context/session})">(2011-2012)</span></h1>
<p>
<span class="parlevent-start" tal:content="string: ${context/start_hour}">14h00</span>
<span tal:condition="context/end"> -
<span class="parlevent-end" tal:content="string: ${context/end_hour}">16h00</span>
</span>
</p>
<p class="place" tal:content="context/place">
</p>
<ul id="cri-stream">
<li><a href="#" class="cri" tal:condition="python: context.cri and context.cri.to_object"
tal:attributes="href context/cri/to_object/absolute_url">Compte-rendu intégral</a>
<span class="cri" tal:condition="python: not(context.cri and context.cri.to_object)">Compte-rendu intégral (non disponible)</span></li>
<li><a href="#" class="streaming" tal:condition="view/has_stream">Streaming</a>
<span class="streaming" tal:condition="not: view/has_stream">Streaming (non disponible)</span></li>
</ul>
<div class="order-of-the-day" tal:condition="context/order_of_the_day">
<h2>Ordre du jour</h2>
<div tal:content="structure context/order_of_the_day/output"/>
</div>
<div tal:replace="structure provider:plone.belowcontentbody" />
</tal:main-macro>
</metal:main>
</body>
</html>

View File

@ -0,0 +1,13 @@
from five import grok
from tabellio.agenda.event import EventBaseView, IEvent
class View(grok.View, EventBaseView):
grok.context(IEvent)
grok.require('zope2.View')
def next_event_url(self):
return EventBaseView.next_event_url(self)
def previous_event_url(self):
return EventBaseView.previous_event_url(self)

View File

@ -0,0 +1,46 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
lang="en"
metal:use-macro="context/main_template/macros/master"
i18n:domain="tabellio.agenda">
<body>
<metal:main fill-slot="main">
<tal:main-macro metal:define-macro="main"
tal:define="toLocalizedTime nocall:context/@@plone/toLocalizedTime">
<div tal:replace="structure provider:plone.abovecontenttitle" />
<h1 class="documentFirstHeading"><span tal:content="context/aq_parent/Title"/></h1>
<div tal:replace="structure provider:plone.belowcontenttitle" />
<div class="blocdate">
<a href="#" class="previous" tal:attributes="href view/previous_event_url">←</a>
<div class="date">
<span class="day" tal:content="context/start/day">30</span>
<span class="month" tal:content="context/start_month">mars</span>
<a href="." class="open-calendar" tal:attributes="href string:./?year=${context/start/year}&month=${context/start/month}">Ouvrir le calendrier</a>
</div>
<a href="#" class="next" tal:attributes="href view/next_event_url">→</a>
</div>
<h1 class="parlevent-title"><span tal:content="context/title">title</span></h1>
<p tal:condition="context/start_hour">
<span class="parlevent-start" tal:content="string: ${context/start_hour}">14h00</span>
<span tal:condition="context/end"> -
<span class="parlevent-end" tal:content="string: ${context/end_hour}">16h00</span>
</span>
</p>
<p class="place" tal:content="context/place">
</p>
<div tal:replace="structure provider:plone.belowcontentbody" />
</tal:main-macro>
</metal:main>
</body>
</html>

View File

@ -0,0 +1,39 @@
import os
from five import grok
from zope import schema, component
from Products.CMFCore.utils import getToolByName
from plone.registry.interfaces import IRegistry
from tabellio.config.interfaces import ITabellioSettings
import tabellio.agenda.parlevent
class ParlEventBaseView(tabellio.agenda.parlevent.ParlEventBaseView):
def get_stream_name(self):
filename = '%04d%02d%02d%02d-SEAN.mp3' % (
self.context.start.year, self.context.start.month,
self.context.start.day, self.context.start.hour)
return filename
def has_stream(self):
settings = component.getUtility(IRegistry).forInterface(ITabellioSettings, False)
if not settings.audiofiles_path:
return False
return os.path.exists(os.path.join(settings.audiofiles_path, self.get_stream_name()))
class View(grok.View, ParlEventBaseView):
grok.context(tabellio.agenda.parlevent.IParlEvent)
grok.require('zope2.View')
class M3U(grok.View, ParlEventBaseView):
grok.context(tabellio.agenda.parlevent.IParlEvent)
grok.require('zope2.View')
grok.name('seance.m3u')
def render(self):
portal_url = getToolByName(self.context, 'portal_url').getPortalObject().absolute_url()
self.request.response.setHeader('Content-type', 'audio/x-mpegurl')
return portal_url + '/mp3/' + self.get_stream_name() + '\n'

View File

@ -0,0 +1,59 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
lang="en"
metal:use-macro="context/main_template/macros/master"
i18n:domain="tabellio.agenda">
<body>
<metal:main fill-slot="main">
<tal:main-macro metal:define-macro="main"
tal:define="toLocalizedTime nocall:context/@@plone/toLocalizedTime">
<div tal:replace="structure provider:plone.abovecontenttitle" />
<h1 class="documentFirstHeading"><span tal:content="context/aq_parent/Title"/></h1>
<div tal:replace="structure provider:plone.belowcontenttitle" />
<div class="blocdate">
<a href="#" class="previous" tal:attributes="href view/previous_event_url">←</a>
<div class="date">
<span class="day" tal:content="context/start/day">30</span>
<span class="month" tal:content="context/start_month">mars</span>
<a href="." class="open-calendar" tal:attributes="href string:./?year=${context/start/year}&month=${context/start/month}">Ouvrir le calendrier</a>
</div>
<a href="#" class="next" tal:attributes="href view/next_event_url">→</a>
</div>
<h1 class="parlevent-title"><span tal:content="context/title">title</span><br/><span tal:content="string: (${context/session})">(2011-2012)</span></h1>
<p>
<span class="parlevent-start" tal:content="string: ${context/start_hour}">14h00</span>
<span tal:condition="context/end"> -
<span class="parlevent-end" tal:content="string: ${context/end_hour}">16h00</span>
</span>
</p>
<p class="place" tal:content="context/place">
</p>
<ul id="cri-stream">
<li><a href="#" class="cri" tal:condition="python: context.cri and context.cri.to_object"
tal:attributes="href context/cri/to_object/absolute_url">Compte-rendu intégral</a>
<span class="cri" tal:condition="python: not(context.cri and context.cri.to_object)">Compte-rendu intégral (non disponible)</span></li>
<li><a tal:attributes="href string:${context/absolute_url}/seance.m3u" class="streaming" tal:condition="view/has_stream">Streaming</a>
<span class="streaming" tal:condition="not: view/has_stream">Streaming (non disponible)</span></li>
</ul>
<div class="order-of-the-day" tal:condition="context/order_of_the_day">
<h2>Ordre du jour</h2>
<div tal:content="structure context/order_of_the_day/output"/>
</div>
<div tal:replace="structure provider:plone.belowcontentbody" />
</tal:main-macro>
</metal:main>
</body>
</html>