From 7aebf9efbd84d988b107d01e19376be7cb297ce0 Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Thu, 22 Oct 2015 17:12:56 +0800 Subject: [PATCH] * finish task #2358. --- module/bug/control.php | 18 ++++++++-- module/bug/css/edit.css | 1 + module/bug/js/common.js | 68 +++++++++++++++++++++++++++++++++++ module/bug/js/create.js | 52 --------------------------- module/bug/lang/zh-cn.php | 2 +- module/bug/view/edit.html.php | 7 +++- module/build/control.php | 8 +++-- 7 files changed, 96 insertions(+), 60 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index fc6b5e2894..7d0fcf535a 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -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); diff --git a/module/bug/css/edit.css b/module/bug/css/edit.css index 0ec48066f5..aa15983631 100644 --- a/module/bug/css/edit.css +++ b/module/bug/css/edit.css @@ -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} diff --git a/module/bug/js/common.js b/module/bug/js/common.js index efe0107e35..ca9fbe8048 100644 --- a/module/bug/js/common.js +++ b/module/bug/js/common.js @@ -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. * diff --git a/module/bug/js/create.js b/module/bug/js/create.js index eab117fd73..3a38d8b89a 100644 --- a/module/bug/js/create.js +++ b/module/bug/js/create.js @@ -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. * diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php index 1e40aa8cd5..142387c24e 100644 --- a/module/bug/lang/zh-cn.php +++ b/module/bug/lang/zh-cn.php @@ -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 = '基本信息'; diff --git a/module/bug/view/edit.html.php b/module/bug/view/edit.html.php index 63e8748549..318fccfe0e 100644 --- a/module/bug/view/edit.html.php +++ b/module/bug/view/edit.html.php @@ -167,7 +167,12 @@ js::set('oldResolvedBuild' , $bug->resolvedBuild); bug->openedBuild;?> - openedBuild, 'size=4 multiple=multiple class="chosen form-control"');?> + +
+ openedBuild, 'size=4 multiple=multiple class="chosen form-control"');?> + bug->allBuilds, "class='btn btn-default' onclick='loadAllBuilds()'")?> +
+ bug->resolvedBy;?> diff --git a/module/build/control.php b/module/build/control.php index a876086352..9457cc3029 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -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'")); } /**