* Finish task#9035.
This commit is contained in:
@@ -595,16 +595,16 @@ class commonModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get recent executions.
|
||||
* Print recent menu.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function getRecentExecutions()
|
||||
public static function printRecentMemu()
|
||||
{
|
||||
global $lang;
|
||||
echo "<li class='divider'></li>";
|
||||
echo '<li><a id="mainRecent" onclick="getExecutions();"><i class="icon icon-recent"></i><span class="text">' . $lang->recent . '</span></a></li>';
|
||||
echo '<li><a id="recentMenu"><i class="icon icon-recent"></i><span class="text">' . $lang->recent . '</span></a></li>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
body {padding-left: 96px}
|
||||
|
||||
#menu {position: fixed; left: 0; top: 0; bottom: 0; background-color: #3C495C; color: #fff; width: 96px; z-index: 1015;}
|
||||
#menu {position: fixed; left: 0; top: 0; bottom: 0; background-color: #3C495C; width: 96px; z-index: 1015;}
|
||||
#menuNav {position: absolute; top: 0; bottom: 80px; width: 100%;}
|
||||
#menu .nav > li {float: none; padding: 4px 8px;}
|
||||
#menu .nav > li > a {color: #fff; line-height: 20px; padding: 8px 6px; border-radius: 2px; white-space: nowrap;}
|
||||
@@ -24,9 +24,11 @@ body.menu-hide {padding-left: 0;}
|
||||
.menu-hide #menu .nav > li > a > .text {display: none}
|
||||
.menu-hide #menu .nav > li.has-avatar > a {padding: 2px 0;}
|
||||
|
||||
#moreExecution {display:none; max-height: 420px; position: fixed; bottom: 0; left: 96px; z-index: 999; background: white; padding: 20px 10px; height: 420px; margin-bottom: 40px; border: 1px solid #efefef}
|
||||
.menu-hide #moreExecution {left: 40px}
|
||||
#moreExecution > .list-group {height: 380px; min-width: 150px; max-width:200px;}
|
||||
#moreExecution {display:none; max-height: 380px; min-height: 140px; max-width:260px; min-width: 150px; position: fixed; bottom: 40px; z-index: 999; background: white; padding: 20px 10px; border: 1px solid #efefef}
|
||||
.more-execution-show {left: 96px;}
|
||||
.more-execution-hide {left: 40px;}
|
||||
#moreExecution .icon-search {opacity: 0.5;}
|
||||
#executionList {max-height: 280px; min-height: 100px; max-width:260px; min-width: 150px; margin-top: 5px;}
|
||||
|
||||
#pages {position: fixed; left: 96px; bottom: 0; right: 0; top: 0;}
|
||||
.page-tab {position: absolute; left: 0; bottom: 0; right: 0; top: 0; background-color: #efefef;}
|
||||
|
||||
@@ -449,9 +449,20 @@
|
||||
});
|
||||
|
||||
/* Hide execution list on mouseleave or click */
|
||||
$('#executionList').on('mouseleave click', function()
|
||||
$(document).click(function()
|
||||
{
|
||||
$('#moreExecution').hide();
|
||||
$("#moreExecution").hide();
|
||||
});
|
||||
|
||||
$("#recentMenu").click(function(event)
|
||||
{
|
||||
event.stopPropagation();
|
||||
getExecutions();
|
||||
});
|
||||
|
||||
$("#moreExecution").click(function(event)
|
||||
{
|
||||
event.stopPropagation();
|
||||
});
|
||||
});
|
||||
}());
|
||||
@@ -462,6 +473,15 @@ function getExecutions()
|
||||
var $moreExecution = $('#moreExecution').toggle();
|
||||
if(!$moreExecution.is(':hidden'))
|
||||
{
|
||||
if($('body').hasClass('menu-hide'))
|
||||
{
|
||||
$('#moreExecution').addClass('more-execution-hide');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#moreExecution').removeClass('more-execution-hide');
|
||||
}
|
||||
|
||||
$.ajax(
|
||||
{
|
||||
url: createLink('project', 'ajaxGetRecentExecutions'),
|
||||
|
||||
@@ -25,11 +25,18 @@ js::set('defaultOpen', $open);
|
||||
<ul class='nav nav-default' id='menuMainNav'>
|
||||
</ul>
|
||||
<ul class='nav nav-default'>
|
||||
<?php commonModel::getRecentExecutions();?>
|
||||
<?php commonModel::printRecentMemu();?>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="table-col col-right" id="moreExecution">
|
||||
<div class="list-group" id="executionList"></div>
|
||||
<div class="table-col col-right">
|
||||
<div id="moreExecution" class="more-execution-show" data-ride="searchList">
|
||||
<div class="input-control search-box has-icon-left has-icon-right search-example">
|
||||
<input id="userSearchBox" type="search" autocomplete="off" class="form-control search-input empty">
|
||||
<label for="userSearchBox" class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label>
|
||||
<a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a>
|
||||
</div>
|
||||
<div class="list-group" id="executionList"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='menuFooter'>
|
||||
<ul id="userNav" class="nav">
|
||||
|
||||
@@ -1144,6 +1144,23 @@ class programModel extends model
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project pairs by id list.
|
||||
*
|
||||
* @param array $projectIdList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPRJPairsByIdList($projectIdList = array())
|
||||
{
|
||||
return $this->dao->select('id, name')->from(TABLE_PROJECT)
|
||||
->where('type')->eq('project')
|
||||
->andWhere('deleted')->eq(0)
|
||||
->andWhere('id')->in($projectIdList)
|
||||
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi()
|
||||
->fetchPairs('id', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project team member pairs.
|
||||
*
|
||||
|
||||
@@ -4,7 +4,6 @@ $config->project->defaultWorkhours = '7.0';
|
||||
$config->project->orderBy = 'isDone,status,order_desc';
|
||||
$config->project->maxBurnDay = '31';
|
||||
$config->project->weekend = '2';
|
||||
$config->project->recentQuantity = 15;
|
||||
|
||||
$config->project->list = new stdclass();
|
||||
$config->project->list->exportFields = 'id,name,code,PM,end,status,totalEstimate,totalConsumed,totalLeft,progress';
|
||||
|
||||
@@ -2428,11 +2428,16 @@ class project extends control
|
||||
$executions = $this->project->getRecentExecutions();
|
||||
if(!empty($executions))
|
||||
{
|
||||
$executionsName = array();
|
||||
foreach($executions as $execution) $executionsName[] = $execution->name;
|
||||
$executionsPinYin = common::convert2Pinyin($executionsName);
|
||||
|
||||
foreach($executions as $execution)
|
||||
{
|
||||
$link = helper::createLink('project', 'task', 'projectID=' . $execution->id, '', false, $execution->project);
|
||||
$execution->code = empty($execution->code) ? $execution->name : $execution->code;
|
||||
echo html::a($link, '<i class="icon icon-menu-doc"></i>' . $execution->code, '', "class='text-ellipsis' title='$execution->name'");
|
||||
$dataKey = 'date-key="' . zget($executionsPinYin, $execution->name, $execution->name) . '"';
|
||||
echo html::a($link, '<i class="icon icon-' . $this->lang->icons[$execution->type] . '"></i> ' . $execution->code, '', "class='search-list-item' title='$execution->name' $dataKey");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3564,14 +3564,48 @@ class projectModel extends model
|
||||
$isView = (empty($this->app->user->view->sprints) || empty($this->app->user->view->projects)) ? false : true;
|
||||
if(!$this->app->user->admin && $isView === false) return array();
|
||||
|
||||
return $this->dao->select('id,project,code,name')->from(TABLE_PROJECT)
|
||||
$executions = $this->dao->select('id,project,code,name,type')->from(TABLE_PROJECT)
|
||||
->where('type')->in('stage,sprint')
|
||||
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->sprints)->fi()
|
||||
->beginIF(!$this->app->user->admin)->andWhere('project')->in($this->app->user->view->projects)->fi()
|
||||
->andWhere('status')->ne('closed')
|
||||
->andWhere('deleted')->eq('0')
|
||||
->orderBy('id_desc')
|
||||
->limit($this->config->project->recentQuantity)
|
||||
->fetchAll();
|
||||
|
||||
/* Get the project or product to which the execution belongs. */
|
||||
$projectIdList = array();
|
||||
$stageIdList = array();
|
||||
foreach($executions as $execution)
|
||||
{
|
||||
if($execution->type == 'stage') $stageIdList[$execution->id] = $execution->id;
|
||||
if($execution->type == 'sprint') $projectIdList[$execution->project] = $execution->project;
|
||||
}
|
||||
$projectPairs = $this->loadModel('program')->getPRJPairsByIdList($projectIdList);
|
||||
$productPairs = $this->getStageLinkProductPairs($stageIdList);
|
||||
|
||||
foreach($executions as $execution)
|
||||
{
|
||||
if($execution->type == 'stage') $execution->name = zget($productPairs, $execution->id) . '/' . $execution->name;
|
||||
if($execution->type == 'sprint') $execution->name = zget($projectPairs, $execution->project) . '/' . $execution->name;
|
||||
}
|
||||
|
||||
return $executions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the products associated with the stage.
|
||||
*
|
||||
* @param string $stageIdList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStageLinkProductPairs($stageIdList = array())
|
||||
{
|
||||
$productpairs = $this->dao->select('t1.project, t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
|
||||
->where('t1.project')->in($stageIdList)
|
||||
->fetchPairs('project', 'name');
|
||||
return $productpairs;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user