* adjust for branch name by product name.

This commit is contained in:
wangyidong
2015-11-10 10:55:34 +08:00
parent 1df211fdaa
commit a0c97d7e01
13 changed files with 32 additions and 13 deletions

View File

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

View File

@@ -18,9 +18,14 @@ class branchModel extends model
* @access public
* @return string
*/
public function getById($branchID)
public function getById($branchID, $productID = 0)
{
if(empty($branchID)) return $this->lang->branch->all;
if(empty($branchID))
{
if(empty($productID)) $productID = $this->session->product;
$product = $this->loadModel('product')->getById($productID);
return $this->lang->branch->all . $this->lang->product->branchName[$product->type];
}
return $this->dao->select('*')->from(TABLE_BRANCH)->where('id')->eq($branchID)->fetch('name');
}
@@ -35,7 +40,11 @@ class branchModel extends model
public function getPairs($productID, $params = '')
{
$branches = $this->dao->select('*')->from(TABLE_BRANCH)->where('product')->eq($productID)->andWhere('deleted')->eq(0)->orderBy('id_asc')->fetchPairs('id', 'name');
if(strpos($params, 'noempty') === false) $branches = array('0' => $this->lang->branch->all) + $branches;
if(strpos($params, 'noempty') === false)
{
$product = $this->loadModel('product')->getById($productID);
$branches = array('0' => $this->lang->branch->all . $this->lang->product->branchName[$product->type]) + $branches;
}
return $branches;
}
@@ -77,11 +86,12 @@ class branchModel extends model
public function getByProducts($products, $params = '')
{
$branches = $this->dao->select('*')->from(TABLE_BRANCH)->where('product')->in($products)->andWhere('deleted')->eq(0)->fetchAll();
$products = $this->loadModel('product')->getByIdList($products);
$branchGroups = array();
foreach($branches as $branch)
{
if(!isset($branchGroups[$branch->product]) and strpos($params, 'noempty') === false) $branchGroups[$branch->product][0] = $this->lang->branch->all;
if(!isset($branchGroups[$branch->product]) and strpos($params, 'noempty') === false) $branchGroups[$branch->product][0] = $this->lang->branch->all . $this->lang->product->branchName[$products[$branch->product]->type];
$branchGroups[$branch->product][$branch->id] = $branch->name;
}

View File

@@ -13,7 +13,7 @@
<?php include '../../common/view/header.html.php';?>
<div class="container mw-700px">
<div id="titlebar">
<div class="heading"><strong><?php echo $lang->branch->manage?></strong></div>
<div class="heading"><strong><?php printf($lang->branch->manageTitle, $this->lang->product->branchName[$this->session->currentProductType])?></strong></div>
</div>
<form method='post' target='hiddenwin'>
<table class="table table-form">

View File

@@ -51,8 +51,8 @@ class build extends control
$this->view->position[] = $this->lang->build->create;
$this->view->productGroups = $productGroups;
$this->view->products = $products;
$this->view->product = $productGroups[$productID];
$this->view->branches = $productGroups[$productID]->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID);
$this->view->product = isset($productGroups[$productID]) ? $productGroups[$productID] : '';
$this->view->branches = (isset($productGroups[$productID]) and $productGroups[$productID]->type == 'normal') ? array() : $this->loadModel('branch')->getPairs($productID);
$this->view->projectID = $projectID;
$this->view->lastBuild = $this->build->getLast($projectID);
$this->view->users = $this->user->getPairs('nodeleted');

View File

@@ -37,8 +37,10 @@
?>
</div>
</td>
<td></td>
<?php else:?>
<td colspan='2'><?php if(empty($products)) printf($lang->build->noProduct, $this->createLink('project', 'manageproducts', "projectID=$projectID"));?></td>
<?php endif;?>
<td><?php if(empty($products)) printf($lang->build->noProduct, $this->createLink('project', 'manageproducts', "projectID=$projectID"));?></td>
</tr>
<tr>
<th><?php echo $lang->build->name;?></th>

View File

@@ -177,7 +177,7 @@ $lang->product->menu->plan = array('link' => 'Plan|productplan|browse|product
$lang->product->menu->release = array('link' => 'Release|release|browse|productID=%s', 'subModule' => 'release');
$lang->product->menu->roadmap = 'Roadmap|product|roadmap|productID=%s';
$lang->product->menu->doc = array('link' => 'Doc|product|doc|productID=%s', 'subModule' => 'doc');
$lang->product->menu->branch = 'Branch|branch|manage|productID=%s';
$lang->product->menu->branch = '%branch%|branch|manage|productID=%s';
$lang->product->menu->module = 'Modules|tree|browse|productID=%s&view=story';
$lang->product->menu->view = array('link' => 'Info|product|view|productID=%s', 'alias' => 'edit');
$lang->product->menu->project = "{$lang->projectCommon}s|product|project|status=all&productID=%s";

View File

@@ -177,7 +177,7 @@ $lang->product->menu->plan = array('link' => '计划|productplan|browse|produ
$lang->product->menu->release = array('link' => '发布|release|browse|productID=%s', 'subModule' => 'release');
$lang->product->menu->roadmap = '路线图|product|roadmap|productID=%s';
$lang->product->menu->doc = array('link' => '文档|product|doc|productID=%s', 'subModule' => 'doc');
$lang->product->menu->branch = '分支|branch|manage|productID=%s';
$lang->product->menu->branch = '%branch%|branch|manage|productID=%s';
$lang->product->menu->module = '模块|tree|browse|productID=%s&view=story';
$lang->product->menu->view = array('link' => '概况|product|view|productID=%s', 'alias' => 'edit');
$lang->product->menu->project = "{$lang->projectCommon}|product|project|status=all&productID=%s";

View File

@@ -48,6 +48,7 @@ $lang->group->copyOptions['copyPriv'] = 'Copy priviledge';
$lang->group->copyOptions['copyUser'] = 'Copy user';
$lang->group->versions[''] = 'History';
$lang->group->versions['7_4'] = 'Zentao 7.4';
$lang->group->versions['7_3'] = 'Zentao 7.3';
$lang->group->versions['7_2'] = 'Zentao 7.2';
$lang->group->versions['7_1'] = 'Zentao 7.1';

View File

@@ -48,6 +48,7 @@ $lang->group->copyOptions['copyPriv'] = '复制权限';
$lang->group->copyOptions['copyUser'] = '复制用户';
$lang->group->versions[''] = '修改历史';
$lang->group->versions['7_4'] = '禅道7.4';
$lang->group->versions['7_3'] = '禅道7.3';
$lang->group->versions['7_2'] = '禅道7.2';
$lang->group->versions['7_1'] = '禅道7.1';

View File

@@ -90,6 +90,7 @@ $lang->product->typeList['normal'] = 'Normal';
$lang->product->typeList['branch'] = 'Multi branch';
$lang->product->typeList['platform'] = 'Multi platform';
$lang->product->branchName['normal'] = '';
$lang->product->branchName['branch'] = 'Branch';
$lang->product->branchName['platform'] = 'Platform';

View File

@@ -90,6 +90,7 @@ $lang->product->typeList['normal'] = '正常';
$lang->product->typeList['branch'] = '多分支';
$lang->product->typeList['platform'] = '多平台';
$lang->product->branchName['normal'] = '';
$lang->product->branchName['branch'] = '分支';
$lang->product->branchName['platform'] = '平台';

View File

@@ -70,6 +70,7 @@ class productModel extends model
if($currentProduct->type != 'normal')
{
$this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$currentProduct->type]);
$this->lang->product->menu->branch = str_replace('%branch%', $this->lang->product->branchName[$currentProduct->type], $this->lang->product->menu->branch);
$branches = $this->loadModel('branch')->getPairs($productID);
$branchName = isset($branches[$branch]) ? $branches[$branch] : $branches[0];
$output .= '</li><li>';

View File

@@ -626,7 +626,7 @@ class project extends control
$project = $this->commonAction($projectID);
$products = $this->project->getProducts($project->id);
$productID = key($products); // Get the first product for creating bug.
$branchID = $products[$productID]->branch;
$branchID = isset($products[$productID]) ? $products[$productID]->branch : 0;
/* Header and position. */
$title = $project->name . $this->lang->colon . $this->lang->project->bug;
@@ -1535,9 +1535,10 @@ class project extends control
$this->config->product->search['params']['product']['values'] = $products + array('all' => $this->lang->product->allProductsOfProject);
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts($products);
unset($this->lang->story->statusList['draft']);
$this->config->product->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $this->lang->story->statusList);
unset($this->config->product->search['fields']['branch']);
unset($this->config->product->search['params']['branch']);
$this->config->product->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $this->lang->story->statusList);
$this->loadModel('search')->setSearchParams($this->config->product->search);
$title = $project->name . $this->lang->colon . $this->lang->project->linkStory;