+ complete task #256, #257 and #258:add bug template for bug steps.

This commit is contained in:
fujia
2010-07-22 10:04:27 +00:00
parent 96ca20380b
commit 1e8c290173
8 changed files with 63 additions and 6 deletions

View File

@@ -88,6 +88,7 @@ define('TABLE_CASESTEP', $config->db->prefix . 'caseStep');
define('TABLE_TESTTASK', $config->db->prefix . 'testTask');
define('TABLE_TESTRUN', $config->db->prefix . 'testRun');
define('TABLE_TESTRESULT', $config->db->prefix . 'testResult');
define('TABLE_USERTPL', $config->db->prefix . 'userTPL');
define('TABLE_PRODUCT', $config->db->prefix . 'product');
define('TABLE_STORY', $config->db->prefix . 'story');

View File

@@ -397,6 +397,7 @@ class bug extends control
$this->view->openedBuilds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty');
$this->view->resolvedBuilds = array('' => '') + $this->view->openedBuilds;
$this->view->actions = $this->action->getList('bug', $bugID);
$this->view->templates = $this->bug->getUserBugTemplates($this->app->user->account);
$this->display();
}
@@ -530,6 +531,26 @@ class bug extends control
die(html::select('bug', $bugs, '', 'class=select-1'));
}
public function saveTemplate()
{
$this->bug->saveUserBugTemplate();
if(dao::isError()) die(js::error(dao::getError()));
die($this->fetch('bug', 'createTPLS'));
}
public function createTPLS()
{
$this->view->templates = $this->bug->getUserBugTemplates($this->app->user->account);
$this->display('bug', 'createTPLS');
}
/* 删除一个bug模板。*/
public function deleteTemplate($templateID)
{
$this->dao->delete()->from(TABLE_USERTPL)->where('id')->eq($templateID)->andWhere('account')->eq($this->app->user->account)->exec();
die();
}
/* 发送邮件。*/
private function sendmail($bugID, $actionID)
{

View File

@@ -131,6 +131,7 @@ $lang->bug->buttonToList = '返回';
/* 交互提示。*/
$lang->bug->confirmChangeProduct = '修改产品会导致相应的项目、需求和任务发生变化,确定吗?';
$lang->bug->confirmDelete = '您确认要删除该Bug吗';
$lang->bug->setTemplateTitle = '请输入bug模板标题保存之前请先填写bug重现步骤';
/* 模板。*/
$lang->bug->tblStep = "[步骤]\n";

View File

@@ -438,4 +438,26 @@ class bugModel extends model
/* 合并配置。*/
foreach($commonOption->graph as $key => $value) if(!isset($chartOption->graph->$key)) $chartOption->graph->$key = $value;
}
/* 获得用户的Bug模板列表。*/
public function getUserBugTemplates($account)
{
$templates = $this->dao->select('id, title, content')
->from(TABLE_USERTPL)
->where('account')->eq($account)
->orderBy('id')
->fetchAll();
return $templates;
}
/* 保存用户的BUG模板。*/
public function saveUserBugTemplate()
{
$template = fixer::input('post')
->specialChars('title, content')
->add('account', $this->app->user->account)
->add('type', 'bug')
->get();
$this->dao->insert(TABLE_USERTPL)->data($template)->autoCheck('title, content', 'notempty')->check('title', 'unique')->exec();
}
}

View File

@@ -24,11 +24,13 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/autocomplete.html.php';?>
<?php include '../../common/view/alert.html.php';?>
<style>
#project, #product {width:200px}
#module, #task {width:400px}
#severity, #browser {width:113px}
#story{width:605px}
.text-1 {width: 85%}
</style>
<script language='Javascript'>
/* 当选择产品时,触发这个方法。*/
@@ -171,7 +173,14 @@ $(function() {
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->steps;?></th>
<td><?php echo html::textarea('steps', $steps, "class='area-1' rows='6'");?></td>
<td>
<table class='w-p100 bd-none'>
<tr class='bd-none' valign='top'>
<td class='w-p85 bd-none padding-zero'><?php echo html::textarea('steps', $steps, "class='w-p100' rows='6'");?></td>
<td class='bd-none pl-10px' id='tplBox'><?php echo $this->fetch('bug', 'createTPLS');?></td>
</tr>
</table>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->keywords;?></th>
@@ -179,7 +188,7 @@ $(function() {
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->files;?></th>
<td><?php echo $this->fetch('file', 'buildform');?></td>
<td><?php echo $this->fetch('file', 'buildform', 'fileCount=2&percent=0.85');?></td>
</tr>
<tr>
<td colspan='2' class='a-center'>

View File

@@ -24,9 +24,10 @@
class file extends control
{
/* 生成文件上传的表单。*/
public function buildForm($fileCount = 2)
public function buildForm($fileCount = 2, $percent = 0.9)
{
$this->view->fileCount = $fileCount;
$this->view->percent = $percent;
$this->display();
}

View File

@@ -5,12 +5,12 @@
<?php endfor;?>
</div>
<script language='javascript'>
function setFileFormWidth()
function setFileFormWidth(percent)
{
totalWidth = Math.round($('#fileform').parent().width() * 0.9);
totalWidth = Math.round($('#fileform').parent().width() * percent);
titleWidth = totalWidth - $('#file0').width() - $('#label0').width();
if(!$.browser.mozilla) titleWidth -= 10;
$('#fileform .text-3').css('width', titleWidth + 'px');
};
$(function(){setFileFormWidth()});
$(function(){setFileFormWidth(<?php echo $percent;?>)});
</script>

View File

@@ -159,9 +159,11 @@ table.tablesorter thead tr .headerSortDown {background-image: url(./images/table
.w-type {width:80px}
.w-resolution{width:60px}
.margin-zero {margin: 0}
.margin-10px {margin: 10px}
.margin-15px {margin: 15px}
.margin-20px {margin: 20px}
.padding-zero{padding: 0}
.padding-10px{padding: 10px}
.padding-5px {padding: 5px}