clarification
[Plinn.git] / skins / custom_control / event_edit_control.py
1 ##parameters=title='', description='', event_type=[], start_date={}, end_date={}, location='', contact_name='', contact_email='', contact_phone='', event_url='', **kw
2 ##
3 from Products.CMFCalendar.exceptions import ResourceLockedError
4 from Products.Plinn.exceptions import DateTimeError
5 from DateTime import DateTime
6
7 try :
8 startDate = DateTime('%s/%s/%s %s %s' % (start_date['year'],
9 start_date['month'],
10 start_date['day'],
11 start_date['hour'],
12 start_date['minute']) )
13 context.setStartDate(startDate)
14 except DateTimeError:
15 return context.setStatus(False, "Start date is not valid.")
16
17
18 try :
19 endDate = DateTime('%s/%s/%s %s %s' % (end_date['year'],
20 end_date['month'],
21 end_date['day'],
22 end_date['hour'],
23 end_date['minute']) )
24 context.setEndDate(endDate)
25 except DateTimeError:
26 return context.setStatus(False, "End date is not valid.")
27
28 try:
29 context.edit( title=title
30 , description = description
31 , location = location
32 , contact_name = contact_name
33 , contact_email = contact_email
34 , contact_phone = contact_phone
35 , event_url = event_url
36 , eventType = event_type
37
38 , effectiveDay = startDate.day()
39 , effectiveMo = startDate.month()
40 , effectiveYear = startDate.year()
41 , start_time = startDate.AMPM()
42 , startAMPM=''
43
44 , expirationDay = endDate.day()
45 , expirationMo = endDate.month()
46 , expirationYear = endDate.year()
47 , stop_time = endDate.AMPM()
48 , stopAMPM=''
49
50 )
51 return context.setStatus(True, 'Event changed.')
52 except ResourceLockedError, errmsg:
53 return context.setStatus(False, errmsg)