* finish task#1072.

This commit is contained in:
chencongzhi520@gmail.com
2013-01-21 02:43:08 +00:00
parent d654b08e66
commit 89951d5400
9 changed files with 38 additions and 35 deletions
-2
View File
@@ -115,7 +115,6 @@ $lang->action->label->linked2plan = 'link to plan';
$lang->action->label->unlinkedfromplan = 'unlink from plan';
$lang->action->label->linked2project = 'link to project';
$lang->action->label->unlinkedfromproject = 'unlik from project';
$lang->action->label->marked = 'edited';
$lang->action->label->started = 'started';
$lang->action->label->recorded = 'log hour';
$lang->action->label->canceled = 'canceled';
@@ -186,7 +185,6 @@ $lang->action->search->label['linked2plan'] = $lang->action->label->link
$lang->action->search->label['unlinkedfromplan'] = $lang->action->label->unlinkedfromplan;
$lang->action->search->label['linked2project'] = $lang->action->label->linked2project;
$lang->action->search->label['unlinkedfromproject'] = $lang->action->label->unlinkedfromproject;
$lang->action->search->label['marked'] = $lang->action->label->marked;
$lang->action->search->label['started'] = $lang->action->label->started;
$lang->action->search->label['canceled'] = $lang->action->label->canceled;
$lang->action->search->label['finished'] = $lang->action->label->finished;
-2
View File
@@ -118,7 +118,6 @@ $lang->action->label->linked2plan = '关联计划';
$lang->action->label->unlinkedfromplan = '移除计划';
$lang->action->label->linked2project = '关联项目';
$lang->action->label->unlinkedfromproject = '移除项目';
$lang->action->label->marked = '编辑了';
$lang->action->label->started = '开始了';
$lang->action->label->recorded = '记录了工时';
$lang->action->label->canceled = '取消了';
@@ -189,7 +188,6 @@ $lang->action->search->label['linked2plan'] = $lang->action->label->link
$lang->action->search->label['unlinkedfromplan'] = $lang->action->label->unlinkedfromplan;
$lang->action->search->label['linked2project'] = $lang->action->label->linked2project;
$lang->action->search->label['unlinkedfromproject'] = $lang->action->label->unlinkedfromproject;
$lang->action->search->label['marked'] = $lang->action->label->marked;
$lang->action->search->label['started'] = $lang->action->label->started;
$lang->action->search->label['canceled'] = $lang->action->label->canceled;
$lang->action->search->label['finished'] = $lang->action->label->finished;
+2 -2
View File
@@ -97,7 +97,7 @@ $lang->resource->todo->batchEdit = 'batchEdit';
$lang->resource->todo->view = 'view';
$lang->resource->todo->delete = 'delete';
$lang->resource->todo->export = 'export';
$lang->resource->todo->mark = 'mark';
$lang->resource->todo->finish = 'finish';
$lang->resource->todo->import2Today = 'import2Today';
$lang->todo->methodOrder[5] = 'create';
@@ -106,7 +106,7 @@ $lang->todo->methodOrder[15] = 'edit';
$lang->todo->methodOrder[20] = 'view';
$lang->todo->methodOrder[25] = 'delete';
$lang->todo->methodOrder[30] = 'export';
$lang->todo->methodOrder[35] = 'mark';
$lang->todo->methodOrder[35] = 'finish';
$lang->todo->methodOrder[40] = 'import2Today';
/* Product. */
+1
View File
@@ -0,0 +1 @@
.icon-green-todo-finish {padding:2px 8px; background:url(/theme/default/images/main/zt-icons.png) -80px -242px;}
+3 -3
View File
@@ -64,7 +64,7 @@
<th class='w-hour'><?php common::printOrderLink('begin', $orderBy, $vars, $lang->todo->beginAB);?></th>
<th class='w-hour'><?php common::printOrderLink('end', $orderBy, $vars, $lang->todo->endAB);?></th>
<th class='w-status'><?php common::printOrderLink('status', $orderBy, $vars, $lang->todo->status);?></th>
<th class='w-100px {sorter:false}'><?php echo $lang->actions;?></th>
<th class='w-80px {sorter:false}'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
@@ -83,9 +83,9 @@
<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>
<td class='a-right'>
<?php
echo html::a($this->createLink('todo', 'mark', "id=$todo->id&status=$todo->status"), $lang->todo->{'mark'.ucfirst($todo->status)}, 'hiddenwin');
common::printIcon('todo', 'finish', "id=$todo->id", $todo, 'list', '', 'hiddenwin');
common::printIcon('todo', 'edit', "id=$todo->id", '', 'list');
common::printIcon('todo', 'delete', "id=$todo->id", '', 'list', '', 'hiddenwin');
?>
+8 -12
View File
@@ -267,26 +267,22 @@ class todo extends control
}
/**
* Mark status of a todo.
* Finish a todo.
*
* @param int $todoID
* @param string $status wait|doing|done
* @access public
* @return void
*/
public function mark($todoID, $status)
public function finish($todoID)
{
$this->todo->mark($todoID, $status);
$this->todo->finish($todoID);
$todo = $this->todo->getById($todoID);
if($todo->status == 'done')
if($todo->type == 'bug' or $todo->type == 'task')
{
if($todo->type == 'bug' or $todo->type == 'task')
{
$confirmNote = 'confirm' . ucfirst($todo->type);
$confirmURL = $this->createLink($todo->type, 'view', "id=$todo->idvalue");
$cancelURL = $this->server->HTTP_REFERER;
die(js::confirm(sprintf($this->lang->todo->$confirmNote, $todo->idvalue), $confirmURL, $cancelURL, 'parent', 'parent'));
}
$confirmNote = 'confirm' . ucfirst($todo->type);
$confirmURL = $this->createLink($todo->type, 'view', "id=$todo->idvalue");
$cancelURL = $this->server->HTTP_REFERER;
die(js::confirm(sprintf($this->lang->todo->$confirmNote, $todo->idvalue), $confirmURL, $cancelURL, 'parent', 'parent'));
}
die(js::reload('parent'));
}
+2 -5
View File
@@ -17,10 +17,7 @@ $lang->todo->edit = "Edit";
$lang->todo->batchEdit = "Batch edit";
$lang->todo->view = "Info";
$lang->todo->viewAB = "Info";
$lang->todo->markDone = "Undone";
$lang->todo->markWait = "Done";
$lang->todo->markDoing = "Done";
$lang->todo->mark = "Change status";
$lang->todo->finish = "Finish";
$lang->todo->export = "Export";
$lang->todo->delete = "Delete";
$lang->todo->browse = "Browse";
@@ -79,4 +76,4 @@ $lang->todo->thisyearTodos = 'This Year';
$lang->todo->thismonthTodos = 'This Month';
$lang->todo->action = new stdclass();
$lang->todo->action->marked = array('main' => '$date, Change status to <stong>$extra</strong> by <strong>$actor</strong>。', 'extra' => $lang->todo->statusList);
$lang->todo->action->finished = array('main' => '$date, Finished by <strong>$actor</strong>');
+2 -5
View File
@@ -17,10 +17,7 @@ $lang->todo->edit = "更新TODO";
$lang->todo->batchEdit = "批量编辑";
$lang->todo->view = "TODO详情";
$lang->todo->viewAB = "详情";
$lang->todo->markDone = "未完成";
$lang->todo->markWait = "已完成";
$lang->todo->markDoing = "已完成";
$lang->todo->mark = "更改状态";
$lang->todo->finish = "完成";
$lang->todo->export = "导出";
$lang->todo->delete = "删除TODO";
$lang->todo->browse = "浏览TODO";
@@ -79,4 +76,4 @@ $lang->todo->thisyearTodos = '本年';
$lang->todo->thismonthTodos = '本月';
$lang->todo->action = new stdclass();
$lang->todo->action->marked = array('main' => '$date, 由 <strong>$actor</strong> 标记为<strong>$extra</strong>。', 'extra' => $lang->todo->statusList);
$lang->todo->action->finished = array('main' => '$date, 由 <strong>$actor</strong>完成');
+20 -4
View File
@@ -192,11 +192,10 @@ class todoModel extends model
* @access public
* @return void
*/
public function mark($todoID, $status)
public function finish($todoID)
{
$status = ($status == 'done') ? 'wait' : 'done';
$this->dao->update(TABLE_TODO)->set('status')->eq($status)->where('id')->eq((int)$todoID)->exec();
$this->loadModel('action')->create('todo', $todoID, 'marked', '', $status);
$this->dao->update(TABLE_TODO)->set('status')->eq('done')->where('id')->eq((int)$todoID)->exec();
$this->loadModel('action')->create('todo', $todoID, 'finished', '', 'done');
return;
}
@@ -318,6 +317,23 @@ class todoModel extends model
}
return $todos;
}
/**
* Judge an action is clickable or not.
*
* @param object $todo
* @param string $action
* @access public
* @return bool
*/
public function isClickable($todo, $action)
{
$action = strtolower($action);
if($action == 'finish') return $todo->status != 'done';
return true;
}
}