diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_getEventListSerialized.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_updateCalendarEventList.xml similarity index 63% rename from bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_getEventListSerialized.xml rename to bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_updateCalendarEventList.xml index ad52f8e3107146248030ec73612b47ea56bf0fb8..25de2dcd984f3b68736423faf4a338522d32ae77 100644 --- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_getEventListSerialized.xml +++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_updateCalendarEventList.xml @@ -55,10 +55,29 @@ XXX - Initial Script to serialize all events\n """\n from Products.ERP5Type.JSONEncoder import encodeInJson as dumps\n +from DateTime import DateTime\n import random\n \n +def convertToERP5DateTime(date):\n + date, hour = date.split()\n + day, month, year = date.split("/")\n + return DateTime("%s/%s/%s %s" % (year, month, day, hour))\n +\n +portal = context.getPortalObject()\n +form = context.REQUEST.form\n +portal_type_list = ["Acknowledgement",\n + "Fax Message",\n + "Letter",\n + "Mail Message",\n + "Note",\n + "Phone Call",\n + "Short Message",\n + "Site Message",\n + "Visit",\n + "Web Message"]\n +\n if request_type == "list":\n - event_list = context.getPortalObject().event_module.searchFolder()\n + event_list = portal.event_module.searchFolder()\n now = DateTime()\n event_dict = {}\n event_dict["events"] = []\n @@ -76,6 +95,29 @@ if request_type == "list":\n random.randrange(0,1),1,0,\n random.randrange(-1,13),1,\'\',\'\',])\n return dumps(event_dict)\n +elif request_type == "remove":\n + title = form.get("title")\n + catalog_object = portal.portal_catalog.getResultValue(portal_type=portal_type_list, title=title)\n + event = context.restrictedTraverse(catalog_object.getPath())\n + portal.event_module.deleteContent(event.getId())\n +elif request_type == "update":\n + context.log(form)\n + title = form.get("title")\n + if not title:\n + return None\n + end_date = convertToERP5DateTime(form.get("CalendarEndTime"))\n + start_date = convertToERP5DateTime(form.get("CalendarStartTime"))\n + catalog_object = portal.portal_catalog.getResultValue(portal_type=portal_type_list, title=title)\n + event = context.restrictedTraverse(catalog_object.getPath())\n + event.setStartDate(start_date)\n + event.setStopDate(end_date)\n +elif request_type == "add":\n + end_date = convertToERP5DateTime(form.get("CalendarEndTime"))\n + start_date = convertToERP5DateTime(form.get("CalendarStartTime"))\n + event_title = form.get("CalendarTitle")\n + event = portal.event_module.newContent(portal_type="Web Message", title=event_title)\n + event.setStartDate(start_date)\n + event.setStopDate(end_date)\n </string> </value> </item> <item> @@ -84,7 +126,7 @@ if request_type == "list":\n </item> <item> <key> <string>id</string> </key> - <value> <string>Base_getEventListSerialized</string> </value> + <value> <string>Base_updateCalendarEventList</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_js/ung_calendar.js.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_js/ung_calendar.js.xml index 7a5b4a8497c48a3ed37b640fef8108425ba77b60..63268c052ff10c0065b824920ec3b254de09e270 100644 --- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_js/ung_calendar.js.xml +++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_js/ung_calendar.js.xml @@ -94,7 +94,7 @@ function wtd(p){\n }\n \n $(document).ready(function() { \n - var DATA_FEED_URL = "Base_getEventListSerialized";\n + var DATA_FEED_URL = "Base_updateCalendarEventList";\n var op = {\n view: "day",\n showday: new Date(),\n @@ -213,9 +213,6 @@ $(document).ready(function() { \n }\n },\n });\n - $("span#bbit-cs-delete.lk").click(function(event){\n - event.preventDefault();\n - });\n }); ]]></string> </value> diff --git a/bt5/erp5_web_ung_theme/bt/revision b/bt5/erp5_web_ung_theme/bt/revision index 0947c3313659827e4a73ff591c1fdcbccf9ed12f..1a1f7f8270a4352d79f9cc9d01750cbe16e6e850 100644 --- a/bt5/erp5_web_ung_theme/bt/revision +++ b/bt5/erp5_web_ung_theme/bt/revision @@ -1 +1 @@ -188 \ No newline at end of file +190 \ No newline at end of file