From 51c4eb0930139c248c7fb8107cc86d00007bbfff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 25 Nov 2011 15:14:17 +0100 Subject: [PATCH] imported event views from tabellio.agenda --- tabellio/pcfviews/comevent.py | 8 +++ tabellio/pcfviews/comevent_templates/view.pt | 61 +++++++++++++++++++ tabellio/pcfviews/event.py | 13 ++++ tabellio/pcfviews/event_templates/view.pt | 46 ++++++++++++++ tabellio/pcfviews/parlevent.py | 39 ++++++++++++ tabellio/pcfviews/parlevent_templates/view.pt | 59 ++++++++++++++++++ 6 files changed, 226 insertions(+) create mode 100644 tabellio/pcfviews/comevent.py create mode 100644 tabellio/pcfviews/comevent_templates/view.pt create mode 100644 tabellio/pcfviews/event.py create mode 100644 tabellio/pcfviews/event_templates/view.pt create mode 100644 tabellio/pcfviews/parlevent.py create mode 100644 tabellio/pcfviews/parlevent_templates/view.pt diff --git a/tabellio/pcfviews/comevent.py b/tabellio/pcfviews/comevent.py new file mode 100644 index 0000000..21aab2a --- /dev/null +++ b/tabellio/pcfviews/comevent.py @@ -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') + diff --git a/tabellio/pcfviews/comevent_templates/view.pt b/tabellio/pcfviews/comevent_templates/view.pt new file mode 100644 index 0000000..2d39a0e --- /dev/null +++ b/tabellio/pcfviews/comevent_templates/view.pt @@ -0,0 +1,61 @@ + + + + + + +
+

+
+ +
+ +
+ 30 + mars + Ouvrir le calendrier +
+ +
+ +

title
(2011-2012)

+ +

+ 14h00 + - + 16h00 + +

+ +

+

+ + + + + +
+

Ordre du jour

+
+
+ +
+ + + + + + diff --git a/tabellio/pcfviews/event.py b/tabellio/pcfviews/event.py new file mode 100644 index 0000000..51c39c4 --- /dev/null +++ b/tabellio/pcfviews/event.py @@ -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) diff --git a/tabellio/pcfviews/event_templates/view.pt b/tabellio/pcfviews/event_templates/view.pt new file mode 100644 index 0000000..5351847 --- /dev/null +++ b/tabellio/pcfviews/event_templates/view.pt @@ -0,0 +1,46 @@ + + + + + + +
+

+
+ +
+ +
+ 30 + mars + Ouvrir le calendrier +
+ +
+ +

title

+ +

+ 14h00 + - + 16h00 + +

+ +

+

+ +
+ + + + + + diff --git a/tabellio/pcfviews/parlevent.py b/tabellio/pcfviews/parlevent.py new file mode 100644 index 0000000..adcb8be --- /dev/null +++ b/tabellio/pcfviews/parlevent.py @@ -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' diff --git a/tabellio/pcfviews/parlevent_templates/view.pt b/tabellio/pcfviews/parlevent_templates/view.pt new file mode 100644 index 0000000..736aa63 --- /dev/null +++ b/tabellio/pcfviews/parlevent_templates/view.pt @@ -0,0 +1,59 @@ + + + + + + +
+

+
+ +
+ +
+ 30 + mars + Ouvrir le calendrier +
+ +
+ +

title
(2011-2012)

+ +

+ 14h00 + - + 16h00 + +

+ +

+

+ + + +
+

Ordre du jour

+
+
+ +
+ + + + + +