+ complete task #251:add files to testcase.

* adjust task and bug model code.
This commit is contained in:
fujia
2010-07-17 05:39:30 +00:00
parent 02dcd61981
commit 5a619a2ca8
8 changed files with 20 additions and 16 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ class bugModel extends model
$bug = fixer::input('post')
->cleanInt('product,module,severity,project,story,task')
->specialChars('title,steps,keyword')
->remove('comment,fiels,labels')
->remove('comment,files,labels')
->setDefault('project,module,project,story,task,duplicateBug', 0)
->setDefault('openedBuild', '')
->add('lastEditedBy', $this->app->user->account)
+1 -1
View File
@@ -74,7 +74,7 @@ class taskModel extends model
->setIF($this->post->story != false and $this->post->story != $oldTask->story, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
->setIF($this->post->status == 'done', 'left', 0)
->setIF($this->post->consumed > 0 and $this->post->left > 0 and $this->post->status == 'wait', 'status', 'doing')
->remove('comment,fiels,labels')
->remove('comment,files,labels')
->get();
$task->statusCustom = strpos(self::CUSTOM_STATUS_ORDER, $task->status) + 1;
+6 -3
View File
@@ -183,7 +183,7 @@ class testcase extends control
$this->display();
}
/* 编辑一个Bug。*/
/* 编辑一个case。*/
public function edit($caseID)
{
$this->loadModel('story');
@@ -193,11 +193,14 @@ class testcase extends control
{
$changes = $this->testcase->update($caseID);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
$files = $this->loadModel('file')->saveUpload('testcase', $caseID);
if($this->post->comment != '' or !empty($changes) or !empty($files))
{
$this->loadModel('action');
$action = !empty($changes) ? 'Edited' : 'Commented';
$actionID = $this->action->create('case', $caseID, $action, $this->post->comment);
$fileAction = '';
if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n";
$actionID = $this->action->create('case', $caseID, $action, $fileAction . $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
die(js::locate($this->createLink('testcase', 'view', "caseID=$caseID"), 'parent'));
+1
View File
@@ -41,6 +41,7 @@ $lang->testcase->version = '用例版本';
$lang->testcase->result = '测试结果';
$lang->testcase->real = '实际情况';
$lang->testcase->keywords = '关键词';
$lang->testcase->files = '附件';
$lang->testcase->howRun = '执行方式';
$lang->testcase->scriptedBy = '由谁编写';
$lang->testcase->scriptedDate = '编写日期';
+4 -3
View File
@@ -45,7 +45,7 @@ class testcaseModel extends model
->add('status', 'normal')
->add('version', 1)
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
->remove('steps,expects')
->remove('steps,expects,files,labels')
->setDefault('story', 0)
->specialChars('title')
->join('stage', ',')
@@ -54,6 +54,7 @@ class testcaseModel extends model
if(!$this->dao->isError())
{
$caseID = $this->dao->lastInsertID();
$this->loadModel('file')->saveUpload('testcase', $caseID);
foreach($this->post->steps as $stepID => $stepDesc)
{
if(empty($stepDesc)) continue;
@@ -93,7 +94,7 @@ class testcaseModel extends model
if($case->linkCase) $case->linkCaseTitles = $this->dao->select('id,title')->from(TABLE_CASE)->where('id')->in($case->linkCase)->fetchPairs();
if($version == 0) $version = $case->version;
$case->steps = $this->dao->select('*')->from(TABLE_CASESTEP)->where('`case`')->eq($caseID)->andWhere('version')->eq($version)->fetchAll();
$case->files = $this->loadModel('file')->getByObject('case', $caseID);
$case->files = $this->loadModel('file')->getByObject('testcase', $caseID);
return $case;
}
@@ -140,7 +141,7 @@ class testcaseModel extends model
->setDefault('story', 0)
->specialChars('title')
->join('stage', ',')
->remove('comment,steps,expects')
->remove('comment,steps,expects,files,labels')
->get();
$this->dao->update(TABLE_CASE)->data($case)->autoCheck()->batchCheck($this->config->testcase->edit->requiredFields, 'notempty')->where('id')->eq((int)$caseID)->exec();
if(!$this->dao->isError())
+5 -2
View File
@@ -24,7 +24,7 @@
?>
<?php include './header.html.php';?>
<div class='yui-d0'>
<form method='post' target='hiddenwin'>
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $lang->testcase->create;?></caption>
<tr>
@@ -86,7 +86,10 @@
<th class='rowhead'><?php echo $lang->testcase->keywords;?></th>
<td><?php echo html::input('keywords', '', "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->files;?></th>
<td><?php echo $this->fetch('file', 'buildform');?></td>
</tr>
<tr>
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::resetButton();?> </td>
</tr>
+1 -3
View File
@@ -24,7 +24,7 @@
?>
<?php include './header.html.php';?>
<style>#module{width:90%}</style>
<form method='post' target='hiddenwin'>
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
<div class='yui-d0'>
<div id='titlebar'>
<div id='main'>
@@ -72,12 +72,10 @@
<legend><?php echo $lang->testcase->legendComment;?></legend>
<textarea name='comment' rows='6' class='w-p100'></textarea>
</fieldset>
<!--
<fieldset>
<legend><?php echo $lang->testcase->legendAttatch;?></legend>
<?php echo $this->fetch('file', 'buildform', 'filecount=2');?>
</fieldset>
-->
<div class='a-center'>
<?php echo html::submitButton();?>
+1 -3
View File
@@ -64,12 +64,10 @@
?>
</table>
</fieldset>
<!--
<fieldset>
<legend><?php echo $lang->testcase->legendAttatch;?></legend>
<div><?php foreach($case->files as $file) echo html::a($file->fullPath, $file->title, '_blank');?></div>
<div><?php foreach($case->files as $file) echo html::a($this->createLink('file', 'download', "fileID=$file->id"), $file->title, '_blank');?></div>
</fieldset>
-->
<?php include '../../common/view/action.html.php';?>
<div class='a-center' style='font-size:16px; font-weight:bold'>