This commit is contained in:
daitingting
2017-05-03 17:36:20 +08:00
34 changed files with 1040 additions and 60 deletions
+1 -1
View File
@@ -146,7 +146,7 @@
</tr>
<tr valign='middle'>
<th><?php echo $lang->bug->productplan;?></th>
<td><?php if(!$bug->plan or !common::printLink('productplan', 'linkBug', "planID=$bug->plan", $bug->planName)) echo $bug->planName;?></td>
<td><?php if(!$bug->plan or !common::printLink('productplan', 'view', "planID=$bug->plan&type=bug", $bug->planName)) echo $bug->planName;?></td>
</tr>
<tr>
<th><?php echo $lang->bug->type;?></th>
+1 -1
View File
@@ -284,7 +284,7 @@ $lang->caselib->menu->testcase = array('link' => 'Case|testcase|browse|');
$lang->caselib->menu->testtask = array('link' => 'Build|testtask|browse|');
$lang->caselib->menu->testsuite = array('link' => 'Suite|testsuite|browse|');
$lang->caselib->menu->report = array('link' => 'Report|testreport|browse|');
$lang->caselib->menu->caselib = array('link' => 'Library|testsuite|library', 'alias' => 'createlib,createcase,libview,edit', 'subModule' => 'tree,testcase');
$lang->caselib->menu->caselib = array('link' => 'Library|testsuite|library', 'alias' => 'createlib,createcase,libview,edit,batchcreatecase,showimport', 'subModule' => 'tree,testcase');
$lang->caselib->menu->create = array('link' => "<i class='icon-plus'></i>Create a Library|testsuite|createLib|", 'float' => 'right');
$lang->caselib->menu->index = array('link' => "<i class='icon-home'></i>Test Home|qa|index|locate=no&productID=%s", 'float' => 'right');
+1 -1
View File
@@ -284,7 +284,7 @@ $lang->caselib->menu->testcase = array('link' => '用例|testcase|browse|');
$lang->caselib->menu->testtask = array('link' => '版本|testtask|browse|');
$lang->caselib->menu->testsuite = array('link' => '套件|testsuite|browse|');
$lang->caselib->menu->report = array('link' => '报告|testreport|browse|');
$lang->caselib->menu->caselib = array('link' => '用例库|testsuite|library', 'alias' => 'createlib,createcase,libview,edit', 'subModule' => 'tree,testcase');
$lang->caselib->menu->caselib = array('link' => '用例库|testsuite|library', 'alias' => 'createlib,createcase,libview,edit,batchcreatecase,showimport', 'subModule' => 'tree,testcase');
$lang->caselib->menu->create = array('link' => "<i class='icon-plus'></i>创建库|testsuite|createLib|", 'float' => 'right');
$lang->caselib->menu->index = array('link' => "<i class='icon-home'></i>测试主页|qa|index|locate=no&productID=%s", 'float' => 'right');
+14 -4
View File
@@ -17,23 +17,33 @@
<?php commonModel::printNotifyLink();?>
</div>
</div>
<?php endif;?>
<?php if(!isset($config->global->browserNotice)):?>
<script>
<?php if(!isset($config->global->browserNotice)):?>
browserNotice = '<?php echo $lang->browserNotice?>'
function ajaxIgnoreBrowser(){$.get(createLink('misc', 'ajaxIgnoreBrowser'));}
$(function(){showBrowserNotice()});
</script>
<?php endif;?>
<?php if(!isset($config->global->novice) and $this->loadModel('tutorial')->checkNovice()):?>
<script>
novice = confirm('<?php echo $lang->tutorial->novice?>');
$.get(createLink('tutorial', 'ajaxSaveNovice', 'novice=' + (novice ? 'true' : 'false')), function()
{
if(novice) location.href=createLink('tutorial', 'index');
});
<?php endif;?>
<?php if(!empty($this->config->sso->turnon)):?>
<?php
$ranzhiAddr = $this->config->sso->addr;
$ranzhiURL = substr($ranzhiAddr, 0, strrpos($ranzhiAddr, '/sys/'));
?>
<?php if(!empty($ranzhiURL)):?>
$(function(){ redirect('<?php echo $ranzhiURL?>', '<?php echo $this->config->sso->code?>'); });
<?php endif;?>
<?php endif;?>
</script>
<?php endif;?>
<script>config.onlybody = '<?php echo $onlybody?>';</script>
+13
View File
@@ -5,15 +5,28 @@ include 'chosen.html.php';
//include 'validation.html.php';
?>
<?php if(empty($_GET['onlybody']) or $_GET['onlybody'] != 'yes'):?>
<?php $this->app->loadConfig('sso');?>
<header id='header'>
<?php if(empty($this->config->sso->turnon)):?>
<div id='topbar'>
<div class='pull-right' id='topnav'><?php commonModel::printTopBar();?></div>
<h5 id='companyname'>
<?php printf($lang->welcome, $app->company->name);?>
</h5>
</div>
<?php endif;?>
<?php
if(!empty($this->config->sso->turnon))
{
css::import($defaultTheme . 'bindranzhi.css');
js::import($jsRoot . 'bindranzhi.js');
}
?>
<nav id='mainmenu'>
<?php commonModel::printMainmenu($this->moduleName); commonModel::printSearchBox();?>
<?php if(!empty($this->config->sso->turnon)):?>
<div class='pull-right' id='topnav'><?php commonModel::printTopBar();?></div>
<?php endif;?>
</nav>
<nav id="modulemenu">
<?php commonModel::printModuleMenu($this->moduleName);?>
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
$config->custom = new stdClass();
$config->custom->canAdd['story'] = 'reasonList,reviewResultList,sourceList,priList';
$config->custom->canAdd['story'] = 'reasonList,sourceList,priList';
$config->custom->canAdd['task'] = 'priList,typeList,reasonList';
$config->custom->canAdd['bug'] = 'priList,severityList,osList,browserList,typeList,resolutionList';
$config->custom->canAdd['testcase'] = 'priList,typeList,stageList,resultList,statusList';
+2 -2
View File
@@ -812,11 +812,11 @@ class project extends control
* @access public
* @return void
*/
public function fixFirst($projectID)
public function fixFirst($projectID, $withLeft = false)
{
if($_POST)
{
$this->project->fixFirst($projectID);
$this->project->fixFirst($projectID, $withLeft);
die(js::reload('parent.parent'));
}
+1
View File
@@ -207,6 +207,7 @@ $lang->project->goback = "Go Back";
$lang->project->noweekend = 'Without Weekend';
$lang->project->withweekend = 'With Weekend';
$lang->project->interval = 'Intervals';
$lang->project->fixFirstWithLeft = 'Do you want to set the left of the day to this value?';
/* 统计。*/
$lang->project->charts = new stdclass();
+1
View File
@@ -207,6 +207,7 @@ $lang->project->goback = "返回任务列表";
$lang->project->noweekend = '去除周末';
$lang->project->withweekend = '显示周末';
$lang->project->interval = '间隔';
$lang->project->fixFirstWithLeft = '是否将该天剩余工时也设置为该值?';
/* 统计。*/
$lang->project->charts = new stdclass();
+3 -3
View File
@@ -825,7 +825,7 @@ class projectModel extends model
unset($queryStatus['closed']);
$queryStatus = array_keys($queryStatus);
}
$tasks = $this->task->getProjectTasks($projectID, $productID, $queryStatus, $modules, $sort, $pager);
$tasks = $this->task->getProjectTasks($projectID, 0, $queryStatus, $modules, $sort, $pager);
}
else
{
@@ -1553,7 +1553,7 @@ class projectModel extends model
* @access public
* @return void
*/
public function fixFirst($projectID)
public function fixFirst($projectID, $withLeft = false)
{
$project = $this->getById($projectID);
$burn = $this->dao->select('*')->from(TABLE_BURN)->where('project')->eq($projectID)->andWhere('date')->eq($project->begin)->fetch();
@@ -1561,7 +1561,7 @@ class projectModel extends model
$data = fixer::input('post')
->add('project', $projectID)
->add('date', $project->begin)
->add('left', empty($burn) ? $this->post->estimate : $burn->left)
->add('left', (empty($burn) or $withLeft) ? $this->post->estimate : $burn->left)
->add('consumed', empty($burn) ? 0 : $burn->consumed)
->get();
if(!is_numeric($data->estimate)) return false;
+12
View File
@@ -25,4 +25,16 @@
</tr>
</table>
</form>
<script>
$(function()
{
$('#submit').click(function()
{
if(confirm('<?php echo $lang->project->fixFirstWithLeft?>'))
{
$(this).closest('form').attr('action', '<?php echo inlink('fixFirst', "projectID={$project->id}&withLeft=1")?>');
}
})
})
</script>
<?php include '../../common/view/footer.lite.html.php';?>
-2
View File
@@ -503,7 +503,6 @@ class storyModel extends model
$allChanges = array();
$now = helper::now();
$data = fixer::input('post')->get();
a($data);exit;
$storyIDList = $this->post->storyIDList ? $this->post->storyIDList : array();
/* Init $stories. */
@@ -575,7 +574,6 @@ class storyModel extends model
$this->dao->update(TABLE_STORY)->data($story)
->autoCheck()
->batchCheck($this->config->story->edit->requiredFields, 'notempty')
->checkIF($story->closedBy, 'closedReason', 'notempty')
->checkIF($story->closedReason == 'done', 'stage', 'notempty')
->checkIF($story->closedReason == 'duplicate', 'duplicateStory', 'notempty')
+7 -5
View File
@@ -145,20 +145,21 @@ function initSteps(selector)
var insertStepRow = function($row, count, type, notFocus)
{
if(count === undefined) count = 1;
var $step;
for(var i = 0; i < count; ++i)
{
var $step = $stepTemplate.clone();
$step = $stepTemplate.clone();
if($row) $row.after($step);
else $steps.append($step);
$step.addClass('step-new');
if(type) $step.find('step-type').val(type);
if(!notFocus) setTimeout(function(){$step.find('.step-steps').focus();}, 10);
if(type) $step.find('.step-type').val(type);
}
if(!notFocus && $step) setTimeout(function(){$step.find('.step-steps').focus();}, 10);
};
var updateStepType = function($step, type)
{
var targetIsGroup = type =='group';
$step.attr('data-type', type).find('.step-steps').toggleClass('autosize', !targetIsGroup).attr('placeholder', targetIsGroup ? groupNameText : null).focus();
$step.attr('data-type', type).find('.step-steps').toggleClass('autosize', !targetIsGroup).attr('placeholder', targetIsGroup ? groupNameText : null);
};
var getStepsElements = function()
{
@@ -277,7 +278,8 @@ function initSteps(selector)
var $step = $control.closest('.step');
if($step.data('index') === getStepsElements().length)
{
insertStepRow($step, 1, 'step', false);
insertStepRow($step, 1, 'step', true);
if($step.is('.step-item,.step-group')) insertStepRow($step, 1, 'item', true);
refreshSteps();
}
}
+4 -4
View File
@@ -1339,10 +1339,10 @@ class testcaseModel extends model
foreach($cases as $key => $case)
{
$caseID = $type == 'case' ? $case->id : $case->case;
$case->bugs = isset($caseBugs[$caseID]) ? $caseBugs[$caseID] : 0;
$case->results = isset($results[$caseID]) ? $results[$caseID] : 0;
$case->caseFails = isset($caseFails[$caseID]) ? $caseFails[$caseID] : 0;
$case->stepNumber = isset($stepNumber[$caseID]) ? $stepNumber[$caseID] : 0;
$case->bugs = isset($caseBugs[$caseID]) ? $caseBugs[$caseID] : 0;
$case->results = isset($results[$caseID]) ? $results[$caseID] : 0;
$case->caseFails = isset($caseFails[$caseID]) ? $caseFails[$caseID] : 0;
$case->stepNumber = isset($steps[$caseID]) ? $steps[$caseID] : 0;
}
return $cases;
+8 -8
View File
@@ -147,16 +147,16 @@
<textarea rows='1' class='form-control autosize step-steps' name='steps[]'></textarea>
<span class="input-group-addon step-type-toggle">
<input type='hidden' name='stepType[]' value='item' class='step-type'>
<label class="checkbox-inline"><input type="checkbox" class='step-group-toggle'> <?php echo $lang->testcase->group ?></label>
<label class="checkbox-inline"><input tabindex='-1' type="checkbox" class='step-group-toggle'> <?php echo $lang->testcase->group ?></label>
</span>
</div>
</td>
<td><textarea rows='1' class='form-control autosize step-expects' name='expects[]'></textarea></td>
<td class='step-actions'>
<div class='btn-group'>
<button type='button' class='btn btn-step-add'><i class='icon icon-plus'></i></button>
<button type='button' class='btn btn-step-move'><i class='icon icon-move'></i></button>
<button type='button' class='btn btn-step-delete'><i class='icon icon-remove'></i></button>
<button type='button' class='btn btn-step-add' tabindex='-1'><i class='icon icon-plus'></i></button>
<button type='button' class='btn btn-step-move' tabindex='-1'><i class='icon icon-move'></i></button>
<button type='button' class='btn btn-step-delete' tabindex='-1'><i class='icon icon-remove'></i></button>
</div>
</td>
</tr>
@@ -170,16 +170,16 @@
<span class='input-group-addon step-type-toggle'>
<?php if(!isset($step->type)) $step->type = 'step';?>
<input type='hidden' name='stepType[]' value='<?php echo $step->type;?>' class='step-type'>
<label class="checkbox-inline"><input type="checkbox" class='step-group-toggle'<?php if($step->type === 'group') echo ' checked' ?>> <?php echo $lang->testcase->group ?></label>
<label class="checkbox-inline"><input tabindex='-1' type="checkbox" class='step-group-toggle'<?php if($step->type === 'group') echo ' checked' ?>> <?php echo $lang->testcase->group ?></label>
</span>
</div>
</td>
<td><?php echo html::textarea('expects[]', $step->expect, "rows='1' class='form-control autosize step-expects'") ?></td>
<td class='step-actions'>
<div class='btn-group'>
<button type='button' class='btn btn-step-add'><i class='icon icon-plus'></i></button>
<button type='button' class='btn btn-step-move'><i class='icon icon-move'></i></button>
<button type='button' class='btn btn-step-delete'><i class='icon icon-remove'></i></button>
<button type='button' class='btn btn-step-add' tabindex='-1'><i class='icon icon-plus'></i></button>
<button type='button' class='btn btn-step-move' tabindex='-1'><i class='icon icon-move'></i></button>
<button type='button' class='btn btn-step-delete' tabindex='-1'><i class='icon icon-remove'></i></button>
</div>
</td>
</tr>
+9 -23
View File
@@ -60,23 +60,16 @@
<textarea rows='1' class='form-control autosize step-steps' name='steps[]'></textarea>
<span class="input-group-addon step-type-toggle">
<input type='hidden' name='stepType[]' value='item' class='step-type'>
<div class='step-type-menu-box'>
<div class='step-type-current'><span></span> <i class='caret'></i></div>
<div class='step-type-menu'>
<a href='javascript:;' href='step-type-option' data-value='step'><?php echo $lang->testcase->step ?></a>
<a href='javascript:;' href='step-type-option' data-value='group'><?php echo $lang->testcase->group ?></a>
<a href='javascript:;' href='step-type-option' data-value='item'><?php echo $lang->testcase->stepChild ?></a>
</div>
</div>
<label class="checkbox-inline"><input tabindex='-1' type="checkbox" class='step-group-toggle'> <?php echo $lang->testcase->group ?></label>
</span>
</div>
</td>
<td><textarea rows='1' class='form-control autosize step-expects' name='expects[]'></textarea></td>
<td class='step-actions'>
<div class='btn-group'>
<button type='button' class='btn btn-step-add'><i class='icon icon-plus'></i></button>
<button type='button' class='btn btn-step-move'><i class='icon icon-move'></i></button>
<button type='button' class='btn btn-step-delete'><i class='icon icon-remove'></i></button>
<button type='button' class='btn btn-step-add' tabindex='-1'><i class='icon icon-plus'></i></button>
<button type='button' class='btn btn-step-move' tabindex='-1'><i class='icon icon-move'></i></button>
<button type='button' class='btn btn-step-delete' tabindex='-1'><i class='icon icon-remove'></i></button>
</div>
</td>
</tr>
@@ -89,24 +82,17 @@
<?php echo html::textarea('steps[]', $step->desc, "rows='1' class='form-control autosize step-steps'") ?>
<span class='input-group-addon step-type-toggle'>
<?php if(!isset($step->type)) $step->type = 'step';?>
<input type='hidden' name='stepType[]' value='<?php echo $step->type ?>' class='step-type'>
<div class='step-type-menu-box'>
<div class='step-type-current'><span></span> <i class='caret'></i></div>
<div class='step-type-menu'>
<a href='javascript:;' href='step-type-option' data-value='step'><?php echo $lang->testcase->step ?></a>
<a href='javascript:;' href='step-type-option' data-value='group'><?php echo $lang->testcase->group ?></a>
<a href='javascript:;' href='step-type-option' data-value='item'><?php echo $lang->testcase->stepChild ?></a>
</div>
</div>
<input type='hidden' name='stepType[]' value='<?php echo $step->type;?>' class='step-type'>
<label class="checkbox-inline"><input tabindex='-1' tabindex='-1' type="checkbox" class='step-group-toggle'<?php if($step->type === 'group') echo ' checked' ?>> <?php echo $lang->testcase->group ?></label>
</span>
</div>
</td>
<td><?php echo html::textarea('expects[]', $step->expect, "rows='1' class='form-control autosize step-expects'") ?></td>
<td class='step-actions'>
<div class='btn-group'>
<button type='button' class='btn btn-step-add'><i class='icon icon-plus'></i></button>
<button type='button' class='btn btn-step-move'><i class='icon icon-move'></i></button>
<button type='button' class='btn btn-step-delete'><i class='icon icon-remove'></i></button>
<button type='button' class='btn btn-step-add' tabindex='-1'><i class='icon icon-plus'></i></button>
<button type='button' class='btn btn-step-move' tabindex='-1'><i class='icon icon-move'></i></button>
<button type='button' class='btn btn-step-delete' tabindex='-1'><i class='icon icon-remove'></i></button>
</div>
</td>
</tr>
+1
View File
@@ -67,6 +67,7 @@
<?php if(isset($stepData[$key]['desc'])):?>
<table class='w-p100 bd-0'>
<?php foreach($stepData[$key]['desc'] as $id => $desc):?>
<?php if(empty($desc['content'])) continue;?>
<tr class='step'>
<td><?php echo $id . html::hidden("stepType[$key][$id]", $desc['type'])?></td>
<td><?php echo html::textarea("desc[$key][$id]", htmlspecialchars($desc['content']), "class='form-control'")?></td>
+339 -1
View File
@@ -432,7 +432,7 @@ class testsuite extends control
$this->view->orderBy = $orderBy;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
$this->view->modules = $this->tree->getOptionMenu($libID, $viewType = 'caselib', $startModuleID = 0);
$this->view->moduleTree = $this->tree->getTreeMenu($libID, $viewType = 'caselib', $startModuleID = 0, array('treeModel', 'createCaseLibLink'), '');
$this->view->moduleTree = $this->tree->getTreeMenu($libID, $viewType = 'caselib', $startModuleID = 0, array('treeModel', 'createCaseLibLink'));
$this->view->pager = $pager;
$this->view->browseType = $browseType;
$this->view->moduleID = $moduleID;
@@ -554,6 +554,47 @@ class testsuite extends control
$this->display();
}
/**
* Batch create case.
*
* @param int $libID
* @param int $moduleID
* @access public
* @return void
*/
public function batchCreateCase($libID, $moduleID = 0)
{
$this->loadModel('testcase');
if(!empty($_POST))
{
$caseID = $this->testsuite->batchCreateCase($libID);
if(dao::isError()) die(js::error(dao::getError()));
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('testsuite', 'library', "libID=$libID&browseType=byModule&param=$moduleID"), 'parent'));
}
$libraries = $this->testsuite->getLibraries();
if(empty($libraries)) $this->locate(inlink('createLib'));
/* Set lib menu. */
$this->testsuite->setLibMenu($libraries, $libID);
$currentModuleID = (int)$moduleID;
/* Set module option menu. */
$moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($libID, $viewType = 'caselib', $startModuleID = 0);
$moduleOptionMenu['ditto'] = $this->lang->testcase->ditto;
$this->view->title = $libraries[$libID] . $this->lang->colon . $this->lang->testcase->batchCreate;
$this->view->position[] = html::a($this->createLink('testsuite', 'library', "libID=$libID"), $libraries[$libID]);
$this->view->position[] = $this->lang->testcase->batchCreate;
$this->view->libID = $libID;
$this->view->moduleOptionMenu = $moduleOptionMenu;
$this->view->currentModuleID = $currentModuleID;
$this->display();
}
/**
* View library
*
@@ -623,4 +664,301 @@ class testsuite extends control
$this->view->keywords = $keywords;
$this->display();
}
/**
* Export templet.
*
* @param int $libID
* @access public
* @return void
*/
public function exportTemplet($libID)
{
$this->loadModel('testcase');
if($_POST)
{
if(!$this->config->testcase->needReview) unset($this->lang->testcase->statusList['wait']);
$fields['module'] = $this->lang->testcase->module;
$fields['title'] = $this->lang->testcase->title;
$fields['stepDesc'] = $this->lang->testcase->stepDesc;
$fields['stepExpect'] = $this->lang->testcase->stepExpect;
$fields['keywords'] = $this->lang->testcase->keywords;
$fields['type'] = $this->lang->testcase->type;
$fields['pri'] = $this->lang->testcase->pri;
$fields['status'] = $this->lang->testcase->status;
$fields['stage'] = $this->lang->testcase->stage;
$fields['precondition'] = $this->lang->testcase->precondition;
$fields[''] = '';
$fields['typeValue'] = $this->lang->testcase->lblTypeValue;
$fields['stageValue'] = $this->lang->testcase->lblStageValue;
$fields['statusValue'] = $this->lang->testcase->lblStatusValue;
$modules = $this->loadModel('tree')->getOptionMenu($libID, $viewType = 'caselib', $startModuleID = 0);
$rows = array();
foreach($modules as $moduleID => $module)
{
$row = new stdclass();
$row->module = $module . "(#$moduleID)";
$row->stepDesc = "1. \n2. \n3.";
$row->stepExpect = "1. \n2. \n3.";
if(empty($rows))
{
$row->typeValue = join("\n", $this->lang->testcase->typeList);
$row->stageValue = join("\n", $this->lang->testcase->stageList);
$row->statusValue = join("\n", $this->lang->testcase->statusList);
}
$rows[] = $row;
}
$this->post->set('fields', $fields);
$this->post->set('kind', 'testcase');
$this->post->set('rows', $rows);
$this->post->set('extraNum', $this->post->num);
$this->post->set('fileName', 'templet');
$this->fetch('file', 'export2csv', $_POST);
}
$this->display();
}
/**
* Import case csv file.
*
* @param int $libID
* @access public
* @return void
*/
public function import($libID)
{
$this->loadModel('testcase');
if($_FILES)
{
$file = $this->loadModel('file')->getUpload('file');
$file = $file[0];
move_uploaded_file($file['tmpname'], $this->file->savePath . $file['pathname']);
$fileName = $this->file->savePath . $file['pathname'];
$rows = $this->file->parseCSV($fileName);
$fields = $this->testcase->getImportFields($productID);
$fields = array_flip($fields);
$header = array();
foreach($rows[0] as $i => $rowValue)
{
if(empty($rowValue)) break;
$header[$i] = $rowValue;
}
unset($rows[0]);
$columnKey = array();
foreach($header as $title)
{
if(!isset($fields[$title])) continue;
$columnKey[] = $fields[$title];
}
if(count($columnKey) != count($header) or $this->post->encode != 'utf-8')
{
$fc = file_get_contents($fileName);
$encode = $this->post->encode != "utf-8" ? $this->post->encode : 'gbk';
$fc = helper::convertEncoding($fc, $encode, 'utf-8');
file_put_contents($fileName, $fc);
$rows = $this->file->parseCSV($fileName);
$columnKey = array();
$header = array();
foreach($rows[0] as $i => $rowValue)
{
if(empty($rowValue)) break;
$header[$i] = $rowValue;
}
unset($rows[0]);
foreach($header as $title)
{
if(!isset($fields[$title])) continue;
$columnKey[] = $fields[$title];
}
if(count($columnKey) != count($header)) die(js::alert($this->lang->testcase->errorEncode));
}
$this->session->set('importFile', $fileName);
die(js::locate(inlink('showImport', "libID=$libID"), 'parent.parent'));
}
$this->display();
}
/**
* Show import case.
*
* @param int $libID
* @access public
* @return void
*/
public function showImport($libID)
{
$this->loadModel('testcase');
if($_POST)
{
$this->testsuite->createFromImport($libID);
die(js::locate(inlink('library', "libID=$libID"), 'parent'));
}
$libraries = $this->testsuite->getLibraries();
if(empty($libraries)) $this->locate(inlink('createLib'));
$this->testsuite->setMenu($libraries, $libID);
$file = $this->session->importFile;
$caseLang = $this->lang->testcase;
$caseConfig = $this->config->testcase;
$modules = $this->loadModel('tree')->getOptionMenu($libID, $viewType = 'caselib', $startModuleID = 0);
$fields = explode(',', $caseConfig->exportFields);
foreach($fields as $key => $fieldName)
{
$fieldName = trim($fieldName);
$fields[$fieldName] = isset($caseLang->$fieldName) ? $caseLang->$fieldName : $fieldName;
unset($fields[$key]);
}
$fields = array_flip($fields);
$rows = $this->loadModel('file')->parseCSV($file);
$header = array();
foreach($rows[0] as $i => $rowValue)
{
if(empty($rowValue)) break;
$header[$i] = $rowValue;
}
unset($rows[0]);
foreach($header as $title)
{
if(!isset($fields[$title])) continue;
$columnKey[] = $fields[$title];
}
$endField = end($fields);
$caseData = array();
$stepData = array();
$stepVars = 0;
foreach($rows as $row => $data)
{
$case = new stdclass();
foreach($columnKey as $key => $field)
{
if(!isset($data[$key])) continue;
$cellValue = $data[$key];
if($field == 'module')
{
$case->$field = 0;
if(strrpos($cellValue, '(#') !== false)
{
$id = trim(substr($cellValue, strrpos($cellValue,'(#') + 2), ')');
$case->$field = $id;
}
}
elseif(in_array($field, $caseConfig->export->listFields))
{
if($field == 'stage')
{
$stages = explode("\n", $cellValue);
foreach($stages as $stage) $case->stage[] = array_search($stage, $caseLang->{$field . 'List'});
$case->stage = join(',', $case->stage);
}
else
{
$case->$field = array_search($cellValue, $caseLang->{$field . 'List'});
}
}
elseif($field != 'stepDesc' and $field != 'stepExpect')
{
$case->$field = $cellValue;
}
else
{
$steps = explode("\n", $cellValue);
$stepKey = str_replace('step', '', strtolower($field));
$caseStep = array();
foreach($steps as $step)
{
$step = trim($step);
if(empty($step)) continue;
if(preg_match('/^(([0-9]+)\.[0-9]+)([.、]{1})/U', $step, $out))
{
$num = $out[1];
$parent = $out[2];
$sign = $out[3];
$signbit = $sign == '.' ? 1 : 3;
$step = trim(substr($step, strlen($num) + $signbit));
if(!empty($step)) $caseStep[$num]['content'] = $step;
$caseStep[$num]['type'] = 'item';
$caseStep[$parent]['type'] = 'group';
}
elseif(preg_match('/^([0-9]+)([.、]{1})/U', $step, $out))
{
$num = $out[1];
$sign = $out[2];
$signbit = $sign == '.' ? 1 : 3;
$step = trim(substr($step, strlen($num) + $signbit));
if(!empty($step)) $caseStep[$num]['content'] = $step;
$caseStep[$num]['type'] = 'step';
}
elseif(isset($num))
{
$caseStep[$num]['content'] .= "\n" . $step;
}
else
{
if($field == 'stepDesc')
{
$num = 1;
$caseStep[$num]['content'] = $step;
$caseStep[$num]['type'] = 'step';
}
if($field == 'stepExpect' and isset($stepData[$row]['desc']))
{
end($stepData[$row]['desc']);
$num = key($stepData[$row]['desc']);
$caseStep[$num]['content'] = $step;
}
}
}
unset($num);
unset($sign);
$stepVars += count($caseStep, COUNT_RECURSIVE) - count($caseStep);
$stepData[$row][$stepKey] = $caseStep;
}
}
$caseData[$row] = $case;
unset($case);
}
if(empty($caseData))
{
echo js::alert($this->lang->error->noData);
die(js::locate($this->createLink('testsuite', 'library', "libID=$libID")));
}
if(!$this->config->testcase->needReview) unset($this->lang->testcase->statusList['wait']);
/* Judge whether the editedTasks is too large and set session. */
$countInputVars = count($caseData) * 9 + $stepVars;
$showSuhosinInfo = common::judgeSuhosinSetting($countInputVars);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? sprintf($this->lang->suhosinInfo, $countInputVars) : sprintf($this->lang->maxVarsInfo, $countInputVars);
$this->view->title = $this->lang->caselib->common . $this->lang->colon . $this->lang->testcase->showImport;
$this->view->position[] = $this->lang->testcase->showImport;
$this->view->modules = $modules;
$this->view->cases = $this->dao->select('id,module,stage,status,pri,type')->from(TABLE_CASE)->where('lib')->eq($libID)->andWhere('deleted')->eq(0)->andWhere('product')->eq(0)->fetchAll('id');
$this->view->caseData = $caseData;
$this->view->stepData = $stepData;
$this->view->libID = $libID;
$this->display();
}
}
+2
View File
@@ -0,0 +1,2 @@
.w-180px{width:180px}
.chosen-container[id^="module"] .chosen-drop {min-width: 400px; border-top: 1px solid #ddd!important}
+2
View File
@@ -1,5 +1,7 @@
.w-220px{width:220px}
#createActionMenu .dropdown-menu {width: 100%;}
.dropdown-menu.with-search {padding: 0; min-width: 150px; overflow: hidden; max-height: 302px;}
.dropdown-menu > .menu-search .input-group {width:100%;}
.dropdown-menu > .menu-search .input-group-addon {position: absolute; right: 10px; top: 0; z-index: 10; background: none; border: none; color: #666}
+2
View File
@@ -0,0 +1,2 @@
.table table td,.outer .table table tbody > tr:last-child td {padding: 2px 0 2px 5px!important; border: none!important;}
.chosen-container-single .chosen-drop {min-width: 300px; border-top: 1px solid #ddd!important}
+2
View File
@@ -20,6 +20,8 @@ $lang->testsuite->linkVersion = "版本";
$lang->testsuite->unlinkCase = "移除";
$lang->testsuite->batchUnlinkCases = "批量移除用例";
$lang->testsuite->deleted = '已删除';
$lang->testsuite->exportTemplet = '导出模板';
$lang->testsuite->importFile = '导入CSV';
$lang->testsuite->common = '套件';
$lang->testsuite->product = '所属' . $lang->productCommon;
+249
View File
@@ -509,4 +509,253 @@ class testsuiteModel extends model
}
return $link;
}
/**
* Create from import.
*
* @param int $libID
* @access public
* @return void
*/
public function createFromImport($libID)
{
$this->loadModel('action');
$this->loadModel('testcase');
$this->loadModel('file');
$now = helper::now();
$data = fixer::input('post')->get();
if(!empty($_POST['id']))
{
$oldSteps = $this->dao->select('t2.*')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_CASESTEP)->alias('t2')->on('t1.id = t2.case')
->where('t1.id')->in(($_POST['id']))
->andWhere('t1.version=t2.version')
->orderBy('t2.id')
->fetchGroup('case');
$oldCases = $this->dao->select('*')->from(TABLE_CASE)->where('id')->in($_POST['id'])->fetchAll('id');
}
$cases = array();
foreach($data->lib as $key => $lib)
{
$caseData = new stdclass();
$caseData->lib = $lib;
$caseData->module = $data->module[$key];
$caseData->title = $data->title[$key];
$caseData->pri = (int)$data->pri[$key];
$caseData->type = $data->type[$key];
$caseData->status = $data->status[$key];
$caseData->stage = join(',', $data->stage[$key]);
$caseData->keywords = $data->keywords[$key];
$caseData->frequency = 1;
$caseData->precondition = $data->precondition[$key];
if(isset($this->config->testcase->create->requiredFields))
{
$requiredFields = explode(',', $this->config->testcase->create->requiredFields);
foreach($requiredFields as $requiredField)
{
$requiredField = trim($requiredField);
if(empty($caseData->$requiredField)) die(js::alert(sprintf($this->lang->testcase->noRequire, $key, $this->lang->testcase->$requiredField)));
}
}
$cases[$key] = $caseData;
}
$forceReview = $this->testcase->forceReview();
foreach($cases as $key => $caseData)
{
if(!empty($_POST['id'][$key]) and empty($_POST['insert']))
{
$caseID = $data->id[$key];
$stepChanged = false;
$steps = array();
$oldStep = isset($oldSteps[$caseID]) ? $oldSteps[$caseID] : array();
$oldCase = $oldCases[$caseID];
/* Remove the empty setps in post. */
$steps = array();
if(isset($_POST['desc'][$key]))
{
foreach($data->desc[$key] as $id => $desc)
{
$desc = trim($desc);
if(empty($desc))continue;
$step = new stdclass();
$step->type = $data->stepType[$key][$id];
$step->desc = $desc;
$step->expect = trim($data->expect[$key][$id]);
$steps[] = $step;
}
}
/* If step count changed, case changed. */
if((!$oldStep != !$steps) or (count($oldStep) != count($steps)))
{
$stepChanged = true;
}
else
{
/* Compare every step. */
foreach($oldStep as $id => $oldStep)
{
if(trim($oldStep->desc) != trim($steps[$id]->desc) or trim($oldStep->expect) != $steps[$id]->expect)
{
$stepChanged = true;
break;
}
}
}
$version = $stepChanged ? $oldCase->version + 1 : $oldCase->version;
$caseData->version = $version;
$changes = common::createChanges($oldCase, $caseData);
if(!$changes and !$stepChanged) continue;
if($changes or $stepChanged)
{
$caseData->lastEditedBy = $this->app->user->account;
$caseData->lastEditedDate = $now;
if($stepChanged and $forceReview) $caseData->status = 'wait';
$this->dao->update(TABLE_CASE)->data($caseData)->where('id')->eq($caseID)->autoCheck()->exec();
if($stepChanged)
{
$parentStepID = 0;
foreach($steps as $id => $step)
{
$step = (array)$step;
if(empty($step['desc'])) continue;
$stepData = new stdclass();
$stepData->type = ($step['type'] == 'item' and $parentStepID == 0) ? 'step' : $step['type'];
$stepData->parent = ($stepData->type == 'item') ? $parentStepID : 0;
$stepData->case = $caseID;
$stepData->version = $version;
$stepData->desc = htmlspecialchars($step['desc']);
$stepData->expect = htmlspecialchars($step['expect']);
$this->dao->insert(TABLE_CASESTEP)->data($stepData)->autoCheck()->exec();
if($stepData->type == 'group') $parentStepID = $this->dao->lastInsertID();
if($stepData->type == 'step') $parentStepID = 0;
}
}
$oldCase->steps = $this->joinStep($oldStep);
$caseData->steps = $this->joinStep($steps);
$changes = common::createChanges($oldCase, $caseData);
$actionID = $this->action->create('case', $caseID, 'Edited');
$this->action->logHistory($actionID, $changes);
}
}
else
{
$caseData->version = 1;
$caseData->openedBy = $this->app->user->account;
$caseData->openedDate = $now;
$caseData->branch = isset($data->branch[$key]) ? $data->branch[$key] : $branch;
if($forceReview) $caseData->status = 'wait';
$this->dao->insert(TABLE_CASE)->data($caseData)->autoCheck()->exec();
if(!dao::isError())
{
$caseID = $this->dao->lastInsertID();
$parentStepID = 0;
foreach($data->desc[$key] as $id => $desc)
{
$desc = trim($desc);
if(empty($desc)) continue;
$stepData = new stdclass();
$stepData->type = ($data->stepType[$key][$id] == 'item' and $parentStepID == 0) ? 'step' : $data->stepType[$key][$id];
$stepData->parent = ($stepData->type == 'item') ? $parentStepID : 0;
$stepData->case = $caseID;
$stepData->version = 1;
$stepData->desc = htmlspecialchars($desc);
$stepData->expect = htmlspecialchars($data->expect[$key][$id]);
$this->dao->insert(TABLE_CASESTEP)->data($stepData)->autoCheck()->exec();
if($stepData->type == 'group') $parentStepID = $this->dao->lastInsertID();
if($stepData->type == 'step') $parentStepID = 0;
}
$this->action->create('case', $caseID, 'Opened');
}
}
}
unlink($this->session->importFile);
unset($_SESSION['importFile']);
}
/**
* Batch create case for lib.
*
* @param int $libID
* @access public
* @return void
*/
public function batchCreateCase($libID)
{
$this->loadModel('testcase');
$this->loadModel('action');
$now = helper::now();
$cases = fixer::input('post')->get();
$batchNum = count(reset($cases));
$result = $this->loadModel('common')->removeDuplicate('case', $cases, "lib={$libID}");
$cases = $result['data'];
for($i = 0; $i < $batchNum; $i++)
{
if(!empty($cases->title[$i]) and empty($cases->type[$i])) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->testcase->type)));
}
$module = 0;
$type = '';
$pri = 3;
for($i = 0; $i < $batchNum; $i++)
{
$module = $cases->module[$i] == 'ditto' ? $module : $cases->module[$i];
$type = $cases->type[$i] == 'ditto' ? $type : $cases->type[$i];
$pri = $cases->pri[$i] == 'ditto' ? $pri : $cases->pri[$i];
$cases->module[$i] = (int)$module;
$cases->type[$i] = $type;
$cases->pri[$i] = $pri;
}
$forceReview = $this->testcase->forceReview();
for($i = 0; $i < $batchNum; $i++)
{
if($cases->type[$i] != '' and $cases->title[$i] != '')
{
$data[$i] = new stdclass();
$data[$i]->lib = $libID;
$data[$i]->module = $cases->module[$i];
$data[$i]->type = $cases->type[$i];
$data[$i]->pri = $cases->pri[$i];
$data[$i]->stage = empty($cases->stage[$i]) ? '' : implode(',', $cases->stage[$i]);
$data[$i]->color = $cases->color[$i];
$data[$i]->title = $cases->title[$i];
$data[$i]->precondition = $cases->precondition[$i];
$data[$i]->keywords = $cases->keywords[$i];
$data[$i]->openedBy = $this->app->user->account;
$data[$i]->openedDate = $now;
$data[$i]->status = $forceReview ? 'wait' : 'normal';
$data[$i]->version = 1;
$this->dao->insert(TABLE_CASE)->data($data[$i])
->autoCheck()
->batchCheck($this->config->testcase->create->requiredFields, 'notempty')
->exec();
if(dao::isError())
{
echo js::error(dao::getError());
die(js::reload('parent'));
}
$caseID = $this->dao->lastInsertID();
$actionID = $this->action->create('case', $caseID, 'Opened');
}
}
}
}
@@ -0,0 +1,93 @@
<?php
/**
* The batch create case view of testsuite module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yidong Wang <yidong@cnezsoft.com>
* @package testsuite
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('testcaseBatchCreateNum', $config->testcase->batchCreate);?>
<?php js::set('libID', $libID);?>
<div id='titlebar'>
<div class='heading'>
<span class='prefix'><?php echo html::icon($lang->icons['testcase']);?></span>
<strong>
<small class='text-muted'><?php echo html::icon($lang->icons['batchCreate']);?></small>
<?php echo $lang->testcase->batchCreate;?>
</strong>
<div class='actions'>
<?php echo html::commonButton($lang->pasteText, "data-toggle='myModal' ")?>
</div>
</div>
</div>
<form class='form-condensed' method='post' enctype='multipart/form-data' target='hiddenwin'>
<table align='center' class='table table-form table-fixed'>
<thead>
<tr>
<th class='w-50px'> <?php echo $lang->idAB;?></th>
<th class='w-180px'><?php echo $lang->testcase->module;?></th>
<th><?php echo $lang->testcase->title;?> <span class='required'></span></th>
<th class='w-100px'><?php echo $lang->testcase->type;?> <span class='required'></span></th>
<th class='w-80px'> <?php echo $lang->testcase->pri;?></th>
<th class='w-150px'><?php echo $lang->testcase->precondition;?></th>
<th class='w-100px'><?php echo $lang->testcase->keywords;?></th>
<th class='w-200px'><?php echo $lang->testcase->stage;?></th>
</tr>
</thead>
<?php unset($lang->testcase->typeList['']);?>
<?php for($i = 0; $i < $config->testcase->batchCreate; $i++):?>
<?php
if($i != 0) $currentModuleID = 'ditto';
if($i != 0) $lang->testcase->typeList['ditto'] = $lang->testcase->ditto;
if($i != 0) $lang->testcase->priList['ditto'] = $lang->testcase->ditto;
$type = $i == 0 ? 'feature' : 'ditto';
$pri = $i == 0 ? 3 : 'ditto';
?>
<tr class='text-center'>
<td><?php echo $i+1;?></td>
<td class='text-left' style='overflow:visible'><?php echo html::select("module[$i]", $moduleOptionMenu, $currentModuleID, "class='form-control chosen'");?></td>
<td style='overflow:visible'>
<div class='input-group'>
<?php echo html::hidden("color[$i]", '', "data-provide='colorpicker' data-wrapper='input-group-btn fix-border-right' data-pull-menu-right='false' data-btn-tip='{$lang->testcase->colorTag}' data-update-text='#title\\[{$i}\\]'");?>
<?php echo html::input("title[$i]", '', "class='form-control' autocomplete='off'");?>
</div>
</td>
<td><?php echo html::select("type[$i]", $lang->testcase->typeList, $type, "class=form-control");?></td>
<td><?php echo html::select("pri[$i]", $lang->testcase->priList, $pri, "class=form-control");?></td>
<td><?php echo html::textarea("precondition[$i]", '', "rows='1' class='form-control autosize'")?></td>
<td><?php echo html::input("keywords[$i]", '', "class='form-control' autocomplete='off'");?></td>
<td class='text-left' style='overflow:visible'><?php echo html::select("stage[$i][]", $lang->testcase->stageList, '', "class='form-control chosen' multiple");?></td>
</tr>
<?php endfor;?>
<tfoot>
<tr><td colspan='8' class='text-center'><?php echo html::submitButton() . html::backButton();?></td></tr>
</tfoot>
</table>
</form>
<table class='hide' id='trTemp'>
<tbody>
<tr class='text-center'>
<td>%s</td>
<td class='text-left' style='overflow:visible'><?php echo html::select("module[%s]", $moduleOptionMenu, $currentModuleID, "class='form-control'");?></td>
<td style='overflow:visible'>
<div class='input-group'>
<?php echo html::hidden("color[%s]", '', "data-wrapper='input-group-btn fix-border-right' data-pull-menu-right='false' data-btn-tip='{$lang->testcase->colorTag}' data-update-text='#title\\[%s\\]'");?>
<?php echo html::input("title[%s]", '', "class='form-control' autocomplete='off'");?></td>
</div>
</td>
<td><?php echo html::select("type[%s]", $lang->testcase->typeList, $type, "class=form-control");?></td>
<td><?php echo html::select("pri[%s]", $lang->testcase->priList, $pri, "class=form-control");?></td>
<td><?php echo html::textarea("precondition[%s]", '', "class='form-control'")?></td>
<td><?php echo html::input("keywords[%s]", '', "class='form-control' autocomplete='off'");?></td>
<td class='text-left' style='overflow:visible'><?php echo html::select("stage[%s][]", $lang->testcase->stageList, '', "class='form-control' multiple");?></td>
</tr>
</tbody>
</table>
<?php include '../../common/view/pastetext.html.php';?>
<?php include '../../common/view/footer.html.php';?>
@@ -0,0 +1,49 @@
<?php include '../../common/view/header.lite.html.php';?>
<script>
function setDownloading()
{
if($.browser.opera) return true; // Opera don't support, omit it.
$.cookie('downloading', 0);
time = setInterval("closeWindow()", 300);
return true;
}
function closeWindow()
{
if($.cookie('downloading') == 1)
{
parent.$.closeModal();
$.cookie('downloading', null);
clearInterval(time);
}
}
</script>
<div id='titlebar'>
<div class='heading'>
<span class='prefix'><?php echo html::icon($lang->icons['export']);?></span>
<strong><?php echo $lang->testcase->exportTemplet;?></strong>
</div>
</div>
<form class='form-condensed' method='post' target='hiddenwin' onsubmit='setDownloading();' style='padding: 40px 5%'>
<table class='w-p100'>
<tr>
<td>
<div class='input-group'>
<span class='input-group-addon'><?php echo $lang->testcase->num;?></span>
<?php
echo html::input('num', '10', "class='form-control' autocomplete='off'");
?>
</div>
</td>
<td class='w-100px'>
<?php echo html::select('encode', $config->charsets[$this->cookie->lang], 'utf-8', "class='form-control'");?>
</td>
<td>
<?php echo html::submitButton();?>
</td>
</tr>
</table>
</form>
<?php include '../../common/view/footer.lite.html.php';?>
+19
View File
@@ -0,0 +1,19 @@
<?php include '../../common/view/header.lite.html.php';?>
<div class='container mw-600px'>
<form class='form-condensed' method='post' enctype='multipart/form-data' target='hiddenwin'>
<table class='table table-form'>
<tr>
<td align='center' style="padding:30px">
<input type='file' name='file' class='form-control'/>
</td>
<td>
<?php echo html::select('encode', $config->charsets[$this->cookie->lang], 'utf-8', "class='form-control'");?>
</td>
<td>
<?php echo html::submitButton();?>
</td>
</tr>
</table>
</form>
</div>
<?php include '../../common/view/footer.lite.html.php';?>
+19
View File
@@ -45,6 +45,15 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
?>
</div>
<div class='actions'>
<div class='btn-group'>
<?php
$link = common::hasPriv('testsuite', 'exportTemplet') ? $this->createLink('testsuite', 'exportTemplet', "libID=$libID") : '#';
if(common::hasPriv('testsuite', 'exportTemplet')) echo html::a($link, "<i class='icon-download-alt'></i> " . $lang->testsuite->exportTemplet, '', "class='btn export'");
$link = common::hasPriv('testsuite', 'import') ? $this->createLink('testsuite', 'import', "libID=$libID") : '#';
if(common::hasPriv('testsuite', 'import')) echo html::a($link, "<i class='icon-upload-alt'></i> " . $lang->testsuite->importFile, '', "class='btn export'");
?>
</div>
<div class='btn-group'>
<div class='btn-group' id='createActionMenu'>
<?php
@@ -52,6 +61,16 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
$link = common::hasPriv('testsuite', 'createCase') ? $this->createLink('testsuite', 'createCase', "libID=$libID&moduleID=" . (isset($moduleID) ? $moduleID : 0)) : '#';
echo html::a($link, "<i class='icon-plus'></i>" . $lang->testcase->create, '', $misc);
?>
<button type='button' class='btn btn-primary dropdown-toggle' data-toggle='dropdown'>
<span class='caret'></span>
</button>
<ul class='dropdown-menu pull-right'>
<?php
$misc = common::hasPriv('testsuite', 'batchCreateCase') ? '' : "class=disabled";
$link = common::hasPriv('testsuite', 'batchCreateCase') ? $this->createLink('testsuite', 'batchCreateCase', "libID=$libID&moduleID=" . (isset($moduleID) ? $moduleID : 0)) : '#';
echo "<li>" . html::a($link, $lang->testcase->batchCreate, '', $misc) . "</li>";
?>
</ul>
</div>
</div>
</div>
+121
View File
@@ -0,0 +1,121 @@
<?php include '../../common/view/header.html.php';?>
<style>
.affix {position:fixed; top:0px; width:95.6%;z-index:10000;}
</style>
<?php if(isset($suhosinInfo)):?>
<div class='alert alert-info'><?php echo $suhosinInfo?></div>
<?php else:?>
<form target='hiddenwin' method='post' class='form-condensed'>
<table class='table table-fixed active-disabled table-custom'>
<thead>
<tr>
<th class='w-70px'><?php echo $lang->testcase->id?></th>
<th><?php echo $lang->testcase->title?></th>
<th class='w-100px'><?php echo $lang->testcase->module?></th>
<th class='w-70px'><?php echo $lang->testcase->pri?></th>
<th class='w-100px'><?php echo $lang->testcase->type?></th>
<th class='w-100px'><?php echo $lang->testcase->status?></th>
<th><?php echo $lang->testcase->stage?></th>
<th class='w-80px'><?php echo $lang->testcase->keywords?></th>
<th><?php echo $lang->testcase->precondition?></th>
<th class='w-300px'>
<table class='w-p100 table-borderless'>
<tr>
<th><?php echo $lang->testcase->stepDesc?></th>
<th><?php echo $lang->testcase->stepExpect?></th>
</tr>
</table>
</th>
</tr>
</thead>
<tbody>
<?php $insert = true;?>
<?php foreach($caseData as $key => $case):?>
<?php if(empty($case->title)) continue;?>
<?php if(!empty($case->id) and !isset($cases[$case->id])) $case->id = 0;?>
<tr valign='top' align='center'>
<td>
<?php
if(!empty($case->id))
{
echo $case->id . html::hidden("id[$key]", $case->id);
$insert = false;
}
else
{
echo $key . " <sub class='gray' style='vertical-align:sub;'>{$lang->testcase->new}</sub>";
}
echo html::hidden("lib[$key]", $libID);
?>
</td>
<td><?php echo html::input("title[$key]", $case->title, "class='form-control' style='margin-top:2px' autocomplete='off'")?></td>
<td class='text-left' style='overflow:visible'><?php echo html::select("module[$key]", $modules, isset($case->module) ? $case->module : (!empty($case->id) ? $cases[$case->id]->module : ''), "class='form-control chosen'")?></td>
<td><?php echo html::select("pri[$key]", $lang->testcase->priList, isset($case->pri) ? $case->pri : (!empty($case->id) ? $cases[$case->id]->pri : ''), "class='form-control'")?></td>
<td><?php echo html::select("type[$key]", $lang->testcase->typeList, isset($case->type) ? $case->type : (!empty($case->id) ? $cases[$case->id]->type : ''), "class='form-control'")?></td>
<td><?php echo html::select("status[$key]", $lang->testcase->statusList, isset($case->status) ? $case->status : (!empty($case->id) ? $cases[$case->id]->status : 'normal'), "class='form-control'")?></td>
<td class='text-left' style='overflow:visible'><?php echo html::select("stage[$key][]", $lang->testcase->stageList, !empty($case->stage) ? $case->stage : (!empty($case->id) ? $cases[$case->id]->stage : ''), "multiple='multiple' class='form-control chosen'")?></td>
<td><?php echo html::input("keywords[$key]", isset($case->keywords) ? $case->keywords : "", "class='form-control' autocomplete='off'")?></td>
<td><?php echo html::textarea("precondition[$key]", isset($case->precondition) ? htmlspecialchars($case->precondition) : "", "class='form-control'")?></td>
<td>
<?php if(isset($stepData[$key]['desc'])):?>
<table class='w-p100 bd-0'>
<?php foreach($stepData[$key]['desc'] as $id => $desc):?>
<?php if(empty($desc['content'])) continue;?>
<tr class='step'>
<td><?php echo $id . html::hidden("stepType[$key][$id]", $desc['type'])?></td>
<td><?php echo html::textarea("desc[$key][$id]", htmlspecialchars($desc['content']), "class='form-control'")?></td>
<td><?php if($desc['type'] != 'group') echo html::textarea("expect[$key][$id]", isset($stepData[$key]['expect'][$id]['content']) ? htmlspecialchars($stepData[$key]['expect'][$id]['content']) : '', "class='form-control'")?></td>
</tr>
<?php endforeach;?>
</table>
<?php endif;?>
</td>
</tr>
<?php endforeach;?>
</tbody>
<tfoot>
<tr>
<td colspan='10' class='text-center'>
<?php
if(!$insert)
{
include '../../common/view/noticeimport.html.php';
echo "<button type='button' data-toggle='myModal' class='btn btn-primary'>{$lang->save}</button>";
}
else
{
echo html::submitButton();
}
echo ' &nbsp; ' . html::backButton()
?>
</td>
</tr>
</tfoot>
</table>
</form>
<?php endif;?>
<script>
$(function(){affix('thead')})
function affix(obj)
{
var fixH = $(obj).offset().top;
var first = true;
$(window).scroll(function()
{
var scroH = $(this).scrollTop();
if(scroH>=fixH && first)
{
$(obj).parent().parent().before("<table id='headerClone' class='table'></table>");
$('#headerClone').append($(obj).clone()).addClass('affix');
$('.active-disabled ' + obj + ' th').each(function(i){$('#headerClone ' + obj + ' th').eq(i).width($(this).width())});
first = false;
}
else if(scroH<fixH)
{
$("#headerClone").remove();
first = true;
}
});
}
</script>
<?php include '../../common/view/footer.html.php';?>
+1 -1
View File
@@ -39,7 +39,7 @@ $lang->testtask->testing = "Testing Build";
$lang->testtask->blocked = "Blocked Build";
$lang->testtask->done = "Tested Build";
$lang->testtask->totalStatus = "All";
$lang->testtask->all = "All Product";
$lang->testtask->all = "All " . $lang->productCommon;
$lang->testtask->id = 'ID';
$lang->testtask->common = 'Test build';
+1 -1
View File
@@ -39,7 +39,7 @@ $lang->testtask->testing = "测试中版本";
$lang->testtask->blocked = "被阻塞版本";
$lang->testtask->done = "已测版本";
$lang->testtask->totalStatus = "全部";
$lang->testtask->all = "全部产品";
$lang->testtask->all = "全部" . $lang->productCommon;
$lang->testtask->id = '编号';
$lang->testtask->common = '测试版本';
+1 -1
View File
@@ -319,7 +319,7 @@ class treeModel extends model
}
else
{
$branches = array($branch => '');
$branches = array();
}
$manage = $userFunc[1] == 'createManageLink' ? true : false;
+27
View File
@@ -0,0 +1,27 @@
function redirect(ranzhiURL, ranzhiCode)
{
var notInIframe = (self == parent);
var entryUrl = encodeURIComponent(window.location.href);
if(notInIframe) location.href = ranzhiURL + '/sys/index.php?entryID=' + ranzhiCode + '&entryUrl=' + entryUrl;
}
function setOuterBox()
{
var side = $('#wrap .outer > .side');
var resetOuterHeight = function()
{
var sideH = side.length ? (side.outerHeight() + $('#featurebar').outerHeight() + 20) : 0;
var height = Math.max(sideH, $(window).height() - $('#header').outerHeight() || 0) - 20;
if(navigator.userAgent.indexOf("MSIE 8.0") >= 0) height -= 40;
$('#wrap .outer').css('min-height', height);
}
side.resize(resetOuterHeight);
$(window).resize(resetOuterHeight);
resetOuterHeight();
}
$(function()
{
$('#searchbox').css('right', $('#topnav').width() - 20);
})
+23 -1
View File
@@ -543,7 +543,29 @@ function setFormAction(actionLink, hiddenwin, obj)
if(hiddenwin) $form.attr('target', hiddenwin);
else $form.removeAttr('target');
$form.attr('action', actionLink).submit();
$form.attr('action', actionLink);
// Check safari is for bug #1000, see http://pms.zentao.net/bug-view-1000.html
var isSafari = navigator.userAgent.indexOf('AppleWebKit') > -1;
if(isSafari)
{
var idPreffix = 'checkbox-fix-' + $.zui.uuid();
$form.find('input[type="checkbox"]').each(function()
{
var $checkbox = $(this);
var checkboxId = idPreffix + $checkbox.val();
$checkbox.attr('data-fix-checkbox', checkboxId).after('<div id="' + checkboxId + '"/>').appendTo($form);
});
}
$form.submit();
if(isSafari)
{
$form.find('[data-fix-checkbox]').each(function()
{
var $checkbox = $(this);
$('#' + $checkbox.data('fixCheckbox')).after($checkbox).remove();
});
}
}
/**
+11
View File
@@ -0,0 +1,11 @@
body{padding-bottom:0px;}
#header{padding-top:0px;}
#mainmenu{margin-top:0px;margin-left:-20px;}
#mainmenu .nav li a{height:40px; line-height:25px;}
#searchbox{top:8px;right:50px}
#topnav{position: absolute; top:6px;right: -35px}
#topnav > a {display:none;}
#topnav > .dropdown{display:none;}
#topnav > a:first-of-type {display:block;}
#topnav > #userMenu{display:block;}
#footer{display:none;}