* finish task#1604.

This commit is contained in:
azhi
2013-07-24 15:15:44 +08:00
parent a3a214318c
commit a87d5832e2
5 changed files with 17 additions and 15 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
.icon-green-task-create {padding:2px 7px 2px 10px; background:url(theme/default/images/main/zt-icons.png) -120px -200px;}
.icon-green-task-batchCreate {padding:2px 10px 2px 10px; background:url(theme/default/images/main/zt-icons.png) -199px -200px;}
.icon-green-testcase-create {padding:2px 7px 2px 10px; background:url(theme/default/images/main/zt-icons.png) -80px -322px;}
.icon-green-testcase-batchCreate {padding:2px 7px 2px 10px; background:url(theme/default/images/main/zt-icons.png) -80px -322px;}
+2 -1
View File
@@ -83,7 +83,8 @@
$lang->task->batchCreate = $lang->project->batchWBS;
common::printIcon('task', 'batchCreate', "projectID={$project->id}&story={$story->id}", '', 'list');
if($productID) common::printIcon('story', 'createCase', "productID=$story->product&moduleID=0&from=&param=0&storyID=$story->id", '', 'list', 'createCase');
$lang->testcase->batchCreate = $lang->testcase->create;
if($productID) common::printIcon('testcase', 'batchCreate', "productID=$story->product&moduleID=0&storyID=$story->id", '', 'list');
$lang->project->unlinkStory = $lang->unlink;
common::printIcon('project', 'unlinkStory', $param, '', 'list', '', 'hiddenwin');
+4 -4
View File
@@ -277,16 +277,16 @@ class testcase extends control
*
* @param int $productID
* @param int $moduleID
* @param int $testcaseID
* @param int $storyID
* @access public
* @return void
*/
public function batchCreate($productID, $moduleID = 0)
public function batchCreate($productID, $moduleID = 0, $storyID = 0)
{
$this->loadModel('story');
if(!empty($_POST))
{
$caseID = $this->testcase->batchCreate($productID);
$caseID = $this->testcase->batchCreate($productID, $storyID);
if(dao::isError()) die(js::error(dao::getError()));
die(js::locate($this->createLink('testcase', 'browse', "productID=$productID&browseType=byModule&param=$moduleID"), 'parent'));
}
@@ -310,10 +310,10 @@ class testcase extends control
$this->view->title = $title;
$this->view->position = $position;
$this->view->productID = $productID;
$this->view->story = $storyID ? $this->story->getByID($storyID) : '';
$this->view->productName = $this->products[$productID];
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0);
$this->view->currentModuleID = $currentModuleID;
$this->view->stories = $this->story->getProductStoryPairs($productID);
$this->view->type = $type;
$this->view->title = $title;
+5 -3
View File
@@ -73,12 +73,14 @@ class testcaseModel extends model
}
/**
* Create a batch case.
* Batch create cases.
*
* @param int $productID
* @param int $storyID
* @access public
* @return void
*/
function batchCreate($productID)
function batchCreate($productID, $storyID)
{
$now = helper::now();
$cases = fixer::input('post')->get();
@@ -90,7 +92,7 @@ class testcaseModel extends model
$data[$i]->product = $productID;
$data[$i]->module = $cases->module[$i] == 'same' ? ($i == 0 ? 0 : $data[$i-1]->module) : $cases->module[$i];
$data[$i]->type = $cases->type[$i] == 'same' ? ($i == 0 ? '' : $data[$i-1]->type) : $cases->type[$i];
$data[$i]->story = $cases->story[$i] == 'same' ? ($i == 0 ? 0 : $data[$i-1]->story) : $cases->story[$i];
$data[$i]->story = $storyID ? $storyID : ($cases->story[$i] == 'same' ? ($i == 0 ? 0 : $data[$i-1]->story) : $cases->story[$i]);
$data[$i]->title = htmlspecialchars($cases->title[$i]);
$data[$i]->openedBy = $this->app->user->account;
$data[$i]->openedDate = $now;
+5 -6
View File
@@ -16,28 +16,27 @@
<?php js::set('productID', $productID);?>
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
<table align='center' class='table-1 fixed'>
<caption><?php echo $lang->testcase->batchCreate;?></caption>
<caption><?php echo $lang->testcase->batchCreate; if($story) echo "{$lang->colon}STORY#{$story->id} $story->title";?></caption>
<tr>
<th class='w-20px'><?php echo $lang->idAB;?></th>
<th class='w-300px'><?php echo $lang->testcase->module;?></th>
<th class='w-180px'><?php echo $lang->testcase->type;?></th>
<th><?php echo $lang->testcase->story;?></th>
<th class='w-300px red'><?php echo $lang->testcase->title;?></th>
<?php if(!$story) echo "<th>{$lang->testcase->story}</th>";?>
<th class='red'><?php echo $lang->testcase->title;?></th>
</tr>
<?php for($i = 0; $i < $config->testcase->batchCreate; $i++):?>
<?php $moduleOptionMenu['same'] = $lang->testcase->same; if($i != 0) $currentModuleID = 'same';?>
<?php $lang->testcase->typeList['same'] = $lang->testcase->same; $type = ($i == 0 ? 'feature' : 'same');?>
<?php $stories['same'] = $lang->testcase->same; $story = $i == 0 ? '' : 'same';?>
<?php $pri = 3;?>
<tr class='a-center'>
<td><?php echo $i+1;?></td>
<td><?php echo html::select("module[$i]", $moduleOptionMenu, $currentModuleID, "class=select-1");?></td>
<td><?php echo html::select("type[$i]", $lang->testcase->typeList, $type, "class=select-1");?></td>
<td class='a-left'style='overflow:visible'><?php echo html::select("story[$i]", '', $story, 'class="select-1 storySelect"');?></td>
<?php if(!$story):?><td class='a-left'style='overflow:visible'><?php echo html::select("story[$i]", '', '', 'class="select-1 storySelect"');?></td><?php endif;?>
<td><?php echo html::input("title[$i]", '', "class='text-1'");?></td>
</tr>
<?php endfor;?>
<tr><td colspan='5' class='a-center'><?php echo html::submitButton() . html::backButton();?></td></tr>
<tr><td colspan='<?php $story ? print '4' : print '5'?>' class='a-center'><?php echo html::submitButton() . html::backButton();?></td></tr>
</table>
</form>
<?php include '../../common/view/footer.html.php';?>