* adjust todo feature.

This commit is contained in:
wangchunsheng
2009-12-28 09:18:44 +00:00
parent 42ebd56829
commit 4d90f7892f
7 changed files with 35 additions and 10 deletions
+4 -1
View File
@@ -366,12 +366,15 @@ EOT;
/* 比较两个数组元素的不同,产生修改记录。*/
public static function createChanges($old, $new)
{
global $config;
$changes = array();
foreach($new as $key => $value)
{
if(strtolower($key) == 'lastediteddate') continue;
if(strtolower($key) == 'lasteditedby') continue;
if($new->$key != $old->$key)
if(isset($config->db->stripSlash) and $config->db->stripSlash) $value = stripslashes($value);
if($value != $old->$key)
{
$diff = '';
if(substr_count($value, "\n") > 1 or substr_count($old->$key, "\n") > 1) $diff = self::diff($old->$key, $value);
+1
View File
@@ -55,6 +55,7 @@ $lang->resource->my->editProfile = 'editProfile';
$lang->resource->todo->create = 'create';
$lang->resource->todo->edit = 'edit';
$lang->resource->todo->view = 'view';
$lang->resource->todo->delete = 'delete';
$lang->resource->todo->mark = 'mark';
$lang->resource->todo->import2Today = 'import2Today';
+2 -2
View File
@@ -40,7 +40,7 @@ function changeDate(date)
echo '<span id="thisweek">' . html::a($this->createLink('my', 'todo', "date=thisweek"), $lang->todo->thisWeekTodos) . '</span>';
echo '<span id="lastweek">' . html::a($this->createLink('my', 'todo', "date=lastweek"), $lang->todo->lastWeekTodos) . '</span>';
echo '<span id="all">' . html::a($this->createLink('my', 'todo', "date=all"), $lang->todo->allDaysTodos) . '</span>';
echo '<span id="before">' . html::a($this->createLink('my', 'todo', "date=before&account={$app->user->account}&status=wait,doing"), $lang->todo->allUndone) . '</span>';
echo '<span id="before">' . html::a($this->createLink('my', 'todo', "date=before&account={$app->user->account}&status=undone"), $lang->todo->allUndone) . '</span>';
echo "<span id='$date'>" . html::select('date', $dates, $date, 'onchange=changeDate(this.value)') . '</span>';
?>
<script>$('#<?php echo $type;?>').addClass('active')</script>
@@ -86,7 +86,7 @@ function changeDate(date)
</td>
<td><?php echo $todo->begin;?></td>
<td><?php echo $todo->end;?></td>
<td class='<?php echo $todo->status;?>'><?php echo $lang->todo->statusList->{$todo->status};?></td>
<td class='<?php echo $todo->status;?>'><?php echo $lang->todo->statusList[$todo->status];?></td>
<td>
<?php
echo html::a($this->createLink('todo', 'mark', "id=$todo->id&status=$todo->status"), $lang->todo->{'mark'.ucfirst($todo->status)}, 'hiddenwin');
+16
View File
@@ -81,6 +81,22 @@ class todo extends control
$this->display();
}
/* 查看todo。*/
public function view($todoID)
{
$todo = $this->todo->findById($todoID);
$this->lang->todo->menu = $this->lang->user->menu;
$this->loadModel('user')->setMenu($this->user->getPairs(), $todo->account);
$this->lang->set('menugroup.todo', 'company');
$this->view->header->title = $this->lang->todo->view;
$this->view->position[] = $this->lang->todo->view;
$this->view->todo = $todo;
$this->view->times = $this->todo->buildTimeList();
$this->display();
}
/* 删除一个todo。*/
public function delete($todoID, $confirm = 'no')
{
+8 -3
View File
@@ -25,6 +25,7 @@ $lang->todo->common = 'TODO';
$lang->todo->index = "todo一览";
$lang->todo->create = "新增TODO";
$lang->todo->edit = "更新";
$lang->todo->view = "TODO详情";
$lang->todo->markDone = "未完成";
$lang->todo->markWait = "已完成";
$lang->todo->markDoing = "已完成";
@@ -32,6 +33,7 @@ $lang->todo->mark = "更改状态";
$lang->todo->delete = "删除";
$lang->todo->browse = "浏览TODO";
$lang->todo->import2Today = "导入到今天";
$lang->todo->changeStatus = "更改";
$lang->todo->id = '编号';
$lang->todo->date = '日期';
@@ -49,9 +51,12 @@ $lang->todo->week = '星期';
$lang->todo->today = '今天';
$lang->todo->weekDateList = '一,二,三,四,五,六,天';
$lang->todo->statusList->wait = '未开始';
$lang->todo->statusList->doing = '进行中';
$lang->todo->statusList->done = '已完成';
$lang->todo->statusList[''] = '';
$lang->todo->statusList['wait'] = '未开始';
$lang->todo->statusList['doing'] = '进行中';
$lang->todo->statusList['done'] = '已完成';
//$lang->todo->statusList['cancel'] = '已取消';
//$lang->todo->statusList['postpone'] = '已延期';
$lang->todo->priList[3] = '一般';
$lang->todo->priList[1] = '最高';
+2 -2
View File
@@ -116,13 +116,13 @@ class todoModel extends model
}
if($account == '') $account = $this->app->user->account;
if($status == 'all') $status = 'wait,doing,done';
$stmt = $this->dao->select('*')->from(TABLE_TODO)
->where('account')->eq($account)
->andWhere("date >= '$begin'")
->andWhere("date <= '$end'")
->andWhere('status')->in($status)
->onCaseOf($status != 'all' and $status != 'undone')->andWhere('status')->in($status)->endCase()
->onCaseOf($status == 'undone')->andWhere('status')->ne('done')->endCase()
->orderBy('date, status, begin')
->query();
while($todo = $stmt->fetch())
+2 -2
View File
@@ -68,10 +68,10 @@ function changeDate(date)
<td><?php echo $todo->date;?></td>
<td><?php echo $lang->todo->typeList->{$todo->type};?></td>
<td><?php echo $todo->pri;?></td>
<td class='a-left'><?php echo $todo->name;?></td>
<td class='a-left'><?php if(!common::printLink('todo', 'view', "todo=$todo->id", $todo->name)) echo $todo->name;?></td>
<td><?php echo $todo->begin;?></td>
<td><?php echo $todo->end;?></td>
<td class='<?php echo $todo->status;?>'><?php echo $lang->todo->statusList->{$todo->status};?></td>
<td class='<?php echo $todo->status;?>'><?php echo $lang->todo->statusList[$todo->status];?></td>
</tr>
<?php endforeach;?>
</tbody>