diff --git a/module/productplan/css/browse.css b/module/productplan/css/browse.css index 2b51775b97..807bae3ee4 100644 --- a/module/productplan/css/browse.css +++ b/module/productplan/css/browse.css @@ -39,3 +39,9 @@ td.c-branch {overflow: hidden; text-align: left !important; text-overflow: ellip #productplanList .c-actions .btn+.btn {margin-left: -1px;} #productplanList .c-actions .btn {display: block; float: left;} #productplanList td.c-actions .dividing-line {width: 1px; height: 16px; display: inline-block; vertical-align: middle; background: #F4F5F7; margin: 6px 0 0 0; float: left;} + +.popover.right {left: 40px; top: -5px; white-space: nowrap;} +.popover.right .popover-content {padding: 5px 20px 0px 0px;} +.execution-tip {list-style: none;} + +#taskPopover .arrow {margin-top: -55px;} diff --git a/module/productplan/js/browse.js b/module/productplan/js/browse.js index f9b4ea064d..6f7053c196 100644 --- a/module/productplan/js/browse.js +++ b/module/productplan/js/browse.js @@ -99,6 +99,26 @@ $(function() { $.zui.ContextMenu.hide(); }); + $('.project-popover').on('click', function(e) + { + e.stopPropagation(); + var showPopover = $(this).next().css('display') == 'block'; + $('.popover.right').hide(); + if(!showPopover) $(this).next().show(); + }); + + $('.project-link').on('click', function() + { + $('.popover.right').hide(); + }); + + /* Hide popover tip. */ + $(document).on('mousedown', function(e) + { + var $target = $(e.target); + var $toggle = $target.closest('.popover, .project-popover'); + if(!$toggle.length) $('.popover.right').hide(); + }); }); /* Define menu creators. */ diff --git a/module/productplan/model.php b/module/productplan/model.php index f2481a291c..80b2f9d75c 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -122,14 +122,14 @@ class productplanModel extends model foreach($planIdList as $planID) { - $planProjects[$planID] = $this->dao->select('t1.*,t2.type')->from(TABLE_PROJECTPRODUCT)->alias('t1') + $planProjects[$planID] = $this->dao->select('t1.project,t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id') ->where('t1.product')->eq($product) ->andWhere('t2.deleted')->eq(0) ->andWhere('t1.plan')->like(",$planID,") ->andWhere('t2.type')->in('sprint,stage,kanban') ->orderBy('project_desc') - ->fetch('project'); + ->fetchAll('project'); } $storyCountInTable = $this->dao->select('plan,count(story) as count')->from(TABLE_PLANSTORY)->where('plan')->in($planIdList)->groupBy('plan')->fetchPairs('plan', 'count'); @@ -159,12 +159,11 @@ class productplanModel extends model ->andWhere('deleted')->eq(0) ->fetchPairs('id', 'estimate'); } - $plan->stories = count($storyPairs); - $plan->bugs = isset($bugs[$plan->id]) ? count($bugs[$plan->id]) : 0; - $plan->hour = array_sum($storyPairs); - $plan->project = zget($planProjects, $plan->id, ''); - $plan->projectID = $plan->project; - $plan->expired = $plan->end < $date ? true : false; + $plan->stories = count($storyPairs); + $plan->bugs = isset($bugs[$plan->id]) ? count($bugs[$plan->id]) : 0; + $plan->hour = array_sum($storyPairs); + $plan->projects = zget($planProjects, $plan->id, ''); + $plan->expired = $plan->end < $date ? true : false; /* Sync linked stories. */ if(!isset($storyCountInTable[$plan->id]) or $storyCountInTable[$plan->id] != $plan->stories) diff --git a/module/productplan/view/browsebylist.html.php b/module/productplan/view/browsebylist.html.php index 8c9fab7c55..ae6636c586 100644 --- a/module/productplan/view/browsebylist.html.php +++ b/module/productplan/view/browsebylist.html.php @@ -145,7 +145,31 @@ stories;?> bugs;?> hour;?> - projectID)) echo html::a(helper::createLink('execution', 'task', 'projectID=' . $plan->projectID), '');?> + + projects)) + { + if(count($plan->projects) === 1) + { + $executionID = key($plan->projects); + echo html::a(helper::createLink('execution', 'task', "executionID=$executionID"), '', '', "title='{$plan->projects[$executionID]->name}'"); + } + else + { + $executionHtml = '
'; + $executionHtml .= '
'; + $executionHtml .= '
'; + $executionHtml .= ''; + $executionHtml .= '
'; + $executionHtml .= '
'; + echo ""; + echo $executionHtml; + } + } + ?> + ', '
', '
', '
'), "\n", str_replace(array("\n", "\r"), '', $plan->desc)), ''));?>