diff --git a/module/product/config.php b/module/product/config.php index 5f2be2d5cc..7e65607534 100644 --- a/module/product/config.php +++ b/module/product/config.php @@ -1,6 +1,7 @@ product = new stdclass(); -$config->product->orderBy = 'isClosed,program_asc,order_asc'; +$config->product->orderBy = 'isClosed,program_asc,order_asc'; +$config->product->showAllProjects = 0; $config->product->customBatchEditFields = 'line,PO,QD,RD,status,type,acl'; if($config->systemMode == 'new') $config->product->customBatchEditFields = 'program,' . $config->product->customBatchEditFields; diff --git a/module/product/control.php b/module/product/control.php index b13fcb690c..2e3997754e 100755 --- a/module/product/control.php +++ b/module/product/control.php @@ -1572,4 +1572,16 @@ class product extends control $this->view->projectProducts = isset($projectProducts) ? $projectProducts : array(); $this->display(); } + + /** + * Ajax set show setting. + * + * @access public + * @return void + */ + public function ajaxSetShowSetting() + { + $data = fixer::input('post')->get(); + $this->loadModel('setting')->updateItem("{$this->app->user->account}.product.showAllProjects", $data->showAllProjects); + } } diff --git a/module/product/css/kanban.css b/module/product/css/kanban.css new file mode 100644 index 0000000000..14266095ad --- /dev/null +++ b/module/product/css/kanban.css @@ -0,0 +1,2 @@ +#showSettingsBox {text-align:right; margin-top:-15px; margin-right:4px;} +#showSettingsBox .checkbox-primary {display:inline-block;} diff --git a/module/product/js/kanban.js b/module/product/js/kanban.js index 9f8ed6d341..73fe67015c 100644 --- a/module/product/js/kanban.js +++ b/module/product/js/kanban.js @@ -139,9 +139,14 @@ function calcColHeight(col, lane, colCards, colHeight) return colCards.length * 62; } -$(function() +/** + * Init kanban. + * + * @access public + * @return void + */ +function initKanban() { - /* Init all kanbans */ $.each(kanbanList, function(key, programsData) { var $kanban = $('#kanban-' + key); @@ -156,4 +161,23 @@ $(function() calcColHeight: calcColHeight }); }); +} + +$(function() +{ + /* Init all kanbans */ + initKanban(); + + $('#showAllProjects').click(function() + { + var showAllProjects = $(this).prop('checked') ? 1 : 0; + $.post(createLink('product', 'ajaxSetShowSetting'), {"showAllProjects": showAllProjects}, function() + { + $.get(createLink('product', 'kanban'), function(data) + { + $('#kanbanList').html($(data).find('#kanbanList').html()); + initKanban(); + }); + }) + }) }); diff --git a/module/product/model.php b/module/product/model.php index 3ecd794851..7a45c532ce 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -1895,7 +1895,7 @@ class productModel extends model $programList = $this->program->getTopPairs('', '', true); $projectList = $this->program->getProjectStats(0, 'doing'); - $projectProduct = $this->dao->select('t1.product,t1.project')->from(TABLE_PROJECTPRODUCT)->alias('t1') + $projectProduct = $this->dao->select('t1.product,t1.project,t2.parent,t2.path')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id') ->where('t1.product')->in(array_keys($productList)) ->andWhere('t1.project')->in($this->app->user->view->projects) @@ -1904,6 +1904,19 @@ class productModel extends model ->andWhere('t2.deleted')->eq('0') ->fetchGroup('product', 'project'); + if(!$this->config->product->showAllProjects) + { + foreach($projectProduct as $productID => $projects) + { + if(!isset($productList[$productID])) continue; + $product = $productList[$productID]; + foreach($projects as $projectID => $project) + { + if($project->parent != $product->program and strpos($project->path, ",{$product->program},") !== 0) unset($projectProduct[$productID][$projectID]); + } + } + } + $planList = $this->dao->select('id,product,title,parent,begin,end')->from(TABLE_PRODUCTPLAN) ->where('product')->in(array_keys($productList)) ->andWhere('deleted')->eq(0) @@ -1912,7 +1925,7 @@ class productModel extends model ->orderBy('begin desc') ->fetchGroup('product', 'id'); - $executionList = $this->dao->select('t1.product as productID,t2.*')->from(TABLE_PROJECTPRODUCT)->alias('t1') + $executionList = $this->dao->select('t1.product as productID,t2.*')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.project=t2.id') ->where('type')->in('stage,sprint,kanban') ->andWhere('t2.project')->in(array_keys($projectList)) diff --git a/module/product/view/kanban.html.php b/module/product/view/kanban.html.php index 3d0b1c270b..b87e1ccb5a 100644 --- a/module/product/view/kanban.html.php +++ b/module/product/view/kanban.html.php @@ -11,12 +11,18 @@ ?> - -
product->noProduct;?>
+product->noProduct;?>
+