diff --git a/module/product/control.php b/module/product/control.php
index 614d716a61..d1c19ad5ae 100644
--- a/module/product/control.php
+++ b/module/product/control.php
@@ -143,8 +143,10 @@ class product extends control
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'story');
/* Build search form. */
+ $this->config->product->search['style'] = 'shortcut';
$actionURL = $this->createLink('product', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID");
$this->product->buildSearchForm($productID, $this->products, $queryID, $actionURL);
+ $this->loadModel('search')->mergeFeatureBar('product', 'browse');
$showModule = !empty($this->config->datatable->productbrowse->showModule) ? $this->config->datatable->productbrowse->showModule : '';
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'story', $showModule) : array();
@@ -172,6 +174,7 @@ class product extends control
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
$this->view->storyStages = $this->product->batchGetStoryStage($stories);
$this->view->setShowModule = true;
+ $this->view->param = $param;
$this->display();
}
diff --git a/module/product/model.php b/module/product/model.php
index 1b1ee0714f..f49732f950 100644
--- a/module/product/model.php
+++ b/module/product/model.php
@@ -367,7 +367,7 @@ class productModel extends model
/* Set modules and browse type. */
$modules = $moduleID ? $this->loadModel('tree')->getAllChildID($moduleID) : '0';
- $browseType = (($browseType == 'bymodule') and ($this->session->storyBrowseType) and ($this->session->storyBrowseType != 'bysearch')) ? $this->session->storyBrowseType : $browseType;
+ $browseType = ($browseType == 'bymodule' and $this->session->storyBrowseType and $this->session->storyBrowseType != 'bysearch') ? $this->session->storyBrowseType : $browseType;
/* Get stories by browseType. */
$stories = array();
diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php
index 2d2f202710..5a9fe6dcec 100644
--- a/module/product/view/browse.html.php
+++ b/module/product/view/browse.html.php
@@ -30,7 +30,12 @@
customMenu['featurebar'] as $type => $featurebar):?>
+
+
+
inlink('browse', "productID=$productID&branch=$branch&browseType=bySearch¶m=$queryID"), $featurebar['link']);?>
+
inlink('browse', "productID=$productID&branch=$branch&browseType=$type"), $featurebar['link']);?>
+
product->searchStory;?>
@@ -79,7 +84,7 @@
moduleName . $this->methodName;
$useDatatable = (isset($this->config->datatable->$datatableId->mode) and $this->config->datatable->$datatableId->mode == 'datatable');
- $vars = "productID=$productID&branch=$branch&browseType=$browseType¶m=$moduleID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
+ $vars = "productID=$productID&branch=$branch&browseType=$browseType¶m=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
include $useDatatable ? dirname(__FILE__) . '/datatabledata.html.php' : dirname(__FILE__) . '/browsedata.html.php';
?>
@@ -254,7 +259,16 @@
diff --git a/module/testcase/control.php b/module/testcase/control.php
index e0245c59bd..df2232e667 100644
--- a/module/testcase/control.php
+++ b/module/testcase/control.php
@@ -95,8 +95,10 @@ class testcase extends control
$cases = $this->loadModel('story')->checkNeedConfirm($cases);
/* Build the search form. */
+ $this->config->testcase->search['style'] = 'shortcut';
$actionURL = $this->createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID");
$this->testcase->buildSearchForm($productID, $this->products, $queryID, $actionURL);
+ $this->loadModel('search')->mergeFeatureBar('testcase', 'browse');
$showModule = !empty($this->config->datatable->testcasebrowse->showModule) ? $this->config->datatable->testcasebrowse->showModule : '';
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'case', $showModule) : array();
diff --git a/module/testcase/js/browse.js b/module/testcase/js/browse.js
index 7b67fdf9ff..9bc4c3fc8c 100644
--- a/module/testcase/js/browse.js
+++ b/module/testcase/js/browse.js
@@ -23,8 +23,6 @@ function confirmBatchDelete(actionLink)
$(document).ready(function()
{
- $('#' + caseBrowseType + 'Tab').addClass('active');
- $('#module' + moduleID).addClass('active');
if(browseType == 'bysearch') ajaxGetSearchForm();
setTimeout(function(){fixedTfootAction('#batchForm')}, 100);
setTimeout(function(){fixedTheadOfList('#caseList')}, 100);
diff --git a/module/testcase/model.php b/module/testcase/model.php
index 28094d8c79..0c68609672 100644
--- a/module/testcase/model.php
+++ b/module/testcase/model.php
@@ -262,7 +262,7 @@ class testcaseModel extends model
{
/* Set modules and browse type. */
$modules = $moduleID ? $this->loadModel('tree')->getAllChildId($moduleID) : '0';
- $browseType = (($browseType == 'bymodule') and ($this->session->caseBrowseType) and ($this->session->caseBrowseType != 'bysearch')) ? $this->session->caseBrowseType : $browseType;
+ $browseType = ($browseType == 'bymodule' and $this->session->caseBrowseType and $this->session->caseBrowseType != 'bysearch') ? $this->session->caseBrowseType : $browseType;
/* By module or all cases. */
$cases = array();
diff --git a/module/testcase/view/browse.html.php b/module/testcase/view/browse.html.php
index f7a4f1ba20..ba4206eaae 100644
--- a/module/testcase/view/browse.html.php
+++ b/module/testcase/view/browse.html.php
@@ -16,7 +16,7 @@ include '../../common/view/datepicker.html.php';
include '../../common/view/datatable.fix.html.php';
include './caseheader.html.php';
js::set('browseType', $browseType);
-js::set('caseBrowseType', $this->session->caseBrowseType);
+js::set('caseBrowseType', ($browseType == 'bymodule' and $this->session->caseBrowseType == 'bysearch') ? 'all' : $this->session->caseBrowseType);
js::set('moduleID' , $moduleID);
js::set('confirmDelete', $lang->testcase->confirmDelete);
js::set('batchDelete', $lang->testcase->confirmBatchDelete);
@@ -98,4 +98,17 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
+
diff --git a/module/testcase/view/caseheader.html.php b/module/testcase/view/caseheader.html.php
index bb10d7233e..c95601d3b1 100644
--- a/module/testcase/view/caseheader.html.php
+++ b/module/testcase/view/caseheader.html.php
@@ -1,12 +1,11 @@
-
-
lang->tree->all;
+ if(!empty($moduleID))
{
$removeLink = $browseType == 'bymodule' ? inlink('browse', "productID=$productID&branch=$branch&browseType=$browseType¶m=0&orderBy=$orderBy&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("caseModule")';
echo ' ' . html::a($removeLink, "") . ' ';
@@ -15,15 +14,24 @@
?>
-
+
customMenu['featurebar'] as $type => $featurebar):?>
" . html::a($this->createLink('testcase', 'browse', "productid=$productID&branch=$branch&browseType=bySearch¶m=$queryID"), $featurebar['link']) . "";
+ }
+ elseif($hasBrowsePriv and ($type == 'all' or $type == 'needconfirm'))
{
echo "- " . html::a($this->createLink('testcase', 'browse', "productid=$productID&branch=$branch&browseType=$type"), $featurebar['link']) . "
";
}
- elseif($type == 'group' and common::hasPriv('testcase', 'groupcase'))
+ elseif($hasGroupPriv and $type == 'group')
{
echo "- ";
$groupBy = isset($groupBy) ? $groupBy : '';
@@ -39,7 +47,7 @@
}
echo '
';
}
- elseif($type == 'zerocase' and common::hasPriv('story', 'zeroCase'))
+ elseif($hasZeroPriv and $type == 'zerocase')
{
echo "
" . html::a($this->createLink('story', 'zeroCase', "productID=$productID"), $lang->story->zeroCase) . '';
}
diff --git a/module/testtask/control.php b/module/testtask/control.php
index 01dc4e72da..0f8e653d0a 100644
--- a/module/testtask/control.php
+++ b/module/testtask/control.php
@@ -230,7 +230,11 @@ class testtask extends control
$pager = pager::init($recTotal, $recPerPage, $pageID);
/* Set the browseType and moduleID. */
$browseType = strtolower($browseType);
- $moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
+
+ if($browseType == 'bymodule') setcookie('taskCaseModule', (int)$param, $this->config->cookieLife, $this->config->webRoot);
+ if($browseType != 'bymodule') $this->session->set('taskCaseBrowseType', $browseType);
+
+ $moduleID = ($browseType == 'bymodule') ? (int)$param : ($browseType == 'bysearch' ? 0 : ($this->cookie->taskCaseModule ? $this->cookie->taskCaseModule : 0));
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
/* Append id for secend sort. */
@@ -241,58 +245,9 @@ class testtask extends control
if(!$task) die(js::error($this->lang->notFound) . js::locate('back'));
$productID = $task->product;
$this->testtask->setMenu($this->products, $productID, $task->branch);
- if($browseType == 'bymodule' or $browseType == 'all')
- {
- $modules = '';
- if($moduleID) $modules = $this->loadModel('tree')->getAllChildID($moduleID);
- $this->view->runs = $this->testtask->getRuns($taskID, $modules, $sort, $pager);
- }
- elseif($browseType == 'assignedtome')
- {
- $this->view->runs = $this->testtask->getUserRuns($taskID, $this->session->user->account, $sort, $pager);
- }
- /* By search. */
- elseif($browseType == 'bysearch')
- {
- if($queryID)
- {
- $query = $this->loadModel('search')->getQuery($queryID);
- if($query)
- {
- $this->session->set('testcaseQuery', $query->sql);
- $this->session->set('testcaseForm', $query->form);
- }
- else
- {
- $this->session->set('testcaseQuery', ' 1 = 1');
- }
- }
- else
- {
- if($this->session->testcaseQuery == false) $this->session->set('testcaseQuery', ' 1 = 1');
- }
- $queryProductID = $productID;
- $allProduct = "`product` = 'all'";
- $caseQuery = $this->session->testcaseQuery;
- if(strpos($this->session->testcaseQuery, $allProduct) !== false)
- {
- $products = array_keys($this->loadModel('product')->getPrivProducts());
- $caseQuery = str_replace($allProduct, '1', $this->session->testcaseQuery);
- $caseQuery = $caseQuery . ' AND `product`' . helper::dbIN(array_keys($products));
- $queryProductID = 'all';
- }
-
- $caseQuery = preg_replace('/`(\w+)`/', 't2.`$1`', $caseQuery);
- $this->view->runs = $this->dao->select('t2.*,t1.*, t2.version as caseVersion')->from(TABLE_TESTRUN)->alias('t1')
- ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
- ->where($caseQuery)
- ->andWhere('t1.task')->eq($taskID)
- ->beginIF($task->branch)->andWhere('t2.branch')->in("0,{$task->branch}")->fi()
- ->orderBy(strpos($sort, 'assignedTo') !== false ? ('t1.' . $sort) : ('t2.' . $sort))
- ->page($pager)
- ->fetchAll();
- }
+ /* Get test cases. */
+ $this->view->runs = $this->testtask->getTaskCases($productID, $browseType, $queryID, $moduleID, $sort, $pager, $task);
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false);
/* Save testcaseIDs session for get the pre and next testcase. */
@@ -302,12 +257,15 @@ class testtask extends control
/* Build the search form. */
$this->loadModel('testcase');
- $this->config->testcase->search['params']['product']['values']= array($productID => $this->products[$productID], 'all' => $this->lang->testcase->allProduct);
- $this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case');
+ $this->config->testcase->search['style'] = 'shortcut';
+ $this->config->testcase->search['module'] = 'testtask';
+ $this->config->testcase->search['params']['product']['values'] = array($productID => $this->products[$productID], 'all' => $this->lang->testcase->allProduct);
+ $this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case');
$this->config->testcase->search['actionURL'] = inlink('cases', "taskID=$taskID&browseType=bySearch&queryID=myQueryID");
unset($this->config->testcase->search['fields']['branch']);
unset($this->config->testcase->search['params']['branch']);
$this->loadModel('search')->setSearchParams($this->config->testcase->search);
+ $this->search->mergeFeatureBar('testtask', 'cases');
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases;
$this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]);
@@ -325,6 +283,7 @@ class testtask extends control
$this->view->orderBy = $orderBy;
$this->view->taskID = $taskID;
$this->view->moduleID = $moduleID;
+ $this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
$this->view->treeClass = $browseType == 'bymodule' ? '' : 'hidden';
$this->view->pager = $pager;
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
diff --git a/module/testtask/js/cases.js b/module/testtask/js/cases.js
index 8177f26650..0ca63241c5 100644
--- a/module/testtask/js/cases.js
+++ b/module/testtask/js/cases.js
@@ -1,8 +1,6 @@
$(document).ready(function()
{
setModal4List('runCase', 'caseList', function(){$(".iframe").modalTrigger({width:1024, type:'iframe'});}, 1024);
- $('#' + browseType + 'Tab').addClass('active');
- $('#module' + moduleID).addClass('active');
if(browseType == 'bysearch') ajaxGetSearchForm();
setTimeout(function(){fixedTfootAction('#casesForm')}, 100);
});
diff --git a/module/testtask/model.php b/module/testtask/model.php
index 97789258ac..9854b9d3c5 100644
--- a/module/testtask/model.php
+++ b/module/testtask/model.php
@@ -282,7 +282,7 @@ class testtaskModel extends model
* @access public
* @return array
*/
- public function getUserRuns($taskID, $user, $orderBy, $pager = null)
+ public function getUserRuns($taskID, $user, $modules = '', $orderBy, $pager = null)
{
$orderBy = strpos($orderBy, 'assignedTo') !== false ? ('t1.' . $orderBy) : ('t2.' . $orderBy);
@@ -290,11 +290,77 @@ class testtaskModel extends model
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
->where('t1.task')->eq((int)$taskID)
->andWhere('t1.assignedTo')->eq($user)
+ ->beginIF($modules)->andWhere('t2.module')->in($modules)->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll();
}
+ /**
+ * Get testtask linked cases.
+ *
+ * @param int $productID
+ * @param string $browseType
+ * @param int $queryID
+ * @param int $moduleID
+ * @param string $sort
+ * @param object $pager
+ * @param object $task
+ * @access public
+ * @return array
+ */
+ public function getTaskCases($productID, $browseType, $queryID, $moduleID, $sort, $pager, $task)
+ {
+ /* Set modules and browse type. */
+ $modules = $moduleID ? $this->loadModel('tree')->getAllChildId($moduleID) : '0';
+ $browseType = ($browseType == 'bymodule' and $this->session->taskCaseBrowseType and $this->session->taskCaseBrowseType != 'bysearch') ? $this->session->taskCaseBrowseType : $browseType;
+
+ if($browseType == 'bymodule' or $browseType == 'all')
+ {
+ $runs = $this->getRuns($task->id, $modules, $sort, $pager);
+ }
+ elseif($browseType == 'assignedtome')
+ {
+ $runs = $this->getUserRuns($task->id, $this->session->user->account, $modules, $sort, $pager);
+ }
+ /* By search. */
+ elseif($browseType == 'bysearch')
+ {
+ if($this->session->testtaskQuery == false) $this->session->set('testtaskQuery', ' 1 = 1');
+ if($queryID)
+ {
+ $query = $this->loadModel('search')->getQuery($queryID);
+ if($query)
+ {
+ $this->session->set('testtaskQuery', $query->sql);
+ $this->session->set('testtaskForm', $query->form);
+ }
+ }
+
+ $queryProductID = $productID;
+ $allProduct = "`product` = 'all'";
+ $caseQuery = $this->session->testtaskQuery;
+ if(strpos($this->session->testtaskQuery, $allProduct) !== false)
+ {
+ $products = array_keys($this->loadModel('product')->getPrivProducts());
+ $caseQuery = str_replace($allProduct, '1', $this->session->testtaskQuery);
+ $caseQuery = $caseQuery . ' AND `product`' . helper::dbIN(array_keys($products));
+ $queryProductID = 'all';
+ }
+
+ $caseQuery = preg_replace('/`(\w+)`/', 't2.`$1`', $caseQuery);
+ $runs = $this->dao->select('t2.*,t1.*, t2.version as caseVersion')->from(TABLE_TESTRUN)->alias('t1')
+ ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
+ ->where($caseQuery)
+ ->andWhere('t1.task')->eq($task->id)
+ ->beginIF($task->branch)->andWhere('t2.branch')->in("0,{$task->branch}")->fi()
+ ->orderBy(strpos($sort, 'assignedTo') !== false ? ('t1.' . $sort) : ('t2.' . $sort))
+ ->page($pager)
+ ->fetchAll();
+ }
+ return $runs;
+ }
+
/**
* Get info of a test run.
*
diff --git a/module/testtask/view/caseheader.html.php b/module/testtask/view/caseheader.html.php
index 6b9c4c5155..39c7646ea3 100644
--- a/module/testtask/view/caseheader.html.php
+++ b/module/testtask/view/caseheader.html.php
@@ -3,14 +3,36 @@
" . html::icon($lang->icons['usecase']) . '
' . $task->name . '';?>