diff options
author | 藍挺瑋 <lantw44@gmail.com> | 2012-12-19 14:15:02 +0800 |
---|---|---|
committer | LAN-TW <lantw44@xwinexp.tfcis.org> | 2012-12-19 14:15:02 +0800 |
commit | 77c2343b071d2a386be3dbe07df17fca39172100 (patch) | |
tree | c7d2a4953ad9ca335a7544f3669227d8625e01cc | |
parent | 87cf2f5be9c573889a95fa109a24a7e46f127137 (diff) | |
download | inccalendar-77c2343b071d2a386be3dbe07df17fca39172100.tar.gz inccalendar-77c2343b071d2a386be3dbe07df17fca39172100.tar.zst inccalendar-77c2343b071d2a386be3dbe07df17fca39172100.zip |
修正儲存資料月份不正確,以及按下「返回月曆」時資料會重複的問題
-rw-r--r-- | access/fetch.py | 6 | ||||
-rw-r--r-- | js/caledit.js | 8 | ||||
-rw-r--r-- | js/data.js | 11 |
3 files changed, 16 insertions, 9 deletions
diff --git a/access/fetch.py b/access/fetch.py index ccc33d3..6de6fd8 100644 --- a/access/fetch.py +++ b/access/fetch.py @@ -62,9 +62,6 @@ class FetchEvent(webapp2.RequestHandler): nextmonth = month + 1 nextyear = year - if withcursor == "": - withcursor = None - data = db.GqlQuery("SELECT * FROM CalEvent " "WHERE ANCESTOR IS :1 AND " "begin >= :2 AND " @@ -74,7 +71,8 @@ class FetchEvent(webapp2.RequestHandler): datetime.datetime(year, month, 1), datetime.datetime(nextyear, nextmonth, 1)) - data.with_cursor(withcursor) + if withcursor != "": + data.with_cursor(withcursor) eventroot = etree.Element('inccalender') for entry in data.run(limit=10): diff --git a/js/caledit.js b/js/caledit.js index 69e713b..40aa80d 100644 --- a/js/caledit.js +++ b/js/caledit.js @@ -73,7 +73,7 @@ function caledit_quit(){ caledit_clearoption(); caledit_clean(); if(caledit_ismodified){ - calload(); + setmonthcal(); } } @@ -195,7 +195,7 @@ function caledit_fill(calevt){ contentobj = document.getElementById("caledit_static_content"); datafromobj = document.getElementById("caledit_datafrom"); yearobj.innerHTML = calevt.datetime.getFullYear(); - monthobj.innerHTML = calevt.datetime.getMonth(); + monthobj.innerHTML = calevt.datetime.getMonth() + 1; dateobj.innerHTML = calevt.datetime.getDate(); hourobj.innerHTML = calevt.datetime.getHours(); minuteobj.innerHTML = calevt.datetime.getMinutes(); @@ -225,7 +225,7 @@ function caledit_fill(calevt){ remindobj = document.getElementById("caledit_dyn_remind"); contentobj = document.getElementById("caledit_dyn_content"); yearobj.value = calevt.datetime.getFullYear(); - monthobj.value = calevt.datetime.getMonth(); + monthobj.value = calevt.datetime.getMonth() + 1; dateobj.value = calevt.datetime.getDate(); hourobj.value = calevt.datetime.getHours(); minuteobj.value = calevt.datetime.getMinutes(); @@ -328,7 +328,7 @@ function caledit_write_current(){ current_form.datetime.setFullYear( parseInt(yearobjw.value), - parseInt(monthobjw.value), + parseInt(monthobjw.value) - 1, parseInt(dateobjw.value)); current_form.datetime.setHours( parseInt(hourobjw.value), @@ -112,7 +112,7 @@ function inccal_send(calevt){ 'remind=' + encodeURIComponent(calevt.remind.toString()) + '&' + 'datafrom=' + encodeURIComponent(calevt.datafrom) + '&' + 'year=' + encodeURIComponent(calevt.datetime.getFullYear()) + '&' + - 'month=' + encodeURIComponent(calevt.datetime.getMonth()) + '&' + + 'month=' + encodeURIComponent(calevt.datetime.getMonth() + 1) + '&' + 'date=' + encodeURIComponent(calevt.datetime.getDate()) + '&' + 'hour=' + encodeURIComponent(calevt.datetime.getHours()) + '&' + 'minute=' + encodeURIComponent(calevt.datetime.getMinutes()); @@ -125,4 +125,13 @@ function inccal_send(calevt){ rq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); rq.send(str + '&key=' + encodeURIComponent(calevt.key)); } + rq.onreadystatechange = function(){ + if(rq.readyState == 4){ + if(rq.status == 200){ + status_bar_set("資料已儲存"); + }else{ + status_bar_set("伺服器回傳" + rq.status.toString() + "錯誤"); + } + } + } } |