encodeQuopriEmail et encodeMailHeader en sécu public.
[Plinn.git] / skins / control / add_event.py
1 ##parameters=ajax=''
2 from DateTime import DateTime
3 from Products.CMFCore.utils import getToolByName
4
5 eventId = DateTime().strftime("%Y%m%d_%H%M%S")
6 newOb = getattr(context, context.invokeFactory('Event', eventId, title=' '))
7
8 ttool = getToolByName(context, 'portal_types')
9 ti = ttool.Event
10 immediate_view = ti.immediate_view
11
12 immediate_view = ti.immediate_view
13 if immediate_view.find('/') > 0 :
14 newOb.setStatus('True', 'Object created.')
15 return newOb.setRedirect(newOb, immediate_view, ajax=ajax)
16 else :
17 from ZTUtils import make_query
18 ob_url = newOb.absolute_url()
19 query = make_query(portal_status_message = 'Object created.', ajax = ajax)
20 url = "%s/%s?%s" % (ob_url, immediate_view, query)
21 return response.redirect(url)