Commit be627314 authored by Gabriel Monnerat's avatar Gabriel Monnerat

add feature to add events via UNG Calendar

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42697 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 83cf91bd
......@@ -57,26 +57,25 @@
from Products.ERP5Type.JSONEncoder import encodeInJson as dumps\n
import random\n
\n
event_list = context.getPortalObject().event_module.searchFolder()\n
\n
now = DateTime()\n
event_dict = {}\n
event_dict["events"] = []\n
event_dict["issort"] = True\n
event_dict["start"] = (now-30).toZone(\'UTC\').ISO()\n
event_dict["end"] = (now+30).toZone(\'UTC\').ISO()\n
event_dict["error"] = None\n
for event in event_list:\n
start = event.getStartDate().strftime("%m/%d/%Y %H:%M")\n
end = event.getStartDate().strftime("%m/%d/%Y %H:%M")\n
event_dict["events"].append([random.randrange(10000, 99999),\n
event.getTitle(),\n
start,\n
end,\n
random.randrange(0,1),1,0,\n
random.randrange(-1,13),1,\'\',\'\',])\n
\n
return dumps(event_dict)\n
if request_type == "list":\n
event_list = context.getPortalObject().event_module.searchFolder()\n
now = DateTime()\n
event_dict = {}\n
event_dict["events"] = []\n
event_dict["issort"] = True\n
event_dict["start"] = (now-30).strftime("%m/%d/%Y %H:%M")\n
event_dict["end"] = (now+30).strftime("%m/%d/%Y %H:%M")\n
event_dict["error"] = None\n
for event in event_list:\n
start = event.getStartDate().strftime("%m/%d/%Y %H:%M")\n
end = event.getStartDate().strftime("%m/%d/%Y %H:%M")\n
event_dict["events"].append([random.randrange(10000, 99999),\n
event.getTitle(),\n
start,\n
end,\n
random.randrange(0,1),1,0,\n
random.randrange(-1,13),1,\'\',\'\',])\n
return dumps(event_dict)\n
</string> </value>
</item>
<item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from DateTime import DateTime\n
\n
form = context.REQUEST.form\n
portal_type = form.get("portal_type")\n
event_title = form.get("title")\n
start_date = DateTime("%(date_year)s/%(date_month)s/%(date_day)s %(date_hour)s:%(date_minute)s" % form)\n
portal = context.getPortalObject()\n
event = portal.event_module.newContent(portal_type=portal_type, title=event_title)\n
event.setStartDate(start_date)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>EventModule_createNewEvent</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -34,7 +34,36 @@
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode>Blank Page</unicode> </value>
<value> <unicode encoding="cdata"><![CDATA[
<form id="create_new_event">\n
<label>Event Type</label>\n
<select name="portal_type">\n
<option>Acknowledgement</option>\n
<option>Fax Message</option>\n
<option>Letter</option>\n
<option>Mail Message</option>\n
<option>Note</option>\n
<option>Phone Call</option>\n
<option>Short Message</option>\n
<option>Site Message</option>\n
<option>Visit</option>\n
<option>Web Message</option>\n
</select>\n
<p>\n
<label>Title: </label>\n
<input name="title" value="" type="text" size="30">\n
<p>\n
<label>Date: </label>\n
<input class="date_field" name="date_year" value="2011" maxlength="4" type="text" size="4">/\n
<input class="date_field" name="date_month" value="" maxlength="2" type="text" size="2">/\n
<input class="date_field" name="date_day" value="" maxlength="2" type="text" size="2">\n
&nbsp;&nbsp;&nbsp;\n
<input class="date_field" name="date_hour" value="" maxlength="2" type="text" size="2">:\n
<input class="date_field" name="date_minute" value="" maxlength="2" type="text" size="2">\n
</form>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -125,6 +125,7 @@
<div class="t2 chromeColor">&nbsp;</div>\n
<div class="t1 chromeColor">&nbsp;</div>\n
</div>\n
<div id="new_event_dialog" title="Create New Event"></div>\n
</div>\n
</html>
......
......@@ -65,7 +65,9 @@ div.cHead div.ptogtitle {\n
\n
a#BBIT_DP_CONTAINER {\n
left: 0px !important;\n
\n
}\n
input[type="text"] {\n
border: 0px;\n
}</string> </value>
</item>
<item>
......
......@@ -6,6 +6,10 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>ung_calendar.js</string> </value>
......@@ -60,7 +64,7 @@ function Edit(data){\n
var editUrl="WebSection_newEvent?id={0}&start={2}&end={3}&isallday={4}&title={1}";\n
if(data){\n
var url = StrFormat(editUrl, data);\n
OpenModelWindow(url,{width: 600, height: 400, caption:"Manage The Event",onclose:function(){\n
OpenModelWindow(url,{width: 400, height: 200, caption:"Manage The Event",onclose:function(){\n
$("#gridcontainer").reload();\n
}});\n
}\n
......@@ -74,8 +78,8 @@ function View(data){\n
alert(str);\n
}\n
function Delete(data, callback){\n
$.alerts.okButton = "Ok"; \n
$.alerts.cancelButton = "Cancel";\n
//$.alerts.okButton = "Ok"; \n
//$.alerts.cancelButton = "Cancel";\n
hiConfirm("Are You Sure to Delete this Event", \'Confirm\', function(r){ r && callback(0);});\n
}\n
\n
......@@ -106,7 +110,7 @@ $(document).ready(function() { \n
url: DATA_FEED_URL + "?request_type=list",\n
quickAddUrl: DATA_FEED_URL + "?request_type=add",\n
quickUpdateUrl: DATA_FEED_URL + "?request_type=update",\n
quickDeleteUrl: DATA_FEED_URL + "?requet_type=remove",\n
quickDeleteUrl: DATA_FEED_URL + "?request_type=remove",\n
};\n
var $dv = $("#calhead");\n
var _MH = document.documentElement.clientHeight;\n
......@@ -166,31 +170,52 @@ $(document).ready(function() { \n
$("#gridcontainer").reload();\n
}); \n
//Add a new event\n
$("#faddbtn").click(function(e) {\n
$("#faddbtn").click(function() {\n
var url ="WebSection_newEvent";\n
OpenModelWindow(url,{ width: 500, height: 400, caption: "Create New Event"});\n
$("div#new_event_dialog").load(url);\n
$("div#new_event_dialog").dialog("open");\n
});\n
//go to today\n
$("#showtodaybtn").click(function(e) {\n
$("#showtodaybtn").click(function() {\n
var p = $("#gridcontainer").gotoDate().BcalGetOp();\n
if (p && p.datestrshow) {\n
$("#txtdatetimeshow").text(p.datestrshow);\n
}\n
});\n
//previous date range\n
$("#sfprevbtn").click(function(e) {\n
$("#sfprevbtn").click(function() {\n
var p = $("#gridcontainer").previousRange().BcalGetOp();\n
if (p && p.datestrshow) {\n
$("#txtdatetimeshow").text(p.datestrshow);\n
}\n
});\n
//next date range\n
$("#sfnextbtn").click(function(e) {\n
$("#sfnextbtn").click(function() {\n
var p = $("#gridcontainer").nextRange().BcalGetOp();\n
if (p && p.datestrshow) {\n
$("#txtdatetimeshow").text(p.datestrshow);\n
}\n
});\n
$("div#new_event_dialog").dialog({\n
autoOpen: false,\n
height: 162,\n
width: 410,\n
modal: true,\n
buttons: {\n
"Create": function(){\n
$.post("EventModule_createNewEvent",\n
$("form#create_new_event").serialize(),\n
function(){\n
$("div#new_event_dialog").dialog("close");\n
$("div#showreflashbtn.fbutton").click();\n
}\n
);\n
}\n
},\n
});\n
$("span#bbit-cs-delete.lk").click(function(event){\n
event.preventDefault();\n
});\n
});
]]></string> </value>
......
187
\ No newline at end of file
188
\ 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