add new 'bureau event' type
This commit is contained in:
parent
9776208b91
commit
40e1df608d
|
@ -0,0 +1,20 @@
|
|||
from zope import schema
|
||||
from zope.interface import implements
|
||||
from z3c.relationfield.schema import RelationChoice
|
||||
|
||||
from plone.formwidget.contenttree import ObjPathSourceBinder
|
||||
|
||||
from tabellio.agenda.interfaces import MessageFactory as _
|
||||
from parlevent import IParlEvent, ParlEvent
|
||||
|
||||
|
||||
class IBurEvent(IParlEvent):
|
||||
pass
|
||||
|
||||
|
||||
class BurEvent(ParlEvent):
|
||||
implements(IBurEvent)
|
||||
|
||||
def klass(self):
|
||||
return 'bureau-event'
|
||||
|
|
@ -115,7 +115,10 @@ class EventBaseView:
|
|||
start = self.context.start
|
||||
|
||||
if portal_type is None:
|
||||
portal_type = ('tabellio.agenda.parlevent', 'tabellio.agenda.comevent')
|
||||
portal_type = ('tabellio.agenda.parlevent',
|
||||
'tabellio.agenda.comevent',
|
||||
'tabellio.agenda.burevent',
|
||||
)
|
||||
|
||||
monthly_view = MonthlyView(self.context, init_calendar=True)
|
||||
serie_of_events = monthly_view.get_events_from_catalog(
|
||||
|
@ -135,7 +138,11 @@ class EventBaseView:
|
|||
start = self.context.start - datetime.timedelta(100)
|
||||
|
||||
if portal_type is None:
|
||||
portal_type = ('tabellio.agenda.event', 'tabellio.agenda.parlevent', 'tabellio.agenda.comevent')
|
||||
portal_type = ('tabellio.agenda.event',
|
||||
'tabellio.agenda.parlevent',
|
||||
'tabellio.agenda.comevent',
|
||||
'tabellio.agenda.burevent'
|
||||
)
|
||||
|
||||
monthly_view = MonthlyView(self.context, init_calendar=True)
|
||||
serie_of_events = monthly_view.get_events_from_catalog(
|
||||
|
|
|
@ -34,8 +34,9 @@ class AgendaSelectorVocabulary(object):
|
|||
def __call__(self, context):
|
||||
values = [('all', _(u'All events')),
|
||||
('parlevent', _(u'Parlementary Events')),
|
||||
('burevent', _(u'Bureau Events')),
|
||||
('comevent', _(u'Commission Events')),
|
||||
('parlcomevent', _(u'Parlmentary and Commission Events')),
|
||||
('parlcomevent', _(u'Parlmentary, Commission and Bureau Events')),
|
||||
('genevent', _(u'General Events'))]
|
||||
terms = []
|
||||
for key, value in values:
|
||||
|
@ -89,25 +90,35 @@ class View(grok.View, utils.MonthlyView):
|
|||
return ['parl']
|
||||
elif self.context.selector == 'comevent':
|
||||
return ['com']
|
||||
elif self.context.selector == 'burevent':
|
||||
return ['bur']
|
||||
elif self.context.selector == 'genevent':
|
||||
return ['gen']
|
||||
elif self.context.selector == 'parlcomevent':
|
||||
return ['parl', 'com']
|
||||
return ['parl', 'com', 'bur']
|
||||
else:
|
||||
return ['parl', 'com', 'gen']
|
||||
return ['parl', 'com', 'bur', 'gen']
|
||||
|
||||
def get_events_from_catalog(self, start, end, **keywords):
|
||||
if self.context.selector == 'parlevent':
|
||||
portal_type = ['tabellio.agenda.parlevent']
|
||||
elif self.context.selector == 'comevent':
|
||||
portal_type = ['tabellio.agenda.comevent']
|
||||
elif self.context.selector == 'burevent':
|
||||
portal_type = ['tabellio.agenda.burevent']
|
||||
elif self.context.selector == 'genevent':
|
||||
portal_type = ['tabellio.agenda.event']
|
||||
elif self.context.selector == 'parlcomevent':
|
||||
portal_type = ['tabellio.agenda.parlevent', 'tabellio.agenda.comevent']
|
||||
portal_type = ['tabellio.agenda.parlevent',
|
||||
'tabellio.agenda.comevent',
|
||||
'tabellio.agenda.burevent',
|
||||
]
|
||||
else:
|
||||
portal_type = ['tabellio.agenda.event', 'tabellio.agenda.parlevent',
|
||||
'tabellio.agenda.comevent']
|
||||
portal_type = ['tabellio.agenda.event',
|
||||
'tabellio.agenda.parlevent',
|
||||
'tabellio.agenda.burevent',
|
||||
'tabellio.agenda.comevent',
|
||||
]
|
||||
|
||||
return utils.MonthlyView.get_events_from_catalog(self, start, end,
|
||||
portal_type=portal_type, **keywords)
|
||||
|
|
|
@ -114,6 +114,7 @@
|
|||
<ul>
|
||||
<li class="parlevent" tal:condition="python: 'parl' in view.shown_events()">Séances plénières</li>
|
||||
<li class="comevent" tal:condition="python: 'com' in view.shown_events()">Commissions</li>
|
||||
<li class="burevent" tal:condition="python: 'bur' in view.shown_events()">Bureaux</li>
|
||||
<li class="event" tal:condition="python: 'gen' in view.shown_events()">Activités</li>
|
||||
<li class="misc">Événements multiples</li>
|
||||
</ul>
|
||||
|
@ -196,6 +197,7 @@ jq('#tabellio-agenda tbody a').click(
|
|||
<ul>
|
||||
<li class="parlevent" tal:condition="python: 'parl' in view.shown_events()">Séances plénières</li>
|
||||
<li class="comevent" tal:condition="python: 'com' in view.shown_events()">Commissions</li>
|
||||
<li class="burevent" tal:condition="python: 'bur' in view.shown_events()">Bureaux</li>
|
||||
<li class="event" tal:condition="python: 'gen' in view.shown_events()">Activités</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -7,6 +7,7 @@ from z3c.form.interfaces import IFormLayer
|
|||
from event import IEvent
|
||||
from parlevent import IParlEvent
|
||||
from comevent import IComEvent
|
||||
from burevent import IBurEvent
|
||||
|
||||
class IEventIndexer(Interface):
|
||||
"""Dexterity behavior interface for enabling the dynamic SearchableText
|
||||
|
|
|
@ -59,9 +59,11 @@ class ParlEventBaseView(EventBaseView):
|
|||
def next_event_url(self):
|
||||
return EventBaseView.next_event_url(self,
|
||||
portal_type=('tabellio.agenda.parlevent',
|
||||
'tabellio.agenda.burevent',
|
||||
'tabellio.agenda.comevent'))
|
||||
|
||||
def previous_event_url(self):
|
||||
return EventBaseView.previous_event_url(self,
|
||||
portal_type=('tabellio.agenda.parlevent',
|
||||
'tabellio.agenda.burevent',
|
||||
'tabellio.agenda.comevent'))
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
<object name="tabellio.agenda.folder" meta_type="Dexterity FTI" />
|
||||
<object name="tabellio.agenda.event" meta_type="Dexterity FTI" />
|
||||
<object name="tabellio.agenda.parlevent" meta_type="Dexterity FTI" />
|
||||
<object name="tabellio.agenda.burevent" meta_type="Dexterity FTI" />
|
||||
<object name="tabellio.agenda.comevent" meta_type="Dexterity FTI" />
|
||||
</object>
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0"?>
|
||||
<object name="tabellio.agenda.burevent" meta_type="Dexterity FTI"
|
||||
i18n:domain="tabellio.agenda" xmlns:i18n="http://xml.zope.org/namespaces/i18n">
|
||||
|
||||
<!-- Basic metadata -->
|
||||
<property name="title" i18n:translate="">Bureau Event</property>
|
||||
<property name="description" i18n:translate="">A bureau event</property>
|
||||
<property name="content_icon">document_icon.gif</property>
|
||||
<property name="allow_discussion">False</property>
|
||||
<property name="global_allow">True</property>
|
||||
<property name="filter_content_types">True</property>
|
||||
<property name="allowed_content_types" />
|
||||
|
||||
<!-- schema interface -->
|
||||
<property name="schema">tabellio.agenda.burevent.IBurEvent</property>
|
||||
|
||||
<!-- class used for content items -->
|
||||
<property name="klass">tabellio.agenda.burevent.BurEvent</property>
|
||||
|
||||
<!-- add permission -->
|
||||
<property name="add_permission">cmf.AddPortalContent</property>
|
||||
|
||||
<!-- enabled behaviors -->
|
||||
<property name="behaviors">
|
||||
<element value="plone.app.content.interfaces.INameFromTitle" />
|
||||
<element value="tabellio.agenda.indexer.IEventIndexer"/>
|
||||
</property>
|
||||
|
||||
<!-- View information -->
|
||||
<property name="default_view">view</property>
|
||||
<property name="default_view_fallback">False</property>
|
||||
<property name="view_methods">
|
||||
<element value="view"/>
|
||||
</property>
|
||||
|
||||
<!-- Method aliases -->
|
||||
<alias from="(Default)" to="(dynamic view)"/>
|
||||
<alias from="edit" to="@@edit"/>
|
||||
<alias from="sharing" to="@@sharing"/>
|
||||
<alias from="view" to="(selected layout)"/>
|
||||
|
||||
<!-- Actions -->
|
||||
<action title="View" action_id="view" category="object" condition_expr=""
|
||||
url_expr="string:${object_url}" visible="True">
|
||||
<permission value="View"/>
|
||||
</action>
|
||||
<action title="Edit" action_id="edit" category="object" condition_expr=""
|
||||
url_expr="string:${object_url}/edit" visible="True">
|
||||
<permission value="Modify portal content"/>
|
||||
</action>
|
||||
</object>
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
<property name="filter_content_types">True</property>
|
||||
<property name="allowed_content_types">
|
||||
<element value="tabellio.agenda.comevent"/>
|
||||
<element value="tabellio.agenda.burevent"/>
|
||||
<element value="tabellio.agenda.event"/>
|
||||
<element value="tabellio.agenda.folder"/>
|
||||
<element value="tabellio.agenda.parlevent"/>
|
||||
|
|
|
@ -46,6 +46,7 @@ class MonthlyView:
|
|||
if portal_type is None:
|
||||
portal_type = ('tabellio.agenda.event',
|
||||
'tabellio.agenda.parlevent',
|
||||
'tabellio.agenda.burevent',
|
||||
'tabellio.agenda.comevent')
|
||||
|
||||
catalog = getToolByName(self.context, 'portal_catalog')
|
||||
|
|
Reference in New Issue