* Finish task #83215, #83210.

This commit is contained in:
liumengyi
2023-01-30 15:39:20 +08:00
parent 165e7f5bb0
commit 5e179c8b05
5 changed files with 84 additions and 47 deletions
+52 -44
View File
@@ -1630,8 +1630,52 @@ class execution extends control
if($this->app->tab == 'doc') unset($this->lang->doc->menu->execution['subMenu']);
if($this->app->tab == 'project') $this->project->setMenu($projectID);
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
parse_str($extra, $output);
$type = !empty($output['type']) ? $output['type'] : 'sprint';
$name = '';
$code = '';
$team = '';
$products = array();
$whitelist = '';
$acl = 'private';
$plan = new stdClass();
$productPlan = array();
$productPlans = array();
if($copyExecutionID)
{
$copyExecution = $this->dao->select('*')->from(TABLE_EXECUTION)->where('id')->eq($copyExecutionID)->fetch();
$type = $copyExecution->type;
$name = $copyExecution->name;
$code = $copyExecution->code;
$team = $copyExecution->team;
$acl = $copyExecution->acl;
$whitelist = $copyExecution->whitelist;
$projectID = $copyExecution->project;
$project = $this->project->getByID($projectID);
$products = $this->loadModel('product')->getProducts($copyExecutionID);
$branches = $this->project->getBranchesByProject($copyExecutionID);
$plans = $this->loadModel('productplan')->getGroupByProduct(array_keys($products), 'skipParent|unexpired');
$branchGroups = $this->execution->getBranchByProduct(array_keys($products), $projectID);
$linkedBranches = array();
foreach($products as $productIndex => $product)
{
$productPlans[$productIndex] = array();
foreach($branches[$productIndex] as $branchID => $branch)
{
$linkedBranches[$productIndex][$branchID] = $branchID;
$productPlans[$productIndex] += isset($plans[$productIndex][$branchID]) ? $plans[$productIndex][$branchID] : array();
}
}
$this->view->branches = $branches;
$this->view->linkedBranches = $linkedBranches;
}
$project = $this->project->getByID($projectID);
if(!empty($project) and $project->model == 'kanban')
if(!empty($project) and ($project->model == 'kanban' or ($project->model == 'agileplus' and $type == 'kanban')))
{
global $lang;
$executionLang = $lang->execution->common;
@@ -1639,6 +1683,8 @@ class execution extends control
$lang->execution->common = $lang->execution->kanban;
include $this->app->getModulePath('', 'execution') . 'lang/' . $this->app->getClientLang() . '.php';
$lang->execution->common = $executionLang;
$lang->execution->typeList['sprint'] = $lang->execution->common;
}
elseif(!empty($project) and $project->model == 'waterfall')
{
@@ -1647,9 +1693,6 @@ class execution extends control
include $this->app->getModulePath('', 'execution') . 'lang/' . $this->app->getClientLang() . '.php';
}
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
parse_str($extra, $output);
$this->app->loadLang('program');
$this->app->loadLang('stage');
$this->app->loadLang('programplan');
@@ -1694,45 +1737,6 @@ class execution extends control
return $this->display();
}
$name = '';
$code = '';
$team = '';
$products = array();
$whitelist = '';
$acl = 'private';
$plan = new stdClass();
$productPlan = array();
$productPlans = array();
if($copyExecutionID)
{
$copyExecution = $this->dao->select('*')->from(TABLE_EXECUTION)->where('id')->eq($copyExecutionID)->fetch();
$name = $copyExecution->name;
$code = $copyExecution->code;
$team = $copyExecution->team;
$acl = $copyExecution->acl;
$whitelist = $copyExecution->whitelist;
$projectID = $copyExecution->project;
$project = $this->project->getByID($projectID);
$products = $this->loadModel('product')->getProducts($copyExecutionID);
$branches = $this->project->getBranchesByProject($copyExecutionID);
$plans = $this->loadModel('productplan')->getGroupByProduct(array_keys($products), 'skipParent|unexpired');
$branchGroups = $this->execution->getBranchByProduct(array_keys($products), $projectID);
$linkedBranches = array();
foreach($products as $productIndex => $product)
{
$productPlans[$productIndex] = array();
foreach($branches[$productIndex] as $branchID => $branch)
{
$linkedBranches[$productIndex][$branchID] = $branchID;
$productPlans[$productIndex] += isset($plans[$productIndex][$branchID]) ? $plans[$productIndex][$branchID] : array();
}
}
$this->view->branches = $branches;
$this->view->linkedBranches = $linkedBranches;
}
if(!empty($planID))
{
$plan = $this->dao->select('*')->from(TABLE_PRODUCTPLAN)->where('id')->eq($planID)->fetch();
@@ -1894,6 +1898,7 @@ class execution extends control
$this->view->isStage = (isset($project->model) and $project->model == 'waterfall') ? true : false;
$this->view->project = $project;
$this->view->division = !empty($project) ? $project->division : 1;
$this->view->type = $type;
$this->display();
}
@@ -4014,18 +4019,20 @@ class execution extends control
$executionConfig = $this->config->execution;
$projectID = $from == 'project' ? $this->session->project : 0;
$project = $this->project->getByID($projectID);
if($projectID) $this->project->setMenu($projectID);
/* Create field lists. */
$fields = $this->post->exportFields ? $this->post->exportFields : explode(',', $executionConfig->list->exportFields);
foreach($fields as $key => $fieldName)
{
if($fieldName == 'name' and $this->app->tab == 'project' and $project->model == 'agileplus') $fields['method'] = $executionLang->method;
$fieldName = trim($fieldName);
$fields[$fieldName] = zget($executionLang, $fieldName);
unset($fields[$key]);
}
$project = $this->project->getByID($projectID);
$executionStats = $this->execution->getStatData($projectID, $status == 'byproduct' ? 'all' : $status, $productID, 0, false, '', 'id_asc');
if(isset($project->model) and $project->model == 'waterfall')
{
@@ -4052,6 +4059,7 @@ class execution extends control
$execution->totalConsumed = $execution->hours->totalConsumed;
$execution->totalLeft = $execution->hours->totalLeft;
$execution->progress = $execution->hours->progress . '%';
if($this->app->tab == 'project' and $project->model == 'agileplus') $execution->method = zget($executionLang->typeList, $execution->type);
if($this->post->exportType == 'selected')
{
+12
View File
@@ -175,6 +175,18 @@ function refreshPage(projectID)
location.href = createLink('execution', 'create', 'projectID=' + projectID);
}
/**
* Refresh page.
*
* @param object $projectID
* @access public
* @return void
*/
function setType(type)
{
location.href = createLink('execution', 'create', 'projectID=' + projectID + '&executionID=0&copyExecutionID=&planID=0&confirm=no&productID=0&extra=type=' + type);
}
/**
* Cut a string of letters and characters with the same length.
*
+1 -1
View File
@@ -88,7 +88,7 @@
<?php if(isset($project) and $project->model == 'scrum'):?>
<td class='text-left' style='overflow:visible'><?php echo html::select("projects[$executionID]", $allProjects, $executions[$executionID]->project, "class='form-control picker-select' data-lastselected='{$executions[$executionID]->project}' onchange='changeProject(this, $executionID, {$executions[$executionID]->project})'");?></td>
<?php endif;?>
<?php if($app->tab == 'project' and isset($project)):?>
<?php if($app->tab == 'project' and isset($project) and $project->model == 'agileplus'):?>
<td title='<?php echo zget($lang->execution->typeList, $executions[$executionID]->type);?>'><?php echo zget($lang->execution->typeList, $executions[$executionID]->type);?></td>
<?php endif;?>
<td title='<?php echo $executions[$executionID]->name?>'><?php echo html::input("names[$executionID]", $executions[$executionID]->name, "class='form-control'");?></td>
+10 -2
View File
@@ -61,6 +61,14 @@
<td class="col-main"><?php echo html::select("project", $allProjects, $projectID, "class='form-control chosen' required onchange='refreshPage(this.value)'");?></td>
<td colspan='2'></td>
</tr>
<?php if(!empty($project->model) and $project->model == 'agileplus'):?>
<?php unset($lang->execution->typeList['stage'], $lang->execution->typeList['']);?>
<tr>
<th><?php echo $lang->execution->method;?></th>
<td class="col-main"><?php echo html::select("type", $lang->execution->typeList, $type, "class='form-control chosen' required onchange='setType(this.value)'");?></td>
<td colspan='2'></td>
</tr>
<?php endif;?>
<tr>
<th class='w-120px'><?php echo $showExecutionExec ? $lang->execution->execName : $lang->execution->name;?></th>
<td class="col-main"><?php echo html::input('name', $name, "class='form-control' required");?></td>
@@ -92,7 +100,7 @@
</div>
</td><td></td><td></td>
</tr>
<?php if(empty($project) or $project->model != 'kanban'):?>
<?php if((empty($project) or $project->model != 'kanban') and $type != 'kanban'):?>
<tr>
<th><?php echo $showExecutionExec ? $lang->execution->execType : $lang->execution->type;?></th>
<td>
@@ -142,7 +150,7 @@
<div class='table-col'>
<?php $hasBranch = $product->type != 'normal' and isset($branchGroups[$product->id]);?>
<div class='input-group <?php if($hasBranch) echo ' has-branch';?>'>
<span class='input-group-addon'><?php echo $lang->product->common;?></span>
<span class='input-group-addon'><?php echo $lang->product->common;?></span>
<?php $disabled = ($project->model == 'waterfall' and !$project->division) ? "disabled='disabled'" : '';?>
<?php echo html::select("products[$i]", $allProducts, $product->id, "class='form-control chosen' $disabled onchange='loadBranches(this)' data-last='" . $product->id . "' data-type='" . $product->type . "'");?>
<?php if($project->model == 'waterfall' and !$project->division) echo html::hidden("products[$i]", $product->id);?>
+9
View File
@@ -52,6 +52,15 @@
<?php common::printLink('execution', 'export', "status=$status&productID=$productID&orderBy=$orderBy&from=project", "<i class='icon-export muted'> </i> " . $lang->export, '', "class='btn btn-link export'")?>
<?php if(common::hasPriv('programplan', 'create') and $isStage and empty($product->deleted)):?>
<?php echo html::a($this->createLink('programplan', 'create', "projectID=$projectID&productID=$productID"), "<i class='icon icon-plus'></i> " . $lang->programplan->create, '', "class='btn btn-primary'");?>
<?php elseif($project->model == 'agileplus'):?>
<div class="btn-group dropdown">
<?php echo html::a($this->createLink('execution', 'create', "projectID=$projectID"), "<i class='icon icon-sm icon-plus'></i> " . $lang->execution->create, '', "class='btn btn-primary create-execution-btn' data-app='execution' onclick='$(this).removeAttr(\"data-toggle\")'");?>
<button type='button' class='btn btn-primary dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button>
<ul class='dropdown-menu pull-right'>
<li><?php echo html::a($this->createLink('execution', 'create', "projectID=$projectID"), $lang->execution->create);?></li>
<li><?php echo html::a($this->createLink('execution', 'create', "projectID=$projectID&executionID=0&copyExecutionID=&planID=0&confirm=no&productID=0&extra=type=kanban"), $lang->project->createKanban);?></li>
</ul>
</div>
<?php else: ?>
<?php if(common::hasPriv('execution', 'create') and !$isStage) echo html::a($this->createLink('execution', 'create', "projectID=$projectID"), "<i class='icon icon-sm icon-plus'></i> " . $lang->execution->create, '', "class='btn btn-primary create-execution-btn' data-app='execution' onclick='$(this).removeAttr(\"data-toggle\")'");?>
<?php endif;?>