Commit c2a6e4be authored by Gabriel Monnerat's avatar Gabriel Monnerat

- clean up the code

- add response to each calendar request

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42737 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 454138a3
...@@ -100,6 +100,7 @@ elif request_type == "remove":\n ...@@ -100,6 +100,7 @@ elif request_type == "remove":\n
catalog_object = portal.portal_catalog.getResultValue(portal_type=portal_type_list, title=title)\n catalog_object = portal.portal_catalog.getResultValue(portal_type=portal_type_list, title=title)\n
event = context.restrictedTraverse(catalog_object.getPath())\n event = context.restrictedTraverse(catalog_object.getPath())\n
portal.event_module.deleteContent(event.getId())\n portal.event_module.deleteContent(event.getId())\n
return dumps({"IsSuccess": True})\n
elif request_type == "update":\n elif request_type == "update":\n
title = form.get("title")\n title = form.get("title")\n
if not title:\n if not title:\n
...@@ -110,6 +111,7 @@ elif request_type == "update":\n ...@@ -110,6 +111,7 @@ elif request_type == "update":\n
event = context.restrictedTraverse(catalog_object.getPath())\n event = context.restrictedTraverse(catalog_object.getPath())\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})\n
elif request_type == "add":\n elif request_type == "add":\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
...@@ -117,6 +119,7 @@ elif request_type == "add":\n ...@@ -117,6 +119,7 @@ elif request_type == "add":\n
event = portal.event_module.newContent(portal_type="Web Message", title=event_title)\n event = portal.event_module.newContent(portal_type="Web Message", 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
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
<link href="portal_skins/erp5_jquery/jquery/plugin/wdcalendar/main.css" rel="stylesheet" type="text/css"/>\n <link href="portal_skins/erp5_jquery/jquery/plugin/wdcalendar/main.css" rel="stylesheet" type="text/css"/>\n
<link href="ung_css/ung_calendar.css" rel="stylesheet" type="text/css"/>\n <link href="ung_css/ung_calendar.css" rel="stylesheet" type="text/css"/>\n
<script src="portal_skins/erp5_jquery/jquery/plugin/wdcalendar/Common.js" type="text/javascript"></script>\n <script src="portal_skins/erp5_jquery/jquery/plugin/wdcalendar/Common.js" type="text/javascript"></script>\n
<script src="portal_skins/erp5_jquery/jquery/plugin/wdcalendar/datepicker_lang_US.js" type="text/javascript"></script>\n
<script src="portal_skins/erp5_jquery/jquery/plugin/wdcalendar/jquery.alert.js" type="text/javascript"></script>\n <script src="portal_skins/erp5_jquery/jquery/plugin/wdcalendar/jquery.alert.js" type="text/javascript"></script>\n
<script src="portal_skins/erp5_jquery/jquery/plugin/wdcalendar/jquery.ifrmdailog.js" defer="defer" type="text/javascript"></script>\n <script src="portal_skins/erp5_jquery/jquery/plugin/wdcalendar/jquery.ifrmdailog.js" defer="defer" type="text/javascript"></script>\n
<script src="portal_skins/erp5_jquery/jquery/plugin/wdcalendar/wdCalendar_lang_US.js" type="text/javascript"></script>\n <script src="portal_skins/erp5_jquery/jquery/plugin/wdcalendar/wdCalendar_lang_US.js" type="text/javascript"></script>\n
......
...@@ -31,10 +31,15 @@ ...@@ -31,10 +31,15 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
function callBeforeRequest(type){\n function callBeforeRequest(type){\n
var message = "Loading data...";\n
switch(type){\n switch(type){\n
case 1:\n case 1:\n
message = "Loading data...";\n message = "Loading Events...";\n
break;\n
case 2:\n
message = "Adding Event...";\n
break;\n
case 3:\n
message = "Removing Event...";\n
break;\n break;\n
case 4:\n case 4:\n
message = "The request is being processed ...";\n message = "The request is being processed ...";\n
...@@ -46,13 +51,9 @@ function callBeforeRequest(type){\n ...@@ -46,13 +51,9 @@ function callBeforeRequest(type){\n
\n \n
function callAfterRequest(type){\n function callAfterRequest(type){\n
switch(type){\n switch(type){\n
case 1:\n default:\n
$("#loadingpannel").hide();\n $("#loadingpannel").hide();\n
break;\n break;\n
case 4:\n
$("#loadingpannel").html("Success!");\n
window.setTimeout(function(){$("#loadingpannel").hide();},2000);\n
break;\n
}\n }\n
}\n }\n
\n \n
......
193 194
\ 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