Commit f5fef434 authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor to create Event according to the portal type selected in form

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42883 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3e84b2ab
...@@ -129,10 +129,13 @@ elif request_type == "update":\n ...@@ -129,10 +129,13 @@ elif request_type == "update":\n
return dumps({"IsSuccess": True})\n return dumps({"IsSuccess": True})\n
\n \n
elif request_type == "add":\n elif request_type == "add":\n
portal_type = form.get("portal_type")\n
if not portal_type:\n
return dumps({"IsSuccess": False})\n
end_date = convertToERP5DateTime(form.get("CalendarEndTime"))\n end_date = convertToERP5DateTime(form.get("CalendarEndTime"))\n
start_date = convertToERP5DateTime(form.get("CalendarStartTime"))\n start_date = convertToERP5DateTime(form.get("CalendarStartTime"))\n
event_title = form.get("CalendarTitle")\n event_title = form.get("CalendarTitle")\n
event = portal.event_module.newContent(portal_type="Web Message", title=event_title)\n event = portal.event_module.newContent(portal_type=portal_type, title=event_title)\n
event.setStartDate(start_date)\n event.setStartDate(start_date)\n
event.setStopDate(end_date)\n event.setStopDate(end_date)\n
return dumps({"IsSuccess": True, "Data": {"title": event_title}})\n return dumps({"IsSuccess": True, "Data": {"title": event_title}})\n
......
209 210
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment