* finish task #2559.
This commit is contained in:
+23
-19
@@ -108,26 +108,30 @@ class bug extends control
|
||||
$actionURL = $this->createLink('bug', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID");
|
||||
$this->bug->buildSearchForm($productID, $this->products, $queryID, $actionURL);
|
||||
|
||||
$showModule = !empty($this->config->datatable->bugbrowse->showModule) ? $this->config->datatable->bugbrowse->showModule : '';
|
||||
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'bug', $showModule) : array();
|
||||
|
||||
/* Set view. */
|
||||
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->common;
|
||||
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
|
||||
$this->view->position[] = $this->lang->bug->common;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->productName = $this->products[$productID];
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
|
||||
$this->view->modules = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch);
|
||||
$this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'bug', $startModuleID = 0, array('treeModel', 'createBugLink'), '', $branch);
|
||||
$this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->bugs = $bugs;
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
$this->view->pager = $pager;
|
||||
$this->view->param = $param;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->memberPairs = $this->user->getPairs('noletter|nodeleted');
|
||||
$this->view->branch = $branch;
|
||||
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
|
||||
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->common;
|
||||
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
|
||||
$this->view->position[] = $this->lang->bug->common;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->productName = $this->products[$productID];
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
|
||||
$this->view->modules = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch);
|
||||
$this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'bug', $startModuleID = 0, array('treeModel', 'createBugLink'), '', $branch);
|
||||
$this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->bugs = $bugs;
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
$this->view->pager = $pager;
|
||||
$this->view->param = $param;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->memberPairs = $this->user->getPairs('noletter|nodeleted');
|
||||
$this->view->branch = $branch;
|
||||
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
|
||||
$this->view->setShowModule = true;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -1990,7 +1990,7 @@ class bugModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function printCell($col, $bug, $users, $builds, $branches)
|
||||
public function printCell($col, $bug, $users, $builds, $branches, $modulePairs)
|
||||
{
|
||||
$bugLink = inlink('view', "bugID=$bug->id");
|
||||
$account = $this->app->user->account;
|
||||
@@ -2020,7 +2020,10 @@ class bugModel extends model
|
||||
break;
|
||||
case 'title':
|
||||
$class = 'confirm' . $bug->confirmed;
|
||||
echo "<span class='$class'>[{$this->lang->bug->confirmedList[$bug->confirmed]}] </span>" . html::a($bugLink, $bug->title);
|
||||
echo "<span class='$class'>[{$lang->bug->confirmedList[$bug->confirmed]}] </span>";
|
||||
if($bug->branch)echo "<span class='label label-info label-badge'>{$branches[$bug->branch]}</span>";
|
||||
if($modulePairs and $bug->module)echo "<span class='label label-info label-badge'>{$modulePairs[$bug->module]}</span>";
|
||||
echo html::a($bugLink, $bug->title);
|
||||
break;
|
||||
case 'branch':
|
||||
echo $branches[$bug->branch];
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
<?php
|
||||
echo "<span class='$class'>[{$lang->bug->confirmedList[$bug->confirmed]}] </span>";
|
||||
if($bug->branch)echo "<span class='label label-info label-badge'>{$branches[$bug->branch]}</span>";
|
||||
if($modulePairs and $bug->module)echo "<span class='label label-info label-badge'>{$modulePairs[$bug->module]}</span>";
|
||||
echo html::a($bugLink, $bug->title);
|
||||
?>
|
||||
</td>
|
||||
|
||||
@@ -23,7 +23,7 @@ extract($widths);
|
||||
<tbody>
|
||||
<?php foreach($bugs as $bug):?>
|
||||
<tr class='text-center' data-id='<?php echo $bug->id?>'>
|
||||
<?php foreach ($setting as $key => $value) $this->bug->printCell($value, $bug, $users, $builds, $branches);?>
|
||||
<?php foreach ($setting as $key => $value) $this->bug->printCell($value, $bug, $users, $builds, $branches, $modulePairs);?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<style>
|
||||
.datatable-menu-wrapper {position: relative; z-index: 999; overflow: visible;}
|
||||
#switchToDatatable {position: absolute; top: 0; right: 0; border: 1px solid #ddd; outline: none; color: #4d90fe!important; background: #fff}
|
||||
#switchToDatatable:hover {color: #002563!important}
|
||||
.datatable-menu-wrapper {position: relative;}
|
||||
.datatable-menu {position: absolute; right: 0; top: 0; border: 1px solid #ddd; background: #fff; z-index: 999;}
|
||||
.datatable-menu > .btn {padding: 5px 6px 6px; outline: none; color: #4d90fe!important}
|
||||
.datatable-menu > .btn:hover {color: #002563!important}
|
||||
</style>
|
||||
<?php $datatableId = $this->moduleName . $this->methodName;?>
|
||||
<script>
|
||||
@@ -10,7 +11,15 @@ $(function()
|
||||
var table = $('#wrap > .outer > .main > form > table').first();
|
||||
if($(table).length > 0)
|
||||
{
|
||||
$(table).before("<div class='datatable-menu-wrapper'><span id='switchToDatatable' title='<?php echo $lang->datatable->switchToDatatable?>' class='btn btn-link'><i class='icon-table'></i></span></div>");
|
||||
var $dropdown = $("<div class='datatable-menu-wrapper'><div class='dropdown datatable-menu'><button type='button' class='btn btn-link' data-toggle='dropdown'><i class='icon-cogs'></i> <span class='caret'></span></button></div></div>");
|
||||
var $dropmenu = $("<ul class='dropdown-menu pull-right'></ul>");
|
||||
<?php if(!empty($setShowModule)):?>
|
||||
$dropmenu.append("<li><a href='javascript:;' data-toggle='showModuleModal'><?php echo $lang->datatable->showModule?></a></li>");
|
||||
<?php endif;?>
|
||||
$dropmenu.append("<li><a href='javascript:;' id='switchToDatatable'><?php echo $lang->datatable->switchToDatatable?></a></li>");
|
||||
$dropdown.children('.dropdown').append($dropmenu);
|
||||
$(table).before($dropdown);
|
||||
$("a[data-toggle='showModuleModal']").click(function(){$('#showModuleModal').modal('show')});
|
||||
}
|
||||
|
||||
$('#switchToDatatable').click(function()
|
||||
@@ -18,6 +27,11 @@ $(function()
|
||||
saveDatatableConfig('mode', 'datatable', true)
|
||||
});
|
||||
|
||||
$('#setShowModule').click(function()
|
||||
{
|
||||
saveDatatableConfig('showModule', $('#showModuleModal input[name="showModule"]:checked').val(), true)
|
||||
});
|
||||
|
||||
function saveDatatableConfig(name, value, reload)
|
||||
{
|
||||
if('<?php echo $this->app->user->account?>' == 'guest') return;
|
||||
@@ -34,3 +48,19 @@ $(function()
|
||||
};
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="showModuleModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog w-800px">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title"><i class="icon-cog"></i> <?php echo $lang->customConfig?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class='form-condensed' method='post' target='hiddenwin' action='<?php echo $this->createLink('datatable', 'ajaxSave')?>'>
|
||||
<p><?php echo html::radio('showModule', $lang->datatable->showModuleList, isset($config->datatable->$datatableId->showModule) ? $config->datatable->$datatableId->showModule : '');?></p>
|
||||
<p><button type='button' id='setShowModule' class='btn btn-primary'><?php echo $lang->save?></button></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -19,11 +19,6 @@ if($config->debug)
|
||||
.datatable .table>tbody>tr>td.col-hover, .datatable .table>tbody>tr.hover>td {background-color: #ebf2f9 !important;}
|
||||
.datatable-span.flexarea .scroll-slide {bottom: -30px}
|
||||
|
||||
.datatable-menu-wrapper {position: relative;}
|
||||
.datatable-menu {position: absolute; right: 0; top: 0; border: 1px solid #ddd; background: #fff; z-index: 999;}
|
||||
.datatable-menu > .btn {padding: 5px 6px 6px; outline: none; color: #4d90fe!important}
|
||||
.datatable-menu > .btn:hover {color: #002563!important}
|
||||
|
||||
.panel > .datatable, .panel-body > .datatable {margin-bottom: 0;}
|
||||
</style>
|
||||
<script>
|
||||
@@ -68,14 +63,15 @@ $(document).ready(function()
|
||||
|
||||
var $dropdown = $("<div class='datatable-menu-wrapper'><div class='dropdown datatable-menu'><button type='button' class='btn btn-link' data-toggle='dropdown'><i class='icon-cogs'></i> <span class='caret'></span></button></div></div>");
|
||||
var $dropmenu = $("<ul class='dropdown-menu pull-right'></ul>");
|
||||
if(customMenu)
|
||||
{
|
||||
$dropmenu.append("<li><a id='customBtn' href='<?php echo $this->createLink('datatable', 'custom', 'id=' . $this->moduleName . '&method=' . $this->methodName)?>' data-toggle='modal' data-type='ajax'><?php echo $lang->datatable->custom?></a></li>");
|
||||
}
|
||||
<?php if(!empty($setShowModule)):?>
|
||||
$dropmenu.append("<li><a href='javascript:;' data-toggle='showModuleModal'><?php echo $lang->datatable->showModule?></a></li>");
|
||||
<?php endif;?>
|
||||
if(customMenu) $dropmenu.append("<li><a id='customBtn' href='<?php echo $this->createLink('datatable', 'custom', 'id=' . $this->moduleName . '&method=' . $this->methodName)?>' data-toggle='modal' data-type='ajax'><?php echo $lang->datatable->custom?></a></li>");
|
||||
$dropmenu.append("<li><a href='javascript:;' id='switchToTable'><?php echo $lang->datatable->switchToTable?></a></li>");
|
||||
$dropdown.children('.dropdown').append($dropmenu);
|
||||
this.$datatable.before($dropdown);
|
||||
this.$datatable.find('[data-toggle=modal], a.iframe').modalTrigger();
|
||||
$("a[data-toggle='showModuleModal']").click(function(){$('#showModuleModal').modal('show')});
|
||||
|
||||
$('#customBtn').modalTrigger();
|
||||
|
||||
|
||||
@@ -13,3 +13,8 @@ $lang->datatable->required = 'Required';
|
||||
|
||||
$lang->datatable->branch = 'Branch';
|
||||
$lang->datatable->platform = 'Platform';
|
||||
|
||||
$lang->datatable->showModule = 'Show module in title';
|
||||
$lang->datatable->showModuleList[] = 'Not show';
|
||||
$lang->datatable->showModuleList['base'] = 'Base node';
|
||||
$lang->datatable->showModuleList['end'] = 'End node';
|
||||
|
||||
@@ -13,3 +13,8 @@ $lang->datatable->required = '必选';
|
||||
|
||||
$lang->datatable->branch = '分支';
|
||||
$lang->datatable->platform = '平台';
|
||||
|
||||
$lang->datatable->showModule = '标题是否显示模块';
|
||||
$lang->datatable->showModuleList[] = '不显示';
|
||||
$lang->datatable->showModuleList['base'] = '根节点';
|
||||
$lang->datatable->showModuleList['end'] = '终极节点';
|
||||
|
||||
@@ -152,6 +152,9 @@ class product extends control
|
||||
$actionURL = $this->createLink('product', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID");
|
||||
$this->product->buildSearchForm($productID, $this->products, $queryID, $actionURL);
|
||||
|
||||
$showModule = !empty($this->config->datatable->productbrowse->showModule) ? $this->config->datatable->productbrowse->showModule : '';
|
||||
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'story', $showModule) : array();
|
||||
|
||||
/* Assign. */
|
||||
$this->view->title = $this->products[$productID]. $this->lang->colon . $this->lang->product->browse;
|
||||
$this->view->position[] = $this->products[$productID];
|
||||
@@ -174,6 +177,7 @@ class product extends control
|
||||
$this->view->branch = $branch;
|
||||
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
|
||||
$this->view->storyStages = $this->product->batchGetStoryStage($stories);
|
||||
$this->view->setShowModule = true;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
<td><span class='<?php echo 'pri' . zget($lang->story->priList, $story->pri, $story->pri);?>'><?php echo zget($lang->story->priList, $story->pri, $story->pri)?></span></td>
|
||||
<td class='text-left' title="<?php echo $story->title?>"><nobr>
|
||||
<?php if($story->branch) echo "<span class='label label-info label-badge'>{$branches[$story->branch]}</span>"?>
|
||||
<?php if($modulePairs and $story->module) echo "<span class='label label-info label-badge'>{$modulePairs[$story->module]}</span>"?>
|
||||
<?php echo html::a($viewLink, $story->title);?>
|
||||
</nobr></td>
|
||||
<td title="<?php echo $story->planTitle?>"><?php echo $story->planTitle;?></td>
|
||||
|
||||
@@ -23,7 +23,7 @@ extract($widths);
|
||||
<tbody>
|
||||
<?php foreach($stories as $story):?>
|
||||
<tr class='text-center' data-id='<?php echo $story->id?>'>
|
||||
<?php foreach($setting as $key => $value) $this->story->printCell($value, $story, $users, $branches, $storyStages);?>
|
||||
<?php foreach($setting as $key => $value) $this->story->printCell($value, $story, $users, $branches, $storyStages, $modulePairs);?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
|
||||
+25
-21
@@ -177,28 +177,32 @@ class project extends control
|
||||
$memberPairs = array();
|
||||
foreach($this->view->teamMembers as $key => $member) $memberPairs[$key] = $member->realname;
|
||||
|
||||
$showModule = !empty($this->config->datatable->projecttask->showModule) ? $this->config->datatable->projecttask->showModule : '';
|
||||
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($projectID, 'task', $showModule) : array();
|
||||
|
||||
/* Assign. */
|
||||
$this->view->tasks = $tasks;
|
||||
$this->view->summary = $this->project->summary($tasks);
|
||||
$this->view->tabID = 'task';
|
||||
$this->view->pager = $pager;
|
||||
$this->view->recTotal = $pager->recTotal;
|
||||
$this->view->recPerPage = $pager->recPerPage;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->status = $status;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->param = $param;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->project = $project;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->modules = $this->tree->getTaskOptionMenu($projectID);
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->moduleTree = $this->tree->getTaskTreeMenu($projectID, $productID = 0, $startModuleID = 0, array('treeModel', 'createTaskLink'));
|
||||
$this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
|
||||
$this->view->projectTree = $this->project->tree();
|
||||
$this->view->memberPairs = $memberPairs;
|
||||
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), 'noempty');
|
||||
$this->view->tasks = $tasks;
|
||||
$this->view->summary = $this->project->summary($tasks);
|
||||
$this->view->tabID = 'task';
|
||||
$this->view->pager = $pager;
|
||||
$this->view->recTotal = $pager->recTotal;
|
||||
$this->view->recPerPage = $pager->recPerPage;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->status = $status;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->param = $param;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->project = $project;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->modules = $this->tree->getTaskOptionMenu($projectID);
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->moduleTree = $this->tree->getTaskTreeMenu($projectID, $productID = 0, $startModuleID = 0, array('treeModel', 'createTaskLink'));
|
||||
$this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
|
||||
$this->view->projectTree = $this->project->tree();
|
||||
$this->view->memberPairs = $memberPairs;
|
||||
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), 'noempty');
|
||||
$this->view->setShowModule = true;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ extract($widths);
|
||||
<tbody>
|
||||
<?php foreach($tasks as $task):?>
|
||||
<tr class='text-center' data-id='<?php echo $task->id?>'>
|
||||
<?php foreach ($setting as $key => $value) $this->task->printCell($value, $task, $memberPairs, $browseType);?>
|
||||
<?php foreach ($setting as $key => $value) $this->task->printCell($value, $task, $memberPairs, $browseType, $branchGroups, $modulePairs);?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
<td><span class='<?php echo 'pri' . zget($lang->task->priList, $task->pri, $task->pri)?>'><?php echo zget($lang->task->priList, $task->pri, $task->pri);?></span></td>
|
||||
<td class='text-left' title="<?php echo $task->name?>">
|
||||
<?php if(isset($branchGroups[$task->product][$task->branch])) echo "<span class='label label-info label-badge'>" . $branchGroups[$task->product][$task->branch] . '</span>';?>
|
||||
<?php if($modulePairs and $task->module) echo "<span class='label label-info label-badge'>" . $modulePairs[$task->module] . '</span>';?>
|
||||
<?php
|
||||
if(!common::printLink('task', 'view', "task=$task->id", $task->name)) echo $task->name;
|
||||
if($task->fromBug) echo html::a($this->createLink('bug', 'view', "id=$task->fromBug"), "[BUG#$task->fromBug]", '_blank', "class='bug'");
|
||||
|
||||
@@ -2080,7 +2080,7 @@ class storyModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function printCell($col, $story, $users, $branches, $storyStages)
|
||||
public function printCell($col, $story, $users, $branches, $storyStages, $modulePairs = array())
|
||||
{
|
||||
$storyLink = helper::createLink('story', 'view', "storyID=$story->id");
|
||||
$account = $this->app->user->account;
|
||||
@@ -2108,6 +2108,8 @@ class storyModel extends model
|
||||
echo "</span>";
|
||||
break;
|
||||
case 'title':
|
||||
if($story->branch) echo "<span class='label label-info label-badge'>{$branches[$story->branch]}</span>";
|
||||
if($modulePairs and $story->module) echo "<span class='label label-info label-badge'>{$modulePairs[$story->module]}</span>";
|
||||
echo html::a($storyLink, $story->title);
|
||||
break;
|
||||
case 'plan':
|
||||
|
||||
@@ -1495,7 +1495,7 @@ class taskModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function printCell($col, $task, $users, $browseType)
|
||||
public function printCell($col, $task, $users, $browseType, $branchGroups, $modulePairs = array())
|
||||
{
|
||||
$taskLink = helper::createLink('task', 'view', "taskID=$task->id");
|
||||
$account = $this->app->user->account;
|
||||
@@ -1520,6 +1520,8 @@ class taskModel extends model
|
||||
echo "</span>";
|
||||
break;
|
||||
case 'name':
|
||||
if(isset($branchGroups[$task->product][$task->branch])) echo "<span class='label label-info label-badge'>" . $branchGroups[$task->product][$task->branch] . '</span>';
|
||||
if($modulePairs and $task->module) echo "<span class='label label-info label-badge'>" . $modulePairs[$task->module] . '</span>';
|
||||
echo html::a($taskLink, $task->name);
|
||||
if($task->fromBug) echo html::a(helper::createLink('bug', 'view', "id=$task->fromBug"), "[BUG#$task->fromBug]", '_blank', "class='bug'");
|
||||
break;
|
||||
|
||||
+21
-17
@@ -98,24 +98,28 @@ class testcase extends control
|
||||
$actionURL = $this->createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID");
|
||||
$this->testcase->buildSearchForm($productID, $this->products, $queryID, $actionURL);
|
||||
|
||||
$showModule = !empty($this->config->datatable->testcasebrowse->showModule) ? $this->config->datatable->testcasebrowse->showModule : '';
|
||||
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'case', $showModule) : array();
|
||||
|
||||
/* Assign. */
|
||||
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->common;
|
||||
$this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]);
|
||||
$this->view->position[] = $this->lang->testcase->common;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->productName = $this->products[$productID];
|
||||
$this->view->modules = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch);
|
||||
$this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createCaseLink'), '', $branch);
|
||||
$this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->param = $param;
|
||||
$this->view->cases = $cases;
|
||||
$this->view->branch = $branch;
|
||||
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
|
||||
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->common;
|
||||
$this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]);
|
||||
$this->view->position[] = $this->lang->testcase->common;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->productName = $this->products[$productID];
|
||||
$this->view->modules = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch);
|
||||
$this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createCaseLink'), '', $branch);
|
||||
$this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->param = $param;
|
||||
$this->view->cases = $cases;
|
||||
$this->view->branch = $branch;
|
||||
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
|
||||
$this->view->setShowModule = true;
|
||||
|
||||
|
||||
$this->display();
|
||||
|
||||
@@ -917,7 +917,7 @@ class testcaseModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function printCell($col, $case, $users, $branches)
|
||||
public function printCell($col, $case, $users, $branches, $modulePairs = array())
|
||||
{
|
||||
$caseLink = helper::createLink('testcase', 'view', "caseID=$case->id");
|
||||
$account = $this->app->user->account;
|
||||
@@ -941,6 +941,8 @@ class testcaseModel extends model
|
||||
echo "</span>";
|
||||
break;
|
||||
case 'title':
|
||||
if($case->branch) echo "<span class='label label-info label-badge'>{$branches[$case->branch]}</span>";
|
||||
if($modulePairs and $case->module) echo "<span class='label label-info label-badge'>{$modulePairs[$case->module]}</span>";
|
||||
echo html::a($caseLink, $case->title);
|
||||
break;
|
||||
case 'branch':
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
<td><span class='<?php echo 'pri' . zget($lang->testcase->priList, $case->pri, $case->pri)?>'><?php echo zget($lang->testcase->priList, $case->pri, $case->pri);?></span></td>
|
||||
<td class='text-left' title="<?php echo $case->title?>">
|
||||
<?php if($case->branch) echo "<span class='label label-info label-badge'>{$branches[$case->branch]}</span>"?>
|
||||
<?php if($modulePairs and $case->module) echo "<span class='label label-info label-badge'>{$modulePairs[$case->module]}</span>"?>
|
||||
<?php echo html::a($viewLink, $case->title);?>
|
||||
</td>
|
||||
<?php if($browseType == 'needconfirm'):?>
|
||||
|
||||
@@ -23,7 +23,7 @@ extract($widths);
|
||||
<tbody>
|
||||
<?php foreach($cases as $case):?>
|
||||
<tr class='text-center' data-id='<?php echo $case->id?>'>
|
||||
<?php foreach($setting as $key => $value) $this->testcase->printCell($value, $case, $users, $branches);?>
|
||||
<?php foreach($setting as $key => $value) $this->testcase->printCell($value, $case, $users, $branches, $modulePairs);?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
|
||||
+14
-13
@@ -314,19 +314,20 @@ class testtask extends control
|
||||
$this->view->position[] = $this->lang->testtask->common;
|
||||
$this->view->position[] = $this->lang->testtask->cases;
|
||||
|
||||
$this->view->productID = $productID;
|
||||
$this->view->productName = $this->products[$productID];
|
||||
$this->view->task = $task;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed,qafirst');
|
||||
$this->view->moduleTree = $this->loadModel('tree')->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createTestTaskLink'), $extra = $taskID);
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->param = $param;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->taskID = $taskID;
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->treeClass = $browseType == 'bymodule' ? '' : 'hidden';
|
||||
$this->view->pager = $pager;
|
||||
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
|
||||
$this->view->productID = $productID;
|
||||
$this->view->productName = $this->products[$productID];
|
||||
$this->view->task = $task;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed,qafirst');
|
||||
$this->view->moduleTree = $this->loadModel('tree')->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createTestTaskLink'), $extra = $taskID);
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->param = $param;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->taskID = $taskID;
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->treeClass = $browseType == 'bymodule' ? '' : 'hidden';
|
||||
$this->view->pager = $pager;
|
||||
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
|
||||
$this->view->setShowModule = false;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -564,6 +564,7 @@ class testtaskModel extends model
|
||||
echo "</span>";
|
||||
break;
|
||||
case 'title':
|
||||
if($run->branch) echo "<span class='label label-info label-badge'>{$branches[$run->branch]}</span>";
|
||||
echo html::a($caseLink, $run->title);
|
||||
break;
|
||||
case 'branch':
|
||||
|
||||
+58
-34
@@ -44,24 +44,16 @@ class treeModel extends model
|
||||
if($startModule) $startModulePath = $startModule->path . '%';
|
||||
}
|
||||
|
||||
if($type == 'bug' or $type == 'case' or $type == 'task')
|
||||
if($this->isMergeModule($rootID, $type))
|
||||
{
|
||||
/* Get createdVersion. */
|
||||
$createdVersion = $this->dao->select('createdVersion')->from(TABLE_PRODUCT)
|
||||
->where('id')->eq($rootID)
|
||||
->fetch('createdVersion');
|
||||
|
||||
if($createdVersion and version_compare($createdVersion, '4.1', '>'))
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where('root')->eq((int)$rootID)
|
||||
->andWhere('type')->in("story,$type")
|
||||
->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
|
||||
->beginIF($branch === 'null')->andWhere('branch')->eq(0)->fi()
|
||||
->beginIF((!empty($branch) and $branch != 'null'))->andWhere("branch")->eq($branch)->fi()
|
||||
->orderBy('grade desc, type desc, `order`')
|
||||
->get();
|
||||
}
|
||||
return $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where('root')->eq((int)$rootID)
|
||||
->andWhere('type')->in("story,$type")
|
||||
->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
|
||||
->beginIF($branch === 'null')->andWhere('branch')->eq(0)->fi()
|
||||
->beginIF((!empty($branch) and $branch != 'null'))->andWhere("branch")->eq($branch)->fi()
|
||||
->orderBy('grade desc, type desc, `order`')
|
||||
->get();
|
||||
}
|
||||
|
||||
/* $createdVersion < 4.1 or $type == 'story'. */
|
||||
@@ -126,6 +118,30 @@ class treeModel extends model
|
||||
return $lastMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module pairs.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param string $viewType
|
||||
* @param string $showModule
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getModulePairs($rootID, $viewType = 'story', $showModule = 'end')
|
||||
{
|
||||
if($this->isMergeModule($rootID, $viewType)) $viewType .= ',story';
|
||||
$modules = $this->dao->select('id,name,path,short')->from(TABLE_MODULE)->where('root')->eq($rootID)->andWhere('type')->in($viewType)->fetchAll('id');
|
||||
$modulePairs = array();
|
||||
foreach($modules as $moduleID => $module)
|
||||
{
|
||||
list($baseModule) = explode(',', trim($module->path, ','));
|
||||
if($showModule == 'base' and isset($modules[$baseModule])) $module = $modules[$baseModule];
|
||||
$modulePairs[$moduleID] = $module->short ? $module->short : $module->name;
|
||||
}
|
||||
|
||||
return $modulePairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an option menu of task in html.
|
||||
*
|
||||
@@ -137,11 +153,10 @@ class treeModel extends model
|
||||
public function getTaskOptionMenu($rootID, $productID = 0, $startModule = 0)
|
||||
{
|
||||
/* If createdVersion <= 4.1, go to getOptionMenu(). */
|
||||
$createdVersion = $this->dao->select('openedVersion')->from(TABLE_PROJECT)->where('id')->eq($rootID)->fetch('openedVersion');
|
||||
$products = $this->loadModel('product')->getProductsByProject($rootID);
|
||||
$branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products));
|
||||
|
||||
if(!$createdVersion or version_compare($createdVersion, '4.1', '<=') or !$products) return $this->getOptionMenu($rootID, 'task', $startModule);
|
||||
if(!$this->isMergeModule($rootID, 'task') or !$products) return $this->getOptionMenu($rootID, 'task', $startModule);
|
||||
|
||||
/* createdVersion > 4.1. */
|
||||
$startModulePath = '';
|
||||
@@ -326,13 +341,10 @@ class treeModel extends model
|
||||
$extra = array('projectID' => $rootID, 'productID' => $productID, 'tip' => true);
|
||||
|
||||
/* If createdVersion <= 4.1, go to getTreeMenu(). */
|
||||
$createdVersion = $this->dao->select('openedVersion')->from(TABLE_PROJECT)
|
||||
->where('id')->eq($rootID)
|
||||
->fetch('openedVersion');
|
||||
$products = $this->loadModel('product')->getProductsByProject($rootID);
|
||||
$branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products));
|
||||
|
||||
if(!$createdVersion or version_compare($createdVersion, '4.1', '<=') or !$products)
|
||||
if(!$this->isMergeModule($rootID, 'task') or !$products)
|
||||
{
|
||||
$extra['tip'] = false;
|
||||
return $this->getTreeMenu($rootID, 'task', $startModule, $userFunc, $extra);
|
||||
@@ -878,12 +890,8 @@ class treeModel extends model
|
||||
*/
|
||||
public function getSons($rootID, $moduleID, $type = 'root', $branch = 0)
|
||||
{
|
||||
$createdVersion = $this->dao->select('createdVersion')->from(TABLE_PRODUCT)
|
||||
->where('id')->eq($rootID)
|
||||
->fetch('createdVersion');
|
||||
|
||||
/* if createVersion <= 4.1 or type == 'story', only get modules of its type. */
|
||||
if(!$createdVersion or version_compare($createdVersion, '4.1', '<=') or $type == 'story')
|
||||
if(!$this->isMergeModule($rootID, $type) or $type == 'story')
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where('root')->eq((int)$rootID)
|
||||
@@ -1331,12 +1339,7 @@ class treeModel extends model
|
||||
{
|
||||
if(empty($branches)) $branches = $this->post->branch;
|
||||
|
||||
if($viewType == 'bug' or $viewType == 'case' or $viewType == 'task')
|
||||
{
|
||||
/* Get createdVersion. */
|
||||
$createdVersion = $this->dao->select('createdVersion')->from(TABLE_PRODUCT)->where('id')->eq($rootID)->fetch('createdVersion');
|
||||
if($createdVersion and version_compare($createdVersion, '4.1', '>')) $viewType .= ',story';
|
||||
}
|
||||
if($this->isMergeModule($rootID, $viewType)) $viewType .= ',story';
|
||||
|
||||
$existsModules = $this->dao->select('id,branch,name')->from(TABLE_MODULE)->where('root')->eq($rootID)->andWhere('type')->in($viewType)->andWhere('parent')->eq($parentModuleID)->fetchAll();
|
||||
$repeatName = '';
|
||||
@@ -1360,4 +1363,25 @@ class treeModel extends model
|
||||
if($repeatName) die(js::alert(sprintf($this->lang->tree->repeatName, $repeatName)));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check merge module version.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param string $viewType
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function isMergeModule($rootID, $viewType)
|
||||
{
|
||||
if($viewType == 'bug' or $viewType == 'case' or $viewType == 'task')
|
||||
{
|
||||
/* Get createdVersion. */
|
||||
$table = $viewType == 'task' ? TABLE_PROJECT : TABLE_PRODUCT;
|
||||
$versionField = $viewType == 'task' ? 'openedVersion' : 'createdVersion';
|
||||
$createdVersion = $this->dao->select($versionField)->from($table)->where('id')->eq($rootID)->fetch($versionField);
|
||||
return ($createdVersion and version_compare($createdVersion, '4.1', '>'));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user