+ add the bug default assignedTo feature.
This commit is contained in:
@@ -553,6 +553,13 @@ class bug extends control
|
||||
die(html::select('bug', $bugs, '', 'class=select-1'));
|
||||
}
|
||||
|
||||
/* 获得模块的默认指派人。*/
|
||||
public function ajaxGetModuleOwner($moduleID, $productID = 0)
|
||||
{
|
||||
if($moduleID) die($this->dao->findByID($moduleID)->from(TABLE_MODULE)->fetch('owner'));
|
||||
die($this->dao->findByID($productID)->from(TABLE_PRODUCT)->fetch('bugOwner'));
|
||||
}
|
||||
|
||||
/* 发送邮件。*/
|
||||
private function sendmail($bugID, $actionID)
|
||||
{
|
||||
|
||||
@@ -41,6 +41,7 @@ function loadAll(productID)
|
||||
loadProductStories(productID); // 加载产品的需求列表。
|
||||
loadProductProjects(productID); // 加载项目列表。
|
||||
loadProductBuilds(productID); // 加载build列表。
|
||||
setAssignedTo(); // 设置默认指派人。
|
||||
}
|
||||
|
||||
/* 加载模块列表。*/
|
||||
@@ -103,6 +104,18 @@ function loadProjectStories(projectID)
|
||||
$('#storyIdBox').load(link);
|
||||
}
|
||||
|
||||
/* 设置默认指派者。*/
|
||||
function setAssignedTo()
|
||||
{
|
||||
productID = $('#product').val();
|
||||
moduleID = $('#module').val();
|
||||
link = createLink('bug', 'ajaxGetModuleOwner', 'moduleID=' + moduleID + '&productID=' + productID);
|
||||
$.get(link, function(owner)
|
||||
{
|
||||
$('#assignedTo').val(owner);
|
||||
});
|
||||
}
|
||||
|
||||
/* 加载项目的build列表。*/
|
||||
function loadProjectBuilds(projectID)
|
||||
{
|
||||
@@ -123,7 +136,7 @@ $(function() {
|
||||
<th class='rowhead'><?php echo $lang->bug->lblProductAndModule;?></th>
|
||||
<td>
|
||||
<?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value); class='select-2'");?>
|
||||
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $moduleID, 'class=select-3');?></span>
|
||||
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $moduleID, 'onchange=setAssignedTo();class=select-3');?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -107,12 +107,13 @@ class tree extends control
|
||||
}
|
||||
$this->view->module = $this->tree->getById($moduleID);
|
||||
$this->view->optionMenu = $this->tree->getOptionMenu($this->view->module->root, $this->view->module->type);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
|
||||
|
||||
/* 去掉自己和child。*/
|
||||
$childs = $this->tree->getAllChildId($moduleID);
|
||||
foreach($childs as $childModuleID) unset($this->view->optionMenu[$childModuleID]);
|
||||
|
||||
$this->display();
|
||||
die($this->display());
|
||||
}
|
||||
|
||||
/* 更新排序。*/
|
||||
@@ -154,6 +155,6 @@ class tree extends control
|
||||
public function ajaxGetOptionMenu($productID, $viewType = 'product', $rootModuleID = 0)
|
||||
{
|
||||
$optionMenu = $this->tree->getOptionMenu($productID, $viewType, $rootModuleID);
|
||||
die( html::select("module", $optionMenu));
|
||||
die( html::select("module", $optionMenu, '', 'onchange=setAssignedTo()'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ $lang->tree->manageCase = "维护用例视图模块";
|
||||
$lang->tree->updateOrder = "更新排序";
|
||||
$lang->tree->manageChild = "维护子模块";
|
||||
$lang->tree->child = "子模块";
|
||||
$lang->tree->owner = "负责人";
|
||||
$lang->tree->ajaxGetOptionMenu = "接口:获取下拉列表";
|
||||
|
||||
$lang->tree->confirmDelete = "您确定删除该模块吗?";
|
||||
|
||||
@@ -150,7 +150,10 @@ class treeModel extends model
|
||||
/* 生成模块编辑链接。*/
|
||||
private function createManageLink($module)
|
||||
{
|
||||
static $users;
|
||||
if(empty($users)) $users = $this->loadModel('user')->getPairs('noletter');
|
||||
$linkHtml = $module->name;
|
||||
if($module->type == 'bug' and $module->owner) $linkHtml .= '<span class="owner">[' . $users[$module->owner] . ']</span>';
|
||||
if(common::hasPriv('tree', 'edit')) $linkHtml .= ' ' . html::a(helper::createLink('tree', 'edit', "module={$module->id}"), $this->lang->tree->edit, '', 'class="iframe"');
|
||||
if(common::hasPriv('tree', 'browse')) $linkHtml .= ' ' . html::a(helper::createLink('tree', 'browse', "root={$module->root}&type={$module->type}&module={$module->id}"), $this->lang->tree->child);
|
||||
if(common::hasPriv('tree', 'delete')) $linkHtml .= ' ' . html::a(helper::createLink('tree', 'delete', "root={$module->root}&module={$module->id}"), $this->lang->delete, 'hiddenwin');
|
||||
@@ -256,11 +259,14 @@ class treeModel extends model
|
||||
public function update($moduleID)
|
||||
{
|
||||
$module = fixer::input('post')->specialChars('name')->get();
|
||||
$self = $this->getById($moduleID);
|
||||
$parent = $this->getById($this->post->parent);
|
||||
$childs = $this->getAllChildId($moduleID);
|
||||
$module->grade = $parent ? $parent->grade + 1 : 1;
|
||||
$this->dao->update(TABLE_MODULE)->data($module)->autoCheck()->check('name', 'notempty')->where('id')->eq($moduleID)->exec();
|
||||
$this->dao->update(TABLE_MODULE)->set('grade = grade + 1')->where('id')->in($childs)->andWhere('id')->ne($moduleID)->exec();
|
||||
$this->dao->update(TABLE_MODULE)->set('owner')->eq($this->post->owner)->where('id')->in($childs)->andWhere('owner')->eq('')->exec();
|
||||
$this->dao->update(TABLE_MODULE)->set('owner')->eq($this->post->owner)->where('id')->in($childs)->andWhere('owner')->eq($self->owner)->exec();
|
||||
$this->fixModulePath();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,12 +30,16 @@
|
||||
<caption><?php echo $lang->tree->edit;?></caption>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->tree->parent;?></th>
|
||||
<td><?php echo html::select('parent', $optionMenu, $module->parent, "class='text-1'");?></td>
|
||||
<td><?php echo html::select('parent', $optionMenu, $module->parent, "class='select-1'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->tree->name;?></th>
|
||||
<td><?php echo html::input('name', $module->name, "class='text-1'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->tree->owner;?></th>
|
||||
<td><?php echo html::select('owner', $users, $module->owner, "class='select-1'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='a-center'>
|
||||
<?php echo html::submitButton();?>
|
||||
|
||||
Reference in New Issue
Block a user