* Code for task#45536.

This commit is contained in:
xieqiyu
2021-12-10 10:57:56 +08:00
parent 821fd3644c
commit ad8ed52f22
16 changed files with 78 additions and 29 deletions
+1 -1
View File
@@ -216,7 +216,7 @@ class company extends control
$this->view->products = $products;
/* Get projects' list.*/
$projects = $this->loadModel('project')->getPairsByProgram(0);
$projects = $this->loadModel('project')->getPairsByProgram();
$this->view->projects = array($this->lang->company->project) + $projects;;
/* Get executions' list.*/
+1 -1
View File
@@ -2025,7 +2025,7 @@ class execution extends control
public function executionKanban()
{
$this->loadModel('project');
$projects = $this->project->getPairsByProgram(0, 'noclosed');
$projects = $this->project->getPairsByProgram('', 'noclosed');
$executions = $this->project->getStats(0, 'all', 0, 0, 30, 'id_desc');
$teams = $this->dao->select('root,account')->from(TABLE_TEAM)
+1 -1
View File
@@ -142,7 +142,7 @@ class group extends control
$this->view->group = $group;
$this->view->programs = $this->loadModel('program')->getPairs(true, 'order_desc');
$this->view->projects = $this->loadModel('project')->getPairsByProgram(0, 'all', true, 'order_desc');
$this->view->projects = $this->loadModel('project')->getPairsByProgram('', 'all', true, 'order_desc');
$this->view->executions = $this->loadModel('execution')->getPairs(0, 'all', 'all');
$this->view->products = $this->loadModel('product')->getPairs();
+1 -1
View File
@@ -720,7 +720,7 @@ class my extends control
$this->view->pager = $pager;
$this->view->ncs = $this->my->getNcList($browseType, $orderBy, $pager);
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
$this->view->projects = $this->loadModel('project')->getPairsByProgram(0);
$this->view->projects = $this->loadModel('project')->getPairsByProgram();
$this->view->mode = 'nc';
$this->display();
}
+4 -3
View File
@@ -90,15 +90,16 @@ class product extends control
/* Get PM id list. */
$accounts = array();
$projectStats = $this->product->getProjectStatsByProduct($productID, $status, $branch, $involved, $orderBy);
$product = $this->product->getByID($productID);
$projects = $this->project->getPairsByProgram($product->program, 'all', false, 'order_asc');
foreach($projectStats as $project)
{
if(!empty($project->PM) and !in_array($project->PM, $accounts)) $accounts[] = $project->PM;
unset($projects[$project->id]);
}
$PMList = $this->user->getListByAccounts($accounts, 'account');
$product = $this->product->getByID($productID);
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->product->project;
$this->view->position[] = $this->products[$productID];
$this->view->position[] = $this->lang->product->project;
@@ -106,7 +107,7 @@ class product extends control
$this->view->PMList = $PMList;
$this->view->productID = $productID;
$this->view->product = $product;
$this->view->projects = $this->project->getPairsByProgram($product->program);
$this->view->projects = $projects;
$this->view->status = $status;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->branchID = $branch;
+26 -6
View File
@@ -9,14 +9,34 @@ $(function()
$('#saveButton').on('click', function()
{
var projectID = $('#project').val();
var productID = $('#product').val();
var branchID = $('#branch').val();
var selectProjectID = $('#project').val();
var currentProductID = $('#product').val();
var currentBranchID = $('#branch').val();
$.post(createLink('project', 'manageProducts', 'projectID=' + projectID), {'products[]' : [productID], 'branch[]' : [branchID]});
$.get(createLink('project', 'ajaxGetLinkedProductsWithBranch', 'projectID=' + selectProjectID), function(product)
{
var products = [];
var branches = [];
$('#link2Project').modal('hide');
window.location.reload();
var linkedProducts = JSON.parse(product);
for(var productID in linkedProducts)
{
for(var branchID in linkedProducts[productID])
{
products.push(productID);
branches.push(branchID);
}
}
products.push(currentProductID);
branches.push(currentBranchID);
$.post(createLink('project', 'manageProducts', 'projectID=' + selectProjectID), {'products' : products, 'branch' : branches}, function()
{
$('#link2Project').modal('hide');
window.location.reload();
});
});
});
});
+5 -4
View File
@@ -33,10 +33,11 @@ $lang->product->changeProgram = "{$lang->productCommon} confirmation of the sc
$lang->product->addWhitelist = 'Add Whitelist';
$lang->product->unbindWhitelist = 'Unbind Whitelist';
$lang->product->indexAction = "All {$lang->productCommon}";
$lang->product->closeAction = "Close {$lang->productCommon}";
$lang->product->orderAction = "Sort {$lang->productCommon}";
$lang->product->exportAction = "Export {$lang->productCommon}";
$lang->product->indexAction = "All {$lang->productCommon}";
$lang->product->closeAction = "Close {$lang->productCommon}";
$lang->product->orderAction = "Sort {$lang->productCommon}";
$lang->product->exportAction = "Export {$lang->productCommon}";
$lang->product->link2Project = "Link Project";
$lang->product->basicInfo = 'Basic Info';
$lang->product->otherInfo = 'Other Info';
+1
View File
@@ -37,6 +37,7 @@ $lang->product->indexAction = "所有{$lang->productCommon}儀表盤";
$lang->product->closeAction = "關閉{$lang->productCommon}";
$lang->product->orderAction = "{$lang->productCommon}排序";
$lang->product->exportAction = "導出{$lang->productCommon}";
$lang->product->link2Project = "關聯項目";
$lang->product->basicInfo = '基本信息';
$lang->product->otherInfo = '其他信息';
+2 -2
View File
@@ -20,8 +20,8 @@
</div>
<?php if($config->systemMode == 'new'):?>
<div class="btn-toolbar pull-right">
<?php echo html::a('#link2Project', '<i class="icon-link"></i> ' . $lang->product->link2Project, '', "data-toggle='modal' class='btn btn-secondary'");?>
<?php common::printLink('project', 'createGuide', "programID=$product->program", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-primary" data-toggle="modal" data-target="#guideDialog"');?>
<?php if(common::hasPriv('project', 'manageProducts')) echo html::a('#link2Project', '<i class="icon-link"></i> ' . $lang->product->link2Project, '', "data-toggle='modal' class='btn btn-secondary'");?>
<?php if(common::hasPriv('project', 'create')) common::printLink('project', 'createGuide', "programID=$product->program", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-primary" data-toggle="modal" data-target="#guideDialog"');?>
</div>
<?php endif;?>
</div>
+1 -1
View File
@@ -29,7 +29,7 @@
<?php if(common::hasPriv('project', 'batchEdit') and $programType != 'bygrid') echo html::checkbox('editProject', array('1' => $lang->project->edit), '', $this->cookie->editProject ? 'checked=checked' : '');?>
</div>
<div class='pull-right'>
<?php common::printLink('project', 'createGuide', "programID=0&from=PGM", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-secondary" data-toggle="modal" data-target="#guideDialog"');?>
<?php if(common::hasPriv('project', 'create')) common::printLink('project', 'createGuide', "programID=0&from=PGM", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-secondary" data-toggle="modal" data-target="#guideDialog"');?>
<?php if(isset($lang->pageActions)) echo $lang->pageActions;?>
</div>
</div>
+1 -1
View File
@@ -30,7 +30,7 @@ js::set('browseType', $browseType);
<?php echo html::checkbox('involved ', array('1' => $lang->project->mine), '', $this->cookie->involved ? 'checked=checked' : '');?>
</div>
<div class="btn-toolbar pull-right">
<?php common::printLink('project', 'createGuide', "programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-primary" data-toggle="modal" data-target="#guideDialog"');?>
<?php if(common::hasPriv('project', 'create')) common::printLink('project', 'createGuide', "programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-primary" data-toggle="modal" data-target="#guideDialog"');?>
</div>
</div>
<div id='mainContent' class="main-row fade">
+19
View File
@@ -214,6 +214,25 @@ class project extends control
die($this->lang->project->unlinkExecutionMember);
}
/**
* Ajax get linked products with branch.
*
* @param int $projectID
* @access public
* @return void
*/
public function ajaxGetLinkedProductsWithBranch($projectID)
{
$productsWithBranch = array();
$linkedProducts = $this->project->getBranchesByProject($projectID);
foreach($linkedProducts as $productID => $branches)
{
foreach($branches as $branchID => $branchInfo) $productsWithBranch[$productID][$branchID] = $branchID;
}
die(json_encode($productsWithBranch));
}
/**
* Project index view.
*
+2 -2
View File
@@ -490,13 +490,13 @@ class projectModel extends model
* @access public
* @return object
*/
public function getPairsByProgram($programID = 0, $status = 'all', $isQueryAll = false, $orderBy = 'order_asc')
public function getPairsByProgram($programID = '', $status = 'all', $isQueryAll = false, $orderBy = 'order_asc')
{
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProjectPairs();
return $this->dao->select('id, name')->from(TABLE_PROJECT)
->where('type')->eq('project')
->andWhere('deleted')->eq(0)
->beginIF($programID)->andWhere('parent')->eq($programID)->fi()
->beginIF($programID !== '')->andWhere('parent')->eq($programID)->fi()
->beginIF($status != 'all' && $status != 'noclosed')->andWhere('status')->eq($status)->fi()
->beginIF($status == 'noclosed')->andWhere('status')->ne('closed')->fi()
->beginIF(!$this->app->user->admin and !$isQueryAll)->andWhere('id')->in($this->app->user->view->projects)->fi()
+2 -2
View File
@@ -48,7 +48,7 @@
</div>
<?php common::printLink('project', 'export', "status=$browseType&orderBy=$orderBy", "<i class='icon-export muted'> </i>" . $lang->export, '', "class='btn btn-link export'")?>
<?php if(!defined('TUTORIAL')):?>
<?php common::printLink('project', 'createGuide', "programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-primary create-project-btn" data-toggle="modal"');?>
<?php if(common::hasPriv('project', 'create')) common::printLink('project', 'createGuide', "programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-primary create-project-btn" data-toggle="modal"');?>
<?php else:?>
<?php common::printLink('project', 'create', "mode=scrum&programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-primary create-project-btn"');?>
<?php endif;?>
@@ -72,7 +72,7 @@
<p>
<span class="text-muted"><?php echo $lang->project->empty;?></span>
<?php if(!defined('TUTORIAL')):?>
<?php common::printLink('project', 'createGuide', "programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-info" data-toggle="modal"');?>
<?php if(common::hasPriv('project', 'create')) common::printLink('project', 'createGuide', "programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-info" data-toggle="modal"');?>
<?php elseif($this->config->systemMode == 'new'):?>
<?php common::printLink('project', 'create', "mode=scrum&programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-info"');?>
<?php else:?>
+9 -2
View File
@@ -17,14 +17,14 @@
<div class='row'>
<div class='col-xs-6'>
<div class='project-type text-center'>
<?php echo html::a($this->createLink("project", "create", "model=scrum&projectID=$projectID"), "<img class='project-type-img' data-type='scrum' src='{$config->webRoot}theme/default/images/main/scrum.png'>", '', "data-app='project'")?>
<?php echo html::a($this->createLink("project", "create", "model=scrum&projectID=$projectID"), "<img class='project-type-img' data-type='scrum' src='{$config->webRoot}theme/default/images/main/scrum.png'>", '', "data-app='project' class='createButton'")?>
<h3><?php echo $lang->project->scrum; ?></h3>
<p><?php echo $lang->project->scrumTitle; ?></p>
</div>
</div>
<div class='col-xs-6'>
<div class='project-type text-center'>
<?php echo html::a($this->createLink("project", "create", "model=waterfall&projectID=$projectID"), "<img class='project-type-img' data-type='waterfall' src='{$config->webRoot}theme/default/images/main/waterfall.png'>", '', "data-app='project'")?>
<?php echo html::a($this->createLink("project", "create", "model=waterfall&projectID=$projectID"), "<img class='project-type-img' data-type='waterfall' src='{$config->webRoot}theme/default/images/main/waterfall.png'>", '', "data-app='project' class='createButton'")?>
<h3><?php echo $lang->project->waterfall; ?></h3>
<p><?php echo $lang->project->waterfallTitle; ?></p>
</div>
@@ -33,3 +33,10 @@
</div>
</div>
</div>
<script>
$('.createButton').on('click', function()
{
$('#guideDialog').modal('hide');
window.location.reload();
});
</script>
+2 -2
View File
@@ -424,7 +424,7 @@ class task extends control
$tasks = $this->task->getParentTaskPairs($this->view->execution->id, $this->view->task->parent);
if(isset($tasks[$taskID])) unset($tasks[$taskID]);
if($this->config->systemMode == 'classic')
if($this->config->systemMode == 'classic')
{
$executionsPair = $this->execution->getPairs();
}
@@ -432,7 +432,7 @@ class task extends control
{
$executionsPair = array();
$executions = $this->execution->getByProject(0, 'all', 0);
$projects = $this->project->getPairsByProgram(0, 'noclosed');
$projects = $this->project->getPairsByProgram('', 'noclosed');
foreach($executions as $executionId => $execution)
{
$executionsPair[$executionId] = (isset($projects[$execution->project]) ? $projects[$execution->project] . ' / ' : '') . $execution->name;