From 51dbbeb9fbef714c18f6a5ab005852b1abdc1a8f Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Mon, 26 Jul 2010 09:09:34 +0000 Subject: [PATCH] + add the bug default assignedTo feature. --- trunk/module/bug/control.php | 7 +++++++ trunk/module/bug/view/create.html.php | 15 ++++++++++++++- trunk/module/tree/control.php | 5 +++-- trunk/module/tree/lang/zh-cn.php | 1 + trunk/module/tree/model.php | 6 ++++++ trunk/module/tree/view/edit.html.php | 6 +++++- 6 files changed, 36 insertions(+), 4 deletions(-) diff --git a/trunk/module/bug/control.php b/trunk/module/bug/control.php index 96d1c740eb..ed02b55245 100644 --- a/trunk/module/bug/control.php +++ b/trunk/module/bug/control.php @@ -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) { diff --git a/trunk/module/bug/view/create.html.php b/trunk/module/bug/view/create.html.php index 3a3b686479..1314ec0419 100644 --- a/trunk/module/bug/view/create.html.php +++ b/trunk/module/bug/view/create.html.php @@ -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() { bug->lblProductAndModule;?> - + diff --git a/trunk/module/tree/control.php b/trunk/module/tree/control.php index 9deb75f1a2..3f7367eee6 100644 --- a/trunk/module/tree/control.php +++ b/trunk/module/tree/control.php @@ -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()')); } } diff --git a/trunk/module/tree/lang/zh-cn.php b/trunk/module/tree/lang/zh-cn.php index ca2c216809..d3a6d68dd6 100644 --- a/trunk/module/tree/lang/zh-cn.php +++ b/trunk/module/tree/lang/zh-cn.php @@ -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 = "您确定删除该模块吗?"; diff --git a/trunk/module/tree/model.php b/trunk/module/tree/model.php index 2b0c30c50e..57b52a76a8 100644 --- a/trunk/module/tree/model.php +++ b/trunk/module/tree/model.php @@ -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 .= '[' . $users[$module->owner] . ']'; 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(); } diff --git a/trunk/module/tree/view/edit.html.php b/trunk/module/tree/view/edit.html.php index c9f498d0ed..e5ec32ef03 100644 --- a/trunk/module/tree/view/edit.html.php +++ b/trunk/module/tree/view/edit.html.php @@ -30,12 +30,16 @@ tree->edit;?> tree->parent;?> - parent, "class='text-1'");?> + parent, "class='select-1'");?> tree->name;?> name, "class='text-1'");?> + + tree->owner;?> + owner, "class='select-1'");?> +