* Finish task #4434, 4461, 4468, 4471, 4474
This commit is contained in:
+95
-14
@@ -16,21 +16,91 @@ class testcaseModel extends model
|
||||
/**
|
||||
* Set menu.
|
||||
*
|
||||
* @param array $products
|
||||
* @param int $productID
|
||||
* @param array $products
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param int $moduleID
|
||||
* @param int $suiteID
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setMenu($products, $productID, $branch = 0, $moduleID = 0, $suiteID = 0)
|
||||
public function setMenu($products, $productID, $branch = 0, $moduleID = 0, $suiteID = 0, $orderBy = 'id_desc')
|
||||
{
|
||||
$this->loadModel('product')->setMenu($products, $productID, $branch, $moduleID, 'case');
|
||||
$selectHtml = $this->product->select($products, $productID, 'testcase', 'browse', '', $branch, $moduleID, 'case');
|
||||
|
||||
$this->app->loadLang('qa');
|
||||
$productIndex = '<div class="btn-group angle-btn"><div class="btn-group">' . html::a(helper::createLink('qa', 'index', 'locate=no'), $this->lang->qa->index, '', "class='btn'") . '</div></div>';
|
||||
$productIndex .= $selectHtml;
|
||||
$pageNav = '';
|
||||
$pageActions = '';
|
||||
if($this->config->global->flow == 'full')
|
||||
{
|
||||
$this->app->loadLang('qa');
|
||||
$pageNav = '<div class="btn-group angle-btn"><div class="btn-group">' . html::a(helper::createLink('qa', 'index', 'locate=no'), $this->lang->qa->index, '', "class='btn'") . '</div></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$exportPriv = common::hasPriv('testcase', 'export');
|
||||
$exportTempletPriv = common::hasPriv('testcase', 'exportTemplet');
|
||||
$importPriv = common::hasPriv('testcase', 'import');
|
||||
$importFromLibPriv = common::hasPriv('testcase', 'importFromLib');
|
||||
if($exportPriv or $exportTempletPriv)
|
||||
{
|
||||
$pageActions .= "<div class='btn-group'>";
|
||||
$pageActions .= "<button type='button' class='btn btn-link dropdown-toggle' data-toggle='dropdown'>";
|
||||
$pageActions .= "<i class='icon icon-export muted'></i> {$this->lang->export}";
|
||||
$pageActions .= "<span class='caret'></span>";
|
||||
$pageActions .= '</button>';
|
||||
$pageActions .= "<ul class='dropdown-menu' id='exportActionMenu'>";
|
||||
if($exportPriv)
|
||||
{
|
||||
$link = helper::createLink('testcase', 'export', "productID=$productID&orderBy=$orderBy");
|
||||
$pageActions .= '<li>' . html::a($link, $this->lang->testcase->export, '', "class='export'") . '</li>';
|
||||
}
|
||||
if($exportTempletPriv)
|
||||
{
|
||||
$link = helper::createLink('testcase', 'exportTemplet', "productID=$productID");
|
||||
$pageActions .= '<li>' . html::a($link, $this->lang->testcase->exportTemplet, '', "class='export'") . '</li>';
|
||||
}
|
||||
$pageActions .= '</ul>';
|
||||
$pageActions .= '</div>';
|
||||
|
||||
$this->lang->modulePageNav = $productIndex;
|
||||
}
|
||||
if($importPriv or $importFromLibPriv)
|
||||
{
|
||||
$pageActions .= "<div class='btn-group'>";
|
||||
$pageActions .= "<button type='button' class='btn btn-link dropdown-toggle' data-toggle='dropdown' id='importAction'><i class='icon icon-import muted'></i> {$this->lang->import}<span class='caret'></span></button>";
|
||||
$pageActions .= "<ul class='dropdown-menu' id='importActionMenu'>";
|
||||
if($importPriv)
|
||||
{
|
||||
$link = helper::createLink('testcase', 'import', "productID=$productID&branch=$branch");
|
||||
$pageActions .= '<li>' . html::a($link, $this->lang->testcase->importFile, '', "class='export'") . '</li>';
|
||||
}
|
||||
if($importFromLibPriv)
|
||||
{
|
||||
$link = helper::createLink('testcase', 'importFromLib', "productID=$productID&branch=$branch");
|
||||
$pageActions .= '<li>' . html::a($link, $this->lang->testcase->importFromLib) . '</li>';
|
||||
}
|
||||
$pageActions .= '</ul>';
|
||||
$pageActions .= '</div>';
|
||||
}
|
||||
$initModule = isset($moduleID) ? (int)$moduleID : 0;
|
||||
|
||||
if(common::hasPriv('testcase', 'batchCreate'))
|
||||
{
|
||||
$link = helper::createLink('testcase', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$initModule");
|
||||
$pageActions .= html::a($link, "<i class='icon-plus'></i> " . $this->lang->testcase->batchCreate, '', "class='btn btn-secondary'");
|
||||
}
|
||||
|
||||
if(common::hasPriv('testcase', 'create'))
|
||||
{
|
||||
$link = helper::createLink('testcase', 'create', "productID=$productID&branch=$branch&moduleID=$initModule");
|
||||
$pageActions .= html::a($link, "<i class='icon-plus'></i> " . $this->lang->testcase->create, '', "class='btn btn-primary'");
|
||||
}
|
||||
}
|
||||
$pageNav .= $selectHtml;
|
||||
|
||||
$this->lang->modulePageNav = $pageNav;
|
||||
$this->lang->modulePageActions = $pageActions;
|
||||
foreach($this->lang->testcase->menu as $key => $menu)
|
||||
{
|
||||
if($this->config->global->flow != 'onlyTest')
|
||||
@@ -46,18 +116,28 @@ class testcaseModel extends model
|
||||
$currentSuite = zget($suiteList, $currentSuiteID, '');
|
||||
$currentLable = empty($currentSuite) ? $this->lang->testsuite->common : $currentSuite->name;
|
||||
|
||||
$replace = "<li id='bysuiteTab' class='dropdown'>";
|
||||
$replace = "<li id='bysuiteTab' class='dropdown' data-id='bysuite'>";
|
||||
$replace .= html::a('javascript:;', $currentLable . " <span class='caret'></span>", '', "data-toggle='dropdown'");
|
||||
$replace .="<ul class='dropdown-menu' style='max-height:240px; overflow-y:auto'>";
|
||||
|
||||
foreach ($suiteList as $suiteID => $suite)
|
||||
if($suiteList)
|
||||
{
|
||||
$suiteName = $suite->name;
|
||||
if($suite->type == 'public') $suiteName .= " <span class='label label-info'>{$this->lang->testsuite->authorList[$suite->type]}</span>";
|
||||
foreach($suiteList as $suiteID => $suite)
|
||||
{
|
||||
$suiteName = $suite->name;
|
||||
if($suite->type == 'public') $suiteName .= " <span class='label label-info'>{$this->lang->testsuite->authorList[$suite->type]}</span>";
|
||||
|
||||
$replace .= '<li' . ($suiteID == (int)$currentSuiteID ? " class='active'" : '') . '>';
|
||||
$replace .= html::a(helper::createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=bySuite¶m=$suiteID"), $suiteName);
|
||||
$replace .= "</li>";
|
||||
$replace .= '<li' . ($suiteID == (int)$currentSuiteID ? " class='active'" : '') . '>';
|
||||
$replace .= html::a(helper::createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=bySuite¶m=$suiteID"), $suiteName);
|
||||
$replace .= "</li>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(common::hasPriv('testsuite', 'create'))
|
||||
{
|
||||
$replace .= '<li>' . html::a(helper::createLink('testsuite', 'create', "productID=$productID"), $this->lang->testsuite->create) . '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
$replace .= '</ul></li>';
|
||||
@@ -71,6 +151,7 @@ class testcaseModel extends model
|
||||
}
|
||||
common::setMenuVars($this->lang->testcase->menu, $key, $replace);
|
||||
}
|
||||
if($this->config->global->flow != 'full' && $this->app->getMethodName() != 'view') $this->lang->testcase->menu->bysearch = "<a class='querybox-toggle' id='bysearchTab'><i class='icon icon-search muted'> </i>{$this->lang->testcase->bySearch}</a>";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user