Merge branch 'sprint/170' into 'sprint/170_mayue_branch'

# Conflicts:
#   module/build/view/create.html.php
#   module/project/model.php
This commit is contained in:
李玉春
2021-11-18 05:15:10 +00:00
51 changed files with 271 additions and 138 deletions
+6 -2
View File
@@ -43,6 +43,7 @@ class branch extends control
$this->view->browseType = $browseType;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->view->product = $this->product->getById($productID);
$this->display();
}
@@ -65,6 +66,7 @@ class branch extends control
die(js::reload('parent.parent'));
}
$this->view->product = $this->loadModel('product')->getById($productID);
$this->display();
}
@@ -75,7 +77,7 @@ class branch extends control
* @access public
* @return void
*/
public function edit($branchID)
public function edit($branchID, $productID)
{
if($_POST)
{
@@ -86,7 +88,8 @@ class branch extends control
die(js::reload('parent.parent'));
}
$this->view->branch = $this->branch->getById($branchID, 0, '');
$this->view->product = $this->loadModel('product')->getById($productID);
$this->view->branch = $this->branch->getById($branchID, 0, '');
$this->display();
}
@@ -123,6 +126,7 @@ class branch extends control
if(!in_array($branch->id, $branchIDList)) unset($branchList[$branch->id]);
}
$this->view->product = $this->product->getById($productID);
$this->view->branchList = $branchList;
$this->display();
}
+2
View File
@@ -2,6 +2,8 @@
.c-order {width: 70px;}
.c-check {width: 40px}
a.setDefault {padding-left: 8px !important}
td.flex {display: flex; flex-flow: row nowrap; justify-content: flex-start; align-items: center;}
td.flex .label-primary {min-width: 40px;}
td.flex .setDefault {min-width: 120px;}
+3 -3
View File
@@ -10,12 +10,12 @@ $lang->branch->all = 'All ';
$lang->branch->main = 'Main';
$lang->branch->edit = 'Edit';
$lang->branch->editAction = 'Edit Branch';
$lang->branch->editAction = 'Edit %s';
$lang->branch->activate = 'Activate';
$lang->branch->activateAction = 'Activate Branch';
$lang->branch->close = 'Close';
$lang->branch->closeAction = 'Close Branch';
$lang->branch->create = 'Create Branch';
$lang->branch->create = 'Create %s';
$lang->branch->merge = 'Merge';
$lang->branch->batchEdit = 'Batch Edit';
$lang->branch->defaultBranch = 'Default Branch';
@@ -43,7 +43,7 @@ $lang->branch->confirmActivate = 'Do you want to activate this @branch@?';
$lang->branch->existName = '@branch@ name already exists.';
$lang->branch->noData = 'No branches.';
$lang->branch->mainBranch = 'The default main branch of the product.';
$lang->branch->mainBranch = 'The default main %s of the product.';
$lang->branch->statusList = array();
$lang->branch->statusList['active'] = 'Active';
+5 -5
View File
@@ -10,12 +10,12 @@ $lang->branch->all = '所有';
$lang->branch->main = '主干';
$lang->branch->edit = '编辑';
$lang->branch->editAction = '编辑分支';
$lang->branch->editAction = '编辑%s';
$lang->branch->activate = '激活';
$lang->branch->activateAction = '激活分支';
$lang->branch->close = '关闭';
$lang->branch->closeAction = '关闭分支';
$lang->branch->create = '新增分支';
$lang->branch->create = '新增%s';
$lang->branch->merge = '合并';
$lang->branch->batchEdit = '批量编辑';
$lang->branch->defaultBranch = '默认分支';
@@ -24,11 +24,11 @@ $lang->branch->setDefaultAction = '设置默认分支';
$lang->branch->id = 'ID';
$lang->branch->product = '所属产品';
$lang->branch->name = '分支名称';
$lang->branch->name = '%s名称';
$lang->branch->status = '状态';
$lang->branch->createdDate = '创建时间';
$lang->branch->closedDate = '关闭时间';
$lang->branch->desc = '分支描述';
$lang->branch->desc = '%s描述';
$lang->branch->order = '排序';
$lang->branch->deleted = '已删除';
$lang->branch->closed = '已关闭';
@@ -43,7 +43,7 @@ $lang->branch->confirmActivate = '是否激活该@branch@?';
$lang->branch->existName = '@branch@名称已存在';
$lang->branch->noData = '暂时没有分支。';
$lang->branch->mainBranch = '产品默认主干分支。';
$lang->branch->mainBranch = '产品默认主干%s。';
$lang->branch->statusList = array();
$lang->branch->statusList['active'] = '激活';
+2 -1
View File
@@ -57,6 +57,7 @@ class branchModel extends model
if($browseType == 'closed') return $branchList;
$product = $this->loadModel('product')->getById($productID);
$defaultBranch = BRANCH_MAIN;
foreach($branchList as $branch) $defaultBranch = $branch->default ? $branch->id : $defaultBranch;
@@ -69,7 +70,7 @@ class branchModel extends model
$mainBranch->status = 'active';
$mainBranch->createdDate = '';
$mainBranch->closedDate = '';
$mainBranch->desc = $this->lang->branch->mainBranch;
$mainBranch->desc = sprintf($this->lang->branch->mainBranch, $this->lang->product->branchName[$product->type]);
$mainBranch->order = 0;
return array($mainBranch) + $branchList;
+3 -3
View File
@@ -21,8 +21,8 @@
<thead>
<tr>
<th class='c-id'><?php echo $lang->branch->id;?></th>
<th class='required c-name'><?php echo $lang->branch->name;?></th>
<th class='c-desc'><?php echo $lang->branch->desc;?></th>
<th class='required c-name'><?php echo sprintf($lang->branch->name, $lang->product->branchName[$product->type]);?></th>
<th class='c-desc'><?php echo sprintf($lang->branch->desc, $lang->product->branchName[$product->type]);?></th>
<th class='c-status'><?php echo $lang->branch->status;?></th>
<th class='c-default text-center'><?php echo $lang->branch->defaultBranch;?></th>
</tr>
@@ -31,7 +31,7 @@
<?php foreach($branchList as $branch):?>
<?php $disabled = $branch->id == BRANCH_MAIN ? 'disabled' : '';?>
<tr>
<td><?php echo ($branch->id == BRANCH_MAIN ? '' : $branch->id) . html::hidden("IDList[$branch->id]", $branch);?></td>
<td><?php echo ($branch->id == BRANCH_MAIN ? '' : $branch->id) . html::hidden("IDList[$branch->id]", $branch->id);?></td>
<td><?php echo html::input("name[$branch->id]", $branch->name, "class='form-control chosen' $disabled");?></td>
<td><?php echo html::input("desc[$branch->id]", $branch->desc, "class='form-control' $disabled");?></td>
<td><?php echo html::select("status[$branch->id]", $lang->branch->statusList, $branch->status, "class='form-control' chosen $disabled onchange='canSetDefaultBranch(this)'");?></td>
+3 -3
View File
@@ -13,16 +13,16 @@
<?php include '../../common/view/header.html.php';?>
<div id='mainContent' class='main-content'>
<div class='main-header'>
<h2><?php echo $lang->branch->create;?></h2>
<h2><?php echo sprintf($lang->branch->create, $lang->product->branchName[$product->type]);?></h2>
</div>
<form class='main-form' method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->branch->name;?></th>
<th><?php echo sprintf($lang->branch->name, $lang->product->branchName[$product->type]);?></th>
<td><?php echo html::input('name', '', "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->branch->desc;?></th>
<th><?php echo sprintf($lang->branch->desc, $lang->product->branchName[$product->type]);?></th>
<td><?php echo html::input('desc', '', "class='form-control'");?></td>
</tr>
<tr>
+3 -3
View File
@@ -13,12 +13,12 @@
<?php include '../../common/view/header.html.php';?>
<div id='mainContent' class='main-content'>
<div class='main-header'>
<h2><?php echo $lang->branch->editAction;?></h2>
<h2><?php echo sprintf($lang->branch->editAction, $lang->product->branchName[$product->type]);?></h2>
</div>
<form class='main-form' method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->branch->name;?></th>
<th><?php echo sprintf($lang->branch->name, $lang->product->branchName[$product->type]);?></th>
<td><?php echo html::input('name', $branch->name, "class='form-control'");?></td>
</tr>
<tr>
@@ -26,7 +26,7 @@
<td><?php echo html::select('status', $lang->branch->statusList, $branch->status, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->branch->desc;?></th>
<th><?php echo sprintf($lang->branch->desc, $lang->product->branchName[$product->type]);?></th>
<td><?php echo html::input('desc', $branch->desc, "class='form-control'");?></td>
</tr>
<tr>
+6 -6
View File
@@ -29,7 +29,7 @@
<?php endforeach;?>
</div>
<div class="btn-toolbar pull-right">
<?php if($canCreate) common::printLink('branch', 'create', "productID=$productID", "<i class='icon icon-plus'></i> " . $lang->branch->create, '', "class='btn btn-primary iframe'", true, true);?>
<?php if($canCreate) common::printLink('branch', 'create', "productID=$productID", "<i class='icon icon-plus'></i> " . sprintf($lang->branch->create, $lang->product->branchName[$product->type]), '', "class='btn btn-primary iframe'", true, true);?>
</div>
</div>
<div id="mainContent">
@@ -37,7 +37,7 @@
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->branch->noData;?></span>
<?php if($canCreate) echo html::a($this->createLink('branch', 'create', "productID=$productID", '', true), "<i class='icon icon-plus'></i> " . $lang->branch->create, '', "class='btn btn-info iframe'");?>
<?php if($canCreate) echo html::a($this->createLink('branch', 'create', "productID=$productID", '', true), "<i class='icon icon-plus'></i> " . sprintf($lang->branch->create, $lang->product->branchName[$product->type]), '', "class='btn btn-info iframe'");?>
</p>
</div>
<?php else:?>
@@ -54,11 +54,11 @@
<?php if($canOrder):?>
<th class='c-order sort-default'><?php echo $lang->branch->order;?></th>
<?php endif;?>
<th class='text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->branch->name);?></th>
<th class='text-left'><?php common::printOrderLink('name', $orderBy, $vars, sprintf($lang->branch->name, $lang->product->branchName[$product->type]));?></th>
<th class='c-status'><?php common::printOrderLink('status', $orderBy, $vars, $lang->branch->status);?></th>
<th class='c-date'><?php common::printOrderLink('createdDate', $orderBy, $vars, $lang->branch->createdDate);?></th>
<th class='c-date'><?php common::printOrderLink('closedDate', $orderBy, $vars, $lang->branch->closedDate);?></th>
<th class='c-desc'><?php echo $lang->branch->desc;?></th>
<th class='c-desc'><?php echo sprintf($lang->branch->desc, $lang->product->branchName[$product->type]);?></th>
<th class='c-actions-2'><?php echo $lang->actions;?></th>
</tr>
</thead>
@@ -86,7 +86,7 @@
elseif($branch->status == 'active')
{
$setDefaultLink = helper::createLink('branch', 'setDefault', "productID=$productID&branchID=$branch->id", '', true);
$setDefaultHtml = html::a($setDefaultLink, "<i class='icon icon-hand-right'></i> <span>{$lang->branch->setDefault}</span>", 'hiddenwin', "class='btn btn-icon-left btn-sm setDefault hidden'");
$setDefaultHtml = html::a($setDefaultLink, "<span><i class='icon icon-hand-right'></i> {$lang->branch->setDefault}</span>", 'hiddenwin', "class='btn btn-icon-left btn-sm setDefault hidden'");
echo common::hasPriv('branch', 'setDefault') ? $setDefaultHtml : '';
}
@@ -99,7 +99,7 @@
<td class='c-actions'>
<?php
$disabled = $isMain ? 'disabled' : '';
common::printIcon('branch', 'edit', "branchID=$branch->id", $branch, 'list', '', '', "$disabled iframe", true);
common::printIcon('branch', 'edit', "branchID=$branch->id&productID=$productID", $branch, 'list', '', '', "$disabled iframe", true);
if($branch->status == 'active')
{
common::printIcon('branch', 'close', "branchID=$branch->id", $branch, 'list', 'off', 'hiddenwin', $disabled);
+1 -1
View File
@@ -44,7 +44,7 @@ $config->bug->list->customBatchEditFields = 'type,severity,pri,productplan,ass
$config->bug->custom = new stdclass();
$config->bug->custom->createFields = $config->bug->list->customCreateFields;
$config->bug->custom->batchCreateFields = 'execution,deadline,steps,type,severity,os,browser';
$config->bug->custom->batchCreateFields = 'execution,deadline,steps,type,severity,os,browser,%s';
$config->bug->custom->batchEditFields = 'type,severity,pri,branch,assignedTo,deadline,status,resolvedBy,resolution';
$config->bug->editor = new stdclass();
+22 -3
View File
@@ -203,12 +203,19 @@ class bug extends control
$showModule = !empty($this->config->datatable->bugBrowse->showModule) ? $this->config->datatable->bugBrowse->showModule : '';
$productName = ($productID and isset($this->products[$productID])) ? $this->products[$productID] : $this->lang->product->allProduct;
$product = $this->product->getById($productID);
if($product and $product->type != 'normal')
{
$this->app->loadLang('datatable');
$this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, $this->lang->product->branchName[$product->type]);
}
/* Set view. */
$this->view->title = $productName . $this->lang->colon . $this->lang->bug->common;
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $productName,'','title=' . $productName);
$this->view->position[] = $this->lang->bug->common;
$this->view->productID = $productID;
$this->view->product = $this->product->getById($productID);
$this->view->product = $product;
$this->view->projectProducts = $this->product->getProducts($this->projectID);
$this->view->productName = $productName;
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
@@ -320,7 +327,7 @@ class bug extends control
}
else
{
$this->qa->setMenu($this->products, $productID);
$this->qa->setMenu($this->products, $productID, $branch);
}
foreach($output as $paramKey => $paramValue)
@@ -427,8 +434,9 @@ class bug extends control
/* Get product, then set menu. */
$productID = $this->product->saveState($productID, $this->products);
$product = $this->product->getById($productID);
if($branch === '') $branch = (int)$this->cookie->preBranch;
$branches = $this->session->currentProductType == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID);
$branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID);
/* Init vars. */
$projectID = 0;
@@ -623,6 +631,7 @@ class bug extends control
$this->view->keywords = $keywords;
$this->view->severity = $severity;
$this->view->type = $type;
$this->view->product = $product;
$this->view->branch = $branch;
$this->view->branches = $branches;
$this->view->blockID = $blockID;
@@ -694,6 +703,16 @@ class bug extends control
if($product->type != 'normal') $customFields[$product->type] = $this->lang->product->branchName[$product->type];
$customFields[$field] = $this->lang->bug->$field;
}
if($product->type != 'normal')
{
$this->config->bug->custom->batchCreateFields = sprintf($this->config->bug->custom->batchCreateFields, $product->type);
}
else
{
$this->config->bug->custom->batchCreateFields = trim(sprintf($this->config->bug->custom->batchCreateFields, ''), ',');
}
$showFields = $this->config->bug->custom->batchCreateFields;
if($product->type == 'normal')
{
+2 -1
View File
@@ -2751,7 +2751,8 @@ class bugModel extends model
echo "<span class='$class'>" . zget($this->lang->bug->confirmedList, $bug->confirmed, $bug->confirmed) . "</span> ";
break;
case 'title':
if($bug->branch and isset($branches[$bug->branch])) echo "<span class='label label-outline label-badge'>{$branches[$bug->branch]}</span> ";
$showBranch = isset($this->config->bug->browse->showBranch) ? $this->config->bug->browse->showBranch : 1;
if(isset($branches[$bug->branch]) and $showBranch) echo "<span class='label label-outline label-badge'>{$branches[$bug->branch]}</span> ";
if($bug->module and isset($modulePairs[$bug->module])) echo "<span class='label label-gray label-badge'>{$modulePairs[$bug->module]}</span> ";
echo $canView ? html::a($bugLink, $bug->title, null, "style='color: $bug->color'") : "<span style='color: $bug->color'>{$bug->title}</span>";
break;
+1 -1
View File
@@ -50,7 +50,7 @@ js::set('moduleID', $moduleID);
<td>
<div class='input-group'>
<?php echo html::select('product', $products, $productID, "onchange='loadAll(this.value);' class='form-control chosen control-product'");?>
<?php if($this->session->currentProductType != 'normal' and isset($products[$productID])):?>
<?php if($product->type != 'normal' and isset($products[$productID])):?>
<?php echo html::select('branch', $branches, $branch, "onchange='loadBranch()' class='form-control chosen control-branch'");?>
<?php endif;?>
</div>
+16 -25
View File
@@ -66,25 +66,21 @@ class build extends control
$productGroups = $this->loadModel('product')->getProducts($executionID);
$productID = $productID ? $productID : key($productGroups);
$branchGroups = $this->loadModel('project')->getBranchesByProject($executionID);
$branchPairs = $this->loadModel('branch')->getPairs($productID, 'active');
$branchPairs = $this->loadModel('branch')->getPairs($productID);
$branches = array();
$products = array();
foreach($productGroups as $product)
/* Set branches and products. */
if($productGroups[$productID]->type != 'normal' and isset($branchGroups[$productID]))
{
$products[$product->id] = $product->name;
if(isset($productGroups[$productID]) and $productGroups[$productID]->type != 'normal')
foreach($branchGroups[$productID] as $branchID => $branch)
{
$branches[$product->id] = array();
if(isset($branchGroups[$product->id]))
{
foreach($branchGroups[$product->id] as $branchID => $branch)
{
$branches[$product->id][$branchID] = $branchPairs[$branchID];
}
}
$branches[$branchID] = $branchPairs[$branchID];
}
}
foreach($productGroups as $product) $products[$product->id] = $product->name;
$this->view->title = $this->lang->build->create;
$this->view->position[] = $this->lang->build->create;
@@ -165,27 +161,22 @@ class build extends control
$productGroups[$build->product] = $product;
}
$products = array();
$branchGroups = $this->loadModel('project')->getBranchesByProject($build->execution);
$branchPairs = $this->loadModel('branch')->getPairs($build->product, 'active');
$branchPairs = $this->loadModel('branch')->getPairs($build->product);
$products = array();
$branches = array();
foreach($productGroups as $product)
/* Set branches and products. */
if($productGroups[$build->product]->type != 'normal' and isset($branchGroups[$build->product]))
{
$products[$product->id] = $product->name;
if(isset($productGroups[$build->product]) and $productGroups[$build->product]->type != 'normal')
foreach($branchGroups[$build->product] as $branchID => $branch)
{
$branches[$product->id] = array();
if(isset($branchGroups[$product->id]))
{
foreach($branchGroups[$product->id] as $branchID => $branch)
{
$branches[$product->id][$branchID] = $branchPairs[$branchID];
}
}
$branches[$branchID] = $branchPairs[$branchID];
}
}
foreach($productGroups as $product) $products[$product->id] = $product->name;
$this->view->title = $execution->name . $this->lang->colon . $this->lang->build->edit;
$this->view->position[] = html::a($this->createLink('execution', 'task', "executionID=$build->execution"), $execution->name);
$this->view->position[] = $this->lang->build->edit;
+1
View File
@@ -35,6 +35,7 @@ function loadProducts(executionID)
$('#productBox').append(data);
$('#product').chosen();
loadBranches($("#product").val());
}
});
}
+7 -3
View File
@@ -227,6 +227,8 @@ class buildModel extends model
*/
public function getExecutionBuildPairs($executionID, $productID, $branch = 0, $params = '', $buildIdList = '')
{
$branch = str_replace('0,', '', $branch);
if($branch == 'all') $branch = 0;
$sysBuilds = array();
$selectedBuilds = array();
if(strpos($params, 'noempty') === false) $sysBuilds = array('' => '');
@@ -239,7 +241,7 @@ class buildModel extends model
->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id')
->where('t1.execution')->eq((int)$executionID)
->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi()
->beginIF($branch)->andWhere('t1.branch')->in("0,$branch")->fi()
->andWhere('t1.branch')->eq($branch)->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
@@ -269,6 +271,8 @@ class buildModel extends model
*/
public function getProductBuildPairs($products, $branch = 0, $params = 'noterminate, nodone', $replace = true)
{
$branch = str_replace('0,', '', $branch);
if($branch == 'all') $branch = 0;
$sysBuilds = array();
if(strpos($params, 'noempty') === false) $sysBuilds = array('' => '');
if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => $this->lang->trunk);
@@ -278,7 +282,7 @@ class buildModel extends model
->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build')
->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id')
->where('t1.product')->in($products)
->beginIF($branch)->andWhere('t1.branch')->in("0,$branch")->fi()
->andWhere('t1.branch')->eq($branch)->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
@@ -379,7 +383,7 @@ class buildModel extends model
$buildID = (int)$buildID;
$oldBuild = $this->dao->select('*')->from(TABLE_BUILD)->where('id')->eq($buildID)->fetch();
$build = fixer::input('post')->stripTags($this->config->build->editor->edit['id'], $this->config->allowedTags)
->setIF($this->post->branch === '', 'branch', $oldBuild->branch)
->setIF(!isset($this->post->branch), 'branch', $oldBuild->branch)
->setDefault('product', $oldBuild->product)
->cleanInt('product,branch,execution')
->remove('allchecker,resolvedBy,files,labels,uid')
+1 -1
View File
@@ -32,7 +32,7 @@
<div class='input-group' id='productBox'>
<?php echo html::select('product', $products, empty($product) ? '' : $product->id, "onchange='loadBranches(this.value);' class='form-control chosen' required");?>
<?php
if(!empty($product) and $product->type != 'normal' and isset($branches[$product->id]))
if(!empty($product) and $product->type != 'normal')
{
$branches = $branches[$product->id];
echo "<span class='input-group-addon fix-padding fix-border'></span>" . html::select('branch', $branches, key($product->branches), "class='form-control chosen'");
+1 -2
View File
@@ -33,9 +33,8 @@
<div class='input-group'>
<?php echo html::select('product', $products, $build->product, "onchange='loadBranches(this.value);' class='form-control chosen' $disabled required");?>
<?php
if($build->productType != 'normal' and isset($branches[$build->product]))
if($build->productType != 'normal')
{
$branches = $branches[$build->product];
echo "<span class='input-group-addon fix-padding fix-border'></span>" . html::select('branch', $branches, $build->branch, "class='form-control chosen' $disabled");
}
?>
+12 -5
View File
@@ -1,4 +1,7 @@
<?php $datatableId = $this->moduleName . ucfirst($this->methodName);?>
<?php $currentModule = $this->moduleName;?>
<?php $currentMethod = $this->methodName;?>
<?php $datatableId = $this->moduleName . ucfirst($this->methodName);?>
<style>
#setShowModule {margin-left: 30px;}
</style>
@@ -6,7 +9,7 @@
$(function()
{
<?php if(!empty($setModule)):?>
$('#sidebar .cell .text-center:last').append("<a href='#showModuleModal' data-toggle='modal' class='btn btn-info btn-wide'><?php echo $app->moduleName=='product' ? $lang->datatable->listSetting : $lang->datatable->moduleSetting?></a><hr class='space-sm' />");
$('#sidebar .cell .text-center:last').append("<a href='#showModuleModal' data-toggle='modal' class='btn btn-info btn-wide'><?php echo ($app->tab == 'product' or $app->tab == 'qa') ? $lang->datatable->displaySetting : $lang->datatable->moduleSetting;?></a><hr class='space-sm' />");
<?php endif;?>
var addSettingButton = function()
@@ -37,6 +40,8 @@ $(function()
{
if('<?php echo $this->app->user->account?>' == 'guest') return;
datatableId = '<?php echo $datatableId?>';
currentModule = '<?php echo $currentModule?>';
currentMethod = '<?php echo $currentMethod?>';
var value = $('#showModuleModal input[name="showModule"]:checked').val();
var allModule = $('#showModuleModal input[name="showAllModule"]:checked').val();
var showBranch = $('#showModuleModal input[name="showBranch"]:checked').val();
@@ -53,6 +58,8 @@ $(function()
value: value,
allModule: allModule,
showBranch: showBranch,
currentModule: currentModule,
currentMethod: currentMethod,
},
success:function(){window.location.reload();},
url: '<?php echo $this->createLink('datatable', 'ajaxSave')?>'
@@ -83,7 +90,7 @@ $(function()
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><i class="icon icon-close"></i></button>
<h4 class="modal-title"><i class="icon-cog-outline"></i> <?php echo $app->moduleName=='product' ? $lang->datatable->listSetting : $lang->datatable->moduleSetting;?></h4>
<h4 class="modal-title"><i class="icon-cog-outline"></i> <?php echo ($app->tab == 'product' or $app->tab == 'qa') ? $lang->datatable->displaySetting : $lang->datatable->moduleSetting;?></h4>
</div>
<div class="modal-body">
<form class='form-condensed' method='post' target='hiddenwin' action='<?php echo $this->createLink('datatable', 'ajaxSave')?>'>
@@ -98,10 +105,10 @@ $(function()
<td><?php echo html::radio('showAllModule', $lang->datatable->showAllModuleList, isset($config->execution->task->allModule) ? $config->execution->task->allModule : 0);?></td>
</tr>
<?php endif;?>
<?php if($this->app->tab == 'product' and $app->moduleName == 'product' and $app->methodName == 'browse'):?>
<?php if(!empty($product) and $product->type != 'normal' and ($this->app->tab == 'product' or $this->app->tab == 'qa')):?>
<tr>
<td><?php echo $lang->datatable->showBranch;?></td>
<td><?php echo html::radio('showBranch', $lang->datatable->showBranchList, isset($config->product->browse->showBranch) ? $config->product->browse->showBranch : 1);?></td>
<td><?php echo html::radio('showBranch', $lang->datatable->showBranchList, isset($config->$currentModule->$currentMethod->showBranch) ? $config->$currentModule->$currentMethod->showBranch : 1);?></td>
</tr>
<?php endif;?>
<tr>
+1 -1
View File
@@ -38,7 +38,7 @@ class datatable extends control
$name = 'datatable.' . $this->post->target . '.' . $this->post->name;
$this->loadModel('setting')->setItem($account . '.' . $name, $this->post->value);
if($this->post->allModule !== false) $this->setting->setItem("$account.execution.task.allModule", $this->post->allModule);
if($this->post->showBranch !== false) $this->setting->setItem("$account.product.browse.showBranch", $this->post->showBranch);
if($this->post->showBranch !== false) $this->setting->setItem($account . '.' . $this->post->currentModule . '.' . $this->post->currentMethod . '.showBranch', $this->post->showBranch);
if($this->post->global) $this->setting->setItem('system.' . $name, $this->post->value);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => 'dao error.'));
+1
View File
@@ -18,6 +18,7 @@ $lang->datatable->resetGlobal = 'Globalen Standard zurücksetzen';
$lang->datatable->branch = 'Branch';
$lang->datatable->platform = 'Platform';
$lang->datatable->displaySetting = 'Set list';
$lang->datatable->moduleSetting = 'Set Module';
$lang->datatable->showModule = 'Anzeigen/Verstecken des Modul Names';
$lang->datatable->showAllModule = 'Show product modules';
-1
View File
@@ -19,7 +19,6 @@ $lang->datatable->branch = 'Branch';
$lang->datatable->platform = 'Platform';
$lang->datatable->moduleSetting = 'Set Module';
$lang->datatable->listSetting = 'Set list';
$lang->datatable->showModule = 'Show modules in the list';
$lang->datatable->showBranch = 'Show branches in the list';
$lang->datatable->showAllModule = 'Show product modules';
+1 -1
View File
@@ -18,7 +18,7 @@ $lang->datatable->resetGlobal = 'Réinitialisation Globale';
$lang->datatable->branch = 'Branche';
$lang->datatable->platform = 'Plateforme';
$lang->datatable->moduleSetting = 'Choisir Module';
$lang->datatable->displaySetting = 'Set list';
$lang->datatable->showModule = 'Montrer les noms des modules dans la page de listes';
$lang->datatable->showAllModule = 'Afficher les modules de produits';
$lang->datatable->showModuleList[] = 'N/A';
+1
View File
@@ -18,6 +18,7 @@ $lang->datatable->resetGlobal = 'Thiết lập lại toàn cục';
$lang->datatable->branch = 'Nhánh';
$lang->datatable->platform = 'Platform';
$lang->datatable->displaySetting = 'Set list';
$lang->datatable->moduleSetting = 'Thiết lập Module';
$lang->datatable->showModule = 'Hiện modules theo danh sách';
$lang->datatable->showAllModule = 'Hiện module sản phẩm';
+1 -1
View File
@@ -19,7 +19,7 @@ $lang->datatable->branch = '分支';
$lang->datatable->platform = '平台';
$lang->datatable->moduleSetting = '模块设置';
$lang->datatable->listSetting = '列表设置';
$lang->datatable->displaySetting = '显示设置';
$lang->datatable->showModule = '列表页是否显示模块名';
$lang->datatable->showBranch = '列表页是否显示%s名';
$lang->datatable->showAllModule = '是否显示完整产品模块';
+1
View File
@@ -18,6 +18,7 @@ $lang->datatable->resetGlobal = '全局恢復預設';
$lang->datatable->branch = '分支';
$lang->datatable->platform = '平台';
$lang->datatable->displaySetting = '顯示設定';
$lang->datatable->moduleSetting = '模組設置';
$lang->datatable->showModule = '列表頁是否顯示模組名';
$lang->datatable->showAllModule = '是否顯示完整產品模組';
+3 -3
View File
@@ -1383,7 +1383,7 @@ class execution extends control
$this->view->code = $code;
$this->view->team = $team;
$this->view->teams = array(0 => '') + $this->execution->getTeamPairsByProject((int)$projectID);
$this->view->allProjects = array(0 => '') + $this->project->getPairsByModel();
$this->view->allProjects = array(0 => '') + $this->project->getPairsByModel('all', 0, 'noclosed');
$this->view->executionID = $executionID;
$this->view->productID = $productID;
$this->view->projectID = $projectID;
@@ -1538,7 +1538,7 @@ class execution extends control
$this->view->qdUsers = $qdUsers;
$this->view->rdUsers = $rdUsers;
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
$this->view->allProjects = $this->project->getPairsByModel();
$this->view->allProjects = $this->project->getPairsByModel('all', 0, 'noclosed');
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->allProducts = $allProducts;
$this->view->linkedProducts = $linkedProducts;
@@ -1619,7 +1619,7 @@ class execution extends control
$this->view->position[] = $this->lang->execution->batchEdit;
$this->view->executionIDList = $executionIDList;
$this->view->executions = $executions;
$this->view->allProjects = $this->project->getPairsByModel();
$this->view->allProjects = $this->project->getPairsByModel('all', 0, 'noclosed');
$this->view->pmUsers = $pmUsers;
$this->view->poUsers = $poUsers;
$this->view->qdUsers = $qdUsers;
+6 -7
View File
@@ -365,8 +365,8 @@ class executionModel extends model
$this->dao->insert(TABLE_EXECUTION)->data($sprint)
->autoCheck($skipFields = 'begin,end')
->batchcheck($this->config->execution->create->requiredFields, 'notempty')
->checkIF(!empty($sprint->name), 'name', 'unique', "`type` in ('sprint','stage') and `parent` = $sprint->parent")
->checkIF(!empty($sprint->code), 'code', 'unique', "`type` in ('sprint','stage') and `parent` = $sprint->parent")
->checkIF(!empty($sprint->name), 'name', 'unique', "`type` in ('sprint','stage') and `project` = $sprint->project")
->checkIF(!empty($sprint->code), 'code', 'unique', "`type` in ('sprint','stage')")
->checkIF($sprint->begin != '', 'begin', 'date')
->checkIF($sprint->end != '', 'end', 'date')
->checkIF($sprint->end != '', 'end', 'ge', $sprint->begin)
@@ -519,6 +519,7 @@ class executionModel extends model
->checkIF($execution->begin != '', 'begin', 'date')
->checkIF($execution->end != '', 'end', 'date')
->checkIF($execution->end != '', 'end', 'ge', $execution->begin)
->checkIF(!empty($execution->name), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $execution->project")
->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')")
->where('id')->eq($executionID)
->limit(1)
@@ -624,10 +625,6 @@ class executionModel extends model
if(isset($data->projects)) $executions[$executionID]->project = zget($data->projects, $executionID, 0);
if(isset($data->attributes)) $executions[$executionID]->attribute = zget($data->attributes, $executionID, '');
/* Check unique name for edited executions. */
if(isset($nameList[$executionName])) dao::$errors['name'][] = 'execution#' . $executionID . sprintf($this->lang->error->unique, $this->lang->execution->name, $executionName);
$nameList[$executionName] = $executionName;
/* Check unique code for edited executions. */
if($projectModel == 'scrum' and empty($executionCode))
{
@@ -646,6 +643,7 @@ class executionModel extends model
{
$oldExecution = $oldExecutions[$executionID];
$team = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution');
$projectID = isset($execution->project) ? $execution->project : $oldExecution->project;
$this->dao->update(TABLE_EXECUTION)->data($execution)
->autoCheck($skipFields = 'begin,end')
@@ -653,7 +651,8 @@ class executionModel extends model
->checkIF($execution->begin != '', 'begin', 'date')
->checkIF($execution->end != '', 'end', 'date')
->checkIF($execution->end != '', 'end', 'gt', $execution->begin)
->checkIF(!empty($execution->code), 'code', 'unique', "id NOT " . helper::dbIN($data->executionIDList) . " and type in ('sprint','stage')")
->checkIF(!empty($execution->name), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $projectID")
->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')")
->where('id')->eq($executionID)
->limit(1)
->exec();
+1 -1
View File
@@ -100,7 +100,7 @@
<?php endif;?>
</td>
<td><span class='label-pri <?php echo 'label-pri-' . $bug->pri?>' title='<?php echo zget($lang->bug->priList, $bug->pri, $bug->pri)?>'><?php echo zget($lang->bug->priList, $bug->pri, $bug->pri)?></span></td>
<td class='text-left' title="<?php echo $bug->title?>"><?php echo html::a($viewLink, $bug->title, null, "style='color: $bug->color' data-app={$this->app->tab}");?></td>
<td class='text-left text-ellipsis' title="<?php echo $bug->title?>"><?php echo html::a($viewLink, $bug->title, null, "style='color: $bug->color' data-app={$this->app->tab}");?></td>
<td><?php echo zget($users, $bug->openedBy, $bug->openedBy);?></td>
<td class="text-center <?php echo (isset($bug->delay) and $bug->status == 'active') ? 'delayed' : '';?>"><?php if(substr($bug->deadline, 0, 4) > 0) echo substr($bug->deadline, 5, 6);?></td>
<td class='c-assignedTo has-btn text-left'><?php $this->bug->printAssignedHtml($bug, $users);?></td>
+1 -1
View File
@@ -49,7 +49,7 @@
<td><span class='label-pri <?php echo 'label-pri-' . $case->pri?>' title='<?php echo zget($lang->testcase->priList, $case->pri, $case->pri);?>'><?php echo zget($lang->testcase->priList, $case->pri, $case->pri)?></span></td>
<?php $params = "testcaseID=$caseID&version=$case->version";?>
<?php if($type == 'assigntome') $params .= "&from=testtask&taskID=$case->task";?>
<td class='text-left'><?php echo html::a($this->createLink('testcase', 'view', $params, '', '', $case->project), $case->title, null, "style='color: $case->color' data-app='{$this->app->tab}'");?></td>
<td class='c-title text-left'><?php echo html::a($this->createLink('testcase', 'view', $params, '', '', $case->project), $case->title, null, "style='color: $case->color' data-app='{$this->app->tab}'");?></td>
<td><?php echo zget($lang->testcase->typeList, $case->type);?></td>
<td><?php echo zget($users, $case->openedBy);?></td>
<td><?php echo zget($users, $case->lastRunner);?></td>
+1
View File
@@ -86,6 +86,7 @@ $lang->misc->feature->detailed = 'Detail';
$lang->misc->feature->introduction = 'Features';
$lang->misc->feature->tutorial = 'Tutorial';
$lang->misc->feature->youngBlueTheme = 'Young Blue Theme';
$lang->misc->feature->youngBlueImage = 'theme/default/images/main/new_theme_en.png';
$lang->misc->feature->nextStep = 'Next step';
$lang->misc->feature->close = 'Close';
$lang->misc->feature->downloadFile = 'Download introduction';
+1
View File
@@ -86,6 +86,7 @@ $lang->misc->feature->detailed = '详情';
$lang->misc->feature->introduction = '新功能介绍';
$lang->misc->feature->tutorial = '新手引导教程';
$lang->misc->feature->youngBlueTheme = '全新青春蓝主题';
$lang->misc->feature->youngBlueImage = 'theme/default/images/main/new_theme.png';
$lang->misc->feature->nextStep = '下一步';
$lang->misc->feature->close = '关闭';
$lang->misc->feature->downloadFile = '下载新版本功能介绍文档';
+1 -1
View File
@@ -40,7 +40,7 @@
<?php elseif($feature == 'youngBlueTheme'):?>
<div class='text-center'>
<?php echo $lang->misc->feature->themeDesc;?>
<img class='text-center' src='<?php echo $config->webRoot . 'theme/default/images/main/new_theme.png';?>' />
<img class='text-center' src='<?php echo $config->webRoot . $lang->misc->feature->youngBlueImage;?>' />
</div>
<?php endif;?>
</div>
+38 -11
View File
@@ -210,7 +210,6 @@ class product extends control
$pager = new pager($recTotal, $recPerPage, $pageID);
$product = $this->product->getById($productID);
if($product and $product->type != 'normal')
{
$this->app->loadLang('datatable');
@@ -273,7 +272,6 @@ class product extends control
$this->product->buildSearchForm($productID, $this->products, $queryID, $actionURL);
$showModule = !empty($this->config->datatable->productBrowse->showModule) ? $this->config->datatable->productBrowse->showModule : '';
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'story', $showModule) : array();
$productName = ($this->app->rawModule == 'projectstory' and empty($productID)) ? $this->lang->product->all : $this->products[$productID];
@@ -311,6 +309,7 @@ class product extends control
$this->view->projectProducts = isset($projectProducts) ? $projectProducts : array();
$this->view->storyType = $storyType;
$this->view->from = $this->app->tab;
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'story', $showModule) : array();
$this->display();
}
@@ -971,10 +970,11 @@ class product extends control
* @param bool $needCreate
* @param string $expired
* @param string $from
* @param string $param
* @access public
* @return void
*/
public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false, $expired = '', $from = '')
public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false, $expired = '', $from = '', $param = '')
{
$this->loadModel('productplan');
if($from == 'story' and $branch == BRANCH_MAIN)
@@ -992,15 +992,42 @@ class product extends control
}
$field = $fieldID ? "plans[$fieldID]" : 'plan';
$output = html::select($field, $plans, $planID, "class='form-control chosen'");
if(count($plans) == 1 and $needCreate)
$output = '';
if(strpos($param, 'batchEdit') !== false)
{
$output .= "<div class='input-group-btn'>";
$output .= html::a($this->createLink('productplan', 'create', "productID=$productID&branch=$branch", '', true), "<i class='icon icon-plus'></i>", '', "class='btn btn-icon' data-toggle='modal' data-type='iframe' data-width='95%' title='{$this->lang->productplan->create}'");
$output .= '</div>';
$output .= "<div class='input-group-btn'>";
$output .= html::a("javascript:void(0)", "<i class='icon icon-refresh'></i>", '', "class='btn btn-icon refresh' data-toggle='tooltip' title='{$this->lang->refresh}' onclick='loadProductPlans($productID)'");
$output .= '</div>';
$output = "<div class='table-row'>";
$output .= "<div class='table-col'>";
$output .= html::select($field, $plans, $planID, "class='form-control chosen'");
$output .= "</div>";
if(count($plans) == 1 and $needCreate)
{
$output .= "<div class='table-col'>";
$output .= "<div class='input-group-btn'>";
$output .= html::a($this->createLink('productplan', 'create', "productID=$productID&branch=$branch", '', true), "<i class='icon icon-plus'></i>", '', "class='btn btn-icon' data-toggle='modal' data-type='iframe' data-width='95%' title='{$this->lang->productplan->create}'");
$output .= '</div>';
$output .= '</div>';
$output .= "<div class='table-col'>";
$output .= "<div class='input-group-btn'>";
$output .= html::a("javascript:void(0)", "<i class='icon icon-refresh'></i>", '', "class='btn btn-icon refresh' data-toggle='tooltip' title='{$this->lang->refresh}' onclick='loadProductPlans($productID)'");
$output .= '</div>';
$output .= '</div>';
}
$output .= "</div>";
}
else
{
$output .= html::select($field, $plans, $planID, "class='form-control chosen'");
if(count($plans) == 1 and $needCreate)
{
$output .= "<div class='input-group-btn'>";
$output .= html::a($this->createLink('productplan', 'create', "productID=$productID&branch=$branch", '', true), "<i class='icon icon-plus'></i>", '', "class='btn btn-icon' data-toggle='modal' data-type='iframe' data-width='95%' title='{$this->lang->productplan->create}'");
$output .= '</div>';
$output .= "<div class='input-group-btn'>";
$output .= html::a("javascript:void(0)", "<i class='icon icon-refresh'></i>", '', "class='btn btn-icon refresh' data-toggle='tooltip' title='{$this->lang->refresh}' onclick='loadProductPlans($productID)'");
$output .= '</div>';
}
}
die($output);
}
+1
View File
@@ -35,3 +35,4 @@ a.removeModule:hover {color: red;}
#batchUnlinkStoryTip .table tfoot {position: relative; bottom: -30px;}
#batchUnlinkStoryTip .table td {border-bottom: 0px;}
#batchUnlinkStoryTip .table th:first-child {width: 460px;}
#mainMenu .dropdown-menu>li>a>.icon {top: 4px;}
-2
View File
@@ -1,7 +1,5 @@
$(function()
{
if(productType == 'normal') $('.table-form>tbody>tr').next().addClass('hidden');
if(typeof(rawModule) == 'undefined') rawModule = 'product';
if(rawModule != 'projectstory')
{
+11 -11
View File
@@ -508,7 +508,8 @@ class productModel extends model
if(strpos($storyMethods, "," . $currentMethod . ",") === false) $currentModule = 'product';
if($currentMethod == 'view' or $currentMethod == 'change' or $currentMethod == 'review') $currentMethod = 'browse';
}
if($currentModule == 'testcase' and $currentMethod == 'view') $currentMethod = 'browse';
if($currentModule == 'testcase' and strpos(',view,edit,', ",$currentMethod,") !== false) $currentMethod = 'browse';
if($currentModule == 'bug' and $currentMethod == 'edit') $currentMethod = 'browse';
if($currentMethod == 'report') $currentMethod = 'browse';
$currentProductName = $this->lang->product->common;
@@ -593,7 +594,7 @@ class productModel extends model
$this->dao->insert(TABLE_PRODUCT)->data($product)->autoCheck()
->batchCheck($this->config->product->create->requiredFields, 'notempty')
->checkIF(!empty($product->name), 'name', 'unique', "`program` = $product->program")
->checkIF(!empty($product->code), 'code', 'unique', "`program` = $product->program")
->checkIF(!empty($product->code), 'code', 'unique')
->exec();
if(!dao::isError())
@@ -662,8 +663,8 @@ class productModel extends model
$product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->edit['id'], $this->post->uid);
$this->dao->update(TABLE_PRODUCT)->data($product)->autoCheck()
->batchCheck($this->config->product->edit->requiredFields, 'notempty')
->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $product->program")
->checkIF(!empty($product->code), 'code', 'unique', "id != $productID")
->check('name', 'unique', "id != $productID and deleted = '0'")
->where('id')->eq($productID)
->exec();
@@ -692,6 +693,7 @@ class productModel extends model
$data = fixer::input('post')->get();
$oldProducts = $this->getByIdList($this->post->productIDList);
$nameList = array();
foreach($data->productIDList as $productID)
{
$productName = $data->names[$productID];
@@ -708,10 +710,6 @@ class productModel extends model
$products[$productID]->status = $data->statuses[$productID];
$products[$productID]->desc = strip_tags($this->post->descs[$productID], $this->config->allowedTags);
$products[$productID]->acl = $data->acls[$productID];
/* Check unique name for edited products. */
if(isset($nameList[$productName])) dao::$errors['name'][] = 'product#' . $productID . sprintf($this->lang->error->unique, $this->lang->product->name, $productName);
$nameList[$productName] = $productName;
}
if(dao::isError()) die(js::error(dao::getError()));
@@ -719,12 +717,13 @@ class productModel extends model
foreach($products as $productID => $product)
{
$oldProduct = $oldProducts[$productID];
$programID = !isset($product->program) ? $oldProduct->program : (empty($product->program) ? 0 : $product->program);
$this->dao->update(TABLE_PRODUCT)
->data($product)
->autoCheck()
->batchCheck($this->config->product->edit->requiredFields , 'notempty')
->check('name', 'unique', "id NOT " . helper::dbIN($data->productIDList) . " and deleted='0'")
->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $programID")
->where('id')->eq($productID)
->exec();
if(dao::isError()) die(js::error('product#' . $productID . dao::getError(true)));
@@ -907,15 +906,16 @@ class productModel extends model
}
$this->config->product->search['params']['module']['values'] = $module;
if($this->session->currentProductType == 'normal' or $this->app->tab == 'assetlib')
$productInfo = $this->getById($productID);
if(!$productID or $productInfo->type == 'normal' or $this->app->tab == 'assetlib')
{
unset($this->config->product->search['fields']['branch']);
unset($this->config->product->search['params']['branch']);
}
else
{
$this->config->product->search['fields']['branch'] = $this->lang->product->branch;
$this->config->product->search['params']['branch']['values'] = array('' => '', '0' => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($productID, 'noempty') + array('all' => $this->lang->branch->all);
$this->config->product->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$productInfo->type]);
$this->config->product->search['params']['branch']['values'] = array('' => '', '0' => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($productID, 'noempty');
}
$this->loadModel('search')->setSearchParams($this->config->product->search);
+1 -1
View File
@@ -741,7 +741,7 @@ class programModel extends model
->checkIF($program->begin != '', 'begin', 'date')
->checkIF($program->end != '', 'end', 'date')
->checkIF($program->end != '', 'end', 'gt', $program->begin)
->check('name', 'unique', "id!=$programID and deleted='0' and `type`='program'")
->checkIF(!empty($program->name), 'name', 'unique', "id!=$programID and `type`='program' and `parent` = $program->parent")
->where('id')->eq($programID)
->limit(1)
->exec();
+6 -2
View File
@@ -514,9 +514,12 @@ class project extends control
/* Link the plan stories. */
$newPlans = array();
foreach($_POST['plans'] as $plans)
if(isset($_POST['plans']))
{
foreach($plans as $planID) $newPlans[$planID] = $planID;
foreach($_POST['plans'] as $plans)
{
foreach($plans as $planID) $newPlans[$planID] = $planID;
}
}
$diffResult = array_diff($oldPlans, $newPlans);
@@ -1577,6 +1580,7 @@ class project extends control
$executionIdList = $this->loadModel('execution')->getByProject($projectID);
$url = $this->createLink('project', 'browse');
if($this->app->tab == 'program') $url = $this->createLink('program', 'browse');
if(empty($executionIdList))
{
+16 -11
View File
@@ -621,7 +621,7 @@ class projectModel extends model
* @access public
* @return array
*/
public function getPairsByModel($model = 'all', $programID = 0)
public function getPairsByModel($model = 'all', $programID = 0, $param = '')
{
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProjectPairs();
@@ -629,6 +629,7 @@ class projectModel extends model
->where('type')->eq('project')
->beginIF($programID)->andWhere('parent')->eq($programID)->fi()
->beginIF($model != 'all')->andWhere('model')->eq($model)->fi()
->beginIF(strpos($param, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi()
->andWhere('deleted')->eq('0')
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi()
->orderBy('id_desc')
@@ -832,7 +833,7 @@ class projectModel extends model
->autoCheck()
->batchcheck($requiredFields, 'notempty')
->checkIF(!empty($project->name), 'name', 'unique', "`type`='project' and `parent` = $project->parent")
->checkIF(!empty($project->code), 'code', 'unique', "`type`='project' and `parent` = $project->parent")
->checkIF(!empty($project->code), 'code', 'unique', "`type`='project'")
->checkIF($project->end != '', 'end', 'gt', $project->begin)
->exec();
@@ -1023,8 +1024,8 @@ class projectModel extends model
->checkIF($project->begin != '', 'begin', 'date')
->checkIF($project->end != '', 'end', 'date')
->checkIF($project->end != '', 'end', 'gt', $project->begin)
->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and type='project'")
->check('name', 'unique', "id != $projectID AND type='project' AND deleted='0'")
->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type` = 'project' and `parent` = $project->parent")
->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and `type` = 'project'")
->where('id')->eq($projectID)
->exec();
@@ -1088,10 +1089,6 @@ class projectModel extends model
$projects[$projectID]->lastEditedBy = $this->app->user->account;
$projects[$projectID]->lastEditedDate = helper::now();
/* Check unique name for edited projects. */
if(isset($nameList[$projectName])) dao::$errors['name'][] = 'project#' . $projectID . sprintf($this->lang->error->unique, $this->lang->project->name, $projectName);
$nameList[$projectName] = $projectName;
if($projects[$projectID]->parent)
{
$parentProject = $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($projects[$projectID]->parent)->fetch();
@@ -1111,12 +1108,16 @@ class projectModel extends model
foreach($projects as $projectID => $project)
{
$oldProject = $oldProjects[$projectID];
$parentID = !isset($project->parent) ? $oldProject->parent : $project->parent;
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck($skipFields = 'begin,end')
->batchCheck($this->config->project->edit->requiredFields , 'notempty')
->checkIF($project->begin != '', 'begin', 'date')
->checkIF($project->end != '', 'end', 'date')
->checkIF($project->end != '', 'end', 'gt', $project->begin)
->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type`='project' and `parent` = $parentID")
->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and `type`='project'")
->where('id')->eq($projectID)
->exec();
@@ -1456,9 +1457,13 @@ class projectModel extends model
$class = "c-$id" . (in_array($id, array('budget', 'teamCount', 'estimate', 'consume')) ? ' c-number' : '');
if($id == 'id') $class .= ' cell-id';
if($id == 'code') $title = "title={$project->code}";
if($id == 'code')
{
$class .= ' c-name';
$title = "title={$project->code}";
}
if($id == 'name')
{
$class .= ' text-left';
+1 -1
View File
@@ -44,7 +44,7 @@ $config->story->list->customBatchEditFields = 'branch,plan,estimate,pri,assign
$config->story->custom = new stdclass();
$config->story->custom->createFields = $config->story->list->customCreateFields;
$config->story->custom->batchCreateFields = 'module,branch,platform,plan,spec,pri,estimate,review';
$config->story->custom->batchCreateFields = 'module,plan,spec,pri,estimate,review,%s';
$config->story->custom->batchEditFields = 'branch,module,plan,estimate,pri,source,stage,closedBy,closedReason';
$config->story->datatable = new stdclass();
+10
View File
@@ -475,6 +475,16 @@ class story extends control
if($product->type != 'normal') $customFields[$product->type] = $this->lang->product->branchName[$product->type];
$customFields[$field] = $this->lang->story->$field;
}
if($product->type != 'normal')
{
$this->config->story->custom->batchCreateFields = sprintf($this->config->story->custom->batchCreateFields, $product->type);
}
else
{
$this->config->story->custom->batchCreateFields = trim(sprintf($this->config->story->custom->batchCreateFields, ''), ',');
}
$showFields = $this->config->story->custom->batchCreateFields;
if($product->type == 'normal')
{
+3 -1
View File
@@ -2,9 +2,11 @@
.c-id {width: 40px;}
.c-estimate {width: 50px;}
.c-branch, .c-module {width: 120px;}
.c-plan, .c-title {width: 150px;}
.c-title {width: 150px;}
.c-plan {width: 170px;}
.c-category {width: 90px;}
.c-pri {width: 70px;}
.c-source {width: 130px;}
.c-note, .c-stage, .c-reason {width: 100px;}
.c-keywords {width: 80px;}
#batchEditForm > div > table > tbody > tr > td:nth-child(4) > div > div:nth-child(1) {width: 60%;}
+1 -1
View File
@@ -34,7 +34,7 @@ function loadBranches(product, branch, storyID)
$('#modules' + storyID).parent('td').load(moduleLink, function(){$('#modules' + storyID).chosen();});
planID = $('#plans' + storyID).val();
planLink = createLink('product', 'ajaxGetPlans', 'productID=' + product + '&branch=' + branch + '&planID=' + planID + '&fieldID=' + storyID + '&needCreate=false&expired=&from=story');
planLink = createLink('product', 'ajaxGetPlans', 'productID=' + product + '&branch=' + branch + '&planID=' + planID + '&fieldID=' + storyID + '&needCreate=false&expired=&from=story&param=batchEdit');
$('#plans' + storyID).parent('td').load(planLink, function(){$('#plans' + storyID).chosen();});
}
+3 -7
View File
@@ -2461,10 +2461,6 @@ class storyModel extends model
$storyQuery .= " AND `status` NOT IN ('draft', 'closed')";
}
}
elseif($branch)
{
if($branch and strpos($storyQuery, '`branch` =') === false) $storyQuery .= " AND `branch` = $branch";
}
elseif(strpos($storyQuery, $allBranch) !== false)
{
$storyQuery = str_replace($allBranch, '1', $storyQuery);
@@ -3723,7 +3719,7 @@ class storyModel extends model
$showBranch = isset($this->config->product->browse->showBranch) ? $this->config->product->browse->showBranch : 1;
if($storyType == 'requirement') echo '<span class="label label-badge label-light">SR</span> ';
if($story->parent > 0 and isset($story->parentName)) $story->title = "{$story->parentName} / {$story->title}";
if($story->branch and isset($branches[$story->branch]) and $showBranch) echo "<span class='label label-outline label-badge'>{$branches[$story->branch]}</span> ";
if(isset($branches[$story->branch]) and $showBranch) echo "<span class='label label-outline label-badge'>{$branches[$story->branch]}</span> ";
if($story->module and isset($modulePairs[$story->module])) echo "<span class='label label-gray label-badge'>{$modulePairs[$story->module]}</span> ";
if($story->parent > 0) echo '<span class="label label-badge label-light" title="' . $this->lang->story->children . '">' . $this->lang->story->childrenAB . '</span> ';
echo $canView ? html::a($storyLink, $story->title, '', "style='color: $story->color' data-app='$tab'") : "<span style='color: $story->color'>{$story->title}</span>";
@@ -4017,7 +4013,7 @@ class storyModel extends model
}
else
{
$stories = $this->getProductStories($productID, 0, 0, 'all', 'story', 'id_desc', true, $excludeStories);
$stories = $this->getProductStories($productID, $branch, 0, 'all', 'story', 'id_desc', true, $excludeStories);
}
}
else
@@ -4028,7 +4024,7 @@ class storyModel extends model
}
else
{
$stories = $this->getProductStories($productID, 0, 0, 'all', 'story', 'id_desc', true, $excludeStories, $pager);
$stories = $this->getProductStories($productID, $branch, 0, 'all', 'story', 'id_desc', true, $excludeStories, $pager);
}
}
+1 -1
View File
@@ -29,7 +29,7 @@ $config->testcase->customBatchEditFields = 'module,story,stage,precondition,st
$config->testcase->custom = new stdclass();
$config->testcase->custom->createFields = $config->testcase->customCreateFields;
$config->testcase->custom->batchCreateFields = 'module,story';
$config->testcase->custom->batchCreateFields = 'module,story,%s';
$config->testcase->custom->batchEditFields = 'branch,module,stage,status,pri,story';
global $lang;
+19 -2
View File
@@ -174,7 +174,6 @@ class testcase extends control
$this->testcase->buildSearchForm($productID, $this->products, $queryID, $actionURL);
$showModule = !empty($this->config->datatable->testcaseBrowse->showModule) ? $this->config->datatable->testcaseBrowse->showModule : '';
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'case', $showModule) : array();
/* Get module tree.*/
if($projectID and empty($productID))
@@ -186,13 +185,20 @@ class testcase extends control
$moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createCaseLink'), '', $branch);
}
$product = $this->product->getById($productID);
if($product and $product->type != 'normal')
{
$this->app->loadLang('datatable');
$this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, $this->lang->product->branchName[$product->type]);
}
/* Assign. */
$tree = $moduleID ? $this->tree->getByID($moduleID) : '';
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->common;
$this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]);
$this->view->position[] = $this->lang->testcase->common;
$this->view->productID = $productID;
$this->view->product = $this->product->getById($productID);
$this->view->product = $product;
$this->view->productName = $this->products[$productID];
$this->view->modules = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch);
$this->view->moduleTree = $moduleTree;
@@ -211,6 +217,7 @@ class testcase extends control
$this->view->suiteList = $this->loadModel('testsuite')->getSuites($productID);
$this->view->suiteID = $suiteID;
$this->view->setModule = true;
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'case', $showModule) : array();
$this->display();
}
@@ -536,6 +543,16 @@ class testcase extends control
if($product->type != 'normal') $customFields[$product->type] = $this->lang->product->branchName[$product->type];
$customFields[$field] = $this->lang->testcase->$field;
}
if($product->type != 'normal')
{
$this->config->testcase->custom->batchCreateFields = sprintf($this->config->testcase->custom->batchCreateFields, $product->type);
}
else
{
$this->config->testcase->custom->batchCreateFields = trim(sprintf($this->config->testcase->custom->batchCreateFields, ''), ',');
}
$showFields = $this->config->testcase->custom->batchCreateFields;
if($product->type == 'normal')
{
+2 -1
View File
@@ -1521,7 +1521,8 @@ class testcaseModel extends model
echo "</span>";
break;
case 'title':
if($case->branch) echo "<span class='label label-info label-outline'>{$branches[$case->branch]}</span> ";
$showBranch = isset($this->config->testcase->browse->showBranch) ? $this->config->testcase->browse->showBranch : 1;
if(isset($branches[$case->branch]) and $showBranch) echo "<span class='label label-info label-outline'>{$branches[$case->branch]}</span> ";
if($modulePairs and $case->module and isset($modulePairs[$case->module])) echo "<span class='label label-gray label-badge'>{$modulePairs[$case->module]}</span> ";
echo $canView ? ($fromCaseID ? html::a($caseLink, $case->title, null, "style='color: $case->color' data-app='{$this->app->tab}'") . html::a(helper::createLink('testcase', 'view', "caseID=$fromCaseID"), "[<i class='icon icon-share' title='{$this->lang->testcase->fromCase}'></i>#$fromCaseID]", '', "data-app='{$this->app->tab}'") : html::a($caseLink, $case->title, null, "style='color: $case->color' data-app='{$this->app->tab}'")) : "<span style='color: $case->color'>$case->title</span>";
break;
+18 -1
View File
@@ -372,10 +372,11 @@ class treeModel extends model
{
if($type == 'line') $rootID = 0;
$this->loadModel('branch');
$branches = array($branch => '');
if($branch)
{
$branchName = $this->loadModel('branch')->getById($branch);
$branchName = $this->branch->getById($branch);
$branches = array($branch => $branchName);
$extra = array('rootID' => $rootID, 'branch' => $branch);
}
@@ -386,6 +387,22 @@ class treeModel extends model
{
if($product->type != 'normal') $branches = array(BRANCH_MAIN => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($rootID, 'noempty');
}
elseif($type == 'story' and $this->app->rawModule == 'projectstory')
{
$projectID = zget($extra, 'projectID', 0);
if($product->type != 'normal' and $projectID)
{
$projectBranches = $this->dao->select('branch')->from(TABLE_PROJECTPRODUCT)
->where('project')->eq($projectID)
->andWhere('product')->eq($product->id)
->fetchPairs();
if(isset($projectBranches[BRANCH_MAIN])) $branches = array(BRANCH_MAIN => $this->lang->branch->main);
$branches += $this->dao->select('id, name')->from(TABLE_BRANCH)
->where('id')->in($projectBranches)
->fetchPairs();
}
}
/* Add for task #1945. check the module has case or no. */
if($type == 'case' and !empty($extra)) $this->loadModel('testtask');
+23
View File
@@ -732,6 +732,7 @@ class upgradeModel extends model
case '15_7_1':
$this->saveLogs('Execute 15_7_1');
$this->execSQL($this->getUpgradeFile('15.7.1'));
$this->updateObjectBranch();
$this->updateProjectStories();
$this->appendExec('15_7_1');
}
@@ -5332,6 +5333,28 @@ class upgradeModel extends model
return true;
}
/**
* Update branch when object have module.
*
* @access public
* @return bool
*/
public function updateObjectBranch()
{
$moduleBranchPairs = $this->dao->select('id,branch')->from(TABLE_MODULE)->fetchPairs();
$storyModulePairs = $this->dao->select('module')->from(TABLE_STORY)->where('module')->ne(0)->fetchPairs();
foreach($storyModulePairs as $moduleID) $this->dao->update(TABLE_STORY)->set('`branch`')->eq($moduleBranchPairs[$moduleID])->where('module')->eq($moduleID)->exec();
$bugModulePairs = $this->dao->select('module')->from(TABLE_BUG)->where('module')->ne(0)->fetchPairs();
foreach($bugModulePairs as $moduleID) $this->dao->update(TABLE_BUG)->set('`branch`')->eq($moduleBranchPairs[$moduleID])->where('module')->eq($moduleID)->exec();
$caseModulePairs = $this->dao->select('module')->from(TABLE_CASE)->where('module')->ne(0)->fetchPairs();
foreach($caseModulePairs as $moduleID) $this->dao->update(TABLE_CASE)->set('`branch`')->eq($moduleBranchPairs[$moduleID])->where('module')->eq($moduleID)->exec();
return true;
}
/**
* Update branch of project linked stories.
*
Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB