From ce25be3c5ae3102a25d1424a167c8ae186296e6c Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 28 Aug 2012 03:32:36 +0000 Subject: [PATCH] * limit date select for todo. --- module/common/view/datepicker.html.php | 11 ++++++++++- module/todo/js/batchcreate.js | 4 +++- module/todo/view/create.html.php | 7 ++++++- module/todo/view/edit.html.php | 7 ++++++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/module/common/view/datepicker.html.php b/module/common/view/datepicker.html.php index 6d91326c0b..0e0834779c 100644 --- a/module/common/view/datepicker.html.php +++ b/module/common/view/datepicker.html.php @@ -20,8 +20,17 @@ Date.abbrDayNames = ['星期天', '星期一', '星期二', '星期三', '星 Date.monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']; $(function() { + var time = $('.date').val(); + if(!isNaN(time)){ + var Y = time.substring(0, 4); + var m = time.substring(4, 6); + var d = time.substring(6, 8); + time = Y + '-' + m + '-' + d; + $('.date').val(time); + } + startDate = new Date(1970, 1, 1); $(".date").datePicker({createButton:true, startDate:startDate}) - .dpSetPosition($.dpConst.POS_TOP, $.dpConst.POS_RIGHT) + .dpSetPosition($.dpConst.POS_TOP, $.dpConst.POS_RIGHT) }); diff --git a/module/todo/js/batchcreate.js b/module/todo/js/batchcreate.js index adead31239..22eb9ab924 100644 --- a/module/todo/js/batchcreate.js +++ b/module/todo/js/batchcreate.js @@ -12,4 +12,6 @@ function updateAction(date) link = createLink('todo', 'batchCreate', 'date=' + date); location.href=link; } - +$(function(){ + $('.date').dpSetStartDate(new Date()); +}) diff --git a/module/todo/view/create.html.php b/module/todo/view/create.html.php index 1808227851..965c3c2166 100644 --- a/module/todo/view/create.html.php +++ b/module/todo/view/create.html.php @@ -63,4 +63,9 @@ - + diff --git a/module/todo/view/edit.html.php b/module/todo/view/edit.html.php index ff49369ac5..986b138589 100644 --- a/module/todo/view/edit.html.php +++ b/module/todo/view/edit.html.php @@ -66,4 +66,9 @@ - +