diff --git a/trunk/module/todo/control.php b/trunk/module/todo/control.php index 17e6b01bf0..38e8e49d51 100644 --- a/trunk/module/todo/control.php +++ b/trunk/module/todo/control.php @@ -66,6 +66,10 @@ class todo extends control die(js::locate($this->createLink('my', 'todo', "date=$_POST[date]"), 'parent')); } + /* 获取todo信息,判断是否是私人事务。*/ + $todo = $this->todo->findById($todoID); + if($todo->private and $this->app->user->account != $todo->account) die('private'); + $header['title'] = $this->lang->my->common . $this->lang->colon . $this->lang->todo->edit; $position[] = $this->lang->todo->edit; @@ -73,7 +77,7 @@ class todo extends control $this->assign('position', $position); $this->assign('dates', $this->todo->buildDateList(0, 3)); $this->assign('times', $this->todo->buildTimeList()); - $this->assign('todo', $this->todo->findById($todoID)); + $this->assign('todo', $todo); $this->display(); } diff --git a/trunk/module/todo/lang/zh-cn.php b/trunk/module/todo/lang/zh-cn.php index 3f546d4c9a..382e4fa34d 100644 --- a/trunk/module/todo/lang/zh-cn.php +++ b/trunk/module/todo/lang/zh-cn.php @@ -34,6 +34,7 @@ $lang->todo->browse = "浏览TODO"; $lang->todo->confirmDelete = "您确定要删除这个todo吗?"; $lang->todo->successMarked = "成功切换状态!"; +$lang->todo->thisIsPrivate = '这是一条私人事务。:)'; $lang->todo->lblDisableDate = '暂时不设定时间'; $lang->todo->id = '编号'; @@ -46,6 +47,7 @@ $lang->todo->pri = '优先级'; $lang->todo->name = '名称'; $lang->todo->status = '状态'; $lang->todo->desc = '描述'; +$lang->todo->private = '私人事务'; $lang->todo->week = '星期'; $lang->todo->today = '今天'; diff --git a/trunk/module/todo/model.php b/trunk/module/todo/model.php index 66ac41fb32..1a4fcedb7a 100644 --- a/trunk/module/todo/model.php +++ b/trunk/module/todo/model.php @@ -33,10 +33,12 @@ class todoModel extends model ->add('idvalue', 0) ->stripTags('type, name') ->specialChars('desc') - ->cleanInt('date, pri, begin, end') + ->cleanInt('date, pri, begin, end, private') ->setIF($this->post->type != 'custom', 'name', '') ->setIF($this->post->type == 'bug', 'idvalue', $this->post->bug) ->setIF($this->post->type == 'task', 'idvalue', $this->post->task) + ->setIF($this->post->begin == false, 'begin', '2400') + ->setIF($this->post->end == false, 'end', '2400') ->remove('bug, task') ->get(); $this->dao->insert(TABLE_TODO)->data($todo)->autoCheck()->checkIF($todo->type == 'custom', 'name', 'notempty')->exec(); @@ -47,9 +49,11 @@ class todoModel extends model { $todo = fixer::input('post') ->stripTags('type, name') - ->cleanInt('date, pri, begin, end') + ->cleanInt('date, pri, begin, end, private') ->specialChars('desc') ->setIF($this->post->type != 'custom', 'name', '') + ->setIF($this->post->begin == false, 'begin', '2400') + ->setIF($this->post->end == false, 'end', '2400') ->get(); $this->dao->update(TABLE_TODO)->data($todo)->autoCheck()->checkIF($todo->type == 'custom', 'name', 'notempty')->where('id')->eq($todoID)->exec(); } @@ -92,6 +96,9 @@ class todoModel extends model if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title'); $todo->begin = $this->fdaoatTime($todo->begin); $todo->end = $this->fdaoatTime($todo->end); + + /* 如果是私人事务,且当前用户非本人,更改标题。*/ + if($todo->private and $this->app->user->account != $todo->account) $todo->name = $this->lang->todo->thisIsPrivate; $todos[] = $todo; } return $todos; @@ -175,7 +182,7 @@ class todoModel extends model /* 格式化时间显示。*/ public function fdaoatTime($time) { - if(strlen($time) != 4) return ''; + if(strlen($time) != 4 or $time == '2400') return ''; return substr($time, 0, 2) . ':' . substr($time, 2, 2); } } diff --git a/trunk/module/todo/view/create.html.php b/trunk/module/todo/view/create.html.php index 547348547e..9966628481 100644 --- a/trunk/module/todo/view/create.html.php +++ b/trunk/module/todo/view/create.html.php @@ -55,6 +55,10 @@ todo->lblDisableDate;?> +