Commit c875c0ef authored by Gabriel Monnerat's avatar Gabriel Monnerat

clean up the code

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42677 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 24d292d9
...@@ -26,96 +26,60 @@ ...@@ -26,96 +26,60 @@
<key> <string>raw</string> </key> <key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
$(document).ready(function() { \n function callBeforeRequest(type){\n
var DATA_FEED_URL = "Base_getEventListSerialized";\n var message = "Loading data...";\n
var op = {\n
view: "day",\n
showday: new Date(),\n
EditCmdhandler:Edit,\n
DeleteCmdhandler:Delete,\n
weekstartday: 0,\n
ViewCmdhandler:View, \n
onWeekOrMonthToDay:wtd,\n
onBeforeRequestData: cal_beforerequest,\n
onAfterRequestData: cal_afterrequest,\n
onRequestDataError: cal_onerror, \n
autoload:true,\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
};\n
var $dv = $("#calhead");\n
var _MH = document.documentElement.clientHeight;\n
var dvH = $dv.height() + 2;\n
op.height = _MH - dvH;\n
op.eventItems =[];\n
var p = $("#gridcontainer").bcalendar(op).BcalGetOp();\n
if (p && p.datestrshow) {\n
$("#txtdatetimeshow").text(p.datestrshow);\n
}\n
$("#caltoolbar").noSelect();\n
$("#hdtxtshow").datepicker({ picker: "#txtdatetimeshow", showtarget: $("#txtdatetimeshow"),\n
onReturn:function(r){ \n
var p = $("#gridcontainer").gotoDate(r).BcalGetOp();\n
if (p && p.datestrshow) {\n
$("#txtdatetimeshow").text(p.datestrshow);\n
}\n
} \n
});\n
function cal_beforerequest(type){\n
var t = "Loading data...";\n
switch(type){\n switch(type){\n
case 1:\n case 1:\n
t = "Loading data...";\n message = "Loading data...";\n
break;\n break;\n
case 2: \n case 4:\n
case 3: \n message = "The request is being processed ...";\n
case 4: \n
t = "The request is being processed ..."; \n
break;\n break;\n
}\n }\n
$("#errorpannel").hide();\n $("#errorpannel").hide();\n
$("#loadingpannel").html(t).show(); \n $("#loadingpannel").html(message).show();\n
}\n }\n
function cal_afterrequest(type){\n \n
function callAfterRequest(type){\n
switch(type){\n switch(type){\n
case 1:\n case 1:\n
$("#loadingpannel").hide();\n $("#loadingpannel").hide();\n
break;\n break;\n
case 2:\n
case 3:\n
case 4:\n case 4:\n
$("#loadingpannel").html("Success!");\n $("#loadingpannel").html("Success!");\n
window.setTimeout(function(){ $("#loadingpannel").hide();},2000);\n window.setTimeout(function(){$("#loadingpannel").hide();},2000);\n
break;\n break;\n
} \n
}\n }\n
function cal_onerror(type,data){\n }\n
\n
function callOnError(type, data){\n
$("#errorpannel").show();\n $("#errorpannel").show();\n
}\n }\n
function Edit(data){\n \n
var eurl="WebSection_newEvent?id={0}&start={2}&end={3}&isallday={4}&title={1}"; \n function Edit(data){\n
var editUrl="WebSection_newEvent?id={0}&start={2}&end={3}&isallday={4}&title={1}";\n
if(data){\n if(data){\n
var url = StrFormat(eurl,data);\n var url = StrFormat(editUrl, data);\n
OpenModelWindow(url,{width: 600, height: 400, caption:"Manage The Event",onclose:function(){\n OpenModelWindow(url,{width: 600, height: 400, caption:"Manage The Event",onclose:function(){\n
$("#gridcontainer").reload();\n $("#gridcontainer").reload();\n
}});\n }});\n
}\n }\n
} \n }\n
function View(data){\n \n
function View(data){\n
var str = "";\n var str = "";\n
$.each(data, function(i, item){\n $.each(data, function(i, item){\n
str += "[" + i + "]: " + item + "\\n";\n str += "[" + i + "]: " + item + "\\n";\n
});\n });\n
alert(str); \n alert(str);\n
} \n }\n
function Delete(data, callback){\n function Delete(data, callback){\n
$.alerts.okButton="Ok"; \n $.alerts.okButton = "Ok"; \n
$.alerts.cancelButton="Cancel"; \n $.alerts.cancelButton = "Cancel";\n
hiConfirm("Are You Sure to Delete this Event", \'Confirm\', function(r){ r && callback(0);}); \n hiConfirm("Are You Sure to Delete this Event", \'Confirm\', function(r){ r && callback(0);});\n
}\n }\n
function wtd(p){\n \n
function wtd(p){\n
if (p && p.datestrshow) {\n if (p && p.datestrshow) {\n
$("#txtdatetimeshow").text(p.datestrshow);\n $("#txtdatetimeshow").text(p.datestrshow);\n
}\n }\n
...@@ -123,7 +87,45 @@ $(document).ready(function() { \n ...@@ -123,7 +87,45 @@ $(document).ready(function() { \n
$(this).removeClass("fcurrent");\n $(this).removeClass("fcurrent");\n
})\n })\n
$("#showdaybtn").addClass("fcurrent");\n $("#showdaybtn").addClass("fcurrent");\n
}\n
\n
$(document).ready(function() { \n
var DATA_FEED_URL = "Base_getEventListSerialized";\n
var op = {\n
view: "day",\n
showday: new Date(),\n
EditCmdhandler:Edit,\n
DeleteCmdhandler:Delete,\n
weekstartday: 0,\n
ViewCmdhandler:View,\n
onWeekOrMonthToDay:wtd,\n
onBeforeRequestData: callBeforeRequest,\n
onAfterRequestData: callAfterRequest,\n
onRequestDataError: callOnError,\n
autoload:true,\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
};\n
var $dv = $("#calhead");\n
var _MH = document.documentElement.clientHeight;\n
var dvH = $dv.height() + 2;\n
op.height = _MH - dvH;\n
op.eventItems =[];\n
var p = $("#gridcontainer").bcalendar(op).BcalGetOp();\n
if (p && p.datestrshow) {\n
$("#txtdatetimeshow").text(p.datestrshow);\n
}\n
$("#caltoolbar").noSelect();\n
$("#hdtxtshow").datepicker({ picker: "#txtdatetimeshow", showtarget: $("#txtdatetimeshow"),\n
onReturn:function(r){ \n
var p = $("#gridcontainer").gotoDate(r).BcalGetOp();\n
if (p && p.datestrshow) {\n
$("#txtdatetimeshow").text(p.datestrshow);\n
}\n }\n
} \n
});\n
//to show day view\n //to show day view\n
$("#showdaybtn").click(function(e) {\n $("#showdaybtn").click(function(e) {\n
//document.location.href="#day";\n //document.location.href="#day";\n
......
185 187
\ 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