* Adjust recent.

This commit is contained in:
leiyong
2020-11-18 15:22:49 +08:00
parent ec6ced01d5
commit 455e828fce
10 changed files with 73 additions and 77 deletions
+7 -7
View File
@@ -541,7 +541,7 @@ class commonModel extends model
* @access public
* @return string
*/
public static function getRecentProjects()
public static function getRecentExecutions()
{
global $dbh, $lang, $app;
echo '<li><hr></li>';
@@ -555,16 +555,16 @@ class commonModel extends model
return false;
}
$recentProjects = $dbh->query('select * from ' . TABLE_PROJECT . " where type in ('stage','sprint') $extraWhere and status != 'close' and deleted = '0' order by id desc limit 6")->fetchAll();
$executions = $dbh->query('select id,name,code,project from ' . TABLE_PROJECT . " where type in ('stage','sprint') $extraWhere and status != 'closed' and code != '' and deleted = '0' order by id desc limit 6")->fetchAll();
if(!empty($recentProjects))
if(!empty($executions))
{
foreach($recentProjects as $key => $project)
foreach($executions as $index => $execution)
{
if($key == 5) continue;
echo '<li>' . html::a(helper::createLink('project', 'task', 'projectID=' . $project->id, '', false, $project->project), $project->name, '', "style='padding: 2px 8px 2px 2px;' class='main-recent-text' title='$project->name'") . '</li>';
if($index == 5) break;
echo '<li>' . html::a(helper::createLink('project', 'task', 'projectID=' . $execution->id, '', false, $execution->project), $execution->code, '', "style='padding: 2px 8px 2px 8px;' class='main-recent-text' title='$execution->name'") . '</li>';
}
if(count($recentProjects) > 5) echo '<li onclick="getMorePRJ();" id="loadMore" class="text-center"><span>' . $lang->more . '</span></li>';
if(count($executions) > 5) echo '<li onclick="getExecutions();" id="loadMore" class="text-center"><span>' . $lang->more . '</span></li>';
}
echo "</ul>\n";
+13 -13
View File
@@ -14,13 +14,13 @@ include 'chosen.html.php';
<div id='menu'>
<nav id='menuNav'>
<?php commonModel::printMainNav($app->rawModule);?>
<?php commonModel::getRecentProjects();?>
<?php commonModel::getRecentExecutions();?>
</nav>
<div id='menuFooter'>
<button type='button' id='menuToggle'><i class='icon icon-sm icon-menu-collapse'></i></button>
</div>
<div class="table-col col-right" id="morePRJ">
<div class="list-group" id="morePRJList"></div>
<div class="table-col col-right" id="moreExecution">
<div class="list-group" id="executionList"></div>
</div>
</div>
<header id='header'>
@@ -83,32 +83,32 @@ $("#searchInput").mouseout(function()
$("#menuToggle").bind('click', function()
{
$("#morePRJ").hide();
$("#moreExecution").hide();
});
$("#morePRJList").mouseover(function()
$("#executionList").mouseover(function()
{
$("#morePRJ").show();
$("#moreExecution").show();
});
$("#morePRJList").mouseout(function()
$("#executionList").mouseout(function()
{
$("#morePRJ").hide();
$("#moreExecution").hide();
});
function getMorePRJ()
function getExecutions()
{
$("#morePRJ").toggle();
if(!$("#morePRJ").is(':hidden'))
$("#moreExecution").toggle();
if(!$("#moreExecution").is(':hidden'))
{
$.ajax(
{
url: createLink('program', 'ajaxGetRecentProjects'),
url: createLink('project', 'ajaxGetRecentExecutions'),
dataType: 'html',
type: 'post',
success: function(data)
{
$("#morePRJList").html(data);
$("#executionList").html(data);
}
})
}
-1
View File
@@ -1,6 +1,5 @@
<?php
$config->program = new stdclass();
$config->program->PRJRecentQuantity = 15;
$config->program->editor = new stdclass();
$config->program->editor->pgmcreate = array('id' => 'desc', 'tools' => 'simpleTools');
+7 -27
View File
@@ -575,24 +575,6 @@ class program extends control
$this->display();
}
/**
* Gets the most recently created project.
*
* @access public
* @return string
*/
public function ajaxGetRecentProjects()
{
$recentProjects = $this->program->getPRJRecent();
if(!empty($recentProjects))
{
foreach($recentProjects as $project)
{
echo html::a(helper::createLink('project', 'task', 'projectID=' . $project->id, '', false, $project->project), '<i class="icon icon-menu-doc"></i>' . $project->name, '', "class='text-ellipsis' title='$project->name'");
}
}
}
/**
* Update program order.
*
@@ -1033,22 +1015,20 @@ class program extends control
$this->loadModel('user');
$this->loadModel('dept');
$project = $this->project->getById($projectID);
$users = $this->user->getPairs('noclosed|nodeleted|devfirst|nofeedback');
$roles = $this->user->getUserRoles(array_keys($users));
$deptUsers = empty($dept) ? array() : $this->dept->getDeptUserPairs($dept);
$project = $this->project->getById($projectID);
$users = $this->user->getPairs('noclosed|nodeleted|devfirst|nofeedback');
$roles = $this->user->getUserRoles(array_keys($users));
$deptUsers = $dept === '' ? array() : $this->dept->getDeptUserPairs($dept);
$title = $this->lang->program->PRJManageMembers . $this->lang->colon . $project->name;
$position[] = $this->lang->program->PRJManageMembers;
$this->view->title = $this->lang->program->PRJManageMembers . $this->lang->colon . $project->name;
$this->view->position[] = $this->lang->program->PRJManageMembers;
$this->view->title = $title;
$this->view->position = $position;
$this->view->project = $project;
$this->view->users = $users;
$this->view->deptUsers = $deptUsers;
$this->view->roles = $roles;
$this->view->dept = $dept;
$this->view->depts = array('' => '') + $this->loadModel('dept')->getOptionMenu();
$this->view->depts = array('' => '') + $this->dept->getOptionMenu();
$this->view->currentMembers = $this->project->getTeamMembers($projectID);;
$this->display();
}
-23
View File
@@ -975,29 +975,6 @@ class programModel extends model
->fetchPairs();
}
/**
* Get recent stage and sprint.
*
* @access public
* @return object
*/
public function getPRJRecent()
{
if(!$this->app->user->admin && (empty($this->app->user->view->sprints) || empty($this->app->user->view->projects)))
{
return array();
}
return $this->dao->select('id,project,name')->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('status')
->andWhere('deleted')->eq('0')
->orderBy('id_desc')
->limit('5,' . $this->config->program->PRJRecentQuantity)
->fetchAll();
}
/**
* Build the query.
*
+1 -4
View File
@@ -71,10 +71,7 @@ js::set('browseType', $browseType);
<?php
foreach($setting as $value)
{
if($value->show)
{
$this->datatable->printHead($value, $orderBy, $vars);
}
if($value->show) $this->datatable->printHead($value, $orderBy, $vars);
}
?>
</tr>
+1
View File
@@ -4,6 +4,7 @@ $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';
+19
View File
@@ -2327,6 +2327,25 @@ class project extends control
$this->display();
}
/**
* Get recent executions.
*
* @access public
* @return string
*/
public function ajaxGetRecentExecutions()
{
$executions = $this->project->getRecentExecutions();
if(!empty($executions))
{
foreach($executions as $execution)
{
$link = helper::createLink('project', 'task', 'projectID=' . $execution->id, '', false, $execution->project);
echo html::a($link, '<i class="icon icon-menu-doc"></i>' . $execution->code, '', "class='text-ellipsis' title='$execution->name'");
}
}
}
/**
* Update order.
*
+23
View File
@@ -3341,4 +3341,27 @@ class projectModel extends model
$products = $this->getProducts($projectID, $withBranch = false);
if(!empty($products)) $this->user->updateUserView(array_keys($products), 'product', $users);
}
/**
* Get recent executions.
*
* @access public
* @return object
*/
public function getRecentExecutions()
{
$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)
->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('code')->ne('')
->andWhere('deleted')->eq('0')
->orderBy('id_desc')
->limit('5,' . $this->config->project->recentQuantity)
->fetchAll();
}
}
+2 -2
View File
@@ -52,7 +52,7 @@ a.showMoreImage:hover {opacity: 1;}
#mainRecent {padding: 8px; line-height: 20px; cursor: pointer; color: #fff; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; -khtml-user-select: none; user-select:none;}
#loadMore {cursor:pointer;}
#morePRJ {display:none; max-height: 420px; position: fixed; bottom: 0; left: 100px; z-index: 999; background: white; padding: 20px 10px; height: 420px; margin-bottom: 40px; border: 1px solid #efefef}
#morePRJ > .list-group {height: 380px; min-width: 150px; max-width:200px;}
#moreExecution {display:none; max-height: 420px; position: fixed; bottom: 0; left: 100px; z-index: 999; background: white; padding: 20px 10px; height: 420px; margin-bottom: 40px; border: 1px solid #efefef}
#moreExecution > .list-group {height: 380px; min-width: 150px; max-width:200px;}
.main-recent-text{overflow: hidden; white-space: nowrap;}
.chosen-container .chosen-drop{z-index: 1100;}