* finish task#1068.

This commit is contained in:
azhi
2013-08-01 13:31:51 +08:00
parent d1de6c6ca4
commit 633d26dc8a
16 changed files with 143 additions and 37 deletions
+10 -9
View File
@@ -42,7 +42,7 @@ function loadAll(productID)
{
$('#taskIdBox').innerHTML = '<select id="task"></select>'; // Reset the task.
$('#task').chosen({no_results_text: noResultsMatch});
loadModuleMenu(productID);
loadProductModules(productID);
loadProductStories(productID);
loadProductProjects(productID);
loadProductBuilds(productID);
@@ -51,15 +51,15 @@ function loadAll(productID)
}
/**
* Load module menu.
* Load product's modules.
*
* @param int $productID
* @access public
* @return void
*/
function loadModuleMenu(productID)
function loadProductModules(productID)
{
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug');
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&rootModuleID=0&returnType=html&needManage=true');
$('#moduleIdBox').load(link);
}
@@ -186,16 +186,17 @@ function loadProjectBuilds(projectID)
productID = $('#product').val();
if(page == 'create') oldOpenedBuild = $('#openedBuild').val() ? $('#openedBuild').val() : 0;
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild);
if(page == 'create')
{
$('#buildBox').load(link);
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + "&index=0&needCreate=true");
$('#buildBox').load(link);
}
else
{
$('#openedBuildBox').load(link);
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild);
$('#openedBuildBox').load(link);
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild);
$('#resolvedBuildBox').load(link);
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild);
$('#resolvedBuildBox').load(link);
}
}
+24 -7
View File
@@ -28,18 +28,35 @@ js::set('mailto', $lang->bug->chosen->mailto);
<th class='rowhead'><?php echo $lang->bug->lblProductAndModule;?></th>
<td>
<?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value) class='select-3'");?>
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $moduleID, "onchange='loadModuleRelated()'");?></span>
<span id='moduleIdBox'>
<?php
echo html::select('module', $moduleOptionMenu, $moduleID, "onchange='loadModuleRelated()'");
if(count($moduleOptionMenu) == 1)
{
echo html::a($this->createLink('tree', 'browse', "rootID=$productID&view=bug"), $lang->tree->manage, '_blank');
echo html::a("javascript:loadProductModules($productID)", $lang->refresh);
}
?>
</span>
</td>
</tr>
<tr>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->project;?></th>
<td><span id='projectIdBox'><?php echo html::select('project', $projects, $projectID, 'class=select-3 onchange=loadProjectRelated(this.value)');?></span></td>
</tr>
<tr>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->openedBuild;?></th>
<td>
<span id='buildBox'><?php echo html::select('openedBuild[]', $builds, $buildID, 'size=3 multiple=multiple class=select-3');?></span>
<?php if(count($builds) == 1) echo $lang->build->notice;?>
<span id='buildBox'>
<?php
echo html::select('openedBuild[]', $builds, $buildID, 'size=3 multiple=multiple class=select-3');
if(count($builds) == 1 and $projectID)
{
echo html::a($this->createLink('build', 'create', "projectID=$projectID"), $lang->build->create, '_blank');
echo html::a("javascript:loadProjectsBuilds($projectID)", $lang->refresh);
}
?>
</span>
</td>
</tr>
<tr>
+13 -2
View File
@@ -191,12 +191,23 @@ class build extends control
* @param string $varName the name of the select object to create
* @param string $build build to selected
* @param int $index the index of batch create bug.
* @param bool $needCreate if need to append the link of create build
* @access public
* @return string
*/
public function ajaxGetProjectBuilds($projectID, $productID, $varName, $build = '', $index = 0)
public function ajaxGetProjectBuilds($projectID, $productID, $varName, $build = '', $index = 0, $needCreate = false)
{
if($varName == 'openedBuild') die(html::select($varName . '[]', $this->build->getProjectBuildPairs($projectID, $productID, 'noempty'), $build, 'size=4 class=select-3 multiple'));
if($varName == 'openedBuild')
{
$builds = $this->build->getProjectBuildPairs($projectID, $productID, 'noempty');
$output = html::select($varName . '[]', $builds , $build, 'size=4 class=select-3 multiple');
if(count($builds) == 1 and $needCreate)
{
$output .= html::a($this->createLink('build', 'create', "projectID=$projectID"), $this->lang->build->create, '_blank');
$output .= html::a("javascript:loadProjectBuilds($projectID)", $this->lang->refresh);
}
die($output);
}
if($varName == 'openedBuilds') die(html::select($varName . "[$index][]", $this->build->getProjectBuildPairs($projectID, $productID, 'noempty'), $build, 'size=4 class=select-3 multiple'));
if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProjectBuildPairs($projectID, $productID, 'noempty'), $build, 'class=select-3'));
if($varName == 'testTaskBuild') die(html::select('build', $this->build->getProjectBuildPairs($projectID, $productID, 'noempty'), $build, 'class=select-3'));
-2
View File
@@ -38,5 +38,3 @@ $lang->build->bugs = 'Linked bugs';
$lang->build->finishStories = 'The total demand for a complete %s';
$lang->build->resolvedBugs = 'The total solution of bug%s';
$lang->build->notice = "Please create a build in project view's build page.";
-2
View File
@@ -38,5 +38,3 @@ $lang->build->bugs = '已关联Bug';
$lang->build->finishStories = '本次共完成需求%s个';
$lang->build->resolvedBugs = '本次共解决Bug%s个';
$lang->build->notice = '版本请到[项目视图]-[版本]创建。';
+1
View File
@@ -28,6 +28,7 @@ $lang->todayIs = '%s, ';
$lang->runInfo = "<div class='row'><div class='u-1 a-center' id='debugbar'>Time: %s ms, Memory: %s KB, Queries: %s. </div></div>";
$lang->reset = 'Reset';
$lang->refresh = 'Refresh';
$lang->edit = 'Edit';
$lang->copy = 'Copy';
$lang->delete = 'Delete';
+1
View File
@@ -28,6 +28,7 @@ $lang->todayIs = '今天是%s,';
$lang->runInfo = "<div class='row'><div class='u-1 a-center' id='debugbar'>时间: %s 毫秒, 内存: %s KB, 查询: %s. </div></div>";
$lang->reset = '重填';
$lang->refresh = '刷新';
$lang->edit = '编辑';
$lang->copy = '复制';
$lang->delete = '删除';
+9 -2
View File
@@ -463,13 +463,20 @@ class product extends control
*
* @param int $productID
* @param int $planID
* @param bool $needCreate
* @access public
* @return void
*/
public function ajaxGetPlans($productID, $planID = 0)
public function ajaxGetPlans($productID, $planID = 0, $needCreate = false)
{
$plans = $this->loadModel('productplan')->getPairs($productID);
die(html::select('plan', $plans, $planID));
$output = html::select('plan', $plans, $planID, "class='select-1'");
if(count($plans) == 1 and $needCreate)
{
$output .= html::a($this->createLink('productplan', 'create', "productID=$productID"), $this->lang->productplan->create, '_blank');
$output .= html::a("javascript:loadProductPlans($productID)", $this->lang->refresh);
}
die($output);
}
/**
+1 -1
View File
@@ -1545,7 +1545,7 @@ class project extends control
public function ajaxGetMembers($projectID)
{
$users = $this->project->getTeamMemberPairs($projectID);
die(html::select('assignedTo', $users, ''));
die(html::select('assignedTo', $users, '', "class='select-1'"));
}
/**
+1
View File
@@ -1 +1,2 @@
#plan {width:245px}
select {border:1px solid #ccc}
+22 -2
View File
@@ -21,12 +21,32 @@
<th class='rowhead'><?php echo $lang->story->product;?></th>
<td>
<?php echo html::select('product', $products, $productID, "onchange=loadProduct(this.value); class='select-3'");?>
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $moduleID);?></span>
<span id='moduleIdBox'>
<?php
echo html::select('module', $moduleOptionMenu, $moduleID);
if(count($moduleOptionMenu) == 1)
{
echo html::a($this->createLink('tree', 'browse', "rootID=$productID&view=story"), $lang->tree->manage, '_blank');
echo html::a("javascript:loadProductModules($productID)", $lang->refresh);
}
?>
</span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->story->plan;?></th>
<td><span id='planIdBox'><?php echo html::select('plan', $plans, $planID, 'class=select-3');?></span></td>
<td>
<span id='planIdBox'>
<?php
echo html::select('plan', $plans, $planID, 'class=select-3');
if(count($plans) == 1)
{
echo html::a($this->createLink('productplan', 'create', "productID=$productID"), $lang->productplan->create, '_blank');
echo html::a("javascript:loadProductPlans($productID)", $lang->refresh);
}
?>
</span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->story->source;?></th>
+23 -2
View File
@@ -52,11 +52,32 @@
</tr>
<tr>
<td class='rowhead'><?php echo $lang->story->module;?></td>
<td><span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $story->module, 'class="select-1"');?></span></td>
<td>
<span id='moduleIdBox'>
<?php
echo html::select('module', $moduleOptionMenu, $story->module, 'class="select-1"');
if(count($moduleOptionMenu) == 1)
{
echo html::a($this->createLink('tree', 'browse', "rootID=$story->product&view=story"), $lang->tree->manage, '_blank');
echo html::a("javascript:loadProductModules($story->product)", $lang->refresh);
}
?>
</span>
</td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->story->plan;?></td>
<td><span id='planIdBox'><?php echo html::select('plan', $plans, $story->plan, 'class=select-1');?></span></td>
<td>
<span id='planIdBox'>
<?php echo html::select('plan', $plans, $story->plan, 'class=select-1');
if(count($plans) == 1)
{
echo html::a($this->createLink('productplan', 'create', "productID=$story->product"), $lang->productplan->create, '_blank');
echo html::a("javascript:loadProductPlans($story->product)", $lang->refresh);
}
?>
</span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->story->source;?></th>
+12 -2
View File
@@ -6,9 +6,19 @@
<script language='Javascript'>
function loadProduct(productID)
{
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story');
planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&planID=' + $('#plan').val());
loadProductModules(productID);
loadProductPlans(productID);
}
function loadProductModules(productID)
{
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&rootModuleID=0&returnType=html&needManage=true');
$('#moduleIdBox').load(moduleLink);
}
function loadProductPlans(productID)
{
planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&planID=' + $('#plan').val() + '&needCreate=true');
$('#planIdBox').load(planLink);
}
+10 -1
View File
@@ -20,7 +20,16 @@
<th class='rowhead'><?php echo $lang->testcase->lblProductAndModule;?></th>
<td>
<?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value); class='select-3'");?>
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID, "onchange=setStories();");?></span>
<span id='moduleIdBox'>
<?php
echo html::select('module', $moduleOptionMenu, $currentModuleID, "onchange=setStories();");
if(count($moduleOptionMenu) == 1)
{
echo html::a($this->createLink('tree', 'browse', "rootID=$productID&view=case"), $lang->tree->manage, '_blank');
echo html::a("javascript:loadProductModules($productID)", $lang->refresh);
}
?>
</span>
</td>
</tr>
<tr>
+3 -3
View File
@@ -15,7 +15,7 @@ var newRowID = 0;
*/
function loadAll(productID)
{
loadModuleMenu(productID);
loadProductModules(productID);
loadStory(productID);
}
@@ -26,9 +26,9 @@ function loadAll(productID)
* @access public
* @return void
*/
function loadModuleMenu(productID)
function loadProductModules(productID)
{
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case');
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&rootModuleID=0&returnType=html&needManage=true');
$('#moduleIdBox').load(link);
}
+13 -2
View File
@@ -296,13 +296,24 @@ class tree extends control
* @param int $rootID
* @param string $viewType
* @param int $rootModuleID
* @param string $returnType
* @param bool $needManage
* @access public
* @return string the html select string.
*/
public function ajaxGetOptionMenu($rootID, $viewType = 'story', $rootModuleID = 0, $returnType = 'html')
public function ajaxGetOptionMenu($rootID, $viewType = 'story', $rootModuleID = 0, $returnType = 'html', $needManage = false)
{
$optionMenu = $this->tree->getOptionMenu($rootID, $viewType, $rootModuleID);
if($returnType == 'html') die( html::select("module", $optionMenu, '', 'onchange=setAssignedTo()'));
if($returnType == 'html')
{
$output = html::select("module", $optionMenu, '', "onchange=setAssignedTo()");
if(count($optionMenu) == 1 and $needManage)
{
$output .= html::a($this->createLink('tree', 'browse', "rootID=$rootID&view=$viewType"), $this->lang->tree->manage, '_blank');
$output .= html::a("javascript:loadProductModules($rootID)", $this->lang->refresh);
}
die($output);
}
if($returnType == 'json') die(json_encode($optionMenu));
}