* code for task #73471.

This commit is contained in:
wangyidong
2022-10-25 11:30:40 +08:00
parent f19271b276
commit 1a9aca53c0
7 changed files with 86 additions and 31 deletions

View File

@@ -1,5 +1,6 @@
<?php
$config->program = new stdclass();
$config->program->showAllProjects = 0;
$config->program->editor = new stdclass();
$config->program->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');

View File

@@ -10,6 +10,14 @@
*/
class program extends control
{
/**
* Construct
*
* @param string $moduleName
* @param string $methodName
* @access public
* @return void
*/
public function __construct($moduleName = '', $methodName = '')
{
parent::__construct($moduleName, $methodName);
@@ -757,4 +765,16 @@ class program extends control
echo $this->fetch('program', 'product', "programID=$programID");
}
/**
* Ajax set show setting.
*
* @access public
* @return void
*/
public function ajaxSetShowSetting()
{
$data = fixer::input('post')->get();
$this->loadModel('setting')->updateItem("{$this->app->user->account}.program.showAllProjects", $data->showAllProjects);
}
}

View File

@@ -26,3 +26,6 @@
.scroll {overflow-x: hidden; overflow-y: auto;}
.fix-table-copy-wrapper thead > tr > th:first-child {background: none!important;}
#showSettingsBox {text-align:right; margin-top:-15px; margin-right:4px;}
#showSettingsBox .checkbox-primary {display:inline-block;}

View File

@@ -131,9 +131,14 @@ function calcColHeight(col, lane, colCards, colHeight)
return colCards.length * 62;
}
$(function()
/**
* Init kanban.
*
* @access public
* @return void
*/
function initKanban()
{
/* Init all kanbans */
$.each(kanbanGroup, function(key, programsData)
{
var $kanban = $('#kanban-' + key);
@@ -146,4 +151,23 @@ $(function()
calcColHeight: calcColHeight
});
});
}
$(function()
{
/* Init all kanbans */
initKanban();
$('#showAllProjects').click(function()
{
var showAllProjects = $(this).prop('checked') ? 1 : 0;
$.post(createLink('program', 'ajaxSetShowSetting'), {"showAllProjects": showAllProjects}, function()
{
$.get(createLink('program', 'kanban'), function(data)
{
$('#kanbanList').html($(data).find('#kanbanList').html());
initKanban();
});
})
})
});

View File

@@ -82,6 +82,7 @@ $lang->program->manageMembers = '项目集团队';
$lang->program->confirmChangePRJUint = '是否同步更新该项目集下子项目集和项目的预算的单位?若确认更新,请填写今日汇率。';
$lang->program->exRateNotNegative = '『汇率』不能是负数。';
$lang->program->changePRJUnit = '更新项目预算单位';
$lang->program->showNotCurrentProjects = '显示非当前项目集的项目信息';
$lang->program->progress = '项目进度';
$lang->program->children = '添加子项目集';

View File

@@ -271,9 +271,8 @@ class programModel extends model
->fetchGroup('product');
/* Get all products linked projects. */
$projectGroup = $this->dao->select('DISTINCT t1.product, t2.id, t2.name, t2.status, t2.end')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')
->on('t1.project = t2.id')
$projectGroup = $this->dao->select('DISTINCT t1.product, t2.id, t2.name, t2.status, t2.end, t2.path')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->where('t2.deleted')->eq(0)
->andWhere('t1.product')->in($productPairs)
->andWhere('t2.type')->eq('project')
@@ -336,6 +335,7 @@ class programModel extends model
foreach($projects as $project)
{
if(helper::diffDate(helper::today(), $project->end) > 0) $project->delay = 1;
if(!$this->config->program->showAllProjects and strpos($project->path, ",{$product->program},") !== 0) continue;
$status = $project->status == 'wait' ? 'wait' : 'doing';
$execution = zget($doingExecutions, $project->id, array());

View File

@@ -11,12 +11,18 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kanban.html.php';?>
<?php if(empty($kanbanGroup)):?>
<div class="table-empty-tip cell">
<p class="text-muted"><?php echo $lang->program->noProgram;?></p>
<div id='showSettingsBox'>
<div class="checkbox-primary checkbox">
<input type="checkbox" value="1" id="showAllProjects" title="<?php echo $lang->program->showNotCurrentProjects;?>" <?php echo $config->program->showAllProjects ? 'checked' : '';?>>
<label for="showAllProjects"><?php echo $lang->program->showNotCurrentProjects;?></label>
</div>
</div>
<?php else:?>
<div id='kanbanList'>
<?php if(empty($kanbanGroup)):?>
<div class="table-empty-tip cell">
<p class="text-muted"><?php echo $lang->program->noProgram;?></p>
</div>
<?php else:?>
<?php foreach($kanbanGroup as $type => $programs):?>
<?php if(empty($programs)) continue;?>
<div class='panel kanban-panel'>
@@ -27,26 +33,26 @@
<div id='kanban-<?php echo $type;?>' class='kanban'></div>
</div>
</div>
<?php endforeach; ?>
<?php endforeach;?>
<?php
$kanbanColumns = array();
$kanbanColumns['unclosedProduct'] = array('name' => $lang->program->kanban->openProducts, 'type' => 'unclosedProduct');
$kanbanColumns['unexpiredPlan'] = array('name' => $lang->program->kanban->unexpiredPlans, 'type' => 'unexpiredPlan');
$kanbanColumns['waitProject'] = array('name' => $lang->program->kanban->waitingProjects, 'type' => 'waitProject');
$kanbanColumns['doingProject'] = array('name' => $lang->program->kanban->doingProjects, 'type' => 'doingProject');
$kanbanColumns['doingExecution'] = array('name' => $lang->program->kanban->doingExecutions, 'type' => 'doingExecution');
$kanbanColumns['normalRelease'] = array('name' => $lang->program->kanban->normalReleases, 'type' => 'normalRelease');
$userPrivs = array();
$userPrivs['product'] = common::hasPriv('product', 'browse');
$userPrivs['productplan'] = common::hasPriv('productplan', 'view');
$userPrivs['project'] = common::hasPriv('project', 'index');
$userPrivs['execution'] = common::hasPriv('execution', 'task');
$userPrivs['release'] = common::hasPriv('release', 'view');
js::set('kanbanColumns', array_values($kanbanColumns));
js::set('userPrivs', $userPrivs);
js::set('kanbanGroup', $kanbanGroup);
js::set('doingText', $lang->program->statusList['doing']);
?>
<?php endif;?>
</div>
<?php
$kanbanColumns = array();
$kanbanColumns['unclosedProduct'] = array('name' => $lang->program->kanban->openProducts, 'type' => 'unclosedProduct');
$kanbanColumns['unexpiredPlan'] = array('name' => $lang->program->kanban->unexpiredPlans, 'type' => 'unexpiredPlan');
$kanbanColumns['waitProject'] = array('name' => $lang->program->kanban->waitingProjects, 'type' => 'waitProject');
$kanbanColumns['doingProject'] = array('name' => $lang->program->kanban->doingProjects, 'type' => 'doingProject');
$kanbanColumns['doingExecution'] = array('name' => $lang->program->kanban->doingExecutions, 'type' => 'doingExecution');
$kanbanColumns['normalRelease'] = array('name' => $lang->program->kanban->normalReleases, 'type' => 'normalRelease');
$userPrivs = array();
$userPrivs['product'] = common::hasPriv('product', 'browse');
$userPrivs['productplan'] = common::hasPriv('productplan', 'view');
$userPrivs['project'] = common::hasPriv('project', 'index');
$userPrivs['execution'] = common::hasPriv('execution', 'task');
$userPrivs['release'] = common::hasPriv('release', 'view');
js::set('kanbanColumns', array_values($kanbanColumns));
js::set('userPrivs', $userPrivs);
js::set('kanbanGroup', $kanbanGroup);
js::set('doingText', $lang->program->statusList['doing']);
?>
<?php endif; ?>
<?php include '../../common/view/footer.html.php';?>