import (and modify) templates from tabellio.agenda

This commit is contained in:
Frédéric Péters 2011-11-25 15:24:44 +01:00
parent a6924fc28d
commit 17b8bcae5e
6 changed files with 194 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,47 @@
<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">Agenda</h1>
<div tal:replace="structure provider:plone.belowcontenttitle" />
<h2 tal:content="context/aq_parent/Title">Agenda parlementaire</h2>
<div id="agenda-view-switcher">
<a tal:attributes="href string:../?year=${context/start/year}&month=${context/start/month}">Calendrier</a> |
<a tal:attributes="href string:../list?year=${context/start/year}&month=${context/start/month}">Liste</a>
</div>
<h2><span tal:replace="context/longdatetime"/> : <span tal:replace="context/title"/></h2>
<p tal:condition="context/description" tal:content="context/description">
</p>
<p class="place">
Lieu : <span tal:replace="context/place"/>
</p>
<div class="order-of-the-day" tal:condition="python: context.order_of_the_day and context.order_of_the_day.output">
<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,40 @@
<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">Agenda</h1>
<div tal:replace="structure provider:plone.belowcontenttitle" />
<h2 tal:content="context/aq_parent/Title">Agenda parlementaire</h2>
<div id="agenda-view-switcher">
<a tal:attributes="href string:../?year=${context/start/year}&month=${context/start/month}">Calendrier</a> |
<a tal:attributes="href string:../list?year=${context/start/year}&month=${context/start/month}">Liste</a>
</div>
<h2><span tal:replace="context/longdatetime"/> : <span tal:replace="context/title"/></h2>
<p tal:condition="context/description" tal:content="context/description">
</p>
<p class="place">
Lieu : <span tal:replace="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,47 @@
<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">Agenda</h1>
<div tal:replace="structure provider:plone.belowcontenttitle" />
<h2 tal:content="context/aq_parent/Title">Agenda parlementaire</h2>
<div id="agenda-view-switcher">
<a tal:attributes="href string:../?year=${context/start/year}&month=${context/start/month}">Calendrier</a> |
<a tal:attributes="href string:../list?year=${context/start/year}&month=${context/start/month}">Liste</a>
</div>
<h2><span tal:replace="context/longdatetime"/> : <span tal:replace="context/title"/></h2>
<p tal:condition="context/description" tal:content="context/description">
</p>
<p class="place">
Lieu : <span tal:replace="context/place"/>
</p>
<div class="order-of-the-day" tal:condition="python: context.order_of_the_day and context.order_of_the_day.output">
<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>