+ bug: when create a bug, add the build field.

* adjust the user::getPairs() method.
This commit is contained in:
wangchunsheng
2010-01-18 09:44:57 +00:00
parent f8a9a55685
commit b2eb6f13d4
12 changed files with 88 additions and 43 deletions

View File

@@ -106,7 +106,7 @@ class bug extends control
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where($this->session->bugQuery)->andWhere('product')->eq($productID)->orderBy($orderBy)->page($pager)->fetchAll();
}
$users = $this->user->getPairs($this->app->company->id, 'noletter');
$users = $this->user->getPairs('noletter');
$header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->bug->common;
$position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
@@ -142,25 +142,26 @@ class bug extends control
die(js::locate($this->createLink('bug', 'browse', "productID={$this->post->product}&type=byModule&param={$this->post->module}"), 'parent'));
}
/* 设置当前的产品和模块。*/
$productID = common::saveProductState($productID, key($this->products));
$currentModuleID = (int)$moduleID;
/* 设置菜单。*/
$this->bug->setMenu($this->products, $productID);
$header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->bug->create;
$position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
$position[] = $this->lang->bug->create;
/* 位置信息。*/
$this->view->header->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->create;
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = $this->lang->bug->create;
$this->assign('header', $header);
$this->assign('position', $position);
$this->assign('productID', $productID);
$this->assign('productName', $this->products[$productID]);
$this->assign('moduleOptionMenu', $this->tree->getOptionMenu($productID, $viewType = 'bug', $rooteModuleID = 0));
$this->assign('currentModuleID', $currentModuleID);
$this->assign('stories', $this->story->getProductStoryPairs($productID));
$this->assign('users', $this->user->getPairs($this->app->company->id, 'noclosed'));
$this->assign('projects', $this->product->getProjectPairs($productID));
$this->view->productID = $productID;
$this->view->productName = $this->products[$productID];
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $rooteModuleID = 0);
$this->view->currentModuleID = $currentModuleID;
$this->view->stories = $this->story->getProductStoryPairs($productID);
$this->view->users = $this->user->getPairs('noclosed');
$this->view->projects = $this->product->getProjectPairs($productID);
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
$this->display();
}
@@ -178,7 +179,7 @@ class bug extends control
$position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $productName);
$position[] = $this->lang->bug->view;
$users = $this->user->getPairs($this->app->company->id, 'noletter');
$users = $this->user->getPairs('noletter');
$actions = $this->action->getList('bug', $bugID);
$this->assign('header', $header);
$this->assign('position', $position);
@@ -227,7 +228,7 @@ class bug extends control
$stories = $bug->project ? $this->story->getProjectStoryPairs($bug->project) : $this->story->getProductStoryPairs($bug->product);
$tasks = $this->task->getProjectTaskPairs($bug->project);
$users = $this->user->getPairs($this->app->company->id);
$users = $this->user->getPairs();
$this->assign('header', $header);
$this->assign('position', $position);
$this->assign('productID', $productID);
@@ -270,7 +271,7 @@ class bug extends control
/* 设置菜单。*/
$this->bug->setMenu($this->products, $productID);
$users = $this->user->getPairs($this->app->company->id);
$users = $this->user->getPairs();
$this->assign('header', $header);
$this->assign('position', $position);
$this->assign('bug', $bug);
@@ -294,7 +295,7 @@ class bug extends control
/* 生成表单。*/
$bug = $this->bug->getById($bugID);
$productID = $bug->product;
$users = $this->user->getPairs($this->app->company->id);
$users = $this->user->getPairs();
/* 设置菜单。*/
$this->bug->setMenu($this->products, $productID);

View File

@@ -49,7 +49,7 @@ class bugModel extends model
->join('mailto', ',')
->remove('files, labels')
->get();
$this->dao->insert(TABLE_BUG)->data($bug)->autoCheck()->batchCheck('title,type', 'notempty')->exec();
$this->dao->insert(TABLE_BUG)->data($bug)->autoCheck()->batchCheck('title,type,openedBuild', 'notempty')->exec();
if(!dao::isError())
{
$bugID = $this->dao->lastInsertID();

View File

@@ -27,6 +27,7 @@
#project{width:245px}
#product{width:245px}
#story{width:245px}
#openedBuild{width:245px}
</style>
<script language='Javascript'>
/* 当选择产品时,触发这个方法。*/
@@ -35,7 +36,8 @@ function loadAll(productID)
$('#taskIdBox').get(0).innerHTML = ''; // 将taskID内容复位。
loadModuleMenu(productID); // 加载产品的模块列表。
loadProductStories(productID); // 加载产品的需求列表。
loadProjects(productID); // 加载项目列表。
loadProductProjects(productID); // 加载项目列表。
loadProductBuilds(productID); // 加载build列表。
}
/* 加载模块列表。*/
@@ -53,19 +55,27 @@ function loadProductStories(productID)
}
/* 加载项目列表。*/
function loadProjects(productID)
function loadProductProjects(productID)
{
link = createLink('product', 'ajaxGetProjects', 'productID=' + productID);
$('#projectIdBox').load(link);
}
/* 加载产品build列表。*/
function loadProductBuilds(productID)
{
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild');
$('#buildBox').load(link);
}
/* 加载项目的任务列表和需求列表。*/
function loadProjectStoriesAndTasks(projectID)
function loadProjectRelated(projectID)
{
if(projectID)
{
loadProjectTasks(projectID);
loadProjectStories(projectID);
loadProjectBuilds(projectID);
}
else
{
@@ -89,6 +99,12 @@ function loadProjectStories(projectID)
$('#storyIdBox').load(link);
}
/* 加载项目的build列表。*/
function loadProjectBuilds(projectID)
{
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&varName=openedBuild');
$('#buildBox').load(link);
}
</script>
<div class='yui-doc3'>
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
@@ -104,7 +120,7 @@ function loadProjectStories(projectID)
<tr>
<th class='rowhead'><?php echo $lang->bug->labProjectAndTask;?></th>
<td class='a-left'>
<span id='projectIdBox'><?php echo html::select('project', $projects, '', 'onchange=loadProjectStoriesAndTasks(this.value)');?></span>
<span id='projectIdBox'><?php echo html::select('project', $projects, '', 'onchange=loadProjectRelated(this.value)');?></span>
<span id='taskIdBox'></span>
</td>
</tr>
@@ -114,13 +130,12 @@ function loadProjectStories(projectID)
<span id='storyIdBox'><?php echo html::select('story', $stories);?></span>
</td>
</tr>
<!--
<tr>
<th class='rowhead'><?php echo $lang->bug->labBuild;?></th>
<th class='rowhead'><?php echo $lang->bug->openedBuild;?></th>
<td class='a-left'>
<span id='buildBox'><?php echo html::select('openedBuild', $builds);?></span>
</td>
</tr>
-->
<tr>
<th class='rowhead'><?php echo $lang->bug->labTypeAndSeverity;?></th>
<td class='a-left'>

View File

@@ -96,4 +96,17 @@ class build extends control
die(js::locate($this->createLink('project', 'build', "projectID=$build->project"), 'parent'));
}
}
/* AJAX接口获得产品的build列表。*/
public function ajaxGetProductBuilds($productID, $varName)
{
die(html::select($varName, $this->build->getProductBuildPairs($productID)));
}
/* AJAX接口获得项目的build列表。*/
public function ajaxGetProjectBuilds($projectID, $varName)
{
die(html::select($varName, $this->build->getProjectBuildPairs($projectID)));
}
}

View File

@@ -49,10 +49,26 @@ class buildModel extends model
->fetchAll();
}
/* 查找项目中的build key=>value对。*/
public function getProjectBuildPairs($projectID)
{
$sysBuilds = array('' => '', 'trunk' => 'Trunk');
$builds = $this->dao->select('id,name')->from(TABLE_BUILD)->where('project')->eq((int)$projectID)->orderBy('id desc')->fetchPairs();
if(!$builds) return $sysBuilds;
$releases = $this->dao->select('build,name')->from(TABLE_RELEASE)->where('build')->in(array_keys($builds))->fetchPairs();
foreach($releases as $buildID => $releaseName) $builds[$buildID] = $releaseName;
return $sysBuilds + $builds;
}
/* 查找产品中的build列表。*/
public function getProductBuildPairs($productID)
{
return $this->dao->select('id,name')->from(TABLE_BUILD)->where('product')->eq((int)$productID)->fetchPairs();
$sysBuilds = array('' => '', 'trunk' => 'Trunk');
$builds = $this->dao->select('id,name')->from(TABLE_BUILD)->where('product')->eq((int)$productID)->orderBy('id desc')->fetchPairs();
if(!$builds) return $sysBuilds;
$releases = $this->dao->select('build,name')->from(TABLE_RELEASE)->where('build')->in(array_keys($builds))->fetchPairs();
foreach($releases as $buildID => $releaseName) $builds[$buildID] = $releaseName;
return $sysBuilds + $builds;
}
/* 创建。*/

View File

@@ -123,7 +123,7 @@ class group extends control
$group = $this->group->getById($groupID);
$groupUsers = $this->group->getUserPairs($groupID);
$groupUsers = join(',', array_keys($groupUsers));
$allUsers = $this->user->getPairs($this->app->company->id, 'noclosed|noempty|noletter');
$allUsers = $this->user->getPairs('noclosed|noempty|noletter');
$header['title'] = $this->lang->admin->common . $this->lang->colon . $group->name . $this->lang->colon . $this->lang->group->manageMember;
$position[] = html::a($this->createLink('admin', 'browsegroup', "companyid={$this->app->company->id}"), $this->lang->admin->group);

View File

@@ -76,7 +76,7 @@ class my extends control
/* 赋值。*/
$this->view->stories = $this->loadModel('story')->getUserStories($this->app->user->account, 'doing,wait');
$this->view->users = $this->user->getPairs($this->app->company->id, 'noletter');
$this->view->users = $this->user->getPairs('noletter');
$this->display();
}

View File

@@ -97,7 +97,7 @@ class product extends control
$this->assign('moduleTree', $this->tree->getTreeMenu($productID, $viewType = 'product', $rooteModuleID = 0, array('treeModel', 'createStoryLink')));
$this->assign('parentModules', $this->tree->getParents($moduleID));
$this->assign('pager', $pager);
$this->assign('users', $this->user->getPairs($this->app->company->id, 'noletter'));
$this->assign('users', $this->user->getPairs('noletter'));
$this->assign('orderBy', $orderBy);
$this->assign('browseType', $browseType);
$this->assign('moduleID', $moduleID);
@@ -186,6 +186,6 @@ class product extends control
public function ajaxGetProjects($productID, $projectID = 0)
{
$projects = $this->product->getProjectPairs($productID);
die(html::select('project', $projects, $projectID, 'onchange=loadProjectStoriesAndTasks(this.value)'));
die(html::select('project', $projects, $projectID, 'onchange=loadProjectRelated(this.value)'));
}
}

View File

@@ -133,7 +133,7 @@ class project extends control
$pager = new pager($recTotal, $recPerPage, $pageID);
$stories = $this->story->getProjectStories($projectID, $orderBy, $pager);
$storyTasks = $this->task->getStoryTaskCounts(array_keys($stories), $projectID);
$users = $this->user->getPairs($this->app->company->id, 'noletter');
$users = $this->user->getPairs('noletter');
/* 赋值。*/
$this->assign('header', $header);
@@ -170,7 +170,7 @@ class project extends control
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
$bugs = $this->bug->getProjectBugs($projectID, $orderBy, $pager);
$users = $this->user->getPairs($this->app->company->id, 'noletter');
$users = $this->user->getPairs('noletter');
/* 赋值。*/
$this->assign('header', $header);
@@ -421,7 +421,7 @@ class project extends control
$this->loadModel('user');
$project = $this->project->findById($projectID);
$users = $this->user->getPairs($this->app->company->id, 'noclosed');
$users = $this->user->getPairs('noclosed');
$users = array('' => '') + $users;
$members = $this->project->getTeamMembers($projectID);

View File

@@ -82,7 +82,7 @@ class testcase extends control
$this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'case', $rooteModuleID = 0, array('treeModel', 'createCaseLink'));
$this->view->moduleID = $moduleID;
$this->view->pager = $pager;
$this->view->users = $this->user->getPairs($this->app->company->id, 'noletter');
$this->view->users = $this->user->getPairs('noletter');
$this->view->orderBy = $orderBy;
$this->view->browseType = $browseType;
$this->view->param = $param;
@@ -114,7 +114,7 @@ class testcase extends control
$position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]);
$position[] = $this->lang->testcase->create;
$users = $this->user->getPairs($this->app->company->id);
$users = $this->user->getPairs();
$this->assign('header', $header);
$this->assign('position', $position);
$this->assign('productID', $productID);
@@ -140,7 +140,7 @@ class testcase extends control
/* 设置菜单。*/
$this->testcase->setMenu($this->products, $productID);
$users = $this->user->getPairs($this->app->company->id, 'noletter');
$users = $this->user->getPairs('noletter');
$actions = $this->action->getList('case', $caseID);
$this->assign('header', $header);
@@ -184,7 +184,7 @@ class testcase extends control
/* 设置菜单。*/
$this->testcase->setMenu($this->products, $productID);
$users = $this->user->getPairs($this->app->company->id);
$users = $this->user->getPairs();
$this->assign('header', $header);
$this->assign('position', $position);
$this->assign('productID', $productID);

View File

@@ -47,7 +47,7 @@ class user extends control
$user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch();
/* <20><><EFBFBD>ò˵<C3B2><CBB5><EFBFBD>*/
$this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account);
$this->user->setMenu($this->user->getPairs('noempty|noclosed'), $account);
$todos = $this->todo->getList($type, $account, $status);
$date = (int)$type == 0 ? $this->todo->today() : $type;
@@ -79,7 +79,7 @@ class user extends control
$user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch();
/* <20><><EFBFBD>ò˵<C3B2><CBB5><EFBFBD>*/
$this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account);
$this->user->setMenu($this->user->getPairs('noempty|noclosed'), $account);
/* <20>趨header<65><72>position<6F><6E>Ϣ<EFBFBD><CFA2>*/
$header['title'] = $this->lang->user->common . $this->lang->colon . $this->lang->user->task;
@@ -104,7 +104,7 @@ class user extends control
$user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch();
/* <20><><EFBFBD>ò˵<C3B2><CBB5><EFBFBD>*/
$this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account);
$this->user->setMenu($this->user->getPairs('noempty|noclosed'), $account);
/* <20>趨header<65><72>position<6F><6E>Ϣ<EFBFBD><CFA2>*/
$header['title'] = $this->lang->user->common . $this->lang->colon . $this->lang->user->bug;
@@ -129,7 +129,7 @@ class user extends control
$user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch();
/* <20><><EFBFBD>ò˵<C3B2><CBB5><EFBFBD>*/
$this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account);
$this->user->setMenu($this->user->getPairs('noempty|noclosed'), $account);
/* <20>趨header<65><72>position<6F><6E>Ϣ<EFBFBD><CFA2>*/
$header['title'] = $this->lang->user->common . $this->lang->colon . $this->lang->user->project;
@@ -152,7 +152,7 @@ class user extends control
$position[] = $this->lang->user->profile;
/* <20><><EFBFBD>ò˵<C3B2><CBB5><EFBFBD>*/
$this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account);
$this->user->setMenu($this->user->getPairs('noempty|noclosed'), $account);
$this->assign('header', $header);
$this->assign('position', $position);

View File

@@ -44,7 +44,7 @@ class userModel extends model
}
/* <20><><EFBFBD><EFBFBD>account=>realname<6D><65><EFBFBD>б<EFBFBD><D0B1><EFBFBD>params: noletter|noempty|noclosed<65><64>*/
public function getPairs($companyID = 0, $params = '')
public function getPairs($params = '', $companyID = 0)
{
if($companyID == 0) $companyID = $this->app->company->id;
$users = $this->dao->select('account, realname')->from(TABLE_USER)->where('company')->eq((int)$companyID)->orderBy('account')->fetchPairs();