* finish change TASK #2051

This commit is contained in:
chujilu
2014-08-21 10:44:56 +08:00
parent f9e44c0075
commit e49f102189
6 changed files with 21 additions and 18 deletions
+2 -5
View File
@@ -242,19 +242,16 @@ class dao
/**
* The count method, call sql::select() and from().
* use as $this->dao->count(TABLE_BUG)->where('')->fetch('count');
* use as $this->dao->count()->from(TABLE_BUG)->where('')->fetch('count');
*
* @param int $tabel
* @access public
* @return void
*/
public function count($table)
public function count()
{
$this->setMode('raw');
$this->setMethod('select');
$this->sqlobj = sql::select('count(*) as count');
$this->setTable($table);
$this->sqlobj->from($table);
return $this;
}
+5 -3
View File
@@ -95,9 +95,11 @@ $lang->action->desc->paused = '$date, paused by <strong>$actor</strong>.
$lang->action->desc->diff1 = 'changed <strong><i>%s</i></strong>, old is "%s", new is "%s".<br />';
$lang->action->desc->diff2 = 'changed <strong><i>%s</i></strong>, the diff is:' . "\n" . "<blockquote>%s</blockquote>" . "\n<div class='hidden'>%s</div>";
$lang->action->desc->diff3 = "changed file's name %s to %s.";
$lang->action->desc->starttesttask = '$date, <strong>$actor</strong> start testtask <strong>$extra</strong>.' . "\n";
$lang->action->desc->stoptesttask = '$date, <strong>$actor</strong> stop testtask <strong>$extra</strong>.' . "\n";
$lang->action->desc->createbuild = '$date, <strong>$actor</strong> create build <strong>$extra</strong>.' . "\n";
$lang->action->desc->project = new stdclass();
$lang->action->desc->project->started = '$date, <strong>$actor</strong> started test task. <strong>$objectID</strong>。' . "\n";
$lang->action->desc->project->closed = '$date, <strong>$actor</strong> closed test task. <strong>$objectID</strong>。' . "\n";
$lang->action->desc->project->opened = '$date, <strong>$actor</strong> created build. <strong>$objectID</strong>。' . "\n";
/* The action labels. */
$lang->action->label = new stdclass();
+5 -3
View File
@@ -95,9 +95,11 @@ $lang->action->desc->paused = '$date, 由 <strong>$actor</strong> 暂停
$lang->action->desc->diff1 = '修改了 <strong><i>%s</i></strong>,旧值为 "%s",新值为 "%s"。<br />' . "\n";
$lang->action->desc->diff2 = '修改了 <strong><i>%s</i></strong>,区别为:' . "\n" . "<blockquote>%s</blockquote>" . "\n<div class='hidden'>%s</div>";
$lang->action->desc->diff3 = '将文件名 %s 改为 %s 。' . "\n";
$lang->action->desc->starttesttask = '$date, 由 <strong>$actor</strong> 启动测试任务 <strong>$extra</strong>。' . "\n";
$lang->action->desc->stoptesttask = '$date, 由 <strong>$actor</strong> 关闭测试任务 <strong>$extra</strong>。' . "\n";
$lang->action->desc->createbuild = '$date, 由 <strong>$actor</strong> 创建版本 <strong>$extra</strong>。' . "\n";
$lang->action->desc->project = new stdclass();
$lang->action->desc->project->started = '$date, 由 <strong>$actor</strong> 启动测试任务 <strong>$objectID</strong>。' . "\n";
$lang->action->desc->project->closed = '$date, 由 <strong>$actor</strong> 完成测试任务 <strong>$objectID</strong>。' . "\n";
$lang->action->desc->project->opened = '$date, 由 <strong>$actor</strong> 创建版本 <strong>$objectID</strong>。' . "\n";
/* 用来显示动态信息。*/
$lang->action->label = new stdclass();
+9
View File
@@ -188,6 +188,9 @@ class actionModel extends model
$actions = $this->dao->select('*')->from(TABLE_ACTION)
->where('objectType')->eq($objectType)
->andWhere('objectID')->eq($objectID)
->beginIF($objectType == 'project')
->orWhere("project = $objectID AND ((objectType = 'testtask' AND action IN('started','closed')) OR (objectType = 'build' AND action = 'opened'))")
->fi()
->orderBy('date, id')->fetchAll('id');
$histories = $this->getHistory(array_keys($actions));
$this->loadModel('file');
@@ -314,6 +317,12 @@ class actionModel extends model
{
$desc = $action->extra ? $this->lang->action->desc->extra : $this->lang->action->desc->common;
}
/* if module == 'project' and method == 'view', try to find special lang */
if($this->app->getModuleName() == 'project' && $this->app->getMethodName() == 'view')
{
if(isset($this->lang->action->desc->project->$actionType))
$desc = $this->lang->action->desc->project->$actionType;
}
if($this->app->getViewType() == 'mhtml') $action->date = date('m-d H:i', strtotime($action->date));
-1
View File
@@ -25,7 +25,6 @@ class build extends control
$buildID = $this->build->create($projectID);
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action')->create('build', $buildID, 'opened');
$actionID = $this->action->create('project', $projectID, 'createbuild', '', $buildID);
die(js::locate($this->createLink('project', 'build', "project=$projectID"), 'parent'));
}
-6
View File
@@ -438,9 +438,6 @@ class testtask extends control
{
$actionID = $this->action->create('testtask', $taskID, 'Started', $this->post->comment);
$this->action->logHistory($actionID, $changes);
$testtask = $this->testtask->getById($taskID);
$projectActionID = $this->action->create('project', $testtask->project, 'starttesttask', '', $taskID);
}
die(js::locate($this->createLink('testtask', 'view', "taskID=$taskID"), 'parent'));
}
@@ -480,9 +477,6 @@ class testtask extends control
{
$actionID = $this->action->create('testtask', $taskID, 'Closed', $this->post->comment);
$this->action->logHistory($actionID, $changes);
$testtask = $this->testtask->getById($taskID);
$projectActionID = $this->action->create('project', $testtask->project, 'stoptesttask', '', $taskID);
}
die(js::locate($this->createLink('testtask', 'view', "taskID=$taskID"), 'parent'));
}