* finish task #2351.

This commit is contained in:
wangyidong
2015-10-27 14:15:05 +08:00
parent b979a5da38
commit 71240b18a7
24 changed files with 231 additions and 152 deletions
+2
View File
@@ -61,6 +61,7 @@ $config->bug->search['fields']['status'] = $lang->bug->status;
$config->bug->search['fields']['confirmed'] = $lang->bug->confirmed;
$config->bug->search['fields']['product'] = $lang->bug->product;
$config->bug->search['fields']['branch'] = $lang->bug->branch;
$config->bug->search['fields']['plan'] = $lang->bug->productplan;
$config->bug->search['fields']['module'] = $lang->bug->module;
$config->bug->search['fields']['project'] = $lang->bug->project;
@@ -102,6 +103,7 @@ $config->bug->search['params']['status'] = array('operator' => '=',
$config->bug->search['params']['confirmed'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->bug->confirmedList);
$config->bug->search['params']['product'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->bug->search['params']['branch'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->bug->search['params']['plan'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->bug->search['params']['module'] = array('operator' => 'belong', 'control' => 'select', 'values' => 'modules');
$config->bug->search['params']['project'] = array('operator' => '=', 'control' => 'select', 'values' => 'projects');
+49 -37
View File
@@ -61,7 +61,7 @@ class bug extends control
* @access public
* @return void
*/
public function browse($productID = 0, $browseType = 'unclosed', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function browse($productID = 0, $branch = 0, $browseType = 'unclosed', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* Set browseType, productID, moduleID and queryID. */
$browseType = strtolower($browseType);
@@ -70,7 +70,7 @@ class bug extends control
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
/* Set menu and save session. */
$this->bug->setMenu($this->products, $productID);
$this->bug->setMenu($this->products, $productID, $branch);
$this->session->set('bugList', $this->app->getURI(true));
/* Process the order by field. */
@@ -90,23 +90,23 @@ class bug extends control
/* Get bugs. */
$bugs = array();
if($browseType == 'all') $bugs = $this->bug->getAllBugs($productID, $projects, $sort, $pager);
if($browseType == 'all') $bugs = $this->bug->getAllBugs($productID, $branch, $projects, $sort, $pager);
elseif($browseType == "bymodule")
{
$childModuleIds = $this->tree->getAllChildId($moduleID);
$bugs = $this->bug->getModuleBugs($productID, $childModuleIds, $projects, $sort, $pager);
$bugs = $this->bug->getModuleBugs($productID, $branch, $childModuleIds, $projects, $sort, $pager);
}
elseif($browseType == 'assigntome') $bugs = $this->bug->getByAssigntome($productID, $projects, $sort, $pager);
elseif($browseType == 'openedbyme') $bugs = $this->bug->getByOpenedbyme($productID, $projects, $sort, $pager);
elseif($browseType == 'resolvedbyme') $bugs = $this->bug->getByResolvedbyme($productID, $projects, $sort, $pager);
elseif($browseType == 'assigntonull') $bugs = $this->bug->getByAssigntonull($productID, $projects, $sort, $pager);
elseif($browseType == 'unconfirmed') $bugs = $this->bug->getUnconfirmed($productID, $projects, $sort, $pager);
elseif($browseType == 'unresolved') $bugs = $this->bug->getByStatus($productID, $projects, 'unresolved', $sort, $pager);
elseif($browseType == 'unclosed') $bugs = $this->bug->getByStatus($productID, $projects, 'unclosed', $sort, $pager);
elseif($browseType == 'toclosed') $bugs = $this->bug->getByStatus($productID, $projects, 'toclosed', $sort, $pager);
elseif($browseType == 'longlifebugs') $bugs = $this->bug->getByLonglifebugs($productID, $projects, $sort, $pager);
elseif($browseType == 'postponedbugs') $bugs = $this->bug->getByPostponedbugs($productID, $projects, $sort, $pager);
elseif($browseType == 'needconfirm') $bugs = $this->bug->getByNeedconfirm($productID, $projects, $sort, $pager);
elseif($browseType == 'assigntome') $bugs = $this->bug->getByAssigntome($productID, $branch, $projects, $sort, $pager);
elseif($browseType == 'openedbyme') $bugs = $this->bug->getByOpenedbyme($productID, $branch, $projects, $sort, $pager);
elseif($browseType == 'resolvedbyme') $bugs = $this->bug->getByResolvedbyme($productID, $branch, $projects, $sort, $pager);
elseif($browseType == 'assigntonull') $bugs = $this->bug->getByAssigntonull($productID, $branch, $projects, $sort, $pager);
elseif($browseType == 'unconfirmed') $bugs = $this->bug->getUnconfirmed($productID, $branch, $projects, $sort, $pager);
elseif($browseType == 'unresolved') $bugs = $this->bug->getByStatus($productID, $branch, $projects, 'unresolved', $sort, $pager);
elseif($browseType == 'unclosed') $bugs = $this->bug->getByStatus($productID, $branch, $projects, 'unclosed', $sort, $pager);
elseif($browseType == 'toclosed') $bugs = $this->bug->getByStatus($productID, $branch, $projects, 'toclosed', $sort, $pager);
elseif($browseType == 'longlifebugs') $bugs = $this->bug->getByLonglifebugs($productID, $branch, $projects, $sort, $pager);
elseif($browseType == 'postponedbugs') $bugs = $this->bug->getByPostponedbugs($productID, $branch, $projects, $sort, $pager);
elseif($browseType == 'needconfirm') $bugs = $this->bug->getByNeedconfirm($productID, $branch, $projects, $sort, $pager);
elseif($browseType == 'bysearch') $bugs = $this->bug->getBySearch($productID, $queryID, $sort, $pager);
/* Process the sql, get the conditon partion, save it to session. */
@@ -116,7 +116,7 @@ class bug extends control
$bugs = $this->loadModel('story')->checkNeedConfirm($bugs);
/* Build the search form. */
$this->config->bug->search['actionURL'] = $this->createLink('bug', 'browse', "productID=$productID&browseType=bySearch&queryID=myQueryID");
$this->config->bug->search['actionURL'] = $this->createLink('bug', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID");
$this->config->bug->search['queryID'] = $queryID;
$this->config->bug->search['params']['product']['values'] = array($productID => $this->products[$productID], 'all' => $this->lang->bug->allProduct);
$this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairs($productID);
@@ -124,6 +124,15 @@ class bug extends control
$this->config->bug->search['params']['project']['values'] = $this->product->getProjectPairs($productID);
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($productID);
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->build->getProductBuildPairs($productID);
if($this->session->currentProductType == 'normal')
{
unset($this->config->bug->search['fields']['branch']);
unset($this->config->bug->search['params']['branch']);
}
else
{
$this->config->bug->search['params']['branch']['values'] = array('' => '') + $this->loadModel('branch')->getPairs($productID, 'noempty');
}
$this->loadModel('search')->setSearchParams($this->config->bug->search);
$users = $this->user->getPairs('noletter');
@@ -165,6 +174,7 @@ class bug extends control
$this->view->orderBy = $orderBy;
$this->view->moduleID = $moduleID;
$this->view->memberPairs = $memberPairs;
$this->view->branch = $branch;
$this->display();
}
@@ -253,8 +263,7 @@ class bug extends control
/* Get product, then set menu. */
$productID = $this->product->saveState($productID, $this->products);
$product = $this->product->getById($productID);
$branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID);
$branches = $this->session->currentProductType == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID);
$this->bug->setMenu($this->products, $productID, $branch);
/* Init vars. */
@@ -336,9 +345,9 @@ class bug extends control
$this->view->productID = $productID;
$this->view->productName = $this->products[$productID];
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0);
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch);
$this->view->stories = $stories;
$this->view->projects = $this->product->getProjectPairs($productID, $params = 'nodeleted');
$this->view->projects = $this->product->getProjectPairs($productID, $branch, $params = 'nodeleted');
$this->view->builds = $builds;
$this->view->moduleID = $moduleID;
$this->view->projectID = $projectID;
@@ -360,7 +369,6 @@ class bug extends control
$this->view->keywords = $keywords;
$this->view->severity = $severity;
$this->view->type = $type;
$this->view->product = $product;
$this->view->branch = $branch;
$this->view->branches = $branches;
@@ -380,24 +388,24 @@ class bug extends control
{
if(!empty($_POST))
{
$actions = $this->bug->batchCreate($productID);
$actions = $this->bug->batchCreate($productID, $branch);
foreach($actions as $bugID => $actionID) $this->sendmail($bugID, $actionID);
die(js::locate($this->session->bugList, 'parent'));
}
/* Get product, then set menu. */
$productID = $this->product->saveState($productID, $this->products);
$this->bug->setMenu($this->products, $productID);
$this->bug->setMenu($this->products, $productID, $branch);
/* If projectID is setted, get builds and stories of this project. */
if($projectID)
{
$builds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, 'noempty');
$builds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $branch, 'noempty');
$stories = $this->story->getProjectStoryPairs($projectID);
}
else
{
$builds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty');
$builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch, 'noempty');
$stories = $this->story->getProductStoryPairs($productID, $branch);
}
@@ -419,7 +427,7 @@ class bug extends control
}
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->batchCreate;
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]);
$this->view->position[] = $this->lang->bug->batchCreate;
$this->view->productID = $productID;
@@ -428,8 +436,9 @@ class bug extends control
$this->view->users = $this->user->getPairs('nodeleted,devfirst');
$this->view->projects = $this->product->getProjectPairs($productID, $params = 'nodeleted');
$this->view->projectID = $projectID;
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0);
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch);
$this->view->moduleID = $moduleID;
$this->view->branch = $branch;
$this->display();
}
@@ -456,7 +465,7 @@ class bug extends control
if($bug->assignedTo == $this->app->user->account) $this->loadModel('action')->read('bug', $bugID);
/* Set menu. */
$this->bug->setMenu($this->products, $bug->product);
$this->bug->setMenu($this->products, $bug->product, $bug->branch);
/* Get product info. */
$productID = $bug->product;
@@ -472,6 +481,7 @@ class bug extends control
$this->view->productName = $productName;
$this->view->modulePath = $this->tree->getParents($bug->module);
$this->view->bug = $bug;
$this->view->branchName = $this->session->currentProductType == 'normal' ? '' : $this->loadModel('branch')->getById($bug->branch);
$this->view->users = $this->user->getPairs('noletter');
$this->view->actions = $this->action->getList('bug', $bugID);
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
@@ -532,7 +542,7 @@ class bug extends control
$currentModuleID = $bug->module;
/* Set the menu. */
$this->bug->setMenu($this->products, $productID);
$this->bug->setMenu($this->products, $productID, $bug->branch);
/* Set header and position. */
$this->view->title = $this->lang->bug->edit . "BUG #$bug->id $bug->title - " . $this->products[$productID];
@@ -542,13 +552,13 @@ class bug extends control
/* Assign. */
if($projectID)
{
$openedBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, 'noempty,noterminate,nodone');
$allBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, 'noempty');
$openedBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $bug->branch, 'noempty,noterminate,nodone');
$allBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $bug->branch, 'noempty');
}
else
{
$openedBuilds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty,noterminate,nodone');
$allBuilds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty');
$openedBuilds = $this->loadModel('build')->getProductBuildPairs($productID, $bug->branch, 'noempty,noterminate,nodone');
$allBuilds = $this->loadModel('build')->getProductBuildPairs($productID, $bug->branch, 'noempty');
}
/* Set the openedBuilds list*/
@@ -563,10 +573,11 @@ class bug extends control
$this->view->productID = $productID;
$this->view->productName = $this->products[$productID];
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, $bug->branch);
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0);
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $bug->branch);
$this->view->currentModuleID = $currentModuleID;
$this->view->projects = $this->product->getProjectPairs($bug->product);
$this->view->stories = $bug->project ? $this->story->getProjectStoryPairs($bug->project) : $this->story->getProductStoryPairs($bug->product, $bug->branch);
$this->view->branches = $this->session->currentProductType == 'normal' ? array() : $this->loadModel('branch')->getPairs($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->openedBuilds = $openedBuilds;
@@ -584,7 +595,7 @@ class bug extends control
* @access public
* @return void
*/
public function batchEdit($productID = 0)
public function batchEdit($productID = 0, $branch = 0)
{
if($this->post->titles)
{
@@ -623,9 +634,9 @@ class bug extends control
$product = $this->product->getByID($productID);
/* Set product menu. */
$this->bug->setMenu($this->products, $productID);
$this->bug->setMenu($this->products, $productID, $branch);
$this->view->title = $product->name . $this->lang->colon . "BUG" . $this->lang->bug->batchEdit;
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]);
}
/* The bugs of my. */
else
@@ -652,6 +663,7 @@ class bug extends control
$this->view->bugIDList = $bugIDList;
$this->view->productID = $productID;
$this->view->bugs = $bugs;
$this->view->branch = $branch;
$this->view->users = $this->user->getPairs('nodeleted,devfirst');
$this->display();
+58 -14
View File
@@ -43,6 +43,7 @@ function loadAll(productID)
{
$('#taskIdBox').innerHTML = '<select id="task"></select>'; // Reset the task.
$('#task').chosen(defaultChosenOptions);
loadProductBranches(productID)
loadProductModules(productID);
loadProductProjects(productID);
loadProductBuilds(productID);
@@ -51,6 +52,18 @@ function loadAll(productID)
}
}
function loadBranch()
{
$('#taskIdBox').innerHTML = '<select id="task"></select>'; // Reset the task.
$('#task').chosen(defaultChosenOptions);
productID = $('#product').val();
loadProductModules(productID);
loadProductProjects(productID);
loadProductBuilds(productID);
loadProductplans(productID);
loadProductStories(productID);
}
/**
*Load all builds of one project or product.
*
@@ -80,9 +93,11 @@ function loadAllBuilds()
*/
function loadAllProjectBuilds(projectID, productID)
{
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
if(page == 'create') oldOpenedBuild = $('#openedBuild').val() ? $('#openedBuild').val() : 0;
link = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild);
link = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch);
if(page == 'create')
{
$('#buildBox').load(link, function(){ notice(); $('#openedBuild').chosen(defaultChosenOptions);});
@@ -91,7 +106,7 @@ function loadAllProjectBuilds(projectID, productID)
{
$('#openedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
buildLink = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild);
buildLink = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch);
$('#resolvedBuildBox').load(buildLink, function(){$(this).find('select').chosen(defaultChosenOptions)});
}
}
@@ -105,7 +120,9 @@ function loadAllProjectBuilds(projectID, productID)
*/
function loadAllProductBuilds(productID)
{
link = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild);
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
link = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch);
if(page == 'create')
{
$('#buildBox').load(link, function(){ notice(); $('#openedBuild').chosen(defaultChosenOptions);});
@@ -114,7 +131,7 @@ function loadAllProductBuilds(productID)
{
$('#openedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
buildLink = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild);
buildLink = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch);
$('#resolvedBuildBox').load(buildLink, function(){$(this).find('select').chosen(defaultChosenOptions)});
}
}
@@ -128,7 +145,9 @@ function loadAllProductBuilds(productID)
*/
function loadProductModules(productID)
{
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&rootModuleID=0&returnType=html&needManage=true');
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=' + branch + '&rootModuleID=0&returnType=html&needManage=true');
$('#moduleIdBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
}
@@ -141,7 +160,9 @@ function loadProductModules(productID)
*/
function loadProductStories(productID)
{
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=0&moduleId=0&storyID=' + oldStoryID);
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleId=0&storyID=' + oldStoryID);
$('#storyIdBox').load(link, function(){$('#story').chosen(defaultChosenOptions);});
}
@@ -154,7 +175,9 @@ function loadProductStories(productID)
*/
function loadProductProjects(productID)
{
link = createLink('product', 'ajaxGetProjects', 'productID=' + productID + '&projectID=' + oldProjectID);
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
link = createLink('product', 'ajaxGetProjects', 'productID=' + productID + '&projectID=' + oldProjectID + '&branch=' + branch);
$('#projectIdBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
}
@@ -167,7 +190,9 @@ function loadProductProjects(productID)
*/
function loadProductplans(productID)
{
link = createLink('productplan', 'ajaxGetProductplans', 'productID=' + productID);
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
link = createLink('productplan', 'ajaxGetProductplans', 'productID=' + productID + '&branch=' + branch);
$('#planIdBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
}
@@ -180,7 +205,9 @@ function loadProductplans(productID)
*/
function loadProductBuilds(productID)
{
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild);
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch);
if(page == 'create')
{
@@ -189,7 +216,7 @@ function loadProductBuilds(productID)
else
{
$('#openedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild);
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch);
$('#resolvedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
}
}
@@ -240,7 +267,9 @@ function loadProjectTasks(projectID)
*/
function loadProjectStories(projectID)
{
link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=' + $('#product').val() + '&moduleID=0&storyID=' + oldStoryID);
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=' + $('#product').val() + '&branch=' + branch + '&moduleID=0&storyID=' + oldStoryID);
$('#storyIdBox').load(link, function(){$('#story').chosen(defaultChosenOptions);});
}
@@ -253,20 +282,22 @@ function loadProjectStories(projectID)
*/
function loadProjectBuilds(projectID)
{
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
productID = $('#product').val();
if(page == 'create') oldOpenedBuild = $('#openedBuild').val() ? $('#openedBuild').val() : 0;
if(page == 'create')
{
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + "&index=0&needCreate=true");
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + "&branch=" + branch + "&index=0&needCreate=true");
$('#buildBox').load(link, function(){ notice(); $('#openedBuild').chosen(defaultChosenOptions);});
}
else
{
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild);
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch);
$('#openedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild);
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch);
$('#resolvedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
}
}
@@ -293,6 +324,19 @@ function setStories(moduleID, productID)
});
}
function loadProductBranches(productID)
{
$('#branch').remove();
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID), function(data)
{
if(data)
{
$('#product').closest('.input-group').append(data);
$('#branch').css('width', page == 'create' ? '100px' : '65px');
}
})
}
/**
* notice for create build.
*
+1
View File
@@ -14,6 +14,7 @@ $lang->bug->common = 'Bug';
$lang->bug->id = 'Bug编号';
$lang->bug->product = '所属' . $lang->productCommon;
$lang->bug->productplan = '所属计划';
$lang->bug->branch = '所属分支';
$lang->bug->module = '所属模块';
$lang->bug->path = '模块路径';
$lang->bug->project = '所属' . $lang->projectCommon;
+30 -19
View File
@@ -21,10 +21,10 @@ class bugModel extends model
* @access public
* @return void
*/
public function setMenu($products, $productID)
public function setMenu($products, $productID, $branch = 0)
{
$this->loadModel('product')->setMenu($products, $productID);
$selectHtml = $this->product->select($products, $productID, 'bug', 'browse');
$this->loadModel('product')->setMenu($products, $productID, $branch);
$selectHtml = $this->product->select($products, $productID, 'bug', 'browse', '', $branch);
foreach($this->lang->bug->menu as $key => $menu)
{
$replace = ($key == 'product') ? $selectHtml : $productID;
@@ -76,7 +76,7 @@ class bugModel extends model
* @access public
* @return void
*/
public function batchCreate($productID)
public function batchCreate($productID, $branch = 0)
{
$this->loadModel('action');
$now = helper::now();
@@ -84,7 +84,7 @@ class bugModel extends model
$data = fixer::input('post')->get();
$batchNum = count(reset($data));
$result = $this->loadModel('common')->removeDuplicate('bug', $data, "product=$productID");
$result = $this->loadModel('common')->removeDuplicate('bug', $data, "product=$productID&branch=$branch");
$data = $result['data'];
for($i = 0; $i < $batchNum; $i++)
@@ -93,7 +93,7 @@ class bugModel extends model
}
/* Get pairs(moduleID => moduleOwner) for bug. */
$stmt = $this->dbh->query($this->loadModel('tree')->buildMenuQuery($productID, 'bug', $startModuleID = 0));
$stmt = $this->dbh->query($this->loadModel('tree')->buildMenuQuery($productID, 'bug', $startModuleID = 0, $branch));
$moduleOwners = array();
while($module = $stmt->fetch()) $moduleOwners[$module->id] = $module->owner;
@@ -126,6 +126,7 @@ class bugModel extends model
$bug->openedBy = $this->app->user->account;
$bug->openedDate = $now;
$bug->product = $productID;
$bug->branch = $branch;
$bug->module = $data->modules[$i];
$bug->project = $data->projects[$i];
$bug->openedBuild = implode(',', $data->openedBuilds[$i]);
@@ -209,10 +210,11 @@ class bugModel extends model
* @access public
* @return array
*/
public function getModuleBugs($productID, $moduleIds = 0, $projects, $orderBy = 'id_desc', $pager = null)
public function getModuleBugs($productID, $branch, $moduleIds = 0, $projects, $orderBy = 'id_desc', $pager = null)
{
return $this->dao->select('*')->from(TABLE_BUG)
->where('product')->eq((int)$productID)
->beginIF(!empty($branch))->andWhere('branch')->in($branch)->fi()
->beginIF(!empty($moduleIds))->andWhere('module')->in($moduleIds)->fi()
->andWhere('project')->in(array_keys($projects))
->andWhere('deleted')->eq(0)
@@ -1353,13 +1355,13 @@ class bugModel extends model
* @access public
* @return array
*/
public function getAllBugs($productID, $projects, $orderBy, $pager = null)
public function getAllBugs($productID, $branch, $projects, $orderBy, $pager = null)
{
$bugs = $this->dao->select('t1.*, t2.title as planTitle')
->from(TABLE_BUG)->alias('t1')
$bugs = $this->dao->select('t1.*, t2.title as planTitle')->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id')
->where('t1.product')->eq($productID)
->andWhere('t1.project')->in(array_keys($projects))
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy($orderBy)->page($pager)->fetchAll();
@@ -1379,9 +1381,10 @@ class bugModel extends model
* @access public
* @return array
*/
public function getByAssigntome($productID, $projects, $orderBy, $pager)
public function getByAssigntome($productID, $branch, $projects, $orderBy, $pager)
{
return $this->dao->findByAssignedTo($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID)
->beginIF($branch)->andWhere('branch')->in($branch)->fi()
->andWhere('project')->in(array_keys($projects))
->andWhere('deleted')->eq(0)
->orderBy($orderBy)->page($pager)->fetchAll();
@@ -1398,9 +1401,10 @@ class bugModel extends model
* @access public
* @return array
*/
public function getByOpenedbyme($productID, $projects, $orderBy, $pager)
public function getByOpenedbyme($productID, $branch, $projects, $orderBy, $pager)
{
return $this->dao->findByOpenedBy($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID)
->beginIF($branch)->andWhere('branch')->in($branch)->fi()
->andWhere('project')->in(array_keys($projects))
->andWhere('deleted')->eq(0)
->orderBy($orderBy)->page($pager)->fetchAll();
@@ -1417,9 +1421,10 @@ class bugModel extends model
* @access public
* @return array
*/
public function getByResolvedbyme($productID, $projects, $orderBy, $pager)
public function getByResolvedbyme($productID, $branch, $projects, $orderBy, $pager)
{
return $this->dao->findByResolvedBy($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID)
->beginIF($branch)->andWhere('branch')->in($branch)->fi()
->andWhere('project')->in(array_keys($projects))
->andWhere('deleted')->eq(0)
->orderBy($orderBy)->page($pager)->fetchAll();
@@ -1436,10 +1441,11 @@ class bugModel extends model
* @access public
* @return array
*/
public function getByAssigntonull($productID, $projects, $orderBy, $pager)
public function getByAssigntonull($productID, $branch, $projects, $orderBy, $pager)
{
return $this->dao->findByAssignedTo('')->from(TABLE_BUG)->andWhere('product')->eq($productID)
->beginIF($branch)->andWhere('branch')->in($branch)->fi()
->andWhere('project')->in(array_keys($projects))
->andWhere('deleted')->eq(0)
->orderBy($orderBy)->page($pager)->fetchAll();
@@ -1455,10 +1461,11 @@ class bugModel extends model
* @access public
* @return void
*/
public function getUnconfirmed($productID, $projects, $orderBy, $pager)
public function getUnconfirmed($productID, $branch, $projects, $orderBy, $pager)
{
return $this->dao->select('*')->from(TABLE_BUG)
->where('confirmed')->eq(0)
->beginIF($branch)->andWhere('branch')->in($branch)->fi()
->andWhere('product')->eq($productID)
->andWhere('project')->in(array_keys($projects))
->andWhere('deleted')->eq(0)
@@ -1477,11 +1484,12 @@ class bugModel extends model
* @access public
* @return array
*/
public function getByStatus($productID, $projects, $status, $orderBy, $pager)
public function getByStatus($productID, $branch, $projects, $status, $orderBy, $pager)
{
return $this->dao->select('*')->from(TABLE_BUG)
->where('project')->in(array_keys($projects))
->andWhere('product')->eq($productID)
->beginIF($branch)->andWhere('branch')->in($branch)->fi()
->beginIF($status == 'unclosed')->andWhere('status')->ne('closed')->fi()
->beginIF($status == 'unresolved')->andWhere('status')->eq('active')->fi()
->beginIF($status == 'toclosed')->andWhere('status')->eq('resolved')->fi()
@@ -1500,10 +1508,11 @@ class bugModel extends model
* @access public
* @return array
*/
public function getByLonglifebugs($productID, $projects, $orderBy, $pager)
public function getByLonglifebugs($productID, $branch, $projects, $orderBy, $pager)
{
return $this->dao->findByLastEditedDate("<", date(DT_DATE1, strtotime('-7 days')))->from(TABLE_BUG)->andWhere('product')->eq($productID)
->andWhere('project')->in(array_keys($projects))
->beginIF($branch)->andWhere('branch')->in($branch)->fi()
->andWhere('openedDate')->lt(date(DT_DATE1,strtotime('-7 days')))
->andWhere('deleted')->eq(0)
->andWhere('status')->ne('closed')->orderBy($orderBy)->page($pager)->fetchAll();
@@ -1520,9 +1529,10 @@ class bugModel extends model
* @access public
* @return array
*/
public function getByPostponedbugs($productID, $projects, $orderBy, $pager)
public function getByPostponedbugs($productID, $branch, $projects, $orderBy, $pager)
{
return $this->dao->findByResolution('postponed')->from(TABLE_BUG)->andWhere('product')->eq($productID)
->beginIF($branch)->andWhere('branch')->in($branch)->fi()
->andWhere('project')->in(array_keys($projects))
->andWhere('deleted')->eq(0)
->orderBy($orderBy)->page($pager)->fetchAll();
@@ -1539,11 +1549,12 @@ class bugModel extends model
* @access public
* @return array
*/
public function getByNeedconfirm($productID, $projects, $orderBy, $pager)
public function getByNeedconfirm($productID, $branch, $projects, $orderBy, $pager)
{
return $this->dao->select('t1.*, t2.title AS storyTitle')->from(TABLE_BUG)->alias('t1')->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->where("t2.status = 'active'")
->andWhere('t1.product')->eq($productID)
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
->andWhere('t2.version > t1.storyVersion')
->andWhere('t1.project')->in(array_keys($projects))
->andWhere('t1.deleted')->eq(0)
+17 -17
View File
@@ -19,18 +19,18 @@ js::set('moduleID', $moduleID);
<div id='featurebar'>
<ul class='nav'>
<?php
echo "<li id='unclosedTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=unclosed&param=0"), $lang->bug->unclosed) . "</li>";
echo "<li id='allTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=all&param=0&orderBy=$orderBy&recTotal=0&recPerPage=200"), $lang->bug->allBugs) . "</li>";
echo "<li id='assigntomeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=assignToMe&param=0"), $lang->bug->assignToMe) . "</li>";
echo "<li id='openedbymeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=openedByMe&param=0"), $lang->bug->openedByMe) . "</li>";
echo "<li id='resolvedbymeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=resolvedByMe&param=0"), $lang->bug->resolvedByMe) . "</li>";
echo "<li id='unconfirmedTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=unconfirmed&param=0"), $lang->bug->confirmedList[0]) . "</li>";
echo "<li id='assigntonullTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=assignToNull&param=0"), $lang->bug->assignToNull) . "</li>";
echo "<li id='unresolvedTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=unResolved&param=0"), $lang->bug->unResolved) . "</li>";
echo "<li id='toclosedTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=toClosed&param=0"), $lang->bug->toClosed) . "</li>";
echo "<li id='longlifebugsTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=longLifeBugs&param=0"), $lang->bug->longLifeBugs) . "</li>";
echo "<li id='postponedbugsTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=postponedBugs&param=0"), $lang->bug->postponedBugs) . "</li>";
echo "<li id='needconfirmTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=needconfirm&param=0"), $lang->bug->needConfirm) . "</li>";
echo "<li id='unclosedTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=unclosed&param=0"), $lang->bug->unclosed) . "</li>";
echo "<li id='allTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=all&param=0&orderBy=$orderBy&recTotal=0&recPerPage=200"), $lang->bug->allBugs) . "</li>";
echo "<li id='assigntomeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=assignToMe&param=0"), $lang->bug->assignToMe) . "</li>";
echo "<li id='openedbymeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=openedByMe&param=0"), $lang->bug->openedByMe) . "</li>";
echo "<li id='resolvedbymeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=resolvedByMe&param=0"), $lang->bug->resolvedByMe) . "</li>";
echo "<li id='unconfirmedTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=unconfirmed&param=0"), $lang->bug->confirmedList[0]) . "</li>";
echo "<li id='assigntonullTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=assignToNull&param=0"), $lang->bug->assignToNull) . "</li>";
echo "<li id='unresolvedTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=unResolved&param=0"), $lang->bug->unResolved) . "</li>";
echo "<li id='toclosedTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=toClosed&param=0"), $lang->bug->toClosed) . "</li>";
echo "<li id='longlifebugsTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=longLifeBugs&param=0"), $lang->bug->longLifeBugs) . "</li>";
echo "<li id='postponedbugsTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=postponedBugs&param=0"), $lang->bug->postponedBugs) . "</li>";
echo "<li id='needconfirmTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=needconfirm&param=0"), $lang->bug->needConfirm) . "</li>";
echo "<li id='bysearchTab'><a href='#'><i class='icon-search icon'></i>&nbsp;{$lang->bug->byQuery}</a></li> ";
?>
</ul>
@@ -55,8 +55,8 @@ js::set('moduleID', $moduleID);
</div>
<div class='btn-group'>
<?php
common::printIcon('bug', 'batchCreate', "productID=$productID&projectID=0&moduleID=$moduleID");
common::printIcon('bug', 'create', "productID=$productID&extra=moduleID=$moduleID");
common::printIcon('bug', 'batchCreate', "productID=$productID&branch=$branch&projectID=0&moduleID=$moduleID");
common::printIcon('bug', 'create', "productID=$productID&branch=$branch&extra=moduleID=$moduleID");
?>
</div>
</div>
@@ -82,7 +82,7 @@ js::set('moduleID', $moduleID);
<div class='main'>
<form method='post'>
<table class='table table-condensed table-hover table-striped tablesorter table-fixed' id='bugList'>
<?php $vars = "productID=$productID&browseType=$browseType&param=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
<?php $vars = "productID=$productID&branch=$branch&browseType=$browseType&param=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
<thead>
<tr>
<th class='w-id'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
@@ -154,7 +154,7 @@ js::set('moduleID', $moduleID);
common::printIcon('bug', 'resolve', $params, $bug, 'list', '', '', 'iframe', true);
common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true);
common::printIcon('bug', 'edit', $params, $bug, 'list');
common::printIcon('bug', 'create', "product=$bug->product&extra=bugID=$bug->id", $bug, 'list', 'copy');
common::printIcon('bug', 'create', "product=$bug->product&branch=$bug->branch&extra=bugID=$bug->id", $bug, 'list', 'copy');
?>
</td>
<?php endif;?>
@@ -175,7 +175,7 @@ js::set('moduleID', $moduleID);
</div>
<div class='btn-group dropup'>
<?php
$actionLink = $this->createLink('bug', 'batchEdit', "productID=$productID");
$actionLink = $this->createLink('bug', 'batchEdit', "productID=$productID&branch=$branch");
$misc = common::hasPriv('bug', 'batchEdit') ? "onclick=\"setFormAction('$actionLink')\"" : "disabled='disabled'";
echo html::commonButton($lang->edit, $misc);
?>
+4 -1
View File
@@ -32,7 +32,10 @@ js::set('refresh', $lang->refresh);
<tr>
<th class='w-110px'><?php echo $lang->bug->lblProductAndModule;?></th>
<td class='w-p45-f'>
<?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value) class='form-control chosen' autocomplete='off'");?>
<div class='input-group'>
<?php echo html::select('product', $products, $productID, "onchange='loadAll(this.value);' class='form-control chosen' autocomplete='off'");?>
<?php if($this->session->currentProductType != 'normal') echo html::select('branch', $branches, $branch, "onchange='loadBranch()' class='form-control' style='width:100px'");?>
</div>
</td>
<td>
<div class='input-group' id='moduleIdBox'>
+7 -2
View File
@@ -71,12 +71,17 @@ js::set('oldResolvedBuild' , $bug->resolvedBuild);
<table class='table table-form'>
<tr>
<th class='w-80px'><?php echo $lang->bug->product;?></th>
<td><?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value); class='form-control chosen'");?></td>
<td>
<div class='input-group'>
<?php echo html::select('product', $products, $productID, "onchange='loadAll(this.value)' class='form-control chosen'");?>
<?php if($this->session->currentProductType != 'normal') echo html::select('branch', $branches, $bug->branch, "onchange='loadBranch();' class='form-control' style='width:65px'");?>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->bug->module;?></th>
<td>
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID, "onchange='loadModuleRelated()' class='form-control chosen'");?></span>
<div class='input-group' id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID, "onchange='loadModuleRelated()' class='form-control chosen'");?></div>
</td>
</tr>
<tr>
+9 -3
View File
@@ -24,8 +24,8 @@
<?php
$browseLink = $app->session->bugList != false ? $app->session->bugList : inlink('browse', "productID=$bug->product");
$params = "bugID=$bug->id";
$copyParams = "productID=$productID&extras=bugID=$bug->id";
$convertParams = "productID=$productID&moduleID=0&from=bug&bugID=$bug->id";
$copyParams = "productID=$productID&branch=$bug->branch&extras=bugID=$bug->id";
$convertParams = "productID=$productID&branch=$bug->branch&moduleID=0&from=bug&bugID=$bug->id";
if(!$bug->deleted)
{
ob_start();
@@ -36,7 +36,7 @@
common::printIcon('bug', 'close', $params, $bug, 'button', '', '', 'text-danger iframe showinonlybody', true);
common::printIcon('bug', 'activate', $params, $bug, 'button', '', '', 'text-success iframe showinonlybody', true);
common::printIcon('bug', 'toStory', "product=$bug->product&module=0&story=0&project=0&bugID=$bug->id", $bug, 'button', $lang->icons['story']);
common::printIcon('bug', 'toStory', "product=$bug->product&branch=$bug->branch&module=0&story=0&project=0&bugID=$bug->id", $bug, 'button', $lang->icons['story']);
common::printIcon('bug', 'createCase', $convertParams, '', 'button', 'sitemap');
echo '</div>';
@@ -110,6 +110,12 @@
<th class='w-60px'><?php echo $lang->bug->product;?></th>
<td><?php if(!common::printLink('bug', 'browse', "productID=$bug->product", $productName)) echo $productName;?></td>
</tr>
<?php if($this->session->currentProductType != 'normal'):?>
<tr>
<th><?php echo $lang->bug->branch;?></th>
<td><?php if(!common::printLink('bug', 'browse', "productID=$bug->product&branch=$bug->branch", $branchName)) echo $branchName;?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->bug->module;?></th>
<?php