Le fichier Plinn utilise désormais le stockage par blob.
[Plinn.git] / skins / custom_content / event_edit_form.py
1 ##parameters=change='', change_and_view='', ajax=''
2 ##
3 form = context.REQUEST.form
4 if change and \
5 context.event_edit_control(**form) and \
6 context.setRedirect(context, 'object/edit', ajax=ajax):
7 return
8 elif change_and_view and \
9 context.event_edit_control(**form) and \
10 context.setRedirect(context, 'object/view', ajax=ajax):
11 return
12
13
14 options = {}
15 buttons = []
16 formFields = {}
17
18 formFields['title'] = form.get('title', context.Title()).strip()
19 formFields['location'] = form.get('location', context.location)
20 formFields['contact_name'] = form.get('contact_name', context.contact_name)
21 formFields['contact_email'] = form.get('contact_email', context.contact_email)
22 formFields['contact_phone'] = form.get('contact_phone', context.contact_phone)
23 formFields['event_type'] = form.get('event_type', context.Subject())
24 formFields['description'] = form.get('description', context.Description())
25 formFields['event_url'] = form.get('event_url', context.event_url)
26
27 start_date = context.start_date and context.start_date or context.end_date
28 formFields['start_date'] = {'year' : start_date.year(),
29 'month' : str(start_date.month()).zfill(2),
30 'day' : str(start_date.day()).zfill(2),
31 'hour' : str(start_date.hour()).zfill(2),
32 'minute': str(start_date.minute()).zfill(2)}
33
34 end_date = context.end_date
35 formFields['end_date'] = {'year' : end_date.year(),
36 'month' : str(end_date.month()).zfill(2),
37 'day' : str(end_date.day()).zfill(2),
38 'hour' : str(end_date.hour()).zfill(2),
39 'minute' : str(end_date.minute()).zfill(2)}
40
41
42
43 target = context.getActionInfo('object/edit')['url']
44 buttons.append( {'name': 'change', 'value': 'Change'} )
45 buttons.append( {'name': 'change_and_view', 'value': 'Change and View'} )
46 options['form'] = { 'action': target,
47 'listButtonInfos': tuple(buttons),
48 'fields' : formFields }
49
50 #return options['form']['fields']
51 return context.event_edit_template(**options)