* finish task #2358.

This commit is contained in:
chenfeiCF
2015-10-22 17:12:56 +08:00
parent 2026c89d90
commit 7aebf9efbd
7 changed files with 96 additions and 60 deletions

View File

@@ -537,12 +537,23 @@ class bug extends control
/* Assign. */
if($projectID)
{
$this->view->openedBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, 'noempty');
$openedBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, 'noempty,noterminate,nodone');
$allBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, 'noempty');
}
else
{
$this->view->openedBuilds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty');
$openedBuilds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty,noterminate,nodone');
$allBuilds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty');
}
/* Set the openedBuilds list*/
$bugOpenedBuilds = array();
foreach($allBuilds as $buildID => $build)
{
if(strpos($bug->openedBuild, "$buildID") !== false) $bugOpenedBuilds[$buildID] = $build;
}
$openedBuilds = $openedBuilds + $bugOpenedBuilds;
$this->view->bug = $bug;
$this->view->productID = $productID;
$this->view->productName = $this->products[$productID];
@@ -553,7 +564,8 @@ class bug extends control
$this->view->stories = $bug->project ? $this->story->getProjectStoryPairs($bug->project) : $this->story->getProductStoryPairs($bug->product);
$this->view->tasks = $this->task->getProjectTaskPairs($bug->project);
$this->view->users = $this->user->getPairs('nodeleted', "$bug->assignedTo,$bug->resolvedBy,$bug->closedBy,$bug->openedBy");
$this->view->resolvedBuilds = array('' => '') + $this->view->openedBuilds;
$this->view->openedBuilds = $openedBuilds;
$this->view->resolvedBuilds = array('' => '') + $openedBuilds;
$this->view->actions = $this->action->getList('bug', $bugID);
$this->view->templates = $this->bug->getUserBugTemplates($this->app->user->account);

View File

@@ -1,2 +1,3 @@
.col-side .chosen-container .chosen-drop {width: 216px!important}
.col-side .chosen-container {width: 218px!important}
.col-side .chosen-container[id^="openedBuild"] {width: 172px!important}

View File

@@ -51,6 +51,74 @@ function loadAll(productID)
}
}
/**
*Load all builds of one project or product.
*
* @access public
* @return void
*/
function loadAllBuilds()
{
productID = $('#product').val();
projectID = $('#project').val();
if(projectID)
{
loadAllProjectBuilds(projectID, productID);
}
else
{
loadAllProductBuilds(productID);
}
}
/**
* Load all builds of the project.
*
* @param int $projectID
* @access public
* @return void
*/
function loadAllProjectBuilds(projectID, productID)
{
if(page == 'create') oldOpenedBuild = $('#openedBuild').val() ? $('#openedBuild').val() : 0;
link = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild);
if(page == 'create')
{
$('#buildBox').load(link, function(){ notice(); $('#openedBuild').chosen(defaultChosenOptions);});
}
else
{
$('#openedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
buildLink = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild);
$('#resolvedBuildBox').load(buildLink, function(){$(this).find('select').chosen(defaultChosenOptions)});
}
}
/**
* Load all builds of the product.
*
* @param int $productID
* @access public
* @return void
*/
function loadAllProductBuilds(productID)
{
link = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild);
if(page == 'create')
{
$('#buildBox').load(link, function(){ notice(); $('#openedBuild').chosen(defaultChosenOptions);});
}
else
{
$('#openedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
buildLink = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild);
$('#resolvedBuildBox').load(buildLink, function(){$(this).find('select').chosen(defaultChosenOptions)});
}
}
/**
* Load product's modules.
*

View File

@@ -23,58 +23,6 @@ function loadAllUsers()
$('#assignedToBox').load(link, function(){$('#assignedTo').chosen(defaultChosenOptions);});
}
/**
*Load all builds of one project or product.
*
* @access public
* @return void
*/
function loadAllBuilds()
{
productID = $('#product').val();
projectID = $('#project').val();
if(projectID)
{
loadAllProjectBuilds(projectID, productID);
}
else
{
loadAllProductBuilds(productID);
}
}
/**
* Load all builds of the project.
*
* @param int $projectID
* @access public
* @return void
*/
function loadAllProjectBuilds(projectID, productID)
{
if(page == 'create') oldOpenedBuild = $('#openedBuild').val() ? $('#openedBuild').val() : 0;
if(page == 'create')
{
link = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild);
$('#buildBox').load(link, function(){ notice(); $('#openedBuild').chosen(defaultChosenOptions);});
}
}
/**
* Load all builds of the product.
*
* @param int $productID
* @access public
* @return void
*/
function loadAllProductBuilds(productID)
{
link = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild);
if(page == 'create') $('#buildBox').load(link, function(){ notice(); $('#openedBuild').chosen(defaultChosenOptions);});
}
/**
* load assignedTo and stories of module.
*

View File

@@ -130,7 +130,7 @@ $lang->bug->lblResolved = '由谁解决';
$lang->bug->lblAllFields = '所有字段';
$lang->bug->lblCustomFields = '自定义字段';
$lang->bug->allUsers = '所有用户';
$lang->bug->allBuilds = '所有版本';
$lang->bug->allBuilds = '所有';
/* legend列表。*/
$lang->bug->legendBasicInfo = '基本信息';

View File

@@ -167,7 +167,12 @@ js::set('oldResolvedBuild' , $bug->resolvedBuild);
</tr>
<tr>
<th><?php echo $lang->bug->openedBuild;?></th>
<td><span id='openedBuildBox'><?php echo html::select('openedBuild[]', $openedBuilds, $bug->openedBuild, 'size=4 multiple=multiple class="chosen form-control"');?></span></td>
<td>
<div class='input-group'>
<span id='openedBuildBox'><?php echo html::select('openedBuild[]', $openedBuilds, $bug->openedBuild, 'size=4 multiple=multiple class="chosen form-control"');?></span>
<span class='input-group-btn'><?php echo html::commonButton($lang->bug->allBuilds, "class='btn btn-default' onclick='loadAllBuilds()'")?></span>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->bug->resolvedBy;?></th>

View File

@@ -194,7 +194,7 @@ class build extends control
{
if($varName == 'openedBuild' ) die(html::select($varName . '[]', $this->build->getProductBuildPairs($productID, 'noempty,release,noterminate,nodone'), $build, 'size=4 class=form-control multiple'));
if($varName == 'openedBuilds' ) die(html::select($varName . "[$index][]", $this->build->getProductBuildPairs($productID, 'noempty,release'), $build, 'size=4 class=form-control multiple'));
if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProductBuildPairs($productID, 'noempty,release'), $build, "class='form-control'"));
if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProductBuildPairs($productID, 'noempty,release,noterminate,nodone'), $build, "class='form-control'"));
}
/**
@@ -217,7 +217,7 @@ class build extends control
die($output);
}
if($varName == 'openedBuilds') die(html::select($varName . "[$index][]", $this->build->getProjectBuildPairs($projectID, $productID, 'noempty'), $build, 'size=4 class=form-control multiple'));
if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProjectBuildPairs($projectID, $productID, 'noempty'), $build, "class='form-control'"));
if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProjectBuildPairs($projectID, $productID, 'noempty,noterminate,nodone'), $build, "class='form-control'"));
if($varName == 'testTaskBuild') die(html::select('build', $this->build->getProjectBuildPairs($projectID, $productID, 'noempty'), $build, "class='form-control'"));
}
@@ -232,7 +232,8 @@ class build extends control
*/
public function ajaxGetAllProductBuilds($productID, $varName, $build = '')
{
if($varName == 'openedBuild' ) die(html::select($varName . '[]', $this->build->getProductBuildPairs($productID, 'noempty,release'), $build, 'size=4 class=form-control multiple'));
if($varName == 'openedBuild' ) die(html::select($varName . '[]', $this->build->getProductBuildPairs($productID, 'noempty,release'), $build, 'size=4 class=form-control multiple'));
if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProductBuildPairs($productID, 'noempty,release'), $build, "class='form-control'"));
}
/**
@@ -252,6 +253,7 @@ class build extends control
$output = html::select($varName . '[]', $builds , $build, 'size=4 class=form-control multiple');
die($output);
}
if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProjectBuildPairs($projectID, $productID, 'noempty'), $build, "class='form-control'"));
}
/**