* adjust for task #2336.

This commit is contained in:
wangyidong
2015-10-27 15:03:20 +08:00
parent 71240b18a7
commit 3673201509
10 changed files with 59 additions and 21 deletions

View File

@@ -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');

View File

@@ -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;

View File

@@ -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[''] = '';

View File

@@ -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'));
}
}

View File

@@ -0,0 +1 @@
#branches .input-group{margin-bottom:5px;}

View File

@@ -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();
}

View File

@@ -2,3 +2,5 @@
$lang->branch->manage = '分支管理';
$lang->branch->all = '所有';
$lang->branch->confirmDelete = '分支删除会影响关联该分支的需求、模块、计划、发布、Bug、用例等等请慎重考虑。是否删除改分支';

View File

@@ -17,26 +17,33 @@
</div>
<form method='post' target='hiddenwin'>
<table class="table table-form">
<?php foreach($branches as $branchID => $branch):?>
<tr>
<td class='w-50px'></td>
<td class="w-200px"><?php echo html::input("branch[$branchID]", $branch, "class='form-control'")?> </td>
<td class="w-300px">
<div id='branches'>
<?php foreach($branches as $branchID => $branch):?>
<div class='input-group'>
<?php echo html::input("branch[$branchID]", $branch, "class='form-control'")?>
<span class='input-group-addon'><a href='javascript:;' onclick='addItem()'><i class='icon icon-plus'></i></a></span>
<span class='input-group-addon'><a href='<?php echo inlink('delete', "branch=$branchID")?>' target='hiddenwin'><i class='icon icon-remove'></i></a></span>
</div>
<?php endforeach;?>
<?php for($i = 0; $i < 2; $i++):?>
<div class='input-group'>
<?php echo html::input("newbranch[]", '', "class='form-control'")?>
<span class='input-group-addon'><a href='javascript:;' onclick='addItem()'><i class='icon icon-plus'></i></a></span>
<span class='input-group-addon'><a href='javascript:;' onclick='deleteItem(this)'><i class='icon icon-remove'></i></a></span>
</div>
<?php endfor;?>
</div>
</td>
<td></td>
</tr>
<?php endforeach;?>
<?php for($i = 0; $i < 5; $i++):?>
<tr>
<td class='w-50px'></td>
<td class="w-200px"><?php echo html::input("newbranch[$i]", '', "class='form-control'")?> </td>
<td></td>
</tr>
<?php endfor;?>
<tr>
<td class='w-50px'></td>
<td class="w-200px"><?php echo html::submitButton()?> </td><td></td>
<td><?php echo html::submitButton() . html::backButton();?> </td><td></td>
</tr>
</table>
</form>
</div>
<?php include '../../common/view/footer.html.php';?>

View File

@@ -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';

View File

@@ -66,6 +66,7 @@ class productModel extends model
$currentProduct = $this->getById($productID);
$this->session->set('currentProductType', $currentProduct->type);
$output = "<a id='currentItem' href=\"javascript:showDropMenu('product', '$productID', '$currentModule', '$currentMethod', '$extra')\">{$currentProduct->name} <span class='icon-caret-down'></span></a><div id='dropMenu'><i class='icon icon-spin icon-spinner'></i></div>";
if($currentProduct->type == 'normal') unset($this->lang->product->menu->branch);
if($currentProduct->type != 'normal')
{
$branches = $this->loadModel('branch')->getPairs($productID);