From 36732015096a75d0e7bf009adf0a3c7b9d91bcd2 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 27 Oct 2015 15:03:20 +0800 Subject: [PATCH] * adjust for task #2336. --- config/config.php | 1 + module/action/config.php | 1 + module/action/lang/zh-cn.php | 12 +++++++----- module/branch/control.php | 19 ++++++++++++++---- module/branch/css/manage.css | 1 + module/branch/js/manage.js | 11 +++++++++++ module/branch/lang/zh-cn.php | 2 ++ module/branch/view/manage.html.php | 31 ++++++++++++++++++------------ module/common/lang/zh-cn.php | 1 + module/product/model.php | 1 + 10 files changed, 59 insertions(+), 21 deletions(-) create mode 100644 module/branch/css/manage.css create mode 100644 module/branch/js/manage.js diff --git a/config/config.php b/config/config.php index fef6e3bc31..b45d6b4e70 100644 --- a/config/config.php +++ b/config/config.php @@ -174,6 +174,7 @@ $config->objectTables['doc'] = TABLE_DOC; $config->objectTables['doclib'] = TABLE_DOCLIB; $config->objectTables['todo'] = TABLE_TODO; $config->objectTables['custom'] = TABLE_LANG; +$config->objectTables['branch'] = TABLE_BRANCH; /* Include extension config files. */ $extConfigFiles = glob($configRoot . 'ext/*.php'); diff --git a/module/action/config.php b/module/action/config.php index 004fad5817..576dd76dc6 100755 --- a/module/action/config.php +++ b/module/action/config.php @@ -14,5 +14,6 @@ $config->action->objectNameFields['user'] = 'account'; $config->action->objectNameFields['doc'] = 'title'; $config->action->objectNameFields['doclib'] = 'name'; $config->action->objectNameFields['todo'] = 'name'; +$config->action->objectNameFields['branch'] = 'name'; $config->action->commonImgSize = 870; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index daabd99266..7d02886dfb 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -58,6 +58,7 @@ $lang->action->objectTypes['user'] = '用户'; $lang->action->objectTypes['doc'] = '文档'; $lang->action->objectTypes['doclib'] = '文档库'; $lang->action->objectTypes['todo'] = '待办'; +$lang->action->objectTypes['branch'] = '分支'; /* 用来描述操作历史记录。*/ $lang->action->desc = new stdclass(); @@ -171,11 +172,12 @@ $lang->action->search->objectTypeList['task'] = '任务'; $lang->action->search->objectTypeList['testtask'] = '测试任务'; $lang->action->search->objectTypeList['user'] = '用户'; $lang->action->search->objectTypeList['doc'] = '文档'; -$lang->action->search->objectTypeList['doclib'] = '文档库'; -$lang->action->search->objectTypeList['todo'] = '待办'; -$lang->action->search->objectTypeList['build'] = 'Build'; -$lang->action->search->objectTypeList['release'] = '发布'; -$lang->action->search->objectTypeList['productplan'] = '计划'; +$lang->action->search->objectTypeList['doclib'] = '文档库'; +$lang->action->search->objectTypeList['todo'] = '待办'; +$lang->action->search->objectTypeList['build'] = 'Build'; +$lang->action->search->objectTypeList['release'] = '发布'; +$lang->action->search->objectTypeList['productplan'] = '计划'; +$lang->action->search->objectTypeList['branch'] = '分支'; /* 用来在动态显示中显示动作 */ $lang->action->search->label[''] = ''; diff --git a/module/branch/control.php b/module/branch/control.php index 3e1a3d550e..6f1404c549 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -18,12 +18,15 @@ class branch extends control $this->branch->manage($productID); die(js::reload('parent')); } - $this->view->title = $this->lang->branch->manage; - $this->view->position[] = $this->lang->branch->manage; - $this->loadModel('product')->setMenu($this->product->getPairs('nocode'), $productID); + $products = $this->loadModel('product')->getPairs('nocode'); + $this->product->setMenu($products, $productID); - $this->view->product = $this->product->getById($productID); + $position[] = html::a($this->createLink('product', 'browse', "productID=$productID"), $products[$productID]); + $position[] = $this->lang->branch->manage; + + $this->view->title = $this->lang->branch->manage; + $this->view->position = $position; $this->view->branches = $this->branch->getPairs($productID, 'noempty'); $this->display(); } @@ -56,5 +59,13 @@ class branch extends control $branches = $this->branch->getPairs($productID); die(html::select('branch', $branches, '', "class='form-control' onchange='loadBranch()'")); } + + public function delete($branchID, $confirm = 'no') + { + if($confirm == 'no') die(js::confirm($this->lang->branch->confirmDelete, inlink('delete', "branchID=$branchID&confirm=yes"))); + + $this->branch->delete(TABLE_BRANCH, $branchID); + die(js::reload('parent')); + } } diff --git a/module/branch/css/manage.css b/module/branch/css/manage.css new file mode 100644 index 0000000000..7db96b5b73 --- /dev/null +++ b/module/branch/css/manage.css @@ -0,0 +1 @@ +#branches .input-group{margin-bottom:5px;} diff --git a/module/branch/js/manage.js b/module/branch/js/manage.js new file mode 100644 index 0000000000..215d1a0549 --- /dev/null +++ b/module/branch/js/manage.js @@ -0,0 +1,11 @@ +function addItem() +{ + var $inputgroup = $('#branches .input-group:last'); + $('#branches').append($inputgroup.clone()).find('.input-group:last').find('input').val(''); +} + +function deleteItem(obj) +{ + if($(obj).closest('#branches').find("input[id^='newbranch']").size() <= 1) return; + $(obj).closest('.input-group').remove(); +} diff --git a/module/branch/lang/zh-cn.php b/module/branch/lang/zh-cn.php index 180dd612a0..8fe78bcfa4 100644 --- a/module/branch/lang/zh-cn.php +++ b/module/branch/lang/zh-cn.php @@ -2,3 +2,5 @@ $lang->branch->manage = '分支管理'; $lang->branch->all = '所有'; + +$lang->branch->confirmDelete = '分支删除,会影响关联该分支的需求、模块、计划、发布、Bug、用例等等,请慎重考虑。是否删除改分支?'; diff --git a/module/branch/view/manage.html.php b/module/branch/view/manage.html.php index da4dc294eb..e04b968487 100644 --- a/module/branch/view/manage.html.php +++ b/module/branch/view/manage.html.php @@ -17,26 +17,33 @@
- $branch):?> - + - - - - - - - - - +
+
+ $branch):?> + + + +
+ + + +
+ +
+
- diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 1916a19737..5c37bd1f92 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -320,6 +320,7 @@ $lang->dev->menu = $lang->admin->menu; $lang->menugroup = new stdclass(); $lang->menugroup->release = 'product'; $lang->menugroup->story = 'product'; +$lang->menugroup->branch = 'product'; $lang->menugroup->productplan = 'product'; $lang->menugroup->task = 'project'; $lang->menugroup->build = 'project'; diff --git a/module/product/model.php b/module/product/model.php index dd1af775ef..abe69d628e 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -66,6 +66,7 @@ class productModel extends model $currentProduct = $this->getById($productID); $this->session->set('currentProductType', $currentProduct->type); $output = "{$currentProduct->name}
"; + if($currentProduct->type == 'normal') unset($this->lang->product->menu->branch); if($currentProduct->type != 'normal') { $branches = $this->loadModel('branch')->getPairs($productID);