+finish task#403
This commit is contained in:
@@ -26,5 +26,7 @@ $config->testcase->search['params']['pri'] = array('operator' => '=',
|
||||
$config->testcase->search['params']['type'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->testcase->typeList);
|
||||
$config->testcase->search['params']['stage'] = array('operator' => 'include', 'control' => 'select', 'values' => $lang->testcase->stageList);
|
||||
|
||||
$config->testcase->defaultSteps = 3;
|
||||
|
||||
$config->testcase->create->requiredFields = 'title,type';
|
||||
$config->testcase->edit->requiredFields = 'title,type';
|
||||
|
||||
@@ -145,7 +145,7 @@ class testcase extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create($productID, $moduleID = 0)
|
||||
public function create($productID, $moduleID = 0, $testcaseID = 0)
|
||||
{
|
||||
$this->loadModel('story');
|
||||
if(!empty($_POST))
|
||||
@@ -165,6 +165,37 @@ class testcase extends control
|
||||
/* Set menu. */
|
||||
$this->testcase->setMenu($this->products, $productID);
|
||||
|
||||
/* Init vars. */
|
||||
$pri = 0;
|
||||
$storyID = 0;
|
||||
$type = '';
|
||||
$stage = '';
|
||||
$title = '';
|
||||
$keywords = '';
|
||||
$steps = array();
|
||||
|
||||
if($testcaseID > 0)
|
||||
{
|
||||
$testcase = $this->testcase->getById($testcaseID);
|
||||
$productID = $testcase->product;
|
||||
$type = $testcase->type ? $testcase->type : 'feature';
|
||||
$stage = $testcase->stage;
|
||||
$pri = $testcase->pri;
|
||||
$storyID = $testcase->story;
|
||||
$title = $testcase->title;
|
||||
$keywords = $testcase->keywords;
|
||||
$steps = $testcase->steps;
|
||||
}
|
||||
|
||||
/* Padding the steps to the default steps count. */
|
||||
if(count($steps) < $this->config->testcase->defaultSteps)
|
||||
{
|
||||
$paddingCount = $this->config->testcase->defaultSteps - count($steps);
|
||||
$step->desc = '';
|
||||
$step->expect = '';
|
||||
for($i = 1; $i <= $paddingCount; $i ++) $steps[] = $step;
|
||||
}
|
||||
|
||||
$header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->create;
|
||||
$position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]);
|
||||
$position[] = $this->lang->testcase->create;
|
||||
@@ -178,6 +209,13 @@ class testcase extends control
|
||||
$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->stage = $stage;
|
||||
$this->view->pri = $pri;
|
||||
$this->view->storyID = $storyID;
|
||||
$this->view->title = $title;
|
||||
$this->view->keywords = $keywords;
|
||||
$this->view->steps = $steps;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -23,23 +23,23 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->testcase->type;?></th>
|
||||
<td><?php echo html::select('type', $lang->testcase->typeList, 'feature', 'class=select-3');?></td>
|
||||
<td><?php echo html::select('type', $lang->testcase->typeList, $type, 'class=select-3');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->testcase->stage;?></th>
|
||||
<td><?php echo html::select('stage[]', $lang->testcase->stageList, '', "class='select-3' multiple='multiple'");?></td>
|
||||
<td><?php echo html::select('stage[]', $lang->testcase->stageList, $stage, "class='select-3' multiple='multiple'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->testcase->pri;?></th>
|
||||
<td><?php echo html::select('pri', $lang->testcase->priList, '', 'class=select-3');?></td>
|
||||
<td><?php echo html::select('pri', $lang->testcase->priList, $pri, 'class=select-3');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->testcase->lblStory;?></th>
|
||||
<td><span id='storyIdBox'><?php echo html::select('story', $stories, '', 'class=select-3');?></span></td>
|
||||
<td><span id='storyIdBox'><?php echo html::select('story', $stories, $storyID, 'class=select-3');?></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->testcase->title;?></th>
|
||||
<td><?php echo html::input('title', '', "class='text-1'");?></td>
|
||||
<td><?php echo html::input('title', $title, "class='text-1'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->testcase->steps;?></th>
|
||||
@@ -52,16 +52,17 @@
|
||||
<th class='w-100px'><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
<?php
|
||||
for($i = 1; $i <= 3; $i ++)
|
||||
foreach($steps as $stepID => $step)
|
||||
{
|
||||
echo "<tr id='row$i' class='a-center'>";
|
||||
echo "<th class='stepID'>$i</th>";
|
||||
echo '<td class="w-p50">' . html::textarea('steps[]', '', "rows='3' class='w-p100'") . '</td>';
|
||||
echo '<td>' . html::textarea('expects[]', '', "rows='3' class='w-p100'") . '</td>';
|
||||
$stepID += 1;
|
||||
echo "<tr id='row$stepID' class='a-center'>";
|
||||
echo "<th class='stepID'>$stepID</th>";
|
||||
echo '<td class="w-p50">' . html::textarea('steps[]', $step->desc, "rows='3' class='w-p100'") . '</td>';
|
||||
echo '<td>' . html::textarea('expects[]', $step->expect, "rows='3' class='w-p100'") . '</td>';
|
||||
echo "<td class='a-center w-100px'><nobr>";
|
||||
echo "<input type='button' tabindex='-1' class='addbutton' onclick='preInsert($i)' value='{$lang->testcase->insertBefore}' /><br /> ";
|
||||
echo "<input type='button' tabindex='-1' class='addbutton' onclick='postInsert($i)' value='{$lang->testcase->insertAfter}' /><br /> ";
|
||||
echo "<input type='button' tabindex='-1' class='delbutton' onclick='deleteRow($i)' value='{$lang->testcase->deleteStep}' /><br /> ";
|
||||
echo "<input type='button' tabindex='-1' class='addbutton' onclick='preInsert($stepID)' value='{$lang->testcase->insertBefore}' /><br />";
|
||||
echo "<input type='button' tabindex='-1' class='addbutton' onclick='postInsert($stepID)' value='{$lang->testcase->insertAfter}' /><br />";
|
||||
echo "<input type='button' tabindex='-1' class='delbutton' onclick='deleteRow($stepID)' value='{$lang->testcase->deleteStep}' /><br />";
|
||||
echo "</nobr></td>";
|
||||
echo '</tr>';
|
||||
}
|
||||
@@ -71,7 +72,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->testcase->keywords;?></th>
|
||||
<td><?php echo html::input('keywords', '', "class='text-1'");?></td>
|
||||
<td><?php echo html::input('keywords', $keywords, "class='text-1'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->testcase->files;?></th>
|
||||
|
||||
Reference in New Issue
Block a user