diff --git a/module/program/config.php b/module/program/config.php index 15afcb8278..410532db8d 100644 --- a/module/program/config.php +++ b/module/program/config.php @@ -1,5 +1,6 @@ program = new stdclass(); +$config->program->showAllProjects = 0; $config->program->editor = new stdclass(); $config->program->editor->create = array('id' => 'desc', 'tools' => 'simpleTools'); diff --git a/module/program/control.php b/module/program/control.php index 7aebc08e59..57555ca63f 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -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); + } } diff --git a/module/program/css/kanban.css b/module/program/css/kanban.css index 2491cb9326..af40ccb920 100644 --- a/module/program/css/kanban.css +++ b/module/program/css/kanban.css @@ -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;} diff --git a/module/program/js/kanban.js b/module/program/js/kanban.js index 11a5d3b128..396c71ba92 100644 --- a/module/program/js/kanban.js +++ b/module/program/js/kanban.js @@ -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(); + }); + }) + }) }); diff --git a/module/program/lang/zh-cn.php b/module/program/lang/zh-cn.php index a4fe75825b..e1cb4b1b7b 100644 --- a/module/program/lang/zh-cn.php +++ b/module/program/lang/zh-cn.php @@ -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 = '添加子项目集'; @@ -164,4 +165,4 @@ $lang->program->kanban->normalReleases = '正常的发布'; $lang->program->kanban->laneColorList = array('#32C5FF', '#006AF1', '#9D28B2', '#FF8F26', '#FFC20E', '#00A78E', '#7FBB00', '#424BAC', '#C0E9FF', '#EC2761'); -$lang->program->defaultProgram = '默认项目集'; \ No newline at end of file +$lang->program->defaultProgram = '默认项目集'; diff --git a/module/program/model.php b/module/program/model.php index 00b588a480..3466a9095f 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -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()); diff --git a/module/program/view/kanban.html.php b/module/program/view/kanban.html.php index 61a2cbb028..5d78a91675 100644 --- a/module/program/view/kanban.html.php +++ b/module/program/view/kanban.html.php @@ -11,12 +11,18 @@ ?> - -
program->noProgram;?>
+program->noProgram;?>
+