+ add the save query feature to story and case.

This commit is contained in:
wangchunsheng
2010-07-05 02:04:58 +00:00
parent 82b785a195
commit fa88844c34
5 changed files with 55 additions and 16 deletions
+2 -3
View File
@@ -121,10 +121,9 @@ class bug extends control
}
elseif($browseType == 'bysearch')
{
if((int)$param)
if($queryID)
{
$queryID = $param;
$query = $this->loadModel('search')->getQuery($queryID);
$query = $this->loadModel('search')->getQuery($queryID);
if($query)
{
$this->session->set('bugQuery', $query->sql);
+25 -6
View File
@@ -51,11 +51,6 @@ class product extends control
/* 浏览某一个产品。*/
public function browse($productID = 0, $browseType = 'byModule', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* 设置搜索条件。*/
$this->config->product->search['actionURL'] = $this->createLink('product', 'browse', "productID=$productID&browseType=bySearch");
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairs($productID);
$this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->product->search);
/* 设置查询格式。*/
$browseType = strtolower($browseType);
@@ -64,6 +59,7 @@ class product extends control
$this->session->set('productList', $this->app->getURI(true));
$productID = common::saveProductState($productID, key($this->products));
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
/* 设置菜单。*/
$this->product->setMenu($this->products, $productID);
@@ -88,10 +84,33 @@ class product extends control
}
elseif($browseType == 'bysearch')
{
if($this->session->storyQuery == false) $this->session->set('storyQuery', ' 1 = 1');
if($queryID)
{
$query = $this->loadModel('search')->getQuery($queryID);
if($query)
{
$this->session->set('storyQuery', $query->sql);
$this->session->set('storyForm', $query->form);
}
else
{
$this->session->set('storyQuery', ' 1 = 1');
}
}
else
{
if($this->session->storyQuery == false) $this->session->set('storyQuery', ' 1 = 1');
}
$stories = $this->story->getByQuery($productID, $this->session->storyQuery, $orderBy, $pager);
}
/* 设置搜索条件。*/
$this->config->product->search['actionURL'] = $this->createLink('product', 'browse', "productID=$productID&browseType=bySearch&queryID=queryID");
$this->config->product->search['queryID'] = $queryID;
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairs($productID);
$this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->product->search);
$this->view->productID = $productID;
$this->view->productName = $this->products[$productID];
$this->view->moduleID = $moduleID;
+2 -2
View File
@@ -5,13 +5,13 @@ $config->testcase->search['fields']['title'] = $lang->testcase->title;
$config->testcase->search['fields']['id'] = $lang->testcase->id;
$config->testcase->search['fields']['keywords'] = $lang->testcase->keywords;
$config->testcase->search['fields']['openedBy'] = $lang->testcase->openedBy;
$config->testcase->search['fields']['lastEditedBy'] = $lang->testcase->lastEditedBy;
$config->testcase->search['fields']['lastEditedBy'] = $lang->testcase->lastEditedByAB;
$config->testcase->search['fields']['status'] = $lang->testcase->status;
$config->testcase->search['fields']['pri'] = $lang->testcase->pri;
$config->testcase->search['fields']['type'] = $lang->testcase->type;
$config->testcase->search['fields']['stage'] = $lang->testcase->stage;
$config->testcase->search['fields']['openedDate'] = $lang->testcase->openedDate;
$config->testcase->search['fields']['lastEditedDate'] = $lang->testcase->lastEditedDate;
$config->testcase->search['fields']['lastEditedDate'] = $lang->testcase->lastEditedDateAB;
$config->testcase->search['params']['title'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
$config->testcase->search['params']['keywords'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
+24 -5
View File
@@ -44,14 +44,11 @@ class testcase extends control
/* 浏览一个产品下面的case。*/
public function browse($productID = 0, $browseType = 'byModule', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* 构造搜索表单。*/
$this->config->testcase->search['actionURL'] = $this->createLink('testcase', 'browse', "productID=$productID&browseType=bySearch");
$this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->testcase->search);
/* 设置浏览模式,产品ID和模块ID。 */
$browseType = strtolower($browseType);
$productID = common::saveProductState($productID, key($this->products));
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
/* 设置菜单,登记session。*/
$this->testcase->setMenu($this->products, $productID);
@@ -78,13 +75,35 @@ class testcase extends control
}
elseif($browseType == 'bysearch')
{
if($this->session->testcaseQuery == false) $this->session->set('testcaseQuery', ' 1 = 1');
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');
}
$this->view->cases = $this->dao->select('*')->from(TABLE_CASE)->where($this->session->testcaseQuery)
->andWhere('product')->eq($productID)
->andWhere('deleted')->eq(0)
->orderBy($orderBy)->page($pager)->fetchAll();
}
/* 构造搜索表单。*/
$this->config->testcase->search['actionURL'] = $this->createLink('testcase', 'browse', "productID=$productID&browseType=bySearch&queryID=queryID");
$this->config->testcase->search['queryID'] = $queryID;
$this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->testcase->search);
/* 赋值。*/
$this->view->header->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->common;
$this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]);
+2
View File
@@ -48,6 +48,8 @@ $lang->testcase->scriptedStatus = '脚本状态';
$lang->testcase->scriptedLocation = '脚本位置';
$lang->testcase->linkCase = '相关用例';
$lang->testcase->stage = '适用阶段';
$lang->testcase->lastEditedByAB = '修改者';
$lang->testcase->lastEditedDateAB = '修改日期';
$lang->case = $lang->testcase; // 用于DAO检查时使用。因为case是系统关键字,所以无法定义该模块为case,只能使用testcase,但表还是使用的case。
$lang->testcase->stepID = '编号';