* finish task #1600.
This commit is contained in:
@@ -342,7 +342,7 @@ class common extends control
|
||||
*/
|
||||
public function printRPN($backLink, $preAndNext = '')
|
||||
{
|
||||
global $lang;
|
||||
global $lang, $app;
|
||||
if(isonlybody()) return false;
|
||||
|
||||
echo "<span class='link-button'>";
|
||||
@@ -351,18 +351,20 @@ class common extends control
|
||||
|
||||
if(isset($preAndNext->pre) and $preAndNext->pre)
|
||||
{
|
||||
$id = (!$_SESSION[$typeOnlyCondition] and $app->getModuleName() == 'testcase' and isset($preAndNext->pre->case)) ? 'case' : 'id';
|
||||
$title = isset($preAndNext->pre->title) ? $preAndNext->pre->title : $preAndNext->pre->name;
|
||||
$title = '#' . $preAndNext->pre->id . ' ' . $title;
|
||||
$title = '#' . $preAndNext->pre->$id . ' ' . $title;
|
||||
echo "<span class='link-button'>";
|
||||
echo html::a($this->inLink('view', "ID={$preAndNext->pre->id}"), ' ', '', "id='pre' class='icon-pre' title='{$title}'");
|
||||
echo html::a($this->inLink('view', "ID={$preAndNext->pre->$id}"), ' ', '', "id='pre' class='icon-pre' title='{$title}'");
|
||||
echo "</span>";
|
||||
}
|
||||
if(isset($preAndNext->next) and $preAndNext->next)
|
||||
{
|
||||
$id = (!$_SESSION[$typeOnlyCondition] and $app->getModuleName() == 'testcase' and isset($preAndNext->next->case)) ? 'case' : 'id';
|
||||
$title = isset($preAndNext->next->title) ? $preAndNext->next->title : $preAndNext->next->name;
|
||||
$title = '#' . $preAndNext->next->id . ' ' . $title;
|
||||
$title = '#' . $preAndNext->next->$id . ' ' . $title;
|
||||
echo "<span class='link-button'>";
|
||||
echo html::a($this->inLink('view', "ID={$preAndNext->next->id}"), ' ', '', "id='next' class='icon-next' title='$title'");
|
||||
echo html::a($this->inLink('view', "ID={$preAndNext->next->$id}"), ' ', '', "id='next' class='icon-next' title='$title'");
|
||||
echo "</span>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -627,7 +627,6 @@ class commonModel extends model
|
||||
$nextID = $tmpObjectIDs[$nextKey];
|
||||
$preAndNextObject->next = $objects[$objectIDs[$nextID]];
|
||||
}
|
||||
|
||||
return $preAndNextObject;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,16 +25,16 @@ global $lang;
|
||||
$config->testcase->search['module'] = 'testcase';
|
||||
$config->testcase->search['fields']['title'] = $lang->testcase->title;
|
||||
$config->testcase->search['fields']['id'] = $lang->testcase->id;
|
||||
$config->testcase->search['fields']['module'] = $lang->testcase->module;
|
||||
$config->testcase->search['fields']['keywords'] = $lang->testcase->keywords;
|
||||
$config->testcase->search['fields']['lastEditedBy'] = $lang->testcase->lastEditedByAB;
|
||||
$config->testcase->search['fields']['type'] = $lang->testcase->type;
|
||||
|
||||
$config->testcase->search['fields']['pri'] = $lang->testcase->pri;
|
||||
$config->testcase->search['fields']['openedBy'] = $lang->testcase->openedBy;
|
||||
$config->testcase->search['fields']['status'] = $lang->testcase->status;
|
||||
$config->testcase->search['fields']['product'] = $lang->testcase->product;
|
||||
$config->testcase->search['fields']['stage'] = $lang->testcase->stage;
|
||||
$config->testcase->search['fields']['module'] = $lang->testcase->module;
|
||||
$config->testcase->search['fields']['pri'] = $lang->testcase->pri;
|
||||
|
||||
$config->testcase->search['fields']['openedDate'] = $lang->testcase->openedDate;
|
||||
$config->testcase->search['fields']['lastEditedDate'] = $lang->testcase->lastEditedDateAB;
|
||||
|
||||
@@ -215,6 +215,7 @@ class testtask extends control
|
||||
/* Set the browseType and moduleID. */
|
||||
$browseType = strtolower($browseType);
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
|
||||
/* Get task and product info, set menu. */
|
||||
$task = $this->testtask->getById($taskID);
|
||||
@@ -231,6 +232,48 @@ class testtask extends control
|
||||
{
|
||||
$this->view->runs = $this->testtask->getUserRuns($taskID, $this->session->user->account, $orderBy, $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 = $this->loadModel('search')->replaceDynamic($caseQuery);
|
||||
$caseQuery = preg_replace('/`(\w+)`/', 't2.`$1`', $caseQuery);
|
||||
$this->view->runs = $this->dao->select('t2.*,t1.*')->from(TABLE_TESTRUN)->alias('t1')
|
||||
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
|
||||
->where($caseQuery)
|
||||
->andWhere('t1.task')->eq($taskID)
|
||||
->orderBy(strpos($orderBy, 'assignedTo') !== false ? ('t1.' . $orderBy) : ('t2.' . $orderBy))
|
||||
->page($pager)
|
||||
->fetchAll();
|
||||
}
|
||||
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false);
|
||||
|
||||
/* Save testcaseIDs session for get the pre and next testcase. */
|
||||
@@ -238,6 +281,13 @@ class testtask extends control
|
||||
foreach($this->view->runs as $run) $testcaseIDs .= ',' . $run->case;
|
||||
$this->session->set('testcaseIDs', $testcaseIDs . ',');
|
||||
|
||||
/* 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['actionURL'] = inlink('cases', "taskID=$taskID&browseType=bySearch&queryID=myQueryID");
|
||||
$this->loadModel('search')->setSearchParams($this->config->testcase->search);
|
||||
|
||||
$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]);
|
||||
$this->view->position[] = $this->lang->testtask->cases;
|
||||
|
||||
@@ -4,8 +4,33 @@ function browseByModule(active)
|
||||
$('.divider').removeClass('hidden');
|
||||
$('#bymoduleTab').addClass('active');
|
||||
$('#' + active + 'Tab').removeClass('active');
|
||||
$('#querybox').addClass('hidden');
|
||||
}
|
||||
|
||||
/* Swtich to search module. */
|
||||
function browseBySearch(active)
|
||||
{
|
||||
$('#querybox').removeClass('hidden');
|
||||
$('.side').addClass('hidden');
|
||||
$('.divider').addClass('hidden');
|
||||
$('#' + active + 'Tab').removeClass('active');
|
||||
$('#bysearchTab').addClass('active');
|
||||
$('#bymoduleTab').removeClass('active');
|
||||
}
|
||||
|
||||
function changeAction(url)
|
||||
{
|
||||
$('#batchForm').attr('action', url);
|
||||
}
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
setModal4List('runCase', 'caseList', function(){$(".results").colorbox({width:900, height:550, iframe:true, transition:'none'});});
|
||||
$('#' + browseType + 'Tab').addClass('active');
|
||||
$('#module' + moduleID).addClass('active');
|
||||
if(browseType == 'bysearch') ajaxGetSearchForm();
|
||||
});
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("a.iframe").colorbox({width:900, height:550, iframe:true, transition:'none', onCleanup:function(){parent.location.href=parent.location.href;}});
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
$(function(){ajaxGetSearchForm();})
|
||||
|
||||
@@ -23,6 +23,7 @@ var moduleID = '<?php echo $moduleID;?>';
|
||||
echo "<span id='bymoduleTab' onclick=\"browseByModule('$browseType')\"><a href='#'>" . $lang->testtask->byModule . "</a></span> ";
|
||||
echo "<span id='allTab'>" . html::a($this->inlink('cases', "taskID=$taskID&browseType=all¶m=0"), $lang->testtask->allCases) . "</span>";
|
||||
echo "<span id='assignedtomeTab'>" . html::a($this->inlink('cases', "taskID=$taskID&browseType=assignedtome¶m=0"), $lang->testtask->assignedToMe) . "</span>";
|
||||
echo "<span id='bysearchTab' onclick=\"browseBySearch('$browseType')\"><a href='#'><span class='icon-search'></span>{$lang->testcase->bySearch}</a></span> ";
|
||||
?>
|
||||
</div>
|
||||
<div class='f-right'>
|
||||
@@ -33,6 +34,7 @@ var moduleID = '<?php echo $moduleID;?>';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div id='querybox'></div>
|
||||
|
||||
<form method='post' name='casesform'>
|
||||
<table class='cont-lt1'>
|
||||
|
||||
@@ -75,5 +75,4 @@
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
<script type='text/javascript'>ajaxGetSearchForm();</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user