* code for browse filter.
This commit is contained in:
+10
-3
@@ -64,12 +64,19 @@ class bug extends control
|
||||
/* Set browse type. */
|
||||
$browseType = strtolower($browseType);
|
||||
|
||||
if($browseType == 'bymodule') setcookie('bugModule', (int)$param, $this->config->cookieLife, $this->config->webRoot);
|
||||
if($browseType != 'bymodule') $this->session->set('bugBrowseType', $browseType);
|
||||
|
||||
/* Set productID, moduleID, queryID and branch. */
|
||||
$productID = $this->product->saveState($productID, $this->products);
|
||||
$branch = ($branch == '') ? $this->session->branch : $branch;
|
||||
setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot);
|
||||
|
||||
if($this->cookie->preProductID != $productID)
|
||||
{
|
||||
$_COOKIE['bugModule'] = 0;
|
||||
setcookie('bugModule', 0, $this->config->cookieLife, $this->config->webRoot);
|
||||
}
|
||||
if($browseType == 'bymodule') setcookie('bugModule', (int)$param, $this->config->cookieLife, $this->config->webRoot);
|
||||
if($browseType != 'bymodule') $this->session->set('bugBrowseType', $browseType);
|
||||
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : ($browseType == 'bysearch' ? 0 : ($this->cookie->bugModule ? $this->cookie->bugModule : 0));
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
|
||||
|
||||
@@ -105,9 +105,6 @@ class product extends control
|
||||
/* Lower browse type. */
|
||||
$browseType = strtolower($browseType);
|
||||
|
||||
if($browseType == 'bymodule') setcookie('storyModule', (int)$param, $this->config->cookieLife, $this->config->webRoot);
|
||||
if($browseType != 'bymodule') $this->session->set('storyBrowseType', $browseType);
|
||||
|
||||
/* Load datatable. */
|
||||
$this->loadModel('datatable');
|
||||
|
||||
@@ -118,6 +115,16 @@ class product extends control
|
||||
/* Set product, module and query. */
|
||||
$productID = $this->product->saveState($productID, $this->products);
|
||||
$branch = ($branch === '') ? $this->session->branch : $branch;
|
||||
setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot);
|
||||
|
||||
if($this->cookie->preProductID != $productID)
|
||||
{
|
||||
$_COOKIE['storyModule'] = 0;
|
||||
setcookie('storyModule', 0, $this->config->cookieLife, $this->config->webRoot);
|
||||
}
|
||||
if($browseType == 'bymodule') setcookie('storyModule', (int)$param, $this->config->cookieLife, $this->config->webRoot);
|
||||
if($browseType != 'bymodule') $this->session->set('storyBrowseType', $browseType);
|
||||
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : ($browseType == 'bysearch' ? 0 : ($this->cookie->storyModule ? $this->cookie->storyModule : 0));
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
|
||||
|
||||
+28
-10
@@ -121,10 +121,27 @@ class project extends control
|
||||
/* Set browse type. */
|
||||
$browseType = strtolower($status);
|
||||
|
||||
if($browseType == 'bymodule' or $browseType == 'byproduct')
|
||||
/* Get products by project. */
|
||||
$project = $this->commonAction($projectID, $status);
|
||||
$projectID = $project->id;
|
||||
$products = $this->loadModel('product')->getProductsByProject($projectID);
|
||||
setcookie('preProjectID', $projectID, $this->config->cookieLife, $this->config->webRoot);
|
||||
|
||||
if($this->cookie->preProjectID != $projectID)
|
||||
{
|
||||
setcookie('taskBrowseType', $browseType, $this->config->cookieLife, $this->config->webRoot);
|
||||
setcookie('browseParam', (int)$param, $this->config->cookieLife, $this->config->webRoot);
|
||||
$_COOKIE['moduleBrowseParam'] = $_COOKIE['productBrowseParam'] = 0;
|
||||
setcookie('moduleBrowseParam', 0, $this->config->cookieLife, $this->config->webRoot);
|
||||
setcookie('productBrowseParam', 0, $this->config->cookieLife, $this->config->webRoot);
|
||||
}
|
||||
if($browseType == 'bymodule')
|
||||
{
|
||||
setcookie('moduleBrowseParam', (int)$param, $this->config->cookieLife, $this->config->webRoot);
|
||||
setcookie('productBrowseParam', 0, $this->config->cookieLife, $this->config->webRoot);
|
||||
}
|
||||
elseif($browseType == 'byproduct')
|
||||
{
|
||||
setcookie('moduleBrowseParam', 0, $this->config->cookieLife, $this->config->webRoot);
|
||||
setcookie('productBrowseParam', (int)$param, $this->config->cookieLife, $this->config->webRoot);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -133,13 +150,8 @@ class project extends control
|
||||
|
||||
/* Set queryID, moduleID and productID. */
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : (($browseType == 'bysearch' or $browseType == 'byproduct') ? 0 : ($this->cookie->taskBrowseType == 'bymodule' ? $this->cookie->browseParam : 0));
|
||||
$productID = ($browseType == 'byproduct') ? (int)$param : (($browseType == 'bysearch' or $browseType == 'bymodule') ? 0 : ($this->cookie->taskBrowseType == 'byproduct' ? $this->cookie->browseParam : 0));
|
||||
|
||||
/* Get products by project. */
|
||||
$project = $this->commonAction($projectID, $status);
|
||||
$projectID = $project->id;
|
||||
$products = $this->loadModel('product')->getProductsByProject($projectID);
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : ($browseType == 'bysearch' ? 0 : $this->cookie->moduleBrowseParam);
|
||||
$productID = ($browseType == 'byproduct') ? (int)$param : ($browseType == 'bysearch' ? 0 : $this->cookie->productBrowseParam);
|
||||
|
||||
/* Save to session. */
|
||||
$uri = $this->app->getURI(true);
|
||||
@@ -1236,6 +1248,12 @@ class project extends control
|
||||
$project = $this->loadModel('project')->getById($projectID);
|
||||
$tree = $this->project->getProjectTree($projectID);
|
||||
|
||||
/* Save to session. */
|
||||
$uri = $this->app->getURI(true);
|
||||
$this->app->session->set('taskList', $uri);
|
||||
$this->app->session->set('storyList', $uri);
|
||||
$this->app->session->set('projectList', $uri);
|
||||
|
||||
if($type === 'json')
|
||||
{
|
||||
die(json_encode($tree, JSON_HEX_QUOT | JSON_HEX_APOS));
|
||||
|
||||
@@ -1970,6 +1970,7 @@ class projectModel extends model
|
||||
$tasks = $this->dao->select('*')->from(TABLE_TASK)
|
||||
->where('project')->eq((int)$projectID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy('id_desc')
|
||||
->fetchAll();
|
||||
$taskGroups = array();
|
||||
foreach($tasks as $task) $taskGroups[$task->module][$task->story][$task->id] = $task;
|
||||
@@ -1981,7 +1982,7 @@ class projectModel extends model
|
||||
if($node->type == 'story')
|
||||
{
|
||||
$node->type = 'module';
|
||||
$stories = $storyGroups[$node->root][$node->id];
|
||||
$stories = isset($storyGroups[$node->root][$node->id]) ? $storyGroups[$node->root][$node->id] : array();
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$storyItem = new stdclass();
|
||||
@@ -1994,7 +1995,7 @@ class projectModel extends model
|
||||
$storyItem->url = helper::createLink('story', 'view', "storyID=$story->id&version=$story->version&from=project¶m=$projectID");
|
||||
$storyItem->taskCreateUrl = helper::createLink('task', 'batchCreate', "projectID={$projectID}&story={$story->id}");
|
||||
|
||||
$storyTasks = $taskGroups[$node->id][$story->id];
|
||||
$storyTasks = isset($taskGroups[$node->id][$story->id]) ? $taskGroups[$node->id][$story->id] : array();
|
||||
if(!empty($storyTasks))
|
||||
{
|
||||
$taskItems = $this->formatTasksForTree($storyTasks, $story);
|
||||
@@ -2009,7 +2010,7 @@ class projectModel extends model
|
||||
elseif($node->type == 'task')
|
||||
{
|
||||
$node->type = 'module';
|
||||
$tasks = $taskGroups[$node->id][0];
|
||||
$tasks = isset($taskGroups[$node->id][0]) ? $taskGroups[$node->id][0] : array();
|
||||
if(!empty($tasks))
|
||||
{
|
||||
$taskItems = $this->formatTasksForTree($tasks);
|
||||
@@ -2062,9 +2063,9 @@ class projectModel extends model
|
||||
$buttons .= common::buildIconButton('task', 'start', "taskID=$task->id", $task, 'list', '', '', 'iframe', true);
|
||||
$buttons .= common::buildIconButton('task', 'recordEstimate', "taskID=$task->id", $task, 'list', 'time', '', 'iframe', true);
|
||||
|
||||
if($browseType == 'needconfirm')
|
||||
if($taskItem->storyChanged)
|
||||
{
|
||||
$lang->task->confirmStoryChange = $lang->confirm;
|
||||
$this->lang->task->confirmStoryChange = $this->lang->confirm;
|
||||
$buttons .= common::buildIconButton('task', 'confirmStoryChange', "taskid=$task->id", '', 'list', '', 'hiddenwin');
|
||||
}
|
||||
|
||||
|
||||
@@ -418,6 +418,7 @@ class searchModel extends model
|
||||
*/
|
||||
public function mergeFeatureBar($module, $method)
|
||||
{
|
||||
if(!isset($this->lang->$module->featurebar[$method])) return;
|
||||
$queryModule = $module == 'project' ? 'task' : ($module == 'product' ? 'story' : $module);
|
||||
$shortcuts = $this->getShorcutQueryPairs($queryModule);
|
||||
foreach($shortcuts as $id => $name)
|
||||
|
||||
@@ -939,6 +939,7 @@ class story extends control
|
||||
$this->lang->story->menuOrder = $this->lang->testcase->menuOrder;
|
||||
$this->lang->story->menu->testcase['subModule'] = 'story';
|
||||
$this->loadModel('testcase')->setMenu($products, $productID);
|
||||
$this->loadModel('search')->mergeFeatureBar('testcase', 'browse');
|
||||
|
||||
/* Append id for secend sort. */
|
||||
$sort = $this->loadModel('common')->appendOrder($orderBy);
|
||||
|
||||
@@ -60,12 +60,19 @@ class testcase extends control
|
||||
/* Set browse type. */
|
||||
$browseType = strtolower($browseType);
|
||||
|
||||
if($browseType == 'bymodule') setcookie('caseModule', (int)$param, $this->config->cookieLife, $this->config->webRoot);
|
||||
if($browseType != 'bymodule') $this->session->set('caseBrowseType', $browseType);
|
||||
|
||||
/* Set browseType, productID, moduleID and queryID. */
|
||||
$productID = $this->product->saveState($productID, $this->products);
|
||||
$branch = ($branch === '') ? $this->session->branch : $branch;
|
||||
setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot);
|
||||
|
||||
if($this->cookie->preProductID != $productID)
|
||||
{
|
||||
$_COOKIE['caseModule'] = 0;
|
||||
setcookie('caseModule', 0, $this->config->cookieLife, $this->config->webRoot);
|
||||
}
|
||||
if($browseType == 'bymodule') setcookie('caseModule', (int)$param, $this->config->cookieLife, $this->config->webRoot);
|
||||
if($browseType != 'bymodule') $this->session->set('caseBrowseType', $browseType);
|
||||
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : ($browseType == 'bysearch' ? 0 : ($this->cookie->caseModule ? $this->cookie->caseModule : 0));
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
|
||||
@@ -148,6 +155,7 @@ class testcase extends control
|
||||
|
||||
$cases = $this->testcase->getModuleCases($productID, $branch, 0, $groupBy);
|
||||
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false);
|
||||
$this->loadModel('search')->mergeFeatureBar('testcase', 'browse');
|
||||
|
||||
$groupCases = array();
|
||||
$groupByList = array();
|
||||
|
||||
@@ -148,7 +148,6 @@ $lang->testcase->searchStories = '键入来搜索需求';
|
||||
|
||||
$lang->testcase->featurebar['browse']['all'] = $lang->testcase->allCases;
|
||||
$lang->testcase->featurebar['browse']['needconfirm'] = $lang->testcase->needConfirm;
|
||||
$lang->testcase->featurebar['browse']['group'] = '';
|
||||
$lang->testcase->featurebar['browse']['zerocase'] = '';
|
||||
$lang->testcase->featurebar['browse']['group'] = '分组查看';
|
||||
$lang->testcase->featurebar['browse']['zerocase'] = '零用例需求';
|
||||
$lang->testcase->featurebar['groupcase'] = $lang->testcase->featurebar['browse'];
|
||||
if(isset($lang->story))$lang->story->featurebar['zerocase'] = $lang->testcase->featurebar['browse'];
|
||||
|
||||
@@ -231,6 +231,18 @@ class testtask extends control
|
||||
/* Set the browseType and moduleID. */
|
||||
$browseType = strtolower($browseType);
|
||||
|
||||
/* Get task and product info, set menu. */
|
||||
$task = $this->testtask->getById($taskID);
|
||||
if(!$task) die(js::error($this->lang->notFound) . js::locate('back'));
|
||||
$productID = $task->product;
|
||||
$this->testtask->setMenu($this->products, $productID, $task->branch);
|
||||
setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot);
|
||||
|
||||
if($this->cookie->preProductID != $productID)
|
||||
{
|
||||
$_COOKIE['taskCaseModule'] = 0;
|
||||
setcookie('taskCaseModule', 0, $this->config->cookieLife, $this->config->webRoot);
|
||||
}
|
||||
if($browseType == 'bymodule') setcookie('taskCaseModule', (int)$param, $this->config->cookieLife, $this->config->webRoot);
|
||||
if($browseType != 'bymodule') $this->session->set('taskCaseBrowseType', $browseType);
|
||||
|
||||
@@ -240,12 +252,6 @@ class testtask extends control
|
||||
/* Append id for secend sort. */
|
||||
$sort = $this->loadModel('common')->appendOrder($orderBy, 't2.id');
|
||||
|
||||
/* Get task and product info, set menu. */
|
||||
$task = $this->testtask->getById($taskID);
|
||||
if(!$task) die(js::error($this->lang->notFound) . js::locate('back'));
|
||||
$productID = $task->product;
|
||||
$this->testtask->setMenu($this->products, $productID, $task->branch);
|
||||
|
||||
/* 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);
|
||||
|
||||
Reference in New Issue
Block a user