* rename importlib to importfromlib.

This commit is contained in:
wangyidong
2017-03-17 13:15:47 +08:00
parent 9851ec8a11
commit cc5386b162
14 changed files with 91 additions and 93 deletions
+1 -1
View File
@@ -258,7 +258,7 @@ $lang->testcase->menu = new stdclass();
$lang->testcase->menu->product = array('link' => '%s', 'fixed' => true);
$lang->testcase->menu->bug = array('link' => 'Bug|bug|browse|productID=%s');
$lang->testcase->menu->testcase = array('link' => 'Case|testcase|browse|productID=%s', 'alias' => 'view,create,batchcreate,edit,batchedit,showimport,groupcase', 'subModule' => 'tree');
$lang->testcase->menu->testcase = array('link' => 'Case|testcase|browse|productID=%s', 'alias' => 'view,create,batchcreate,edit,batchedit,showimport,groupcase,importfromlib', 'subModule' => 'tree');
$lang->testcase->menu->testtask = array('link' => 'Build|testtask|browse|productID=%s', 'alias' => 'view,create,edit,linkcase,cases,start,close,batchrun,groupcase');
$lang->testcase->menu->testsuite = array('link' => 'Suite|testsuite|browse|productID=%s', 'alias' => 'view,create,edit,linkcase');
$lang->testcase->menu->report = array('link' => 'Report|testreport|browse|productID=%s', 'alias' => 'view,create');
+1 -1
View File
@@ -258,7 +258,7 @@ $lang->testcase->menu = new stdclass();
$lang->testcase->menu->product = array('link' => '%s', 'fixed' => true);
$lang->testcase->menu->bug = array('link' => 'Bug|bug|browse|productID=%s');
$lang->testcase->menu->testcase = array('link' => '用例|testcase|browse|productID=%s', 'alias' => 'view,create,batchcreate,edit,batchedit,showimport,groupcase,importlib,report', 'subModule' => 'tree');
$lang->testcase->menu->testcase = array('link' => '用例|testcase|browse|productID=%s', 'alias' => 'view,create,batchcreate,edit,batchedit,showimport,groupcase,importfromlib', 'subModule' => 'tree');
$lang->testcase->menu->testtask = array('link' => '版本|testtask|browse|productID=%s', 'alias' => 'view,create,edit,linkcase,cases,start,close,batchrun,groupcase');
$lang->testcase->menu->testsuite = array('link' => '套件|testsuite|browse|productID=%s', 'alias' => 'view,create,edit,linkcase');
$lang->testcase->menu->report = array('link' => '报告|testreport|browse|productID=%s', 'alias' => 'view,create');
+3 -3
View File
@@ -520,7 +520,7 @@ $lang->resource->testcase->report = 'reportChart';
$lang->resource->testcase->review = 'review';
$lang->resource->testcase->batchReview = 'batchReview';
$lang->resource->testcase->batchStoryChange = 'batchStoryChange';
$lang->resource->testcase->importLib = 'importLib';
$lang->resource->testcase->importFromLib = 'importFromLib';
$lang->testcase->methodOrder[0] = 'index';
$lang->testcase->methodOrder[5] = 'browse';
@@ -544,7 +544,7 @@ $lang->testcase->methodOrder[90] = 'report';
$lang->testcase->methodOrder[95] = 'review';
$lang->testcase->methodOrder[100] = 'batchReview';
$lang->testcase->methodOrder[105] = 'batchStoryChange';
$lang->testcase->methodOrder[110] = 'importLib';
$lang->testcase->methodOrder[110] = 'importFromLib';
/* Test task. */
$lang->resource->testtask = new stdclass();
@@ -1266,7 +1266,7 @@ $lang->changelog['9.1'][] = 'testcase-report';
$lang->changelog['9.1'][] = 'testcase-review';
$lang->changelog['9.1'][] = 'testcase-batchReview';
$lang->changelog['9.1'][] = 'testcase-batchStoryChange';
$lang->changelog['9.1'][] = 'testcase-importLib';
$lang->changelog['9.1'][] = 'testcase-importFromLib';
$lang->changelog['9.1'][] = 'testreport-browse';
$lang->changelog['9.1'][] = 'testreport-create';
$lang->changelog['9.1'][] = 'testreport-view';
+52 -60
View File
@@ -1346,6 +1346,58 @@ class testcase extends control
$this->display();
}
/**
* Import case from lib.
*
* @param int $productID
* @param int $branch
* @param int $libID
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function importFromLib($productID, $branch = 0, $libID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
if($_POST)
{
$this->testcase->importFromLib($productID);
die(js::reload('parent'));
}
$this->testcase->setMenu($this->products, $productID, $branch);
$libraries = $this->loadModel('testsuite')->getLibraries();
if(empty($libraries))
{
echo js::alert($this->lang->testcase->noLibrary);
die(js::locate(inlink('browse')));
}
if(empty($libID) or !isset($libraries[$libID])) $libID = key($libraries);
/* Load pager. */
$this->app->loadClass('pager', $static = true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$this->view->title = $this->lang->testcase->common . $this->lang->colon . $this->lang->testcase->importFromLib;
$this->view->position[] = $this->lang->testcase->importFromLib;
$this->view->libraries = $libraries;
$this->view->libID = $libID;
$this->view->productID = $productID;
$this->view->branch = $branch;
$this->view->cases = $this->testsuite->getNotImportedCases($productID, $libID, $orderBy, $pager);
$this->view->modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, $branch);
$this->view->libModules = $this->tree->getOptionMenu($libID, 'caselib');
$this->view->pager = $pager;
$this->view->orderBy = $orderBy;
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
$this->display();
}
/**
* Show import data
*
@@ -1520,64 +1572,4 @@ class testcase extends control
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}
/**
* Import case from lib.
*
* @param int $productID
* @param int $branch
* @param int $libID
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function importLib($productID, $branch = 0, $libID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
if($_POST)
{
$this->testcase->importLib($productID);
die(js::reload('parent'));
}
$this->testcase->setMenu($this->products, $productID, $branch);
$libraries = $this->loadModel('testsuite')->getLibraries();
if(empty($libraries))
{
echo js::alert($this->lang->testcase->noLibrary);
die(js::locate(inlink('browse')));
}
if(empty($libID) or !isset($libraries[$libID])) $libID = key($libraries);
/* Load pager. */
$this->app->loadClass('pager', $static = true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, $branch);
$libName = $libraries[$libID];
$libModules = $this->tree->getOptionMenu($libID, 'caselib');
foreach($libModules as $moduleID => $moduleName)
{
if($moduleID == 0) continue;
$modules[$moduleID] = $libName . $moduleName;
}
$this->view->title = $this->lang->testcase->common . $this->lang->colon . $this->lang->testcase->importFromLib;
$this->view->position[] = $this->lang->testcase->importFromLib;
$this->view->libraries = $libraries;
$this->view->libID = $libID;
$this->view->productID = $productID;
$this->view->branch = $branch;
$this->view->cases = $this->testsuite->getNotImportedCases($productID, $libID, $orderBy, $pager);
$this->view->modules = $modules;
$this->view->pager = $pager;
$this->view->orderBy = $orderBy;
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
$this->display();
}
}
@@ -1,2 +1,2 @@
#titlebar .input-group {position: relative; top: -6px; margin-left: 10px; width: 300px;}
#titlebar .input-group {position: relative; top: -6px; width: 350px;}
#titlebar .input-group-addon, #titlebar .form-control {font-size: 12px; padding: 5px 10px; line-height: 18px; height: 30px}
@@ -1,6 +1,6 @@
function reload(libID)
{
link = createLink('testcase','importLib','productID='+ productID + '&branch=' + branch + '&libID='+libID);
link = createLink('testcase','importFromLib','productID='+ productID + '&branch=' + branch + '&libID='+libID);
location.href = link;
}
$(function()
+4 -4
View File
@@ -56,6 +56,7 @@ $lang->testcase->resultsAB = 'R';
$lang->testcase->stepNumber = '用例步骤数';
$lang->testcase->stepNumberAB = 'S';
$lang->testcase->createBug = '转Bug';
$lang->testcase->fromModule = '来源模块';
$lang->case = $lang->testcase; // 用于DAO检查时使用。因为case是系统关键字,所以无法定义该模块为case,只能使用testcase,但表还是使用的case。
$lang->testcase->stepID = '编号';
@@ -70,7 +71,6 @@ $lang->testcase->batchCreate = "批量添加";
$lang->testcase->delete = "删除用例";
$lang->testcase->view = "用例详情";
$lang->testcase->review = "评审";
$lang->testcase->importLib = "从库导入";
$lang->testcase->edit = "编辑";
$lang->testcase->batchEdit = "批量编辑 ";
$lang->testcase->batchChangeModule = "批量修改模块";
@@ -82,7 +82,7 @@ $lang->testcase->browse = "用例列表";
$lang->testcase->groupCase = "分组浏览用例";
$lang->testcase->import = "导入";
$lang->testcase->importFile = "导入CSV";
$lang->testcase->importFromLib = "从库中导入";
$lang->testcase->importFromLib = "用例库中导入";
$lang->testcase->showImport = "显示导入内容";
$lang->testcase->exportTemplet = "导出模板";
$lang->testcase->export = "导出数据";
@@ -181,11 +181,11 @@ $lang->testcase->action->fromlib = array('main' => '$date, 由 <strong>$actor</
$lang->testcase->action->reviewed = array('main' => '$date, 由 <strong>$actor</strong> 记录评审结果,结果为 <strong>$extra</strong>。', 'extra' => 'reviewResultList');
$lang->testcase->featureBar['browse']['all'] = $lang->testcase->allCases;
$lang->testcase->featureBar['browse']['needconfirm'] = $lang->testcase->needConfirm;
$lang->testcase->featureBar['browse']['wait'] = '待评审';
$lang->testcase->featureBar['browse']['needconfirm'] = $lang->testcase->needConfirm;
$lang->testcase->featureBar['browse']['group'] = '分组查看';
$lang->testcase->featureBar['browse']['zerocase'] = '零用例需求';
$lang->testcase->featureBar['browse']['suite'] = '套件';
$lang->testcase->featureBar['browse']['zerocase'] = '零用例需求';
$lang->testcase->featureBar['groupcase'] = $lang->testcase->featureBar['browse'];
/* 统计报表。*/
+3 -1
View File
@@ -1080,7 +1080,7 @@ class testcaseModel extends model
* @access public
* @return void
*/
public function importLib($productID)
public function importFromLib($productID)
{
$data = fixer::input('post')->get();
$libCases = $this->dao->select('*')->from(TABLE_CASE)->where('deleted')->eq(0)->andWhere('id')->in($data->caseIdList)->fetchAll('id');
@@ -1092,10 +1092,12 @@ class testcaseModel extends model
if(isset($data->module[$case->id])) $case->module = $data->module[$case->id];
if(isset($data->branch[$case->id])) $case->branch = $data->branch[$case->id];
unset($case->id);
$this->dao->insert(TABLE_CASE)->data($case)
->autoCheck()
->batchCheck($this->config->testcase->create->requiredFields, 'notempty')
->exec();
if(!dao::isError())
{
$caseID = $this->dao->lastInsertID();
+15 -11
View File
@@ -34,35 +34,42 @@
}
elseif($hasBrowsePriv and $menuType == 'suite')
{
echo "<li id='bysuiteTab' class='dropdown'>";
$currentSuiteID = isset($suiteID) ? (int)$suiteID : 0;
$currentSuite = zget($suiteList, $currentSuiteID, '');
$currentName = empty($currentSuite) ? $lang->testsuite->common : $currentSuite->name;
echo html::a('javascript:;', $currentName . " <span class='caret'></span>", '', "data-toggle='dropdown'");
$currentLable = empty($currentSuite) ? $lang->testsuite->common : $currentSuite->name;
echo "<li id='bysuiteTab' class='dropdown'>";
echo html::a('javascript:;', $currentLable . " <span class='caret'></span>", '', "data-toggle='dropdown'");
echo "<ul class='dropdown-menu' style='max-height:240px; overflow-y:auto'>";
foreach ($suiteList as $suiteID => $suite)
{
echo '<li' . ($suiteID == (int)$currentSuiteID ? " class='active'" : '') . '>';
$suiteName = $suite->name;
if($suite->type == 'public') $suiteName .= " <span class='label label-info'>{$lang->testsuite->authorList[$suite->type]}</span>";
echo '<li' . ($suiteID == (int)$currentSuiteID ? " class='active'" : '') . '>';
echo html::a($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=bySuite&param=$suiteID"), $suiteName);
}
echo '</ul></li>';
}
elseif($hasGroupPriv and $menuType == 'group')
{
echo "<li id='groupTab' class='dropdown'>";
$groupBy = isset($groupBy) ? $groupBy : '';
$current = zget($lang->testcase->groups, isset($groupBy) ? $groupBy : '', '');
if(empty($current)) $current = $lang->testcase->groups[''];
echo "<li id='groupTab' class='dropdown'>";
echo html::a('javascript:;', $current . " <span class='caret'></span>", '', "data-toggle='dropdown'");
echo "<ul class='dropdown-menu'>";
foreach ($lang->testcase->groups as $key => $value)
{
if($key == '') continue;
echo '<li' . ($key == $groupBy ? " class='active'" : '') . '>';
echo html::a($this->createLink('testcase', 'groupCase', "productID=$productID&branch=$branch&groupBy=$key"), $value);
}
echo '</ul></li>';
}
elseif($hasZeroPriv and $menuType == 'zerocase')
@@ -95,18 +102,15 @@
</ul>
</div>
<div class='btn-group'>
<button type='button' class='btn btn-default dropdown-toggle' data-toggle='dropdown' id='importAction'>
<i class='icon-upload-alt'></i> <?php echo $lang->import ?>
<span class='caret'></span>
</button>
<button type='button' class='btn btn-default dropdown-toggle' data-toggle='dropdown' id='importAction'><i class='icon-upload-alt'></i> <?php echo $lang->import ?><span class='caret'></span></button>
<ul class='dropdown-menu' id='importActionMenu'>
<?php
$misc = common::hasPriv('testcase', 'import') ? "class='export'" : "class=disabled";
$link = common::hasPriv('testcase', 'import') ? $this->createLink('testcase', 'import', "productID=$productID&branch=$branch") : '#';
echo "<li>" . html::a($link, $lang->testcase->importFile, '', $misc) . "</li>";
$misc = common::hasPriv('testcase', 'importLib') ? '' : "class=disabled";
$link = common::hasPriv('testcase', 'importLib') ? $this->createLink('testcase', 'importLib', "productID=$productID&branch=$branch") : '#';
$misc = common::hasPriv('testcase', 'importFromLib') ? '' : "class=disabled";
$link = common::hasPriv('testcase', 'importFromLib') ? $this->createLink('testcase', 'importFromLib', "productID=$productID&branch=$branch") : '#';
echo "<li>" . html::a($link, $lang->testcase->importFromLib, '', $misc) . "</li>";
?>
</ul>
@@ -1,22 +1,20 @@
<?php
/**
* The importlib view file of testcase module of ZenTaoPMS.
* The importfromlib view file of testcase 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 testcase
* @version $Id: importlib.html.php 4669 2013-04-23 02:28:08Z chencongzhi520@gmail.com $
* @version $Id
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id='titlebar'>
<div class='heading'>
<span class='prefix pull-left'><?php echo html::icon($lang->icons['testcase']);?></span>
<strong class='pull-left'><small class='text-muted'><?php echo html::icon($lang->icons['import']);?></small> <?php echo $lang->testcase->importFromLib;?></strong>
<div class='input-group pull-left' style='font-weight:normal;'>
<span class='input-group-addon'><?php echo $lang->testcase->selectLib;?></span>
<span class='input-group-addon'><strong style='font-size:15px'><?php echo $lang->testcase->selectLib;?></strong></span>
<?php echo html::select('fromlib', $libraries, $libID, "onchange='reload(this.value)' class='form-control chosen'");?>
</div>
</div>
@@ -32,6 +30,7 @@
<?php endif;?>
<th class='w-pri'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th> <?php common::printOrderLink('title', $orderBy, $vars, $lang->testcase->title);?></th>
<th class='w-200px'><?php echo $lang->testcase->fromModule ?></th>
<th class='w-200px'><?php echo $lang->testcase->module ?></th>
<th class='w-100px'><?php common::printOrderLink('type', $orderBy, $vars, $lang->testcase->type)?></th>
</tr>
@@ -48,7 +47,8 @@
<?php endif;?>
<td><span class='<?php echo 'pri' . zget($lang->testcase->priList, $case->pri, $case->pri)?>'><?php echo $case->pri == '0' ? '' : zget($lang->testcase->priList, $case->pri, $case->pri);?></span></td>
<td class='text-left nobr'><?php if(!common::printLink('testcase', 'view', "caseID=$case->id", $case->title)) echo $case->title;?></td>
<td class='text-left' style='overflow:visible'><?php echo html::select("module[{$case->id}]", $modules, $case->module, "class='from-control chosen'");?></th>
<td class='text-left'><?php echo zget($libModules, $case->module, '');?></th>
<td class='text-left' style='overflow:visible'><?php echo html::select("module[{$case->id}]", $modules, 0, "class='from-control chosen'");?></th>
<td><?php echo zget($lang->testcase->typeList, $case->type);?></th>
</tr>
<?php endforeach;?>
+1 -1
View File
@@ -53,7 +53,7 @@
echo $case->title . ' ( ';
for($i = $case->version; $i >= 1; $i --)
{
echo html::a($this->createLink('testcase', 'view', "caseID=$case->id&version=$i"), "#$i", '_blank');
echo html::a($this->createLink('testcase', 'view', "caseID=$case->id&version=$i", '', true), "#$i", '', "class='iframe' data-width='95%'");
}
echo ')';
?>
+1 -1
View File
@@ -91,7 +91,7 @@
<td><span class='<?php echo 'pri' . zget($lang->testcase->priList, $case->pri, $case->pri)?>'><?php echo zget($lang->testcase->priList, $case->pri, $case->pri)?></span></td>
<td class='text-left nobr'>
<?php if($case->branch) echo "<span class='label label-info label-badge'>{$branches[$case->branch]}</span>"?>
<?php echo html::a($this->createLink('testcase', 'view', "caseID=$case->id&version=$case->caseVersion"), $case->title, '_blank');?>
<?php echo html::a($this->createLink('testcase', 'view', "caseID=$case->id&version=$case->caseVersion"), $case->title);?>
</td>
<td><?php echo $lang->testcase->typeList[$case->type];?></td>
<td class='<?php echo $case->status;?>'><?php echo ($case->version < $case->caseVersion) ? "<span class='warning'>{$lang->testcase->changed}</span>" : $lang->testcase->statusList[$case->status];?></td>
+1 -1
View File
@@ -48,7 +48,7 @@
<td><span class='<?php echo 'pri' . zget($lang->testcase->priList, $run->pri, $run->pri)?>'><?php echo zget($lang->testcase->priList, $run->pri, $run->pri)?></span></td>
<td class='text-left nobr'>
<?php if($run->branch) echo "<span class='label label-info label-badge'>{$branches[$run->branch]}</span>"?>
<?php echo html::a($this->createLink('testcase', 'view', "caseID=$run->case&version=$run->version&from=testtask&taskID=$run->task"), $run->title, '_blank');?>
<?php echo html::a($this->createLink('testcase', 'view', "caseID=$run->case&version=$run->version&from=testtask&taskID=$run->task"), $run->title);?>
</td>
<td><?php echo $lang->testcase->typeList[$run->type];?></td>
<td><?php $assignedTo = $users[$run->assignedTo]; echo substr($assignedTo, strpos($assignedTo, ':') + 1);?></td>
+1 -1
View File
@@ -104,7 +104,7 @@
echo $case->title . ' ( ';
for($i = $case->version; $i >= 1; $i --)
{
echo html::a($this->createLink('testcase', 'view', "caseID=$case->id&version=$i"), "#$i", '_blank');
echo html::a($this->createLink('testcase', 'view', "caseID=$case->id&version=$i", '', true), "#$i", '', "class='iframe' data-width='95%'");
}
echo ')';
?>