+ add the feature of delete to build module.

+ log the actions of build.
This commit is contained in:
wangchunsheng
2010-04-10 09:34:57 +00:00
parent d07f9d86b5
commit d3673b9998
9 changed files with 118 additions and 73 deletions

View File

@@ -1,10 +1,24 @@
<?php
$config->action->objectTables['bug'] = TABLE_BUG;
$config->action->objectTables['story'] = TABLE_STORY;
$config->action->objectTables['case'] = TABLE_CASE;
$config->action->objectTables['task'] = TABLE_TASK;
$config->action->objectTables['company'] = TABLE_COMPANY;
$config->action->objectTables['product'] = TABLE_PRODUCT;
$config->action->objectTables['story'] = TABLE_STORY;
$config->action->objectTables['productplan'] = TABLE_PRODUCTPLAN;
$config->action->objectTables['release'] = TABLE_RELEASE;
$config->action->objectTables['project'] = TABLE_PROJECT;
$config->action->objectTables['task'] = TABLE_TASK;
$config->action->objectTables['build'] = TABLE_BUILD;
$config->action->objectTables['bug'] = TABLE_BUG;
$config->action->objectTables['case'] = TABLE_CASE;
$config->action->objectTables['testtask'] = TABLE_TESTTASK;
$config->action->objectNameFields['bug'] = 'title';
$config->action->objectNameFields['story'] = 'title';
$config->action->objectNameFields['case'] = 'title';
$config->action->objectNameFields['task'] = 'name';
$config->action->objectNameFields['company'] = 'name';
$config->action->objectNameFields['product'] = 'name';
$config->action->objectNameFields['story'] = 'title';
$config->action->objectNameFields['productplan'] = 'name';
$config->action->objectNameFields['release'] = 'name';
$config->action->objectNameFields['project'] = 'name';
$config->action->objectNameFields['task'] = 'title';
$config->action->objectNameFields['build'] = 'name';
$config->action->objectNameFields['bug'] = 'title';
$config->action->objectNameFields['case'] = 'title';
$config->action->objectNameFields['testtask'] = 'name';

View File

@@ -26,6 +26,14 @@ class action extends control
/* 已删除记录列表。*/
public function trash($orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* 登记session。*/
$uri = $this->app->getURI(true);
$this->session->set('bugList', $uri);
$this->session->set('caseList', $uri);
$this->session->set('storyList', $uri);
$this->session->set('taskList', $uri);
$this->session->set('buildList', $uri);
/* 设置标题和导航条。*/
$this->view->header->title = $this->lang->action->trash;
$this->view->position[] = $this->lang->action->trash;

View File

@@ -31,8 +31,17 @@ $lang->action->objectName = '对象名称';
$lang->action->actor = '操作者';
$lang->action->date = '日期';
$lang->action->objectTypes['bug'] = 'BUG';
$lang->action->objectTypes['case'] = '用例';
$lang->action->objectTypes['company'] = '公司';
$lang->action->objectTypes['product'] = '产品';
$lang->action->objectTypes['story'] = '需求';
$lang->action->objectTypes['productplan'] = '产品计划';
$lang->action->objectTypes['release'] = '发布';
$lang->action->objectTypes['project'] = '项目';
$lang->action->objectTypes['task'] = '任务';
$lang->action->objectTypes['build'] = 'Build';
$lang->action->objectTypes['bug'] = 'Bug';
$lang->action->objectTypes['case'] = '用例';
$lang->action->objectTypes['testtask'] = '测试任务';
/* 用来描述操作历史记录。*/
$lang->action->desc->common = '$date, <strong>$action</strong> by <strong>$actor</strong>';

View File

@@ -39,10 +39,11 @@
</thead>
<tbody>
<?php foreach($trashes as $action):?>
<?php $module = $action->objectType == 'case' ? 'testcase' : $action->objectType;?>
<tr class='a-center'>
<td><?php echo $lang->action->objectTypes[$action->objectType];?></td>
<td><?php echo $action->objectID;?></td>
<td class='a-left'><?php echo $action->objectName;?></td>
<td class='a-left'><?php echo html::a($this->createLink($module, 'view', "id=$action->objectID"), $action->objectName);?></td>
<td><?php echo $users[$action->actor];?></td>
<td><?php echo $action->date;?></td>
<td><?php common::printLink('action', 'undelete', "actionid=$action->id", $lang->action->undelete, 'hiddenwin');?>

View File

@@ -28,8 +28,9 @@ class build extends control
{
if(!empty($_POST))
{
$this->build->create($projectID);
$buildID = $this->build->create($projectID);
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action')->create('build', $buildID, 'Opened');
die(js::locate($this->createLink('project', 'build', "project=$projectID"), 'parent'));
}
@@ -48,9 +49,11 @@ class build extends control
{
if(!empty($_POST))
{
$this->build->update($buildID);
$changes = $this->build->update($buildID);
if(dao::isError()) die(js::error(dao::getError()));
die(js::locate($this->createLink('project', 'build', "projectID={$this->post->project}"), 'parent'));
$actionID = $this->loadModel('action')->create('build', $buildID, 'edited');
$this->action->logHistory($actionID, $changes);
die(js::locate(inlink('view', "buildID=$buildID"), 'parent'));
}
/* 设置菜单。*/
@@ -79,6 +82,7 @@ class build extends control
$this->view->products = $this->project->getProducts($build->project);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->build = $build;
$this->view->actions = $this->loadModel('action')->getList('build', $buildID);
$this->display();
}
@@ -92,7 +96,7 @@ class build extends control
else
{
$build = $this->build->getById($buildID);
$this->build->delete($buildID);
$this->build->delete(TABLE_BUILD, $buildID);
die(js::locate($this->createLink('project', 'build', "projectID=$build->project"), 'parent'));
}
}
@@ -110,5 +114,4 @@ class build extends control
if($varName == 'openedBuild') die(html::select($varName . '[]', $this->build->getProjectBuildPairs($projectID, 'noempty'), $build, 'size=4 class=select-3 multiple'));
if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProjectBuildPairs($projectID, 'noempty'), $build, 'class=select-3'));
}
}

View File

@@ -45,6 +45,7 @@ class buildModel extends model
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product = t3.id')
->where('t1.project')->eq((int)$projectID)
->andWhere('t1.deleted')->eq(0)
->orderBy('t1.id DESC')
->fetchAll();
}
@@ -56,9 +57,15 @@ class buildModel extends model
if(strpos($params, 'noempty') === false) $sysBuilds = array('' => '');
if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => 'Trunk');
$builds = $this->dao->select('id,name')->from(TABLE_BUILD)->where('project')->eq((int)$projectID)->orderBy('id desc')->fetchPairs();
$builds = $this->dao->select('id,name')->from(TABLE_BUILD)
->where('project')->eq((int)$projectID)
->andWhere('deleted')->eq(0)
->orderBy('id desc')->fetchPairs();
if(!$builds) return $sysBuilds;
$releases = $this->dao->select('build,name')->from(TABLE_RELEASE)->where('build')->in(array_keys($builds))->fetchPairs();
$releases = $this->dao->select('build,name')->from(TABLE_RELEASE)
->where('build')->in(array_keys($builds))
->andWhere('deleted')->eq(0)
->fetchPairs();
foreach($releases as $buildID => $releaseName) $builds[$buildID] = $releaseName;
return $sysBuilds + $builds;
}
@@ -70,9 +77,15 @@ class buildModel extends model
if(strpos($params, 'noempty') === false) $sysBuilds = array('' => '');
if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => 'Trunk');
$builds = $this->dao->select('id,name')->from(TABLE_BUILD)->where('product')->eq((int)$productID)->orderBy('id desc')->fetchPairs();
$builds = $this->dao->select('id,name')->from(TABLE_BUILD)
->where('product')->eq((int)$productID)
->andWhere('deleted')->eq(0)
->orderBy('id desc')->fetchPairs();
if(!$builds) return $sysBuilds;
$releases = $this->dao->select('build,name')->from(TABLE_RELEASE)->where('build')->in(array_keys($builds))->fetchPairs();
$releases = $this->dao->select('build,name')->from(TABLE_RELEASE)
->where('build')->in(array_keys($builds))
->andWhere('deleted')->eq(0)
->fetchPairs();
foreach($releases as $buildID => $releaseName) $builds[$buildID] = $releaseName;
return $sysBuilds + $builds;
}
@@ -92,16 +105,12 @@ class buildModel extends model
/* 编辑。*/
public function update($buildID)
{
$oldBuild = $this->getByID($buildID);
$build = fixer::input('post')
->stripTags('name')
->specialChars('desc')
->get();
$this->dao->update(TABLE_BUILD)->data($build)->autoCheck()->batchCheck($this->config->build->edit->requiredFields, 'notempty')->where('id')->eq((int)$buildID)->exec();
}
/* 删除build。*/
public function delete($buildID)
{
return $this->dao->update(TABLE_BUILD)->set('deleted')->eq(1)->where('id')->eq((int)$buildID)->exec();
if(!dao::isError()) return common::createChanges($oldBuild, $build);
}
}

View File

@@ -24,47 +24,46 @@
?>
<?php include '../../common/view/header.html.php';?>
<div class='yui-d0'>
<form method='post' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $lang->build->view;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->build->product;?></th>
<td><?php echo $build->productName;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->name;?></th>
<td><?php echo $build->name;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->builder;?></th>
<td><?php echo $users[$build->builder];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->date;?></th>
<td><?php echo $build->date;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->scmPath;?></th>
<td><?php strpos($build->scmPath, 'http') === 0 ? printf(html::a($build->scmPath)) : printf($build->scmPath);?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->filePath;?></th>
<td><?php strpos($build->filePath, 'http') === 0 ? printf(html::a($build->filePath)) : printf($build->filePath);?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->desc;?></th>
<td><?php echo nl2br($build->desc);?></td>
</tr>
<tr>
<td colspan='2' class='a-center'>
<?php
common::printLink('build', 'edit', "buildID=$build->id", $lang->edit);
common::printLink('build', 'delete', "buildID=$build->id", $lang->delete);
?>
</td>
</tr>
</table>
</form>
<table class='table-1'>
<caption><?php echo $lang->build->view;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->build->product;?></th>
<td><?php echo $build->productName;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->name;?></th>
<td><?php echo $build->name;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->builder;?></th>
<td><?php echo $users[$build->builder];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->date;?></th>
<td><?php echo $build->date;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->scmPath;?></th>
<td><?php strpos($build->scmPath, 'http') === 0 ? printf(html::a($build->scmPath)) : printf($build->scmPath);?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->filePath;?></th>
<td><?php strpos($build->filePath, 'http') === 0 ? printf(html::a($build->filePath)) : printf($build->filePath);?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->desc;?></th>
<td><?php echo nl2br($build->desc);?></td>
</tr>
</table>
<div class='a-center f-16px strong'>
<?php
$browseLink = $this->session->buildList ? $this->session->buildList : $this->createLink('project', 'build', "projectID=$build->project");
common::printLink('build', 'edit', "buildID=$build->id", $lang->edit);
common::printLink('build', 'delete', "buildID=$build->id", $lang->delete, 'hiddenwin');
echo html::a($browseLink, $lang->goback);
?>
</div>
<?php include '../../common/view/action.html.php';?>
</div>
<?php include '../../common/view/footer.html.php';?>

View File

@@ -257,6 +257,8 @@ class project extends control
/* 浏览某一个项目下面的build。*/
public function build($projectID = 0)
{
$this->session->set('buildList', $this->app->getURI(true));
/* 公共的操作。*/
$project = $this->commonAction($projectID);

View File

@@ -30,13 +30,13 @@
</div>
</div>
<div class='yui-d0'>
<table class='table-1 fixed tablesorter'>
<table class='table-1 tablesorter'>
<thead>
<tr class='colhead'>
<th><?php echo $lang->build->product;?></th>
<th class='w-p15'><?php echo $lang->build->name;?></th>
<th class='w-p20'><?php echo $lang->build->scmPath;?></th>
<th class='w-p20'><?php echo $lang->build->filePath;?></th>
<th><?php echo $lang->build->name;?></th>
<th><?php echo $lang->build->scmPath;?></th>
<th><?php echo $lang->build->filePath;?></th>
<th><?php echo $lang->build->date;?></th>
<th><?php echo $lang->build->builder;?></th>
<th><?php echo $lang->actions;?></th>
@@ -46,7 +46,7 @@
<?php foreach($builds as $build):?>
<tr class='a-center'>
<td><?php echo $build->productName;?></td>
<td><?php echo html::a($this->createLink('build', 'view', "build=$build->id"), $build->name);?></td>
<td class='a-left'><?php echo html::a($this->createLink('build', 'view', "build=$build->id"), $build->name);?></td>
<td class='a-left nobr'><?php strpos($build->scmPath, 'http') === 0 ? printf(html::a($build->scmPath)) : printf($build->scmPath);?></td>
<td class='a-left nobr'><?php strpos($build->filePath, 'http') === 0 ? printf(html::a($build->filePath)) : printf($build->filePath);?></td>
<td><?php echo $build->date?></td>